svn commit: r348999 - in head: bin/stty share/man/man4 sys/dev/uart sys/dev/usb/serial sys/kern sys/sys
Author: shurd Date: Wed Jun 12 18:07:04 2019 New Revision: 348999 URL: https://svnweb.freebsd.org/changeset/base/348999 Log: Some devices take undesired actions when RTS and DTR are asserted. Some development boards for example will reset on DTR, and some radio interfaces will transmit on RTS. This patch allows "stty -f /dev/ttyu9.init -rtsdtr" to prevent RTS and DTR from being asserted on open(), allowing these devices to be used without problems. Reviewed by:imp Differential Revision: https://reviews.freebsd.org/D20031 Modified: head/bin/stty/modes.c head/bin/stty/print.c head/bin/stty/stty.1 head/share/man/man4/termios.4 head/sys/dev/uart/uart_tty.c head/sys/dev/usb/serial/umcs.c head/sys/dev/usb/serial/usb_serial.c head/sys/kern/tty.c head/sys/sys/_termios.h Modified: head/bin/stty/modes.c == --- head/bin/stty/modes.c Wed Jun 12 16:49:01 2019(r348998) +++ head/bin/stty/modes.c Wed Jun 12 18:07:04 2019(r348999) @@ -91,6 +91,8 @@ static const struct modes cmodes[] = { { "-rtsflow", 0, CRTS_IFLOW }, { "mdmbuf", MDMBUF, 0 }, { "-mdmbuf",0, MDMBUF }, + { "rtsdtr", 0, CNO_RTSDTR }, + { "-rtsdtr",CNO_RTSDTR, 0 }, { NULL, 0, 0 }, }; Modified: head/bin/stty/print.c == --- head/bin/stty/print.c Wed Jun 12 16:49:01 2019(r348998) +++ head/bin/stty/print.c Wed Jun 12 18:07:04 2019(r348999) @@ -184,6 +184,12 @@ print(struct termios *tp, struct winsize *wp, int ldis put("-dsrflow", CDSR_OFLOW, 0); put("-dtrflow", CDTR_IFLOW, 0); put("-mdmbuf", MDMBUF, 0); /* XXX mdmbuf == dtrflow */ + if (on(CNO_RTSDTR)) + bput("-rtsdtr"); + else { + if (fmt >= BSD) + bput("rtsdtr"); + } /* special control characters */ cc = tp->c_cc; Modified: head/bin/stty/stty.1 == --- head/bin/stty/stty.1Wed Jun 12 16:49:01 2019(r348998) +++ head/bin/stty/stty.1Wed Jun 12 18:07:04 2019(r348999) @@ -145,6 +145,8 @@ Assume a line without (with) modem control. .It Cm crtscts Pq Fl crtscts Enable (disable) RTS/CTS flow control. +.It Cm rtsdtr Pq Fl -rtsdtr +Enable (disable) asserting RTS/DTR on open. .El .Ss Input Modes: This corresponds to the c_iflag in the termios structure. Modified: head/share/man/man4/termios.4 == --- head/share/man/man4/termios.4 Wed Jun 12 16:49:01 2019 (r348998) +++ head/share/man/man4/termios.4 Wed Jun 12 18:07:04 2019 (r348999) @@ -1185,6 +1185,8 @@ flow control of output */ /* RTS flow control of input */ .It Dv MDMBUF /* flow control output via Carrier */ +.It Dv CNO_RTSDTR +/* Do not assert RTS or DTR automatically */ .El .Pp The @@ -1266,6 +1268,12 @@ If .Dv MDMBUF is set then output flow control is controlled by the state of Carrier Detect. +.Pp +If +.Dv CNO_RTSDTR +is set then the RTS and DTR lines will not be asserted when the device +is opened. +As a result, this flag is only useful on initial-state devices. .Pp If the object for which the control modes are set is not an asynchronous serial connection, some of the modes may be ignored; for example, if an Modified: head/sys/dev/uart/uart_tty.c == --- head/sys/dev/uart/uart_tty.cWed Jun 12 16:49:01 2019 (r348998) +++ head/sys/dev/uart/uart_tty.cWed Jun 12 18:07:04 2019 (r348999) @@ -285,13 +285,16 @@ uart_tty_param(struct tty *tp, struct termios *t) parity = UART_PARITY_NONE; if (UART_PARAM(sc, t->c_ospeed, databits, stopbits, parity) != 0) return (EINVAL); - UART_SETSIG(sc, SER_DDTR | SER_DTR); + if ((t->c_cflag & CNO_RTSDTR) == 0) + UART_SETSIG(sc, SER_DDTR | SER_DTR); /* Set input flow control state. */ if (!sc->sc_hwiflow) { if ((t->c_cflag & CRTS_IFLOW) && sc->sc_isquelch) UART_SETSIG(sc, SER_DRTS); - else - UART_SETSIG(sc, SER_DRTS | SER_RTS); + else { + if ((t->c_cflag & CNO_RTSDTR) == 0) + UART_SETSIG(sc, SER_DRTS | SER_RTS); + } } else UART_IOCTL(sc, UART_IOCTL_IFLOW, (t->c_cflag & CRTS_IFLOW)); /* Set output flow control state. */ Modified: head/sys/dev/usb/serial/umcs.c == --- head/sys/dev/usb/serial/umcs.c Wed Jun 12 16:49:01 2019
svn commit: r347542 - in stable/12: share/man/man4 sys/net
Author: shurd Date: Mon May 13 18:48:08 2019 New Revision: 347542 URL: https://svnweb.freebsd.org/changeset/base/347542 Log: MFC r346708: iflib: Better control over queue core assignment By default, cores are now assigned to queues in a sequential manner rather than all NICs starting at the first core. On a four-core system with two NICs each using two queue pairs, the nic:queue -> core mapping has changed from this: 0:0 -> 0, 0:1 -> 1 1:0 -> 0, 1:1 -> 1 To this: 0:0 -> 0, 0:1 -> 1 1:0 -> 2, 1:1 -> 3 Additionally, a device can now be configured to use separate cores for TX and RX queues. Two new tunables have been added, dev.X.Y.iflib.separate_txrx and dev.X.Y.iflib.core_offset. If core_offset is set, the NIC is not part of the auto-assigned sequence. Reviewed by: marius Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D20029 Modified: stable/12/share/man/man4/iflib.4 stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/iflib.4 == --- stable/12/share/man/man4/iflib.4Mon May 13 18:40:01 2019 (r347541) +++ stable/12/share/man/man4/iflib.4Mon May 13 18:48:08 2019 (r347542) @@ -55,6 +55,16 @@ If zero, the number of TX queues is derived from the n socket connected to the controller. .It Va disable_msix Disables MSI-X interrupts for the device. +.It Va core_offset +Specifies a starting core offset to assign queues to. +If the value is unspecified or 65535, cores are assigned sequentially across +controllers. +.It Va separate_txrx +Requests that RX and TX queues not be paired on the same core. +If this is zero or not set, an RX and TX queue pair will be assigned to each +core. +When set to a non-zero value, TX queues are assigned to cores following the +last RX queue. .El .Pp These Modified: stable/12/sys/net/iflib.c == --- stable/12/sys/net/iflib.c Mon May 13 18:40:01 2019(r347541) +++ stable/12/sys/net/iflib.c Mon May 13 18:48:08 2019(r347542) @@ -191,6 +191,9 @@ struct iflib_ctx { uint16_t ifc_sysctl_qs_eq_override; uint16_t ifc_sysctl_rx_budget; uint16_t ifc_sysctl_tx_abdicate; + uint16_t ifc_sysctl_core_offset; +#defineCORE_OFFSET_UNSPECIFIED 0x + uint8_t ifc_sysctl_separate_txrx; qidx_t ifc_sysctl_ntxds[8]; qidx_t ifc_sysctl_nrxds[8]; @@ -728,6 +731,18 @@ static void iflib_free_intr_mem(if_ctx_t ctx); static struct mbuf * iflib_fixup_rx(struct mbuf *m); #endif +static SLIST_HEAD(cpu_offset_list, cpu_offset) cpu_offsets = +SLIST_HEAD_INITIALIZER(cpu_offsets); +struct cpu_offset { + SLIST_ENTRY(cpu_offset) entries; + cpuset_tset; + unsigned intrefcount; + uint16_toffset; +}; +static struct mtx cpu_offset_mtx; +MTX_SYSINIT(iflib_cpu_offset, &cpu_offset_mtx, "iflib_cpu_offset lock", +MTX_DEF); + NETDUMP_DEFINE(iflib); #ifdef DEV_NETMAP @@ -4401,6 +4416,71 @@ iflib_reset_qvalues(if_ctx_t ctx) } } +static uint16_t +get_ctx_core_offset(if_ctx_t ctx) +{ + if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + struct cpu_offset *op; + uint16_t qc; + uint16_t ret = ctx->ifc_sysctl_core_offset; + + if (ret != CORE_OFFSET_UNSPECIFIED) + return (ret); + + if (ctx->ifc_sysctl_separate_txrx) + qc = scctx->isc_ntxqsets + scctx->isc_nrxqsets; + else + qc = max(scctx->isc_ntxqsets, scctx->isc_nrxqsets); + + mtx_lock(&cpu_offset_mtx); + SLIST_FOREACH(op, &cpu_offsets, entries) { + if (CPU_CMP(&ctx->ifc_cpus, &op->set) == 0) { + ret = op->offset; + op->offset += qc; + MPASS(op->refcount < UINT_MAX); + op->refcount++; + break; + } + } + if (ret == CORE_OFFSET_UNSPECIFIED) { + ret = 0; + op = malloc(sizeof(struct cpu_offset), M_IFLIB, + M_NOWAIT | M_ZERO); + if (op == NULL) { + device_printf(ctx->ifc_dev, + "allocation for cpu offset failed.\n"); + } else { + op->offset = qc; + op->refcount = 1; + CPU_COPY(&ctx->ifc_cpus, &op->set); + SLIST_INSERT_HEAD(&cpu_offsets, op, entries); + } + } + mtx_unlock(&cpu_offset_mtx); + + return (ret); +} + +static void +unref_ctx_core_offset(if_ctx_t ctx) +{ + struct cpu_offset *op, *top; + + mtx_lock(&cpu_offset_mtx); + SLIST_FOREACH_SAFE(op, &cpu_offsets, entries, top) { + if (CPU_CMP(&c
svn commit: r346708 - in head: share/man/man4 sys/net
Author: shurd Date: Thu Apr 25 21:24:56 2019 New Revision: 346708 URL: https://svnweb.freebsd.org/changeset/base/346708 Log: iflib: Better control over queue core assignment By default, cores are now assigned to queues in a sequential manner rather than all NICs starting at the first core. On a four-core system with two NICs each using two queue pairs, the nic:queue -> core mapping has changed from this: 0:0 -> 0, 0:1 -> 1 1:0 -> 0, 1:1 -> 1 To this: 0:0 -> 0, 0:1 -> 1 1:0 -> 2, 1:1 -> 3 Additionally, a device can now be configured to use separate cores for TX and RX queues. Two new tunables have been added, dev.X.Y.iflib.separate_txrx and dev.X.Y.iflib.core_offset. If core_offset is set, the NIC is not part of the auto-assigned sequence. Reviewed by: marius MFC after:2 weeks Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D20029 Modified: head/share/man/man4/iflib.4 head/sys/net/iflib.c Modified: head/share/man/man4/iflib.4 == --- head/share/man/man4/iflib.4 Thu Apr 25 21:09:07 2019(r346707) +++ head/share/man/man4/iflib.4 Thu Apr 25 21:24:56 2019(r346708) @@ -55,6 +55,16 @@ If zero, the number of TX queues is derived from the n socket connected to the controller. .It Va disable_msix Disables MSI-X interrupts for the device. +.It Va core_offset +Specifies a starting core offset to assign queues to. +If the value is unspecified or 65535, cores are assigned sequentially across +controllers. +.It Va separate_txrx +Requests that RX and TX queues not be paired on the same core. +If this is zero or not set, an RX and TX queue pair will be assigned to each +core. +When set to a non-zero value, TX queues are assigned to cores following the +last RX queue. .El .Pp These Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cThu Apr 25 21:09:07 2019(r346707) +++ head/sys/net/iflib.cThu Apr 25 21:24:56 2019(r346708) @@ -189,6 +189,9 @@ struct iflib_ctx { uint16_t ifc_sysctl_qs_eq_override; uint16_t ifc_sysctl_rx_budget; uint16_t ifc_sysctl_tx_abdicate; + uint16_t ifc_sysctl_core_offset; +#defineCORE_OFFSET_UNSPECIFIED 0x + uint8_t ifc_sysctl_separate_txrx; qidx_t ifc_sysctl_ntxds[8]; qidx_t ifc_sysctl_nrxds[8]; @@ -723,6 +726,18 @@ static void iflib_free_intr_mem(if_ctx_t ctx); static struct mbuf * iflib_fixup_rx(struct mbuf *m); #endif +static SLIST_HEAD(cpu_offset_list, cpu_offset) cpu_offsets = +SLIST_HEAD_INITIALIZER(cpu_offsets); +struct cpu_offset { + SLIST_ENTRY(cpu_offset) entries; + cpuset_tset; + unsigned intrefcount; + uint16_toffset; +}; +static struct mtx cpu_offset_mtx; +MTX_SYSINIT(iflib_cpu_offset, &cpu_offset_mtx, "iflib_cpu_offset lock", +MTX_DEF); + NETDUMP_DEFINE(iflib); #ifdef DEV_NETMAP @@ -4461,6 +4476,71 @@ iflib_rem_pfil(if_ctx_t ctx) pfil_head_unregister(pfil); } +static uint16_t +get_ctx_core_offset(if_ctx_t ctx) +{ + if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + struct cpu_offset *op; + uint16_t qc; + uint16_t ret = ctx->ifc_sysctl_core_offset; + + if (ret != CORE_OFFSET_UNSPECIFIED) + return (ret); + + if (ctx->ifc_sysctl_separate_txrx) + qc = scctx->isc_ntxqsets + scctx->isc_nrxqsets; + else + qc = max(scctx->isc_ntxqsets, scctx->isc_nrxqsets); + + mtx_lock(&cpu_offset_mtx); + SLIST_FOREACH(op, &cpu_offsets, entries) { + if (CPU_CMP(&ctx->ifc_cpus, &op->set) == 0) { + ret = op->offset; + op->offset += qc; + MPASS(op->refcount < UINT_MAX); + op->refcount++; + break; + } + } + if (ret == CORE_OFFSET_UNSPECIFIED) { + ret = 0; + op = malloc(sizeof(struct cpu_offset), M_IFLIB, + M_NOWAIT | M_ZERO); + if (op == NULL) { + device_printf(ctx->ifc_dev, + "allocation for cpu offset failed.\n"); + } else { + op->offset = qc; + op->refcount = 1; + CPU_COPY(&ctx->ifc_cpus, &op->set); + SLIST_INSERT_HEAD(&cpu_offsets, op, entries); + } + } + mtx_unlock(&cpu_offset_mtx); + + return (ret); +} + +static void +unref_ctx_core_offset(if_ctx_t ctx) +{ + struct cpu_offset *op, *top; + + mtx_lock(&cpu_offset_mtx); + SLIST_FOREACH_SAFE(op, &cpu_offsets, entries, top) { + if (CPU_CMP(&ctx->ifc_cpus, &op->set) == 0) { + MPASS(op
svn commit: r344472 - stable/11/sys/net
Author: shurd Date: Fri Feb 22 18:24:57 2019 New Revision: 344472 URL: https://svnweb.freebsd.org/changeset/base/344472 Log: MFC r333131: Fix iflib_encap() EFBIG handling bugs 1) Don't give up if m_collapse() fails. Rather than giving up, try m_defrag() immediately. 2) Fix a leak where, if the NIC driver rejected the defrag'ed chain as having too many segments, we would fail to free the chain. Reviewed by: Matthew Macy (this version of patch) Submitted by: Matthew Macy (early version of leak fix) Modified: stable/11/sys/net/iflib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/iflib.c == --- stable/11/sys/net/iflib.c Fri Feb 22 18:02:46 2019(r344471) +++ stable/11/sys/net/iflib.c Fri Feb 22 18:24:57 2019(r344472) @@ -3229,8 +3229,12 @@ defrag: switch (err) { case EFBIG: /* try collapse once and defrag once */ - if (remap == 0) + if (remap == 0) { m_head = m_collapse(*m_headp, M_NOWAIT, max_segs); + /* try defrag if collapsing fails */ + if (m_head == NULL) + remap++; + } if (remap == 1) m_head = m_defrag(*m_headp, M_NOWAIT); remap++; @@ -3318,13 +3322,18 @@ defrag: */ txq->ift_pidx = pi.ipi_new_pidx; txq->ift_npending += pi.ipi_ndescs; - } else if (__predict_false(err == EFBIG && remap < 2)) { + } else { *m_headp = m_head = iflib_remove_mbuf(txq); - remap = 1; - txq->ift_txd_encap_efbig++; - goto defrag; - } else + if (err == EFBIG) { + txq->ift_txd_encap_efbig++; + if (remap < 2) { + remap = 1; + goto defrag; + } + } DBG_COUNTER_INC(encap_txd_encap_fail); + goto defrag_failed; + } return (err); defrag_failed: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344471 - stable/12/sys/net
Author: shurd Date: Fri Feb 22 18:02:46 2019 New Revision: 344471 URL: https://svnweb.freebsd.org/changeset/base/344471 Log: MFC r344162: iflib: Improve return values of interrupt handlers. iflib was returning FILTER_HANDLED, in cases where FILTER_STRAY was more correct. This potentially caused issues with shared legacy interrupts. Driver filters returning FILTER_STRAY are now properly handled. Submitted by: Augustin Cavalier Reviewed by: marius, gallatin Obtained from:Haiku (a84bb9, 4947d1) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D19201 Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c == --- stable/12/sys/net/iflib.c Fri Feb 22 15:31:50 2019(r344470) +++ stable/12/sys/net/iflib.c Fri Feb 22 18:02:46 2019(r344471) @@ -1466,12 +1466,17 @@ iflib_fast_intr(void *arg) { iflib_filter_info_t info = arg; struct grouptask *gtask = info->ifi_task; + int result; + if (!iflib_started) - return (FILTER_HANDLED); + return (FILTER_STRAY); DBG_COUNTER_INC(fast_intrs); - if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) == FILTER_HANDLED) - return (FILTER_HANDLED); + if (info->ifi_filter != NULL) { + result = info->ifi_filter(info->ifi_filter_arg); + if ((result & FILTER_SCHEDULE_THREAD) == 0) + return (result); + } GROUPTASK_ENQUEUE(gtask); return (FILTER_HANDLED); @@ -1484,14 +1489,17 @@ iflib_fast_intr_rxtx(void *arg) struct grouptask *gtask = info->ifi_task; iflib_rxq_t rxq = (iflib_rxq_t)info->ifi_ctx; if_ctx_t ctx = NULL;; - int i, cidx; + int i, cidx, result; if (!iflib_started) - return (FILTER_HANDLED); + return (FILTER_STRAY); DBG_COUNTER_INC(fast_intrs); - if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) == FILTER_HANDLED) - return (FILTER_HANDLED); + if (info->ifi_filter != NULL) { + result = info->ifi_filter(info->ifi_filter_arg); + if ((result & FILTER_SCHEDULE_THREAD) == 0) + return (result); + } MPASS(rxq->ifr_ntxqirq); for (i = 0; i < rxq->ifr_ntxqirq; i++) { @@ -1526,13 +1534,17 @@ iflib_fast_intr_ctx(void *arg) { iflib_filter_info_t info = arg; struct grouptask *gtask = info->ifi_task; + int result; if (!iflib_started) - return (FILTER_HANDLED); + return (FILTER_STRAY); DBG_COUNTER_INC(fast_intrs); - if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) == FILTER_HANDLED) - return (FILTER_HANDLED); + if (info->ifi_filter != NULL) { + result = info->ifi_filter(info->ifi_filter_arg); + if ((result & FILTER_SCHEDULE_THREAD) == 0) + return (result); + } GROUPTASK_ENQUEUE(gtask); return (FILTER_HANDLED); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344162 - head/sys/net
Author: shurd Date: Fri Feb 15 18:51:43 2019 New Revision: 344162 URL: https://svnweb.freebsd.org/changeset/base/344162 Log: iflib: Improve return values of interrupt handlers. iflib was returning FILTER_HANDLED, in cases where FILTER_STRAY was more correct. This potentially caused issues with shared legacy interrupts. Driver filters returning FILTER_STRAY are now properly handled. Submitted by: Augustin Cavalier Reviewed by: marius, gallatin Obtained from:Haiku (a84bb9, 4947d1) MFC after:1 week Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D19201 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri Feb 15 18:28:51 2019(r344161) +++ head/sys/net/iflib.cFri Feb 15 18:51:43 2019(r344162) @@ -1468,12 +1468,17 @@ iflib_fast_intr(void *arg) { iflib_filter_info_t info = arg; struct grouptask *gtask = info->ifi_task; + int result; + if (!iflib_started) - return (FILTER_HANDLED); + return (FILTER_STRAY); DBG_COUNTER_INC(fast_intrs); - if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) == FILTER_HANDLED) - return (FILTER_HANDLED); + if (info->ifi_filter != NULL) { + result = info->ifi_filter(info->ifi_filter_arg); + if ((result & FILTER_SCHEDULE_THREAD) == 0) + return (result); + } GROUPTASK_ENQUEUE(gtask); return (FILTER_HANDLED); @@ -1488,15 +1493,18 @@ iflib_fast_intr_rxtx(void *arg) iflib_rxq_t rxq = (iflib_rxq_t)info->ifi_ctx; iflib_txq_t txq; void *sc; - int i, cidx; + int i, cidx, result; qidx_t txqid; if (!iflib_started) - return (FILTER_HANDLED); + return (FILTER_STRAY); DBG_COUNTER_INC(fast_intrs); - if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) == FILTER_HANDLED) - return (FILTER_HANDLED); + if (info->ifi_filter != NULL) { + result = info->ifi_filter(info->ifi_filter_arg); + if ((result & FILTER_SCHEDULE_THREAD) == 0) + return (result); + } ctx = rxq->ifr_ctx; sc = ctx->ifc_softc; @@ -1531,13 +1539,17 @@ iflib_fast_intr_ctx(void *arg) { iflib_filter_info_t info = arg; struct grouptask *gtask = info->ifi_task; + int result; if (!iflib_started) - return (FILTER_HANDLED); + return (FILTER_STRAY); DBG_COUNTER_INC(fast_intrs); - if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) == FILTER_HANDLED) - return (FILTER_HANDLED); + if (info->ifi_filter != NULL) { + result = info->ifi_filter(info->ifi_filter_arg); + if ((result & FILTER_SCHEDULE_THREAD) == 0) + return (result); + } GROUPTASK_ENQUEUE(gtask); return (FILTER_HANDLED); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r343441 - stable/12/sys/netinet
Author: shurd Date: Fri Jan 25 18:30:12 2019 New Revision: 343441 URL: https://svnweb.freebsd.org/changeset/base/343441 Log: MFC r343047: Fix window update issue when scaling disabled When the TCP window scale option is not used, and the window opens up enough in one soreceive, a window update will not be sent. For example, if recwin == 65535, so->so_rcv.sb_hiwat >= 262144, and so->so_rcv.sb_hiwat <= 524272, the window update will never be sent. This is because recwin and adv are clamped to TCP_MAXWIN << tp->rcv_scale, and so will never be >= so->so_rcv.sb_hiwat / 4 or <= so->so_rcv.sb_hiwat / 8. This patch ensures a window update is sent if the window opens by TCP_MAXWIN << tp->rcv_scale, which should only happen when the window size goes from zero to the max expressible. This issue looks like it was introduced in r306769 when recwin was clamped to TCP_MAXWIN << tp->rcv_scale. Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D18821 Modified: stable/12/sys/netinet/tcp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_output.c == --- stable/12/sys/netinet/tcp_output.c Fri Jan 25 17:09:26 2019 (r343440) +++ stable/12/sys/netinet/tcp_output.c Fri Jan 25 18:30:12 2019 (r343441) @@ -656,7 +656,8 @@ after_sack_rexmit: if (adv >= (int32_t)(2 * tp->t_maxseg) && (adv >= (int32_t)(so->so_rcv.sb_hiwat / 4) || recwin <= (so->so_rcv.sb_hiwat / 8) || -so->so_rcv.sb_hiwat <= 8 * tp->t_maxseg)) +so->so_rcv.sb_hiwat <= 8 * tp->t_maxseg || +adv >= TCP_MAXWIN << tp->rcv_scale)) goto send; if (2 * adv >= (int32_t)so->so_rcv.sb_hiwat) goto send; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r343099 - stable/11/sys/net
Author: shurd Date: Wed Jan 16 19:20:14 2019 New Revision: 343099 URL: https://svnweb.freebsd.org/changeset/base/343099 Log: MFC r342855: Use iflib_if_init_locked() during resume instead of iflib_init_locked(). iflib_init_locked() assumes that iflib_stop() has been called, however, it is not called for suspend. iflib_if_init_locked() calls stop then init, so fixes the problem. This was causing errors after a resume from suspend. PR: 224059 Reported by: zeising Sponsored by: Limelight Networks Modified: stable/11/sys/net/iflib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/iflib.c == --- stable/11/sys/net/iflib.c Wed Jan 16 15:19:09 2019(r343098) +++ stable/11/sys/net/iflib.c Wed Jan 16 19:20:14 2019(r343099) @@ -4540,7 +4540,7 @@ iflib_device_resume(device_t dev) CTX_LOCK(ctx); IFDI_RESUME(ctx); - iflib_init_locked(ctx); + iflib_if_init_locked(ctx); CTX_UNLOCK(ctx); for (int i = 0; i < NTXQSETS(ctx); i++, txq++) iflib_txq_check_drain(txq, IFLIB_RESTART_BUDGET); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r343047 - head/sys/netinet
Author: shurd Date: Tue Jan 15 17:40:19 2019 New Revision: 343047 URL: https://svnweb.freebsd.org/changeset/base/343047 Log: Fix window update issue when scaling disabled When the TCP window scale option is not used, and the window opens up enough in one soreceive, a window update will not be sent. For example, if recwin == 65535, so->so_rcv.sb_hiwat >= 262144, and so->so_rcv.sb_hiwat <= 524272, the window update will never be sent. This is because recwin and adv are clamped to TCP_MAXWIN << tp->rcv_scale, and so will never be >= so->so_rcv.sb_hiwat / 4 or <= so->so_rcv.sb_hiwat / 8. This patch ensures a window update is sent if the window opens by TCP_MAXWIN << tp->rcv_scale, which should only happen when the window size goes from zero to the max expressible. This issue looks like it was introduced in r306769 when recwin was clamped to TCP_MAXWIN << tp->rcv_scale. MFC after:1 week Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D18821 Modified: head/sys/netinet/tcp_output.c Modified: head/sys/netinet/tcp_output.c == --- head/sys/netinet/tcp_output.c Tue Jan 15 16:12:47 2019 (r343046) +++ head/sys/netinet/tcp_output.c Tue Jan 15 17:40:19 2019 (r343047) @@ -656,7 +656,8 @@ after_sack_rexmit: if (adv >= (int32_t)(2 * tp->t_maxseg) && (adv >= (int32_t)(so->so_rcv.sb_hiwat / 4) || recwin <= (so->so_rcv.sb_hiwat / 8) || -so->so_rcv.sb_hiwat <= 8 * tp->t_maxseg)) +so->so_rcv.sb_hiwat <= 8 * tp->t_maxseg || +adv >= TCP_MAXWIN << tp->rcv_scale)) goto send; if (2 * adv >= (int32_t)so->so_rcv.sb_hiwat) goto send; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r343024 - stable/12/sys/net
Author: shurd Date: Mon Jan 14 18:40:37 2019 New Revision: 343024 URL: https://svnweb.freebsd.org/changeset/base/343024 Log: MFC r342855: Use iflib_if_init_locked() during resume instead of iflib_init_locked(). iflib_init_locked() assumes that iflib_stop() has been called, however, it is not called for suspend. iflib_if_init_locked() calls stop then init, so fixes the problem. This was causing errors after a resume from suspend. PR: 224059 Reported by: zeising Sponsored by: Limelight Networks Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c == --- stable/12/sys/net/iflib.c Mon Jan 14 15:48:35 2019(r343023) +++ stable/12/sys/net/iflib.c Mon Jan 14 18:40:37 2019(r343024) @@ -5118,7 +5118,7 @@ iflib_device_resume(device_t dev) CTX_LOCK(ctx); IFDI_RESUME(ctx); - iflib_init_locked(ctx); + iflib_if_init_locked(ctx); CTX_UNLOCK(ctx); for (int i = 0; i < NTXQSETS(ctx); i++, txq++) iflib_txq_check_drain(txq, IFLIB_RESTART_BUDGET); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342855 - head/sys/net
Author: shurd Date: Mon Jan 7 23:46:54 2019 New Revision: 342855 URL: https://svnweb.freebsd.org/changeset/base/342855 Log: Use iflib_if_init_locked() during resume instead of iflib_init_locked(). iflib_init_locked() assumes that iflib_stop() has been called, however, it is not called for suspend. iflib_if_init_locked() calls stop then init, so fixes the problem. This was causing errors after a resume from suspend. PR: 224059 Reported by: zeising MFC after:1 week Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cMon Jan 7 23:17:09 2019(r342854) +++ head/sys/net/iflib.cMon Jan 7 23:46:54 2019(r342855) @@ -4894,7 +4894,7 @@ iflib_device_resume(device_t dev) CTX_LOCK(ctx); IFDI_RESUME(ctx); - iflib_init_locked(ctx); + iflib_if_init_locked(ctx); CTX_UNLOCK(ctx); for (int i = 0; i < NTXQSETS(ctx); i++, txq++) iflib_txq_check_drain(txq, IFLIB_RESTART_BUDGET); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342194 - stable/12/sys/net
Author: shurd Date: Tue Dec 18 17:31:31 2018 New Revision: 342194 URL: https://svnweb.freebsd.org/changeset/base/342194 Log: MFC r341824: Fix !tx_abdicate error from r336560 r336560 was supposed to restore pre-r323954 behaviour when tx_abdicate is not set (the default case). However, it appears that rather than the drainage check being made conditional on tx_abdicate being set, it was duplicated so it occured twice if tx_abdicate was set and once if it was not. Now when !tx_abdicate, drainage is only checked if the doorbell isn't pending. Reported by:lev Sponsored by: Limelight Networks Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c == --- stable/12/sys/net/iflib.c Tue Dec 18 17:17:53 2018(r342193) +++ stable/12/sys/net/iflib.c Tue Dec 18 17:31:31 2018(r342194) @@ -3798,7 +3798,6 @@ _task_fn_tx(void *context) */ if (abdicate) ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); - ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); if (ctx->ifc_flags & IFC_LEGACY) IFDI_INTR_ENABLE(ctx); else { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341824 - head/sys/net
Author: shurd Date: Tue Dec 11 17:46:01 2018 New Revision: 341824 URL: https://svnweb.freebsd.org/changeset/base/341824 Log: Fix !tx_abdicate error from r336560 r336560 was supposed to restore pre-r323954 behaviour when tx_abdicate is not set (the default case). However, it appears that rather than the drainage check being made conditional on tx_abdicate being set, it was duplicated so it occured twice if tx_abdicate was set and once if it was not. Now when !tx_abdicate, drainage is only checked if the doorbell isn't pending. Reported by:lev MFC after: 1 week Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue Dec 11 17:39:49 2018(r341823) +++ head/sys/net/iflib.cTue Dec 11 17:46:01 2018(r341824) @@ -3582,7 +3582,6 @@ _task_fn_tx(void *context) */ if (abdicate) ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); - ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); if (ctx->ifc_flags & IFC_LEGACY) IFDI_INTR_ENABLE(ctx); else { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341427 - in stable/12/sys/dev: ixgbe ixl
Author: shurd Date: Mon Dec 3 15:18:35 2018 New Revision: 341427 URL: https://svnweb.freebsd.org/changeset/base/341427 Log: MFC r341156: Fix first-packet completion The first packet after the ring is initialized was never completed as isc_txd_credits_update() would not include it in the count of completed packets. This caused netmap to never complete a batch. See PR 233022 for more details. This is the same fix as the r340310 for e1000 PR: 233607 Reported by: lev Reviewed by: lev Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D18368 Modified: stable/12/sys/dev/ixgbe/ix_txrx.c stable/12/sys/dev/ixl/ixl_txrx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixgbe/ix_txrx.c == --- stable/12/sys/dev/ixgbe/ix_txrx.c Mon Dec 3 15:14:40 2018 (r341426) +++ stable/12/sys/dev/ixgbe/ix_txrx.c Mon Dec 3 15:18:35 2018 (r341427) @@ -297,6 +297,8 @@ ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; Modified: stable/12/sys/dev/ixl/ixl_txrx.c == --- stable/12/sys/dev/ixl/ixl_txrx.cMon Dec 3 15:14:40 2018 (r341426) +++ stable/12/sys/dev/ixl/ixl_txrx.cMon Dec 3 15:18:35 2018 (r341427) @@ -516,7 +516,13 @@ ixl_isc_txd_credits_update_dwb(void *arg, uint16_t txq ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + /* +* XXX This appears to be a hack for first-packet. +* A correct fix would prevent prev == cur in the first place. +*/ MPASS(prev == 0 || delta != 0); + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; #if 0 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341156 - in head/sys/dev: ixgbe ixl
Author: shurd Date: Wed Nov 28 17:37:17 2018 New Revision: 341156 URL: https://svnweb.freebsd.org/changeset/base/341156 Log: Fix first-packet completion The first packet after the ring is initialized was never completed as isc_txd_credits_update() would not include it in the count of completed packets. This caused netmap to never complete a batch. See PR 233022 for more details. This is the same fix as the r340310 for e1000 PR: 233607 Reported by: lev Reviewed by: lev MFC after:3 days Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D18368 Modified: head/sys/dev/ixgbe/ix_txrx.c head/sys/dev/ixl/ixl_txrx.c Modified: head/sys/dev/ixgbe/ix_txrx.c == --- head/sys/dev/ixgbe/ix_txrx.cWed Nov 28 17:31:34 2018 (r341155) +++ head/sys/dev/ixgbe/ix_txrx.cWed Nov 28 17:37:17 2018 (r341156) @@ -297,6 +297,8 @@ ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; Modified: head/sys/dev/ixl/ixl_txrx.c == --- head/sys/dev/ixl/ixl_txrx.c Wed Nov 28 17:31:34 2018(r341155) +++ head/sys/dev/ixl/ixl_txrx.c Wed Nov 28 17:37:17 2018(r341156) @@ -516,7 +516,13 @@ ixl_isc_txd_credits_update_dwb(void *arg, uint16_t txq ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + /* +* XXX This appears to be a hack for first-packet. +* A correct fix would prevent prev == cur in the first place. +*/ MPASS(prev == 0 || delta != 0); + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; #if 0 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340735 - releng/12.0/sys/net
Author: shurd Date: Wed Nov 21 17:33:19 2018 New Revision: 340735 URL: https://svnweb.freebsd.org/changeset/base/340735 Log: MFS r340729: Prevent POLA violation with TSO/CSUM offload Ensure that any time CSUM_IP_TSO or CSUM_IP6_TSO is set that the corresponding CSUM_IP6?_TCP / CSUM_IP flags are also set. Approved by: re (gjb) Sponsored by: Limelight Networks Modified: releng/12.0/sys/net/iflib.c Directory Properties: releng/12.0/ (props changed) Modified: releng/12.0/sys/net/iflib.c == --- releng/12.0/sys/net/iflib.c Wed Nov 21 17:32:09 2018(r340734) +++ releng/12.0/sys/net/iflib.c Wed Nov 21 17:33:19 2018(r340735) @@ -2974,9 +2974,6 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, pi->ipi_ipproto = ip->ip_p; pi->ipi_flags |= IPI_TX_IPV4; - if ((sctx->isc_flags & IFLIB_NEED_ZERO_CSUM) && (pi->ipi_csum_flags & CSUM_IP)) - ip->ip_sum = 0; - /* TCP checksum offload may require TCP header length */ if (IS_TX_OFFLOAD4(pi)) { if (__predict_true(pi->ipi_ipproto == IPPROTO_TCP)) { @@ -2993,6 +2990,10 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, if (IS_TSO4(pi)) { if (__predict_false(ip->ip_p != IPPROTO_TCP)) return (ENXIO); + /* +* TSO always requires hardware checksum offload. +*/ + pi->ipi_csum_flags |= (CSUM_IP_TCP | CSUM_IP); th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); pi->ipi_tso_segsz = m->m_pkthdr.tso_segsz; @@ -3002,6 +3003,9 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, } } } + if ((sctx->isc_flags & IFLIB_NEED_ZERO_CSUM) && (pi->ipi_csum_flags & CSUM_IP)) + ip->ip_sum = 0; + break; } #endif @@ -3039,9 +3043,7 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, if (__predict_false(ip6->ip6_nxt != IPPROTO_TCP)) return (ENXIO); /* -* The corresponding flag is set by the stack in the IPv4 -* TSO case, but not in IPv6 (at least in FreeBSD 10.2). -* So, set it here because the rest of the flow requires it. +* TSO always requires hardware checksum offload. */ pi->ipi_csum_flags |= CSUM_IP6_TCP; th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340729 - stable/12/sys/net
Author: shurd Date: Wed Nov 21 17:14:57 2018 New Revision: 340729 URL: https://svnweb.freebsd.org/changeset/base/340729 Log: MFC r340435: Prevent POLA violation with TSO/CSUM offload Ensure that any time CSUM_IP_TSO or CSUM_IP6_TSO is set that the corresponding CSUM_IP6?_TCP / CSUM_IP flags are also set. Rather than requireing drivers to bake-in an understanding that TSO implies checksum offloads, make it explicit. This change requires us to move the IFLIB_NEED_ZERO_CSUM implementation to ensure it's zeroed for TSO. Reported by: Jacob Keller Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17801 Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c == --- stable/12/sys/net/iflib.c Wed Nov 21 17:07:07 2018(r340728) +++ stable/12/sys/net/iflib.c Wed Nov 21 17:14:57 2018(r340729) @@ -2974,9 +2974,6 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, pi->ipi_ipproto = ip->ip_p; pi->ipi_flags |= IPI_TX_IPV4; - if ((sctx->isc_flags & IFLIB_NEED_ZERO_CSUM) && (pi->ipi_csum_flags & CSUM_IP)) - ip->ip_sum = 0; - /* TCP checksum offload may require TCP header length */ if (IS_TX_OFFLOAD4(pi)) { if (__predict_true(pi->ipi_ipproto == IPPROTO_TCP)) { @@ -2993,6 +2990,10 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, if (IS_TSO4(pi)) { if (__predict_false(ip->ip_p != IPPROTO_TCP)) return (ENXIO); + /* +* TSO always requires hardware checksum offload. +*/ + pi->ipi_csum_flags |= (CSUM_IP_TCP | CSUM_IP); th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); pi->ipi_tso_segsz = m->m_pkthdr.tso_segsz; @@ -3002,6 +3003,9 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, } } } + if ((sctx->isc_flags & IFLIB_NEED_ZERO_CSUM) && (pi->ipi_csum_flags & CSUM_IP)) + ip->ip_sum = 0; + break; } #endif @@ -3039,9 +3043,7 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, if (__predict_false(ip6->ip6_nxt != IPPROTO_TCP)) return (ENXIO); /* -* The corresponding flag is set by the stack in the IPv4 -* TSO case, but not in IPv6 (at least in FreeBSD 10.2). -* So, set it here because the rest of the flow requires it. +* TSO always requires hardware checksum offload. */ pi->ipi_csum_flags |= CSUM_IP6_TCP; th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340634 - releng/12.0/sys/net
Author: shurd Date: Mon Nov 19 16:40:19 2018 New Revision: 340634 URL: https://svnweb.freebsd.org/changeset/base/340634 Log: MFS r340629 r340434: Fix leaks caused by ifc_nhwtxqs never being initialized (broken by r333502) and clear the last ring in the case where isc_nfl != isc_nrxqs r340445: Clear RX completion queue state variables in iflib_stop() Approved by: re (gjb) Sponsored by: Limelight Networks Modified: releng/12.0/sys/net/iflib.c Directory Properties: releng/12.0/ (props changed) Modified: releng/12.0/sys/net/iflib.c == --- releng/12.0/sys/net/iflib.c Mon Nov 19 15:49:39 2018(r340633) +++ releng/12.0/sys/net/iflib.c Mon Nov 19 16:40:19 2018(r340634) @@ -175,8 +175,6 @@ struct iflib_ctx { struct sx ifc_ctx_sx; struct mtx ifc_state_mtx; - uint16_t ifc_nhwtxqs; - iflib_txq_t ifc_txqs; iflib_rxq_t ifc_rxqs; uint32_t ifc_if_flags; @@ -1771,6 +1769,7 @@ iflib_txq_setup(iflib_txq_t txq) { if_ctx_t ctx = txq->ift_ctx; if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + if_shared_ctx_t sctx = ctx->ifc_sctx; iflib_dma_info_t di; int i; @@ -1784,11 +1783,11 @@ iflib_txq_setup(iflib_txq_t txq) txq->ift_pidx = txq->ift_cidx = txq->ift_npending = 0; txq->ift_size = scctx->isc_ntxd[txq->ift_br_offset]; - for (i = 0, di = txq->ift_ifdi; i < ctx->ifc_nhwtxqs; i++, di++) + for (i = 0, di = txq->ift_ifdi; i < sctx->isc_ntxqs; i++, di++) bzero((void *)di->idi_vaddr, di->idi_size); IFDI_TXQ_SETUP(ctx, txq->ift_id); - for (i = 0, di = txq->ift_ifdi; i < ctx->ifc_nhwtxqs; i++, di++) + for (i = 0, di = txq->ift_ifdi; i < sctx->isc_ntxqs; i++, di++) bus_dmamap_sync(di->idi_tag, di->idi_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); @@ -2375,6 +2374,7 @@ iflib_stop(if_ctx_t ctx) iflib_txq_t txq = ctx->ifc_txqs; iflib_rxq_t rxq = ctx->ifc_rxqs; if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + if_shared_ctx_t sctx = ctx->ifc_sctx; iflib_dma_info_t di; iflib_fl_t fl; int i, j; @@ -2408,13 +2408,14 @@ iflib_stop(if_ctx_t ctx) txq->ift_no_tx_dma_setup = txq->ift_txd_encap_efbig = txq->ift_map_failed = 0; txq->ift_pullups = 0; ifmp_ring_reset_stats(txq->ift_br); - for (j = 0, di = txq->ift_ifdi; j < ctx->ifc_nhwtxqs; j++, di++) + for (j = 0, di = txq->ift_ifdi; j < sctx->isc_ntxqs; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); } for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { /* make sure all transmitters have completed before proceeding XXX */ - for (j = 0, di = rxq->ifr_ifdi; j < rxq->ifr_nfl; j++, di++) + rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; + for (j = 0, di = rxq->ifr_ifdi; j < sctx->isc_nrxqs; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); /* also resets the free lists pidx/cidx */ for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) @@ -5516,11 +5517,12 @@ static void iflib_tx_structures_free(if_ctx_t ctx) { iflib_txq_t txq = ctx->ifc_txqs; + if_shared_ctx_t sctx = ctx->ifc_sctx; int i, j; for (i = 0; i < NTXQSETS(ctx); i++, txq++) { iflib_txq_destroy(txq); - for (j = 0; j < ctx->ifc_nhwtxqs; j++) + for (j = 0; j < sctx->isc_ntxqs; j++) iflib_dma_free(&txq->ift_ifdi[j]); } free(ctx->ifc_txqs, M_IFLIB); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340629 - stable/12/sys/net
Author: shurd Date: Mon Nov 19 15:18:30 2018 New Revision: 340629 URL: https://svnweb.freebsd.org/changeset/base/340629 Log: MFC r340434, r340445 r340434: Fix leaks caused by ifc_nhwtxqs never being initialized r333502 removed initialization of ifc_nhwtxqs, and it's not clear there's a need to copy it into the struct iflib_ctx at all. Use ctx->ifc_sctx->isc_ntxqs instead. Further, iflib_stop() did not clear the last ring in the case where isc_nfl != isc_nrxqs (such as when IFLIB_HAS_RXCQ is set). Use ctx->ifc_sctx->isc_nrxqs here instead of isc_nfl. Reported by: pkelsey Reviewed by: pkelsey Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17979 r340445: Clear RX completion queue state veriables in iflib_stop() iflib_stop() was not resetting the rxq completion queue state variables. This meant that for any driver that has receive completion queues, after a reinit, iflib would start asking what's available on the rx side starting at whatever the completion queue index was prior to the stop, instead of at 0. Submitted by: pkelsey Reported by: pkelsey Sponsored by: Limelight Networks Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c == --- stable/12/sys/net/iflib.c Mon Nov 19 14:19:27 2018(r340628) +++ stable/12/sys/net/iflib.c Mon Nov 19 15:18:30 2018(r340629) @@ -175,8 +175,6 @@ struct iflib_ctx { struct sx ifc_ctx_sx; struct mtx ifc_state_mtx; - uint16_t ifc_nhwtxqs; - iflib_txq_t ifc_txqs; iflib_rxq_t ifc_rxqs; uint32_t ifc_if_flags; @@ -1771,6 +1769,7 @@ iflib_txq_setup(iflib_txq_t txq) { if_ctx_t ctx = txq->ift_ctx; if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + if_shared_ctx_t sctx = ctx->ifc_sctx; iflib_dma_info_t di; int i; @@ -1784,11 +1783,11 @@ iflib_txq_setup(iflib_txq_t txq) txq->ift_pidx = txq->ift_cidx = txq->ift_npending = 0; txq->ift_size = scctx->isc_ntxd[txq->ift_br_offset]; - for (i = 0, di = txq->ift_ifdi; i < ctx->ifc_nhwtxqs; i++, di++) + for (i = 0, di = txq->ift_ifdi; i < sctx->isc_ntxqs; i++, di++) bzero((void *)di->idi_vaddr, di->idi_size); IFDI_TXQ_SETUP(ctx, txq->ift_id); - for (i = 0, di = txq->ift_ifdi; i < ctx->ifc_nhwtxqs; i++, di++) + for (i = 0, di = txq->ift_ifdi; i < sctx->isc_ntxqs; i++, di++) bus_dmamap_sync(di->idi_tag, di->idi_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); @@ -2375,6 +2374,7 @@ iflib_stop(if_ctx_t ctx) iflib_txq_t txq = ctx->ifc_txqs; iflib_rxq_t rxq = ctx->ifc_rxqs; if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + if_shared_ctx_t sctx = ctx->ifc_sctx; iflib_dma_info_t di; iflib_fl_t fl; int i, j; @@ -2408,13 +2408,14 @@ iflib_stop(if_ctx_t ctx) txq->ift_no_tx_dma_setup = txq->ift_txd_encap_efbig = txq->ift_map_failed = 0; txq->ift_pullups = 0; ifmp_ring_reset_stats(txq->ift_br); - for (j = 0, di = txq->ift_ifdi; j < ctx->ifc_nhwtxqs; j++, di++) + for (j = 0, di = txq->ift_ifdi; j < sctx->isc_ntxqs; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); } for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { /* make sure all transmitters have completed before proceeding XXX */ - for (j = 0, di = rxq->ifr_ifdi; j < rxq->ifr_nfl; j++, di++) + rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; + for (j = 0, di = rxq->ifr_ifdi; j < sctx->isc_nrxqs; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); /* also resets the free lists pidx/cidx */ for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) @@ -5516,11 +5517,12 @@ static void iflib_tx_structures_free(if_ctx_t ctx) { iflib_txq_t txq = ctx->ifc_txqs; + if_shared_ctx_t sctx = ctx->ifc_sctx; int i, j; for (i = 0; i < NTXQSETS(ctx); i++, txq++) { iflib_txq_destroy(txq); - for (j = 0; j < ctx->ifc_nhwtxqs; j++) + for (j = 0; j < sctx->isc_ntxqs; j++) iflib_dma_free(&txq->ift_ifdi[j]); } free(ctx->ifc_txqs, M_IFLIB); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340445 - head/sys/net
Author: shurd Date: Wed Nov 14 20:36:18 2018 New Revision: 340445 URL: https://svnweb.freebsd.org/changeset/base/340445 Log: Clear RX completion queue state veriables in iflib_stop() iflib_stop() was not resetting the rxq completion queue state variables. This meant that for any driver that has receive completion queues, after a reinit, iflib would start asking what's available on the rx side starting at whatever the completion queue index was prior to the stop, instead of at 0. Submitted by: pkelsey Reported by: pkelsey MFC after:3 days Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Nov 14 20:35:04 2018(r340444) +++ head/sys/net/iflib.cWed Nov 14 20:36:18 2018(r340445) @@ -2414,6 +2414,7 @@ iflib_stop(if_ctx_t ctx) for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { /* make sure all transmitters have completed before proceeding XXX */ + rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; for (j = 0, di = rxq->ifr_ifdi; j < sctx->isc_nrxqs; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); /* also resets the free lists pidx/cidx */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340435 - head/sys/net
Author: shurd Date: Wed Nov 14 15:23:39 2018 New Revision: 340435 URL: https://svnweb.freebsd.org/changeset/base/340435 Log: Prevent POLA violation with TSO/CSUM offload Ensure that any time CSUM_IP_TSO or CSUM_IP6_TSO is set that the corresponding CSUM_IP6?_TCP / CSUM_IP flags are also set. Rather than requireing drivers to bake-in an understanding that TSO implies checksum offloads, make it explicit. This change requires us to move the IFLIB_NEED_ZERO_CSUM implementation to ensure it's zeroed for TSO. Reported by: Jacob Keller MFC after:1 week Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17801 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Nov 14 15:16:45 2018(r340434) +++ head/sys/net/iflib.cWed Nov 14 15:23:39 2018(r340435) @@ -2973,9 +2973,6 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, pi->ipi_ipproto = ip->ip_p; pi->ipi_flags |= IPI_TX_IPV4; - if ((sctx->isc_flags & IFLIB_NEED_ZERO_CSUM) && (pi->ipi_csum_flags & CSUM_IP)) - ip->ip_sum = 0; - /* TCP checksum offload may require TCP header length */ if (IS_TX_OFFLOAD4(pi)) { if (__predict_true(pi->ipi_ipproto == IPPROTO_TCP)) { @@ -2992,6 +2989,10 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, if (IS_TSO4(pi)) { if (__predict_false(ip->ip_p != IPPROTO_TCP)) return (ENXIO); + /* +* TSO always requires hardware checksum offload. +*/ + pi->ipi_csum_flags |= (CSUM_IP_TCP | CSUM_IP); th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); pi->ipi_tso_segsz = m->m_pkthdr.tso_segsz; @@ -3001,6 +3002,9 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, } } } + if ((sctx->isc_flags & IFLIB_NEED_ZERO_CSUM) && (pi->ipi_csum_flags & CSUM_IP)) + ip->ip_sum = 0; + break; } #endif @@ -3038,9 +3042,7 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, if (__predict_false(ip6->ip6_nxt != IPPROTO_TCP)) return (ENXIO); /* -* The corresponding flag is set by the stack in the IPv4 -* TSO case, but not in IPv6 (at least in FreeBSD 10.2). -* So, set it here because the rest of the flow requires it. +* TSO always requires hardware checksum offload. */ pi->ipi_csum_flags |= CSUM_IP6_TCP; th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340434 - head/sys/net
Author: shurd Date: Wed Nov 14 15:16:45 2018 New Revision: 340434 URL: https://svnweb.freebsd.org/changeset/base/340434 Log: Fix leaks caused by ifc_nhwtxqs never being initialized r333502 removed initialization of ifc_nhwtxqs, and it's not clear there's a need to copy it into the struct iflib_ctx at all. Use ctx->ifc_sctx->isc_ntxqs instead. Further, iflib_stop() did not clear the last ring in the case where isc_nfl != isc_nrxqs (such as when IFLIB_HAS_RXCQ is set). Use ctx->ifc_sctx->isc_nrxqs here instead of isc_nfl. Reported by: pkelsey Reviewed by: pkelsey MFC after:3 days Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17979 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Nov 14 15:15:07 2018(r340433) +++ head/sys/net/iflib.cWed Nov 14 15:16:45 2018(r340434) @@ -175,8 +175,6 @@ struct iflib_ctx { struct sx ifc_ctx_sx; struct mtx ifc_state_mtx; - uint16_t ifc_nhwtxqs; - iflib_txq_t ifc_txqs; iflib_rxq_t ifc_rxqs; uint32_t ifc_if_flags; @@ -1771,6 +1769,7 @@ iflib_txq_setup(iflib_txq_t txq) { if_ctx_t ctx = txq->ift_ctx; if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + if_shared_ctx_t sctx = ctx->ifc_sctx; iflib_dma_info_t di; int i; @@ -1784,11 +1783,11 @@ iflib_txq_setup(iflib_txq_t txq) txq->ift_pidx = txq->ift_cidx = txq->ift_npending = 0; txq->ift_size = scctx->isc_ntxd[txq->ift_br_offset]; - for (i = 0, di = txq->ift_ifdi; i < ctx->ifc_nhwtxqs; i++, di++) + for (i = 0, di = txq->ift_ifdi; i < sctx->isc_ntxqs; i++, di++) bzero((void *)di->idi_vaddr, di->idi_size); IFDI_TXQ_SETUP(ctx, txq->ift_id); - for (i = 0, di = txq->ift_ifdi; i < ctx->ifc_nhwtxqs; i++, di++) + for (i = 0, di = txq->ift_ifdi; i < sctx->isc_ntxqs; i++, di++) bus_dmamap_sync(di->idi_tag, di->idi_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); @@ -2375,6 +2374,7 @@ iflib_stop(if_ctx_t ctx) iflib_txq_t txq = ctx->ifc_txqs; iflib_rxq_t rxq = ctx->ifc_rxqs; if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + if_shared_ctx_t sctx = ctx->ifc_sctx; iflib_dma_info_t di; iflib_fl_t fl; int i, j; @@ -2408,13 +2408,13 @@ iflib_stop(if_ctx_t ctx) txq->ift_no_tx_dma_setup = txq->ift_txd_encap_efbig = txq->ift_map_failed = 0; txq->ift_pullups = 0; ifmp_ring_reset_stats(txq->ift_br); - for (j = 0, di = txq->ift_ifdi; j < ctx->ifc_nhwtxqs; j++, di++) + for (j = 0, di = txq->ift_ifdi; j < sctx->isc_ntxqs; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); } for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { /* make sure all transmitters have completed before proceeding XXX */ - for (j = 0, di = rxq->ifr_ifdi; j < rxq->ifr_nfl; j++, di++) + for (j = 0, di = rxq->ifr_ifdi; j < sctx->isc_nrxqs; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); /* also resets the free lists pidx/cidx */ for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) @@ -5516,11 +5516,12 @@ static void iflib_tx_structures_free(if_ctx_t ctx) { iflib_txq_t txq = ctx->ifc_txqs; + if_shared_ctx_t sctx = ctx->ifc_sctx; int i, j; for (i = 0; i < NTXQSETS(ctx); i++, txq++) { iflib_txq_destroy(txq); - for (j = 0; j < ctx->ifc_nhwtxqs; j++) + for (j = 0; j < sctx->isc_ntxqs; j++) iflib_dma_free(&txq->ift_ifdi[j]); } free(ctx->ifc_txqs, M_IFLIB); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340366 - stable/12/sys/dev/e1000
Author: shurd Date: Mon Nov 12 16:28:07 2018 New Revision: 340366 URL: https://svnweb.freebsd.org/changeset/base/340366 Log: MFC r340310: Fix first-packet completion The first packet after the ring is initialized was never completed as isc_txd_credits_update() would not include it in the count of completed packets. This caused netmap to never complete a batch. See PR 233022 for more details. PR: 233022 Reported by: lev Reviewed by: lev Approved by: re (kib) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17931 Modified: stable/12/sys/dev/e1000/em_txrx.c stable/12/sys/dev/e1000/igb_txrx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/e1000/em_txrx.c == --- stable/12/sys/dev/e1000/em_txrx.c Mon Nov 12 16:08:14 2018 (r340365) +++ stable/12/sys/dev/e1000/em_txrx.c Mon Nov 12 16:28:07 2018 (r340366) @@ -458,7 +458,13 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, b ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + /* +* XXX This appears to be a hack for first-packet. +* A correct fix would prevent prev == cur in the first place. +*/ MPASS(prev == 0 || delta != 0); + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; DPRINTF(iflib_get_dev(adapter->ctx), Modified: stable/12/sys/dev/e1000/igb_txrx.c == --- stable/12/sys/dev/e1000/igb_txrx.c Mon Nov 12 16:08:14 2018 (r340365) +++ stable/12/sys/dev/e1000/igb_txrx.c Mon Nov 12 16:28:07 2018 (r340366) @@ -333,7 +333,13 @@ igb_isc_txd_credits_update(void *arg, uint16_t txqid, ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + /* +* XXX This appears to be a hack for first-packet. +* A correct fix would prevent prev == cur in the first place. +*/ MPASS(prev == 0 || delta != 0); + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340365 - stable/12/sys/net
Author: shurd Date: Mon Nov 12 16:08:14 2018 New Revision: 340365 URL: https://svnweb.freebsd.org/changeset/base/340365 Log: MFC r340236: Fix rxcsum issue introduced in r338838 r338838 attempted to fix issues with rxcsum and rxcsum6. However, the rxcsum bits were set as though if_setcapenablebit() was being called, not if_togglecapenable() which is in use. As a result, it was not possible to disable rxcsum when rxcsum6 was supported. PR: 233004 Reported by: lev Reviewed by: lev Approved by: re (kib) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17881 Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c == --- stable/12/sys/net/iflib.c Mon Nov 12 15:59:32 2018(r340364) +++ stable/12/sys/net/iflib.c Mon Nov 12 16:08:14 2018(r340365) @@ -4256,18 +4256,13 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) setmask |= (mask & IFCAP_WOL); /* -* If we're disabling any RX csum, disable all the ones -* the driver supports. This assumes all supported are -* enabled. -* -* Otherwise, if they've changed, enable all of them. +* If any RX csum has changed, change all the ones that +* are supported by the driver. */ - if ((setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) < - (oldmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6))) - setmask &= ~(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); - else if ((setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) != - (oldmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6))) - setmask |= (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)); + if (setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { + setmask |= ctx->ifc_softc_ctx.isc_capabilities & + (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); + } /* * want to ensure that traffic has stopped before we change any of the flags ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340310 - head/sys/dev/e1000
Author: shurd Date: Fri Nov 9 22:18:43 2018 New Revision: 340310 URL: https://svnweb.freebsd.org/changeset/base/340310 Log: Fix first-packet completion The first packet after the ring is initialized was never completed as isc_txd_credits_update() would not include it in the count of completed packets. This caused netmap to never complete a batch. See PR 233022 for more details. PR: 233022 Reported by: lev Reviewed by: lev MFC after:3 days Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17931 Modified: head/sys/dev/e1000/em_txrx.c head/sys/dev/e1000/igb_txrx.c Modified: head/sys/dev/e1000/em_txrx.c == --- head/sys/dev/e1000/em_txrx.cFri Nov 9 21:45:42 2018 (r340309) +++ head/sys/dev/e1000/em_txrx.cFri Nov 9 22:18:43 2018 (r340310) @@ -458,7 +458,13 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, b ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + /* +* XXX This appears to be a hack for first-packet. +* A correct fix would prevent prev == cur in the first place. +*/ MPASS(prev == 0 || delta != 0); + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; DPRINTF(iflib_get_dev(adapter->ctx), Modified: head/sys/dev/e1000/igb_txrx.c == --- head/sys/dev/e1000/igb_txrx.c Fri Nov 9 21:45:42 2018 (r340309) +++ head/sys/dev/e1000/igb_txrx.c Fri Nov 9 22:18:43 2018 (r340310) @@ -333,7 +333,13 @@ igb_isc_txd_credits_update(void *arg, uint16_t txqid, ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + /* +* XXX This appears to be a hack for first-packet. +* A correct fix would prevent prev == cur in the first place. +*/ MPASS(prev == 0 || delta != 0); + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340236 - head/sys/net
Author: shurd Date: Wed Nov 7 19:31:48 2018 New Revision: 340236 URL: https://svnweb.freebsd.org/changeset/base/340236 Log: Fix rxcsum issue introduced in r338838 r338838 attempted to fix issues with rxcsum and rxcsum6. However, the rxcsum bits were set as though if_setcapenablebit() was being called, not if_togglecapenable() which is in use. As a result, it was not possible to disable rxcsum when rxcsum6 was supported. PR: 233004 Reported by: lev Reviewed by: lev MFC after:3 days Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17881 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Nov 7 18:54:24 2018(r340235) +++ head/sys/net/iflib.cWed Nov 7 19:31:48 2018(r340236) @@ -4256,18 +4256,13 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) setmask |= (mask & IFCAP_WOL); /* -* If we're disabling any RX csum, disable all the ones -* the driver supports. This assumes all supported are -* enabled. -* -* Otherwise, if they've changed, enable all of them. +* If any RX csum has changed, change all the ones that +* are supported by the driver. */ - if ((setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) < - (oldmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6))) - setmask &= ~(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); - else if ((setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) != - (oldmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6))) - setmask |= (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)); + if (setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { + setmask |= ctx->ifc_softc_ctx.isc_capabilities & + (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); + } /* * want to ensure that traffic has stopped before we change any of the flags ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r340202 - in stable/12/sys: kern sys
Author: shurd Date: Tue Nov 6 20:46:00 2018 New Revision: 340202 URL: https://svnweb.freebsd.org/changeset/base/340202 Log: MFC r339861: Drain grouptaskqueue of the gtask before detaching it. taskqgroup_detach() would remove the task even if it was running or enqueued, which could lead to panics (see D17404). With this change, taskqgroup_detach() drains the task and sets a new flag which prevents the task from being scheduled again. I've added grouptask_block() and grouptask_unblock() to allow control over the flag from other locations as well. Reviewed by: Jeffrey Pieper Approved by: re (kib) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17674 Modified: stable/12/sys/kern/subr_gtaskqueue.c stable/12/sys/sys/gtaskqueue.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_gtaskqueue.c == --- stable/12/sys/kern/subr_gtaskqueue.cTue Nov 6 20:45:15 2018 (r340201) +++ stable/12/sys/kern/subr_gtaskqueue.cTue Nov 6 20:46:00 2018 (r340202) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_GTASKQUEUE, "gtaskqueue", "Group Task Queues"); static voidgtaskqueue_thread_enqueue(void *); static voidgtaskqueue_thread_loop(void *arg); +static int task_is_running(struct gtaskqueue *queue, struct gtask *gtask); +static voidgtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask); TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); TASKQGROUP_DEFINE(config, 1, 1); @@ -183,6 +185,44 @@ gtaskqueue_free(struct gtaskqueue *queue) free(queue, M_GTASKQUEUE); } +/* + * Wait for all to complete, then prevent it from being enqueued + */ +void +grouptask_block(struct grouptask *grouptask) +{ + struct gtaskqueue *queue = grouptask->gt_taskqueue; + struct gtask *gtask = &grouptask->gt_task; + +#ifdef INVARIANTS + if (queue == NULL) { + gtask_dump(gtask); + panic("queue == NULL"); + } +#endif + TQ_LOCK(queue); + gtask->ta_flags |= TASK_NOENQUEUE; + gtaskqueue_drain_locked(queue, gtask); + TQ_UNLOCK(queue); +} + +void +grouptask_unblock(struct grouptask *grouptask) +{ + struct gtaskqueue *queue = grouptask->gt_taskqueue; + struct gtask *gtask = &grouptask->gt_task; + +#ifdef INVARIANTS + if (queue == NULL) { + gtask_dump(gtask); + panic("queue == NULL"); + } +#endif + TQ_LOCK(queue); + gtask->ta_flags &= ~TASK_NOENQUEUE; + TQ_UNLOCK(queue); +} + int grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *gtask) { @@ -197,6 +237,10 @@ grouptaskqueue_enqueue(struct gtaskqueue *queue, struc TQ_UNLOCK(queue); return (0); } + if (gtask->ta_flags & TASK_NOENQUEUE) { + TQ_UNLOCK(queue); + return (EAGAIN); + } STAILQ_INSERT_TAIL(&queue->tq_queue, gtask, ta_link); gtask->ta_flags |= TASK_ENQUEUED; TQ_UNLOCK(queue); @@ -378,6 +422,13 @@ gtaskqueue_cancel(struct gtaskqueue *queue, struct gta return (error); } +static void +gtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask) +{ + while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, gtask)) + TQ_SLEEP(queue, gtask, &queue->tq_mutex, PWAIT, "-", 0); +} + void gtaskqueue_drain(struct gtaskqueue *queue, struct gtask *gtask) { @@ -386,8 +437,7 @@ gtaskqueue_drain(struct gtaskqueue *queue, struct gtas WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); TQ_LOCK(queue); - while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, gtask)) - TQ_SLEEP(queue, gtask, &queue->tq_mutex, PWAIT, "-", 0); + gtaskqueue_drain_locked(queue, gtask); TQ_UNLOCK(queue); } @@ -803,6 +853,7 @@ taskqgroup_detach(struct taskqgroup *qgroup, struct gr { int i; + grouptask_block(gtask); mtx_lock(&qgroup->tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_taskq == gtask->gt_taskqueue) @@ -813,6 +864,7 @@ taskqgroup_detach(struct taskqgroup *qgroup, struct gr LIST_REMOVE(gtask, gt_list); mtx_unlock(&qgroup->tqg_lock); gtask->gt_taskqueue = NULL; + gtask->gt_task.ta_flags &= ~TASK_NOENQUEUE; } static void Modified: stable/12/sys/sys/gtaskqueue.h == --- stable/12/sys/sys/gtaskqueue.h Tue Nov 6 20:45:15 2018 (r340201) +++ stable/12/sys/sys/gtaskqueue.h Tue Nov 6 20:46:00 2018 (r340202) @@ -52,7 +52,9 @@ int gtaskqueue_cancel(struct gtaskqueue *queue, struct void gtaskqueue_drain(struct gtaskqueue *queue, struct gtask *task); void gtas
svn commit: r339861 - in head/sys: kern sys
Author: shurd Date: Mon Oct 29 14:36:03 2018 New Revision: 339861 URL: https://svnweb.freebsd.org/changeset/base/339861 Log: Drain grouptaskqueue of the gtask before detaching it. taskqgroup_detach() would remove the task even if it was running or enqueued, which could lead to panics (see D17404). With this change, taskqgroup_detach() drains the task and sets a new flag which prevents the task from being scheduled again. I've added grouptask_block() and grouptask_unblock() to allow control over the flag from other locations as well. Reviewed by: Jeffrey Pieper MFC after:1 week Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17674 Modified: head/sys/kern/subr_gtaskqueue.c head/sys/sys/gtaskqueue.h Modified: head/sys/kern/subr_gtaskqueue.c == --- head/sys/kern/subr_gtaskqueue.c Mon Oct 29 14:06:20 2018 (r339860) +++ head/sys/kern/subr_gtaskqueue.c Mon Oct 29 14:36:03 2018 (r339861) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_GTASKQUEUE, "gtaskqueue", "Group Task Queues"); static voidgtaskqueue_thread_enqueue(void *); static voidgtaskqueue_thread_loop(void *arg); +static int task_is_running(struct gtaskqueue *queue, struct gtask *gtask); +static voidgtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask); TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); TASKQGROUP_DEFINE(config, 1, 1); @@ -183,6 +185,44 @@ gtaskqueue_free(struct gtaskqueue *queue) free(queue, M_GTASKQUEUE); } +/* + * Wait for all to complete, then prevent it from being enqueued + */ +void +grouptask_block(struct grouptask *grouptask) +{ + struct gtaskqueue *queue = grouptask->gt_taskqueue; + struct gtask *gtask = &grouptask->gt_task; + +#ifdef INVARIANTS + if (queue == NULL) { + gtask_dump(gtask); + panic("queue == NULL"); + } +#endif + TQ_LOCK(queue); + gtask->ta_flags |= TASK_NOENQUEUE; + gtaskqueue_drain_locked(queue, gtask); + TQ_UNLOCK(queue); +} + +void +grouptask_unblock(struct grouptask *grouptask) +{ + struct gtaskqueue *queue = grouptask->gt_taskqueue; + struct gtask *gtask = &grouptask->gt_task; + +#ifdef INVARIANTS + if (queue == NULL) { + gtask_dump(gtask); + panic("queue == NULL"); + } +#endif + TQ_LOCK(queue); + gtask->ta_flags &= ~TASK_NOENQUEUE; + TQ_UNLOCK(queue); +} + int grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *gtask) { @@ -197,6 +237,10 @@ grouptaskqueue_enqueue(struct gtaskqueue *queue, struc TQ_UNLOCK(queue); return (0); } + if (gtask->ta_flags & TASK_NOENQUEUE) { + TQ_UNLOCK(queue); + return (EAGAIN); + } STAILQ_INSERT_TAIL(&queue->tq_queue, gtask, ta_link); gtask->ta_flags |= TASK_ENQUEUED; TQ_UNLOCK(queue); @@ -378,6 +422,13 @@ gtaskqueue_cancel(struct gtaskqueue *queue, struct gta return (error); } +static void +gtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask) +{ + while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, gtask)) + TQ_SLEEP(queue, gtask, &queue->tq_mutex, PWAIT, "-", 0); +} + void gtaskqueue_drain(struct gtaskqueue *queue, struct gtask *gtask) { @@ -386,8 +437,7 @@ gtaskqueue_drain(struct gtaskqueue *queue, struct gtas WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); TQ_LOCK(queue); - while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, gtask)) - TQ_SLEEP(queue, gtask, &queue->tq_mutex, PWAIT, "-", 0); + gtaskqueue_drain_locked(queue, gtask); TQ_UNLOCK(queue); } @@ -803,6 +853,7 @@ taskqgroup_detach(struct taskqgroup *qgroup, struct gr { int i; + grouptask_block(gtask); mtx_lock(&qgroup->tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_taskq == gtask->gt_taskqueue) @@ -813,6 +864,7 @@ taskqgroup_detach(struct taskqgroup *qgroup, struct gr LIST_REMOVE(gtask, gt_list); mtx_unlock(&qgroup->tqg_lock); gtask->gt_taskqueue = NULL; + gtask->gt_task.ta_flags &= ~TASK_NOENQUEUE; } static void Modified: head/sys/sys/gtaskqueue.h == --- head/sys/sys/gtaskqueue.h Mon Oct 29 14:06:20 2018(r339860) +++ head/sys/sys/gtaskqueue.h Mon Oct 29 14:36:03 2018(r339861) @@ -52,7 +52,9 @@ int gtaskqueue_cancel(struct gtaskqueue *queue, struct void gtaskqueue_drain(struct gtaskqueue *queue, struct gtask *task); void gtaskqueue_drain_all(struct gtaskqueue *queue); -int grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *task); +void
svn commit: r339267 - head/sys/dev/e1000
Author: shurd Date: Tue Oct 9 20:16:19 2018 New Revision: 339267 URL: https://svnweb.freebsd.org/changeset/base/339267 Log: Use mbuf defines to construct csum offload masks rather than literals Reviewed by: erj Approved by: re (rgrimes) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17442 Modified: head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.h == --- head/sys/dev/e1000/if_em.h Tue Oct 9 19:46:27 2018(r339266) +++ head/sys/dev/e1000/if_em.h Tue Oct 9 20:16:19 2018(r339267) @@ -341,8 +341,11 @@ #define EM_MSIX_LINK 0x0100 /* For 82574 use */ #define ETH_ZLEN 60 #define ETH_ADDR_LEN 6 -#define EM_CSUM_OFFLOAD7 /* Offload bits in mbuf flag */ -#define IGB_CSUM_OFFLOAD 0x0E0F /* Offload bits in mbuf flag */ +#define EM_CSUM_OFFLOAD(CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP) /* Offload bits in mbuf flag */ +#define IGB_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | \ +CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ +CSUM_IP6_SCTP) /* Offload bits in mbuf flag */ + #define IGB_PKTTYPE_MASK 0xFFF0 #define IGB_DMCTLX_DCFLUSH_DIS 0x8000 /* Disable DMA Coalesce Flush */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r339207 - head/sys/dev/e1000
Author: shurd Date: Fri Oct 5 20:16:20 2018 New Revision: 339207 URL: https://svnweb.freebsd.org/changeset/base/339207 Log: Fix igb corrupting checksums with BPF and VLAN When using a vlan with igb and the vlanhwcsum option, any mbufs which already had the TCP, UDP, or SCTP checksum calculated and therefore don't have the CSUM_[IP|IP6]_[TCP|UDP|SCTP] bits set in the csum_flags field would have the L4 checksum corrupted by the hardware. This was caused by the driver setting E1000_TXD_POPTS_TXSM any time a checksum bit was set OR a vlan tag was present. The patched driver only sets E1000_TXD_POPTS_TXSM when an offload is requested. PR: 231416 Reported by: pi Approved by: re (gjb) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17404 Modified: head/sys/dev/e1000/igb_txrx.c Modified: head/sys/dev/e1000/igb_txrx.c == --- head/sys/dev/e1000/igb_txrx.c Fri Oct 5 19:27:42 2018 (r339206) +++ head/sys/dev/e1000/igb_txrx.c Fri Oct 5 20:16:20 2018 (r339207) @@ -152,7 +152,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi u32 vlan_macip_lens, type_tucmd_mlhl; u32 mss_l4len_idx; mss_l4len_idx = vlan_macip_lens = type_tucmd_mlhl = 0; - int offload = TRUE; /* First check if TSO is to be used */ if (pi->ipi_csum_flags & CSUM_TSO) @@ -186,7 +185,6 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_IPV6; break; default: - offload = FALSE; break; } @@ -195,24 +193,26 @@ igb_tx_ctx_setup(struct tx_ring *txr, if_pkt_info_t pi switch (pi->ipi_ipproto) { case IPPROTO_TCP: - if (pi->ipi_csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) + if (pi->ipi_csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) { type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP; + *olinfo_status |= E1000_TXD_POPTS_TXSM << 8; + } break; case IPPROTO_UDP: - if (pi->ipi_csum_flags & (CSUM_IP_UDP | CSUM_IP6_UDP)) + if (pi->ipi_csum_flags & (CSUM_IP_UDP | CSUM_IP6_UDP)) { type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP; + *olinfo_status |= E1000_TXD_POPTS_TXSM << 8; + } break; case IPPROTO_SCTP: - if (pi->ipi_csum_flags & (CSUM_IP_SCTP | CSUM_IP6_SCTP)) + if (pi->ipi_csum_flags & (CSUM_IP_SCTP | CSUM_IP6_SCTP)) { type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP; + *olinfo_status |= E1000_TXD_POPTS_TXSM << 8; + } break; default: - offload = FALSE; break; } - - if (offload) /* For the TX descriptor setup */ - *olinfo_status |= E1000_TXD_POPTS_TXSM << 8; /* 82575 needs the queue index added */ if (adapter->hw.mac.type == e1000_82575) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338840 - head/sys/dev/e1000
Author: shurd Date: Thu Sep 20 20:06:44 2018 New Revision: 338840 URL: https://svnweb.freebsd.org/changeset/base/338840 Log: Add IFCAP_TSO6 for igb It seems igb supports TSO6, but the capability got lost in the iflib update. Restore this capability. PR: 231476 Reported by: lev Reviewed by: erj Approved by: re (gjb) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17242 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Thu Sep 20 19:45:27 2018(r338839) +++ head/sys/dev/e1000/if_em.c Thu Sep 20 20:06:44 2018(r338840) @@ -709,7 +709,8 @@ em_set_num_queues(if_ctx_t ctx) #defineIGB_CAPS \ IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \ IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER | IFCAP_TSO4 | \ -IFCAP_LRO | IFCAP_VLAN_HWTSO | IFCAP_JUMBO_MTU | IFCAP_HWCSUM_IPV6; +IFCAP_LRO | IFCAP_VLAN_HWTSO | IFCAP_JUMBO_MTU | IFCAP_HWCSUM_IPV6 |\ +IFCAP_TSO6 /* * Device initialization routine ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338838 - head/sys/net
Author: shurd Date: Thu Sep 20 19:35:35 2018 New Revision: 338838 URL: https://svnweb.freebsd.org/changeset/base/338838 Log: Fix capabilities handling for iflib drivers Various capabilities were not being handled correctly in the SIOCSIFCAP handler. Specifically: IFCAP_RXCSUM and IFCAP_RXCSUM_IPV6 could be set even if not supported It was impossible to disable IFCAP_RXCSUM and/or IFCAP_RXCSUM_IPV6 via ifconfig since it does ioctl() per command-line flag rather than combine them into a single call. IFCAP_VLAN_HWCSUM could not be modified via the ioctl() Setting any combination of the three IFCAP_WOL flags would set only IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC. For example, setting only IFCAP_WOL_UCAST would result in both IFCAP_WOL_MCAST and IFCAP_WOL_MAGIC being enabled, but IFCAP_WOL_UCAST would not be enabled. Because if_vlancap() was called before if_togglecapenable(), vlan flags were sometimes not applied correctly. Interfaces were being unnecessarily stopped and restarted for WoL PR: 231151 Submitted by: Kaho Toshikazu Reported by: Shirkdog Reviewed by: galladin Approved by: re (gjb) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D17158 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cThu Sep 20 18:30:17 2018(r338837) +++ head/sys/net/iflib.cThu Sep 20 19:35:35 2018(r338838) @@ -4100,9 +4100,10 @@ iflib_if_qflush(if_t ifp) } -#define IFCAP_FLAGS (IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6 | IFCAP_HWCSUM | IFCAP_LRO | \ -IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTAGGING | IFCAP_HWSTATS | \ -IFCAP_VLAN_MTU | IFCAP_VLAN_HWFILTER | IFCAP_VLAN_HWTSO) +#define IFCAP_FLAGS (IFCAP_HWCSUM_IPV6 | IFCAP_HWCSUM | IFCAP_LRO | \ +IFCAP_TSO | IFCAP_VLAN_HWTAGGING | IFCAP_HWSTATS | \ +IFCAP_VLAN_MTU | IFCAP_VLAN_HWFILTER | \ +IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM) static int iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) @@ -4223,39 +4224,51 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) } case SIOCSIFCAP: { - int mask, setmask; + int mask, setmask, oldmask; - mask = ifr->ifr_reqcap ^ if_getcapenable(ifp); + oldmask = if_getcapenable(ifp); + mask = ifr->ifr_reqcap ^ oldmask; + mask &= ctx->ifc_softc_ctx.isc_capabilities; setmask = 0; #ifdef TCP_OFFLOAD setmask |= mask & (IFCAP_TOE4|IFCAP_TOE6); #endif setmask |= (mask & IFCAP_FLAGS); + setmask |= (mask & IFCAP_WOL); - if (setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) - setmask |= (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); - if ((mask & IFCAP_WOL) && - (if_getcapabilities(ifp) & IFCAP_WOL) != 0) - setmask |= (mask & (IFCAP_WOL_MCAST|IFCAP_WOL_MAGIC)); - if_vlancap(ifp); /* +* If we're disabling any RX csum, disable all the ones +* the driver supports. This assumes all supported are +* enabled. +* +* Otherwise, if they've changed, enable all of them. +*/ + if ((setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) < + (oldmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6))) + setmask &= ~(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); + else if ((setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) != + (oldmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6))) + setmask |= (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)); + + /* * want to ensure that traffic has stopped before we change any of the flags */ if (setmask) { CTX_LOCK(ctx); bits = if_getdrvflags(ifp); - if (bits & IFF_DRV_RUNNING) + if (bits & IFF_DRV_RUNNING && setmask & ~IFCAP_WOL) iflib_stop(ctx); STATE_LOCK(ctx); if_togglecapenable(ifp, setmask); STATE_UNLOCK(ctx); - if (bits & IFF_DRV_RUNNING) + if (bits & IFF_DRV_RUNNING && setmask & ~IFCAP_WOL) iflib_init_locked(ctx); STATE_LOCK(ctx); if_setdrvflags(ifp, bits); STATE_UNLOCK(ctx); CTX_UNLOCK(ctx); } + if_vlancap(ifp); break; } case SIOCGPRIVAT
svn commit: r338834 - in head/share/man: man4 man9
Author: shurd Date: Thu Sep 20 18:24:32 2018 New Revision: 338834 URL: https://svnweb.freebsd.org/changeset/base/338834 Log: Add iflib.4 manpage The new manpage documents the tunables and statistic sysctls exposed by iflib. Reviewed by: bcr Approved by: re (gjb) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D16920 Added: head/share/man/man4/iflib.4 (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/bnxt.4 head/share/man/man4/em.4 head/share/man/man9/iflib.9 Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileThu Sep 20 16:43:58 2018 (r338833) +++ head/share/man/man4/MakefileThu Sep 20 18:24:32 2018 (r338834) @@ -202,6 +202,7 @@ MAN=aac.4 \ icmp6.4 \ ida.4 \ if_ipsec.4 \ + iflib.4 \ ifmib.4 \ ig4.4 \ igmp.4 \ Modified: head/share/man/man4/bnxt.4 == --- head/share/man/man4/bnxt.4 Thu Sep 20 16:43:58 2018(r338833) +++ head/share/man/man4/bnxt.4 Thu Sep 20 18:24:32 2018(r338834) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2017 +.Dd September 20, 2018 .Dt BNXT 4 .Os .Sh NAME @@ -110,7 +110,7 @@ These variables must be set before loading the driver, or through the use of .Xr kenv 1 . These are provided by the -.Xr iflib 9 +.Xr iflib 4 framework, and might be better documented there. .Bl -tag -width indent .It Va dev.bnxt.X.iflib.override_nrxds Modified: head/share/man/man4/em.4 == --- head/share/man/man4/em.4Thu Sep 20 16:43:58 2018(r338833) +++ head/share/man/man4/em.4Thu Sep 20 18:24:32 2018(r338834) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2017 +.Dd September 20, 2018 .Dt EM 4 .Os .Sh NAME @@ -298,6 +298,7 @@ issue to .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , +.Xr iflib 4 , .Xr led 4 , .Xr netintro 4 , .Xr ng_ether 4 , Added: head/share/man/man4/iflib.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/iflib.4 Thu Sep 20 18:24:32 2018(r338834) @@ -0,0 +1,195 @@ +.\" $FreeBSD$ +.Dd September 20, 2018 +.Dt IFLIB 4 +.Os +.Sh NAME +.Nm iflib +.Nd Network Interface Driver Framework +.Sh SYNOPSIS +.Cd "device pci" +.Cd "device iflib" +.Sh DESCRIPTION +.Nm +is a framework for network interface drivers for +.Fx . +It is designed to remove a large amount of the boilerplate that is often +needed for modern network interface devices, allowing driver authors to +focus on the specific code needed for their hardware. +This allows for a shared set of +.Xr sysctl 8 +names, rather than each driver naming them individually. +.Sh SYSCTL VARIABLES +These variables must be set before loading the driver, either via +.Xr loader.conf 5 +or through the use of +.Xr kenv 1 . +They are all prefixed by +.Va dev.X.Y.iflib. +where X is the driver name, and Y is the instance number. +.Bl -tag -width indent +.It Va override_nrxds +Override the number of RX descriptors for each queue. +The value is a comma separated list of positive integers. +Some drivers only use a single value, but others may use more. +These numbers must be powers of two, and zero means to use the default. +Individual drivers may have additional restrictions on allowable values. +Defaults to all zeros. +.It Va override_ntxds +Override the number of TX descriptors for each queue. +The value is a comma separated list of positive integers. +Some drivers only use a single value, but others may use more. +These numbers must be powers of two, and zero means to use the default. +Individual drivers may have additional restrictions on allowable values. +Defaults to all zeros. +.It Va override_qs_enable +When set, allows the number of transmit and receive queues to be different. +If not set, the lower of the number of TX or RX queues will be used for both. +.It Va override_nrxqs +Set the number of RX queues. +If zero, the number of RX queues is derived from the number of cores on the +socket connected to the controller. +Defaults to 0. +.It Va override_ntxqs +Set the number of TX queues. +If zero, the number of TX queues is derived from the number of cores on the +socket connected to the controller. +.It Va disable_msix +Disables MSI-X interrupts for the device. +.El +.Pp +These +.Xr sysctl 8 +variables can be changed at any time: +.Bl -tag -width indent +.It Va tx_abdicate +Controls how the transmit ring is serviced. +If set to zero, when a frame is submitted to the transmission ring, the same +task that is submitting it will service the ring unless there's already a +task servicing the TX ring. +This ensures that wh
svn commit: r338505 - head/sys/net
Author: shurd Date: Thu Sep 6 18:51:52 2018 New Revision: 338505 URL: https://svnweb.freebsd.org/changeset/base/338505 Log: Clean up iflib sysctls Remove sysctls: txq_drain_encapfail - now a duplicate of encap_txd_encap_fail intr_link - was never incremented intr_msix - was never incremented rx_zero_len - was never incremented The following were not incremented in all code-paths that apply: m_pullups, mbuf_defrag, rxd_flush, tx_encap, rx_intr_enables, tx_frees, encap_txd_encap_fail. Fixes: Replace the broken collapse_pkthdr() implementation with an MPASS(). fl_refills and fl_refills_large were not incremented when using netmap. Reviewed by: gallatin Approved by: re (marius) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D16733 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cThu Sep 6 18:45:31 2018(r338504) +++ head/sys/net/iflib.cThu Sep 6 18:51:52 2018(r338505) @@ -641,7 +641,6 @@ SYSCTL_INT(_net_iflib, OID_AUTO, fl_refills_large, CTL static int iflib_txq_drain_flushing; static int iflib_txq_drain_oactive; static int iflib_txq_drain_notready; -static int iflib_txq_drain_encapfail; SYSCTL_INT(_net_iflib, OID_AUTO, txq_drain_flushing, CTLFLAG_RD, &iflib_txq_drain_flushing, 0, "# drain flushes"); @@ -649,8 +648,6 @@ SYSCTL_INT(_net_iflib, OID_AUTO, txq_drain_oactive, CT &iflib_txq_drain_oactive, 0, "# drain oactives"); SYSCTL_INT(_net_iflib, OID_AUTO, txq_drain_notready, CTLFLAG_RD, &iflib_txq_drain_notready, 0, "# drain notready"); -SYSCTL_INT(_net_iflib, OID_AUTO, txq_drain_encapfail, CTLFLAG_RD, - &iflib_txq_drain_encapfail, 0, "# drain encap fails"); static int iflib_encap_load_mbuf_fail; @@ -670,21 +667,14 @@ SYSCTL_INT(_net_iflib, OID_AUTO, encap_txd_encap_fail, static int iflib_task_fn_rxs; static int iflib_rx_intr_enables; static int iflib_fast_intrs; -static int iflib_intr_link; -static int iflib_intr_msix; static int iflib_rx_unavail; static int iflib_rx_ctx_inactive; -static int iflib_rx_zero_len; static int iflib_rx_if_input; static int iflib_rx_mbuf_null; static int iflib_rxd_flush; static int iflib_verbose_debug; -SYSCTL_INT(_net_iflib, OID_AUTO, intr_link, CTLFLAG_RD, - &iflib_intr_link, 0, "# intr link calls"); -SYSCTL_INT(_net_iflib, OID_AUTO, intr_msix, CTLFLAG_RD, - &iflib_intr_msix, 0, "# intr msix calls"); SYSCTL_INT(_net_iflib, OID_AUTO, task_fn_rx, CTLFLAG_RD, &iflib_task_fn_rxs, 0, "# task_fn_rx calls"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_intr_enables, CTLFLAG_RD, @@ -695,8 +685,6 @@ SYSCTL_INT(_net_iflib, OID_AUTO, rx_unavail, CTLFLAG_R &iflib_rx_unavail, 0, "# times rxeof called with no available data"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_ctx_inactive, CTLFLAG_RD, &iflib_rx_ctx_inactive, 0, "# times rxeof called with inactive context"); -SYSCTL_INT(_net_iflib, OID_AUTO, rx_zero_len, CTLFLAG_RD, - &iflib_rx_zero_len, 0, "# times rxeof saw zero len mbuf"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_if_input, CTLFLAG_RD, &iflib_rx_if_input, 0, "# times rxeof called if_input"); SYSCTL_INT(_net_iflib, OID_AUTO, rx_mbuf_null, CTLFLAG_RD, @@ -713,12 +701,12 @@ iflib_debug_reset(void) iflib_tx_seen = iflib_tx_sent = iflib_tx_encap = iflib_rx_allocs = iflib_fl_refills = iflib_fl_refills_large = iflib_tx_frees = iflib_txq_drain_flushing = iflib_txq_drain_oactive = - iflib_txq_drain_notready = iflib_txq_drain_encapfail = + iflib_txq_drain_notready = iflib_encap_load_mbuf_fail = iflib_encap_pad_mbuf_fail = iflib_encap_txq_avail_fail = iflib_encap_txd_encap_fail = iflib_task_fn_rxs = iflib_rx_intr_enables = iflib_fast_intrs = - iflib_intr_link = iflib_intr_msix = iflib_rx_unavail = - iflib_rx_ctx_inactive = iflib_rx_zero_len = iflib_rx_if_input = + iflib_rx_unavail = + iflib_rx_ctx_inactive = iflib_rx_if_input = iflib_rx_mbuf_null = iflib_rxd_flush = 0; } @@ -839,6 +827,9 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring if_ctx_t ctx = rxq->ifr_ctx; iflib_fl_t fl = &rxq->ifr_fl[0]; uint32_t refill_pidx, nic_i; +#if IFLIB_DEBUG_COUNTERS + int rf_count = 0; +#endif if (nm_i == head && __predict_true(!init)) return 0; @@ -851,7 +842,12 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring */ head = nm_prev(head, lim); nic_i = UINT_MAX; + DBG_COUNTER_INC(fl_refills); while (nm_i != head) { +#if IFLIB_DEBUG_COUNTERS + if (++rf_
svn commit: r338373 - head/sys/net
Author: shurd Date: Wed Aug 29 16:21:34 2018 New Revision: 338373 URL: https://svnweb.freebsd.org/changeset/base/338373 Log: Fix compile error due to missing parenthesis in r338372 Approved by: re (gjb) Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Aug 29 15:55:25 2018(r338372) +++ head/sys/net/iflib.cWed Aug 29 16:21:34 2018(r338373) @@ -3636,7 +3636,7 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui if (__predict_false(ctx->ifc_flags & IFC_QFLUSH)) { DBG_COUNTER_INC(txq_drain_flushing); for (i = 0; i < avail; i++) { - if (__predict_true(r->items[(cidx + i) & (r->size-1)] != (void *)txq) + if (__predict_true(r->items[(cidx + i) & (r->size-1)] != (void *)txq)) m_free(r->items[(cidx + i) & (r->size-1)]); r->items[(cidx + i) & (r->size-1)] = NULL; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338372 - head/sys/net
Author: shurd Date: Wed Aug 29 15:55:25 2018 New Revision: 338372 URL: https://svnweb.freebsd.org/changeset/base/338372 Log: Fix potential data corruption in iflib The MP ring may have txq pointers enqueued. Previously, these were passed to m_free() when IFC_QFLUSH was set. This patch checks for the value and doesn't call m_free(). Reviewed by: gallatin Approved by: re (gjb) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D16882 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Aug 29 14:01:27 2018(r338371) +++ head/sys/net/iflib.cWed Aug 29 15:55:25 2018(r338372) @@ -3636,7 +3636,8 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui if (__predict_false(ctx->ifc_flags & IFC_QFLUSH)) { DBG_COUNTER_INC(txq_drain_flushing); for (i = 0; i < avail; i++) { - m_free(r->items[(cidx + i) & (r->size-1)]); + if (__predict_true(r->items[(cidx + i) & (r->size-1)] != (void *)txq) + m_free(r->items[(cidx + i) & (r->size-1)]); r->items[(cidx + i) & (r->size-1)] = NULL; } return (avail); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r336560 - head/sys/net
Author: shurd Date: Fri Jul 20 17:45:26 2018 New Revision: 336560 URL: https://svnweb.freebsd.org/changeset/base/336560 Log: Add knob to control tx ring abdication. r323954 changed the mp ring behaviour when 64-bit atomics were available to abdicate the TX ring rather than having one become a consumer thereby running to completion on TX. The consumer of the mp ring was then triggered in the tx task rather than blocking the TX call. While this significantly lowered the number of RX drops in small-packet forwarding, it also negatively impacts TX performance. With this change, the default behaviour is reverted, causing one TX ring to become a consumer during the enqueue call. A new sysctl, dev.X.Y.iflib.tx_abdicate is added to control this behaviour. Reviewed by: gallatin Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D16302 Modified: head/sys/net/iflib.c head/sys/net/mp_ring.c head/sys/net/mp_ring.h Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri Jul 20 17:24:45 2018(r336559) +++ head/sys/net/iflib.cFri Jul 20 17:45:26 2018(r336560) @@ -197,6 +197,7 @@ struct iflib_ctx { uint16_t ifc_sysctl_nrxqs; uint16_t ifc_sysctl_qs_eq_override; uint16_t ifc_sysctl_rx_budget; + uint16_t ifc_sysctl_tx_abdicate; qidx_t ifc_sysctl_ntxds[8]; qidx_t ifc_sysctl_nrxds[8]; @@ -3756,6 +3757,7 @@ _task_fn_tx(void *context) iflib_txq_t txq = context; if_ctx_t ctx = txq->ift_ctx; struct ifnet *ifp = ctx->ifc_ifp; + int abdicate = ctx->ifc_sysctl_tx_abdicate; #ifdef IFLIB_DIAGNOSTICS txq->ift_cpu_exec_count[curcpu]++; @@ -3769,7 +3771,14 @@ _task_fn_tx(void *context) return; } if (txq->ift_db_pending) - ifmp_ring_enqueue(txq->ift_br, (void **)&txq, 1, TX_BATCH_SIZE); + ifmp_ring_enqueue(txq->ift_br, (void **)&txq, 1, TX_BATCH_SIZE, abdicate); + else if (!abdicate) + ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); + /* +* When abdicating, we always need to check drainage, not just when we don't enqueue +*/ + if (abdicate) + ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); ifmp_ring_check_drainage(txq->ift_br, TX_BATCH_SIZE); if (ctx->ifc_flags & IFC_LEGACY) IFDI_INTR_ENABLE(ctx); @@ -3940,6 +3949,7 @@ iflib_if_transmit(if_t ifp, struct mbuf *m) iflib_txq_t txq; int err, qidx; + int abdicate = ctx->ifc_sysctl_tx_abdicate; if (__predict_false((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || !LINK_ACTIVE(ctx))) { DBG_COUNTER_INC(tx_frees); @@ -3991,10 +4001,13 @@ iflib_if_transmit(if_t ifp, struct mbuf *m) } #endif DBG_COUNTER_INC(tx_seen); - err = ifmp_ring_enqueue(txq->ift_br, (void **)&m, 1, TX_BATCH_SIZE); + err = ifmp_ring_enqueue(txq->ift_br, (void **)&m, 1, TX_BATCH_SIZE, abdicate); - GROUPTASK_ENQUEUE(&txq->ift_task); - if (err) { + if (abdicate) + GROUPTASK_ENQUEUE(&txq->ift_task); + if (err) { + if (!abdicate) + GROUPTASK_ENQUEUE(&txq->ift_task); /* support forthcoming later */ #ifdef DRIVER_BACKPRESSURE txq->ift_closed = TRUE; @@ -6200,6 +6213,9 @@ iflib_add_device_sysctl_pre(if_ctx_t ctx) SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "rx_budget", CTLFLAG_RWTUN, &ctx->ifc_sysctl_rx_budget, 0, "set the rx budget"); + SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "tx_abdicate", + CTLFLAG_RWTUN, &ctx->ifc_sysctl_tx_abdicate, 0, + "cause tx to abdicate instead of running to completion"); /* XXX change for per-queue sizes */ SYSCTL_ADD_PROC(ctx_list, oid_list, OID_AUTO, "override_ntxds", Modified: head/sys/net/mp_ring.c == --- head/sys/net/mp_ring.c Fri Jul 20 17:24:45 2018(r336559) +++ head/sys/net/mp_ring.c Fri Jul 20 17:45:26 2018(r336560) @@ -327,7 +327,7 @@ ifmp_ring_free(struct ifmp_ring *r) */ #ifdef NO_64BIT_ATOMICS int -ifmp_ring_enqueue(struct ifmp_ring *r, void **items, int n, int budget) +ifmp_ring_enqueue(struct ifmp_ring *r, void **items, int n, int budget, int abdicate) { union ring_state os, ns; uint16_t pidx_start, pidx_stop; @@ -380,16 +380,24 @@ ifmp_ring_enqueue(struct ifmp_ring *r, void **items, i */ os.state = ns.state = r->state; ns.pidx_tail = pidx_stop; - ns.flags = BUSY; + if (abdicate) { + if (os.flags == IDLE) + ns.flags = ABDICATED; + } +
svn commit: r336559 - head/sys/net
Author: shurd Date: Fri Jul 20 17:24:45 2018 New Revision: 336559 URL: https://svnweb.freebsd.org/changeset/base/336559 Log: Improve netmap TX handling when TX IRQs are not used/supported Use the timer to poll for TX completions when there are outstanding TX slots. Track when the last driver timer was called to prevent overcalling it. Also clean up some kring vs NIC ring usage. Reviewed by: marius, Johannes Lundberg Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D16300 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri Jul 20 16:37:04 2018(r336558) +++ head/sys/net/iflib.cFri Jul 20 17:24:45 2018(r336559) @@ -146,6 +146,7 @@ typedef struct iflib_fl *iflib_fl_t; struct iflib_ctx; static void iru_init(if_rxd_update_t iru, iflib_rxq_t rxq, uint8_t flid); +static void iflib_timer(void *arg); typedef struct iflib_filter_info { driver_filter_t *ifi_filter; @@ -356,6 +357,7 @@ struct iflib_txq { uint64_tift_map_failed; uint64_tift_txd_encap_efbig; uint64_tift_pullups; + uint64_tift_last_timer_tick; struct mtx ift_mtx; struct mtx ift_db_mtx; @@ -916,7 +918,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl struct netmap_adapter *na = kring->na; struct ifnet *ifp = na->ifp; struct netmap_ring *ring = kring->ring; - u_int nm_i; /* index into the netmap ring */ + u_int nm_i; /* index into the netmap kring */ u_int nic_i;/* index into the NIC ring */ u_int n; u_int const lim = kring->nkr_num_slots - 1; @@ -939,7 +941,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl /* * First part: process new packets to send. -* nm_i is the current index in the netmap ring, +* nm_i is the current index in the netmap kring, * nic_i is the corresponding index in the NIC ring. * * If we have packets to send (nm_i != head) @@ -959,7 +961,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl * to prefetch the next slot and txr entry. */ - nm_i = netmap_idx_n2k(kring, kring->nr_hwcur); + nm_i = kring->nr_hwcur; if (nm_i != head) { /* we have new packets to send */ pkt_info_zero(&pi); pi.ipi_segs = txq->ift_segs; @@ -1012,7 +1014,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); } - kring->nr_hwcur = head; + kring->nr_hwcur = nm_i; /* synchronize the NIC ring */ if (txq->ift_sds.ifsd_map) @@ -1031,19 +1033,18 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl * minimal delay, then trigger the tx handler which will spin in the * group task queue. */ - if (kring->nr_hwtail != nm_prev(head, lim)) { + if (kring->nr_hwtail != nm_prev(kring->nr_hwcur, lim)) { if (iflib_tx_credits_update(ctx, txq)) { /* some tx completed, increment avail */ nic_i = txq->ift_cidx_processed; kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim); } - else { - if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ)) { - DELAY(1); - GROUPTASK_ENQUEUE(&ctx->ifc_txqs[txq->ift_id].ift_task); - } - } } + if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ)) + if (kring->nr_hwtail != nm_prev(kring->nr_hwcur, lim)) { + callout_reset_on(&txq->ift_timer, hz < 2000 ? 1 : hz / 1000, + iflib_timer, txq, txq->ift_timer.c_cpu); + } return (0); } @@ -1069,7 +1070,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl uint32_t nic_i; /* index into the NIC ring */ u_int i, n; u_int const lim = kring->nkr_num_slots - 1; - u_int const head = netmap_idx_n2k(kring, kring->rhead); + u_int const head = kring->rhead; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; struct if_rxd_info ri; @@ -1134,7 +1135,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl iflib_rx_miss_bufs += n; } fl->ifl_cidx = nic_i; - kring->nr_hwtail = netmap_idx_k2n(kring, nm_i); + kring->nr_hwtail = nm_i; } kring->nr_
svn commit: r334862 - head/sys/net
Author: shurd Date: Fri Jun 8 21:49:19 2018 New Revision: 334862 URL: https://svnweb.freebsd.org/changeset/base/334862 Log: Remove tx task spinning added in r333686 This caused issues with PASTE. Just remove the reschedule since the DELAY() should be enough for use cases such as pkt-gen which were failing before the change. Reported by: Michio Honda Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri Jun 8 21:47:17 2018(r334861) +++ head/sys/net/iflib.cFri Jun 8 21:49:19 2018(r334862) @@ -3728,16 +3728,6 @@ _task_fn_tx(void *context) */ if (ctx->isc_txd_credits_update(ctx->ifc_softc, txq->ift_id, false)) netmap_tx_irq(ifp, txq->ift_id); - else { -#ifdef DEV_NETMAP - if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ)) { - struct netmap_kring *kring = NA(ctx->ifc_ifp)->tx_rings[txq->ift_id]; - - if (kring->nr_hwtail != nm_prev(kring->rhead, kring->nkr_num_slots - 1)) - GROUPTASK_ENQUEUE(&txq->ift_task); - } -#endif - } IFDI_TX_QUEUE_INTR_ENABLE(ctx, txq->ift_id); return; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r334358 - in head/sys: kern net sys
Author: shurd Date: Tue May 29 21:56:39 2018 New Revision: 334358 URL: https://svnweb.freebsd.org/changeset/base/334358 Log: iflib: mark irq allocation name parameter as constant The *name parameter passed to iflib_irq_alloc_generic and iflib_softirq_alloc_generic is never modified. Many places in code pass string literals and thus should not be modified. Mark the *name parameter as a const char * instead, so that we enforce that the name is not modified before passing to bus_describe_intr() Submitted by: Jacob Keller Reviewed by: kmacy Sponsored by: Intel Corporation Differential Revision:https://reviews.freebsd.org/D15343 Modified: head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/net/iflib.h head/sys/sys/gtaskqueue.h Modified: head/sys/kern/subr_gtaskqueue.c == --- head/sys/kern/subr_gtaskqueue.c Tue May 29 21:52:13 2018 (r334357) +++ head/sys/kern/subr_gtaskqueue.c Tue May 29 21:56:39 2018 (r334358) @@ -561,7 +561,7 @@ struct taskqgroup_cpu { struct taskqgroup { struct taskqgroup_cpu tqg_queue[MAXCPU]; struct mtx tqg_lock; - char * tqg_name; + const char *tqg_name; int tqg_adjusting; int tqg_stride; int tqg_cnt; @@ -720,7 +720,7 @@ taskqgroup_attach_deferred(struct taskqgroup *qgroup, int taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, - void *uniq, int cpu, int irq, char *name) + void *uniq, int cpu, int irq, const char *name) { cpuset_t mask; int i, qid, error; @@ -961,7 +961,7 @@ taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, } struct taskqgroup * -taskqgroup_create(char *name) +taskqgroup_create(const char *name) { struct taskqgroup *qgroup; Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue May 29 21:52:13 2018(r334357) +++ head/sys/net/iflib.cTue May 29 21:56:39 2018(r334358) @@ -733,7 +733,7 @@ static int iflib_tx_credits_update(if_ctx_t ctx, iflib static int iflib_rxd_avail(if_ctx_t ctx, iflib_rxq_t rxq, qidx_t cidx, qidx_t budget); static int iflib_qset_structures_setup(if_ctx_t ctx); static int iflib_msix_init(if_ctx_t ctx); -static int iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filterarg, int *rid, char *str); +static int iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filterarg, int *rid, const char *str); static void iflib_txq_check_drain(iflib_txq_t txq, int budget); static uint32_t iflib_txq_can_drain(struct ifmp_ring *); static int iflib_register(if_ctx_t); @@ -1523,8 +1523,8 @@ iflib_fast_intr_ctx(void *arg) static int _iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid, - driver_filter_t filter, driver_intr_t handler, void *arg, -char *name) +driver_filter_t filter, driver_intr_t handler, void *arg, +const char *name) { int rc, flags; struct resource *res; @@ -5395,7 +5395,7 @@ iflib_qset_structures_setup(if_ctx_t ctx) int iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid, - driver_filter_t filter, void *filter_arg, driver_intr_t handler, void *arg, char *name) + driver_filter_t filter, void *filter_arg, driver_intr_t handler, void *arg, const char *name) { return (_iflib_irq_alloc(ctx, irq, rid, filter, handler, arg, name)); @@ -5526,7 +5526,7 @@ get_core_offset(if_ctx_t ctx, iflib_intr_type_t type, /* Just to avoid copy/paste */ static inline int iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_intr_type_t type, int qid, -struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, char *name) +struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, const char *name) { int cpuid; int err, tid; @@ -5549,8 +5549,8 @@ iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_in int iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid, - iflib_intr_type_t type, driver_filter_t *filter, - void *filter_arg, int qid, char *name) + iflib_intr_type_t type, driver_filter_t *filter, + void *filter_arg, int qid, const char *name) { struct grouptask *gtask; struct taskqgroup *tqg; @@ -5631,7 +5631,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in } void -iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, char *name) +iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, const char *name) { struct grouptask *gtask; s
svn commit: r334178 - stable/11/sys/dev/bnxt
Author: shurd Date: Thu May 24 18:53:29 2018 New Revision: 334178 URL: https://svnweb.freebsd.org/changeset/base/334178 Log: MFC: r333792 Avoid spurious warnings when hardware LRO is enabled by not attempting to configure invalid VNICs. Approved by: re (gjb) Submitted by: bhargava.marre...@broadcom.com Sponsored by: Broadcom Limited Modified: stable/11/sys/dev/bnxt/bnxt_hwrm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bnxt/bnxt_hwrm.c == --- stable/11/sys/dev/bnxt/bnxt_hwrm.c Thu May 24 18:49:19 2018 (r334177) +++ stable/11/sys/dev/bnxt/bnxt_hwrm.c Thu May 24 18:53:29 2018 (r334178) @@ -1017,6 +1017,10 @@ bnxt_hwrm_vnic_tpa_cfg(struct bnxt_softc *softc) struct hwrm_vnic_tpa_cfg_input req = {0}; uint32_t flags; + if (softc->vnic_info.id == (uint16_t) HWRM_NA_SIGNATURE) { + return 0; + } + bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_TPA_CFG); if (softc->hw_lro.enable) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333686 - head/sys/net
Author: shurd Date: Wed May 16 21:03:22 2018 New Revision: 333686 URL: https://svnweb.freebsd.org/changeset/base/333686 Log: Work around lack of TX IRQs in iflib for netmap When poll() is called via netmap, txsync is initially called, and if there are no available buffers to reclaim, it waits for the driver to notify of new buffers. Since the TX IRQ is generally not used in iflib drivers, this ends up causing a timeout. Work around this by having the reclaim DELAY(1) if it's initially unable to reclaim anything, then schedule the tx task, which will spin by continuously rescheduling itself until some buffers are reclaimed. In general, the delay is enough to allow some buffers to be reclaimed, so spinning is minimized. Reported by: Johannes Lundberg Reviewed by: sbruno Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D15455 Modified: head/sys/net/iflib.c head/sys/net/iflib_private.h Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed May 16 20:44:08 2018(r333685) +++ head/sys/net/iflib.cWed May 16 21:03:22 2018(r333686) @@ -960,10 +960,10 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl */ nm_i = netmap_idx_n2k(kring, kring->nr_hwcur); - pkt_info_zero(&pi); - pi.ipi_segs = txq->ift_segs; - pi.ipi_qsidx = kring->ring_id; if (nm_i != head) { /* we have new packets to send */ + pkt_info_zero(&pi); + pi.ipi_segs = txq->ift_segs; + pi.ipi_qsidx = kring->ring_id; nic_i = netmap_idx_k2n(kring, nm_i); __builtin_prefetch(&ring->slot[nm_i]); @@ -1025,11 +1025,24 @@ iflib_netmap_txsync(struct netmap_kring *kring, int fl /* * Second part: reclaim buffers for completed transmissions. +* +* If there are unclaimed buffers, attempt to reclaim them. +* If none are reclaimed, and TX IRQs are not in use, do an initial +* minimal delay, then trigger the tx handler which will spin in the +* group task queue. */ - if (iflib_tx_credits_update(ctx, txq)) { - /* some tx completed, increment avail */ - nic_i = txq->ift_cidx_processed; - kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim); + if (kring->nr_hwtail != nm_prev(head, lim)) { + if (iflib_tx_credits_update(ctx, txq)) { + /* some tx completed, increment avail */ + nic_i = txq->ift_cidx_processed; + kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim); + } + else { + if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ)) { + DELAY(1); + GROUPTASK_ENQUEUE(&ctx->ifc_txqs[txq->ift_id].ift_task); + } + } } return (0); } @@ -3702,8 +3715,20 @@ _task_fn_tx(void *context) if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) return; if (if_getcapenable(ifp) & IFCAP_NETMAP) { + /* +* If there are no available credits, and TX IRQs are not in use, +* re-schedule the task immediately. +*/ if (ctx->isc_txd_credits_update(ctx->ifc_softc, txq->ift_id, false)) netmap_tx_irq(ifp, txq->ift_id); + else { + if (!(ctx->ifc_flags & IFC_NETMAP_TX_IRQ)) { + struct netmap_kring *kring = NA(ctx->ifc_ifp)->tx_rings[txq->ift_id]; + + if (kring->nr_hwtail != nm_prev(kring->rhead, kring->nkr_num_slots - 1)) + GROUPTASK_ENQUEUE(&txq->ift_task); + } + } IFDI_TX_QUEUE_INTR_ENABLE(ctx, txq->ift_id); return; } @@ -5548,6 +5573,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in fn = _task_fn_tx; intr_fast = iflib_fast_intr; GROUPTASK_INIT(gtask, 0, fn, q); + ctx->ifc_flags |= IFC_NETMAP_TX_IRQ; break; case IFLIB_INTR_RX: q = &ctx->ifc_rxqs[qid]; Modified: head/sys/net/iflib_private.h == --- head/sys/net/iflib_private.hWed May 16 20:44:08 2018 (r333685) +++ head/sys/net/iflib_private.hWed May 16 21:03:22 2018 (r333686) @@ -43,6 +43,8 @@ #defineIFC_CHECK_HUNG 0x200 #defineIFC_PSEUDO 0x400 +#define IFC_NETMAP_TX_IRQ 0x8000 + MALLOC_DECLARE(M_IFLIB); #define IFLIB_MAX_TX_BYTES (2*1024*1024
svn commit: r333637 - head/sys/netinet
Author: shurd Date: Tue May 15 16:54:41 2018 New Revision: 333637 URL: https://svnweb.freebsd.org/changeset/base/333637 Log: Check that ifma_protospec != NULL in inm_lookup If ifma_protospec is NULL when inm_lookup() is called, there is a dereference in a NULL struct pointer. This ensures that struct is not NULL before comparing the address. Reported by: dumbbell Reviewed by: sbruno Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D15440 Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c == --- head/sys/netinet/in_mcast.c Tue May 15 16:44:35 2018(r333636) +++ head/sys/netinet/in_mcast.c Tue May 15 16:54:41 2018(r333637) @@ -344,12 +344,13 @@ inm_lookup_locked(struct ifnet *ifp, const struct in_a inm = NULL; TAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { - if (ifma->ifma_addr->sa_family == AF_INET) { - inm = (struct in_multi *)ifma->ifma_protospec; - if (inm->inm_addr.s_addr == ina.s_addr) - break; - inm = NULL; - } + if (ifma->ifma_addr->sa_family != AF_INET || + ifma->ifma_protospec == NULL) + continue; + inm = (struct in_multi *)ifma->ifma_protospec; + if (inm->inm_addr.s_addr == ina.s_addr) + break; + inm = NULL; } return (inm); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333612 - head/sys/net
Author: shurd Date: Mon May 14 20:06:49 2018 New Revision: 333612 URL: https://svnweb.freebsd.org/changeset/base/333612 Log: Replace rmlock with epoch in lagg Use the new epoch based reclamation API. Now the hot paths will not block at all, and the sx lock is used for the softc data. This fixes LORs reported where the rwlock was obtained when the sxlock was held. Submitted by: mmacy Reported by: Harry Schmalzbauer Reviewed by: sbruno Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D15355 Modified: head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/if_lagg.c == --- head/sys/net/if_lagg.c Mon May 14 19:21:57 2018(r333611) +++ head/sys/net/if_lagg.c Mon May 14 20:06:49 2018(r333612) @@ -73,6 +73,18 @@ __FBSDID("$FreeBSD$"); #include #include +#defineLAGG_RLOCK()epoch_enter(net_epoch) +#defineLAGG_RUNLOCK() epoch_exit(net_epoch) +#defineLAGG_RLOCK_ASSERT() MPASS(in_epoch()) +#defineLAGG_UNLOCK_ASSERT()MPASS(!in_epoch()) + +#defineLAGG_SX_INIT(_sc) sx_init(&(_sc)->sc_sx, "if_lagg sx") +#defineLAGG_SX_DESTROY(_sc)sx_destroy(&(_sc)->sc_sx) +#defineLAGG_XLOCK(_sc) sx_xlock(&(_sc)->sc_sx) +#defineLAGG_XUNLOCK(_sc) sx_xunlock(&(_sc)->sc_sx) +#defineLAGG_SXLOCK_ASSERT(_sc) sx_assert(&(_sc)->sc_sx, SA_LOCKED) +#defineLAGG_XLOCK_ASSERT(_sc) sx_assert(&(_sc)->sc_sx, SA_XLOCKED) + /* Special flags we should propagate to the lagg ports. */ static struct { int flag; @@ -334,14 +346,11 @@ lagg_proto_detach(struct lagg_softc *sc) lagg_proto pr; LAGG_XLOCK_ASSERT(sc); - LAGG_WLOCK_ASSERT(sc); pr = sc->sc_proto; sc->sc_proto = LAGG_PROTO_NONE; if (lagg_protos[pr].pr_detach != NULL) lagg_protos[pr].pr_detach(sc); - else - LAGG_WUNLOCK(sc); } static int @@ -437,10 +446,10 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int if (ifp->if_softc != arg) /* Not our event */ return; - LAGG_SLOCK(sc); - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) + LAGG_RLOCK(); + CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag); - LAGG_SUNLOCK(sc); + LAGG_RUNLOCK(); } /* @@ -456,10 +465,10 @@ lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_i if (ifp->if_softc != arg) /* Not our event */ return; - LAGG_SLOCK(sc); - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) + LAGG_RLOCK(); + CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag); - LAGG_SUNLOCK(sc); + LAGG_RUNLOCK(); } static int @@ -475,7 +484,6 @@ lagg_clone_create(struct if_clone *ifc, int unit, cadd free(sc, M_DEVBUF); return (ENOSPC); } - LAGG_LOCK_INIT(sc); LAGG_SX_INIT(sc); LAGG_XLOCK(sc); @@ -550,9 +558,7 @@ lagg_clone_destroy(struct ifnet *ifp) lagg_port_destroy(lp, 1); /* Unhook the aggregation protocol */ - LAGG_WLOCK(sc); lagg_proto_detach(sc); - LAGG_UNLOCK_ASSERT(sc); LAGG_XUNLOCK(sc); ifmedia_removeall(&sc->sc_media); @@ -564,7 +570,6 @@ lagg_clone_destroy(struct ifnet *ifp) LAGG_LIST_UNLOCK(); LAGG_SX_DESTROY(sc); - LAGG_LOCK_DESTROY(sc); free(sc, M_DEVBUF); } @@ -580,7 +585,7 @@ lagg_capabilities(struct lagg_softc *sc) /* Get common enabled capabilities for the lagg ports */ ena = ~0; - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) + CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) ena &= lp->lp_ifp->if_capenable; ena = (ena == ~0 ? 0 : ena); @@ -590,7 +595,7 @@ lagg_capabilities(struct lagg_softc *sc) */ do { pena = ena; - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { + CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { lagg_setcaps(lp, ena); ena &= lp->lp_ifp->if_capenable; } @@ -600,7 +605,7 @@ lagg_capabilities(struct lagg_softc *sc) cap = ~0; hwa = ~(uint64_t)0; memset(&hw_tsomax, 0, sizeof(hw_tsomax)); - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { + CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { cap &= lp->lp_ifp->if_capabilities; hwa &= lp->lp_ifp->if_hwassist; if_hw_tsomax_common(lp->lp_ifp, &hw_tsomax); @@ -689,17 +694,14 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * bcopy(IF_LLADDR(ifp), lp->lp_lladdr, ETHER_ADDR_LEN); lp->lp_ifcapenable
svn commit: r333505 - in head/sys: netinet netinet6
Author: shurd Date: Fri May 11 21:42:27 2018 New Revision: 333505 URL: https://svnweb.freebsd.org/changeset/base/333505 Log: Fix LORs in in6?_leave_group() r333175 updated the join_group functions, but not the leave_group ones. Reviewed by: sbruno Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D15393 Modified: head/sys/netinet/in_mcast.c head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet/in_mcast.c == --- head/sys/netinet/in_mcast.c Fri May 11 20:47:45 2018(r333504) +++ head/sys/netinet/in_mcast.c Fri May 11 21:42:27 2018(r333505) @@ -2501,6 +2501,8 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop /* * Begin state merge transaction at IGMP layer. */ + in_pcbref(inp); + INP_WUNLOCK(inp); IN_MULTI_LOCK(); if (is_final) { @@ -2531,6 +2533,9 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop out_in_multi_locked: IN_MULTI_UNLOCK(); + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (ENXIO); if (error) imf_rollback(imf); Modified: head/sys/netinet6/in6_mcast.c == --- head/sys/netinet6/in6_mcast.c Fri May 11 20:47:45 2018 (r333504) +++ head/sys/netinet6/in6_mcast.c Fri May 11 21:42:27 2018 (r333505) @@ -2381,6 +2381,8 @@ in6p_leave_group(struct inpcb *inp, struct sockopt *so /* * Begin state merge transaction at MLD layer. */ + in_pcbref(inp); + INP_WUNLOCK(inp); IN6_MULTI_LOCK(); if (is_final) { @@ -2407,6 +2409,9 @@ in6p_leave_group(struct inpcb *inp, struct sockopt *so } IN6_MULTI_UNLOCK(); + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) + return (ENXIO); if (error) im6f_rollback(imf); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333503 - stable/11/sys/net
Author: shurd Date: Fri May 11 20:40:26 2018 New Revision: 333503 URL: https://svnweb.freebsd.org/changeset/base/333503 Log: MFC r29, r66, r73 r29: Fix off-by-one error requesting tx interrupt r66: Cleanup queues when iflib_device_register fails r73: Log iflib_tx_structures_setup failure in function Approved by: re (gjb@) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D15354 Modified: stable/11/sys/net/iflib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/iflib.c == --- stable/11/sys/net/iflib.c Fri May 11 20:08:28 2018(r333502) +++ stable/11/sys/net/iflib.c Fri May 11 20:40:26 2018(r333503) @@ -3269,7 +3269,7 @@ defrag: */ txq->ift_rs_pending += nsegs + 1; if (txq->ift_rs_pending > TXQ_MAX_RS_DEFERRED(txq) || -iflib_no_tx_batch || (TXQ_AVAIL(txq) - nsegs - 1) <= MAX_TX_DESC(ctx)) { +iflib_no_tx_batch || (TXQ_AVAIL(txq) - nsegs) <= MAX_TX_DESC(ctx) + 2) { pi.ipi_flags |= IPI_TX_INTR; txq->ift_rs_pending = 0; } @@ -4342,10 +4342,8 @@ iflib_device_register(device_t dev, void *sc, if_share goto fail; } - if ((err = iflib_qset_structures_setup(ctx))) { - device_printf(dev, "qset structure setup failed %d\n", err); + if ((err = iflib_qset_structures_setup(ctx))) goto fail_queues; - } /* * Group taskqueues aren't properly set up until SMP is started, * so we disable interrupts until we can handle them post @@ -4392,7 +4390,8 @@ fail_intr_free: if (scctx->isc_intr == IFLIB_INTR_MSIX || scctx->isc_intr == IFLIB_INTR_MSI) pci_release_msi(ctx->ifc_dev); fail_queues: - /* XXX free queues */ + iflib_tx_structures_free(ctx); + iflib_rx_structures_free(ctx); fail: IFDI_DETACH(ctx); return (err); @@ -5003,14 +5002,18 @@ iflib_qset_structures_setup(if_ctx_t ctx) { int err; - if ((err = iflib_tx_structures_setup(ctx)) != 0) + /* +* It is expected that the caller takes care of freeing queues if this +* fails. +*/ + if ((err = iflib_tx_structures_setup(ctx)) != 0) { + device_printf(ctx->ifc_dev, "iflib_tx_structures_setup failed: %d\n", err); return (err); + } - if ((err = iflib_rx_structures_setup(ctx)) != 0) { + if ((err = iflib_rx_structures_setup(ctx)) != 0) device_printf(ctx->ifc_dev, "iflib_rx_structures_setup failed: %d\n", err); - iflib_tx_structures_free(ctx); - iflib_rx_structures_free(ctx); - } + return (err); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333501 - head/usr.sbin/mld6query
Author: shurd Date: Fri May 11 19:37:18 2018 New Revision: 333501 URL: https://svnweb.freebsd.org/changeset/base/333501 Log: Fix mld6query(8) and add a new -g option The mld6query command relies on KAME behaviour which allows the ipv6mr_multiaddr member of the request object in a IPV6_JOIN_GROUP setsockopt() call to be INADDR6_ANY. The FreeBSD stack doesn't allow this, so mld6query has been non-functional. Also, add a -g option which sends a General Query (query INADDR6_ANY) Reviewed by: sbruno, mmacy Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D15384 Modified: head/usr.sbin/mld6query/mld6.c head/usr.sbin/mld6query/mld6query.8 Modified: head/usr.sbin/mld6query/mld6.c == --- head/usr.sbin/mld6query/mld6.c Fri May 11 18:37:14 2018 (r333500) +++ head/usr.sbin/mld6query/mld6.c Fri May 11 19:37:18 2018 (r333501) @@ -85,7 +85,7 @@ int s; #define QUERY_RESPONSE_INTERVAL 1 -void make_msg(int index, struct in6_addr *addr, u_int type); +void make_msg(int index, struct in6_addr *addr, u_int type, struct in6_addr *qaddr); void usage(void); void dump(int); void quit(int); @@ -100,14 +100,26 @@ main(int argc, char *argv[]) struct itimerval itimer; u_int type; int ch; + struct in6_addr *qaddr = &maddr; type = MLD_LISTENER_QUERY; - while ((ch = getopt(argc, argv, "dr")) != -1) { + while ((ch = getopt(argc, argv, "dgr")) != -1) { switch (ch) { case 'd': + if (type != MLD_LISTENER_QUERY) { + printf("Can not specifiy -d with -r\n"); + return 1; + } type = MLD_LISTENER_DONE; break; + case 'g': + qaddr = &any; + break; case 'r': + if (type != MLD_LISTENER_QUERY) { + printf("Can not specifiy -r with -d\n"); + return 1; + } type = MLD_LISTENER_REPORT; break; default: @@ -127,6 +139,10 @@ main(int argc, char *argv[]) usage(); if (argc == 2 && inet_pton(AF_INET6, argv[1], &maddr) != 1) usage(); + if (type != MLD_LISTENER_QUERY && qaddr != &maddr) { + printf("Can not specifiy -g with -d or -r\n"); + return 1; + } if ((s = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0) err(1, "socket"); @@ -135,7 +151,12 @@ main(int argc, char *argv[]) sizeof(hlim)) == -1) err(1, "setsockopt(IPV6_MULTICAST_HOPS)"); - mreq.ipv6mr_multiaddr = any; + if (IN6_IS_ADDR_UNSPECIFIED(&maddr)) { + if (inet_pton(AF_INET6, "ff02::1", &maddr) != 1) + errx(1, "inet_pton failed"); + } + + mreq.ipv6mr_multiaddr = maddr; mreq.ipv6mr_interface = ifindex; if (setsockopt(s, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1) @@ -149,7 +170,7 @@ main(int argc, char *argv[]) sizeof(filt)) < 0) err(1, "setsockopt(ICMP6_FILTER)"); - make_msg(ifindex, &maddr, type); + make_msg(ifindex, &maddr, type, qaddr); if (sendmsg(s, &m, 0) < 0) err(1, "sendmsg"); @@ -177,7 +198,7 @@ main(int argc, char *argv[]) } void -make_msg(int index, struct in6_addr *addr, u_int type) +make_msg(int index, struct in6_addr *addr, u_int type, struct in6_addr *qaddr) { static struct iovec iov[2]; static u_char *cmsgbuf; @@ -196,12 +217,7 @@ make_msg(int index, struct in6_addr *addr, u_int type) dst.sin6_len = sizeof(dst); dst.sin6_family = AF_INET6; - if (IN6_IS_ADDR_UNSPECIFIED(addr)) { - if (inet_pton(AF_INET6, "ff02::1", &dst.sin6_addr) != 1) - errx(1, "inet_pton failed"); - } - else - dst.sin6_addr = *addr; + dst.sin6_addr = *addr; m.msg_name = (caddr_t)&dst; m.msg_namelen = dst.sin6_len; iov[0].iov_base = (caddr_t)&mldh; @@ -212,7 +228,7 @@ make_msg(int index, struct in6_addr *addr, u_int type) bzero(&mldh, sizeof(mldh)); mldh.mld_type = type & 0xff; mldh.mld_maxdelay = htons(QUERY_RESPONSE_INTERVAL); - mldh.mld_addr = *addr; + mldh.mld_addr = *qaddr; /* MLD packet should be advertised from linklocal address */ getifaddrs(&ifa); @@ -337,7 +353,7 @@ dump(int s) void quit(int signum __unused) { - mreq.ipv6mr_multiaddr = any; + mreq.ipv6mr_multiaddr = maddr; mreq.ipv6mr_interface = ifindex;
svn commit: r333373 - head/sys/net
Author: shurd Date: Tue May 8 17:15:10 2018 New Revision: 73 URL: https://svnweb.freebsd.org/changeset/base/73 Log: iflib: print message when iflib_tx_structures_setup fails Print a message when iflib_tx_structures_setup fails, like we do for iflib_rx_structures_setup. Now that we always print a message from within iflib_qset_structures_setup when it fails, stop printing one in iflib_device_register() at the call site. Submitted by: Jacob Keller Reviewed by: gallatin MFC after:3 days Sponsored by: Intel Corporation Differential Revision:https://reviews.freebsd.org/D15300 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue May 8 17:14:54 2018(r72) +++ head/sys/net/iflib.cTue May 8 17:15:10 2018(r73) @@ -4398,10 +4398,8 @@ iflib_device_register(device_t dev, void *sc, if_share goto fail; } - if ((err = iflib_qset_structures_setup(ctx))) { - device_printf(dev, "qset structure setup failed %d\n", err); + if ((err = iflib_qset_structures_setup(ctx))) goto fail_queues; - } /* * Group taskqueues aren't properly set up until SMP is started, @@ -5070,8 +5068,10 @@ iflib_qset_structures_setup(if_ctx_t ctx) * It is expected that the caller takes care of freeing queues if this * fails. */ - if ((err = iflib_tx_structures_setup(ctx)) != 0) + if ((err = iflib_tx_structures_setup(ctx)) != 0) { + device_printf(ctx->ifc_dev, "iflib_tx_structures_setup failed: %d\n", err); return (err); + } if ((err = iflib_rx_structures_setup(ctx)) != 0) device_printf(ctx->ifc_dev, "iflib_rx_structures_setup failed: %d\n", err); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333366 - head/sys/net
Author: shurd Date: Tue May 8 16:56:02 2018 New Revision: 66 URL: https://svnweb.freebsd.org/changeset/base/66 Log: iflib: cleanup queues when iflib_device_register fail Submitted by: Jacob Keller Reviewed by: gallatin MFC after:3 days Sponsored by: Intel Corporation Differential Revision:https://reviews.freebsd.org/D15299 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue May 8 16:16:56 2018(r65) +++ head/sys/net/iflib.cTue May 8 16:56:02 2018(r66) @@ -4453,7 +4453,8 @@ fail_intr_free: if (scctx->isc_intr == IFLIB_INTR_MSIX || scctx->isc_intr == IFLIB_INTR_MSI) pci_release_msi(ctx->ifc_dev); fail_queues: - /* XXX free queues */ + iflib_tx_structures_free(ctx); + iflib_rx_structures_free(ctx); fail: IFDI_DETACH(ctx); CTX_UNLOCK(ctx); @@ -5065,14 +5066,16 @@ iflib_qset_structures_setup(if_ctx_t ctx) { int err; + /* +* It is expected that the caller takes care of freeing queues if this +* fails. +*/ if ((err = iflib_tx_structures_setup(ctx)) != 0) return (err); - if ((err = iflib_rx_structures_setup(ctx)) != 0) { + if ((err = iflib_rx_structures_setup(ctx)) != 0) device_printf(ctx->ifc_dev, "iflib_rx_structures_setup failed: %d\n", err); - iflib_tx_structures_free(ctx); - iflib_rx_structures_free(ctx); - } + return (err); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333364 - in stable/11: share/man/man4 sys/dev/bnxt
,20 +229,23 @@ As of this writing, the system must be rebooted to ini .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , +.Xr iflib 4 , .Xr netintro 4 , .Xr ng_ether 4 , .Xr vlan 4 , -.Xr ifconfig 8 , -.Xr iflib 4 +.Xr ifconfig 8 .Sh HISTORY The .Nm device driver first appeared in .Fx 11.1 . .Sh AUTHORS +.An -nosplit The .Nm driver was written by -.An Jack Vogel Aq Mt jfvo...@gmail.com . +.An Jack Vogel Aq Mt jfvo...@gmail.com +and +.An Stephen Hurd Aq Mt sh...@freebsd.org , and is currently maintained by -.An Stephen Hurd Aq Mt stephen.h...@broadcom.com . +.An Broadcom Limited Aq Mt freebsd@broadcom.com . Modified: stable/11/sys/dev/bnxt/bnxt.h == --- stable/11/sys/dev/bnxt/bnxt.h Tue May 8 13:23:39 2018 (r63) +++ stable/11/sys/dev/bnxt/bnxt.h Tue May 8 15:51:40 2018 (r64) @@ -93,6 +93,18 @@ __FBSDID("$FreeBSD$"); #define BNXT_MAX_MTU 9000 +#define BNXT_RSS_HASH_TYPE_TCPV4 0 +#define BNXT_RSS_HASH_TYPE_UDPV4 1 +#define BNXT_RSS_HASH_TYPE_IPV42 +#define BNXT_RSS_HASH_TYPE_TCPV6 3 +#define BNXT_RSS_HASH_TYPE_UDPV6 4 +#define BNXT_RSS_HASH_TYPE_IPV65 +#define BNXT_GET_RSS_PROFILE_ID(rss_hash_type) ((rss_hash_type >> 1) & 0x1F) + +#define BNXT_NO_MORE_WOL_FILTERS 0x +#define bnxt_wol_supported(softc) (!((softc)->flags & BNXT_FLAG_VF) && \ + ((softc)->flags & BNXT_FLAG_WOL_CAP )) + /* Completion related defines */ #define CMP_VALID(cmp, v_bit) \ ((!!(((struct cmpl_base *)(cmp))->info3_v & htole32(CMPL_BASE_V))) == !!(v_bit) ) @@ -199,10 +211,31 @@ __FBSDID("$FreeBSD$"); #define BNXT_HWRM_LOCK_DESTROY(_softc) mtx_destroy(&(_softc)->hwrm_lock) #define BNXT_HWRM_LOCK_ASSERT(_softc) mtx_assert(&(_softc)->hwrm_lock,\ MA_OWNED) +#define BNXT_IS_FLOW_CTRL_CHANGED(link_info) \ + ((link_info->last_flow_ctrl.tx != link_info->flow_ctrl.tx) || \ + (link_info->last_flow_ctrl.rx != link_info->flow_ctrl.rx) || \ +(link_info->last_flow_ctrl.autoneg != link_info->flow_ctrl.autoneg)) /* Chip info */ #define BNXT_TSO_SIZE UINT16_MAX +#define min_t(type, x, y) ({\ +type __min1 = (x); \ +type __min2 = (y); \ +__min1 < __min2 ? __min1 : __min2; }) + +#define max_t(type, x, y) ({\ +type __max1 = (x); \ +type __max2 = (y); \ +__max1 > __max2 ? __max1 : __max2; }) + +#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max) + +#define BNXT_IFMEDIA_ADD(supported, fw_speed, ifm_speed) do { \ + if ((supported) & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_ ## fw_speed) \ + ifmedia_add(softc->media, IFM_ETHER | (ifm_speed), 0, NULL); \ +} while(0) + #define BNXT_MIN_FRAME_SIZE52 /* Frames must be padded to this size for some A0 chips */ /* NVRAM access */ @@ -266,6 +299,12 @@ struct bnxt_bar_info { int rid; }; +struct bnxt_flow_ctrl { + bool rx; + bool tx; + bool autoneg; +}; + struct bnxt_link_info { uint8_t media_type; uint8_t transceiver; @@ -277,10 +316,8 @@ struct bnxt_link_info { uint8_t last_link_up; uint8_t duplex; uint8_t last_duplex; - uint8_t pause; - uint8_t last_pause; - uint8_t auto_pause; - uint8_t force_pause; + struct bnxt_flow_ctrl flow_ctrl; + struct bnxt_flow_ctrl last_flow_ctrl; uint8_t duplex_setting; uint8_t auto_mode; #define PHY_VER_LEN3 @@ -298,7 +335,6 @@ struct bnxt_link_info { #define BNXT_AUTONEG_SPEED 1 #define BNXT_AUTONEG_FLOW_CTRL 2 uint8_t req_duplex; - uint8_t req_flow_ctrl; uint16_treq_link_speed; }; @@ -372,7 +408,6 @@ struct bnxt_vf_info { bus_addr_t hwrm_cmd_req_dma_addr; }; -#define BNXT_FLAG_VF (1<<1) #define BNXT_PF(softc) (!((softc)->flags & BNXT_FLAG_VF)) #define BNXT_VF(softc) ((softc)->flags & BNXT_FLAG_VF) @@ -498,6 +533,21 @@ struct bnxt_nvram_info { struct sysctl_oid *nvm_oid; }; +struct bnxt_func_qcfg { + uint16_t alloc_completion_rings; + uint16_t alloc_tx_rings; + uint16_t alloc_rx_rings; + uint16_t alloc_vnics; +}; + +struct bnxt_hw_lro { + uint16_t enable; + uint16_t is_mode_gro; + uint16_t max_agg_segs; + uint16_t max_aggs; + uint32_t min_agg_len; +}; + struct bnxt_soft
svn commit: r333341 - stable/11/sys/net
Author: shurd Date: Mon May 7 23:10:02 2018 New Revision: 41 URL: https://svnweb.freebsd.org/changeset/base/41 Log: MFC r333253-r333254 Fixes invalid free()s when iflib_queues_alloc() fails, and remove unused brscp variable. Approved by: re (gjb@) Modified: stable/11/sys/net/iflib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/iflib.c == --- stable/11/sys/net/iflib.c Mon May 7 22:33:40 2018(r40) +++ stable/11/sys/net/iflib.c Mon May 7 23:10:02 2018(r41) @@ -4719,17 +4719,12 @@ iflib_queues_alloc(if_ctx_t ctx) int nfree_lists = sctx->isc_nfl ? sctx->isc_nfl : 1; caddr_t *vaddrs; uint64_t *paddrs; - struct ifmp_ring **brscp; KASSERT(ntxqs > 0, ("number of queues per qset must be at least 1")); KASSERT(nrxqs > 0, ("number of queues per qset must be at least 1")); - brscp = NULL; - txq = NULL; - rxq = NULL; - /* Allocate the TX ring struct memory */ - if (!(txq = + if (!(ctx->ifc_txqs = (iflib_txq_t) malloc(sizeof(struct iflib_txq) * ntxqsets, M_IFLIB, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate TX ring memory\n"); @@ -4738,7 +4733,7 @@ iflib_queues_alloc(if_ctx_t ctx) } /* Now allocate the RX */ - if (!(rxq = + if (!(ctx->ifc_rxqs = (iflib_rxq_t) malloc(sizeof(struct iflib_rxq) * nrxqsets, M_IFLIB, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate RX ring memory\n"); @@ -4746,8 +4741,8 @@ iflib_queues_alloc(if_ctx_t ctx) goto rx_fail; } - ctx->ifc_txqs = txq; - ctx->ifc_rxqs = rxq; + txq = ctx->ifc_txqs; + rxq = ctx->ifc_rxqs; /* * XXX handle allocation failure @@ -4905,19 +4900,13 @@ iflib_queues_alloc(if_ctx_t ctx) /* XXX handle allocation failure changes */ err_rx_desc: err_tx_desc: +rx_fail: if (ctx->ifc_rxqs != NULL) free(ctx->ifc_rxqs, M_IFLIB); ctx->ifc_rxqs = NULL; if (ctx->ifc_txqs != NULL) free(ctx->ifc_txqs, M_IFLIB); ctx->ifc_txqs = NULL; -rx_fail: - if (brscp != NULL) - free(brscp, M_IFLIB); - if (rxq != NULL) - free(rxq, M_IFLIB); - if (txq != NULL) - free(txq, M_IFLIB); fail: return (err); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333340 - stable/11/sys/net
Author: shurd Date: Mon May 7 22:33:40 2018 New Revision: 40 URL: https://svnweb.freebsd.org/changeset/base/40 Log: Direct commit to stable/11 to fix botched r38 netmap nm_intr is not part of stable/11 Approved by: re (marius@) Sponsored by: Limelight Networks Modified: stable/11/sys/net/iflib.c Modified: stable/11/sys/net/iflib.c == --- stable/11/sys/net/iflib.c Mon May 7 22:29:32 2018(r39) +++ stable/11/sys/net/iflib.c Mon May 7 22:33:40 2018(r40) @@ -1114,22 +1114,6 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl return (netmap_fl_refill(rxq, kring, nm_i, false)); } -static void -iflib_netmap_intr(struct netmap_adapter *na, int onoff) -{ - struct ifnet *ifp = na->ifp; - if_ctx_t ctx = ifp->if_softc; - - CTX_LOCK(ctx); - if (onoff) { - IFDI_INTR_ENABLE(ctx); - } else { - IFDI_INTR_DISABLE(ctx); - } - CTX_UNLOCK(ctx); -} - - static int iflib_netmap_attach(if_ctx_t ctx) { @@ -1148,7 +1132,6 @@ iflib_netmap_attach(if_ctx_t ctx) na.nm_txsync = iflib_netmap_txsync; na.nm_rxsync = iflib_netmap_rxsync; na.nm_register = iflib_netmap_register; - na.nm_intr = iflib_netmap_intr; na.num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; na.num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; return (netmap_attach(&na)); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333338 - in stable/11/sys: dev/bnxt kern net sys
Author: shurd Date: Mon May 7 21:42:22 2018 New Revision: 38 URL: https://svnweb.freebsd.org/changeset/base/38 Log: Merge iflib changes to 11-STABLE MFC r300147, r300153, r300154, r300215, r301563, r301567, r302372, r307560, r307562, r307563, r307568, r308792, r311039, r311837, r312755, r312903, r312905, r312924, r313248, r315217, r315245, r315288, r316278, r316281, r316502, r316596, r317756, r319917, r319921, r319984, r319989, r320059, r320609, r320611, r321253, r321629, r321630, r322337, r322338, r322823, r323077, r323825, r323876, r323879, r323887, r323941, r323942, r323943, r323944, r323954, r324038, r324318, r324937, r325166, r325167, r325168, r325201, r325241, r325245, r325487, r325494, r325901, r326033, r326369, r326370, r326432, r326577, r326578, r326702, r326706, r326775, r327013, r327017, r327052, r327072, r327098, r327242, r327244, r327247, r329651, r329742, r330289, r330715, r330721, r332419, r332422, r332729 Reviewed by: sbruno Approved by: re (delphij@) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D15142 Modified: stable/11/sys/dev/bnxt/bnxt.h stable/11/sys/dev/bnxt/bnxt_hwrm.c stable/11/sys/dev/bnxt/bnxt_txrx.c stable/11/sys/dev/bnxt/if_bnxt.c stable/11/sys/kern/kern_cpuset.c stable/11/sys/kern/kern_intr.c stable/11/sys/kern/subr_gtaskqueue.c stable/11/sys/net/ifdi_if.m stable/11/sys/net/iflib.c stable/11/sys/net/iflib.h stable/11/sys/net/mp_ring.c stable/11/sys/sys/_task.h stable/11/sys/sys/cpuset.h stable/11/sys/sys/interrupt.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bnxt/bnxt.h == --- stable/11/sys/dev/bnxt/bnxt.h Mon May 7 21:32:08 2018 (r37) +++ stable/11/sys/dev/bnxt/bnxt.h Mon May 7 21:42:22 2018 (r38) @@ -203,6 +203,8 @@ __FBSDID("$FreeBSD$"); /* Chip info */ #define BNXT_TSO_SIZE UINT16_MAX +#define BNXT_MIN_FRAME_SIZE52 /* Frames must be padded to this size for some A0 chips */ + /* NVRAM access */ enum bnxt_nvm_directory_type { BNX_DIR_TYPE_UNUSED = 0, @@ -427,6 +429,7 @@ struct bnxt_ring { uint32_tring_size; /* Must be a power of two */ uint16_tid; /* Logical ID */ uint16_tphys_id; + struct bnxt_full_tpa_start *tpa_start; }; struct bnxt_cp_ring { @@ -552,7 +555,6 @@ struct bnxt_softc { struct sysctl_ctx_list hw_stats; struct sysctl_oid *hw_stats_oid; - struct bnxt_full_tpa_start *tpa_start; struct bnxt_ver_info*ver_info; struct bnxt_nvram_info *nvm_info; }; Modified: stable/11/sys/dev/bnxt/bnxt_hwrm.c == --- stable/11/sys/dev/bnxt/bnxt_hwrm.c Mon May 7 21:32:08 2018 (r37) +++ stable/11/sys/dev/bnxt/bnxt_hwrm.c Mon May 7 21:42:22 2018 (r38) @@ -931,7 +931,7 @@ bnxt_hwrm_vnic_tpa_cfg(struct bnxt_softc *softc, struc /* TODO: Calculate this based on ring size? */ req.max_agg_segs = htole16(3); /* Base this in the allocated TPA start size... */ - req.max_aggs = htole16(2); + req.max_aggs = htole16(7); /* * TODO: max_agg_timer? * req.mag_agg_timer = htole32(XXX); Modified: stable/11/sys/dev/bnxt/bnxt_txrx.c == --- stable/11/sys/dev/bnxt/bnxt_txrx.c Mon May 7 21:32:08 2018 (r37) +++ stable/11/sys/dev/bnxt/bnxt_txrx.c Mon May 7 21:42:22 2018 (r38) @@ -48,17 +48,19 @@ __FBSDID("$FreeBSD$"); */ static int bnxt_isc_txd_encap(void *sc, if_pkt_info_t pi); -static void bnxt_isc_txd_flush(void *sc, uint16_t txqid, uint32_t pidx); -static int bnxt_isc_txd_credits_update(void *sc, uint16_t txqid, uint32_t cidx, -bool clear); +static void bnxt_isc_txd_flush(void *sc, uint16_t txqid, qidx_t pidx); +static int bnxt_isc_txd_credits_update(void *sc, uint16_t txqid, bool clear); -static void bnxt_isc_rxd_refill(void *sc, uint16_t rxqid, uint8_t flid, +static void bnxt_isc_rxd_refill(void *sc, if_rxd_update_t iru); + +/* uint16_t rxqid, uint8_t flid, uint32_t pidx, uint64_t *paddrs, caddr_t *vaddrs, uint16_t count, uint16_t buf_size); +*/ static void bnxt_isc_rxd_flush(void *sc, uint16_t rxqid, uint8_t flid, -uint32_t pidx); -static int bnxt_isc_rxd_available(void *sc, uint16_t rxqid, uint32_t idx, -int budget); +qidx_t pidx); +static int bnxt_isc_rxd_available(void *sc, uint16_t rxqid, qidx_t idx, +qidx_t budget); static int bnxt_isc_rxd_pkt_get(void *sc, if_rxd_info_t ri); static int bnxt_intr(void *sc); @@ -172,7 +174,7 @@ bnxt_isc_txd_encap(void *sc, if_pkt_info_t pi) } static void -bnxt_isc_txd_flush(void
svn commit: r333254 - head/sys/net
Author: shurd Date: Fri May 4 15:20:34 2018 New Revision: 333254 URL: https://svnweb.freebsd.org/changeset/base/333254 Log: iflib: fix invalid free during queue allocation failure In r301567, code was added to cleanup to prevent memory leaks for the Tx and Rx ring structs. This code carefully tracked txq and rxq, and made sure to free them properly during cleanup. Because we assigned the txq and rxq pointers into the ctx->ifc_txqs and ctx->ifc_rxqs, we carefully reset these pointers to NULL, so that cleanup code would not accidentally free the memory twice. This was changed by r304021 ("Update iflib to support more NIC designs"), which removed this resetting of the pointers to NULL, because it re-used the txq and rxq pointers as an index into the queue set array. Unfortunately, the cleanup code was left alone. Thus, if we fail to allocate DMA or fail to configure the queues using the drivers ifdi methods, we will attempt to free txq and rxq. These variables would now incorrectly point to the wrong location, resulting in a page fault. There are a number of methods to correct this, but ultimately the root cause was that we reuse the txq and rxq pointers for two different purposes. Instead, when allocating, store the returned pointer directly into ctx->ifc_txqs and ctx->ifc_rxqs. Then, assign this to txq and rxq as index pointers before starting the loop to allocate each queue. Drop the cleanup code for txq and rxq, and only use ctx->ifc_txqs and ctx->ifc_rxqs. Thus, we no longer need to free txq or rxq under any error flow, and intsead rely solely on the pointers stored in ctx->ifc_txqs and ctx->ifc_rxqs. This prevents the invalid free(), and ensures that we still properly cleanup after ourselves as before when failing to allocate. Submitted by: Jacob Keller Reviewed by: gallatin, sbruno Sponsored by: Intel Corporation Differential Revision:https://reviews.freebsd.org/D15285 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri May 4 15:11:16 2018(r333253) +++ head/sys/net/iflib.cFri May 4 15:20:34 2018(r333254) @@ -4777,11 +4777,8 @@ iflib_queues_alloc(if_ctx_t ctx) KASSERT(ntxqs > 0, ("number of queues per qset must be at least 1")); KASSERT(nrxqs > 0, ("number of queues per qset must be at least 1")); - txq = NULL; - rxq = NULL; - /* Allocate the TX ring struct memory */ - if (!(txq = + if (!(ctx->ifc_txqs = (iflib_txq_t) malloc(sizeof(struct iflib_txq) * ntxqsets, M_IFLIB, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate TX ring memory\n"); @@ -4790,7 +4787,7 @@ iflib_queues_alloc(if_ctx_t ctx) } /* Now allocate the RX */ - if (!(rxq = + if (!(ctx->ifc_rxqs = (iflib_rxq_t) malloc(sizeof(struct iflib_rxq) * nrxqsets, M_IFLIB, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate RX ring memory\n"); @@ -4798,8 +4795,8 @@ iflib_queues_alloc(if_ctx_t ctx) goto rx_fail; } - ctx->ifc_txqs = txq; - ctx->ifc_rxqs = rxq; + txq = ctx->ifc_txqs; + rxq = ctx->ifc_rxqs; /* * XXX handle allocation failure @@ -4957,17 +4954,13 @@ iflib_queues_alloc(if_ctx_t ctx) /* XXX handle allocation failure changes */ err_rx_desc: err_tx_desc: +rx_fail: if (ctx->ifc_rxqs != NULL) free(ctx->ifc_rxqs, M_IFLIB); ctx->ifc_rxqs = NULL; if (ctx->ifc_txqs != NULL) free(ctx->ifc_txqs, M_IFLIB); ctx->ifc_txqs = NULL; -rx_fail: - if (rxq != NULL) - free(rxq, M_IFLIB); - if (txq != NULL) - free(txq, M_IFLIB); fail: return (err); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333253 - head/sys/net
Author: shurd Date: Fri May 4 15:11:16 2018 New Revision: 333253 URL: https://svnweb.freebsd.org/changeset/base/333253 Log: iflib: remove unused brscp pointer from iflib_queues_alloc This pointer was no longer written to as of r315217. Since nothing writes to the variable, remove it. Submitted by: Jacob Keller Reviewed by: gallatin, kmacy, sbruno Differential Revision:https://reviews.freebsd.org/D15284 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri May 4 14:49:37 2018(r333252) +++ head/sys/net/iflib.cFri May 4 15:11:16 2018(r333253) @@ -4773,12 +4773,10 @@ iflib_queues_alloc(if_ctx_t ctx) int nfree_lists = sctx->isc_nfl ? sctx->isc_nfl : 1; caddr_t *vaddrs; uint64_t *paddrs; - struct ifmp_ring **brscp; KASSERT(ntxqs > 0, ("number of queues per qset must be at least 1")); KASSERT(nrxqs > 0, ("number of queues per qset must be at least 1")); - brscp = NULL; txq = NULL; rxq = NULL; @@ -4966,8 +4964,6 @@ err_tx_desc: free(ctx->ifc_txqs, M_IFLIB); ctx->ifc_txqs = NULL; rx_fail: - if (brscp != NULL) - free(brscp, M_IFLIB); if (rxq != NULL) free(rxq, M_IFLIB); if (txq != NULL) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333218 - head/sys/net
Author: shurd Date: Thu May 3 17:02:31 2018 New Revision: 333218 URL: https://svnweb.freebsd.org/changeset/base/333218 Log: Allow iflib NIC drivers to sleep rather than busy wait Since the move to SMP NIC driver locking has had to go through serious contortions using mtx around long running hardware operations. This moves iflib past that. Individual drivers may now sleep when appropriate. Submitted by: Matthew Macy Reviewed by: shurd Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D14983 Modified: head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cThu May 3 16:19:47 2018(r333217) +++ head/sys/net/iflib.cThu May 3 17:02:31 2018(r333218) @@ -163,7 +163,7 @@ struct iflib_ctx { if_shared_ctx_t ifc_sctx; struct if_softc_ctx ifc_softc_ctx; - struct mtx ifc_ctx_mtx; + struct sx ifc_ctx_sx; struct mtx ifc_state_mtx; uint16_t ifc_nhwtxqs; @@ -537,10 +537,10 @@ rxd_info_zero(if_rxd_info_t ri) #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) & IFF_DRV_RUNNING)) -#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_ctx_mtx, _name, "iflib ctx lock", MTX_DEF) -#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx) -#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx) -#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx) +#define CTX_LOCK_INIT(_sc) sx_init(&(_sc)->ifc_ctx_sx, "iflib ctx lock") +#define CTX_LOCK(ctx) sx_xlock(&(ctx)->ifc_ctx_sx) +#define CTX_UNLOCK(ctx) sx_xunlock(&(ctx)->ifc_ctx_sx) +#define CTX_LOCK_DESTROY(ctx) sx_destroy(&(ctx)->ifc_ctx_sx) #define STATE_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_state_mtx, _name, "iflib state lock", MTX_DEF) @@ -4277,7 +4277,9 @@ iflib_device_register(device_t dev, void *sc, if_share } } + CTX_LOCK(ctx); if ((err = IFDI_ATTACH_PRE(ctx)) != 0) { + CTX_UNLOCK(ctx); device_printf(dev, "IFDI_ATTACH_PRE failed %d\n", err); return (err); } @@ -4435,6 +4437,7 @@ iflib_device_register(device_t dev, void *sc, if_share if_setgetcounterfn(ctx->ifc_ifp, iflib_if_get_counter); iflib_add_device_sysctl_post(ctx); ctx->ifc_flags |= IFC_INIT_DONE; + CTX_UNLOCK(ctx); return (0); fail_detach: ether_ifdetach(ctx->ifc_ifp); @@ -4445,6 +4448,7 @@ fail_queues: /* XXX free queues */ fail: IFDI_DETACH(ctx); + CTX_UNLOCK(ctx); return (err); } @@ -4711,8 +4715,7 @@ iflib_register(if_ctx_t ctx) _iflib_assert(sctx); - CTX_LOCK_INIT(ctx, device_get_nameunit(ctx->ifc_dev)); - + CTX_LOCK_INIT(ctx); STATE_LOCK_INIT(ctx, device_get_nameunit(ctx->ifc_dev)); ifp = ctx->ifc_ifp = if_gethandle(IFT_ETHER); if (ifp == NULL) { @@ -5457,8 +5460,8 @@ iflib_io_tqg_attach(struct grouptask *gt, void *uniq, } void -iflib_config_gtask_init(if_ctx_t ctx, struct grouptask *gtask, gtask_fn_t *fn, - char *name) +iflib_config_gtask_init(void *ctx, struct grouptask *gtask, gtask_fn_t *fn, + const char *name) { GROUPTASK_INIT(gtask, 0, fn, ctx); @@ -5538,11 +5541,11 @@ iflib_add_int_delay_sysctl(if_ctx_t ctx, const char *n info, 0, iflib_sysctl_int_delay, "I", description); } -struct mtx * +struct sx * iflib_ctx_lock_get(if_ctx_t ctx) { - return (&ctx->ifc_ctx_mtx); + return (&ctx->ifc_ctx_sx); } static int Modified: head/sys/net/iflib.h == --- head/sys/net/iflib.hThu May 3 16:19:47 2018(r333217) +++ head/sys/net/iflib.hThu May 3 17:02:31 2018(r333218) @@ -373,8 +373,8 @@ void iflib_irq_free(if_ctx_t ctx, if_irq_t irq); void iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, char *name); -void iflib_config_gtask_init(if_ctx_t ctx, struct grouptask *gtask, -gtask_fn_t *fn, char *name); +void iflib_config_gtask_init(void *ctx, struct grouptask *gtask, +gtask_fn_t *fn, const char *name); void iflib_config_gtask_deinit(struct grouptask *gtask); @@ -396,7 +396,7 @@ int iflib_dma_alloc_multi(if_ctx_t ctx, int *sizes, if void iflib_dma_free_multi(iflib_dma_info_t *dmalist, int count); -struct mtx *iflib_ctx_lock_get(if_ctx_t); +struct sx *iflib_ctx_lock_get(if_ctx_t); struct mtx *iflib_qset_lock_get(if_ctx_t, uint16_t); void iflib_led_create(if_ctx_t ctx); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333175 - in head/sys: kern net netinet netinet6 sys
Author: shurd Date: Wed May 2 19:36:29 2018 New Revision: 333175 URL: https://svnweb.freebsd.org/changeset/base/333175 Log: Separate list manipulation locking from state change in multicast Multicast incorrectly calls in to drivers with a mutex held causing drivers to have to go through all manner of contortions to use a non sleepable lock. Serialize multicast updates instead. Submitted by: mmacy Reviewed by: shurd, sbruno Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D14969 Modified: head/sys/kern/subr_gtaskqueue.c head/sys/kern/subr_witness.c head/sys/net/if.c head/sys/netinet/igmp.c head/sys/netinet/igmp_var.h head/sys/netinet/in.c head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_var.h head/sys/netinet/ip_carp.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_mcast.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_var.h head/sys/netinet6/mld6.c head/sys/netinet6/mld6_var.h head/sys/sys/gtaskqueue.h Modified: head/sys/kern/subr_gtaskqueue.c == --- head/sys/kern/subr_gtaskqueue.c Wed May 2 17:41:00 2018 (r333174) +++ head/sys/kern/subr_gtaskqueue.c Wed May 2 19:36:29 2018 (r333175) @@ -53,6 +53,7 @@ static void gtaskqueue_thread_enqueue(void *); static voidgtaskqueue_thread_loop(void *arg); TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); +TASKQGROUP_DEFINE(config, 1, 1); struct gtaskqueue_busy { struct gtask*tb_running; @@ -662,7 +663,7 @@ SYSINIT(tqg_record_smp_started, SI_SUB_SMP, SI_ORDER_F void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, -void *uniq, int irq, char *name) +void *uniq, int irq, const char *name) { cpuset_t mask; int qid, error; @@ -976,4 +977,13 @@ void taskqgroup_destroy(struct taskqgroup *qgroup) { +} + +void +taskqgroup_config_gtask_init(void *ctx, struct grouptask *gtask, gtask_fn_t *fn, + const char *name) +{ + + GROUPTASK_INIT(gtask, 0, fn, ctx); + taskqgroup_attach(qgroup_config, gtask, gtask, -1, name); } Modified: head/sys/kern/subr_witness.c == --- head/sys/kern/subr_witness.cWed May 2 17:41:00 2018 (r333174) +++ head/sys/kern/subr_witness.cWed May 2 19:36:29 2018 (r333175) @@ -532,18 +532,22 @@ static struct witness_order_list_entry order_lists[] = * IPv4 multicast: * protocol locks before interface locks, after UDP locks. */ + { "in_multi_sx", &lock_class_sx }, { "udpinp", &lock_class_rw }, - { "in_multi_mtx", &lock_class_mtx_sleep }, + { "in_multi_list_mtx", &lock_class_mtx_sleep }, { "igmp_mtx", &lock_class_mtx_sleep }, + { "ifnet_rw", &lock_class_rw }, { "if_addr_lock", &lock_class_rw }, { NULL, NULL }, /* * IPv6 multicast: * protocol locks before interface locks, after UDP locks. */ + { "in6_multi_sx", &lock_class_sx }, { "udpinp", &lock_class_rw }, - { "in6_multi_mtx", &lock_class_mtx_sleep }, + { "in6_multi_list_mtx", &lock_class_mtx_sleep }, { "mld_mtx", &lock_class_mtx_sleep }, + { "ifnet_rw", &lock_class_rw }, { "if_addr_lock", &lock_class_rw }, { NULL, NULL }, /* Modified: head/sys/net/if.c == --- head/sys/net/if.c Wed May 2 17:41:00 2018(r333174) +++ head/sys/net/if.c Wed May 2 19:36:29 2018(r333175) @@ -985,11 +985,13 @@ static void if_purgemaddrs(struct ifnet *ifp) { struct ifmultiaddr *ifma; - struct ifmultiaddr *next; IF_ADDR_WLOCK(ifp); - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) + while (!TAILQ_EMPTY(&ifp->if_multiaddrs)) { + ifma = TAILQ_FIRST(&ifp->if_multiaddrs); + TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); if_delmulti_locked(ifp, ifma, 1); + } IF_ADDR_WUNLOCK(ifp); } @@ -3429,6 +3431,12 @@ if_addmulti(struct ifnet *ifp, struct sockaddr *sa, struct sockaddr_dl sdl; int error; +#ifdef INET + IN_MULTI_LIST_UNLOCK_ASSERT(); +#endif +#ifdef INET6 + IN6_MULTI_LIST_UNLOCK_ASSERT(); +#endif /* * If the address is already present, return a new reference to it; * otherwise, allocate storage and set up a new address. @@ -3610,6 +3618,9 @@ if_delmulti_ifma(struct ifmultiaddr *ifma) struct ifnet *ifp; int lastref; +#ifdef INET + IN_MULTI_LIST_UNLOCK_ASSERT(); +#endif ifp = ifma->ifma_ifp; #ifdef DIAGNOSTIC if (ifp == NULL) { @@ -3711,8 +3722,7 @@ if_delmulti_locked(struct ifnet *ifp, struct ifmultiad
svn commit: r332734 - in stable/11/sys: kern net
Author: shurd Date: Wed Apr 18 18:45:04 2018 New Revision: 332734 URL: https://svnweb.freebsd.org/changeset/base/332734 Log: MFC r332388: Make BPF global lock an SX This allows NIC drivers to sleep on polling config operations. PR: 323477 Submitted by: Matthew Macy Reviewed by: shurd Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D14982 Modified: stable/11/sys/kern/subr_witness.c stable/11/sys/net/bpf.c stable/11/sys/net/bpfdesc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_witness.c == --- stable/11/sys/kern/subr_witness.c Wed Apr 18 18:36:26 2018 (r332733) +++ stable/11/sys/kern/subr_witness.c Wed Apr 18 18:45:04 2018 (r332734) @@ -567,7 +567,7 @@ static struct witness_order_list_entry order_lists[] = /* * BPF */ - { "bpf global lock", &lock_class_mtx_sleep }, + { "bpf global lock", &lock_class_sx }, { "bpf interface lock", &lock_class_rw }, { "bpf cdev lock", &lock_class_mtx_sleep }, { NULL, NULL }, Modified: stable/11/sys/net/bpf.c == --- stable/11/sys/net/bpf.c Wed Apr 18 18:36:26 2018(r332733) +++ stable/11/sys/net/bpf.c Wed Apr 18 18:45:04 2018(r332734) @@ -157,6 +157,9 @@ struct bpf_dltlist32 { #defineBIOCSETFNR32_IOW('B', 130, struct bpf_program32) #endif +#define BPF_LOCK()sx_xlock(&bpf_sx) +#define BPF_UNLOCK() sx_xunlock(&bpf_sx) +#define BPF_LOCK_ASSERT() sx_assert(&bpf_sx, SA_XLOCKED) /* * bpf_iflist is a list of BPF interface structures, each corresponding to a * specific DLT. The same network interface might have several BPF interface @@ -164,7 +167,7 @@ struct bpf_dltlist32 { * frames, ethernet frames, etc). */ static LIST_HEAD(, bpf_if) bpf_iflist, bpf_freelist; -static struct mtx bpf_mtx;/* bpf global lock */ +static struct sx bpf_sx; /* bpf global lock */ static int bpf_bpfd_cnt; static voidbpf_attachd(struct bpf_d *, struct bpf_if *); @@ -2800,7 +2803,7 @@ bpf_drvinit(void *unused) { struct cdev *dev; - mtx_init(&bpf_mtx, "bpf global lock", NULL, MTX_DEF); + sx_init(&bpf_sx, "bpf global lock"); LIST_INIT(&bpf_iflist); LIST_INIT(&bpf_freelist); Modified: stable/11/sys/net/bpfdesc.h == --- stable/11/sys/net/bpfdesc.h Wed Apr 18 18:36:26 2018(r332733) +++ stable/11/sys/net/bpfdesc.h Wed Apr 18 18:45:04 2018(r332734) @@ -115,9 +115,6 @@ struct bpf_d { #define BPF_PID_REFRESH(bd, td)(bd)->bd_pid = (td)->td_proc->p_pid #define BPF_PID_REFRESH_CUR(bd)(bd)->bd_pid = curthread->td_proc->p_pid -#define BPF_LOCK() mtx_lock(&bpf_mtx) -#define BPF_UNLOCK() mtx_unlock(&bpf_mtx) -#define BPF_LOCK_ASSERT() mtx_assert(&bpf_mtx, MA_OWNED) /* * External representation of the bpf descriptor */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r332729 - head/sys/net
Author: shurd Date: Wed Apr 18 15:34:18 2018 New Revision: 332729 URL: https://svnweb.freebsd.org/changeset/base/332729 Log: iflib: Fix queue distribution when there are no threads Previously, if there are no threads, all queues which targeted cores that share an L2 cache were bound to a single core. The intent is to distribute them across these cores. Reported by: olivier Reviewed by: sbruno Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D15120 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Apr 18 14:55:01 2018(r332728) +++ head/sys/net/iflib.cWed Apr 18 15:34:18 2018(r332729) @@ -5117,13 +5117,18 @@ find_child_with_core(int cpu, struct cpu_group *grp) } /* - * Find the nth thread on the specified core + * Find the nth "close" core to the specified core + * "close" is defined as the deepest level that shares + * at least an L2 cache. With threads, this will be + * threads on the same core. If the sahred cache is L3 + * or higher, simply returns the same core. */ static int -find_thread(int cpu, int thread_num) +find_close_core(int cpu, int core_offset) { struct cpu_group *grp; int i; + int fcpu; cpuset_t cs; grp = cpu_top; @@ -5143,7 +5148,19 @@ find_thread(int cpu, int thread_num) /* Now pick one */ CPU_COPY(&grp->cg_mask, &cs); - for (i = thread_num % grp->cg_count; i > 0; i--) { + + /* Add the selected CPU offset to core offset. */ + for (i = 0; (fcpu = CPU_FFS(&cs)) != 0; i++) { + if (fcpu - 1 == cpu) + break; + CPU_CLR(fcpu - 1, &cs); + } + MPASS(fcpu); + + core_offset += i; + + CPU_COPY(&grp->cg_mask, &cs); + for (i = core_offset % grp->cg_count; i > 0; i--) { MPASS(CPU_FFS(&cs)); CPU_CLR(CPU_FFS(&cs) - 1, &cs); } @@ -5152,31 +5169,31 @@ find_thread(int cpu, int thread_num) } #else static int -find_thread(int cpu, int thread_num __unused) +find_close_core(int cpu, int core_offset __unused) { return cpu; } #endif static int -get_thread_num(if_ctx_t ctx, iflib_intr_type_t type, int qid) +get_core_offset(if_ctx_t ctx, iflib_intr_type_t type, int qid) { switch (type) { case IFLIB_INTR_TX: - /* TX queues get threads on the same core as the corresponding RX queue */ - /* XXX handle multiple RX threads per core and more than two threads per core */ + /* TX queues get cores which share at least an L2 cache with the corresponding RX queue */ + /* XXX handle multiple RX threads per core and more than two core per L2 group */ return qid / CPU_COUNT(&ctx->ifc_cpus) + 1; case IFLIB_INTR_RX: case IFLIB_INTR_RXTX: - /* RX queues get the first thread on their core */ + /* RX queues get the specified core */ return qid / CPU_COUNT(&ctx->ifc_cpus); default: return -1; } } #else -#define get_thread_num(ctx, type, qid) CPU_FIRST() -#define find_thread(cpuid, tid)CPU_FIRST() +#define get_core_offset(ctx, type, qid)CPU_FIRST() +#define find_close_core(cpuid, tid)CPU_FIRST() #define find_nth(ctx, gid) CPU_FIRST() #endif @@ -5189,9 +5206,9 @@ iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_in int err, tid; cpuid = find_nth(ctx, qid); - tid = get_thread_num(ctx, type, qid); + tid = get_core_offset(ctx, type, qid); MPASS(tid >= 0); - cpuid = find_thread(cpuid, tid); + cpuid = find_close_core(cpuid, tid); err = taskqgroup_attach_cpu(tqg, gtask, uniq, cpuid, irq, name); if (err) { device_printf(ctx->ifc_dev, "taskqgroup_attach_cpu failed %d\n", err); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r332481 - stable/11/sys/dev/ixgbe
Author: shurd Date: Fri Apr 13 17:45:54 2018 New Revision: 332481 URL: https://svnweb.freebsd.org/changeset/base/332481 Log: Move 1-second spin into ixgbe_netmap_reg() This should still work around the netmap issue, but should not impact other calls to ixgbe_stop(). PR: 221317 Sponsored by: Limelight Networks Modified: stable/11/sys/dev/ixgbe/if_ix.c stable/11/sys/dev/ixgbe/ixgbe_netmap.c Modified: stable/11/sys/dev/ixgbe/if_ix.c == --- stable/11/sys/dev/ixgbe/if_ix.c Fri Apr 13 17:37:39 2018 (r332480) +++ stable/11/sys/dev/ixgbe/if_ix.c Fri Apr 13 17:45:54 2018 (r332481) @@ -3567,8 +3567,6 @@ ixgbe_stop(void *arg) mtx_assert(&adapter->core_mtx, MA_OWNED); - msec_delay(1000); - INIT_DEBUGOUT("ixgbe_stop: begin\n"); ixgbe_disable_intr(adapter); callout_stop(&adapter->timer); Modified: stable/11/sys/dev/ixgbe/ixgbe_netmap.c == --- stable/11/sys/dev/ixgbe/ixgbe_netmap.c Fri Apr 13 17:37:39 2018 (r332480) +++ stable/11/sys/dev/ixgbe/ixgbe_netmap.c Fri Apr 13 17:45:54 2018 (r332481) @@ -151,6 +151,7 @@ ixgbe_netmap_reg(struct netmap_adapter *na, int onoff) struct adapter *adapter = ifp->if_softc; IXGBE_CORE_LOCK(adapter); + msec_delay(1000); adapter->stop_locked(adapter); set_crcstrip(&adapter->hw, onoff); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r332447 - stable/11/sys/dev/ixgbe
Yeah, I'm looking at the changes that caused this now. Hopefully I'll have this updated today. On Thu, Apr 12, 2018 at 4:01 PM, Ryan Stone wrote: > Spinning in the kernel for a full second is a really bad idea. At > minimum this is going to hold off all callouts from one of the callout > threads for up to a full second as ixgbe_local_timer() waits for the > core mutex. That chews up two CPU cores doing busy-wait loops (the > ixgbe_stop() thread busy-waits in msec_delay and the callout thread > adaptively spins waiting for the mutex). If any other thread tries to > acquire the core lock they also adaptively spin on the mutex chewing > up yet more cores. This includes any threads trying to fetch > interface status (e.g. ifconfig), various interrupt handlers, etc. > -- [image: Limelight Networks] <http://www.limelight.com> Stephen Hurd* Principal Engineer* EXPERIENCE FIRST. +1 616 848 0643 <+1+616+848+0643> www.limelight.com [image: Facebook] <https://www.facebook.com/LimelightNetworks>[image: LinkedIn] <http://www.linkedin.com/company/limelight-networks>[image: Twitter] <https://twitter.com/llnw> ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r332447 - stable/11/sys/dev/ixgbe
Author: shurd Date: Thu Apr 12 19:06:15 2018 New Revision: 332447 URL: https://svnweb.freebsd.org/changeset/base/332447 Log: Work around netmap issue with ixgbe After multiple start/stop of netmap, ixgbe will get into a bad state requiring a reboot to recover. Adding a delay before stopping the interface appears to work around the issue. The -CURRENT driver has diverged too far from -STABLE for an MFC. PR: 221317 Submitted by: Sylvain Galliano Reported by: Cassiano Peixoto Sponsored by: Limelight Networks Modified: stable/11/sys/dev/ixgbe/if_ix.c Modified: stable/11/sys/dev/ixgbe/if_ix.c == --- stable/11/sys/dev/ixgbe/if_ix.c Thu Apr 12 19:00:22 2018 (r332446) +++ stable/11/sys/dev/ixgbe/if_ix.c Thu Apr 12 19:06:15 2018 (r332447) @@ -3567,6 +3567,8 @@ ixgbe_stop(void *arg) mtx_assert(&adapter->core_mtx, MA_OWNED); + msec_delay(1000); + INIT_DEBUGOUT("ixgbe_stop: begin\n"); ixgbe_disable_intr(adapter); callout_stop(&adapter->timer); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r332419 - head/sys/net
Author: shurd Date: Wed Apr 11 21:41:59 2018 New Revision: 332419 URL: https://svnweb.freebsd.org/changeset/base/332419 Log: Properly initialize ifc_nhwtxqs. Also, since ifc_nhwrxqs is only used in one place, remove it from the struct. This was preventing iflib_dma_free() from being called via iflib_device_detach(). Submitted by: Matthew Macy Reviewed by: shurd Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Apr 11 20:04:06 2018(r332418) +++ head/sys/net/iflib.cWed Apr 11 21:41:59 2018(r332419) @@ -166,7 +166,6 @@ struct iflib_ctx { struct mtx ifc_mtx; uint16_t ifc_nhwtxqs; - uint16_t ifc_nhwrxqs; iflib_txq_t ifc_txqs; iflib_rxq_t ifc_rxqs; @@ -2289,7 +2288,7 @@ iflib_stop(if_ctx_t ctx) for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { /* make sure all transmitters have completed before proceeding XXX */ - for (j = 0, di = txq->ift_ifdi; j < ctx->ifc_nhwrxqs; j++, di++) + for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); /* also resets the free lists pidx/cidx */ for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) @@ -4198,6 +4197,7 @@ iflib_device_register(device_t dev, void *sc, if_share scctx = &ctx->ifc_softc_ctx; ifp = ctx->ifc_ifp; + ctx->ifc_nhwtxqs = sctx->isc_ntxqs; /* * XXX sanity check that ntxd & nrxd are a power of 2 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r332389 - head/sys/net
Author: shurd Date: Tue Apr 10 19:48:24 2018 New Revision: 332389 URL: https://svnweb.freebsd.org/changeset/base/332389 Log: Split out flag manipulation from general context manipulation in iflib To avoid blocking on the context lock in the swi thread and risk potential deadlocks, this change protects lighter weight updates that only need to be consistent with each other with their own lock. Submitted by: Matthew Macy Reviewed by: shurd Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D14967 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue Apr 10 19:42:50 2018(r332388) +++ head/sys/net/iflib.cTue Apr 10 19:48:24 2018(r332389) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2017, Matthew Macy + * Copyright (c) 2014-2018, Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -163,7 +163,8 @@ struct iflib_ctx { if_shared_ctx_t ifc_sctx; struct if_softc_ctx ifc_softc_ctx; - struct mtx ifc_mtx; + struct mtx ifc_ctx_mtx; + struct mtx ifc_state_mtx; uint16_t ifc_nhwtxqs; uint16_t ifc_nhwrxqs; @@ -318,8 +319,10 @@ typedef struct iflib_sw_tx_desc_array { #defineIFC_INIT_DONE 0x020 #defineIFC_PREFETCH0x040 #defineIFC_DO_RESET0x080 -#defineIFC_CHECK_HUNG 0x100 +#defineIFC_DO_WATCHDOG 0x100 +#defineIFC_CHECK_HUNG 0x200 + #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) @@ -535,13 +538,19 @@ rxd_info_zero(if_rxd_info_t ri) #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) & IFF_DRV_RUNNING)) -#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_mtx, _name, "iflib ctx lock", MTX_DEF) +#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_ctx_mtx, _name, "iflib ctx lock", MTX_DEF) +#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx) +#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx) +#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx) -#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_mtx) -#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_mtx) -#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_mtx) +#define STATE_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_state_mtx, _name, "iflib state lock", MTX_DEF) +#define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx) +#define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx) +#define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx) + + #define CALLOUT_LOCK(txq) mtx_lock(&txq->ift_mtx) #define CALLOUT_UNLOCK(txq)mtx_unlock(&txq->ift_mtx) @@ -2144,18 +2153,14 @@ iflib_timer(void *arg) if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, txq->ift_timer.c_cpu); return; -hung: - CTX_LOCK(ctx); - if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); + hung: device_printf(ctx->ifc_dev, "TX(%d) desc avail = %d, pidx = %d\n", txq->ift_id, TXQ_AVAIL(txq), txq->ift_pidx); - - IFDI_WATCHDOG_RESET(ctx); - ctx->ifc_watchdog_events++; - - ctx->ifc_flags |= IFC_DO_RESET; + STATE_LOCK(ctx); + if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); + ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET); iflib_admin_intr_deferred(ctx); - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); } static void @@ -2673,10 +2678,10 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) return true; return (iflib_rxd_avail(ctx, rxq, *cidxp, 1)); err: - CTX_LOCK(ctx); + STATE_LOCK(ctx); ctx->ifc_flags |= IFC_DO_RESET; iflib_admin_intr_deferred(ctx); - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); return (false); } @@ -3706,27 +3711,35 @@ _task_fn_admin(void *context) if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; iflib_txq_t txq; int i; + bool oactive, running, do_reset, do_watchdog; - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) { - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE)) { - return; - } - } + STATE_LOCK(ctx); + running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING); + oactive = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE); + do_reset = (ctx->ifc_flags & IFC_DO_RESET); + do_watchdog = (ctx->ifc_flags & IFC_DO_WATCHDOG); + ctx->ifc_flags &= ~(IFC_DO_RESET|IFC_DO_WATCHDOG); + STATE_UNLOCK(ctx); + if (!runni
svn commit: r332388 - in head/sys: kern net
Author: shurd Date: Tue Apr 10 19:42:50 2018 New Revision: 332388 URL: https://svnweb.freebsd.org/changeset/base/332388 Log: Make BPF global lock an SX This allows NIC drivers to sleep on polling config operations. Submitted by: Matthew Macy Reviewed by: shurd Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D14982 Modified: head/sys/kern/subr_witness.c head/sys/net/bpf.c head/sys/net/bpfdesc.h Modified: head/sys/kern/subr_witness.c == --- head/sys/kern/subr_witness.cTue Apr 10 19:18:16 2018 (r332387) +++ head/sys/kern/subr_witness.cTue Apr 10 19:42:50 2018 (r332388) @@ -569,7 +569,7 @@ static struct witness_order_list_entry order_lists[] = /* * BPF */ - { "bpf global lock", &lock_class_mtx_sleep }, + { "bpf global lock", &lock_class_sx }, { "bpf interface lock", &lock_class_rw }, { "bpf cdev lock", &lock_class_mtx_sleep }, { NULL, NULL }, Modified: head/sys/net/bpf.c == --- head/sys/net/bpf.c Tue Apr 10 19:18:16 2018(r332387) +++ head/sys/net/bpf.c Tue Apr 10 19:42:50 2018(r332388) @@ -159,6 +159,9 @@ struct bpf_dltlist32 { #defineBIOCSETFNR32_IOW('B', 130, struct bpf_program32) #endif +#define BPF_LOCK()sx_xlock(&bpf_sx) +#define BPF_UNLOCK() sx_xunlock(&bpf_sx) +#define BPF_LOCK_ASSERT() sx_assert(&bpf_sx, SA_XLOCKED) /* * bpf_iflist is a list of BPF interface structures, each corresponding to a * specific DLT. The same network interface might have several BPF interface @@ -166,7 +169,7 @@ struct bpf_dltlist32 { * frames, ethernet frames, etc). */ static LIST_HEAD(, bpf_if) bpf_iflist, bpf_freelist; -static struct mtx bpf_mtx;/* bpf global lock */ +static struct sx bpf_sx; /* bpf global lock */ static int bpf_bpfd_cnt; static voidbpf_attachd(struct bpf_d *, struct bpf_if *); @@ -2821,7 +2824,7 @@ bpf_drvinit(void *unused) { struct cdev *dev; - mtx_init(&bpf_mtx, "bpf global lock", NULL, MTX_DEF); + sx_init(&bpf_sx, "bpf global lock"); LIST_INIT(&bpf_iflist); LIST_INIT(&bpf_freelist); Modified: head/sys/net/bpfdesc.h == --- head/sys/net/bpfdesc.h Tue Apr 10 19:18:16 2018(r332387) +++ head/sys/net/bpfdesc.h Tue Apr 10 19:42:50 2018(r332388) @@ -118,9 +118,6 @@ struct bpf_d { #define BPF_PID_REFRESH(bd, td)(bd)->bd_pid = (td)->td_proc->p_pid #define BPF_PID_REFRESH_CUR(bd)(bd)->bd_pid = curthread->td_proc->p_pid -#define BPF_LOCK() mtx_lock(&bpf_mtx) -#define BPF_UNLOCK() mtx_unlock(&bpf_mtx) -#define BPF_LOCK_ASSERT() mtx_assert(&bpf_mtx, MA_OWNED) /* * External representation of the bpf descriptor */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r331310 - head/sys/dev/e1000
Author: shurd Date: Wed Mar 21 15:57:36 2018 New Revision: 331310 URL: https://svnweb.freebsd.org/changeset/base/331310 Log: Update copyright per Matthew Macy "Under my tutelage Nicole did 85% of the work. At the time it seemed simplest for a number of reasons to put my copyright on it. I now consider that to have been a mistake." Submitted by: Matthew Macy Reviewed by: shurd Approved by: shurd Differential Revision:https://reviews.freebsd.org/D14766 Modified: head/sys/dev/e1000/em_txrx.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/em_txrx.c == --- head/sys/dev/e1000/em_txrx.cWed Mar 21 15:54:46 2018 (r331309) +++ head/sys/dev/e1000/em_txrx.cWed Mar 21 15:57:36 2018 (r331310) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2016-2017 Matthew Macy + * Copyright (c) 2016 Nicole Graziano + * Copyright (c) 2017 Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Wed Mar 21 15:54:46 2018(r331309) +++ head/sys/dev/e1000/if_em.c Wed Mar 21 15:57:36 2018(r331310) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2016 Matthew Macy + * Copyright (c) 2016 Nicole Graziano * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/if_em.h == --- head/sys/dev/e1000/if_em.h Wed Mar 21 15:54:46 2018(r331309) +++ head/sys/dev/e1000/if_em.h Wed Mar 21 15:57:36 2018(r331310) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2016 Matthew Macy + * Copyright (c) 2016 Nicole Graziano * All rights reserved. * * Redistribution and use in source and binary forms, with or without ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r330289 - head/sys/net
Author: shurd Date: Fri Mar 2 18:48:07 2018 New Revision: 330289 URL: https://svnweb.freebsd.org/changeset/base/330289 Log: iflib: stop timer callout when stopping iflib_timer has been seen running after the interface had been removed. This change prevents that. Submitted by: matt.m...@joyent.com Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri Mar 2 18:12:25 2018(r330288) +++ head/sys/net/iflib.cFri Mar 2 18:48:07 2018(r330289) @@ -2267,6 +2267,10 @@ iflib_stop(if_ctx_t ctx) for (i = 0; i < scctx->isc_ntxqsets; i++, txq++) { /* make sure all transmitters have completed before proceeding XXX */ + CALLOUT_LOCK(txq); + callout_stop(&txq->ift_timer); + CALLOUT_UNLOCK(txq); + /* clean any enqueued buffers */ iflib_ifmp_purge(txq); /* Free any existing tx buffers. */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329742 - head/sys/net
Author: shurd Date: Wed Feb 21 18:57:00 2018 New Revision: 329742 URL: https://svnweb.freebsd.org/changeset/base/329742 Log: IFLIB: Make isc_magic unsigned The IFLIB_MAGIC macro is > INT_MAX, so isc_magic should be able to contain it. Reported by: jeb Sponsored by: Limelight Networks Modified: head/sys/net/iflib.h Modified: head/sys/net/iflib.h == --- head/sys/net/iflib.hWed Feb 21 18:32:57 2018(r329741) +++ head/sys/net/iflib.hWed Feb 21 18:57:00 2018(r329742) @@ -229,7 +229,7 @@ typedef struct if_softc_ctx { * Initialization values for device */ struct if_shared_ctx { - int isc_magic; + unsigned isc_magic; driver_t *isc_driver; bus_size_t isc_q_align; bus_size_t isc_tx_maxsize; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329651 - head/sys/net
Author: shurd Date: Tue Feb 20 18:33:45 2018 New Revision: 329651 URL: https://svnweb.freebsd.org/changeset/base/329651 Log: IFLIB: do not remove dmamap on buffer unload Dmamap is created only on IFC attach. If we remove it on buffer release, we won't be able to do ifconfig down&up. Only destroy when in detach. Reported by: wma Reviewed by: wma Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D14060 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue Feb 20 18:24:20 2018(r329650) +++ head/sys/net/iflib.cTue Feb 20 18:33:45 2018(r329651) @@ -1984,7 +1984,8 @@ iflib_fl_bufs_free(iflib_fl_t fl) if (fl->ifl_sds.ifsd_map != NULL) { bus_dmamap_t sd_map = fl->ifl_sds.ifsd_map[i]; bus_dmamap_unload(fl->ifl_desc_tag, sd_map); - bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); + if (fl->ifl_rxq->ifr_ctx->ifc_in_detach) + bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); } if (*sd_m != NULL) { m_init(*sd_m, M_NOWAIT, MT_DATA, 0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r329335 - head/share/man/man4
Author: shurd Date: Thu Feb 15 18:39:43 2018 New Revision: 329335 URL: https://svnweb.freebsd.org/changeset/base/329335 Log: bnxt: Update man page with newly supported devices, options, etc update man page with * Newly supported devices * Newly added options * 'maintained by' Email ID Submitted by: Siva Kallam Reviewed by: shurd, sbruno Approved by: shurd Sponsored by: Broadcom Limited Differential Revision:https://reviews.freebsd.org/D13982 Modified: head/share/man/man4/bnxt.4 Modified: head/share/man/man4/bnxt.4 == --- head/share/man/man4/bnxt.4 Thu Feb 15 18:37:32 2018(r329334) +++ head/share/man/man4/bnxt.4 Thu Feb 15 18:39:43 2018(r329335) @@ -68,25 +68,41 @@ Broadcom BCM57302 NetXtreme-C 10Gb/25Gb Ethernet Contr .It Broadcom BCM57304 NetXtreme-C 10Gb/25Gb/40Gb/50Gb Ethernet Controller .It -Broadcom BCM57402 NetXtreme-E 10Gb Ethernet Controller +Broadcom BCM57304 NetXtreme-C Ethernet Virtual Function .It -Broadcom BCM57404 NetXtreme-E 10Gb/25Gb Ethernet Controller +Broadcom BCM57314 NetXtreme-C Ethernet Virtual Function .It -Broadcom BCM57406 NetXtreme-E 10GBase-T Ethernet Controller +Broadcom BCM57402 NetXtreme-E 10Gb Ethernet Controller .It -Broadcom BCM57402 NetXtreme-E Partition +Broadcom BCM57402 NetXtreme-E Ethernet Partition .It -Broadcom BCM57407 NetXtreme-E 10GBase-T Ethernet Controller +Broadcom BCM57404 NetXtreme-E 10Gb/25Gb Ethernet Controller .It +Broadcom BCM57404 NetXtreme-E Ethernet Virtual Function +.It Broadcom BCM57404 NetXtreme-E Partition .It +Broadcom BCM57406 NetXtreme-E 10GBASE-T Ethernet Controller +.It Broadcom BCM57406 NetXtreme-E Partition .It +Broadcom BCM57407 NetXtreme-E 10GBase-T Ethernet Controller +.It Broadcom BCM57407 NetXtreme-E 25Gb Ethernet Controller .It -Broadcom BCM57304 NetXtreme-C Virtual Function +Broadcom BCM57407 NetXtreme-E Partition .It -Broadcom BCM57404 NetXtreme-E Virtual Function +Broadcom BCM57412 NetXtreme-E Partition +.It +Broadcom BCM57414 NetXtreme-E Ethernet Virtual Function +.It +Broadcom BCM57414 NetXtreme-E Partition +.It +Broadcom BCM57416 NetXtreme-E Partition +.It +Broadcom BCM57417 NetXtreme-E Ethernet Partition +.It +Broadcom BCM57454 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet .El .Sh SYSCTL VARIABLES These variables must be set before loading the driver, either via @@ -181,11 +197,20 @@ Supported HWRM API version of the currently running fi HWRM API version the driver was built to support. .It Va dev.bnxt.X.hwstats.* Per-queue statistics tracked by the hardware. +.It Va dev.bnxt.X.hwstats.port_stats.* +Per-port statistics tracked by the hardware. .It Va dev.bnxt.X.hwstats.rxq0.drop_pkts Number of packets dropped by hardware on queue zero. This number might seem high, but the count includes packets dropped due to incorrect destination MAC, unsubscribed multicast address, and other normal reasons to ignore Ethernet frames. +.It Va dev.bnxt.X.hwstats.rxq0.tpa_* +statistics related to HW LRO. +.It Va dev.bnxt.X.hw_lro.* +Enable / Disable HW LRO feature. Defaults to disable. +Enabling HW LRO could cause issues when forwarding is enabled on host. +.It Va dev.bnxt.X.fc +Enable / Disable Flow Control feature. Defaults to Enable .El .Sh DIAGNOSTICS .Bl -diag @@ -219,6 +244,8 @@ device driver first appeared in The .Nm driver was written by -.An Jack Vogel Aq Mt jfvo...@gmail.com , +.An Jack Vogel Aq Mt jfvo...@gmail.com +and +.An Stephen Hurd Aq Mt sh...@freebsd.org , and is currently maintained by -.An Stephen Hurd Aq Mt stephen.h...@broadcom.com . +.An Broadcom Limited Aq Mt freebsd@broadcom.com . ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r327247 - head/sys/net
Author: shurd Date: Wed Dec 27 20:42:30 2017 New Revision: 327247 URL: https://svnweb.freebsd.org/changeset/base/327247 Log: Don't pass rids to taskqgroup_attach() As everywhere else, we want to pass rman_get_start(irq->ii_res). This caused set affinity errors when not using MSI-X vectors (legacy and MSI interrupts). Reported by: sbruno Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Dec 27 20:33:37 2017(r327246) +++ head/sys/net/iflib.cWed Dec 27 20:42:30 2017(r327247) @@ -5347,10 +5347,10 @@ iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filte if ((err = _iflib_irq_alloc(ctx, irq, tqrid, iflib_fast_intr_ctx, NULL, info, name)) != 0) return (err); GROUPTASK_INIT(gtask, 0, fn, q); - taskqgroup_attach(tqg, gtask, q, tqrid, name); + taskqgroup_attach(tqg, gtask, q, rman_get_start(irq->ii_res), name); GROUPTASK_INIT(&txq->ift_task, 0, _task_fn_tx, txq); - taskqgroup_attach(qgroup_if_io_tqg, &txq->ift_task, txq, tqrid, "tx"); + taskqgroup_attach(qgroup_if_io_tqg, &txq->ift_task, txq, rman_get_start(irq->ii_res), "tx"); return (0); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r327244 - head/sys/net
Author: shurd Date: Wed Dec 27 19:14:15 2017 New Revision: 327244 URL: https://svnweb.freebsd.org/changeset/base/327244 Log: Remove assertion that's not true for !EARLY_AP_STARTUP gtask->gt_taskqueue is NULL when EARLY_AP_STARTUP is not enabled. Remove assertion to allow this config to work. Reported by: oleg Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Dec 27 19:13:50 2017(r327243) +++ head/sys/net/iflib.cWed Dec 27 19:14:15 2017(r327244) @@ -5174,7 +5174,6 @@ iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_in if (cpuid > ctx->ifc_cpuid_highest) ctx->ifc_cpuid_highest = cpuid; #endif - MPASS(gtask->gt_taskqueue != NULL); return 0; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r327242 - head/sys/net
Author: shurd Date: Wed Dec 27 19:12:32 2017 New Revision: 327242 URL: https://svnweb.freebsd.org/changeset/base/327242 Log: Fix indentation. Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Dec 27 18:30:24 2017(r327241) +++ head/sys/net/iflib.cWed Dec 27 19:12:32 2017(r327242) @@ -2635,7 +2635,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) if ((m->m_pkthdr.csum_flags & (CSUM_L4_CALC|CSUM_L4_VALID)) == (CSUM_L4_CALC|CSUM_L4_VALID)) { if (lro_possible && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0) - continue; + continue; } } #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r327013 - head/sys/net
Oleg Bulyzhin wrote: On Fri, Dec 22, 2017 at 07:11:36PM -0500, Stephen Hurd wrote: Interesting... is this a standard GENERIC kernel, or is this a custom config? If a custom config, can you send it to me? Also, does this system have any other iflib drivers? igb, em, or bnxt? Can you include the log info (if any) for them as well? It's custom kernel on my testing machine. It has em too but ix is probed first.. If i comment out if_ix.ko load - it boots just fine (looks like if_em is not calling iflib_irq_set_affinity()): em0: port 0xdc00-0xdc1f mem 0xfeae-0x feaf,0xfeac-0xfead irq 17 at device 0.0 on pci3 em0: attach_pre capping queues at 1 em0: using 1024 tx descriptors and 1024 rx descriptors em0: msix_init qsets capped at 1 em0: PCIY_MSIX capability not found; or rid 0 == 0. em0: Using a Legacy interrupt em0: allocated for 1 tx_queues em0: allocated for 1 rx_queues ioapic0: routing intpin 17 (PCI IRQ 17) to lapic 0 vector 54 em0: bpf attached em0: Ethernet address: 00:15:17:3a:0c:7a em0: netmap queues/slots: TX 1/1024, RX 1/1024 P.S. verbose dmesg & kernel conf attached Hrm, can you try it with: optionsEARLY_AP_STARTUP In slave-amd64-smp-debug? ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r327013 - head/sys/net
Oleg Bulyzhin wrote: On Fri, Dec 22, 2017 at 01:22:20PM -0500, Stephen Hurd wrote: Can you provide me with the output of ``sysctl kern.sched.topology_spec''? # sysctl kern.sched.topology_spec kern.sched.topology_spec: 0, 1, 2, 3 0 1 2 3 And provide the new dmesg with this added output. ix0: port 0xcc00-0xcc1f mem 0xfde8-0xfdef,0xfde7c000-0xfde7 irq 18 at device 0.0 on pci2 ix0: using 2048 tx descriptors and 2048 rx descriptors ix0: msix_init qsets capped at 16 ix0: pxm cpus: 4 queue msgs: 63 admincnt: 1 ix0: using 4 rx queues 4 tx queues ix0: attempting to allocate 5 MSI-X vectors (64 supported) msi: routing MSI-X IRQ 259 to local APIC 0 vector 54 msi: routing MSI-X IRQ 260 to local APIC 0 vector 55 msi: routing MSI-X IRQ 261 to local APIC 0 vector 56 msi: routing MSI-X IRQ 262 to local APIC 0 vector 57 msi: routing MSI-X IRQ 263 to local APIC 0 vector 58 ix0: using IRQs 259-263 for MSI-X ix0: Using MSIX interrupts with 5 vectors ix0: allocated for 4 queues ix0: allocated for 4 rx queues ix0: irq=259, type=0, qid=0, name=rxq0 panic: Assertion gtask->gt_taskqueue != NULL failed at /usr/src/sys/net/iflib.c:5178 cpuid = 0 time = 1 KDB: enter: panic Interesting... is this a standard GENERIC kernel, or is this a custom config? If a custom config, can you send it to me? Also, does this system have any other iflib drivers? igb, em, or bnxt? Can you include the log info (if any) for them as well? ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r327013 - head/sys/net
Oleg Bulyzhin wrote: On Wed, Dec 20, 2017 at 01:03:34AM +, Stephen Hurd wrote: Author: shurd Date: Wed Dec 20 01:03:34 2017 New Revision: 327013 URL: https://svnweb.freebsd.org/changeset/base/327013 Log: Support attaching tx queues to cpus This will attempt to use a different thread/core on the same L2 cache when possible, or use the same cpu as the rx thread when not. If SMP isn't enabled, don't go looking for cores to use. This is mostly useful when using shared TX/RX queues. Reviewed by: sbruno Sponsored by:Limelight Networks Differential Revision: https://reviews.freebsd.org/D12446 i'm getting this panic: [skipped] ix0: port 0xcc00-0xcc1f mem 0xfde8-0xfdef,0xfde7c000-0xfde7 irq 18 at device 0.0 on pci2 ix0: using 2048 tx descriptors and 2048 rx descriptors ix0: msix_init qsets capped at 16 ix0: pxm cpus: 4 queue msgs: 63 admincnt: 1 ix0: using 4 rx queues 4 tx queues ix0: attempting to allocate 5 MSI-X vectors (64 supported) msi: routing MSI-X IRQ 259 to local APIC 0 vector 54 msi: routing MSI-X IRQ 260 to local APIC 0 vector 55 msi: routing MSI-X IRQ 261 to local APIC 0 vector 56 msi: routing MSI-X IRQ 262 to local APIC 0 vector 57 msi: routing MSI-X IRQ 263 to local APIC 0 vector 58 ix0: using IRQs 259-263 for MSI-X ix0: Using MSIX interrupts with 5 vectors ix0: allocated for 4 queues ix0: allocated for 4 rx queues panic: Assertion gtask->gt_taskqueue != NULL failed at /usr/src/sys/net/iflib.c:5177 cpuid = 0 time = 1 KDB: enter: panic [ thread pid 0 tid 10 ] Stopped at kdb_enter+0x3b: movq$0,kdb_why db> bt Tracing pid 0 tid 10 td 0x80bf63c0 kdb_enter() at kdb_enter+0x3b/frame 0x81004130 vpanic() at vpanic+0x1b9/frame 0x810041b0 kassert_panic() at kassert_panic+0x173/frame 0x81004220 iflib_irq_set_affinity() at iflib_irq_set_affinity+0xae2/frame 0x810042e0 iflib_irq_alloc_generic() at iflib_irq_alloc_generic+0x1f7/frame 0x81004350 ixgbe_if_msix_intr_assign() at ixgbe_if_msix_intr_assign+0xa2/frame 0x810043d0 iflib_device_register() at iflib_device_register+0x2a6a/frame 0x810046f0 iflib_device_attach() at iflib_device_attach+0xb7/frame 0x81004720 device_attach() at device_attach+0x3f7/frame 0x81004770 bus_generic_attach() at bus_generic_attach+0x5a/frame 0x81004790 pci_attach() at pci_attach+0xd5/frame 0x810047d0 device_attach() at device_attach+0x3f7/frame 0x81004820 bus_generic_attach() at bus_generic_attach+0x5a/frame 0x81004840 acpi_pcib_pci_attach() at acpi_pcib_pci_attach+0xa1/frame 0x81004880 device_attach() at device_attach+0x3f7/frame 0x810048d0 bus_generic_attach() at bus_generic_attach+0x5a/frame 0x810048f0 pci_attach() at pci_attach+0xd5/frame 0x81004930 device_attach() at device_attach+0x3f7/frame 0x81004980 bus_generic_attach() at bus_generic_attach+0x5a/frame 0x810049a0 acpi_pcib_acpi_attach() at acpi_pcib_acpi_attach+0x3bc/frame 0x81004a10 device_attach() at device_attach+0x3f7/frame 0x81004a60 bus_generic_attach() at bus_generic_attach+0x5a/frame 0x81004a80 acpi_attach() at acpi_attach+0xe85/frame 0x81004b30 device_attach() at device_attach+0x3f7/frame 0x81004b80 bus_generic_attach() at bus_generic_attach+0x5a/frame 0x81004ba0 nexus_acpi_attach() at nexus_acpi_attach+0x73/frame 0x81004bd0 device_attach() at device_attach+0x3f7/frame 0x81004c20 bus_generic_new_pass() at bus_generic_new_pass+0x116/frame 0x81004c50 bus_set_pass() at bus_set_pass+0x8c/frame 0x81004c80 configure() at configure+0x9/frame 0x81004c90 mi_startup() at mi_startup+0x9c/frame 0x81004cb0 btext() at btext+0x2c Can you provide me with the output of ``sysctl kern.sched.topology_spec''? It would also be useful to add a line in iflib.c at the beginning of iflib_irq_set_affinity() to show the parameters: int cpuid; int err, tid; +device_printf(ctx->ifc_dev, "irq=%d, type=%d, qid=%d, name=%s\n", irq, type, qid, name); cpuid = find_nth(ctx, qid); tid = get_thread_num(ctx, type, qid); MPASS(tid >= 0); And provide the new dmesg with this added output. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r327052 - head/sys/net
Author: shurd Date: Thu Dec 21 01:22:36 2017 New Revision: 327052 URL: https://svnweb.freebsd.org/changeset/base/327052 Log: Don't call tcp_lro_rx() unless hardware verified TCP/UDP csum It seems that tcp_lro_rx() doesn't verify TCP checksums, so if there are bad checksums in the packets caused by invalid data, the invalid data will pass through without errors. This was noticed with the igb driver and a specific internet host: fetch http://www.mpfr.org/mpfr-current/mpfr-3.1.6.tar.xz -o test.bin && sha256 test.bin Would result in a different value sometimes. This ends up making LRO require RXCSUM to be enabled, and RXCSUM to support TCP and UDP checksums. PR: 224346 Reported by: gjb Reviewed by: sbruno Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D13561 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cThu Dec 21 00:35:14 2017(r327051) +++ head/sys/net/iflib.cThu Dec 21 01:22:36 2017(r327052) @@ -2632,8 +2632,11 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) mt = mf = NULL; } } - if (lro_possible && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0) + if ((m->m_pkthdr.csum_flags & (CSUM_L4_CALC|CSUM_L4_VALID)) == + (CSUM_L4_CALC|CSUM_L4_VALID)) { + if (lro_possible && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0) continue; + } } #endif if (lro_possible) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r327013 - head/sys/net
Author: shurd Date: Wed Dec 20 01:03:34 2017 New Revision: 327013 URL: https://svnweb.freebsd.org/changeset/base/327013 Log: Support attaching tx queues to cpus This will attempt to use a different thread/core on the same L2 cache when possible, or use the same cpu as the rx thread when not. If SMP isn't enabled, don't go looking for cores to use. This is mostly useful when using shared TX/RX queues. Reviewed by: sbruno Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D12446 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Dec 20 00:49:08 2017(r327012) +++ head/sys/net/iflib.cWed Dec 20 01:03:34 2017(r327013) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_acpi.h" +#include "opt_sched.h" #include #include @@ -5044,25 +5045,136 @@ iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid, return (_iflib_irq_alloc(ctx, irq, rid, filter, handler, arg, name)); } +#ifdef SMP static int -find_nth(if_ctx_t ctx, cpuset_t *cpus, int qid) +find_nth(if_ctx_t ctx, int qid) { + cpuset_t cpus; int i, cpuid, eqid, count; - CPU_COPY(&ctx->ifc_cpus, cpus); - count = CPU_COUNT(cpus); + CPU_COPY(&ctx->ifc_cpus, &cpus); + count = CPU_COUNT(&cpus); eqid = qid % count; /* clear up to the qid'th bit */ for (i = 0; i < eqid; i++) { - cpuid = CPU_FFS(cpus); + cpuid = CPU_FFS(&cpus); MPASS(cpuid != 0); - CPU_CLR(cpuid-1, cpus); + CPU_CLR(cpuid-1, &cpus); } - cpuid = CPU_FFS(cpus); + cpuid = CPU_FFS(&cpus); MPASS(cpuid != 0); return (cpuid-1); } +#ifdef SCHED_ULE +extern struct cpu_group *cpu_top; /* CPU topology */ + +static int +find_child_with_core(int cpu, struct cpu_group *grp) +{ + int i; + + if (grp->cg_children == 0) + return -1; + + MPASS(grp->cg_child); + for (i = 0; i < grp->cg_children; i++) { + if (CPU_ISSET(cpu, &grp->cg_child[i].cg_mask)) + return i; + } + + return -1; +} + +/* + * Find the nth thread on the specified core + */ +static int +find_thread(int cpu, int thread_num) +{ + struct cpu_group *grp; + int i; + cpuset_t cs; + + grp = cpu_top; + if (grp == NULL) + return cpu; + i = 0; + while ((i = find_child_with_core(cpu, grp)) != -1) { + /* If the child only has one cpu, don't descend */ + if (grp->cg_child[i].cg_count <= 1) + break; + grp = &grp->cg_child[i]; + } + + /* If they don't share at least an L2 cache, use the same CPU */ + if (grp->cg_level > CG_SHARE_L2 || grp->cg_level == CG_SHARE_NONE) + return cpu; + + /* Now pick one */ + CPU_COPY(&grp->cg_mask, &cs); + for (i = thread_num % grp->cg_count; i > 0; i--) { + MPASS(CPU_FFS(&cs)); + CPU_CLR(CPU_FFS(&cs) - 1, &cs); + } + MPASS(CPU_FFS(&cs)); + return CPU_FFS(&cs) - 1; +} +#else +static int +find_thread(int cpu, int thread_num __unused) +{ + return cpu_id +} +#endif + +static int +get_thread_num(if_ctx_t ctx, iflib_intr_type_t type, int qid) +{ + switch (type) { + case IFLIB_INTR_TX: + /* TX queues get threads on the same core as the corresponding RX queue */ + /* XXX handle multiple RX threads per core and more than two threads per core */ + return qid / CPU_COUNT(&ctx->ifc_cpus) + 1; + case IFLIB_INTR_RX: + case IFLIB_INTR_RXTX: + /* RX queues get the first thread on their core */ + return qid / CPU_COUNT(&ctx->ifc_cpus); + default: + return -1; + } +} +#else +#define get_thread_num(ctx, type, qid) CPU_FIRST() +#define find_thread(cpuid, tid)CPU_FIRST() +#define find_nth(ctx, gid) CPU_FIRST() +#endif + +/* Just to avoid copy/paste */ +static inline int +iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_intr_type_t type, int qid, +struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, char *name) +{ + int cpuid; + int err, tid; + + cpuid = find_nth(ctx, qid); + tid = get_thread_num(ctx, type, qid); + MPASS(tid >= 0); + cpuid = find_thread(cpuid, tid); + err = taskqgroup_attach_cpu(tqg, gtask, uniq, cpuid, irq, name); + if (err) { + device_printf(ctx->ifc_dev, "taskqgroup_attach_cpu failed %d\n", err); + return (err); + } +#ifdef notyet + if (cpuid > ctx->ifc_cpuid_highest) + ctx->ifc_cpuid_highest = cpuid; +#endif +
svn commit: r327003 - head/sys/dev/bnxt
Author: shurd Date: Tue Dec 19 22:15:46 2017 New Revision: 327003 URL: https://svnweb.freebsd.org/changeset/base/327003 Log: Add log messages for unknown and unhandled phy types Previously, it silently only supported auto, instead, log a message indicating why only auto is supported. Submitted by: Bhargava Chenna Marreddy Sponsored by: Broadcom Limited Differential Revision:https://reviews.freebsd.org/D13358 Modified: head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/if_bnxt.c == --- head/sys/dev/bnxt/if_bnxt.c Tue Dec 19 22:08:57 2017(r327002) +++ head/sys/dev/bnxt/if_bnxt.c Tue Dec 19 22:15:46 2017(r327003) @@ -2085,8 +2085,13 @@ bnxt_add_media_types(struct bnxt_softc *softc) break; case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_UNKNOWN: -default: /* Only Autoneg is supported for TYPE_UNKNOWN */ + device_printf(softc->dev, "Unknown phy type\n"); + break; + +default: + /* Only Autoneg is supported for new phy type values */ + device_printf(softc->dev, "phy type %d not supported by driver\n", phy_type); break; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r327001 - head/sys/dev/bnxt
Author: shurd Date: Tue Dec 19 22:06:25 2017 New Revision: 327001 URL: https://svnweb.freebsd.org/changeset/base/327001 Log: On Link up & down, update media types It's possible to change the SFP module when link is down, which would change the available media types. This is part of D13358. Submitted by: Bhargava Chenna Marreddy Sponsored by: Broadcom Limited Modified: head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/if_bnxt.c == --- head/sys/dev/bnxt/if_bnxt.c Tue Dec 19 21:07:30 2017(r327000) +++ head/sys/dev/bnxt/if_bnxt.c Tue Dec 19 22:06:25 2017(r327001) @@ -2224,6 +2224,10 @@ bnxt_report_link(struct bnxt_softc *softc) link_info->last_flow_ctrl.tx = link_info->flow_ctrl.tx; link_info->last_flow_ctrl.rx = link_info->flow_ctrl.rx; link_info->last_flow_ctrl.autoneg = link_info->flow_ctrl.autoneg; + /* update media types */ + ifmedia_removeall(softc->media); + bnxt_add_media_types(softc); + ifmedia_set(softc->media, IFM_ETHER | IFM_AUTO); } static int ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r327000 - head/sys/dev/bnxt
Author: shurd Date: Tue Dec 19 21:07:30 2017 New Revision: 327000 URL: https://svnweb.freebsd.org/changeset/base/327000 Log: Support short HWRM commands New Stratus bnxt devices require support for short HWRM commands for VFs to function. Enable their use, but only use them if it's both supported and required... prefer the long HWRM commands when possible. Submitted by: Bhargava Chenna Marreddy Sponsored by: Broadcom Limited Differential Revision:https://reviews.freebsd.org/D13269?id=36180 Modified: head/sys/dev/bnxt/bnxt.h head/sys/dev/bnxt/bnxt_hwrm.c head/sys/dev/bnxt/bnxt_hwrm.h head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/bnxt.h == --- head/sys/dev/bnxt/bnxt.hTue Dec 19 20:32:45 2017(r326999) +++ head/sys/dev/bnxt/bnxt.hTue Dec 19 21:07:30 2017(r327000) @@ -561,6 +561,7 @@ struct bnxt_softc { #define BNXT_FLAG_VF 0x0001 #define BNXT_FLAG_NPAR 0x0002 #define BNXT_FLAG_WOL_CAP 0x0004 +#define BNXT_FLAG_SHORT_CMD0x0008 uint32_tflags; uint32_ttotal_msix; @@ -572,6 +573,7 @@ struct bnxt_softc { uint16_thwrm_cmd_seq; uint32_thwrm_cmd_timeo; /* milliseconds */ struct iflib_dma_info hwrm_cmd_resp; + struct iflib_dma_info hwrm_short_cmd_req_addr; /* Interrupt info for HWRM */ struct if_irq irq; struct mtx hwrm_lock; Modified: head/sys/dev/bnxt/bnxt_hwrm.c == --- head/sys/dev/bnxt/bnxt_hwrm.c Tue Dec 19 20:32:45 2017 (r326999) +++ head/sys/dev/bnxt/bnxt_hwrm.c Tue Dec 19 21:07:30 2017 (r327000) @@ -122,12 +122,37 @@ _hwrm_send_message(struct bnxt_softc *softc, void *msg uint16_t cp_ring_id; uint8_t *valid; uint16_t err; + uint16_t max_req_len = HWRM_MAX_REQ_LEN; + struct hwrm_short_input short_input = {0}; /* TODO: DMASYNC in here. */ req->seq_id = htole16(softc->hwrm_cmd_seq++); memset(resp, 0, PAGE_SIZE); cp_ring_id = le16toh(req->cmpl_ring); + if (softc->flags & BNXT_FLAG_SHORT_CMD) { + void *short_cmd_req = softc->hwrm_short_cmd_req_addr.idi_vaddr; + + memcpy(short_cmd_req, req, msg_len); + memset((uint8_t *) short_cmd_req + msg_len, 0, softc->hwrm_max_req_len- + msg_len); + + short_input.req_type = req->req_type; + short_input.signature = + htole16(HWRM_SHORT_INPUT_SIGNATURE_SHORT_CMD); + short_input.size = htole16(msg_len); + short_input.req_addr = + htole64(softc->hwrm_short_cmd_req_addr.idi_paddr); + + data = (uint32_t *)&short_input; + msg_len = sizeof(short_input); + + /* Sync memory write before updating doorbell */ + wmb(); + + max_req_len = BNXT_HWRM_SHORT_REQ_LEN; + } + /* Write request msg to hwrm channel */ for (i = 0; i < msg_len; i += 4) { bus_space_write_4(softc->hwrm_bar.tag, @@ -137,7 +162,7 @@ _hwrm_send_message(struct bnxt_softc *softc, void *msg } /* Clear to the end of the request buffer */ - for (i = msg_len; i < HWRM_MAX_REQ_LEN; i += 4) + for (i = msg_len; i < max_req_len; i += 4) bus_space_write_4(softc->hwrm_bar.tag, softc->hwrm_bar.handle, i, 0); @@ -248,6 +273,7 @@ bnxt_hwrm_ver_get(struct bnxt_softc *softc) int rc; const char nastr[] = ""; const char naver[] = ""; + uint32_t dev_caps_cfg; softc->hwrm_max_req_len = HWRM_MAX_REQ_LEN; softc->hwrm_cmd_timeo = 1000; @@ -322,6 +348,11 @@ bnxt_hwrm_ver_get(struct bnxt_softc *softc) softc->hwrm_max_req_len = le16toh(resp->max_req_win_len); if (resp->def_req_timeout) softc->hwrm_cmd_timeo = le16toh(resp->def_req_timeout); + + dev_caps_cfg = le32toh(resp->dev_caps_cfg); + if ((dev_caps_cfg & HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_SUPPORTED) && + (dev_caps_cfg & HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_REQUIRED)) + softc->flags |= BNXT_FLAG_SHORT_CMD; fail: BNXT_HWRM_UNLOCK(softc); Modified: head/sys/dev/bnxt/bnxt_hwrm.h == --- head/sys/dev/bnxt/bnxt_hwrm.h Tue Dec 19 20:32:45 2017 (r326999) +++ head/sys/dev/bnxt/bnxt_hwrm.h Tue Dec 19 21:07:30 2017 (r327000) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #define BNXT_PAUSE_RX (HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) #define BNXT_AUTO_PAUSE_AUTONEG_PAUSE
svn commit: r326999 - head/sys/dev/bnxt
Author: shurd Date: Tue Dec 19 20:32:45 2017 New Revision: 326999 URL: https://svnweb.freebsd.org/changeset/base/326999 Log: Don't populate NVRAM sysctls for VFs Only the PF allows NVRAM interaction on bnxt devices. Submitted by: Bhargava Chenna Marreddy Sponsored by: Broadcom Limited Modified: head/sys/dev/bnxt/bnxt_sysctl.c head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/bnxt_sysctl.c == --- head/sys/dev/bnxt/bnxt_sysctl.c Tue Dec 19 20:19:07 2017 (r326998) +++ head/sys/dev/bnxt/bnxt_sysctl.c Tue Dec 19 20:32:45 2017 (r326999) @@ -74,14 +74,16 @@ bnxt_init_sysctl_ctx(struct bnxt_softc *softc) return ENOMEM; } - sysctl_ctx_init(&softc->nvm_info->nvm_ctx); - ctx = device_get_sysctl_ctx(softc->dev); - softc->nvm_info->nvm_oid = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, - "nvram", CTLFLAG_RD, 0, "nvram information"); - if (!softc->nvm_info->nvm_oid) { - sysctl_ctx_free(&softc->nvm_info->nvm_ctx); - return ENOMEM; + if (BNXT_PF(softc)) { + sysctl_ctx_init(&softc->nvm_info->nvm_ctx); + ctx = device_get_sysctl_ctx(softc->dev); + softc->nvm_info->nvm_oid = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, + "nvram", CTLFLAG_RD, 0, "nvram information"); + if (!softc->nvm_info->nvm_oid) { + sysctl_ctx_free(&softc->nvm_info->nvm_ctx); + return ENOMEM; + } } sysctl_ctx_init(&softc->hw_lro_ctx); @@ -127,7 +129,7 @@ bnxt_free_sysctl_ctx(struct bnxt_softc *softc) else softc->ver_info->ver_oid = NULL; } - if (softc->nvm_info->nvm_oid != NULL) { + if (BNXT_PF(softc) && softc->nvm_info->nvm_oid != NULL) { orc = sysctl_ctx_free(&softc->nvm_info->nvm_ctx); if (orc) rc = orc; Modified: head/sys/dev/bnxt/if_bnxt.c == --- head/sys/dev/bnxt/if_bnxt.c Tue Dec 19 20:19:07 2017(r326998) +++ head/sys/dev/bnxt/if_bnxt.c Tue Dec 19 20:32:45 2017(r326999) @@ -715,18 +715,21 @@ bnxt_attach_pre(if_ctx_t ctx) } /* Get NVRAM info */ - softc->nvm_info = malloc(sizeof(struct bnxt_nvram_info), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (softc->nvm_info == NULL) { - rc = ENOMEM; - device_printf(softc->dev, - "Unable to allocate space for NVRAM info\n"); - goto nvm_alloc_fail; + if (BNXT_PF(softc)) { + softc->nvm_info = malloc(sizeof(struct bnxt_nvram_info), + M_DEVBUF, M_NOWAIT | M_ZERO); + if (softc->nvm_info == NULL) { + rc = ENOMEM; + device_printf(softc->dev, + "Unable to allocate space for NVRAM info\n"); + goto nvm_alloc_fail; + } + + rc = bnxt_hwrm_nvm_get_dev_info(softc, &softc->nvm_info->mfg_id, + &softc->nvm_info->device_id, &softc->nvm_info->sector_size, + &softc->nvm_info->size, &softc->nvm_info->reserved_size, + &softc->nvm_info->available_size); } - rc = bnxt_hwrm_nvm_get_dev_info(softc, &softc->nvm_info->mfg_id, - &softc->nvm_info->device_id, &softc->nvm_info->sector_size, - &softc->nvm_info->size, &softc->nvm_info->reserved_size, - &softc->nvm_info->available_size); /* Register the driver with the FW */ rc = bnxt_hwrm_func_drv_rgtr(softc); @@ -859,9 +862,11 @@ bnxt_attach_pre(if_ctx_t ctx) rc = bnxt_init_sysctl_ctx(softc); if (rc) goto init_sysctl_failed; - rc = bnxt_create_nvram_sysctls(softc->nvm_info); - if (rc) - goto failed; + if (BNXT_PF(softc)) { + rc = bnxt_create_nvram_sysctls(softc->nvm_info); + if (rc) + goto failed; + } arc4rand(softc->vnic_info.rss_hash_key, HW_HASH_KEY_SIZE, 0); softc->vnic_info.rss_hash_type = @@ -894,7 +899,8 @@ failed: init_sysctl_failed: bnxt_hwrm_func_drv_unrgtr(softc, false); drv_rgtr_fail: - free(softc->nvm_info, M_DEVBUF); + if (BNXT_PF(softc)) + free(softc->nvm_info, M_DEVBUF); nvm_alloc_fail: ver_fail: free(softc->ver_info, M_DEVBUF); @@ -963,7 +969,8 @@ bnxt_detach(if_ctx_t ctx) for (i = 0; i < softc->nrxqsets; i++) free(softc->rx_rings[i].tpa_start, M_DEVBUF); free(softc->ver_info, M_DEVBUF); - free(softc->nvm_inf
svn commit: r326985 - head/sys/dev/bnxt
Author: shurd Date: Tue Dec 19 18:12:18 2017 New Revision: 326985 URL: https://svnweb.freebsd.org/changeset/base/326985 Log: Add byte swapping in bnxt_cfg_async_cr() request The firmware is always in little endian, use htole*() for all request fields larger than one byte. Submitted by: Bhargava Chenna Marreddy Sponsored by: Broadcom Limited Modified: head/sys/dev/bnxt/bnxt_hwrm.c Modified: head/sys/dev/bnxt/bnxt_hwrm.c == --- head/sys/dev/bnxt/bnxt_hwrm.c Tue Dec 19 17:59:00 2017 (r326984) +++ head/sys/dev/bnxt/bnxt_hwrm.c Tue Dec 19 18:12:18 2017 (r326985) @@ -945,9 +945,9 @@ bnxt_cfg_async_cr(struct bnxt_softc *softc) bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_CFG); - req.fid = 0x; + req.fid = htole16(0x); req.enables = htole32(HWRM_FUNC_CFG_INPUT_ENABLES_ASYNC_EVENT_CR); - req.async_event_cr = softc->def_cp_ring.ring.phys_id; + req.async_event_cr = htole16(softc->def_cp_ring.ring.phys_id); rc = hwrm_send_message(softc, &req, sizeof(req)); } @@ -957,7 +957,7 @@ bnxt_cfg_async_cr(struct bnxt_softc *softc) bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_VF_CFG); req.enables = htole32(HWRM_FUNC_VF_CFG_INPUT_ENABLES_ASYNC_EVENT_CR); - req.async_event_cr = softc->def_cp_ring.ring.phys_id; + req.async_event_cr = htole16(softc->def_cp_ring.ring.phys_id); rc = hwrm_send_message(softc, &req, sizeof(req)); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r326984 - in head: share/man/man4 sys/compat/linuxkpi/common/src sys/dev/e1000 sys/net sys/sys
Author: shurd Date: Tue Dec 19 17:59:00 2017 New Revision: 326984 URL: https://svnweb.freebsd.org/changeset/base/326984 Log: Update Matthew Macy contact info Email address has changed, uses consistent name (Matthew, not Matt) Reported by: Matthew Macy Differential Revision:https://reviews.freebsd.org/D13537 Modified: head/share/man/man4/em.4 head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/compat/linuxkpi/common/src/linux_rcu.c head/sys/dev/e1000/em_txrx.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h head/sys/dev/e1000/igb_txrx.c head/sys/net/ifdi_if.m head/sys/net/iflib.c head/sys/net/iflib.h head/sys/sys/gtaskqueue.h Modified: head/share/man/man4/em.4 == --- head/share/man/man4/em.4Tue Dec 19 17:13:04 2017(r326983) +++ head/share/man/man4/em.4Tue Dec 19 17:59:00 2017(r326984) @@ -319,6 +319,6 @@ The driver was originally written by .An Intel Corporation Aq Mt free...@intel.com . It was merged with igb driver and converted to the iflib framework by -.An Matthew Macy Aq Mt mm...@nextbsd.org +.An Matthew Macy Aq Mt mm...@mattmacy.io and .An Sean Bruno Aq Mt sbr...@freebsd.org . Modified: head/sys/compat/linuxkpi/common/src/linux_page.c == --- head/sys/compat/linuxkpi/common/src/linux_page.cTue Dec 19 17:13:04 2017(r326983) +++ head/sys/compat/linuxkpi/common/src/linux_page.cTue Dec 19 17:59:00 2017(r326984) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2010 Isilon Systems, Inc. - * Copyright (c) 2016 Matt Macy (mm...@nextbsd.org) + * Copyright (c) 2016 Matthew Macy (mm...@mattmacy.io) * Copyright (c) 2017 Mellanox Technologies, Ltd. * All rights reserved. * Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c == --- head/sys/compat/linuxkpi/common/src/linux_rcu.c Tue Dec 19 17:13:04 2017(r326983) +++ head/sys/compat/linuxkpi/common/src/linux_rcu.c Tue Dec 19 17:59:00 2017(r326984) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Matt Macy (mm...@nextbsd.org) + * Copyright (c) 2016 Matthew Macy (mm...@mattmacy.io) * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/em_txrx.c == --- head/sys/dev/e1000/em_txrx.cTue Dec 19 17:13:04 2017 (r326983) +++ head/sys/dev/e1000/em_txrx.cTue Dec 19 17:59:00 2017 (r326984) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016-2017 Matt Macy + * Copyright (c) 2016-2017 Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Tue Dec 19 17:13:04 2017(r326983) +++ head/sys/dev/e1000/if_em.c Tue Dec 19 17:59:00 2017(r326984) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2016 Matt Macy + * Copyright (c) 2016 Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/if_em.h == --- head/sys/dev/e1000/if_em.h Tue Dec 19 17:13:04 2017(r326983) +++ head/sys/dev/e1000/if_em.h Tue Dec 19 17:59:00 2017(r326984) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2016 Matt Macy + * Copyright (c) 2016 Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/e1000/igb_txrx.c == --- head/sys/dev/e1000/igb_txrx.c Tue Dec 19 17:13:04 2017 (r326983) +++ head/sys/dev/e1000/igb_txrx.c Tue Dec 19 17:59:00 2017 (r326984) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Matt Macy + * Copyright (c) 2016 Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/net/ifdi_if.m == --- head/sys/net/ifdi_if.m Tue Dec 19 17:13:04 2017(r326983) +++ head/sys/net/ifdi_if.m Tue Dec 19 17:59:00 2017(r326984) @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, Matthew Macy (km...@freebsd.org) +# Copyright (c) 2014, Matthew Macy (mm...@mattmacy.io) # All rights reserved. # # Redistribution and use in source and binary forms, with or without Modified: head/sys/net/iflib.c == --- h
svn commit: r326775 - head/sys/net
Author: shurd Date: Mon Dec 11 20:01:28 2017 New Revision: 326775 URL: https://svnweb.freebsd.org/changeset/base/326775 Log: Increment encap_pad_mbuf_fail when m_dup() fails in padding Previously, the counter was only incremented when m_append() failed. Since the function can also fail on m_dup() now, increment the counter there as well. Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cMon Dec 11 19:21:39 2017(r326774) +++ head/sys/net/iflib.cMon Dec 11 20:01:28 2017(r326775) @@ -3127,6 +3127,7 @@ iflib_ether_pad(device_t dev, struct mbuf **m_head, ui if (new_head == NULL) { m_freem(*m_head); device_printf(dev, "cannot pad short frame, m_dup() failed"); + DBG_COUNTER_INC(encap_pad_mbuf_fail); return ENOMEM; } m_freem(*m_head); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r326706 - head/sys/net
Author: shurd Date: Fri Dec 8 19:50:06 2017 New Revision: 326706 URL: https://svnweb.freebsd.org/changeset/base/326706 Log: Free mbuf chain when m_dup fails Fix memory leak where mbuf chain wasn't free()d if iflib_ether_pad() has a failure in m_dup(). Reported by: "Ryan Stone" Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri Dec 8 19:26:25 2017(r326705) +++ head/sys/net/iflib.cFri Dec 8 19:50:06 2017(r326706) @@ -3125,6 +3125,7 @@ iflib_ether_pad(device_t dev, struct mbuf **m_head, ui if (!M_WRITABLE(*m_head)) { new_head = m_dup(*m_head, M_NOWAIT); if (new_head == NULL) { + m_freem(*m_head); device_printf(dev, "cannot pad short frame, m_dup() failed"); return ENOMEM; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r326702 - head/sys/net
Author: shurd Date: Fri Dec 8 18:43:31 2017 New Revision: 326702 URL: https://svnweb.freebsd.org/changeset/base/326702 Log: Handle read-only mbufs in iflib ether pad function If ethernet padding is enabled, and a read-only mbuf is passed, it would modify the mbuf using m_append(). Instead, call m_dup() and append to the new packet. Reported by: Pyun YongHyeon Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D13414 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri Dec 8 18:04:43 2017(r326701) +++ head/sys/net/iflib.cFri Dec 8 18:43:31 2017(r326702) @@ -3112,7 +3112,7 @@ calc_next_txd(iflib_txq_t txq, int cidx, uint8_t qid) * min_frame_size is the frame size (less CRC) to pad the mbuf to */ static __noinline int -iflib_ether_pad(device_t dev, struct mbuf *m_head, uint16_t min_frame_size) +iflib_ether_pad(device_t dev, struct mbuf **m_head, uint16_t min_frame_size) { /* * 18 is enough bytes to pad an ARP packet to 46 bytes, and @@ -3120,14 +3120,25 @@ iflib_ether_pad(device_t dev, struct mbuf *m_head, uin */ static char pad[18];/* just zeros */ int n; + struct mbuf *new_head; - for (n = min_frame_size - m_head->m_pkthdr.len; + if (!M_WRITABLE(*m_head)) { + new_head = m_dup(*m_head, M_NOWAIT); + if (new_head == NULL) { + device_printf(dev, "cannot pad short frame, m_dup() failed"); + return ENOMEM; + } + m_freem(*m_head); + *m_head = new_head; + } + + for (n = min_frame_size - (*m_head)->m_pkthdr.len; n > 0; n -= sizeof(pad)) - if (!m_append(m_head, min(n, sizeof(pad)), pad)) + if (!m_append(*m_head, min(n, sizeof(pad)), pad)) break; if (n > 0) { - m_freem(m_head); + m_freem(*m_head); device_printf(dev, "cannot pad short frame\n"); DBG_COUNTER_INC(encap_pad_mbuf_fail); return (ENOBUFS); @@ -3189,13 +3200,13 @@ iflib_encap(iflib_txq_t txq, struct mbuf **m_headp) desc_tag = txq->ift_desc_tag; max_segs = scctx->isc_tx_nsegments; } - m_head = *m_headp; if ((sctx->isc_flags & IFLIB_NEED_ETHER_PAD) && __predict_false(m_head->m_pkthdr.len < scctx->isc_min_frame_size)) { - err = iflib_ether_pad(ctx->ifc_dev, m_head, scctx->isc_min_frame_size); + err = iflib_ether_pad(ctx->ifc_dev, m_headp, scctx->isc_min_frame_size); if (err) return err; } + m_head = *m_headp; pkt_info_zero(&pi); pi.ipi_mflags = (m_head->m_flags & (M_VLANTAG|M_BCAST|M_MCAST)); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r326578 - in head/sys: dev/bnxt net
Author: shurd Date: Tue Dec 5 21:00:31 2017 New Revision: 326578 URL: https://svnweb.freebsd.org/changeset/base/326578 Log: iflib: Support to padding Ethernet frames to a min size Some bnxt devices do not correctly send frames smaller than 52 bytes (without CRC), so add a quirk that will pad frames to an arbitrary size before passing off to the encap routine. Reported by: Bhargava Chenna Marreddy Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D13269 Modified: head/sys/dev/bnxt/bnxt.h head/sys/dev/bnxt/if_bnxt.c head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/dev/bnxt/bnxt.h == --- head/sys/dev/bnxt/bnxt.hTue Dec 5 20:43:24 2017(r326577) +++ head/sys/dev/bnxt/bnxt.hTue Dec 5 21:00:31 2017(r326578) @@ -236,6 +236,8 @@ __FBSDID("$FreeBSD$"); ifmedia_add(softc->media, IFM_ETHER | (ifm_speed), 0, NULL); \ } while(0) +#define BNXT_MIN_FRAME_SIZE52 /* Frames must be padded to this size for some A0 chips */ + /* NVRAM access */ enum bnxt_nvm_directory_type { BNX_DIR_TYPE_UNUSED = 0, Modified: head/sys/dev/bnxt/if_bnxt.c == --- head/sys/dev/bnxt/if_bnxt.c Tue Dec 5 20:43:24 2017(r326577) +++ head/sys/dev/bnxt/if_bnxt.c Tue Dec 5 21:00:31 2017(r326578) @@ -298,7 +298,7 @@ static struct if_shared_ctx bnxt_sctx_init = { .isc_magic = IFLIB_MAGIC, .isc_driver = &bnxt_iflib_driver, .isc_nfl = 2, // Number of Free Lists - .isc_flags = IFLIB_HAS_RXCQ | IFLIB_HAS_TXCQ, + .isc_flags = IFLIB_HAS_RXCQ | IFLIB_HAS_TXCQ | IFLIB_NEED_ETHER_PAD, .isc_q_align = PAGE_SIZE, .isc_tx_maxsize = BNXT_TSO_SIZE, .isc_tx_maxsegsize = BNXT_TSO_SIZE, @@ -793,6 +793,7 @@ bnxt_attach_pre(if_ctx_t ctx) scctx->isc_tx_tso_size_max = BNXT_TSO_SIZE; scctx->isc_tx_tso_segsize_max = BNXT_TSO_SIZE; scctx->isc_vectors = softc->func.max_cp_rings; + scctx->isc_min_frame_size = BNXT_MIN_FRAME_SIZE; scctx->isc_txrx = &bnxt_txrx; if (scctx->isc_nrxd[0] < Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue Dec 5 20:43:24 2017(r326577) +++ head/sys/net/iflib.cTue Dec 5 21:00:31 2017(r326578) @@ -627,11 +627,14 @@ SYSCTL_INT(_net_iflib, OID_AUTO, txq_drain_encapfail, static int iflib_encap_load_mbuf_fail; +static int iflib_encap_pad_mbuf_fail; static int iflib_encap_txq_avail_fail; static int iflib_encap_txd_encap_fail; SYSCTL_INT(_net_iflib, OID_AUTO, encap_load_mbuf_fail, CTLFLAG_RD, &iflib_encap_load_mbuf_fail, 0, "# busdma load failures"); +SYSCTL_INT(_net_iflib, OID_AUTO, encap_pad_mbuf_fail, CTLFLAG_RD, + &iflib_encap_pad_mbuf_fail, 0, "# runt frame pad failures"); SYSCTL_INT(_net_iflib, OID_AUTO, encap_txq_avail_fail, CTLFLAG_RD, &iflib_encap_txq_avail_fail, 0, "# txq avail failures"); SYSCTL_INT(_net_iflib, OID_AUTO, encap_txd_encap_fail, CTLFLAG_RD, @@ -684,9 +687,10 @@ iflib_debug_reset(void) iflib_fl_refills = iflib_fl_refills_large = iflib_tx_frees = iflib_txq_drain_flushing = iflib_txq_drain_oactive = iflib_txq_drain_notready = iflib_txq_drain_encapfail = - iflib_encap_load_mbuf_fail = iflib_encap_txq_avail_fail = - iflib_encap_txd_encap_fail = iflib_task_fn_rxs = iflib_rx_intr_enables = - iflib_fast_intrs = iflib_intr_link = iflib_intr_msix = iflib_rx_unavail = + iflib_encap_load_mbuf_fail = iflib_encap_pad_mbuf_fail = + iflib_encap_txq_avail_fail = iflib_encap_txd_encap_fail = + iflib_task_fn_rxs = iflib_rx_intr_enables = iflib_fast_intrs = + iflib_intr_link = iflib_intr_msix = iflib_rx_unavail = iflib_rx_ctx_inactive = iflib_rx_zero_len = iflib_rx_if_input = iflib_rx_mbuf_null = iflib_rxd_flush = 0; } @@ -3103,6 +3107,35 @@ calc_next_txd(iflib_txq_t txq, int cidx, uint8_t qid) return (next < end ? next : start); } +/* + * Pad an mbuf to ensure a minimum ethernet frame size. + * min_frame_size is the frame size (less CRC) to pad the mbuf to + */ +static __noinline int +iflib_ether_pad(device_t dev, struct mbuf *m_head, uint16_t min_frame_size) +{ + /* +* 18 is enough bytes to pad an ARP packet to 46 bytes, and +* and ARP message is the smallest common payload I can think of +*/ + static char pad[18];/* just zeros */ + int n; + + for (n = min_frame_size - m_head->m_pkthdr.len; +n > 0; n -= sizeof(pad)) + if (!m_append(m_head, min(n, sizeof(p
svn commit: r326577 - head/sys/net
Author: shurd Date: Tue Dec 5 20:43:24 2017 New Revision: 326577 URL: https://svnweb.freebsd.org/changeset/base/326577 Log: Avoid calling CURVNET_[SET|RESTORE] for each packet The LRO possible test was calling CURVNET_SET once for IPv4 or IPv6 for each packet in a chain. Only call it once per chain instead. Submitted by: Matthew Macy Reviewed by: cem, ae Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D13368 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue Dec 5 20:19:13 2017(r326576) +++ head/sys/net/iflib.cTue Dec 5 20:43:24 2017(r326577) @@ -2467,13 +2467,26 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) } #if defined(INET6) || defined(INET) +static void +iflib_get_ip_forwarding(struct lro_ctrl *lc, bool *v4, bool *v6) +{ + CURVNET_SET(lc->ifp->if_vnet); +#if defined(INET6) + *v6 = VNET(ip6_forwarding); +#endif +#if defined(INET) + *v4 = VNET(ipforwarding); +#endif + CURVNET_RESTORE(); +} + /* * Returns true if it's possible this packet could be LROed. * if it returns false, it is guaranteed that tcp_lro_rx() * would not return zero. */ static bool -iflib_check_lro_possible(struct lro_ctrl *lc, struct mbuf *m) +iflib_check_lro_possible(struct mbuf *m, bool v4_forwarding, bool v6_forwarding) { struct ether_header *eh; uint16_t eh_type; @@ -2483,32 +2496,21 @@ iflib_check_lro_possible(struct lro_ctrl *lc, struct m switch (eh_type) { #if defined(INET6) case ETHERTYPE_IPV6: - { - CURVNET_SET(lc->ifp->if_vnet); - if (VNET(ip6_forwarding) == 0) { - CURVNET_RESTORE(); - return true; - } - CURVNET_RESTORE(); - break; - } + return !v6_forwarding; #endif #if defined (INET) case ETHERTYPE_IP: - { - CURVNET_SET(lc->ifp->if_vnet); - if (VNET(ipforwarding) == 0) { - CURVNET_RESTORE(); - return true; - } - CURVNET_RESTORE(); - break; - } + return !v4_forwarding; #endif } return false; } +#else +static void +iflib_get_ip_forwarding(struct lro_ctrl *lc __unused, bool *v4 __unused, bool *v6 __unused) +{ +} #endif static bool @@ -2525,6 +2527,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) struct ifnet *ifp; int lro_enabled; bool lro_possible = false; + bool v4_forwarding, v6_forwarding; /* * XXX early demux data packets so that if_input processing only handles @@ -2601,6 +2604,8 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) __iflib_fl_refill_lt(ctx, fl, budget + 8); lro_enabled = (if_getcapenable(ifp) & IFCAP_LRO); + if (lro_enabled) + iflib_get_ip_forwarding(&rxq->ifr_lc, &v4_forwarding, &v6_forwarding); mt = mf = NULL; while (mh != NULL) { m = mh; @@ -2615,7 +2620,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) #if defined(INET6) || defined(INET) if (lro_enabled) { if (!lro_possible) { - lro_possible = iflib_check_lro_possible(&rxq->ifr_lc, m); + lro_possible = iflib_check_lro_possible(m, v4_forwarding, v6_forwarding); if (lro_possible && mf != NULL) { ifp->if_input(ifp, mf); DBG_COUNTER_INC(rx_if_input); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r326432 - head/sys/net
Author: shurd Date: Fri Dec 1 17:58:20 2017 New Revision: 326432 URL: https://svnweb.freebsd.org/changeset/base/326432 Log: Add support for SIOCGIFXMEDIA to iflib SIOCGIFXMEDIA is required for extended ethernet media types, but iflib did not support it. Reported by: Bhargava Chenna Marreddy Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D13312 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri Dec 1 17:15:13 2017(r326431) +++ head/sys/net/iflib.cFri Dec 1 17:58:20 2017(r326432) @@ -3912,6 +3912,7 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) CTX_UNLOCK(ctx); /* falls thru */ case SIOCGIFMEDIA: + case SIOCGIFXMEDIA: err = ifmedia_ioctl(ifp, ifr, &ctx->ifc_media, command); break; case SIOCGI2C: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r326370 - head/sys/net
Author: shurd Date: Wed Nov 29 18:21:17 2017 New Revision: 326370 URL: https://svnweb.freebsd.org/changeset/base/326370 Log: Fix comment introduced in r326369 The code uses the set of all CPUs, it doesn't zero out the set. Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Nov 29 18:14:57 2017(r326369) +++ head/sys/net/iflib.cWed Nov 29 18:21:17 2017(r326370) @@ -4260,7 +4260,7 @@ iflib_device_register(device_t dev, void *sc, if_share /* XXX format name */ taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, -1, "admin"); - /* Set up cpu set. If it fails, zero out the set. */ + /* Set up cpu set. If it fails, use the set of all CPUs. */ if (bus_get_cpus(dev, INTR_CPUS, sizeof(ctx->ifc_cpus), &ctx->ifc_cpus) != 0) { device_printf(dev, "Unable to fetch CPU list\n"); CPU_COPY(&all_cpus, &ctx->ifc_cpus); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r326369 - head/sys/net
Author: shurd Date: Wed Nov 29 18:14:57 2017 New Revision: 326369 URL: https://svnweb.freebsd.org/changeset/base/326369 Log: Ensure that ctx->ifc_cpus is always initialized If a device didn't support MSI-X, ctx->ifc_cpus would not be initialized, but the IRQ allocation routines still uses the value. Move the initialization to common code. Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Nov 29 14:45:28 2017(r326368) +++ head/sys/net/iflib.cWed Nov 29 18:14:57 2017(r326369) @@ -4259,6 +4259,14 @@ iflib_device_register(device_t dev, void *sc, if_share GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); /* XXX format name */ taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, -1, "admin"); + + /* Set up cpu set. If it fails, zero out the set. */ + if (bus_get_cpus(dev, INTR_CPUS, sizeof(ctx->ifc_cpus), &ctx->ifc_cpus) != 0) { + device_printf(dev, "Unable to fetch CPU list\n"); + CPU_COPY(&all_cpus, &ctx->ifc_cpus); + } + MPASS(CPU_COUNT(&ctx->ifc_cpus) > 0); + /* ** Now setup MSI or MSI/X, should ** return us the number of supported @@ -4984,7 +4992,7 @@ find_nth(if_ctx_t ctx, cpuset_t *cpus, int qid) int i, cpuid, eqid, count; CPU_COPY(&ctx->ifc_cpus, cpus); - count = CPU_COUNT(&ctx->ifc_cpus); + count = CPU_COUNT(cpus); eqid = qid % count; /* clear up to the qid'th bit */ for (i = 0; i < eqid; i++) { @@ -5391,20 +5399,14 @@ iflib_msix_init(if_ctx_t ctx) #else queuemsgs = msgs - admincnt; #endif - if (bus_get_cpus(dev, INTR_CPUS, sizeof(ctx->ifc_cpus), &ctx->ifc_cpus) == 0) { #ifdef RSS - queues = imin(queuemsgs, rss_getnumbuckets()); + queues = imin(queuemsgs, rss_getnumbuckets()); #else - queues = queuemsgs; + queues = queuemsgs; #endif - queues = imin(CPU_COUNT(&ctx->ifc_cpus), queues); - device_printf(dev, "pxm cpus: %d queue msgs: %d admincnt: %d\n", - CPU_COUNT(&ctx->ifc_cpus), queuemsgs, admincnt); - } else { - device_printf(dev, "Unable to fetch CPU list\n"); - /* Figure out a reasonable auto config value */ - queues = min(queuemsgs, mp_ncpus); - } + queues = imin(CPU_COUNT(&ctx->ifc_cpus), queues); + device_printf(dev, "pxm cpus: %d queue msgs: %d admincnt: %d\n", + CPU_COUNT(&ctx->ifc_cpus), queuemsgs, admincnt); #ifdef RSS /* If we're doing RSS, clamp at the number of RSS buckets */ if (queues > rss_getnumbuckets()) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r326033 - head/sys/net
Author: shurd Date: Mon Nov 20 21:57:04 2017 New Revision: 326033 URL: https://svnweb.freebsd.org/changeset/base/326033 Log: Fix off-by-one error in bit_nclear() usage bit_nclear() takes the bit numbers for the start and end bits, not the start and a count. This was resulting in memory corruption past the end of the bitstr_t. Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cMon Nov 20 21:56:25 2017(r326032) +++ head/sys/net/iflib.cMon Nov 20 21:57:04 2017(r326033) @@ -2025,7 +2025,7 @@ iflib_fl_setup(iflib_fl_t fl) if_ctx_t ctx = rxq->ifr_ctx; if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; - bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size); + bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size - 1); /* ** Free current RX buffer structs and their mbufs */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r325901 - head/sys/net
Author: shurd Date: Thu Nov 16 18:52:58 2017 New Revision: 325901 URL: https://svnweb.freebsd.org/changeset/base/325901 Log: Fix default numbers of iflib queue sets The intent appears to be having one RX/TX queue set per core, but since scctx->isc_n[tr]xqsets is set to max before calling iflib_msix_init(), both end up being set to total number of cores. Use ctx->ifc_sysctl_n[rt]xqs as the selected value and scctx->isc_n[rt]xqsets as the max. This should result in what appears to be the intended behaviour Reviewed by: sbruno Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D13096 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cThu Nov 16 18:22:03 2017(r325900) +++ head/sys/net/iflib.cThu Nov 16 18:52:58 2017(r325901) @@ -5312,11 +5312,11 @@ iflib_msix_init(if_ctx_t ctx) int iflib_num_tx_queues, iflib_num_rx_queues; int err, admincnt, bar; - iflib_num_tx_queues = scctx->isc_ntxqsets; - iflib_num_rx_queues = scctx->isc_nrxqsets; + iflib_num_tx_queues = ctx->ifc_sysctl_ntxqs; + iflib_num_rx_queues = ctx->ifc_sysctl_nrxqs; - device_printf(dev, "msix_init qsets capped at %d\n", iflib_num_tx_queues); - + device_printf(dev, "msix_init qsets capped at %d\n", imax(scctx->isc_ntxqsets, scctx->isc_nrxqsets)); + bar = ctx->ifc_softc_ctx.isc_msix_bar; admincnt = sctx->isc_admin_intrcnt; /* Override by global tuneable */ @@ -5414,6 +5414,10 @@ iflib_msix_init(if_ctx_t ctx) rx_queues = iflib_num_rx_queues; else rx_queues = queues; + + if (rx_queues > scctx->isc_nrxqsets) + rx_queues = scctx->isc_nrxqsets; + /* * We want this to be all logical CPUs by default */ @@ -5421,6 +5425,9 @@ iflib_msix_init(if_ctx_t ctx) tx_queues = iflib_num_tx_queues; else tx_queues = mp_ncpus; + + if (tx_queues > scctx->isc_ntxqsets) + tx_queues = scctx->isc_ntxqsets; if (ctx->ifc_sysctl_qs_eq_override == 0) { #ifdef INVARIANTS ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r325488 - head/sys/dev/bnxt
Author: shurd Date: Mon Nov 6 16:41:29 2017 New Revision: 325488 URL: https://svnweb.freebsd.org/changeset/base/325488 Log: bnxt: Add support for new phy_types and speeds - Part #2 Use our ifm_list of supported media types rather than nested switch statements to find the current media type. Find a supported type that matches the current speed. Remove all workarounds while updating ifmr->ifm_active. For BNXT_IFMEDIA_ADD, added Three more speeds IFM_10G_T, IFM_2500_T & IFM_2500_KX. Submitted by: Bhargava Chenna Marreddy Reviewed by: shurd, sbruno Approved by: sbruno (mentor) Sponsored by: Broadcom Limited Differential Revision:https://reviews.freebsd.org/D12896 Modified: head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/if_bnxt.c == --- head/sys/dev/bnxt/if_bnxt.c Mon Nov 6 16:23:21 2017(r325487) +++ head/sys/dev/bnxt/if_bnxt.c Mon Nov 6 16:41:29 2017(r325488) @@ -1198,8 +1198,11 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * if { struct bnxt_softc *softc = iflib_get_softc(ctx); struct bnxt_link_info *link_info = &softc->link_info; - uint8_t phy_type = get_phy_type(softc); + struct ifmedia_entry *next; + uint64_t target_baudrate = bnxt_get_baudrate(link_info); + int active_media = IFM_UNKNOWN; + bnxt_update_link(softc, true); ifmr->ifm_status = IFM_AVALID; @@ -1215,171 +1218,17 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * if else ifmr->ifm_active |= IFM_HDX; - switch (link_info->link_speed) { - case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100MB: - ifmr->ifm_active |= IFM_100_T; - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_1GB: - switch (phy_type) { - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKX: - ifmr->ifm_active |= IFM_1000_KX; +/* + * Go through the list of supported media which got prepared + * as part of bnxt_add_media_types() using api ifmedia_add(). + */ + LIST_FOREACH(next, &(iflib_get_media(ctx)->ifm_list), ifm_list) { + if (ifmedia_baudrate(next->ifm_media) == target_baudrate) { + active_media = next->ifm_media; break; - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET: - ifmr->ifm_active |= IFM_1000_T; - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_SGMIIEXTPHY: - ifmr->ifm_active |= IFM_1000_SGMII; - break; - default: -/* - * Workaround: - *Don't return IFM_UNKNOWN until - *Stratus return proper media_type - */ - ifmr->ifm_active |= IFM_1000_KX; - break; } - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_2_5GB: - switch (phy_type) { - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKX: - ifmr->ifm_active |= IFM_2500_KX; - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET: - ifmr->ifm_active |= IFM_2500_T; - break; - default: - ifmr->ifm_active |= IFM_UNKNOWN; - break; - } - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_10GB: - switch (phy_type) { - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASECR: - ifmr->ifm_active |= IFM_10G_CR1; - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR4: - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR2: - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKR: - ifmr->ifm_active |= IFM_10G_KR; - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASELR: - ifmr->ifm_active |= IFM_10G_LR; - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASESR: - ifmr->ifm_active |= IFM_10G_SR; - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASEKX: - ifmr->ifm_active |= IFM_10G_KX4; - break; - case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET: - ifmr->ifm_active |= IFM_10G_T; - break; - default: -/* - * Workaround: - *Don't return IFM_UNKNOWN until - *Stratus return proper media_
svn commit: r325487 - head/sys/net
Author: shurd Date: Mon Nov 6 16:23:21 2017 New Revision: 325487 URL: https://svnweb.freebsd.org/changeset/base/325487 Log: Only chain non-LRO mbufs when LRO is not possible Preserve packet order between tcp_lro_rx() and if_input() to avoid creating extra corner cases. If no packets can be LROed, combine them into one chain for submission via if_input(). If any packet can potentially be LROed however, retain old behaviour and call if_input() for each packet. This should keep the 12% improvement for small packet forwarding intact, but mostly avoids impacting the LRO case. Reviewed by: cem, sbruno Approved by: sbruno (mentor) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D12876 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cMon Nov 6 15:29:33 2017(r325486) +++ head/sys/net/iflib.cMon Nov 6 16:23:21 2017(r325487) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -68,6 +69,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -2463,7 +2466,48 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) return (m); } +#if defined(INET6) || defined(INET) +/* + * Returns true if it's possible this packet could be LROed. + * if it returns false, it is guaranteed that tcp_lro_rx() + * would not return zero. + */ static bool +iflib_check_lro_possible(struct lro_ctrl *lc, struct mbuf *m) +{ + struct ether_header *eh; + uint16_t eh_type; + + eh = mtod(m, struct ether_header *); + eh_type = ntohs(eh->ether_type); + switch (eh_type) { + case ETHERTYPE_IPV6: + { + CURVNET_SET(lc->ifp->if_vnet); + if (VNET(ip6_forwarding) == 0) { + CURVNET_RESTORE(); + return true; + } + CURVNET_RESTORE(); + break; + } + case ETHERTYPE_IP: + { + CURVNET_SET(lc->ifp->if_vnet); + if (VNET(ipforwarding) == 0) { + CURVNET_RESTORE(); + return true; + } + CURVNET_RESTORE(); + break; + } + } + + return false; +} +#endif + +static bool iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) { if_ctx_t ctx = rxq->ifr_ctx; @@ -2476,6 +2520,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) iflib_fl_t fl; struct ifnet *ifp; int lro_enabled; + bool lro_possible = false; /* * XXX early demux data packets so that if_input processing only handles @@ -2555,8 +2600,6 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) mt = mf = NULL; while (mh != NULL) { m = mh; - if (mf == NULL) - mf = m; mh = mh->m_nextpkt; m->m_nextpkt = NULL; #ifndef __NO_STRICT_ALIGNMENT @@ -2566,12 +2609,27 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) rx_bytes += m->m_pkthdr.len; rx_pkts++; #if defined(INET6) || defined(INET) - if (lro_enabled && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0) { - if (mf == m) - mf = NULL; - continue; + if (lro_enabled) { + if (!lro_possible) { + lro_possible = iflib_check_lro_possible(&rxq->ifr_lc, m); + if (lro_possible && mf != NULL) { + ifp->if_input(ifp, mf); + DBG_COUNTER_INC(rx_if_input); + mt = mf = NULL; + } + } + if (lro_possible && tcp_lro_rx(&rxq->ifr_lc, m, 0) == 0) + continue; } #endif + if (lro_possible) { + ifp->if_input(ifp, m); + DBG_COUNTER_INC(rx_if_input); + continue; + } + + if (mf == NULL) + mf = m; if (mt != NULL) mt->m_nextpkt = m; mt = m; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r325245 - head/sys/net
Author: shurd Date: Tue Oct 31 19:03:35 2017 New Revision: 325245 URL: https://svnweb.freebsd.org/changeset/base/325245 Log: Preserve TSO checksum flags r323941 incorrectly disabled TSO flags based on MTU. Reported by: Yuri Pankov Reviewed by: sbruno Approved by: sbruno (mentor) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D12880 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue Oct 31 19:02:14 2017(r325244) +++ head/sys/net/iflib.cTue Oct 31 19:03:35 2017(r325245) @@ -2718,10 +2718,6 @@ iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, pi->ipi_ehdrlen = ETHER_HDR_LEN; } - if (if_getmtu(txq->ift_ctx->ifc_ifp) >= pi->ipi_len) { - pi->ipi_csum_flags &= ~(CSUM_IP_TSO|CSUM_IP6_TSO); - } - switch (pi->ipi_etype) { #ifdef INET case ETHERTYPE_IP: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r325241 - head/sys/net
Author: shurd Date: Tue Oct 31 17:50:42 2017 New Revision: 325241 URL: https://svnweb.freebsd.org/changeset/base/325241 Log: Fix PR221990 - Assertion at iflib.c:1947 ifl_pidx and ifl_credits are going out of sync in _iflib_fl_refill() as they use different update log. Use the same update logic for both, and add a final call to isc_rxd_refill() to handle early exits from the loop. PR: 221990 Reported by: pho Reviewed by: sbruno Approved by: sbruno (mentor) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D12798 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue Oct 31 17:16:46 2017(r325240) +++ head/sys/net/iflib.cTue Oct 31 17:50:42 2017(r325241) @@ -1818,20 +1818,22 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun int n, i = 0; uint64_t bus_addr; int err; + qidx_t credits; sd_m = fl->ifl_sds.ifsd_m; sd_map = fl->ifl_sds.ifsd_map; sd_cl = fl->ifl_sds.ifsd_cl; sd_flags = fl->ifl_sds.ifsd_flags; idx = pidx; + credits = fl->ifl_credits; n = count; MPASS(n > 0); - MPASS(fl->ifl_credits + n <= fl->ifl_size); + MPASS(credits + n <= fl->ifl_size); if (pidx < fl->ifl_cidx) MPASS(pidx + n <= fl->ifl_cidx); - if (pidx == fl->ifl_cidx && (fl->ifl_credits < fl->ifl_size)) + if (pidx == fl->ifl_cidx && (credits < fl->ifl_size)) MPASS(fl->ifl_gen == 0); if (pidx > fl->ifl_cidx) MPASS(n <= fl->ifl_size - pidx + fl->ifl_cidx); @@ -1904,9 +1906,9 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun fl->ifl_rxd_idxs[i] = frag_idx; fl->ifl_bus_addrs[i] = bus_addr; fl->ifl_vm_addrs[i] = cl; - fl->ifl_credits++; + credits++; i++; - MPASS(fl->ifl_credits <= fl->ifl_size); + MPASS(credits <= fl->ifl_size); if (++idx == fl->ifl_size) { fl->ifl_gen = 1; idx = 0; @@ -1918,10 +1920,18 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun i = 0; pidx = idx; fl->ifl_pidx = idx; + fl->ifl_credits = credits; } } done: + if (i) { + iru.iru_pidx = pidx; + iru.iru_count = i; + ctx->isc_rxd_refill(ctx->ifc_softc, &iru); + fl->ifl_pidx = idx; + fl->ifl_credits = credits; + } DBG_COUNTER_INC(rxd_flush); if (fl->ifl_pidx == 0) pidx = fl->ifl_size - 1; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r325201 - head/sys/net
Author: shurd Date: Tue Oct 31 02:49:28 2017 New Revision: 325201 URL: https://svnweb.freebsd.org/changeset/base/325201 Log: Fix build with nodevice netmap iru_init() was declared and used outside the DEV_NETMAP conditional blocks, but was implemented inside one. Move the implementation out of the DEV_NETMAP block to allow building with netmap disabled. Reported by: Andrew Turner Reviewed by: sbruno Approved by: sbruno (mentor) Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D12842 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue Oct 31 02:46:36 2017(r325200) +++ head/sys/net/iflib.cTue Oct 31 02:49:28 2017(r325201) @@ -790,20 +790,6 @@ iflib_netmap_register(struct netmap_adapter *na, int o return (status); } -static void -iru_init(if_rxd_update_t iru, iflib_rxq_t rxq, uint8_t flid) -{ - iflib_fl_t fl; - - fl = &rxq->ifr_fl[flid]; - iru->iru_paddrs = fl->ifl_bus_addrs; - iru->iru_vaddrs = &fl->ifl_vm_addrs[0]; - iru->iru_idxs = fl->ifl_rxd_idxs; - iru->iru_qsidx = rxq->ifr_id; - iru->iru_buf_size = fl->ifl_buf_size; - iru->iru_flidx = fl->ifl_id; -} - static int netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, uint32_t nm_i, bool init) { @@ -1235,6 +1221,20 @@ prefetch2cachelines(void *x) #define prefetch(x) #define prefetch2cachelines(x) #endif + +static void +iru_init(if_rxd_update_t iru, iflib_rxq_t rxq, uint8_t flid) +{ + iflib_fl_t fl; + + fl = &rxq->ifr_fl[flid]; + iru->iru_paddrs = fl->ifl_bus_addrs; + iru->iru_vaddrs = &fl->ifl_vm_addrs[0]; + iru->iru_idxs = fl->ifl_rxd_idxs; + iru->iru_qsidx = rxq->ifr_id; + iru->iru_buf_size = fl->ifl_buf_size; + iru->iru_flidx = fl->ifl_id; +} static void _iflib_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r325169 - head/sys/dev/bnxt
Author: shurd Date: Mon Oct 30 21:26:23 2017 New Revision: 325169 URL: https://svnweb.freebsd.org/changeset/base/325169 Log: bnxt: Add support for new phy_types and speeds 1) Add new phy_types and speeds from the latest firmware header. 2) Introduced a macro to avoid code duplication and improve readability for the invocation of ifmedia_add(). Submitted by: Bhargava Chenna Marreddy Reviewed by: shurd, sbruno Approved by: sbruno (mentor) Sponsored by: Broadcom Limited Differential Revision:https://reviews.freebsd.org/D12423 Modified: head/sys/dev/bnxt/bnxt.h head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/bnxt.h == --- head/sys/dev/bnxt/bnxt.hMon Oct 30 21:20:33 2017(r325168) +++ head/sys/dev/bnxt/bnxt.hMon Oct 30 21:26:23 2017(r325169) @@ -231,6 +231,11 @@ __FBSDID("$FreeBSD$"); #define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max) +#define BNXT_IFMEDIA_ADD(supported, fw_speed, ifm_speed) do { \ + if ((supported) & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_ ## fw_speed) \ + ifmedia_add(softc->media, IFM_ETHER | (ifm_speed), 0, NULL); \ +} while(0) + /* NVRAM access */ enum bnxt_nvm_directory_type { BNX_DIR_TYPE_UNUSED = 0, Modified: head/sys/dev/bnxt/if_bnxt.c == --- head/sys/dev/bnxt/if_bnxt.c Mon Oct 30 21:20:33 2017(r325168) +++ head/sys/dev/bnxt/if_bnxt.c Mon Oct 30 21:26:23 2017(r325169) @@ -2121,129 +2121,86 @@ bnxt_add_media_types(struct bnxt_softc *softc) return; switch (phy_type) { + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASECR4: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASECR4: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASECR_CA_L: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASECR_CA_S: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASECR_CA_N: case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASECR: - if (supported & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB) - ifmedia_add(softc->media, IFM_ETHER | IFM_100G_CR4, 0, - NULL); - if (supported & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_50GB) - ifmedia_add(softc->media, IFM_ETHER | IFM_50G_CR2, 0, - NULL); - if (supported & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_40GB) - ifmedia_add(softc->media, IFM_ETHER | IFM_40G_CR4, 0, - NULL); - if (supported & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_25GB) - ifmedia_add(softc->media, IFM_ETHER | IFM_25G_CR, 0, - NULL); - if (supported & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10GB) - ifmedia_add(softc->media, IFM_ETHER | IFM_10G_CR1, 0, - NULL); + BNXT_IFMEDIA_ADD(supported, SPEEDS_100GB, IFM_100G_CR4); + BNXT_IFMEDIA_ADD(supported, SPEEDS_50GB, IFM_50G_CR2); + BNXT_IFMEDIA_ADD(supported, SPEEDS_40GB, IFM_40G_CR4); + BNXT_IFMEDIA_ADD(supported, SPEEDS_25GB, IFM_25G_CR); + BNXT_IFMEDIA_ADD(supported, SPEEDS_10GB, IFM_10G_CR1); + BNXT_IFMEDIA_ADD(supported, SPEEDS_1GB, IFM_1000_T); break; + + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASELR4: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASELR4: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASELR: + BNXT_IFMEDIA_ADD(supported, SPEEDS_100GB, IFM_100G_LR4); + BNXT_IFMEDIA_ADD(supported, SPEEDS_40GB, IFM_40G_LR4); + BNXT_IFMEDIA_ADD(supported, SPEEDS_25GB, IFM_25G_LR); + BNXT_IFMEDIA_ADD(supported, SPEEDS_10GB, IFM_10G_LR); + BNXT_IFMEDIA_ADD(supported, SPEEDS_1GB, IFM_1000_LX); + break; + + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASESR10: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASESR4: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASESR4: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASESR: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_40G_BASEER4: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_100G_BASEER4: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_25G_BASESR: + case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_1G_BASESX: + BNXT_IFMEDIA_ADD(supported, SPEEDS_100GB, IFM_100G_SR4); + BNXT_IFMEDIA_ADD(supported, SPEEDS_40GB, IFM_40G_SR4); + BNXT_IFMEDIA_ADD(supported, SPEEDS_25GB, IFM_25G_SR); + BNXT_IFMEDIA_ADD(supported, SPEEDS_10GB, IFM_10G_SR); + BNXT_IFMEDIA_ADD(supported, SPEEDS_1GB, IFM_1000_SX); + break; + case HWRM_PORT_PHY