svn commit: r359029 - head/sys/dev/vmware/vmxnet3
Author: pkelsey Date: Tue Mar 17 03:32:13 2020 New Revision: 359029 URL: https://svnweb.freebsd.org/changeset/base/359029 Log: Restore power-of-2 queue count constraint from r290948 When vmx(4) was converted to an iflib driver in r343291, the power-of-2 queue count constraint was removed as it appeared that current implementations of the VMXNET3 virtual device no longer required that constraint. It turns out that some of the implementations still do, and on such systems, the device will fail to initialize when configured with a non-power-of-2 RX or TX queue count. PR: 237321 Reported by: ncrog...@gmail.com MFC after:1 week Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cMon Mar 16 23:37:57 2020 (r359028) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cTue Mar 17 03:32:13 2020 (r359029) @@ -321,6 +321,13 @@ vmxnet3_register(device_t dev) } static int +trunc_powerof2(int val) +{ + + return (1U << (fls(val) - 1)); +} + +static int vmxnet3_attach_pre(if_ctx_t ctx) { device_t dev; @@ -349,12 +356,16 @@ vmxnet3_attach_pre(if_ctx_t ctx) /* If 0, the iflib tunable was not set, so set to the default */ if (scctx->isc_nrxqsets == 0) scctx->isc_nrxqsets = VMXNET3_DEF_RX_QUEUES; + scctx->isc_nrxqsets = trunc_powerof2(scctx->isc_nrxqsets); scctx->isc_nrxqsets_max = min(VMXNET3_MAX_RX_QUEUES, mp_ncpus); + scctx->isc_nrxqsets_max = trunc_powerof2(scctx->isc_nrxqsets_max); /* If 0, the iflib tunable was not set, so set to the default */ if (scctx->isc_ntxqsets == 0) scctx->isc_ntxqsets = VMXNET3_DEF_TX_QUEUES; + scctx->isc_ntxqsets = trunc_powerof2(scctx->isc_ntxqsets); scctx->isc_ntxqsets_max = min(VMXNET3_MAX_TX_QUEUES, mp_ncpus); + scctx->isc_ntxqsets_max = trunc_powerof2(scctx->isc_ntxqsets_max); /* * Enforce that the transmit completion queue descriptor count is ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r358995 - head/sys/net
On Mon, Mar 16, 2020 at 7:55 AM Slawa Olhovchenkov wrote: > On Sat, Mar 14, 2020 at 07:43:44PM +0000, Patrick Kelsey wrote: > > > Author: pkelsey > > Date: Sat Mar 14 19:43:44 2020 > > New Revision: 358995 > > URL: https://svnweb.freebsd.org/changeset/base/358995 > > > > Log: > > Fix iflib freelist state corruption > > > > This fixes a bug in iflib freelist management that breaks the required > > correspondence between freelist indexes and driver ring slots. > > > > PR: 243126, 243392, 240628 > > Are you sure? > Bug 240628 - sysutils/zfsnap2: Completion script link for zsh has > wrong path > > Unfortunately, that should be 240608, not 240628. > > Reported by:avg, alexandr.oleyni...@gmail.com, Harald > Schmalzbauer > > Reviewed by:avg, gallatin > > MFC after: 1 week > > Differential Revision: https://reviews.freebsd.org/D23943 > > Very interesting. > Is this related to my problem? > I am have trouble w/ netmap: > > 1. netmap reported RX slots filled all ring (tail == head-1) > 2. application processed all RX slots and reported to nemap (head == tail) > 3. RX stuck. > > workaround: report on step 2 head = tail-1 (one RX slots left > unprocessed). > > Also I am have trouble w/ TX, similar. > This commit changes code that netmap does not use. netmap freelist refill is handled via netmap_fl_refill() in iflib.c, and that was not examined as part of this work. -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r359002 - head/sys/net
Author: pkelsey Date: Sat Mar 14 20:13:42 2020 New Revision: 359002 URL: https://svnweb.freebsd.org/changeset/base/359002 Log: Remove extraneous code from iflib ifsd_cidx is never used, and the line removed from rxd_frag_to_sd() is just dead code. Reviewed by: erj, gallatin MFC after:1 week Differential Revision:https://reviews.freebsd.org/D23951 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cSat Mar 14 20:11:46 2020(r359001) +++ head/sys/net/iflib.cSat Mar 14 20:13:42 2020(r359002) @@ -451,7 +451,6 @@ struct iflib_rxq { typedef struct if_rxsd { caddr_t *ifsd_cl; iflib_fl_t ifsd_fl; - qidx_t ifsd_cidx; } *if_rxsd_t; /* multiple of word size */ @@ -2552,7 +2551,6 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, boo cidx = irf->irf_idx; fl = >ifr_fl[flid]; sd->ifsd_fl = fl; - sd->ifsd_cidx = cidx; m = fl->ifl_sds.ifsd_m[cidx]; sd->ifsd_cl = >ifl_sds.ifsd_cl[cidx]; fl->ifl_credits--; @@ -2564,7 +2562,6 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, boo next = (cidx + CACHE_PTR_INCREMENT) & (fl->ifl_size-1); prefetch(>ifl_sds.ifsd_map[next]); map = fl->ifl_sds.ifsd_map[cidx]; - next = (cidx + CACHE_LINE_SIZE) & (fl->ifl_size-1); bus_dmamap_sync(fl->ifl_buf_tag, map, BUS_DMASYNC_POSTREAD); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r359001 - head/sys/dev/vmware/vmxnet3
Author: pkelsey Date: Sat Mar 14 20:11:46 2020 New Revision: 359001 URL: https://svnweb.freebsd.org/changeset/base/359001 Log: Adjust if_vmx default receive parameters for better out-of-box performance These adjustments improve performance with jumbo frames and/or LRO enabled (i.e., when there may be multiple descriptors per packet) by increasing the default size of the receive queues and by always using page-sized buffers for the body type receive ring. This patch also adjust the initialization of the max frame size to remove cases where certain configuration sequences would result in 2K receive buffers being used instead of 4K ones when jumbo frames were enabled. Reviewed by: gallatin MFC after:1 week Differential Revision:https://reviews.freebsd.org/D23950 Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c head/sys/dev/vmware/vmxnet3/if_vmxvar.h Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cSat Mar 14 20:08:04 2020 (r359000) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cSat Mar 14 20:11:46 2020 (r359001) @@ -381,6 +381,12 @@ vmxnet3_attach_pre(if_ctx_t ctx) scctx->isc_rxqsizes[2] = sizeof(struct vmxnet3_rxdesc) * scctx->isc_nrxd[2]; + /* +* Initialize the max frame size and descriptor queue buffer +* sizes. +*/ + vmxnet3_mtu_set(ctx, if_getmtu(sc->vmx_ifp)); + scctx->isc_rss_table_size = UPT1_RSS_MAX_IND_TABLE_SIZE; /* Map PCI BARs */ @@ -1943,14 +1949,9 @@ static void vmxnet3_init(if_ctx_t ctx) { struct vmxnet3_softc *sc; - if_softc_ctx_t scctx; sc = iflib_get_softc(ctx); - scctx = sc->vmx_scctx; - scctx->isc_max_frame_size = if_getmtu(iflib_get_ifp(ctx)) + - ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; - /* Use the current MAC address. */ bcopy(IF_LLADDR(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); vmxnet3_set_lladdr(sc); @@ -1975,10 +1976,36 @@ vmxnet3_multi_set(if_ctx_t ctx) static int vmxnet3_mtu_set(if_ctx_t ctx, uint32_t mtu) { + struct vmxnet3_softc *sc; + if_softc_ctx_t scctx; + sc = iflib_get_softc(ctx); + scctx = sc->vmx_scctx; + if (mtu > VMXNET3_TX_MAXSIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN)) return (EINVAL); + + /* +* Update the max frame size so that the rx mbuf size is +* chosen based on the new mtu during the interface init that +* will occur after this routine returns. +*/ + scctx->isc_max_frame_size = mtu + + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; + /* RX completion queue - n/a */ + scctx->isc_rxd_buf_size[0] = 0; + /* +* For header-type descriptors (used for first segment of +* packet), let iflib determine the buffer size based on the +* max frame size. +*/ + scctx->isc_rxd_buf_size[1] = 0; + /* +* For body-type descriptors (used for jumbo frames and LRO), +* always use page-sized buffers. +*/ + scctx->isc_rxd_buf_size[2] = MJUMPAGESIZE; return (0); } Modified: head/sys/dev/vmware/vmxnet3/if_vmxvar.h == --- head/sys/dev/vmware/vmxnet3/if_vmxvar.h Sat Mar 14 20:08:04 2020 (r359000) +++ head/sys/dev/vmware/vmxnet3/if_vmxvar.h Sat Mar 14 20:11:46 2020 (r359001) @@ -41,7 +41,7 @@ struct vmxnet3_softc; #define VMXNET3_MAX_TX_NDESC 4096 #define VMXNET3_MIN_TX_NDESC 32 #define VMXNET3_MASK_TX_NDESC 0x1F -#define VMXNET3_DEF_RX_NDESC 256 +#define VMXNET3_DEF_RX_NDESC 512 #define VMXNET3_MAX_RX_NDESC 2048 #define VMXNET3_MIN_RX_NDESC 32 #define VMXNET3_MASK_RX_NDESC 0x1F ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r359000 - head/sys/dev/vmware/vmxnet3
Author: pkelsey Date: Sat Mar 14 20:08:04 2020 New Revision: 359000 URL: https://svnweb.freebsd.org/changeset/base/359000 Log: Fix if_vmx receive checksum offload bug and harden against the device skipping receive descriptors This fixes a bug where the checksum offload status of received packets was being taken from the first descriptor instead of the last, which affected LRO packets. The driver has been hardened against the device skipping receive descriptors, although it is not believed that this can occur given the way this implementation configures the receive rings. Additionally, for packets received with the error indicator set, the driver now forces the length of all fragments in that packet to zero prior to passing it to iflib. Such packets should wind up being discarded at some point in the stack anyway, but this removes any questions by killing them in the driver. Counters have been added (and exposed via sysctls) for skipped receive descriptors, zero-length packets received, and packets received with the error indicator set so that these conditions can be easily observed in the field. PR: 243126, 243392, 240628 Reported by: avg, alexandr.oleyni...@gmail.com, Harald Schmalzbauer Reviewed by: gallatin MFC after:1 week Differential Revision:https://reviews.freebsd.org/D23949 Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c head/sys/dev/vmware/vmxnet3/if_vmxvar.h Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cSat Mar 14 19:58:50 2020 (r358999) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cSat Mar 14 20:08:04 2020 (r359000) @@ -1494,6 +1494,7 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t ri) int cqidx; uint16_t total_len; uint8_t nfrags; + uint8_t i; uint8_t flid; sc = vsc; @@ -1517,6 +1518,7 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t ri) KASSERT(rxcd->sop && rxcd->eop, ("%s: zero-length packet without both sop and eop set", __func__)); + rxc->vxcr_zero_length++; if (++cqidx == rxc->vxcr_ndesc) { cqidx = 0; rxc->vxcr_gen ^= 1; @@ -1572,31 +1574,6 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t ri) } } - /* VLAN */ - if (rxcd->vlan) { - ri->iri_flags |= M_VLANTAG; - ri->iri_vtag = rxcd->vtag; - } - - /* Checksum offload */ - if (!rxcd->no_csum) { - uint32_t csum_flags = 0; - - if (rxcd->ipv4) { - csum_flags |= CSUM_IP_CHECKED; - if (rxcd->ipcsum_ok) - csum_flags |= CSUM_IP_VALID; - } - if (!rxcd->fragment && (rxcd->tcp || rxcd->udp)) { - csum_flags |= CSUM_L4_CALC; - if (rxcd->csum_ok) { - csum_flags |= CSUM_L4_VALID; - ri->iri_csum_data = 0x; - } - } - ri->iri_csum_flags = csum_flags; - } - /* * The queue numbering scheme used for rxcd->qid is as follows: * - All of the command ring 0s are numbered [0, nrxqsets - 1] @@ -1632,6 +1609,46 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t ri) ri->iri_nfrags = nfrags; ri->iri_len = total_len; + /* +* If there's an error, the last descriptor in the packet will +* have the error indicator set. In this case, set all +* fragment lengths to zero. This will cause iflib to discard +* the packet, but process all associated descriptors through +* the refill mechanism. +*/ + if (__predict_false(rxcd->error)) { + rxc->vxcr_pkt_errors++; + for (i = 0; i < nfrags; i++) { + frag = >iri_frags[i]; + frag->irf_len = 0; + } + } else { + /* Checksum offload information is in the last descriptor. */ + if (!rxcd->no_csum) { + uint32_t csum_flags = 0; + + if (rxcd->ipv4) { + csum_flags |= CSUM_IP_CHECKED; + if (rxcd->ipcsum_ok) + csum_flags |= CSUM_IP_VALID; + } + if (!rxcd->fragment && (rxcd->tcp || rxcd->udp)) { + csum_flags |= CSUM_L4_CALC; + if (rxcd->csum_ok) { + csum_flags |= CSUM_L4_VALID; + ri->iri_csum_data = 0x; +
svn commit: r358999 - head/sys/net
Author: pkelsey Date: Sat Mar 14 19:58:50 2020 New Revision: 358999 URL: https://svnweb.freebsd.org/changeset/base/358999 Log: Remove refill budget from iflib Reviewed by: gallatin MFC after:1 week Differential Revision:https://reviews.freebsd.org/D23948 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cSat Mar 14 19:56:46 2020(r358998) +++ head/sys/net/iflib.cSat Mar 14 19:58:50 2020(r358999) @@ -2081,7 +2081,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun } static __inline uint8_t -__iflib_fl_refill_lt(if_ctx_t ctx, iflib_fl_t fl, int max) +__iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl) { /* we avoid allowing pidx to catch up with cidx as it confuses ixl */ int32_t reclaimable = fl->ifl_size - fl->ifl_credits - 1; @@ -2093,7 +2093,7 @@ __iflib_fl_refill_lt(if_ctx_t ctx, iflib_fl_t fl, int MPASS(reclaimable == delta); if (reclaimable > 0) - return (_iflib_fl_refill(ctx, fl, min(max, reclaimable))); + return (_iflib_fl_refill(ctx, fl, reclaimable)); return (0); } @@ -2812,7 +2812,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) cidxp = >ifr_fl[0].ifl_cidx; if ((avail = iflib_rxd_avail(ctx, rxq, *cidxp, budget)) == 0) { for (i = 0, fl = >ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) - retval |= __iflib_fl_refill_lt(ctx, fl, budget + 8); + retval |= __iflib_fl_refill_all(ctx, fl); DBG_COUNTER_INC(rx_unavail); return (retval); } @@ -2872,7 +2872,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) CURVNET_RESTORE(); /* make sure that we can refill faster than drain */ for (i = 0, fl = >ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) - retval |= __iflib_fl_refill_lt(ctx, fl, budget + 8); + retval |= __iflib_fl_refill_all(ctx, fl); lro_enabled = (if_getcapenable(ifp) & IFCAP_LRO); if (lro_enabled) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358998 - head/sys/net
Author: pkelsey Date: Sat Mar 14 19:56:46 2020 New Revision: 358998 URL: https://svnweb.freebsd.org/changeset/base/358998 Log: Allow iflib drivers to specify the buffer size used for each receive queue Reviewed by: erj, gallatin MFC after:1 week Differential Revision:https://reviews.freebsd.org/D23947 Modified: head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cSat Mar 14 19:55:05 2020(r358997) +++ head/sys/net/iflib.cSat Mar 14 19:56:46 2020(r358998) @@ -708,6 +708,7 @@ static int iflib_altq_if_transmit(if_t ifp, struct mbu static int iflib_register(if_ctx_t); static void iflib_deregister(if_ctx_t); static void iflib_unregister_vlan_handlers(if_ctx_t ctx); +static uint16_t iflib_get_mbuf_size_for(unsigned int size); static void iflib_init_locked(if_ctx_t ctx); static void iflib_add_device_sysctl_pre(if_ctx_t ctx); static void iflib_add_device_sysctl_post(if_ctx_t ctx); @@ -2163,6 +2164,8 @@ iflib_fl_setup(iflib_fl_t fl) { iflib_rxq_t rxq = fl->ifl_rxq; if_ctx_t ctx = rxq->ifr_ctx; + if_softc_ctx_t scctx = >ifc_softc_ctx; + int qidx; bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size - 1); /* @@ -2171,7 +2174,16 @@ iflib_fl_setup(iflib_fl_t fl) iflib_fl_bufs_free(fl); /* Now replenish the mbufs */ MPASS(fl->ifl_credits == 0); - fl->ifl_buf_size = ctx->ifc_rx_mbuf_sz; + qidx = rxq->ifr_fl_offset + fl->ifl_id; + if (scctx->isc_rxd_buf_size[qidx] != 0) + fl->ifl_buf_size = scctx->isc_rxd_buf_size[qidx]; + else + fl->ifl_buf_size = ctx->ifc_rx_mbuf_sz; + /* +* ifl_buf_size may be a driver-supplied value, so pull it up +* to the selected mbuf size. +*/ + fl->ifl_buf_size = iflib_get_mbuf_size_for(fl->ifl_buf_size); if (fl->ifl_buf_size > ctx->ifc_max_fl_buf_size) ctx->ifc_max_fl_buf_size = fl->ifl_buf_size; fl->ifl_cltype = m_gettype(fl->ifl_buf_size); @@ -2303,6 +2315,16 @@ iflib_timer(void *arg) STATE_UNLOCK(ctx); } +static uint16_t +iflib_get_mbuf_size_for(unsigned int size) +{ + + if (size <= MCLBYTES) + return (MCLBYTES); + else + return (MJUMPAGESIZE); +} + static void iflib_calc_rx_mbuf_sz(if_ctx_t ctx) { @@ -2312,10 +2334,8 @@ iflib_calc_rx_mbuf_sz(if_ctx_t ctx) * XXX don't set the max_frame_size to larger * than the hardware can handle */ - if (sctx->isc_max_frame_size <= MCLBYTES) - ctx->ifc_rx_mbuf_sz = MCLBYTES; - else - ctx->ifc_rx_mbuf_sz = MJUMPAGESIZE; + ctx->ifc_rx_mbuf_sz = + iflib_get_mbuf_size_for(sctx->isc_max_frame_size); } uint32_t @@ -6724,6 +6744,9 @@ iflib_add_device_sysctl_post(if_ctx_t ctx) SYSCTL_ADD_U16(ctx_list, fl_list, OID_AUTO, "credits", CTLFLAG_RD, >ifl_credits, 1, "credits available"); + SYSCTL_ADD_U16(ctx_list, fl_list, OID_AUTO, "buf_size", + CTLFLAG_RD, + >ifl_buf_size, 1, "buffer size"); #if MEMORY_LOGGING SYSCTL_ADD_QUAD(ctx_list, fl_list, OID_AUTO, "fl_m_enqueued", CTLFLAG_RD, Modified: head/sys/net/iflib.h == --- head/sys/net/iflib.hSat Mar 14 19:55:05 2020(r358997) +++ head/sys/net/iflib.hSat Mar 14 19:56:46 2020(r358998) @@ -220,6 +220,9 @@ typedef struct if_softc_ctx { uint32_t __spare2__; iflib_intr_mode_t isc_intr; + uint16_t isc_rxd_buf_size[8]; /* set at init time by driver, 0 +means use iflib-calculated size +based on isc_max_frame_size */ uint16_t isc_max_frame_size; /* set at init time by driver */ uint16_t isc_min_frame_size; /* set at init time by driver, only used if IFLIB_NEED_ETHER_PAD is set. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358997 - head/sys/net
Author: pkelsey Date: Sat Mar 14 19:55:05 2020 New Revision: 358997 URL: https://svnweb.freebsd.org/changeset/base/358997 Log: Remove freelist contiguous-indexes assertion from rxd_frag_to_sd() The vmx driver is an example of an iflib driver that might report packets using non-contiguous descriptors (with unused descriptors either between received packets or between the fragments of a received packet), so this assertion needs to be removed. For such drivers, the freelist producer and consumer indexes don't relate directly to driver ring slots (the driver deals directly with freelist buffer indexes supplied by iflib during refill, and reports them with each fragment during packet reception), but do continue to be used by iflib for accounting, such as determining the number of ring slots that are refillable. PR: 243126, 243392, 240628 Reported by: avg, alexandr.oleyni...@gmail.com, Harald Schmalzbauer Reviewed by: gallatin MFC after:1 week Differential Revision:https://reviews.freebsd.org/D23946 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cSat Mar 14 19:51:55 2020(r358996) +++ head/sys/net/iflib.cSat Mar 14 19:55:05 2020(r358997) @@ -2546,8 +2546,6 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, boo map = fl->ifl_sds.ifsd_map[cidx]; next = (cidx + CACHE_LINE_SIZE) & (fl->ifl_size-1); - /* not valid assert if bxe really does SGE from non-contiguous elements */ - MPASS(fl->ifl_cidx == cidx); bus_dmamap_sync(fl->ifl_buf_tag, map, BUS_DMASYNC_POSTREAD); if (rxq->pfil != NULL && PFIL_HOOKED_IN(rxq->pfil) && pf_rv != NULL && ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358996 - head/sys/net
Author: pkelsey Date: Sat Mar 14 19:51:55 2020 New Revision: 358996 URL: https://svnweb.freebsd.org/changeset/base/358996 Log: Fix iflib zero-length fragment handling The dmamap for zero-length fragments should not be unloaded, as doing so breaks the the cluster-reuse logic in _iflib_fl_refill(). All zero-length fragments are now handled by the assemble_segments() path so that the cluster-reuse logic there does not have to be replicated in the small-single-fragment-packet path of iflib_rxd_pkt_get(). Packets consisting entirely of zero-length fragments (which result in a NULL mbuf pointer) are now properly tolerated. This allows drivers (such as the vmx driver) to pass such packets to iflib when a descriptor error occurs during packet reception, the advantage being that the refill of descriptors associated with the error packet are handled via the existing iflib machinery without having to duplicate parts of that machinery in the driver to handle that error case. Reviewed by: avg, erj, gallatin MFC after:1 week Differential Revision:https://reviews.freebsd.org/D23945 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cSat Mar 14 19:43:44 2020(r358995) +++ head/sys/net/iflib.cSat Mar 14 19:51:55 2020(r358996) @@ -2550,7 +2550,8 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, boo MPASS(fl->ifl_cidx == cidx); bus_dmamap_sync(fl->ifl_buf_tag, map, BUS_DMASYNC_POSTREAD); - if (rxq->pfil != NULL && PFIL_HOOKED_IN(rxq->pfil) && pf_rv != NULL) { + if (rxq->pfil != NULL && PFIL_HOOKED_IN(rxq->pfil) && pf_rv != NULL && + irf->irf_len != 0) { payload = *sd->ifsd_cl; payload += ri->iri_pad; len = ri->iri_len - ri->iri_pad; @@ -2587,7 +2588,7 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, boo *pf_rv = PFIL_PASS; } - if (unload) + if (unload && irf->irf_len != 0) bus_dmamap_unload(fl->ifl_buf_tag, map); fl->ifl_cidx = (fl->ifl_cidx + 1) & (fl->ifl_size-1); if (__predict_false(fl->ifl_cidx == 0)) @@ -2672,6 +2673,7 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) /* should I merge this back in now that the two paths are basically duplicated? */ if (ri->iri_nfrags == 1 && + ri->iri_frags[0].irf_len != 0 && ri->iri_frags[0].irf_len <= MIN(IFLIB_RX_COPY_THRESH, MHLEN)) { m = rxd_frag_to_sd(rxq, >iri_frags[0], false, , _rv, ri); @@ -2688,6 +2690,8 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) } } else { m = assemble_segments(rxq, ri, , _rv); + if (m == NULL) + return (NULL); if (pf_rv != PFIL_PASS && pf_rv != PFIL_REALLOCED) return (m); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r358995 - head/sys/net
Author: pkelsey Date: Sat Mar 14 19:43:44 2020 New Revision: 358995 URL: https://svnweb.freebsd.org/changeset/base/358995 Log: Fix iflib freelist state corruption This fixes a bug in iflib freelist management that breaks the required correspondence between freelist indexes and driver ring slots. PR: 243126, 243392, 240628 Reported by: avg, alexandr.oleyni...@gmail.com, Harald Schmalzbauer Reviewed by: avg, gallatin MFC after:1 week Differential Revision:https://reviews.freebsd.org/D23943 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cSat Mar 14 18:35:44 2020(r358994) +++ head/sys/net/iflib.cSat Mar 14 19:43:44 2020(r358995) @@ -2072,7 +2072,9 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); ctx->isc_rxd_flush(ctx->ifc_softc, fl->ifl_rxq->ifr_id, fl->ifl_id, pidx); - fl->ifl_fragidx = frag_idx; + fl->ifl_fragidx = frag_idx + 1; + if (fl->ifl_fragidx == fl->ifl_size) + fl->ifl_fragidx = 0; return (n == -1 ? 0 : IFLIB_RXEOF_EMPTY); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r344238 - head/stand/common
On Mon, Feb 18, 2019 at 3:15 PM Warner Losh wrote: > > > On Mon, Feb 18, 2019 at 10:51 AM Rodney W. Grimes < > free...@pdx.rh.cn85.dnsmgr.net> wrote: > >> > On Mon, Feb 18, 2019 at 7:31 AM Ian Lepore wrote: >> > >> > > On Mon, 2019-02-18 at 15:09 +0200, Toomas Soome wrote: >> > > > > On 18 Feb 2019, at 01:32, Ian Lepore wrote: >> > > > > >> > > > > Author: ian >> > > > > Date: Sun Feb 17 23:32:09 2019 >> > > > > New Revision: 344238 >> > > > > URL: https://svnweb.freebsd.org/changeset/base/344238 >> > > > > >> > > > > Log: >> > > > > Restore loader(8)'s ability for lsdev to show partitions within >> a bsd >> > > slice. >> > > > > >> > > > > I'm pretty sure this used to work at one time, perhaps long >> ago. It >> > > has >> > > > > been failing recently because if you call disk_open() with >> > > dev->d_partition >> > > > > set to -1 when d_slice refers to a bsd slice, it assumes you >> want it >> > > to >> > > > > open the first partition within that slice. When you then pass >> that >> > > open >> > > > > dev instance to ptable_open(), it tries to read the start of the >> 'a' >> > > > > partition and decides there is no recognizable partition type >> there. >> > > > > >> > > > > This restores the old functionality by resetting d_offset to the >> start >> > > > > of the raw slice after disk_open() returns. For good measure, >> > > d_partition >> > > > > is also set back to -1, although that doesn't currently affect >> > > anything. >> > > > > >> > > > > I would have preferred to make disk_open() avoid such rude >> > > assumptions and >> > > > > if you ask for partition -1 you get the raw slice. But the >> commit >> > > history >> > > > > shows that someone already did that once (r239058), and had to >> revert >> > > it >> > > > > (r239232), so I didn't even try to go down that road. >> > > > >> > > > >> > > > What was the reason for the revert? I still do think the current >> > > > disk_open() approach is not good because it does break the promise >> to >> > > > get MBR partition (see common/disk.h). >> > > > >> > > > Of course I can see the appeal for something like ?boot disk0:? but >> > > > case like that should be solved by iterating partition table, and >> not >> > > > by making API to do wrong thing - if I did ask to for disk0s0: I >> > > > really would expect to get disk0s0: and not disk0s0a: >> > > > >> > > > But anyhow, it would be good to understand the actual reasoning >> > > > behind that decision. >> > > > >> > > >> > > I have no idea. As is so often the case, the commit message for the >> > > revert said what the commit did ("revert to historic behavior") >> without >> > > any hint of why the change was made. One has to assume that it broke >> > > some working cases and people complained. >> > > >> > > Part of the problem for the disk_open() "api" is that there is not >> even >> > > a comment block with some hints in it. I was thinking one potential >> > > solution might instead of using "if (partition < 0)" we could define a >> > > couple magical partition number values, PNUM_GETBEST = -1, >> > > PNUM_RAWSLICE = -2, that sort of thing. But it would require carefully >> > > combing through the existing code looking at all calls to disk_open() >> > > and all usage of disk_devdesc.d_partition. >> > > >> > >> > I think that we should fix the disk_open() api. And then fix everything >> > that uses it to comply with the new rules. The current hodge-podge that >> we >> > have causes a number of issues for different environments that are only >> > mostly worked around. I've done some work in this area to make things >> more >> > regular, but it's still a dog's breakfast of almost-stackable devices >> that >> > we overload too many things on, resulting in the mis-mash we have today. >> > When
svn commit: r344234 - head/stand/libsa/zfs
Author: pkelsey Date: Sun Feb 17 17:47:08 2019 New Revision: 344234 URL: https://svnweb.freebsd.org/changeset/base/344234 Log: It turns out r344226 narrowed the overrun bug but did not eliminate it entirely This commit fixes a remaining output buffer overrun in the single-sector case when there is a non-zero tail. Reviewed by: allanjude, tsoome MFC after:3 months MFC with: r344226 Differential Revision:https://reviews.freebsd.org/D19220 Modified: head/stand/libsa/zfs/zfs.c Modified: head/stand/libsa/zfs/zfs.c == --- head/stand/libsa/zfs/zfs.c Sun Feb 17 16:56:41 2019(r344233) +++ head/stand/libsa/zfs/zfs.c Sun Feb 17 17:47:08 2019(r344234) @@ -435,8 +435,8 @@ vdev_read(vdev_t *vdev, void *priv, off_t offset, void ret = EIO; goto error; } - memcpy(outbuf, bouncebuf + head, secsz - head); - outbuf += secsz - head; + memcpy(outbuf, bouncebuf + head, min(secsz - head, bytes)); + outbuf += min(secsz - head, bytes); } /* Full data return from read sectors */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344226 - head/stand/libsa/zfs
Author: pkelsey Date: Sun Feb 17 03:35:15 2019 New Revision: 344226 URL: https://svnweb.freebsd.org/changeset/base/344226 Log: Fix memory corruption bug introduced in r325310 The bug occurred when a bounce buffer was used and the requested read size was greater than the size of the bounce buffer. This commit also rewrites the read logic so that it is easier to systematically verify all alignment and size cases. Reviewed by: allanjude, tsoome MFC after:3 months Differential Revision:https://reviews.freebsd.org/D19140 Modified: head/stand/libsa/zfs/zfs.c Modified: head/stand/libsa/zfs/zfs.c == --- head/stand/libsa/zfs/zfs.c Sun Feb 17 03:21:42 2019(r344225) +++ head/stand/libsa/zfs/zfs.c Sun Feb 17 03:35:15 2019(r344226) @@ -363,51 +363,100 @@ static int vdev_read(vdev_t *vdev, void *priv, off_t offset, void *buf, size_t bytes) { int fd, ret; - size_t res, size, remainder, rb_size, blksz; - unsigned secsz; - off_t off; - char *bouncebuf, *rb_buf; + size_t res, head, tail, total_size, full_sec_size; + unsigned secsz, do_tail_read; + off_t start_sec; + char *outbuf, *bouncebuf; fd = (uintptr_t) priv; + outbuf = (char *) buf; bouncebuf = NULL; ret = ioctl(fd, DIOCGSECTORSIZE, ); if (ret != 0) return (ret); - off = offset / secsz; - remainder = offset % secsz; - if (lseek(fd, off * secsz, SEEK_SET) == -1) - return (errno); + /* +* Handling reads of arbitrary offset and size - multi-sector case +* and single-sector case. +* +*Multi-sector Case +*(do_tail_read = true if tail > 0) +* +* |<--total_size->| +* | | +* |<--head-->|<--bytes>|<--tail-->| +* | | | | +* | | |<~full_sec_size~>| | | +* +--+ +--+ +* | |0101010| . . . |0101011| | +* +--+ +--+ +* start_sec start_sec + n +* +* +* Single-sector Case +*(do_tail_read = false) +* +* |<--total_size = secsz->| +* | | +* |<-head->|<---bytes--->|<-tail->| +* +---+ +* ||0101010101010|| +* +---+ +* start_sec +*/ + start_sec = offset / secsz; + head = offset % secsz; + total_size = roundup2(head + bytes, secsz); + tail = total_size - (head + bytes); + do_tail_read = ((tail > 0) && (head + bytes > secsz)); + full_sec_size = total_size; + if (head > 0) + full_sec_size -= secsz; + if (do_tail_read) + full_sec_size -= secsz; - rb_buf = buf; - rb_size = bytes; - size = roundup2(bytes + remainder, secsz); - blksz = size; - if (remainder != 0 || size != bytes) { + /* Return of partial sector data requires a bounce buffer. */ + if ((head > 0) || do_tail_read) { bouncebuf = zfs_alloc(secsz); if (bouncebuf == NULL) { printf("vdev_read: out of memory\n"); return (ENOMEM); } - rb_buf = bouncebuf; - blksz = rb_size - remainder; } - while (bytes > 0) { - res = read(fd, rb_buf, rb_size); - if (res != rb_size) { + if (lseek(fd, start_sec * secsz, SEEK_SET) == -1) + return (errno); + + /* Partial data return from first sector */ + if (head > 0) { + res = read(fd, bouncebuf, secsz); + if (res != secsz) { ret = EIO; goto error; } - if (bytes < blksz) - blksz = bytes; - if (bouncebuf != NULL) - memcpy(buf, rb_buf + remainder, blksz); - buf = (void *)((uintptr_t)buf + blksz); - bytes -= blksz; - remainder = 0; - blksz = rb_size; + memcpy(outbuf, bouncebuf + head, secsz - head); + outbuf += secsz - head; + } + + /* Full data return from read sectors */ + if
svn commit: r344227 - head/stand/i386/zfsboot
Author: pkelsey Date: Sun Feb 17 03:52:44 2019 New Revision: 344227 URL: https://svnweb.freebsd.org/changeset/base/344227 Log: Remove whole-disk vdev support from zfsboot This is consistent with the removal of whole-disk vdev support from libsa/zfs/zfs.c in r342151, and is part way to having the LBAs read during probe be fully constrained by partition tables when present. Reviewed by: tsoome MFC after:3 months Differential Revision:https://reviews.freebsd.org/D19142 Modified: head/stand/i386/zfsboot/zfsboot.c Modified: head/stand/i386/zfsboot/zfsboot.c == --- head/stand/i386/zfsboot/zfsboot.c Sun Feb 17 03:35:15 2019 (r344226) +++ head/stand/i386/zfsboot/zfsboot.c Sun Feb 17 03:52:44 2019 (r344227) @@ -545,32 +545,19 @@ probe_drive(struct zfsdsk *zdsk) char *sec; unsigned i; -/* - * If we find a vdev on the whole disk, stop here. - */ -if (vdev_probe(vdev_read2, zdsk, NULL) == 0) - return; - #ifdef LOADER_GELI_SUPPORT /* - * Taste the disk, if it is GELI encrypted, decrypt it and check to see if - * it is a usable vdev then. Otherwise dig - * out the partition table and probe each slice/partition - * in turn for a vdev or GELI encrypted vdev. + * Taste the disk, if it is GELI encrypted, decrypt it then dig out the + * partition table and probe each slice/partition in turn for a vdev or + * GELI encrypted vdev. */ elba = drvsize_ext(zdsk); if (elba > 0) { elba--; } zdsk->gdev = geli_taste(vdev_read, zdsk, elba, "disk%u:0:"); -if (zdsk->gdev != NULL) { - if (geli_havekey(zdsk->gdev) == 0 || - geli_passphrase(zdsk->gdev, gelipw) == 0) { - if (vdev_probe(vdev_read2, zdsk, NULL) == 0) { - return; - } - } -} +if ((zdsk->gdev != NULL) && (geli_havekey(zdsk->gdev) == 0)) + geli_passphrase(zdsk->gdev, gelipw); #endif /* LOADER_GELI_SUPPORT */ sec = dmadat->secbuf; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344025 - head/sbin/pfctl
Author: pkelsey Date: Mon Feb 11 22:58:43 2019 New Revision: 344025 URL: https://svnweb.freebsd.org/changeset/base/344025 Log: Fix the fix added in r343287 for spurious HFSC bandwidth check errors The logic added in r343287 to avoid false-positive sum-of-child-bandwidth check errors for HFSC queues has a bug in it that causes the upperlimit service curve of an HFSC queue to be pulled down to its parent's linkshare service curve if it happens to be above it. Upon further inspection/reflection, this generic sum-of-child-bandwidths check does not need to be fixed for HFSC - it needs to be skipped. For HFSC, the equivalent check is to ensure the sum of child linkshare service curves are at or below the parent's linkshare service curve, and this check is already being performed by eval_pfqueue_hfsc(). This commit reverts the affected parts of r343287 and adds new logic to skip the generic sum-of-child-bandwidths check for HFSC. MFC after:1 day Sponsored by: RG Nets Differential Revision:https://reviews.freebsd.org/D19124 Modified: head/sbin/pfctl/pfctl_altq.c Modified: head/sbin/pfctl/pfctl_altq.c == --- head/sbin/pfctl/pfctl_altq.cMon Feb 11 22:09:26 2019 (r344024) +++ head/sbin/pfctl/pfctl_altq.cMon Feb 11 22:58:43 2019 (r344025) @@ -429,34 +429,25 @@ eval_pfqueue(struct pfctl *pf, struct pf_altq *pa, str if (pa->qlimit == 0) pa->qlimit = DEFAULT_QLIMIT; - if (eval_queue_opts(pa, opts, - parent == NULL ? pa->ifbandwidth : parent->pa.bandwidth)) - return (1); - if (pa->scheduler == ALTQT_CBQ || pa->scheduler == ALTQT_HFSC || pa->scheduler == ALTQT_FAIRQ) { pa->bandwidth = eval_bwspec(bw, parent == NULL ? pa->ifbandwidth : parent->pa.bandwidth); - /* -* For HFSC, if the linkshare service curve m2 parameter is -* set, it overrides the provided queue bandwidth parameter, -* so adjust the queue bandwidth parameter accordingly here -* to avoid false positives in the total child bandwidth -* check below. -*/ - if ((pa->scheduler == ALTQT_HFSC) && - (pa->pq_u.hfsc_opts.lssc_m2 != 0)) { - pa->bandwidth = pa->pq_u.hfsc_opts.lssc_m2; - } - if (pa->bandwidth > pa->ifbandwidth) { fprintf(stderr, "bandwidth for %s higher than " "interface\n", pa->qname); return (1); } - /* check the sum of the child bandwidth is under parent's */ - if (parent != NULL) { + /* +* If not HFSC, then check that the sum of the child +* bandwidths is less than the parent's bandwidth. For +* HFSC, the equivalent concept is to check that the sum of +* the child linkshare service curves are under the parent's +* linkshare service curve, and that check is performed by +* eval_pfqueue_hfsc(). +*/ + if ((parent != NULL) && (pa->scheduler != ALTQT_HFSC)) { if (pa->bandwidth > parent->pa.bandwidth) { warnx("bandwidth for %s higher than parent", pa->qname); @@ -471,6 +462,10 @@ eval_pfqueue(struct pfctl *pf, struct pf_altq *pa, str } } } + + if (eval_queue_opts(pa, opts, + parent == NULL ? pa->ifbandwidth : parent->pa.bandwidth)) + return (1); if (parent != NULL) parent->meta.children++; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343996 - head/sys/netpfil/pf
Author: pkelsey Date: Mon Feb 11 05:39:38 2019 New Revision: 343996 URL: https://svnweb.freebsd.org/changeset/base/343996 Log: Place pf_altq_get_nth_active() under the ALTQ ifdef MFC after:1 week Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c == --- head/sys/netpfil/pf/pf_ioctl.c Mon Feb 11 05:17:31 2019 (r343995) +++ head/sys/netpfil/pf/pf_ioctl.c Mon Feb 11 05:39:38 2019 (r343996) @@ -1360,7 +1360,6 @@ pf_import_kaltq(struct pfioc_altq_v1 *pa, struct pf_al return (0); } -#endif /* ALTQ */ static struct pf_altq * pf_altq_get_nth_active(u_int32_t n) @@ -1383,6 +1382,7 @@ pf_altq_get_nth_active(u_int32_t n) return (NULL); } +#endif /* ALTQ */ static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343995 - in head/sys: net net/altq netpfil/pf
Author: pkelsey Date: Mon Feb 11 05:17:31 2019 New Revision: 343995 URL: https://svnweb.freebsd.org/changeset/base/343995 Log: Reduce the time it takes the kernel to install a new PF config containing a large number of queues In general, the time savings come from separating the active and inactive queues lists into separate interface and non-interface queue lists, and changing the rule and queue tag management from list-based to hash-bashed. In HFSC, a linear scan of the class table during each queue destroy was also eliminated. There are now two new tunables to control the hash size used for each tag set (default for each is 128): net.pf.queue_tag_hashsize net.pf.rule_tag_hashsize Reviewed by: kp MFC after:1 week Sponsored by: RG Nets Differential Revision:https://reviews.freebsd.org/D19131 Modified: head/sys/net/altq/altq_cbq.c head/sys/net/altq/altq_codel.c head/sys/net/altq/altq_fairq.c head/sys/net/altq/altq_hfsc.c head/sys/net/altq/altq_hfsc.h head/sys/net/altq/altq_priq.c head/sys/net/altq/altq_subr.c head/sys/net/altq/altq_var.h head/sys/net/pfvar.h head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/net/altq/altq_cbq.c == --- head/sys/net/altq/altq_cbq.cMon Feb 11 04:00:42 2019 (r343994) +++ head/sys/net/altq/altq_cbq.cMon Feb 11 05:17:31 2019 (r343995) @@ -223,12 +223,11 @@ cbq_pfattach(struct pf_altq *a) } int -cbq_add_altq(struct pf_altq *a) +cbq_add_altq(struct ifnet *ifp, struct pf_altq *a) { cbq_state_t *cbqp; - struct ifnet*ifp; - if ((ifp = ifunit(a->ifname)) == NULL) + if (ifp == NULL) return (EINVAL); if (!ALTQ_IS_READY(>if_snd)) return (ENODEV); Modified: head/sys/net/altq/altq_codel.c == --- head/sys/net/altq/altq_codel.c Mon Feb 11 04:00:42 2019 (r343994) +++ head/sys/net/altq/altq_codel.c Mon Feb 11 05:17:31 2019 (r343995) @@ -89,13 +89,12 @@ codel_pfattach(struct pf_altq *a) } int -codel_add_altq(struct pf_altq *a) +codel_add_altq(struct ifnet *ifp, struct pf_altq *a) { struct codel_if *cif; - struct ifnet*ifp; struct codel_opts *opts; - if ((ifp = ifunit(a->ifname)) == NULL) + if (ifp == NULL) return (EINVAL); if (!ALTQ_IS_READY(>if_snd)) return (ENODEV); Modified: head/sys/net/altq/altq_fairq.c == --- head/sys/net/altq/altq_fairq.c Mon Feb 11 04:00:42 2019 (r343994) +++ head/sys/net/altq/altq_fairq.c Mon Feb 11 05:17:31 2019 (r343995) @@ -148,12 +148,11 @@ fairq_pfattach(struct pf_altq *a) } int -fairq_add_altq(struct pf_altq *a) +fairq_add_altq(struct ifnet *ifp, struct pf_altq *a) { struct fairq_if *pif; - struct ifnet *ifp; - if ((ifp = ifunit(a->ifname)) == NULL) + if (ifp == NULL) return (EINVAL); if (!ALTQ_IS_READY(>if_snd)) return (ENODEV); Modified: head/sys/net/altq/altq_hfsc.c == --- head/sys/net/altq/altq_hfsc.c Mon Feb 11 04:00:42 2019 (r343994) +++ head/sys/net/altq/altq_hfsc.c Mon Feb 11 05:17:31 2019 (r343995) @@ -159,12 +159,11 @@ hfsc_pfattach(struct pf_altq *a) } int -hfsc_add_altq(struct pf_altq *a) +hfsc_add_altq(struct ifnet *ifp, struct pf_altq *a) { struct hfsc_if *hif; - struct ifnet *ifp; - if ((ifp = ifunit(a->ifname)) == NULL) + if (ifp == NULL) return (EINVAL); if (!ALTQ_IS_READY(>if_snd)) return (ENODEV); @@ -506,6 +505,7 @@ hfsc_class_create(struct hfsc_if *hif, struct service_ goto err_ret; } } + cl->cl_slot = i; if (flags & HFCF_DEFAULTCLASS) hif->hif_defaultclass = cl; @@ -558,7 +558,7 @@ hfsc_class_create(struct hfsc_if *hif, struct service_ static int hfsc_class_destroy(struct hfsc_class *cl) { - int i, s; + int s; if (cl == NULL) return (0); @@ -589,12 +589,7 @@ hfsc_class_destroy(struct hfsc_class *cl) ASSERT(p != NULL); } - for (i = 0; i < HFSC_MAX_CLASSES; i++) - if (cl->cl_hif->hif_class_tbl[i] == cl) { - cl->cl_hif->hif_class_tbl[i] = NULL; - break; - } - + cl->cl_hif->hif_class_tbl[cl->cl_slot] = NULL; cl->cl_hif->hif_classes--; IFQ_UNLOCK(cl->cl_hif->hif_ifq); splx(s); Modified: head/sys/net/altq/altq_hfsc.h
svn commit: r343919 - head/sys/dev/e1000
Author: pkelsey Date: Fri Feb 8 20:34:47 2019 New Revision: 343919 URL: https://svnweb.freebsd.org/changeset/base/343919 Log: Fix em(4) interrupt routing When configured with more tx queues than rx queues, em_if_msix_intr_assign() was incorrectly routing the tx event interrupts. Reviewed by: erj, marius MFC after:1 week Differential Revision:https://reviews.freebsd.org/D19070 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Fri Feb 8 19:19:31 2019(r343918) +++ head/sys/dev/e1000/if_em.c Fri Feb 8 20:34:47 2019(r343919) @@ -1996,7 +1996,7 @@ em_if_msix_intr_assign(if_ctx_t ctx, int msix) >rx_queues[i % adapter->rx_num_queues].que_irq, IFLIB_INTR_TX, tx_que, tx_que->me, buf); - tx_que->msix = (vector % adapter->tx_num_queues); + tx_que->msix = (vector % adapter->rx_num_queues); /* * Set the bit to enable interrupt @@ -2009,9 +2009,9 @@ em_if_msix_intr_assign(if_ctx_t ctx, int msix) adapter->ims |= tx_que->eims; adapter->ivars |= (8 | tx_que->msix) << (8 + (i * 4)); } else if (adapter->hw.mac.type == e1000_82575) { - tx_que->eims = E1000_EICR_TX_QUEUE0 << (i % adapter->tx_num_queues); + tx_que->eims = E1000_EICR_TX_QUEUE0 << i; } else { - tx_que->eims = 1 << (i % adapter->tx_num_queues); + tx_que->eims = 1 << i; } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343688 - head/sys/dev/vmware/vmxnet3
On Sat, Feb 2, 2019 at 7:27 PM Enji Cooper wrote: > Hi Patrick, > > On Feb 2, 2019, at 13:14, Patrick Kelsey wrote: > > Author: pkelsey > Date: Sat Feb 2 21:14:53 2019 > New Revision: 343688 > URL: https://svnweb.freebsd.org/changeset/base/343688 > > Log: > Fix interrupt index configuratoin when using MSI interrupts. > > When in MSI mode, the device was only being configured with one > interrupt index, but it needs two - one for the actual interrupt and > one to park the tx queue at. > > Also clarified comments relating to interrupt index assignment. > > Reported by:Yuri Pankov > MFC after:1 day > > > Does this change partly fix > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203874 ? > No, this fixes the behavior of the iflib version of the vmx(4) driver when that bug causes its interrupt configuration code to fall into the MSI path (because MSI-X has been blacklisted). -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343291 - in head/sys: dev/vmware/vmxnet3 net
On Sat, Feb 2, 2019 at 3:29 PM Patrick Kelsey wrote: > > > On Sat, Feb 2, 2019 at 9:28 AM Yuri Pankov wrote: > >> Patrick Kelsey wrote: >> > Author: pkelsey >> > Date: Tue Jan 22 01:11:17 2019 >> > New Revision: 343291 >> > URL: https://svnweb.freebsd.org/changeset/base/343291 >> > >> > Log: >> > onvert vmx(4) to being an iflib driver. >> > >> > Also, expose IFLIB_MAX_RX_SEGS to iflib drivers and add >> > iflib_dma_alloc_align() to the iflib API. >> > >> > Performance is generally better with the tunable/sysctl >> > dev.vmx..iflib.tx_abdicate=1. >> > >> > Reviewed by:shurd >> > MFC after: 1 week >> > Relnotes: yes >> > Sponsored by: RG Nets >> > Differential Revision: https://reviews.freebsd.org/D18761 >> >> This breaks vmx interfaces for me in ESXi 6.7 (output below). The >> review mentions setting hw.pci.honor_msi_blacklist="0" and it helps >> indeed -- worth mentioning in UPDATING? >> >> vmx0: port 0x3000-0x300f mem >> 0xfe903000-0xfe903fff,0xfe902000-0xfe902fff,0xfe90-0xfe901fff at >> device 0.0 on pci3 >> vmx0: Using 512 tx descriptors and 256 rx descriptors >> vmx0: msix_init qsets capped at 8 >> vmx0: intr CPUs: 20 queue msgs: 24 admincnt: 1 >> vmx0: Using 8 rx queues 8 tx queues >> vmx0: attempting to allocate 9 MSI-X vectors (25 supported) >> vmx0: failed to allocate 9 MSI-X vectors, err: 6 - using MSI >> vmx0: attempting to allocate 1 MSI vectors (1 supported) >> msi: routing MSI IRQ 25 to local APIC 6 vector 48 >> vmx0: using IRQ 25 for MSI >> vmx0: Using an MSI interrupt >> msi: Assigning MSI IRQ 25 to local APIC 25 vector 48 >> msi: Assigning MSI IRQ 25 to local APIC 24 vector 48 >> vmx0: bpf attached >> vmx0: Ethernet address: 00:00:00:00:00:33 >> vmx0: netmap queues/slots: TX 1/512, RX 1/512 >> vmx0: device enable command failed! >> vmx0: link state changed to UP >> vmx0: device enable command failed! >> >> > Setting hw.pci.honor_msi_blacklist="0" should only be necessary if you > want to operate with more than one queue. If > hw.pci.honor_msi_blacklist="0" is not set, then MSI-X will not be > available, and MSI will be used, which reduces the number of queues that > can be configured for use to 1. This case should work correctly. > > I am able to reproduce the behavior you described above on ESXi 6.7 using > the latest snapshot release (based on r343598). The error that appears in > the ESXi logs will be similar to: > > 2019-02-02T15:14:02.986Z| vcpu-1| I125: VMXNET3 user: failed to activate > 'Ethernet0', status: 0xbad0001 > > which vaguely means 'the device did not like something about the > configuration it was given'. I will see if I can determine the root > cause. Given that enabling MSI-X seems to work around the problem, and > based on other issues I encountered during development, I currently suspect > there is a problem with the interrupt index that is being configured for > the transmit queue in the device configuration structure when using MSI. > > Indeed, the interrupt index for the tx queue in MSI mode was the problem. This is now fixed in r343688 ( https://svnweb.freebsd.org/changeset/base/343688). Thanks for reporting the issue! -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343688 - head/sys/dev/vmware/vmxnet3
Author: pkelsey Date: Sat Feb 2 21:14:53 2019 New Revision: 343688 URL: https://svnweb.freebsd.org/changeset/base/343688 Log: Fix interrupt index configuratoin when using MSI interrupts. When in MSI mode, the device was only being configured with one interrupt index, but it needs two - one for the actual interrupt and one to park the tx queue at. Also clarified comments relating to interrupt index assignment. Reported by: Yuri Pankov MFC after:1 day Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cSat Feb 2 17:42:17 2019 (r343687) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cSat Feb 2 21:14:53 2019 (r343688) @@ -676,14 +676,16 @@ vmxnet3_set_interrupt_idx(struct vmxnet3_softc *sc) scctx = sc->vmx_scctx; /* -* There is either one interrupt, or there is one interrupt per -* receive queue. If there is one interrupt, then all interrupt -* indexes are zero. If there is one interrupt per receive queue, -* the transmit queue interrupt indexes are assigned the receive -* queue interrupt indexesin round-robin fashion. -* -* The event interrupt is always the last interrupt index. +* There is always one interrupt per receive queue, assigned +* starting with the first interrupt. When there is only one +* interrupt available, the event interrupt shares the receive queue +* interrupt, otherwise it uses the interrupt following the last +* receive queue interrupt. Transmit queues are not assigned +* interrupts, so they are given indexes beyond the indexes that +* correspond to the real interrupts. */ + + /* The event interrupt is always the last vector. */ sc->vmx_event_intr_idx = scctx->isc_vectors - 1; intr_idx = 0; @@ -1073,14 +1075,14 @@ vmxnet3_init_shared_data(struct vmxnet3_softc *sc) ds->automask = sc->vmx_intr_mask_mode == VMXNET3_IMM_AUTO; /* * Total number of interrupt indexes we are using in the shared -* config data, even though we don't actually allocate MSI-X +* config data, even though we don't actually allocate interrupt * resources for the tx queues. Some versions of the device will * fail to initialize successfully if interrupt indexes are used in * the shared config that exceed the number of interrupts configured * here. */ ds->nintr = (scctx->isc_vectors == 1) ? - 1 : (scctx->isc_nrxqsets + scctx->isc_ntxqsets + 1); + 2 : (scctx->isc_nrxqsets + scctx->isc_ntxqsets + 1); ds->evintr = sc->vmx_event_intr_idx; ds->ictrl = VMXNET3_ICTRL_DISABLE_ALL; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343291 - in head/sys: dev/vmware/vmxnet3 net
On Sat, Feb 2, 2019 at 9:28 AM Yuri Pankov wrote: > Patrick Kelsey wrote: > > Author: pkelsey > > Date: Tue Jan 22 01:11:17 2019 > > New Revision: 343291 > > URL: https://svnweb.freebsd.org/changeset/base/343291 > > > > Log: > > onvert vmx(4) to being an iflib driver. > > > > Also, expose IFLIB_MAX_RX_SEGS to iflib drivers and add > > iflib_dma_alloc_align() to the iflib API. > > > > Performance is generally better with the tunable/sysctl > > dev.vmx..iflib.tx_abdicate=1. > > > > Reviewed by:shurd > > MFC after: 1 week > > Relnotes: yes > > Sponsored by: RG Nets > > Differential Revision: https://reviews.freebsd.org/D18761 > > This breaks vmx interfaces for me in ESXi 6.7 (output below). The > review mentions setting hw.pci.honor_msi_blacklist="0" and it helps > indeed -- worth mentioning in UPDATING? > > vmx0: port 0x3000-0x300f mem > 0xfe903000-0xfe903fff,0xfe902000-0xfe902fff,0xfe90-0xfe901fff at > device 0.0 on pci3 > vmx0: Using 512 tx descriptors and 256 rx descriptors > vmx0: msix_init qsets capped at 8 > vmx0: intr CPUs: 20 queue msgs: 24 admincnt: 1 > vmx0: Using 8 rx queues 8 tx queues > vmx0: attempting to allocate 9 MSI-X vectors (25 supported) > vmx0: failed to allocate 9 MSI-X vectors, err: 6 - using MSI > vmx0: attempting to allocate 1 MSI vectors (1 supported) > msi: routing MSI IRQ 25 to local APIC 6 vector 48 > vmx0: using IRQ 25 for MSI > vmx0: Using an MSI interrupt > msi: Assigning MSI IRQ 25 to local APIC 25 vector 48 > msi: Assigning MSI IRQ 25 to local APIC 24 vector 48 > vmx0: bpf attached > vmx0: Ethernet address: 00:00:00:00:00:33 > vmx0: netmap queues/slots: TX 1/512, RX 1/512 > vmx0: device enable command failed! > vmx0: link state changed to UP > vmx0: device enable command failed! > > Setting hw.pci.honor_msi_blacklist="0" should only be necessary if you want to operate with more than one queue. If hw.pci.honor_msi_blacklist="0" is not set, then MSI-X will not be available, and MSI will be used, which reduces the number of queues that can be configured for use to 1. This case should work correctly. I am able to reproduce the behavior you described above on ESXi 6.7 using the latest snapshot release (based on r343598). The error that appears in the ESXi logs will be similar to: 2019-02-02T15:14:02.986Z| vcpu-1| I125: VMXNET3 user: failed to activate 'Ethernet0', status: 0xbad0001 which vaguely means 'the device did not like something about the configuration it was given'. I will see if I can determine the root cause. Given that enabling MSI-X seems to work around the problem, and based on other issues I encountered during development, I currently suspect there is a problem with the interrupt index that is being configured for the transmit queue in the device configuration structure when using MSI. -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343535 - head/sbin/ifconfig
Author: pkelsey Date: Mon Jan 28 20:30:04 2019 New Revision: 343535 URL: https://svnweb.freebsd.org/changeset/base/343535 Log: Speed up non-status operations applied to a single interface When performing a non-status operation on a single interface, it is not necessary for ifconfig to build a list of all addresses in the system, sort them, then iterate through them looking for the entry for the single interface of interest. Doing so becomes increasingly expensive as the number of interfaces in the system grows (e.g., in a system with 1000+ vlan(4) interfaces). Reviewed by: ae, kp MFC after:1 week Sponsored by: RG Nets Differential Revision:https://reviews.freebsd.org/D18919 Modified: head/sbin/ifconfig/ifconfig.c Modified: head/sbin/ifconfig/ifconfig.c == --- head/sbin/ifconfig/ifconfig.c Mon Jan 28 20:26:09 2019 (r343534) +++ head/sbin/ifconfig/ifconfig.c Mon Jan 28 20:30:04 2019 (r343535) @@ -111,6 +111,8 @@ static void status(const struct afswtch *afp, const st static void tunnel_status(int s); static _Noreturn void usage(void); +static int getifflags(const char *ifname, int us); + static struct afswtch *af_getbyname(const char *name); static struct afswtch *af_getbyfamily(int af); static void af_other_status(int); @@ -369,6 +371,7 @@ main(int argc, char *argv[]) const char *ifname; struct option *p; size_t iflen; + int flags; all = downonly = uponly = namesonly = noload = verbose = 0; f_inet = f_inet6 = f_ether = f_addr = NULL; @@ -526,6 +529,25 @@ main(int argc, char *argv[]) argc--, argv++; } + /* +* Check for a requested configuration action on a single interface, +* which doesn't require building, sorting, and searching the entire +* system address list +*/ + if ((argc > 0) && (ifname != NULL)) { + iflen = strlcpy(name, ifname, sizeof(name)); + if (iflen >= sizeof(name)) { + warnx("%s: interface name too long, skipping", ifname); + } else { + flags = getifflags(name, -1); + if (!(((flags & IFF_CANTCONFIG) != 0) || + (downonly && (flags & IFF_UP) != 0) || + (uponly && (flags & IFF_UP) == 0))) + ifconfig(argc, argv, 0, afp); + } + goto done; + } + if (getifaddrs() != 0) err(EXIT_FAILURE, "getifaddrs"); @@ -609,6 +631,7 @@ main(int argc, char *argv[]) printf("\n"); freeifaddrs(ifap); +done: freeformat(); exit(exit_code); } @@ -1020,6 +1043,28 @@ setifdstaddr(const char *addr, int param __unused, int afp->af_getaddr(addr, DSTADDR); } +static int +getifflags(const char *ifname, int us) +{ + struct ifreq my_ifr; + int s; + + memset(_ifr, 0, sizeof(my_ifr)); + (void) strlcpy(my_ifr.ifr_name, ifname, sizeof(my_ifr.ifr_name)); + if (us < 0) { + if ((s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0) + err(1, "socket(family AF_LOCAL,SOCK_DGRAM"); + } else + s = us; + if (ioctl(s, SIOCGIFFLAGS, (caddr_t)_ifr) < 0) { + Perror("ioctl (SIOCGIFFLAGS)"); + exit(1); + } + if (us < 0) + close(s); + return ((my_ifr.ifr_flags & 0x) | (my_ifr.ifr_flagshigh << 16)); +} + /* * Note: doing an SIOCIGIFFLAGS scribbles on the union portion * of the ifreq structure, which may confuse other parts of ifconfig. @@ -1031,20 +1076,14 @@ setifflags(const char *vname, int value, int s, const struct ifreqmy_ifr; int flags; - memset(_ifr, 0, sizeof(my_ifr)); - (void) strlcpy(my_ifr.ifr_name, name, sizeof(my_ifr.ifr_name)); - - if (ioctl(s, SIOCGIFFLAGS, (caddr_t)_ifr) < 0) { - Perror("ioctl (SIOCGIFFLAGS)"); - exit(1); - } - flags = (my_ifr.ifr_flags & 0x) | (my_ifr.ifr_flagshigh << 16); - + flags = getifflags(name, s); if (value < 0) { value = -value; flags &= ~value; } else flags |= value; + memset(_ifr, 0, sizeof(my_ifr)); + (void) strlcpy(my_ifr.ifr_name, name, sizeof(my_ifr.ifr_name)); my_ifr.ifr_flags = flags & 0x; my_ifr.ifr_flagshigh = flags >> 16; if (ioctl(s, SIOCSIFFLAGS, (caddr_t)_ifr) < 0) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343534 - head/sys/netpfil/pf
Author: pkelsey Date: Mon Jan 28 20:26:09 2019 New Revision: 343534 URL: https://svnweb.freebsd.org/changeset/base/343534 Log: Don't re-evaluate ALTQ kernel configuration due to events on non-ALTQ interfaces Re-evaluating the ALTQ kernel configuration can be expensive, particularly when there are a large number (hundreds or thousands) of queues, and is wholly unnecessary in response to events on interfaces that do not support ALTQ as such interfaces cannot be part of an ALTQ configuration. Reviewed by: kp MFC after:1 week Sponsored by: RG Nets Differential Revision:https://reviews.freebsd.org/D18918 Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c == --- head/sys/netpfil/pf/pf_ioctl.c Mon Jan 28 20:22:17 2019 (r343533) +++ head/sys/netpfil/pf/pf_ioctl.c Mon Jan 28 20:26:09 2019 (r343534) @@ -683,6 +683,14 @@ pf_altq_ifnet_event(struct ifnet *ifp, int remove) u_int32_tticket; int error = 0; + /* +* No need to re-evaluate the configuration for events on interfaces +* that do not support ALTQ, as it's not possible for such +* interfaces to be part of the configuration. +*/ + if (!ALTQ_IS_READY(>if_snd)) + return; + /* Interrupt userland queue modifications */ if (V_altqs_inactive_open) pf_rollback_altq(V_ticket_altqs_inactive); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343301 - head/sys/modules/vmware/vmxnet3
Author: pkelsey Date: Tue Jan 22 04:36:19 2019 New Revision: 343301 URL: https://svnweb.freebsd.org/changeset/base/343301 Log: Add missing dependency to vmxnet3 Makefile and clean it up a bit otherwise. MFC after:1 week Modified: head/sys/modules/vmware/vmxnet3/Makefile Modified: head/sys/modules/vmware/vmxnet3/Makefile == --- head/sys/modules/vmware/vmxnet3/MakefileTue Jan 22 04:20:52 2019 (r343300) +++ head/sys/modules/vmware/vmxnet3/MakefileTue Jan 22 04:36:19 2019 (r343301) @@ -27,10 +27,7 @@ KMOD= if_vmx SRCS= if_vmx.c -SRCS+= bus_if.h device_if.h pci_if.h opt_inet.h opt_inet6.h - -# With VMXNET3_LEGACY_TX, the driver will use the non-multiqueue -# capable if_start interface. -#CFLAGS+= -DVMXNET3_LEGACY_TX +SRCS+= bus_if.h device_if.h pci_if.h ifdi_if.h +SRCS+= opt_inet.h opt_inet6.h .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343296 - head/sbin/pfctl
Author: pkelsey Date: Tue Jan 22 02:53:59 2019 New Revision: 343296 URL: https://svnweb.freebsd.org/changeset/base/343296 Log: Remove unused function gsc_destroy() gsc_destroy() is no longer needed as of r343287. MFC after:1 week Modified: head/sbin/pfctl/pfctl_altq.c Modified: head/sbin/pfctl/pfctl_altq.c == --- head/sbin/pfctl/pfctl_altq.cTue Jan 22 02:13:33 2019 (r343295) +++ head/sbin/pfctl/pfctl_altq.cTue Jan 22 02:53:59 2019 (r343296) @@ -93,7 +93,6 @@ static intcheck_commit_fairq(int, int, struct pfctl_a static void gsc_add_sc(struct gen_sc *, struct service_curve *); static int is_gsc_under_sc(struct gen_sc *, struct service_curve *); -static void gsc_destroy(struct gen_sc *); static struct segment *gsc_getentry(struct gen_sc *, double); static int gsc_add_seg(struct gen_sc *, double, double, double, double); @@ -1127,17 +1126,6 @@ is_gsc_under_sc(struct gen_sc *gsc, struct service_cur return (0); } return (1); -} - -static void -gsc_destroy(struct gen_sc *gsc) -{ - struct segment *s; - - while ((s = LIST_FIRST(gsc)) != NULL) { - LIST_REMOVE(s, _next); - free(s); - } } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343291 - in head/sys: dev/vmware/vmxnet3 net
Author: pkelsey Date: Tue Jan 22 01:11:17 2019 New Revision: 343291 URL: https://svnweb.freebsd.org/changeset/base/343291 Log: onvert vmx(4) to being an iflib driver. Also, expose IFLIB_MAX_RX_SEGS to iflib drivers and add iflib_dma_alloc_align() to the iflib API. Performance is generally better with the tunable/sysctl dev.vmx..iflib.tx_abdicate=1. Reviewed by: shurd MFC after:1 week Relnotes: yes Sponsored by: RG Nets Differential Revision:https://reviews.freebsd.org/D18761 Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c head/sys/dev/vmware/vmxnet3/if_vmxvar.h head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cTue Jan 22 01:07:20 2019 (r343290) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cTue Jan 22 01:11:17 2019 (r343291) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2013 Tsubai Masanari * Copyright (c) 2013 Bryan Venteicher + * Copyright (c) 2018 Patrick Kelsey * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -24,7 +25,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -46,9 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include -#include - #include #include #include @@ -57,8 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include #include @@ -67,139 +63,95 @@ __FBSDID("$FreeBSD$"); #include #include +#include "ifdi_if.h" + #include "if_vmxreg.h" #include "if_vmxvar.h" #include "opt_inet.h" #include "opt_inet6.h" -#ifdef VMXNET3_FAILPOINTS -#include -static SYSCTL_NODE(DEBUG_FP, OID_AUTO, vmxnet3, CTLFLAG_RW, 0, -"vmxnet3 fail points"); -#define VMXNET3_FP _debug_fail_point_vmxnet3 -#endif -static int vmxnet3_probe(device_t); -static int vmxnet3_attach(device_t); -static int vmxnet3_detach(device_t); -static int vmxnet3_shutdown(device_t); +#define VMXNET3_VMWARE_VENDOR_ID 0x15AD +#define VMXNET3_VMWARE_DEVICE_ID 0x07B0 +static pci_vendor_info_t vmxnet3_vendor_info_array[] = +{ + PVID(VMXNET3_VMWARE_VENDOR_ID, VMXNET3_VMWARE_DEVICE_ID, "VMware VMXNET3 Ethernet Adapter"), + /* required last entry */ + PVID_END +}; + +static void*vmxnet3_register(device_t); +static int vmxnet3_attach_pre(if_ctx_t); +static int vmxnet3_msix_intr_assign(if_ctx_t, int); +static voidvmxnet3_free_irqs(struct vmxnet3_softc *); +static int vmxnet3_attach_post(if_ctx_t); +static int vmxnet3_detach(if_ctx_t); +static int vmxnet3_shutdown(if_ctx_t); +static int vmxnet3_suspend(if_ctx_t); +static int vmxnet3_resume(if_ctx_t); + static int vmxnet3_alloc_resources(struct vmxnet3_softc *); static voidvmxnet3_free_resources(struct vmxnet3_softc *); static int vmxnet3_check_version(struct vmxnet3_softc *); -static voidvmxnet3_initial_config(struct vmxnet3_softc *); -static voidvmxnet3_check_multiqueue(struct vmxnet3_softc *); +static voidvmxnet3_set_interrupt_idx(struct vmxnet3_softc *); -static int vmxnet3_alloc_msix_interrupts(struct vmxnet3_softc *); -static int vmxnet3_alloc_msi_interrupts(struct vmxnet3_softc *); -static int vmxnet3_alloc_legacy_interrupts(struct vmxnet3_softc *); -static int vmxnet3_alloc_interrupt(struct vmxnet3_softc *, int, int, - struct vmxnet3_interrupt *); -static int vmxnet3_alloc_intr_resources(struct vmxnet3_softc *); -static int vmxnet3_setup_msix_interrupts(struct vmxnet3_softc *); -static int vmxnet3_setup_legacy_interrupt(struct vmxnet3_softc *); -static int vmxnet3_setup_interrupts(struct vmxnet3_softc *); -static int vmxnet3_alloc_interrupts(struct vmxnet3_softc *); +static int vmxnet3_queues_shared_alloc(struct vmxnet3_softc *); +static voidvmxnet3_init_txq(struct vmxnet3_softc *, int); +static int vmxnet3_tx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int); +static voidvmxnet3_init_rxq(struct vmxnet3_softc *, int, int); +static int vmxnet3_rx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int); +static voidvmxnet3_queues_free(if_ctx_t); -static voidvmxnet3_free_interrupt(struct vmxnet3_softc *, - struct vmxnet3_interrupt *); -static voidvmxnet3_free_interrupts(struct vmxnet3_softc *); - -#ifndef VMXNET3_LEGACY_TX -static int vmxnet3_alloc_taskqueue(struct vmxnet3_softc *); -static voidvmxnet3_start_taskqueue(struct vmxnet3_softc *); -static voidvmxnet3_drain_
svn commit: r343288 - head/sys/net
Author: pkelsey Date: Tue Jan 22 00:56:44 2019 New Revision: 343288 URL: https://svnweb.freebsd.org/changeset/base/343288 Log: Fix various resource leaks that can occur in the error paths of iflib_device_register() and iflib_pseudo_register(). Reviewed by: shurd MFC after:1 week Sponsored by: RG Nets Differential Revision:https://reviews.freebsd.org/D18760 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cTue Jan 22 00:50:24 2019(r343287) +++ head/sys/net/iflib.cTue Jan 22 00:56:44 2019(r343288) @@ -4368,11 +4368,8 @@ iflib_device_register(device_t dev, void *sc, if_share ctx->ifc_softc = sc; if ((err = iflib_register(ctx)) != 0) { - if (ctx->ifc_flags & IFC_SC_ALLOCATED) - free(sc, M_IFLIB); - free(ctx, M_IFLIB); device_printf(dev, "iflib_register failed %d\n", err); - return (err); + goto fail_ctx_free; } iflib_add_device_sysctl_pre(ctx); @@ -4382,9 +4379,8 @@ iflib_device_register(device_t dev, void *sc, if_share iflib_reset_qvalues(ctx); 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); + goto fail_unlock; } _iflib_pre_assert(scctx); ctx->ifc_txrx = *scctx->isc_txrx; @@ -4414,7 +4410,7 @@ iflib_device_register(device_t dev, void *sc, if_share /* round down instead? */ device_printf(dev, "# rx descriptors must be a power of 2\n"); err = EINVAL; - goto fail; + goto fail_iflib_detach; } } for (i = 0; i < sctx->isc_ntxqs; i++) { @@ -4422,7 +4418,7 @@ iflib_device_register(device_t dev, void *sc, if_share device_printf(dev, "# tx descriptors must be a power of 2"); err = EINVAL; - goto fail; + goto fail_iflib_detach; } } @@ -4492,7 +4488,7 @@ iflib_device_register(device_t dev, void *sc, if_share /* Get memory for the station queues */ if ((err = iflib_queues_alloc(ctx))) { device_printf(dev, "Unable to allocate queue memory\n"); - goto fail; + goto fail_intr_free; } if ((err = iflib_qset_structures_setup(ctx))) @@ -4511,7 +4507,7 @@ iflib_device_register(device_t dev, void *sc, if_share IFDI_INTR_DISABLE(ctx); if (msix > 1 && (err = IFDI_MSIX_INTR_ASSIGN(ctx, msix)) != 0) { device_printf(dev, "IFDI_MSIX_INTR_ASSIGN failed %d\n", err); - goto fail_intr_free; + goto fail_queues; } if (msix <= 1) { rid = 0; @@ -4521,7 +4517,7 @@ iflib_device_register(device_t dev, void *sc, if_share } if ((err = iflib_legacy_setup(ctx, ctx->isc_legacy_intr, ctx->ifc_softc, , "irq0")) != 0) { device_printf(dev, "iflib_legacy_setup failed %d\n", err); - goto fail_intr_free; + goto fail_queues; } } @@ -4557,14 +4553,18 @@ iflib_device_register(device_t dev, void *sc, if_share fail_detach: ether_ifdetach(ctx->ifc_ifp); fail_intr_free: + iflib_free_intr_mem(ctx); fail_queues: iflib_tx_structures_free(ctx); iflib_rx_structures_free(ctx); -fail: - iflib_free_intr_mem(ctx); +fail_iflib_detach: IFDI_DETACH(ctx); +fail_unlock: CTX_UNLOCK(ctx); - +fail_ctx_free: +if (ctx->ifc_flags & IFC_SC_ALLOCATED) +free(ctx->ifc_softc, M_IFLIB); +free(ctx, M_IFLIB); return (err); } @@ -4593,9 +4593,7 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sc if ((err = iflib_register(ctx)) != 0) { device_printf(dev, "%s: iflib_register failed %d\n", __func__, err); - free(sc, M_IFLIB); - free(ctx, M_IFLIB); - return (err); + goto fail_ctx_free; } iflib_add_device_sysctl_pre(ctx); @@ -4609,14 +4607,14 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sc if ((err = IFDI_ATTACH_PRE(ctx)) != 0) { device_printf(dev, "IFDI_ATTACH_PRE failed %d\n", err); - return (err); + goto fail_ctx_free; } if (sctx->isc_flags & IFLIB_GEN_MAC) iflib_gen_mac(ctx); if ((err = IFDI_CLONEATTACH(ctx, clctx->cc_ifc, clctx->cc_name,
svn commit: r343287 - head/sbin/pfctl
Author: pkelsey Date: Tue Jan 22 00:50:24 2019 New Revision: 343287 URL: https://svnweb.freebsd.org/changeset/base/343287 Log: Reduce pf.conf parsing cost for configs that define N queues from O(N^2) to O(N) The number of syscalls made during parsing of any config that defines tables is also reduced, and incorrect warnings that HFSC parent queue bandwidths were smaller than the sum of their child bandwidths have been fixed. Reviewed by: kp MFC after:1 week Sponsored by: RG Nets Differential Revision:https://reviews.freebsd.org/D18759 Modified: head/sbin/pfctl/pfctl.h head/sbin/pfctl/pfctl_altq.c head/sbin/pfctl/pfctl_parser.c head/sbin/pfctl/pfctl_parser.h Modified: head/sbin/pfctl/pfctl.h == --- head/sbin/pfctl/pfctl.h Mon Jan 21 23:54:33 2019(r343286) +++ head/sbin/pfctl/pfctl.h Tue Jan 22 00:50:24 2019(r343287) @@ -114,7 +114,6 @@ extern int loadopt; int check_commit_altq(int, int); voidpfaltq_store(struct pf_altq *); -struct pf_altq *pfaltq_lookup(const char *); char *rate2str(double); voidprint_addr(struct pf_addr_wrap *, sa_family_t, int); Modified: head/sbin/pfctl/pfctl_altq.c == --- head/sbin/pfctl/pfctl_altq.cMon Jan 21 23:54:33 2019 (r343286) +++ head/sbin/pfctl/pfctl_altq.cTue Jan 22 00:50:24 2019 (r343287) @@ -24,6 +24,7 @@ __FBSDID("$FreeBSD$"); #define PFIOC_USE_LATEST #include +#include #include #include @@ -36,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -53,33 +55,40 @@ __FBSDID("$FreeBSD$"); #define is_sc_null(sc) (((sc) == NULL) || ((sc)->m1 == 0 && (sc)->m2 == 0)) -static TAILQ_HEAD(altqs, pf_altq) altqs = TAILQ_HEAD_INITIALIZER(altqs); -static LIST_HEAD(gen_sc, segment) rtsc, lssc; +static STAILQ_HEAD(interfaces, pfctl_altq) interfaces = STAILQ_HEAD_INITIALIZER(interfaces); +static struct hsearch_data queue_map; +static struct hsearch_data if_map; +static struct hsearch_data qid_map; -struct pf_altq *qname_to_pfaltq(const char *, const char *); -u_int32_t qname_to_qid(const char *); +static struct pfctl_altq *pfaltq_lookup(char *ifname); +static struct pfctl_altq *qname_to_pfaltq(const char *, const char *); +static u_int32_tqname_to_qid(char *); -static int eval_pfqueue_cbq(struct pfctl *, struct pf_altq *); +static int eval_pfqueue_cbq(struct pfctl *, struct pf_altq *, + struct pfctl_altq *); static int cbq_compute_idletime(struct pfctl *, struct pf_altq *); -static int check_commit_cbq(int, int, struct pf_altq *); +static int check_commit_cbq(int, int, struct pfctl_altq *); static int print_cbq_opts(const struct pf_altq *); static int print_codel_opts(const struct pf_altq *, const struct node_queue_opt *); -static int eval_pfqueue_priq(struct pfctl *, struct pf_altq *); -static int check_commit_priq(int, int, struct pf_altq *); +static int eval_pfqueue_priq(struct pfctl *, struct pf_altq *, + struct pfctl_altq *); +static int check_commit_priq(int, int, struct pfctl_altq *); static int print_priq_opts(const struct pf_altq *); -static int eval_pfqueue_hfsc(struct pfctl *, struct pf_altq *); -static int check_commit_hfsc(int, int, struct pf_altq *); +static int eval_pfqueue_hfsc(struct pfctl *, struct pf_altq *, + struct pfctl_altq *, struct pfctl_altq *); +static int check_commit_hfsc(int, int, struct pfctl_altq *); static int print_hfsc_opts(const struct pf_altq *, const struct node_queue_opt *); -static int eval_pfqueue_fairq(struct pfctl *, struct pf_altq *); +static int eval_pfqueue_fairq(struct pfctl *, struct pf_altq *, + struct pfctl_altq *, struct pfctl_altq *); static int print_fairq_opts(const struct pf_altq *, const struct node_queue_opt *); -static int check_commit_fairq(int, int, struct pf_altq *); +static int check_commit_fairq(int, int, struct pfctl_altq *); static void gsc_add_sc(struct gen_sc *, struct service_curve *); static int is_gsc_under_sc(struct gen_sc *, @@ -104,59 +113,101 @@ void print_hfsc_sc(const char *, u_int, u_int, u_int voidprint_fairq_sc(const char *, u_int, u_int, u_int, const struct node_fairq_sc *); +static __attribute__((constructor)) void +pfctl_altq_init(void) +{ + /* +* As hdestroy() will never be called on these tables, it will be +* safe to use references into the stored data as keys. +*/ + if (hcreate_r(0, _map) == 0) + err(1, "Failed to create altq queue map"); + if
Re: svn commit: r338253 - head/sbin/pfctl
Fixed in r338260. On Thu, Aug 23, 2018 at 1:30 PM Patrick Kelsey wrote: > > > On Thu, Aug 23, 2018 at 1:05 PM Stefan Esser wrote: > >> Am 23.08.18 um 18:10 schrieb Patrick Kelsey: >> > Author: pkelsey >> > Date: Thu Aug 23 16:10:28 2018 >> > New Revision: 338253 >> > URL: https://svnweb.freebsd.org/changeset/base/338253 >> > >> > Log: >> > Extend tbrsize heuristic in pfctl(8) to provide a sensible value for >> > higher bandwidth interfaces. The new value is used above 2.5 Gbps, >> > which is the highest standard rate that could be used prior to >> > r338209, so the default behavior for all existing systems should >> > remain the same. >> > >> > The value of 128 chosen is a balance between being big enough to >> > reduce potential precision/quantization effects stemming from frequent >> > bucket refills over small time intervals and being small enough to >> > prevent a greedy driver from burst dequeuing more packets than it has >> > available hardware ring slots for whenever altq transitions from idle >> > to backlogged. >> > >> > Reviewed by:jmallett, kp >> > MFC after: 2 weeks >> > Sponsored by: RG Nets >> > Differential Revision: https://reviews.freebsd.org/D16852 >> > >> > Modified: >> > head/sbin/pfctl/pfctl_altq.c >> > >> > Modified: head/sbin/pfctl/pfctl_altq.c >> > >> == >> > --- head/sbin/pfctl/pfctl_altq.c Thu Aug 23 15:01:27 2018 >> (r338252) >> > +++ head/sbin/pfctl/pfctl_altq.c Thu Aug 23 16:10:28 2018 >> (r338253) >> > @@ -299,8 +299,10 @@ eval_pfaltq(struct pfctl *pf, struct pf_altq *pa, >> stru >> > size = 4; >> > else if (rate <= 200 * 1000 * 1000) >> > size = 8; >> > - else >> > + else if (rate <= 2500 * 1000 * 1000) >> > size = 24; >> > + else >> > + size = 128; >> > size = size * getifmtu(pa->ifname); >> > pa->tbrsize = size; >> > } >> > >> >> This breaks the build on my amd64 box: >> >> /usr/svn/base/head/sbin/pfctl/pfctl_altq.c:302:32: error: overflow in >> expression; result is -1794967296 with type 'int' >> [-Werror,-Winteger-overflow] >> else if (rate <= 2500 * 1000 * 1000) >> ^ >> >> While "rate" is unsigned long, the expression being calculated is not ... >> >> Regards, STefan >> > > Will fix shortly...not sure why I did not encounter this error in my setup. > > -Patrick > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r338260 - head/sbin/pfctl
Author: pkelsey Date: Thu Aug 23 17:41:39 2018 New Revision: 338260 URL: https://svnweb.freebsd.org/changeset/base/338260 Log: Fix warning about crossing INT32_MAX boundary in computation of constant value. Modified: head/sbin/pfctl/pfctl_altq.c Modified: head/sbin/pfctl/pfctl_altq.c == --- head/sbin/pfctl/pfctl_altq.cThu Aug 23 17:27:02 2018 (r338259) +++ head/sbin/pfctl/pfctl_altq.cThu Aug 23 17:41:39 2018 (r338260) @@ -299,7 +299,7 @@ eval_pfaltq(struct pfctl *pf, struct pf_altq *pa, stru size = 4; else if (rate <= 200 * 1000 * 1000) size = 8; - else if (rate <= 2500 * 1000 * 1000) + else if (rate <= 2500 * 1000 * 1000ULL) size = 24; else size = 128; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r338253 - head/sbin/pfctl
On Thu, Aug 23, 2018 at 1:05 PM Stefan Esser wrote: > Am 23.08.18 um 18:10 schrieb Patrick Kelsey: > > Author: pkelsey > > Date: Thu Aug 23 16:10:28 2018 > > New Revision: 338253 > > URL: https://svnweb.freebsd.org/changeset/base/338253 > > > > Log: > > Extend tbrsize heuristic in pfctl(8) to provide a sensible value for > > higher bandwidth interfaces. The new value is used above 2.5 Gbps, > > which is the highest standard rate that could be used prior to > > r338209, so the default behavior for all existing systems should > > remain the same. > > > > The value of 128 chosen is a balance between being big enough to > > reduce potential precision/quantization effects stemming from frequent > > bucket refills over small time intervals and being small enough to > > prevent a greedy driver from burst dequeuing more packets than it has > > available hardware ring slots for whenever altq transitions from idle > > to backlogged. > > > > Reviewed by:jmallett, kp > > MFC after: 2 weeks > > Sponsored by: RG Nets > > Differential Revision: https://reviews.freebsd.org/D16852 > > > > Modified: > > head/sbin/pfctl/pfctl_altq.c > > > > Modified: head/sbin/pfctl/pfctl_altq.c > > > == > > --- head/sbin/pfctl/pfctl_altq.c Thu Aug 23 15:01:27 2018 > (r338252) > > +++ head/sbin/pfctl/pfctl_altq.c Thu Aug 23 16:10:28 2018 > (r338253) > > @@ -299,8 +299,10 @@ eval_pfaltq(struct pfctl *pf, struct pf_altq *pa, > stru > > size = 4; > > else if (rate <= 200 * 1000 * 1000) > > size = 8; > > - else > > + else if (rate <= 2500 * 1000 * 1000) > > size = 24; > > + else > > + size = 128; > > size = size * getifmtu(pa->ifname); > > pa->tbrsize = size; > > } > > > > This breaks the build on my amd64 box: > > /usr/svn/base/head/sbin/pfctl/pfctl_altq.c:302:32: error: overflow in > expression; result is -1794967296 with type 'int' > [-Werror,-Winteger-overflow] > else if (rate <= 2500 * 1000 * 1000) > ^ > > While "rate" is unsigned long, the expression being calculated is not ... > > Regards, STefan > Will fix shortly...not sure why I did not encounter this error in my setup. -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r338253 - head/sbin/pfctl
Author: pkelsey Date: Thu Aug 23 16:10:28 2018 New Revision: 338253 URL: https://svnweb.freebsd.org/changeset/base/338253 Log: Extend tbrsize heuristic in pfctl(8) to provide a sensible value for higher bandwidth interfaces. The new value is used above 2.5 Gbps, which is the highest standard rate that could be used prior to r338209, so the default behavior for all existing systems should remain the same. The value of 128 chosen is a balance between being big enough to reduce potential precision/quantization effects stemming from frequent bucket refills over small time intervals and being small enough to prevent a greedy driver from burst dequeuing more packets than it has available hardware ring slots for whenever altq transitions from idle to backlogged. Reviewed by: jmallett, kp MFC after:2 weeks Sponsored by: RG Nets Differential Revision: https://reviews.freebsd.org/D16852 Modified: head/sbin/pfctl/pfctl_altq.c Modified: head/sbin/pfctl/pfctl_altq.c == --- head/sbin/pfctl/pfctl_altq.cThu Aug 23 15:01:27 2018 (r338252) +++ head/sbin/pfctl/pfctl_altq.cThu Aug 23 16:10:28 2018 (r338253) @@ -299,8 +299,10 @@ eval_pfaltq(struct pfctl *pf, struct pf_altq *pa, stru size = 4; else if (rate <= 200 * 1000 * 1000) size = 8; - else + else if (rate <= 2500 * 1000 * 1000) size = 24; + else + size = 128; size = size * getifmtu(pa->ifname); pa->tbrsize = size; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r338209 - in head: sbin/ipfw sbin/pfctl sys/net sys/net/altq sys/netpfil/pf usr.sbin/bsnmpd/modules/snmp_pf
Gleb, Thanks for taking a look. I don't think there is all that much complication in the compatibility layer, and I think what is there is worth the properties it yields. The approach taken to backwards compatibility has a clear and regular structure, it allows out of tree consumers of the interface to be upgraded asynchronously to the evolution of the interface, it allows out of tree consumers to be written such that they can be successfully compiled against multiple versions of the interface (using #ifdef of the various structure version macros), it doesn't require constructing a FreeBSD version chart to figure out what each struct looks like and when, and it anticipates that additional revisions of interface data structures may be made at multiple unknown points in the future as other altq algorithms are upgraded to support higher bandwidths. There are at least two consumers in ports that use the altq portions of the pf ioctl interface - pftop and pfstat. These are both named in the review, having been found pretty easily by looking at the short list of ports with 'pf' in the name and doing a make extract and grep of the obvious potential users. I don't think taking a COMPAT_FREEBSDXX approach would have reduced the diff much or at all, and I think it would introduce breakage scenarios (that don't exist now) between ports/packages and stable branches if additional interface changes are made in the future. By having any sort of backwards compat, we are guaranteeing that all versions of these structures are supported by the kernel interface, so all the versions have to be present in headers somewhere. There is already pretty poor separation of public/private in the pf and altq headers, such that hiding prior versions of data structures in some of the headers consumed by userland programs won't really improve the situation (I have improved it a little bit by separating struct pf_altq into the user facing version and the kernel-internal version). Best, Patrick On Wed, Aug 22, 2018 at 5:40 PM Gleb Smirnoff wrote: > Patrick, > > thanks for the change. The compatibility layer seems overcomplicated > though. IMHO, it would be enough just to provide binary compatibility > keeping the old structure and ioctl number as compat, not declaring > them in public headers. And the compat layer should be embraced with > COMPAT_FREEBSD11. > > To estimate number of ports affected a exp-run can be requested. Might > happen there are very little or even none! > > On Wed, Aug 22, 2018 at 07:38:48PM +, Patrick Kelsey wrote: > P> Author: pkelsey > P> Date: Wed Aug 22 19:38:48 2018 > P> New Revision: 338209 > P> URL: https://svnweb.freebsd.org/changeset/base/338209 > P> > P> Log: > P> Extended pf(4) ioctl interface and pfctl(8) to allow bandwidths of > P> 2^32 bps or greater to be used. Prior to this, bandwidth parameters > P> would simply wrap at the 2^32 boundary. The computations in the HFSC > P> scheduler and token bucket regulator have been modified to operate > P> correctly up to at least 100 Gbps. No other algorithms have been > P> examined or modified for correct operation above 2^32 bps (some may > P> have existing computation resolution or overflow issues at rates below > P> that threshold). pfctl(8) will now limit non-HFSC bandwidth > P> parameters to 2^32 - 1 before passing them to the kernel. > P> > P> The extensions to the pf(4) ioctl interface have been made in a > P> backwards-compatible way by versioning affected data structures, > P> supporting all versions in the kernel, and implementing macros that > P> will cause existing code that consumes that interface to use version 0 > P> without source modifications. If version 0 consumers of the interface > P> are used against a new kernel that has had bandwidth parameters of > P> 2^32 or greater configured by updated tools, such bandwidth parameters > P> will be reported as 2^32 - 1 bps by those old consumers. > P> > P> All in-tree consumers of the pf(4) interface have been updated. To > P> update out-of-tree consumers to the latest version of the interface, > P> define PFIOC_USE_LATEST ahead of any includes and use the code of > P> pfctl(8) as a guide for the ioctls of interest. > P> > P> PR:211730 > P> Reviewed by: jmallett, kp, loos > P> MFC after: 2 weeks > P> Relnotes: yes > P> Sponsored by: RG Nets > P> Differential Revision: https://reviews.freebsd.org/D16782 > P> > P> Modified: > P> head/sbin/ipfw/altq.c > P> head/sbin/pfctl/parse.y > P> head/sbin/pfctl/pfctl.c > P> head/sbin/pfctl/pfctl_altq.c > P> head/sbin/pfctl/pfctl_parser.h > P> head/sbin/p
svn commit: r338209 - in head: sbin/ipfw sbin/pfctl sys/net sys/net/altq sys/netpfil/pf usr.sbin/bsnmpd/modules/snmp_pf
Author: pkelsey Date: Wed Aug 22 19:38:48 2018 New Revision: 338209 URL: https://svnweb.freebsd.org/changeset/base/338209 Log: Extended pf(4) ioctl interface and pfctl(8) to allow bandwidths of 2^32 bps or greater to be used. Prior to this, bandwidth parameters would simply wrap at the 2^32 boundary. The computations in the HFSC scheduler and token bucket regulator have been modified to operate correctly up to at least 100 Gbps. No other algorithms have been examined or modified for correct operation above 2^32 bps (some may have existing computation resolution or overflow issues at rates below that threshold). pfctl(8) will now limit non-HFSC bandwidth parameters to 2^32 - 1 before passing them to the kernel. The extensions to the pf(4) ioctl interface have been made in a backwards-compatible way by versioning affected data structures, supporting all versions in the kernel, and implementing macros that will cause existing code that consumes that interface to use version 0 without source modifications. If version 0 consumers of the interface are used against a new kernel that has had bandwidth parameters of 2^32 or greater configured by updated tools, such bandwidth parameters will be reported as 2^32 - 1 bps by those old consumers. All in-tree consumers of the pf(4) interface have been updated. To update out-of-tree consumers to the latest version of the interface, define PFIOC_USE_LATEST ahead of any includes and use the code of pfctl(8) as a guide for the ioctls of interest. PR: 211730 Reviewed by: jmallett, kp, loos MFC after:2 weeks Relnotes: yes Sponsored by: RG Nets Differential Revision:https://reviews.freebsd.org/D16782 Modified: head/sbin/ipfw/altq.c head/sbin/pfctl/parse.y head/sbin/pfctl/pfctl.c head/sbin/pfctl/pfctl_altq.c head/sbin/pfctl/pfctl_parser.h head/sbin/pfctl/pfctl_qstats.c head/sys/net/altq/altq.h head/sys/net/altq/altq_cbq.c head/sys/net/altq/altq_cbq.h head/sys/net/altq/altq_codel.c head/sys/net/altq/altq_codel.h head/sys/net/altq/altq_fairq.c head/sys/net/altq/altq_fairq.h head/sys/net/altq/altq_hfsc.c head/sys/net/altq/altq_hfsc.h head/sys/net/altq/altq_priq.c head/sys/net/altq/altq_priq.h head/sys/net/altq/altq_subr.c head/sys/net/altq/altq_var.h head/sys/net/pfvar.h head/sys/netpfil/pf/pf_altq.h head/sys/netpfil/pf/pf_ioctl.c head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c Modified: head/sbin/ipfw/altq.c == --- head/sbin/ipfw/altq.c Wed Aug 22 18:19:56 2018(r338208) +++ head/sbin/ipfw/altq.c Wed Aug 22 19:38:48 2018(r338209) @@ -22,6 +22,8 @@ * altq interface */ +#define PFIOC_USE_LATEST + #include #include #include @@ -85,6 +87,7 @@ altq_fetch(void) return; } bzero(, sizeof(pfioc)); + pfioc.version = PFIOC_ALTQ_VERSION; if (ioctl(pffd, DIOCGETALTQS, ) != 0) { warn("altq support getting queue list"); close(pffd); Modified: head/sbin/pfctl/parse.y == --- head/sbin/pfctl/parse.y Wed Aug 22 18:19:56 2018(r338208) +++ head/sbin/pfctl/parse.y Wed Aug 22 19:38:48 2018(r338209) @@ -32,6 +32,8 @@ #include __FBSDID("$FreeBSD$"); +#define PFIOC_USE_LATEST + #include #include #include @@ -286,7 +288,7 @@ static struct queue_opts { struct node_queue_bwqueue_bwspec; struct node_queue_opt scheduler; int priority; - int tbrsize; + unsigned inttbrsize; int qlimit; } queue_opts; @@ -1623,8 +1625,8 @@ queue_opt : BANDWIDTH bandwidth { yyerror("tbrsize cannot be respecified"); YYERROR; } - if ($2 < 0 || $2 > 65535) { - yyerror("tbrsize too big: max 65535"); + if ($2 < 0 || $2 > UINT_MAX) { + yyerror("tbrsize too big: max %u", UINT_MAX); YYERROR; } queue_opts.marker |= QOM_TBRSIZE; @@ -1673,10 +1675,10 @@ bandwidth : STRING { } } free($1); - $$.bw_absolute = (u_int32_t)bps; + $$.bw_absolute = (u_int64_t)bps; } | NUMBER { - if ($1 < 0 || $1 > UINT_MAX) { + if ($1 < 0 || $1 >= LLONG_MAX) { yyerror("bandwidth number too big"); YYERROR; } Modified: head/sbin/pfctl/pfctl.c
svn commit: r337281 - head/sys/net
Author: pkelsey Date: Sat Aug 4 01:45:17 2018 New Revision: 337281 URL: https://svnweb.freebsd.org/changeset/base/337281 Log: Mark the send queue ready so ALTQ is available. Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cSat Aug 4 00:34:15 2018(r337280) +++ head/sys/net/iflib.cSat Aug 4 01:45:17 2018(r337281) @@ -5234,6 +5234,7 @@ iflib_register(if_ctx_t ctx) #ifdef ALTQ if_setstartfn(ifp, iflib_altq_if_start); if_settransmitfn(ifp, iflib_altq_if_transmit); + if_setsendqready(ifp); #else if_settransmitfn(ifp, iflib_if_transmit); #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r336727 - in head/sys/net: . altq
Author: pkelsey Date: Wed Jul 25 22:46:36 2018 New Revision: 336727 URL: https://svnweb.freebsd.org/changeset/base/336727 Log: ALTQ support for iflib. Reviewed by: jmallett, mmacy Differential Revision:https://reviews.freebsd.org/D16433 Modified: head/sys/net/altq/if_altq.h head/sys/net/iflib.c Modified: head/sys/net/altq/if_altq.h == --- head/sys/net/altq/if_altq.h Wed Jul 25 21:52:49 2018(r336726) +++ head/sys/net/altq/if_altq.h Wed Jul 25 22:46:36 2018(r336727) @@ -143,7 +143,11 @@ struct tb_regulator { #defineALTRQ_PURGE 1 /* purge all packets */ #defineALTQ_IS_READY(ifq) ((ifq)->altq_flags & ALTQF_READY) +#ifdef ALTQ #defineALTQ_IS_ENABLED(ifq)((ifq)->altq_flags & ALTQF_ENABLED) +#else +#defineALTQ_IS_ENABLED(ifq)0 +#endif #defineALTQ_NEEDS_CLASSIFY(ifq)((ifq)->altq_flags & ALTQF_CLASSIFY) #defineALTQ_IS_CNDTNING(ifq) ((ifq)->altq_flags & ALTQF_CNDTNING) Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cWed Jul 25 21:52:49 2018(r336726) +++ head/sys/net/iflib.cWed Jul 25 22:46:36 2018(r336727) @@ -739,6 +739,10 @@ 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, 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 *); +#ifdef ALTQ +static void iflib_altq_if_start(if_t ifp); +static int iflib_altq_if_transmit(if_t ifp, struct mbuf *m); +#endif static int iflib_register(if_ctx_t); static void iflib_init_locked(if_ctx_t ctx); static void iflib_add_device_sysctl_pre(if_ctx_t ctx); @@ -3775,6 +3779,10 @@ _task_fn_tx(void *context) IFDI_TX_QUEUE_INTR_ENABLE(ctx, txq->ift_id); return; } +#ifdef ALTQ + if (ALTQ_IS_ENABLED(>if_snd)) + iflib_altq_if_start(ifp); +#endif if (txq->ift_db_pending) ifmp_ring_enqueue(txq->ift_br, (void **), 1, TX_BATCH_SIZE, abdicate); else if (!abdicate) @@ -3963,8 +3971,9 @@ iflib_if_transmit(if_t ifp, struct mbuf *m) } MPASS(m->m_nextpkt == NULL); + /* ALTQ-enabled interfaces always use queue 0. */ qidx = 0; - if ((NTXQSETS(ctx) > 1) && M_HASHTYPE_GET(m)) + if ((NTXQSETS(ctx) > 1) && M_HASHTYPE_GET(m) && !ALTQ_IS_ENABLED(>if_snd)) qidx = QIDX(ctx, m); /* * XXX calculate buf_ring based on flowid (divvy up bits?) @@ -4024,7 +4033,60 @@ iflib_if_transmit(if_t ifp, struct mbuf *m) return (err); } +#ifdef ALTQ +/* + * The overall approach to integrating iflib with ALTQ is to continue to use + * the iflib mp_ring machinery between the ALTQ queue(s) and the hardware + * ring. Technically, when using ALTQ, queueing to an intermediate mp_ring + * is redundant/unnecessary, but doing so minimizes the amount of + * ALTQ-specific code required in iflib. It is assumed that the overhead of + * redundantly queueing to an intermediate mp_ring is swamped by the + * performance limitations inherent in using ALTQ. + * + * When ALTQ support is compiled in, all iflib drivers will use a transmit + * routine, iflib_altq_if_transmit(), that checks if ALTQ is enabled for the + * given interface. If ALTQ is enabled for an interface, then all + * transmitted packets for that interface will be submitted to the ALTQ + * subsystem via IFQ_ENQUEUE(). We don't use the legacy if_transmit() + * implementation because it uses IFQ_HANDOFF(), which will duplicatively + * update stats that the iflib machinery handles, and which is sensitve to + * the disused IFF_DRV_OACTIVE flag. Additionally, iflib_altq_if_start() + * will be installed as the start routine for use by ALTQ facilities that + * need to trigger queue drains on a scheduled basis. + * + */ static void +iflib_altq_if_start(if_t ifp) +{ + struct ifaltq *ifq = >if_snd; + struct mbuf *m; + + IFQ_LOCK(ifq); + IFQ_DEQUEUE_NOLOCK(ifq, m); + while (m != NULL) { + iflib_if_transmit(ifp, m); + IFQ_DEQUEUE_NOLOCK(ifq, m); + } + IFQ_UNLOCK(ifq); +} + +static int +iflib_altq_if_transmit(if_t ifp, struct mbuf *m) +{ + int err; + + if (ALTQ_IS_ENABLED(>if_snd)) { + IFQ_ENQUEUE(>if_snd, m, err); + if (err == 0) + iflib_altq_if_start(ifp); + } else + err = iflib_if_transmit(ifp, m); + + return (err); +} +#endif /* ALTQ */ + +static void iflib_if_qflush(if_t ifp) { if_ctx_t ctx = if_getsoftc(ifp); @@ -4041,6 +4103,10 @@ iflib_if_qflush(if_t ifp) ctx->ifc_flags &= ~IFC_QFLUSH;
svn commit: r330035 - head/sys/netinet
Author: pkelsey Date: Mon Feb 26 20:31:16 2018 New Revision: 330035 URL: https://svnweb.freebsd.org/changeset/base/330035 Log: Ensure signed comparison to avoid false trip of assert during VNET teardown. Reported by: lwhsu MFC after:1 month Modified: head/sys/netinet/tcp_fastopen.c Modified: head/sys/netinet/tcp_fastopen.c == --- head/sys/netinet/tcp_fastopen.c Mon Feb 26 19:27:59 2018 (r330034) +++ head/sys/netinet/tcp_fastopen.c Mon Feb 26 20:31:16 2018 (r330035) @@ -1101,7 +1101,7 @@ tcp_fastopen_ccache_bucket_trim(struct tcp_fastopen_cc if (entries > limit) tcp_fastopen_ccache_entry_drop(cce, ccb); } - KASSERT(ccb->ccb_num_entries <= limit, + KASSERT(ccb->ccb_num_entries <= (int)limit, ("%s: ccb->ccb_num_entries %d exceeds limit %d", __func__, ccb->ccb_num_entries, limit)); if (limit == 0) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330002 - in head/sys: amd64/conf arm64/conf netinet
Author: pkelsey Date: Mon Feb 26 03:03:41 2018 New Revision: 330002 URL: https://svnweb.freebsd.org/changeset/base/330002 Log: Greatly reduce the number of #ifdefs supporting the TCP_RFC7413 kernel option. The conditional compilation support is now centralized in tcp_fastopen.h and tcp_var.h. This doesn't provide the minimum theoretical code/data footprint when TCP_RFC7413 is disabled, but nearly all the TFO code should wind up being removed by the optimizer, the additional footprint in the syncache entries is a single pointer, and the additional overhead in the tcpcb is at the end of the structure. This enables the TCP_RFC7413 kernel option by default in amd64 and arm64 GENERIC. Reviewed by: hiren MFC after:1 month Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D14048 Modified: head/sys/amd64/conf/GENERIC head/sys/arm64/conf/GENERIC head/sys/netinet/tcp_fastopen.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_syncache.h head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Mon Feb 26 02:53:22 2018(r330001) +++ head/sys/amd64/conf/GENERIC Mon Feb 26 03:03:41 2018(r330002) @@ -33,6 +33,7 @@ options IPSEC # IP (v4/v6) security optionsIPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 optionsTCP_OFFLOAD # TCP offload optionsTCP_HHOOK # hhook(9) framework for TCP +optionsTCP_RFC7413 # TCP Fast Open optionsSCTP# Stream Control Transmission Protocol optionsFFS # Berkeley Fast Filesystem optionsSOFTUPDATES # Enable FFS soft updates support Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Mon Feb 26 02:53:22 2018(r330001) +++ head/sys/arm64/conf/GENERIC Mon Feb 26 03:03:41 2018(r330002) @@ -33,6 +33,7 @@ options IPSEC # IP (v4/v6) security optionsIPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 optionsTCP_HHOOK # hhook(9) framework for TCP optionsTCP_OFFLOAD # TCP offload +optionsTCP_RFC7413 # TCP Fast Open optionsSCTP# Stream Control Transmission Protocol optionsFFS # Berkeley Fast Filesystem optionsSOFTUPDATES # Enable FFS soft updates support Modified: head/sys/netinet/tcp_fastopen.h == --- head/sys/netinet/tcp_fastopen.h Mon Feb 26 02:53:22 2018 (r330001) +++ head/sys/netinet/tcp_fastopen.h Mon Feb 26 03:03:41 2018 (r330002) @@ -31,13 +31,20 @@ #ifdef _KERNEL +#include "opt_inet.h" + #defineTCP_FASTOPEN_COOKIE_LEN 8 /* SipHash24 64-bit output */ +#ifdef TCP_RFC7413 VNET_DECLARE(unsigned int, tcp_fastopen_client_enable); #defineV_tcp_fastopen_client_enableVNET(tcp_fastopen_client_enable) VNET_DECLARE(unsigned int, tcp_fastopen_server_enable); #defineV_tcp_fastopen_server_enableVNET(tcp_fastopen_server_enable) +#else +#defineV_tcp_fastopen_client_enable0 +#defineV_tcp_fastopen_server_enable0 +#endif /* TCP_RFC7413 */ union tcp_fastopen_ip_addr { struct in_addr v4; @@ -74,6 +81,7 @@ struct tcp_fastopen_ccache { uint32_tsecret; }; +#ifdef TCP_RFC7413 void tcp_fastopen_init(void); void tcp_fastopen_destroy(void); unsigned int *tcp_fastopen_alloc_counter(void); @@ -84,6 +92,17 @@ void tcp_fastopen_connect(struct tcpcb *); void tcp_fastopen_disable_path(struct tcpcb *); void tcp_fastopen_update_cache(struct tcpcb *, uint16_t, uint8_t, uint8_t *); +#else +#define tcp_fastopen_init()((void)0) +#define tcp_fastopen_destroy() ((void)0) +#define tcp_fastopen_alloc_counter() NULL +#define tcp_fastopen_decrement_counter(c) ((void)0) +#define tcp_fastopen_check_cookie(i, c, l, lc) (-1) +#define tcp_fastopen_connect(t)((void)0) +#define tcp_fastopen_disable_path(t) ((void)0) +#define tcp_fastopen_update_cache(t, m, l, c) ((void)0) +#endif /* TCP_RFC7413 */ + #endif /* _KERNEL */ #endif /* _TCP_FASTOPEN_H_ */ Modified: head/sys/netinet/tcp_input.c == --- head/sys/netinet/tcp_input.cMon Feb 26 02:53:22 2018 (r330001) +++ head/sys/netinet/tcp_input.c
svn commit: r330001 - in head/sys: conf netinet
Author: pkelsey Date: Mon Feb 26 02:53:22 2018 New Revision: 330001 URL: https://svnweb.freebsd.org/changeset/base/330001 Log: This is an implementation of the client side of TCP Fast Open (TFO) [RFC7413]. It also includes a pre-shared key mode of operation in which the server requires the client to be in possession of a shared secret in order to successfully open TFO connections with that server. The names of some existing fastopen sysctls have changed (e.g., net.inet.tcp.fastopen.enabled -> net.inet.tcp.fastopen.server_enable). Reviewed by: tuexen MFC after:1 month Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D14047 Modified: head/sys/conf/options head/sys/netinet/tcp.h head/sys/netinet/tcp_fastopen.c head/sys/netinet/tcp_fastopen.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h Modified: head/sys/conf/options == --- head/sys/conf/options Mon Feb 26 02:43:26 2018(r33) +++ head/sys/conf/options Mon Feb 26 02:53:22 2018(r330001) @@ -456,6 +456,7 @@ TCP_HHOOK opt_inet.h TCP_OFFLOADopt_inet.h # Enable code to dispatch TCP offloading TCP_RFC7413opt_inet.h TCP_RFC7413_MAX_KEYS opt_inet.h +TCP_RFC7413_MAX_PSKS opt_inet.h TCP_SIGNATURE opt_ipsec.h VLAN_ARRAY opt_vlan.h XBONEHACK Modified: head/sys/netinet/tcp.h == --- head/sys/netinet/tcp.h Mon Feb 26 02:43:26 2018(r33) +++ head/sys/netinet/tcp.h Mon Feb 26 02:53:22 2018(r330001) @@ -101,8 +101,6 @@ struct tcphdr { #define TCPOLEN_SIGNATURE18 #defineTCPOPT_FAST_OPEN34 #define TCPOLEN_FAST_OPEN_EMPTY 2 -#define TCPOLEN_FAST_OPEN_MIN6 -#define TCPOLEN_FAST_OPEN_MAX18 /* Miscellaneous constants */ #defineMAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ @@ -152,6 +150,10 @@ struct tcphdr { #define TCP_MAXHLEN(0xf<<2)/* max length of header in bytes */ #define TCP_MAXOLEN(TCP_MAXHLEN - sizeof(struct tcphdr)) /* max space left for options */ + +#define TCP_FASTOPEN_MIN_COOKIE_LEN4 /* Per RFC7413 */ +#define TCP_FASTOPEN_MAX_COOKIE_LEN16 /* Per RFC7413 */ +#define TCP_FASTOPEN_PSK_LEN 16 /* Same as TCP_FASTOPEN_KEY_LEN */ #endif /* __BSD_VISIBLE */ /* @@ -251,6 +253,16 @@ struct tcp_info { /* Padding to grow without breaking ABI. */ u_int32_t __tcpi_pad[26]; /* Padding. */ +}; + +/* + * If this structure is provided when setting the TCP_FASTOPEN socket + * option, and the enable member is non-zero, a subsequent connect will use + * pre-shared key (PSK) mode using the provided key. + */ +struct tcp_fastopen { + int enable; + uint8_t psk[TCP_FASTOPEN_PSK_LEN]; }; #endif #define TCP_FUNCTION_NAME_LEN_MAX 32 Modified: head/sys/netinet/tcp_fastopen.c == --- head/sys/netinet/tcp_fastopen.c Mon Feb 26 02:43:26 2018 (r33) +++ head/sys/netinet/tcp_fastopen.c Mon Feb 26 02:53:22 2018 (r330001) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Patrick Kelsey + * Copyright (c) 2015-2017 Patrick Kelsey * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,23 +25,44 @@ */ /* - * This is a server-side implementation of TCP Fast Open (TFO) [RFC7413]. + * This is an implementation of TCP Fast Open (TFO) [RFC7413]. To include + * this code, add the following line to your kernel config: * - * This implementation is currently considered to be experimental and is not - * included in kernel builds by default. To include this code, add the - * following line to your kernel config: - * * options TCP_RFC7413 * + * * The generated TFO cookies are the 64-bit output of - * SipHash24(<16-byte-key>). Multiple concurrent valid keys are - * supported so that time-based rolling cookie invalidation policies can be - * implemented in the system. The default number of concurrent keys is 2. - * This can be adjusted in the kernel config as follows: + * SipHash24(key=<16-byte-key>, msg=). Multiple concurrent valid + * keys are supported so that time-based rolling cookie invalidation + * policies can be implemented in the system. The default number of + * concurrent keys is 2. This can be adjusted in the kernel config as + * follows: * * options TCP_RFC7413_MAX_KEYS= * * + * In addition to the facilities defined in RFC7413, this implem
svn commit: r330000 - head/sys/netinet
Author: pkelsey Date: Mon Feb 26 02:43:26 2018 New Revision: 33 URL: https://svnweb.freebsd.org/changeset/base/33 Log: Fix harmless locking bug in tfp_fastopen_check_cookie(). The keylist lock was not being acquired early enough. The only side effect of this bug is that the effective add time of a new key could be slightly later than it would have been otherwise, as seen by a TFO client. Reviewed by: tuexen MFC after:1 month Sponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D14046 Modified: head/sys/netinet/tcp_fastopen.c Modified: head/sys/netinet/tcp_fastopen.c == --- head/sys/netinet/tcp_fastopen.c Mon Feb 26 02:28:32 2018 (r32) +++ head/sys/netinet/tcp_fastopen.c Mon Feb 26 02:43:26 2018 (r33) @@ -313,6 +313,7 @@ tcp_fastopen_check_cookie(struct in_conninfo *inc, uin { struct rm_priotracker tracker; unsigned int i, key_index; + int rv; uint64_t cur_cookie; if (V_tcp_fastopen_acceptany) { @@ -320,21 +321,22 @@ tcp_fastopen_check_cookie(struct in_conninfo *inc, uin return (1); } + TCP_FASTOPEN_KEYS_RLOCK(); if (len != TCP_FASTOPEN_COOKIE_LEN) { if (V_tcp_fastopen_numkeys > 0) { *latest_cookie = tcp_fastopen_make_cookie( V_tcp_fastopen_keys.key[V_tcp_fastopen_keys.newest], inc); - return (0); - } - return (-1); + rv = 0; + } else + rv = -1; + goto out; } /* * Check against each available key, from newest to oldest. */ - TCP_FASTOPEN_KEYS_RLOCK(); key_index = V_tcp_fastopen_keys.newest; for (i = 0; i < V_tcp_fastopen_numkeys; i++) { cur_cookie = @@ -343,17 +345,19 @@ tcp_fastopen_check_cookie(struct in_conninfo *inc, uin if (i == 0) *latest_cookie = cur_cookie; if (memcmp(cookie, _cookie, TCP_FASTOPEN_COOKIE_LEN) == 0) { - TCP_FASTOPEN_KEYS_RUNLOCK(); - return (1); + rv = 1; + goto out; } if (key_index == 0) key_index = TCP_FASTOPEN_MAX_KEYS - 1; else key_index--; } - TCP_FASTOPEN_KEYS_RUNLOCK(); + rv = 0; - return (0); +out: + TCP_FASTOPEN_KEYS_RUNLOCK(); + return (rv); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324181 - head/sys/netinet
Author: pkelsey Date: Sun Oct 1 23:37:17 2017 New Revision: 324181 URL: https://svnweb.freebsd.org/changeset/base/324181 Log: The soisconnected() call removed from syncache_socket() in r307966 was not extraneous in the TCP Fast Open (TFO) passive-open case. In the TFO passive-open case, syncache_socket() is being called during processing of a TFO SYN bearing a valid cookie, and a call to soisconnected() is required in order to allow the application to immediately consume any data delivered in the SYN and to have a chance to generate response data to accompany the SYN-ACK. The removal of this call to soisconnected() effectively converted all TFO passive opens to having the same RTT cost as a standard 3WHS. This commit adds a call to soisconnected() to syncache_tfo_expand() so that it is only in the TFO passive-open path, thereby restoring TFO passve-open RTT performance and preserving the non-TFO connection-rate performance gains realized by r307966. MFC after:1 week Sponsored by: Limelight Networks Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c == --- head/sys/netinet/tcp_syncache.c Sun Oct 1 21:45:15 2017 (r324180) +++ head/sys/netinet/tcp_syncache.c Sun Oct 1 23:37:17 2017 (r324181) @@ -1195,6 +1195,7 @@ syncache_tfo_expand(struct syncache *sc, struct socket TCPSTAT_INC(tcps_sc_aborted); atomic_subtract_int(pending_counter, 1); } else { + soisconnected(*lsop); inp = sotoinpcb(*lsop); tp = intotcpcb(inp); tp->t_flags |= TF_FASTOPEN; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317421 - head/sys/kern
Author: pkelsey Date: Tue Apr 25 19:54:34 2017 New Revision: 317421 URL: https://svnweb.freebsd.org/changeset/base/317421 Log: Remove unnecessary check for NULL mbuf in soreceive_generic(). This check has been redundant since it was introduced in r162554. Reviewed by: emaste, glebius MFC after:1 week Differential Revision:https://reviews.freebsd.org/D10322 Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Tue Apr 25 19:48:25 2017(r317420) +++ head/sys/kern/uipc_socket.c Tue Apr 25 19:54:34 2017(r317421) @@ -1766,7 +1766,7 @@ dontblock: * requires MT_SONAME mbufs at the head of * each record. */ - if (m && pr->pr_flags & PR_ATOMIC && + if (pr->pr_flags & PR_ATOMIC && ((flags & MSG_PEEK) == 0)) (void)sbdroprecord_locked(>so_rcv); SOCKBUF_UNLOCK(>so_rcv); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317035 - in head: contrib/traceroute sbin/route sbin/routed sys/net usr.bin/netstat usr.sbin/arp usr.sbin/ndp usr.sbin/rarpd usr.sbin/route6d
Author: pkelsey Date: Sun Apr 16 19:17:10 2017 New Revision: 317035 URL: https://svnweb.freebsd.org/changeset/base/317035 Log: Fix userland tools that don't check the format of routing socket messages before accessing message fields that may not be present, removing dead/duplicate/misleading code along the way. Document the message format for each routing socket message in route.h. Fix a bug in usr.bin/netstat introduced in r287351 that resulted in pointer computation with essentially random 16-bit offsets and dereferencing of the results. Reviewed by: ae MFC after:1 month Differential Revision:https://reviews.freebsd.org/D10330 Modified: head/contrib/traceroute/findsaddr-socket.c head/sbin/route/route.c head/sbin/routed/table.c head/sys/net/route.h head/usr.bin/netstat/route.c head/usr.sbin/arp/arp.c head/usr.sbin/ndp/ndp.c head/usr.sbin/rarpd/rarpd.c head/usr.sbin/route6d/route6d.c Modified: head/contrib/traceroute/findsaddr-socket.c == --- head/contrib/traceroute/findsaddr-socket.c Sun Apr 16 19:12:07 2017 (r317034) +++ head/contrib/traceroute/findsaddr-socket.c Sun Apr 16 19:17:10 2017 (r317035) @@ -156,7 +156,8 @@ findsaddr(register const struct sockaddr return (errbuf); } - } while (rp->rtm_seq != seq || rp->rtm_pid != pid); + } while (rp->rtm_type != RTM_GET || rp->rtm_seq != seq || + rp->rtm_pid != pid); close(s); Modified: head/sbin/route/route.c == --- head/sbin/route/route.c Sun Apr 16 19:12:07 2017(r317034) +++ head/sbin/route/route.c Sun Apr 16 19:17:10 2017(r317035) @@ -1497,10 +1497,7 @@ rtmsg(int cmd, int flags, int fib) #define NEXTADDR(w, u) \ if (rtm_addrs & (w)) { \ - l = (((struct sockaddr *)&(u))->sa_len == 0) ? \ - sizeof(long) : \ - 1 + struct sockaddr *)&(u))->sa_len - 1)\ - | (sizeof(long) - 1)); \ + l = SA_SIZE(&(u)); \ memmove(cp, (char *)&(u), l); \ cp += l;\ if (verbose)\ @@ -1564,7 +1561,8 @@ rtmsg(int cmd, int flags, int fib) do { l = read(s, (char *)_rtmsg, sizeof(m_rtmsg)); } while (l > 0 && stop_read == 0 && - (rtm.rtm_seq != rtm_seq || rtm.rtm_pid != pid)); + (rtm.rtm_type != RTM_GET || rtm.rtm_seq != rtm_seq || + rtm.rtm_pid != pid)); if (stop_read != 0) { warnx("read from routing socket timed out"); return (-1); @@ -1706,10 +1704,13 @@ print_rtmsg(struct rt_msghdr *rtm, size_ break; default: - printf("pid: %ld, seq %d, errno %d, flags:", - (long)rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno); - printb(rtm->rtm_flags, routeflags); - pmsg_common(rtm, msglen); + if (rtm->rtm_type <= RTM_RESOLVE) { + printf("pid: %ld, seq %d, errno %d, flags:", + (long)rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno); + printb(rtm->rtm_flags, routeflags); + pmsg_common(rtm, msglen); + } else + printf("type: %u, len: %zu\n", rtm->rtm_type, msglen); } return; Modified: head/sbin/routed/table.c == --- head/sbin/routed/table.cSun Apr 16 19:12:07 2017(r317034) +++ head/sbin/routed/table.cSun Apr 16 19:17:10 2017(r317035) @@ -1233,6 +1233,15 @@ read_rt(void) if (m.r.rtm.rtm_type <= RTM_CHANGE) strp += sprintf(strp," from pid %d",m.r.rtm.rtm_pid); + /* +* Only messages that use the struct rt_msghdr format are +* allowed beyond this point. +*/ + if (m.r.rtm.rtm_type > RTM_RESOLVE) { + trace_act("ignore %s", str); + continue; + } + rt_xaddrs(, m.r.addrs, [RTAX_MAX], m.r.rtm.rtm_addrs); Modified: head/sys/net/route.h == --- head/sys/net/route.hSun Apr 16 19:12:07 2017
Re: svn commit: r316648 - in head/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/include cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev/dtrac
On Tue, Apr 11, 2017 at 1:24 AM, John Baldwin <j...@freebsd.org> wrote: > On Monday, April 10, 2017 04:26:03 PM Patrick Kelsey wrote: > > On Mon, Apr 10, 2017 at 1:43 PM, John Baldwin <j...@freebsd.org> wrote: > > > > > On Monday, April 10, 2017 01:23:04 PM Jung-uk Kim wrote: > > > > On 04/08/2017 22:00, Patrick Kelsey wrote: > > > > > Author: pkelsey > > > > > Date: Sun Apr 9 02:00:03 2017 > > > > > New Revision: 316648 > > > > > URL: https://svnweb.freebsd.org/changeset/base/316648 > > > > > > > > > > Log: > > > > > Corrected misspelled versions of rendezvous. > > > > > > > > > > The MFC will include a compat definition of > > > smp_no_rendevous_barrier() > > > > > that calls smp_no_rendezvous_barrier(). > > > > > > > > > > Reviewed by: gnn, kib > > > > > MFC after:1 week > > > > > Differential Revision:https://reviews.freebsd.org/D10313 > > > > ... > > > > > > > > We knew about the problem but we didn't fix it because it breaks KPI. > > > > For example, sysutils/virtualbox-ose-kmod. If you really want to MFC > > > > this change, you have to implement shims. > > > > > > Also, the function isn't actually called, but is only used in > comparisons > > > in smp_rendezvous_action(). To do a compat shim you will need to > either > > > change these comparisons to compare against both function pointers or > > > define the alternate symbol as an alias of the existing function. That > > > only helps the KBI though. For the KPI would just use a #define to > point > > > to the new name. > > > > > > > That's a good point about the comparisons in smp_rendezvous_action() - > if I > > had managed to miss that detail all the way through the compat shim > > implementation, it would have littered pointless empty function > invocations > > and atomic increments into all the uses of smp_rendezvous() that used > > smp_no_rendezvous_barrier for at least one of the stages. > > > > I don't think we have an established place to define machine-independent > > symbol aliases. Approaching that through linker scripts would require > > spamming a PROVIDE() statement into each of the arch-specific scripts. > > Since this is a function, I think a better way than the symbol alias + > > #define approach would be to just define a function pointer called > > smp_no_rendevous_barrier that gets statically initialized to > > smp_no_rendezvous_barrier. In that case, the extern decl takes care of > the > > KPI, the corresponding symbol definition takes care of the KBI, and it > has > > a minimal, MI, code footprint. > > I was thinking something along the lines of __weak_reference() from > sys/cdefs.h. Actually, maybe > __strong_reference(smp_no_rendezvous, smp_no_rendevous_barrier) > would be sufficient? > > __strong_reference() is it. > > Either that, or I relax the goal of purging it entirely and put the > compat > > shim in current also to sidestep the port-patching issue. > > Well, I'd like to not have it live around forever, but we could add the > compat shim to HEAD in the short term (also makes MFC slightly simpler as > you just group the two commits together when you MFC). Once the port is > patched with the updated FreeBSD_version we can remove the shim from HEAD. > > So far it doesn't look like patching ports will be much of an issue. I extracted sources for all ports that contained INSTALL_KLD in their Makefile and grepped them for smp_no_rendevous - the only ports turned up that way are emulators/virtualbox-ose-additions and emulators/virtualbox-ose-kmod. One set of patches will serve both, and I've sent them off to the maintainers. -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r316648 - in head/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/include cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev/dtrac
On Mon, Apr 10, 2017 at 1:43 PM, John Baldwin <j...@freebsd.org> wrote: > On Monday, April 10, 2017 01:23:04 PM Jung-uk Kim wrote: > > On 04/08/2017 22:00, Patrick Kelsey wrote: > > > Author: pkelsey > > > Date: Sun Apr 9 02:00:03 2017 > > > New Revision: 316648 > > > URL: https://svnweb.freebsd.org/changeset/base/316648 > > > > > > Log: > > > Corrected misspelled versions of rendezvous. > > > > > > The MFC will include a compat definition of > smp_no_rendevous_barrier() > > > that calls smp_no_rendezvous_barrier(). > > > > > > Reviewed by: gnn, kib > > > MFC after:1 week > > > Differential Revision:https://reviews.freebsd.org/D10313 > > ... > > > > We knew about the problem but we didn't fix it because it breaks KPI. > > For example, sysutils/virtualbox-ose-kmod. If you really want to MFC > > this change, you have to implement shims. > > Also, the function isn't actually called, but is only used in comparisons > in smp_rendezvous_action(). To do a compat shim you will need to either > change these comparisons to compare against both function pointers or > define the alternate symbol as an alias of the existing function. That > only helps the KBI though. For the KPI would just use a #define to point > to the new name. > That's a good point about the comparisons in smp_rendezvous_action() - if I had managed to miss that detail all the way through the compat shim implementation, it would have littered pointless empty function invocations and atomic increments into all the uses of smp_rendezvous() that used smp_no_rendezvous_barrier for at least one of the stages. I don't think we have an established place to define machine-independent symbol aliases. Approaching that through linker scripts would require spamming a PROVIDE() statement into each of the arch-specific scripts. Since this is a function, I think a better way than the symbol alias + #define approach would be to just define a function pointer called smp_no_rendevous_barrier that gets statically initialized to smp_no_rendezvous_barrier. In that case, the extern decl takes care of the KPI, the corresponding symbol definition takes care of the KBI, and it has a minimal, MI, code footprint. > > Also, as Jung-uk notes, this already breaks virtualbox on HEAD, so you will > need to patch the port now, not only if you MFC. Either that, or I relax the goal of purging it entirely and put the compat shim in current also to sidestep the port-patching issue. -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316683 - head/sys/sys
Author: pkelsey Date: Mon Apr 10 17:59:29 2017 New Revision: 316683 URL: https://svnweb.freebsd.org/changeset/base/316683 Log: Bump __FreeBSD_version due to r316648, rename of smp_no_redevous_barrier() to smp_no_rendezvous_barrier() Reported by: jkim Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hMon Apr 10 17:57:56 2017(r316682) +++ head/sys/sys/param.hMon Apr 10 17:59:29 2017(r316683) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200027 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200028 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r316648 - in head/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/include cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev/dtrac
On Mon, Apr 10, 2017 at 1:26 PM, Jung-uk Kim <j...@freebsd.org> wrote: > On 04/10/2017 13:23, Jung-uk Kim wrote: > > On 04/08/2017 22:00, Patrick Kelsey wrote: > >> Author: pkelsey > >> Date: Sun Apr 9 02:00:03 2017 > >> New Revision: 316648 > >> URL: https://svnweb.freebsd.org/changeset/base/316648 > >> > >> Log: > >> Corrected misspelled versions of rendezvous. > >> > >> The MFC will include a compat definition of smp_no_rendevous_barrier() > >> that calls smp_no_rendezvous_barrier(). > >> > >> Reviewed by: gnn, kib > >> MFC after: 1 week > >> Differential Revision: https://reviews.freebsd.org/D10313 > > ... > > > > We knew about the problem but we didn't fix it because it breaks KPI. > > For example, sysutils/virtualbox-ose-kmod. If you really want to MFC > > this change, you have to implement shims. > > Actually, I meant to say current also needs a shim. Otherwise, > _FreeBSD_version must be bumped. > > Sorry, I wasn't clear about this. > > I'm glad you clarified, as I was reading your last message just now wondering what I was missing. With respect to current, the intention is for the misspelled version to be gone in 12. The lack of a version bump was due to my misunderstanding of whether KPI changes were or weren't being tracked in __FreeBSD_version prior to a .0 release, but now that I've gone and found 1.6 in the Porter's Handbook, it's clear that they are. Thanks for catching this. -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316648 - in head/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/include cddl/dev/dtrace/aarch64 cddl/dev/dtrace/amd64 cddl/dev/dtrace/arm cddl/dev/dtrace/i386 cddl/dev/dtrace...
Author: pkelsey Date: Sun Apr 9 02:00:03 2017 New Revision: 316648 URL: https://svnweb.freebsd.org/changeset/base/316648 Log: Corrected misspelled versions of rendezvous. The MFC will include a compat definition of smp_no_rendevous_barrier() that calls smp_no_rendezvous_barrier(). Reviewed by: gnn, kib MFC after:1 week Differential Revision:https://reviews.freebsd.org/D10313 Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/counter.h head/sys/arm/arm/pmap-v6.c head/sys/arm/include/counter.h head/sys/arm64/include/counter.h head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c head/sys/cddl/dev/dtrace/arm/dtrace_subr.c head/sys/cddl/dev/dtrace/i386/dtrace_subr.c head/sys/cddl/dev/dtrace/mips/dtrace_subr.c head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c head/sys/dev/acpica/acpi_cpu.c head/sys/i386/i386/pmap.c head/sys/i386/include/counter.h head/sys/kern/kern_rmlock.c head/sys/kern/subr_smp.c head/sys/mips/include/counter.h head/sys/powerpc/include/counter.h head/sys/powerpc/ofw/ofw_machdep.c head/sys/riscv/include/counter.h head/sys/sparc64/include/counter.h head/sys/sys/smp.h head/sys/x86/x86/tsc.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Sun Apr 9 01:35:19 2017(r316647) +++ head/sys/amd64/amd64/pmap.c Sun Apr 9 02:00:03 2017(r316648) @@ -1733,7 +1733,7 @@ pmap_update_pde(pmap_t pmap, vm_offset_t act.newpde = newpde; CPU_SET(cpuid, ); smp_rendezvous_cpus(active, - smp_no_rendevous_barrier, pmap_update_pde_action, + smp_no_rendezvous_barrier, pmap_update_pde_action, pmap_update_pde_teardown, ); } else { pmap_update_pde_store(pmap, pde, newpde); Modified: head/sys/amd64/include/counter.h == --- head/sys/amd64/include/counter.hSun Apr 9 01:35:19 2017 (r316647) +++ head/sys/amd64/include/counter.hSun Apr 9 02:00:03 2017 (r316648) @@ -69,8 +69,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: head/sys/arm/arm/pmap-v6.c == --- head/sys/arm/arm/pmap-v6.c Sun Apr 9 01:35:19 2017(r316647) +++ head/sys/arm/arm/pmap-v6.c Sun Apr 9 02:00:03 2017(r316648) @@ -3322,7 +3322,7 @@ pmap_change_pte1(pmap_t pmap, pt1_entry_ act.va = va; act.npte1 = npte1; act.update = PCPU_GET(cpuid); - smp_rendezvous_cpus(all_cpus, smp_no_rendevous_barrier, + smp_rendezvous_cpus(all_cpus, smp_no_rendezvous_barrier, pmap_update_pte1_action, NULL, ); sched_unpin(); } else { Modified: head/sys/arm/include/counter.h == --- head/sys/arm/include/counter.h Sun Apr 9 01:35:19 2017 (r316647) +++ head/sys/arm/include/counter.h Sun Apr 9 02:00:03 2017 (r316648) @@ -70,8 +70,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: head/sys/arm64/include/counter.h == --- head/sys/arm64/include/counter.hSun Apr 9 01:35:19 2017 (r316647) +++ head/sys/arm64/include/counter.hSun Apr 9 02:00:03 2017 (r316648) @@ -68,8 +68,8 @@ static inline void counter_u64_zero_inline(counter_u64_t c) { - smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, - smp_no_rendevous_barrier, c); + smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, + smp_no_rendezvous_barrier, c); } #endif Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c == --- head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Sun Apr 9 01:35:19 2017(r316647) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Sun Apr 9 02:00:03 2017(r316648) @@ -134,8 +134,8 @@ dtrace_xcall(processorid_t cpu, dtrace_x else CPU_SETOF(cpu, ); -
svn commit: r316634 - head/sys/net
Author: pkelsey Date: Sat Apr 8 04:50:50 2017 New Revision: 316634 URL: https://svnweb.freebsd.org/changeset/base/316634 Log: Fixed typo in comment found while reading commit email for fix of other typo in same comment. ned -> need MFC after:3 days Modified: head/sys/net/if_epair.c Modified: head/sys/net/if_epair.c == --- head/sys/net/if_epair.c Sat Apr 8 04:45:52 2017(r316633) +++ head/sys/net/if_epair.c Sat Apr 8 04:50:50 2017(r316634) @@ -403,7 +403,7 @@ epair_start_locked(struct ifnet *ifp) /* * We get packets here from ether_output via if_handoff() -* and ned to put them into the input queue of the oifp +* and need to put them into the input queue of the oifp * and call oifp->if_input() via netisr/epair_sintr(). */ oifp = sc->oifp; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316633 - head/sys/net
Author: pkelsey Date: Sat Apr 8 04:45:52 2017 New Revision: 316633 URL: https://svnweb.freebsd.org/changeset/base/316633 Log: Fixed typo in comment. patckets -> packets MFC after:3 days Modified: head/sys/net/if_epair.c Modified: head/sys/net/if_epair.c == --- head/sys/net/if_epair.c Sat Apr 8 04:41:46 2017(r316632) +++ head/sys/net/if_epair.c Sat Apr 8 04:45:52 2017(r316633) @@ -402,7 +402,7 @@ epair_start_locked(struct ifnet *ifp) return; /* -* We get patckets here from ether_output via if_handoff() +* We get packets here from ether_output via if_handoff() * and ned to put them into the input queue of the oifp * and call oifp->if_input() via netisr/epair_sintr(). */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316632 - head/sys/sys
Author: pkelsey Date: Sat Apr 8 04:41:46 2017 New Revision: 316632 URL: https://svnweb.freebsd.org/changeset/base/316632 Log: Fixed typo. CSUM_COALESED -> CSUM_COALESCED MFC after:3 days Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h == --- head/sys/sys/mbuf.h Sat Apr 8 04:37:01 2017(r316631) +++ head/sys/sys/mbuf.h Sat Apr 8 04:41:46 2017(r316632) @@ -484,7 +484,7 @@ void sf_ext_free_nocache(void *, void *) #defineCSUM_L4_VALID 0x0800 /* checksum is correct */ #defineCSUM_L5_CALC0x1000 /* calculated layer 5 csum */ #defineCSUM_L5_VALID 0x2000 /* checksum is correct */ -#defineCSUM_COALESED 0x4000 /* contains merged segments */ +#defineCSUM_COALESCED 0x4000 /* contains merged segments */ /* * CSUM flag description for use with printf(9) %b identifier. @@ -495,7 +495,7 @@ void sf_ext_free_nocache(void *, void *) "\12CSUM_IP6_UDP\13CSUM_IP6_TCP\14CSUM_IP6_SCTP\15CSUM_IP6_TSO" \ "\16CSUM_IP6_ISCSI" \ "\31CSUM_L3_CALC\32CSUM_L3_VALID\33CSUM_L4_CALC\34CSUM_L4_VALID" \ -"\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESED" +"\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESCED" /* CSUM flags compatibility mappings. */ #defineCSUM_IP_CHECKED CSUM_L3_CALC ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316631 - head/sys/net
Author: pkelsey Date: Sat Apr 8 04:37:01 2017 New Revision: 316631 URL: https://svnweb.freebsd.org/changeset/base/316631 Log: Fix typo in comment. logest -> longest MFC after:3 days Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c == --- head/sys/net/rtsock.c Sat Apr 8 04:34:18 2017(r316630) +++ head/sys/net/rtsock.c Sat Apr 8 04:37:01 2017(r316631) @@ -728,7 +728,7 @@ route_output(struct mbuf *m, struct sock if (info.rti_info[RTAX_NETMASK] == NULL && rtm->rtm_type == RTM_GET) { /* -* Provide logest prefix match for +* Provide longest prefix match for * address lookup (no mask). * 'route -n get addr' */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316630 - head/sys/sys
Author: pkelsey Date: Sat Apr 8 04:34:18 2017 New Revision: 316630 URL: https://svnweb.freebsd.org/changeset/base/316630 Log: Fix typo. hist -> hint MFC after:3 days Modified: head/sys/sys/event.h Modified: head/sys/sys/event.h == --- head/sys/sys/event.hFri Apr 7 23:37:22 2017(r316629) +++ head/sys/sys/event.hSat Apr 8 04:34:18 2017(r316630) @@ -173,7 +173,7 @@ struct knlist { #defineKNF_LISTLOCKED 0x0001 /* knlist is locked */ #defineKNF_NOKQLOCK0x0002 /* do not keep KQ_LOCK */ -#define KNOTE(list, hist, flags) knote(list, hist, flags) +#define KNOTE(list, hint, flags) knote(list, hint, flags) #define KNOTE_LOCKED(list, hint) knote(list, hint, KNF_LISTLOCKED) #define KNOTE_UNLOCKED(list, hint) knote(list, hint, 0) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r313168 - head/sys/netinet
Author: pkelsey Date: Fri Feb 3 17:02:57 2017 New Revision: 313168 URL: https://svnweb.freebsd.org/changeset/base/313168 Log: Fix VIMAGE-related bugs in TFO. The autokey callout vnet context was not being initialized, and the per-vnet fastopen context was only being initialized for the default vnet. PR: 216613 Reported by: Alex Deiter MFC after:1 week Modified: head/sys/netinet/tcp_fastopen.c head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_fastopen.c == --- head/sys/netinet/tcp_fastopen.c Fri Feb 3 16:57:14 2017 (r313167) +++ head/sys/netinet/tcp_fastopen.c Fri Feb 3 17:02:57 2017 (r313168) @@ -209,6 +209,7 @@ tcp_fastopen_init(void) rm_init(_tcp_fastopen_keylock, "tfo_keylock"); callout_init_rm(_tcp_fastopen_autokey_ctx.c, _tcp_fastopen_keylock, 0); + V_tcp_fastopen_autokey_ctx.v = curvnet; V_tcp_fastopen_keys.newest = TCP_FASTOPEN_MAX_KEYS - 1; } Modified: head/sys/netinet/tcp_subr.c == --- head/sys/netinet/tcp_subr.c Fri Feb 3 16:57:14 2017(r313167) +++ head/sys/netinet/tcp_subr.c Fri Feb 3 17:02:57 2017(r313168) @@ -679,6 +679,10 @@ tcp_init(void) V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); +#ifdef TCP_RFC7413 + tcp_fastopen_init(); +#endif + /* Skip initialization of globals for non-default instances. */ if (!IS_DEFAULT_VNET(curvnet)) return; @@ -732,10 +736,6 @@ tcp_init(void) #ifdef TCPPCAP tcp_pcap_init(); #endif - -#ifdef TCP_RFC7413 - tcp_fastopen_init(); -#endif } #ifdef VIMAGE ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r307337 - head/sys/netinet
Author: pkelsey Date: Sat Oct 15 01:41:28 2016 New Revision: 307337 URL: https://svnweb.freebsd.org/changeset/base/307337 Log: Fix cases where the TFO pending counter would leak references, and eventually, memory. Also renamed some tfo labels and added/reworked comments for clarity. Based on an initial patch from jtl. PR: 213424 Reviewed by: jtl MFC after:1 week Differential Revision:https://reviews.freebsd.org/D8235 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_input.c == --- head/sys/netinet/tcp_input.cSat Oct 15 00:29:15 2016 (r307336) +++ head/sys/netinet/tcp_input.cSat Oct 15 01:41:28 2016 (r307337) @@ -1121,7 +1121,7 @@ relocked: goto dropwithreset; } #ifdef TCP_RFC7413 -new_tfo_socket: +tfo_socket_result: #endif if (so == NULL) { /* @@ -1387,7 +1387,7 @@ new_tfo_socket: tcp_dooptions(, optp, optlen, TO_SYN); #ifdef TCP_RFC7413 if (syncache_add(, , th, inp, , m, NULL, NULL)) - goto new_tfo_socket; + goto tfo_socket_result; #else syncache_add(, , th, inp, , m, NULL, NULL); #endif Modified: head/sys/netinet/tcp_syncache.c == --- head/sys/netinet/tcp_syncache.c Sat Oct 15 00:29:15 2016 (r307336) +++ head/sys/netinet/tcp_syncache.c Sat Oct 15 01:41:28 2016 (r307337) @@ -1151,11 +1151,10 @@ syncache_tfo_expand(struct syncache *sc, * the data, we avoid this DoS scenario. * * The exception to the above is when a SYN with a valid TCP Fast Open (TFO) - * cookie is processed, V_tcp_fastopen_enabled set to true, and the - * TCP_FASTOPEN socket option is set. In this case, a new socket is created - * and returned via lsop, the mbuf is not freed so that tcp_input() can - * queue its data to the socket, and 1 is returned to indicate the - * TFO-socket-creation path was taken. + * cookie is processed and a new socket is created. In this case, any data + * accompanying the SYN will be queued to the socket by tcp_input() and will + * be ACKed either when the application sends response data or the delayed + * ACK timer expires, whichever comes first. */ int syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, @@ -1181,6 +1180,7 @@ syncache_add(struct in_conninfo *inc, st struct ucred *cred; #ifdef TCP_RFC7413 uint64_t tfo_response_cookie; + unsigned int *tfo_pending = NULL; int tfo_cookie_valid = 0; int tfo_response_cookie_valid = 0; #endif @@ -1226,8 +1226,13 @@ syncache_add(struct in_conninfo *inc, st _response_cookie); tfo_cookie_valid = (result > 0); tfo_response_cookie_valid = (result >= 0); - } else - atomic_subtract_int(tp->t_tfo_pending, 1); + } + + /* +* Remember the TFO pending counter as it will have to be +* decremented below if we don't make it to syncache_tfo_expand(). +*/ + tfo_pending = tp->t_tfo_pending; } #endif @@ -1468,9 +1473,9 @@ skip_alloc: #ifdef TCP_RFC7413 if (tfo_cookie_valid) { syncache_tfo_expand(sc, lsop, m, tfo_response_cookie); - /* INP_WUNLOCK(inp) will be performed by the called */ + /* INP_WUNLOCK(inp) will be performed by the caller */ rv = 1; - goto tfo_done; + goto tfo_expanded; } #endif @@ -1496,7 +1501,16 @@ done: m_freem(m); } #ifdef TCP_RFC7413 -tfo_done: + /* +* If tfo_pending is not NULL here, then a TFO SYN that did not +* result in a new socket was processed and the associated pending +* counter has not yet been decremented. All such TFO processing paths +* transit this point. +*/ + if (tfo_pending != NULL) + tcp_fastopen_decrement_counter(tfo_pending); + +tfo_expanded: #endif if (cred != NULL) crfree(cred); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r305169 - head/sys/kern
Author: pkelsey Date: Thu Sep 1 02:05:46 2016 New Revision: 305169 URL: https://svnweb.freebsd.org/changeset/base/305169 Log: _taskqueue_start_threads() now fails if it doesn't actually start any threads. Reviewed by: jhb MFC after:1 week Differential Revision:https://reviews.freebsd.org/D7701 Modified: head/sys/kern/subr_taskqueue.c Modified: head/sys/kern/subr_taskqueue.c == --- head/sys/kern/subr_taskqueue.c Thu Sep 1 01:08:18 2016 (r305168) +++ head/sys/kern/subr_taskqueue.c Thu Sep 1 02:05:46 2016 (r305169) @@ -625,6 +625,11 @@ _taskqueue_start_threads(struct taskqueu } else tq->tq_tcount++; } + if (tq->tq_tcount == 0) { + free(tq->tq_threads, M_TASKQUEUE); + tq->tq_threads = NULL; + return (ENOMEM); + } for (i = 0; i < count; i++) { if (tq->tq_threads[i] == NULL) continue; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r298274 - head/sys/dev/spibus
On Tue, Apr 19, 2016 at 4:41 PM, Patrick Kelsey <pkel...@freebsd.org> wrote: > > > > On Tue, Apr 19, 2016 at 4:38 PM, Adrian Chadd <adrian.ch...@gmail.com> > wrote: > >> On 19 April 2016 at 13:37, Patrick Kelsey <pkel...@freebsd.org> wrote: >> > >> > >> > On Tue, Apr 19, 2016 at 4:21 PM, Ian Lepore <i...@freebsd.org> wrote: >> >> >> >> On Tue, 2016-04-19 at 13:17 -0700, Juli Mallett wrote: >> >> > Patrick Kelsey offered an mmcspi driver for FreeBSD, but nobody >> >> > seemed >> >> > interested. I know of one proprietary branch of FreeBSD using it. >> >> > You might poke him if you want to know how he dealt with this, and if >> >> > you want to commit his driver. >> >> > >> >> >> >> Patrick is a committer, maybe he should just commit it. :) >> > >> > >> > What I believe originally held up that driver being committed (by >> others - >> > this was before my commit bit) was that I relied on some out-of-tree >> spibus >> > changes Luiz had made (as I recall, mainly being able to reserve the >> SPI bus >> > for multiple transactions), and getting those into the tree would have >> > required updating/testing other existing SPI drivers, based on feedback >> I >> > received at the time. All I had was the RB450G that I developed and >> tested >> > the driver with, so I really couldn't address that issue, and then work >> took >> > me in some other direction entirely. Some or all of these spibus >> changes >> > that I relied on might now be in the tree, I'm not sure offhand. I am >> sure >> > though that a huge stack of other things I need to get through has >> > chronically kept me from updating that driver to current and retesting. >> > >> > When I wrote that driver, I put a lot of effort into testing it against >> as >> > many different cards as I could obtain at the time - I believe 30 or so >> in >> > total, all the details are in the code that was posted to the list back >> > then. I encountered a number of strange/unexpected behaviors in that >> set of >> > cards, and all of that hard-won knowledge is in that driver, including a >> > much less complex fix for a shifted-response-data issue than you will >> see if >> > you look at the Linux mmcpsi driver (as I recall, the Linux driver has >> code >> > to arbitrarily bit-shift card response data, and to detect when that >> should >> > be done, but it turns out that can be avoided entirely by inserting idle >> > cycles in the right place when sending the command). >> >> Well, we should add the SPI bus reservation code and churn stuff as >> needed. I think that'd be a great addition. >> >> Do you have a patchset somewhere? >> >> > > Just going from memory here - there is what I posted to the list, then at > some point Luiz took a stab at updating it to then-current (I should have a > copy of those somewhere - not sure where else they went, if anywhere), and > beyond that, I think there's a harmless but unnecessary conditional in the > original code that could be removed. > > > For reference, my original patchset and the work-in-progress update Luiz sent me a few months later are now available at https://people.freebsd.org/~pkelsey/mmcspi/ -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r298274 - head/sys/dev/spibus
On Tue, Apr 19, 2016 at 4:38 PM, Adrian Chadd <adrian.ch...@gmail.com> wrote: > On 19 April 2016 at 13:37, Patrick Kelsey <pkel...@freebsd.org> wrote: > > > > > > On Tue, Apr 19, 2016 at 4:21 PM, Ian Lepore <i...@freebsd.org> wrote: > >> > >> On Tue, 2016-04-19 at 13:17 -0700, Juli Mallett wrote: > >> > Patrick Kelsey offered an mmcspi driver for FreeBSD, but nobody > >> > seemed > >> > interested. I know of one proprietary branch of FreeBSD using it. > >> > You might poke him if you want to know how he dealt with this, and if > >> > you want to commit his driver. > >> > > >> > >> Patrick is a committer, maybe he should just commit it. :) > > > > > > What I believe originally held up that driver being committed (by others > - > > this was before my commit bit) was that I relied on some out-of-tree > spibus > > changes Luiz had made (as I recall, mainly being able to reserve the SPI > bus > > for multiple transactions), and getting those into the tree would have > > required updating/testing other existing SPI drivers, based on feedback I > > received at the time. All I had was the RB450G that I developed and > tested > > the driver with, so I really couldn't address that issue, and then work > took > > me in some other direction entirely. Some or all of these spibus changes > > that I relied on might now be in the tree, I'm not sure offhand. I am > sure > > though that a huge stack of other things I need to get through has > > chronically kept me from updating that driver to current and retesting. > > > > When I wrote that driver, I put a lot of effort into testing it against > as > > many different cards as I could obtain at the time - I believe 30 or so > in > > total, all the details are in the code that was posted to the list back > > then. I encountered a number of strange/unexpected behaviors in that > set of > > cards, and all of that hard-won knowledge is in that driver, including a > > much less complex fix for a shifted-response-data issue than you will > see if > > you look at the Linux mmcpsi driver (as I recall, the Linux driver has > code > > to arbitrarily bit-shift card response data, and to detect when that > should > > be done, but it turns out that can be avoided entirely by inserting idle > > cycles in the right place when sending the command). > > Well, we should add the SPI bus reservation code and churn stuff as > needed. I think that'd be a great addition. > > Do you have a patchset somewhere? > > Just going from memory here - there is what I posted to the list, then at some point Luiz took a stab at updating it to then-current (I should have a copy of those somewhere - not sure where else they went, if anywhere), and beyond that, I think there's a harmless but unnecessary conditional in the original code that could be removed. -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r298274 - head/sys/dev/spibus
On Tue, Apr 19, 2016 at 4:21 PM, Ian Lepore <i...@freebsd.org> wrote: > On Tue, 2016-04-19 at 13:17 -0700, Juli Mallett wrote: > > Patrick Kelsey offered an mmcspi driver for FreeBSD, but nobody > > seemed > > interested. I know of one proprietary branch of FreeBSD using it. > > You might poke him if you want to know how he dealt with this, and if > > you want to commit his driver. > > > > Patrick is a committer, maybe he should just commit it. :) > What I believe originally held up that driver being committed (by others - this was before my commit bit) was that I relied on some out-of-tree spibus changes Luiz had made (as I recall, mainly being able to reserve the SPI bus for multiple transactions), and getting those into the tree would have required updating/testing other existing SPI drivers, based on feedback I received at the time. All I had was the RB450G that I developed and tested the driver with, so I really couldn't address that issue, and then work took me in some other direction entirely. Some or all of these spibus changes that I relied on might now be in the tree, I'm not sure offhand. I am sure though that a huge stack of other things I need to get through has chronically kept me from updating that driver to current and retesting. When I wrote that driver, I put a lot of effort into testing it against as many different cards as I could obtain at the time - I believe 30 or so in total, all the details are in the code that was posted to the list back then. I encountered a number of strange/unexpected behaviors in that set of cards, and all of that hard-won knowledge is in that driver, including a much less complex fix for a shifted-response-data issue than you will see if you look at the Linux mmcpsi driver (as I recall, the Linux driver has code to arbitrarily bit-shift card response data, and to detect when that should be done, but it turns out that can be avoided entirely by inserting idle cycles in the right place when sending the command). -Patrick ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r292706 - in head/sys: conf netinet
Author: pkelsey Date: Thu Dec 24 19:09:48 2015 New Revision: 292706 URL: https://svnweb.freebsd.org/changeset/base/292706 Log: Implementation of server-side TCP Fast Open (TFO) [RFC7413]. TFO is disabled by default in the kernel build. See the top comment in sys/netinet/tcp_fastopen.c for implementation particulars. Reviewed by: gnn, jch, stas MFC after:3 days Sponsored by: Verisign, Inc. Differential Revision:https://reviews.freebsd.org/D4350 Added: head/sys/netinet/tcp_fastopen.c (contents, props changed) head/sys/netinet/tcp_fastopen.h (contents, props changed) Modified: head/sys/conf/files head/sys/conf/options head/sys/netinet/tcp.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_syncache.h head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h Modified: head/sys/conf/files == --- head/sys/conf/files Thu Dec 24 18:53:17 2015(r292705) +++ head/sys/conf/files Thu Dec 24 19:09:48 2015(r292706) @@ -3688,6 +3688,7 @@ netinet/sctp_usrreq.c optional inet sct netinet/sctputil.c optional inet sctp | inet6 sctp netinet/siftr.coptional inet siftr alq | inet6 siftr alq netinet/tcp_debug.coptional tcpdebug +netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 netinet/tcp_hostcache.coptional inet | inet6 netinet/tcp_input.coptional inet | inet6 netinet/tcp_lro.c optional inet | inet6 Modified: head/sys/conf/options == --- head/sys/conf/options Thu Dec 24 18:53:17 2015(r292705) +++ head/sys/conf/options Thu Dec 24 19:09:48 2015(r292706) @@ -440,6 +440,8 @@ TCPDEBUG TCPPCAPopt_global.h SIFTR TCP_OFFLOADopt_inet.h # Enable code to dispatch TCP offloading +TCP_RFC7413opt_inet.h +TCP_RFC7413_MAX_KEYS opt_inet.h TCP_SIGNATURE opt_inet.h VLAN_ARRAY opt_vlan.h XBONEHACK Modified: head/sys/netinet/tcp.h == --- head/sys/netinet/tcp.h Thu Dec 24 18:53:17 2015(r292705) +++ head/sys/netinet/tcp.h Thu Dec 24 19:09:48 2015(r292706) @@ -97,6 +97,10 @@ struct tcphdr { #defineTCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ #defineTCPOPT_SIGNATURE19 /* Keyed MD5: RFC 2385 */ #define TCPOLEN_SIGNATURE18 +#defineTCPOPT_FAST_OPEN34 +#define TCPOLEN_FAST_OPEN_EMPTY 2 +#define TCPOLEN_FAST_OPEN_MIN6 +#define TCPOLEN_FAST_OPEN_MAX18 /* Miscellaneous constants */ #defineMAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ @@ -165,6 +169,7 @@ struct tcphdr { #defineTCP_KEEPIDLE256 /* L,N,X start keeplives after this period */ #defineTCP_KEEPINTVL 512 /* L,N interval between keepalives */ #defineTCP_KEEPCNT 1024/* L,N number of keepalives before close */ +#defineTCP_FASTOPEN1025/* enable TFO / was created via TFO */ #defineTCP_PCAP_OUT2048/* number of output packets to keep */ #defineTCP_PCAP_IN 4096/* number of input packets to keep */ #define TCP_FUNCTION_BLK 8192 /* Set the tcp function pointers to the specified stack */ Added: head/sys/netinet/tcp_fastopen.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/tcp_fastopen.c Thu Dec 24 19:09:48 2015 (r292706) @@ -0,0 +1,442 @@ +/*- + * Copyright (c) 2015 Patrick Kelsey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING
svn commit: r286027 - in head/sys: netinet sys
Author: pkelsey Date: Wed Jul 29 17:59:13 2015 New Revision: 286027 URL: https://svnweb.freebsd.org/changeset/base/286027 Log: Revert r265338, r271089 and r271123 as those changes do not handle non-inline urgent data and introduce an mbuf exhaustion attack vector similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs. Address the issue described in FreeBSD-SA-15:15.tcp. Reviewed by: glebius Approved by: so Approved by: jmallett (mentor) Security: FreeBSD-SA-15:15.tcp Sponsored by: Norse Corp, Inc. Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h head/sys/sys/mbuf.h Modified: head/sys/netinet/tcp_input.c == --- head/sys/netinet/tcp_input.cWed Jul 29 17:50:14 2015 (r286026) +++ head/sys/netinet/tcp_input.cWed Jul 29 17:59:13 2015 (r286027) @@ -1665,7 +1665,8 @@ tcp_do_segment(struct mbuf *m, struct tc tp-snd_nxt == tp-snd_max tiwin tiwin == tp-snd_wnd ((tp-t_flags (TF_NEEDSYN|TF_NEEDFIN)) == 0) - tp-t_segq == NULL ((to.to_flags TOF_TS) == 0 || + LIST_EMPTY(tp-t_segq) + ((to.to_flags TOF_TS) == 0 || TSTMP_GEQ(to.to_tsval, tp-ts_recent)) ) { /* @@ -2903,7 +2904,8 @@ dodata: /* XXX */ * immediately when segments are out of order (so * fast retransmit can work). */ - if (th-th_seq == tp-rcv_nxt tp-t_segq == NULL + if (th-th_seq == tp-rcv_nxt + LIST_EMPTY(tp-t_segq) TCPS_HAVEESTABLISHED(tp-t_state)) { if (DELAY_ACK(tp, tlen)) tp-t_flags |= TF_DELACK; Modified: head/sys/netinet/tcp_reass.c == --- head/sys/netinet/tcp_reass.cWed Jul 29 17:50:14 2015 (r286026) +++ head/sys/netinet/tcp_reass.cWed Jul 29 17:59:13 2015 (r286027) @@ -71,33 +71,80 @@ __FBSDID($FreeBSD$); #include netinet/tcp_var.h #include netinet6/tcp6_var.h #include netinet/tcpip.h +#ifdef TCPDEBUG +#include netinet/tcp_debug.h +#endif /* TCPDEBUG */ + +static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, +TCP Segment Reassembly Queue); + +static int tcp_reass_maxseg = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, +tcp_reass_maxseg, 0, +Global maximum number of TCP Segments in Reassembly Queue); + +static uma_zone_t tcp_reass_zone; +SYSCTL_UMA_CUR(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_VNET, +tcp_reass_zone, +Global number of TCP Segments currently in Reassembly Queue); + +/* Initialize TCP reassembly queue */ +static void +tcp_reass_zone_change(void *tag) +{ + + /* Set the zone limit and read back the effective value. */ + tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); +} + +void +tcp_reass_global_init(void) +{ + + tcp_reass_maxseg = nmbclusters / 16; + TUNABLE_INT_FETCH(net.inet.tcp.reass.maxsegments, + tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate(tcpreass, sizeof (struct tseg_qent), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + /* Set the zone limit and read back the effective value. */ + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); + EVENTHANDLER_REGISTER(nmbclusters_change, + tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); +} void tcp_reass_flush(struct tcpcb *tp) { - struct mbuf *m; + struct tseg_qent *qe; INP_WLOCK_ASSERT(tp-t_inpcb); - while ((m = tp-t_segq) != NULL) { - tp-t_segq = m-m_nextpkt; - tp-t_segqlen -= m-m_pkthdr.len; - m_freem(m); + while ((qe = LIST_FIRST(tp-t_segq)) != NULL) { + LIST_REMOVE(qe, tqe_q); + m_freem(qe-tqe_m); + uma_zfree(tcp_reass_zone, qe); + tp-t_segqlen--; } KASSERT((tp-t_segqlen == 0), - (TCP reass queue %p length is %d instead of 0 after flush., + (TCP reass queue %p segment count is %d instead of 0 after flush., tp, tp-t_segqlen)); } -#defineM_TCPHDR(m) ((struct tcphdr *)((m)-m_pkthdr.pkt_tcphdr)) - int tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { + struct tseg_qent *q; + struct tseg_qent *p = NULL; + struct tseg_qent *nq; + struct tseg_qent *te = NULL; struct socket *so = tp-t_inpcb-inp_socket; - struct mbuf *mq, *mp; - int flags, wakeup; +
Re: svn commit: r286027 - in head/sys: netinet sys
On Wed, Jul 29, 2015 at 2:43 PM, Shawn Webb shawn.w...@hardenedbsd.org wrote: On Wednesday, 29 July 2015 05:59:14 PM Patrick Kelsey wrote: Author: pkelsey Date: Wed Jul 29 17:59:13 2015 New Revision: 286027 URL: https://svnweb.freebsd.org/changeset/base/286027 Log: Revert r265338, r271089 and r271123 as those changes do not handle non-inline urgent data and introduce an mbuf exhaustion attack vector similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs. Address the issue described in FreeBSD-SA-15:15.tcp. Reviewed by:glebius Approved by:so Approved by:jmallett (mentor) Security: FreeBSD-SA-15:15.tcp Sponsored by: Norse Corp, Inc. Does this commit need to be MFC'd to stable/10? Or is this only for HEAD? The reverted revisions were only on HEAD after stable/10 was created and never MFC'd. stable/10 only required the fix for FreeBSD-SA-15:15.tcp, which was committed in r285976. -Patrick ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285657 - head/sys/netinet
Author: pkelsey Date: Fri Jul 17 17:36:33 2015 New Revision: 285657 URL: https://svnweb.freebsd.org/changeset/base/285657 Log: Check TCP timestamp option flag so that the automatic receive buffer scaling code does not use an uninitialized timestamp echo reply value from the stack when timestamps are not enabled. Differential Revision: https://reviews.freebsd.org/D3060 Reviewed by: hiren Approved by: jmallett (mentor) MFC after:3 days Sponsored by: Norse Corp, Inc. Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c == --- head/sys/netinet/tcp_input.cFri Jul 17 16:34:01 2015 (r285656) +++ head/sys/netinet/tcp_input.cFri Jul 17 17:36:33 2015 (r285657) @@ -1856,6 +1856,7 @@ tcp_do_segment(struct mbuf *m, struct tc * the buffer to better manage the socket buffer resources. */ if (V_tcp_do_autorcvbuf + (to.to_flags TOF_TS) to.to_tsecr (so-so_rcv.sb_flags SB_AUTOSIZE)) { if (TSTMP_GT(to.to_tsecr, tp-rfbuf_ts) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285590 - head/sys/dev/ixgbe
Author: pkelsey Date: Wed Jul 15 00:35:50 2015 New Revision: 285590 URL: https://svnweb.freebsd.org/changeset/base/285590 Log: Fix igxbe SRIOV VF (if_ixv) initialization bugs. The MAC address for an if_ixv instance can now set at creation time, and the receive ring tail pointer is correctly initialized (previously, things still worked because the receive ring tail pointer was being fixed up as a side effect of other activity). Differential Revision: https://reviews.freebsd.org/D2922 Reviewed by: erj, gnn Approved by: jmallett (mentor) Sponsored by: Norse Corp, Inc. Modified: head/sys/dev/ixgbe/if_ix.c head/sys/dev/ixgbe/if_ixv.c head/sys/dev/ixgbe/ixgbe_vf.c Modified: head/sys/dev/ixgbe/if_ix.c == --- head/sys/dev/ixgbe/if_ix.c Tue Jul 14 23:49:29 2015(r285589) +++ head/sys/dev/ixgbe/if_ix.c Wed Jul 15 00:35:50 2015(r285590) @@ -5273,10 +5273,10 @@ ixgbe_vf_api_negotiate(struct adapter *a uint32_t *msg) { - switch (msg[0]) { + switch (msg[1]) { case IXGBE_API_VER_1_0: case IXGBE_API_VER_1_1: - vf-api_ver = msg[0]; + vf-api_ver = msg[1]; ixgbe_send_vf_ack(adapter, vf, msg[0]); break; default: Modified: head/sys/dev/ixgbe/if_ixv.c == --- head/sys/dev/ixgbe/if_ixv.c Tue Jul 14 23:49:29 2015(r285589) +++ head/sys/dev/ixgbe/if_ixv.c Wed Jul 15 00:35:50 2015(r285590) @@ -1665,10 +1665,6 @@ ixv_initialize_receive_units(struct adap reg |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF; IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(i), reg); - /* Set the Tail Pointer */ - IXGBE_WRITE_REG(hw, IXGBE_VFRDT(rxr-me), - adapter-num_rx_desc - 1); - /* Set the processing limit */ rxr-process_limit = ixv_rx_process_limit; @@ -1687,6 +1683,10 @@ ixv_initialize_receive_units(struct adap msec_delay(1); } wmb(); + + /* Set the Tail Pointer */ + IXGBE_WRITE_REG(hw, IXGBE_VFRDT(rxr-me), + adapter-num_rx_desc - 1); } rxcsum = IXGBE_READ_REG(hw, IXGBE_RXCSUM); Modified: head/sys/dev/ixgbe/ixgbe_vf.c == --- head/sys/dev/ixgbe/ixgbe_vf.c Tue Jul 14 23:49:29 2015 (r285589) +++ head/sys/dev/ixgbe/ixgbe_vf.c Wed Jul 15 00:35:50 2015 (r285590) @@ -225,6 +225,8 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *h if (ret_val) return ret_val; + msgbuf[0] = ~IXGBE_VT_MSGTYPE_CTS; + if (msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK) msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_NACK)) return IXGBE_ERR_INVALID_MAC_ADDR; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285592 - in head/sys: amd64/conf dev/ixgbe dev/netmap
Author: pkelsey Date: Wed Jul 15 01:02:01 2015 New Revision: 285592 URL: https://svnweb.freebsd.org/changeset/base/285592 Log: Add netmap support for ixgbe SRIOV VFs (that is, to if_ixv). Differential Revision: https://reviews.freebsd.org/D2923 Reviewed by: erj, gnn Approved by: jmallett (mentor) Sponsored by: Norse Corp, Inc. Modified: head/sys/amd64/conf/GENERIC head/sys/dev/ixgbe/if_ix.c head/sys/dev/ixgbe/if_ixv.c head/sys/dev/ixgbe/ixgbe.h head/sys/dev/netmap/ixgbe_netmap.h Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Wed Jul 15 01:01:17 2015(r285591) +++ head/sys/amd64/conf/GENERIC Wed Jul 15 01:02:01 2015(r285592) @@ -362,7 +362,7 @@ device xenpci # Xen HVM Hypervisor se device vmx # VMware VMXNET3 Ethernet # Netmap provides direct access to TX/RX rings on supported NICs -device netmap # netmap(4) support +# device netmap # netmap(4) support # The crypto framework is required by IPSEC device crypto # Required by IPSEC Modified: head/sys/dev/ixgbe/if_ix.c == --- head/sys/dev/ixgbe/if_ix.c Wed Jul 15 01:01:17 2015(r285591) +++ head/sys/dev/ixgbe/if_ix.c Wed Jul 15 01:02:01 2015(r285592) @@ -442,6 +442,11 @@ ixgbe_attach(device_t dev) adapter-dev = adapter-osdep.dev = dev; hw = adapter-hw; +#ifdef DEV_NETMAP + adapter-init_locked = ixgbe_init_locked; + adapter-stop_locked = ixgbe_stop; +#endif + /* Core Lock Init*/ IXGBE_CORE_LOCK_INIT(adapter, device_get_nameunit(dev)); Modified: head/sys/dev/ixgbe/if_ixv.c == --- head/sys/dev/ixgbe/if_ixv.c Wed Jul 15 01:01:17 2015(r285591) +++ head/sys/dev/ixgbe/if_ixv.c Wed Jul 15 01:02:01 2015(r285592) @@ -124,6 +124,18 @@ static voidixv_msix_mbx(void *); static voidixv_handle_que(void *, int); static voidixv_handle_mbx(void *, int); +#ifdef DEV_NETMAP +/* + * This is defined in dev/netmap/ixgbe_netmap.h, which is included by + * if_ix.c. + */ +extern void ixgbe_netmap_attach(struct adapter *adapter); + +#include net/netmap.h +#include sys/selinfo.h +#include dev/netmap/netmap_kern.h +#endif /* DEV_NETMAP */ + /* * FreeBSD Device Interface Entry Points */ @@ -145,6 +157,9 @@ devclass_t ixv_devclass; DRIVER_MODULE(ixv, pci, ixv_driver, ixv_devclass, 0, 0); MODULE_DEPEND(ixv, pci, 1, 1, 1); MODULE_DEPEND(ixv, ether, 1, 1, 1); +#ifdef DEV_NETMAP +MODULE_DEPEND(ix, netmap, 1, 1, 1); +#endif /* DEV_NETMAP */ /* XXX depend on 'ix' ? */ /* @@ -278,6 +293,11 @@ ixv_attach(device_t dev) adapter-dev = adapter-osdep.dev = dev; hw = adapter-hw; +#ifdef DEV_NETMAP + adapter-init_locked = ixv_init_locked; + adapter-stop_locked = ixv_stop; +#endif + /* Core Lock Init*/ IXGBE_CORE_LOCK_INIT(adapter, device_get_nameunit(dev)); @@ -381,6 +401,9 @@ ixv_attach(device_t dev) adapter-vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, ixv_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); +#ifdef DEV_NETMAP + ixgbe_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT(ixv_attach: end); return (0); @@ -444,6 +467,9 @@ ixv_detach(device_t dev) ether_ifdetach(adapter-ifp); callout_drain(adapter-timer); +#ifdef DEV_NETMAP + netmap_detach(adapter-ifp); +#endif /* DEV_NETMAP */ ixv_free_pci_resources(adapter); bus_generic_detach(dev); if_free(adapter-ifp); @@ -1685,8 +1711,33 @@ ixv_initialize_receive_units(struct adap wmb(); /* Set the Tail Pointer */ - IXGBE_WRITE_REG(hw, IXGBE_VFRDT(rxr-me), - adapter-num_rx_desc - 1); +#ifdef DEV_NETMAP + /* +* In netmap mode, we must preserve the buffers made +* available to userspace before the if_init() +* (this is true by default on the TX side, because +* init makes all buffers available to userspace). +* +* netmap_reset() and the device specific routines +* (e.g. ixgbe_setup_receive_rings()) map these +* buffers at the end of the NIC ring, so here we +* must set the RDT (tail) register to make sure +* they are not overwritten. +* +* In this driver the NIC ring starts at RDH = 0, +* RDT points to the last slot available for reception
svn commit: r285593 - head/sys/amd64/conf
Author: pkelsey Date: Wed Jul 15 01:04:54 2015 New Revision: 285593 URL: https://svnweb.freebsd.org/changeset/base/285593 Log: Revert inadvertent change to amd64/GENERIC. Modified: head/sys/amd64/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Wed Jul 15 01:02:01 2015(r285592) +++ head/sys/amd64/conf/GENERIC Wed Jul 15 01:04:54 2015(r285593) @@ -362,7 +362,7 @@ device xenpci # Xen HVM Hypervisor se device vmx # VMware VMXNET3 Ethernet # Netmap provides direct access to TX/RX rings on supported NICs -# device netmap # netmap(4) support +device netmap # netmap(4) support # The crypto framework is required by IPSEC device crypto # Required by IPSEC ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r285349 - in head/sys: dev/cxgbe dev/e1000 dev/ixgbe dev/netmap dev/re net
Thanks for the update, Luigi! For the record, the exclusive open was Juli Mallett's idea for the solutions you mention - I was just the first +1. -Patrick On Fri, Jul 10, 2015 at 1:51 AM, Luigi Rizzo lu...@freebsd.org wrote: Author: luigi Date: Fri Jul 10 05:51:36 2015 New Revision: 285349 URL: https://svnweb.freebsd.org/changeset/base/285349 Log: Sync netmap sources with the version in our private tree. This commit contains large contributions from Giuseppe Lettieri and Stefano Garzarella, is partly supported by grants from Verisign and Cisco, and brings in the following: - fix zerocopy monitor ports and introduce copying monitor ports (the latter are lower performance but give access to all traffic in parallel with the application) - exclusive open mode, useful to implement solutions that recover from crashes of the main netmap client (suggested by Patrick Kelsey) - revised memory allocator in preparation for the 'passthrough mode' (ptnetmap) recently presented at bsdcan. ptnetmap is described in S. Garzarella, G. Lettieri, L. Rizzo; Virtual device passthrough for high speed VM networking, ACM/IEEE ANCS 2015, Oakland (CA) May 2015 http://info.iet.unipi.it/~luigi/research.html - fix rx CRC handing on ixl - add module dependencies for netmap when building drivers as modules - minor simplifications to device-specific routines (*txsync, *rxsync) - general code cleanup (remove unused variables, introduce macros to access rings and remove duplicate code, Applications do not need to be recompiled, unless of course they want to use the new features (monitors and exclusive open). Those willing to try this code on stable/10 can just update the sys/dev/netmap/*, sys/net/netmap* with the version in HEAD and apply the small patches to individual device drivers. MFC after:1 month Sponsored by: (partly) Verisign, Cisco Modified: head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/ixgbe/if_ix.c head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_ixl_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/if_vtnet_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mem2.c head/sys/dev/netmap/netmap_mem2.h head/sys/dev/netmap/netmap_monitor.c head/sys/dev/netmap/netmap_pipe.c head/sys/dev/netmap/netmap_vale.c head/sys/dev/re/if_re.c head/sys/net/netmap.h head/sys/net/netmap_user.h Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cFri Jul 10 05:07:18 2015 (r285348) +++ head/sys/dev/cxgbe/t4_main.cFri Jul 10 05:51:36 2015 (r285349) @@ -8533,10 +8533,17 @@ static devclass_t cxgbe_devclass, cxl_de DRIVER_MODULE(t4nex, pci, t4_driver, t4_devclass, mod_event, 0); MODULE_VERSION(t4nex, 1); MODULE_DEPEND(t4nex, firmware, 1, 1, 1); +#ifdef DEV_NETMAP +MODULE_DEPEND(t4nex, netmap, 1, 1, 1); +#endif /* DEV_NETMAP */ + DRIVER_MODULE(t5nex, pci, t5_driver, t5_devclass, mod_event, 0); MODULE_VERSION(t5nex, 1); MODULE_DEPEND(t5nex, firmware, 1, 1, 1); +#ifdef DEV_NETMAP +MODULE_DEPEND(t5nex, netmap, 1, 1, 1); +#endif /* DEV_NETMAP */ DRIVER_MODULE(cxgbe, t4nex, cxgbe_driver, cxgbe_devclass, 0, 0); MODULE_VERSION(cxgbe, 1); Modified: head/sys/dev/cxgbe/t4_netmap.c == --- head/sys/dev/cxgbe/t4_netmap.c Fri Jul 10 05:07:18 2015 (r285348) +++ head/sys/dev/cxgbe/t4_netmap.c Fri Jul 10 05:51:36 2015 (r285349) @@ -917,8 +917,6 @@ cxgbe_netmap_txsync(struct netmap_kring kring-nr_hwtail -= kring-nkr_num_slots; } - nm_txsync_finalize(kring); - return (0); } @@ -931,7 +929,7 @@ cxgbe_netmap_rxsync(struct netmap_kring struct port_info *pi = ifp-if_softc; struct adapter *sc = pi-adapter; struct sge_nm_rxq *nm_rxq = sc-sge.nm_rxq[pi-first_nm_rxq + kring-ring_id]; - u_int const head = nm_rxsync_prologue(kring); + u_int const head = kring-rhead; u_int n; int force_update = (flags NAF_FORCE_READ) || kring-nr_kflags NKR_PENDINTR; @@ -993,8 +991,6 @@ cxgbe_netmap_rxsync(struct netmap_kring } } - nm_rxsync_finalize(kring); - return (0); } Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c
Re: svn commit: r285336 - in head/sys: netipsec opencrypto
On Thu, Jul 9, 2015 at 10:45 PM, Warner Losh i...@bsdimp.com wrote: On Jul 9, 2015, at 8:27 PM, George Neville-Neil g...@freebsd.org wrote: On 9 Jul 2015, at 18:26, Peter Wemm wrote: On Thursday, July 09, 2015 06:16:36 PM George V. Neville-Neil wrote: Author: gnn Date: Thu Jul 9 18:16:35 2015 New Revision: 285336 URL: https://svnweb.freebsd.org/changeset/base/285336 Log: Add support for AES modes to IPSec. These modes work both in software only mode and with hardware support on systems that have AESNI instructions. Differential Revision: D2936 Reviewed by:jmg, eri, cognet Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c @@ -953,6 +989,11 @@ esp_output_cb(struct cryptop *crp) case CRYPTO_SHA2_512_HMAC: alen = esph-hashsize/2; break; + case CRYPTO_AES_128_GMAC: + case CRYPTO_AES_192_GMAC: + case CRYPTO_AES_256_GMAC: + alen = esph-hashsize; + break; default: alen = AH_HMAC_HASHLEN; break; This introduces a LINT compile failure: /usr/src/sys/netipsec/xform_esp.c:992:9: error: use of undeclared identifier 'CRYPTO_AES_128_GMAC' case CRYPTO_AES_128_GMAC: ^ /usr/src/sys/netipsec/xform_esp.c:993:9: error: use of undeclared identifier 'CRYPTO_AES_192_GMAC' case CRYPTO_AES_192_GMAC: ^ /usr/src/sys/netipsec/xform_esp.c:994:9: error: use of undeclared identifier 'CRYPTO_AES_256_GMAC' case CRYPTO_AES_256_GMAC: ^ 3 errors generated. --- xform_esp.o --- Apologies, fixed in 285347. BTW The LINT conf in amd64 is ignored. Why? What do you mean? There was some temporary confusion regarding the LINT conf being dynamically generated (and thus properly ignored by svn), now resolved. -Patrick ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285275 - in head: contrib/tcpdump contrib/tcpdump/missing usr.sbin/tcpdump/tcpdump
Author: pkelsey Date: Wed Jul 8 16:19:32 2015 New Revision: 285275 URL: https://svnweb.freebsd.org/changeset/base/285275 Log: MFV r285191: tcpdump 4.7.4. Also, the changes made in r272451 and r272653 that were lost in the merge of 4.6.2 (r276788) have been restored. PR: 199568 Differential Revision: https://reviews.freebsd.org/D3007 Reviewed by: brooks, hiren Approved by: jmallett (mentor) MFC after: 1 month Added: head/contrib/tcpdump/print-ftp.c - copied unchanged from r285191, vendor/tcpdump/dist/print-ftp.c head/contrib/tcpdump/print-geneve.c - copied unchanged from r285191, vendor/tcpdump/dist/print-geneve.c head/contrib/tcpdump/print-http.c - copied unchanged from r285191, vendor/tcpdump/dist/print-http.c head/contrib/tcpdump/print-rtsp.c - copied unchanged from r285191, vendor/tcpdump/dist/print-rtsp.c head/contrib/tcpdump/print-smtp.c - copied unchanged from r285191, vendor/tcpdump/dist/print-smtp.c Deleted: head/contrib/tcpdump/bootp.h Modified: head/contrib/tcpdump/CHANGES head/contrib/tcpdump/CREDITS head/contrib/tcpdump/INSTALL.txt head/contrib/tcpdump/Makefile.in head/contrib/tcpdump/VERSION head/contrib/tcpdump/addrtoname.c head/contrib/tcpdump/addrtoname.h head/contrib/tcpdump/config.guess head/contrib/tcpdump/config.h.in head/contrib/tcpdump/config.sub head/contrib/tcpdump/configure head/contrib/tcpdump/configure.in head/contrib/tcpdump/extract.h head/contrib/tcpdump/interface.h head/contrib/tcpdump/ip.h head/contrib/tcpdump/machdep.c head/contrib/tcpdump/missing/strsep.c head/contrib/tcpdump/mkdep head/contrib/tcpdump/netdissect.h head/contrib/tcpdump/openflow.h head/contrib/tcpdump/oui.c head/contrib/tcpdump/oui.h head/contrib/tcpdump/print-ahcp.c head/contrib/tcpdump/print-aodv.c head/contrib/tcpdump/print-arcnet.c head/contrib/tcpdump/print-arp.c head/contrib/tcpdump/print-ascii.c head/contrib/tcpdump/print-atm.c head/contrib/tcpdump/print-babel.c head/contrib/tcpdump/print-bgp.c head/contrib/tcpdump/print-bootp.c head/contrib/tcpdump/print-cdp.c head/contrib/tcpdump/print-cfm.c head/contrib/tcpdump/print-chdlc.c head/contrib/tcpdump/print-cnfp.c head/contrib/tcpdump/print-dccp.c head/contrib/tcpdump/print-decnet.c head/contrib/tcpdump/print-eigrp.c head/contrib/tcpdump/print-enc.c head/contrib/tcpdump/print-ether.c head/contrib/tcpdump/print-forces.c head/contrib/tcpdump/print-fr.c head/contrib/tcpdump/print-geonet.c head/contrib/tcpdump/print-gre.c head/contrib/tcpdump/print-icmp.c head/contrib/tcpdump/print-icmp6.c head/contrib/tcpdump/print-ip.c head/contrib/tcpdump/print-ip6.c head/contrib/tcpdump/print-ipnet.c head/contrib/tcpdump/print-isoclns.c head/contrib/tcpdump/print-juniper.c head/contrib/tcpdump/print-ldp.c head/contrib/tcpdump/print-lldp.c head/contrib/tcpdump/print-lmp.c head/contrib/tcpdump/print-lspping.c head/contrib/tcpdump/print-lwapp.c head/contrib/tcpdump/print-mobility.c head/contrib/tcpdump/print-mpcp.c head/contrib/tcpdump/print-mpls.c head/contrib/tcpdump/print-nflog.c head/contrib/tcpdump/print-null.c head/contrib/tcpdump/print-olsr.c head/contrib/tcpdump/print-openflow-1.0.c head/contrib/tcpdump/print-openflow.c head/contrib/tcpdump/print-ospf.c head/contrib/tcpdump/print-pflog.c head/contrib/tcpdump/print-pim.c head/contrib/tcpdump/print-ppi.c head/contrib/tcpdump/print-ppp.c head/contrib/tcpdump/print-radius.c head/contrib/tcpdump/print-rpki-rtr.c head/contrib/tcpdump/print-rsvp.c head/contrib/tcpdump/print-sflow.c head/contrib/tcpdump/print-sip.c head/contrib/tcpdump/print-sl.c head/contrib/tcpdump/print-sll.c head/contrib/tcpdump/print-slow.c head/contrib/tcpdump/print-smb.c head/contrib/tcpdump/print-tcp.c head/contrib/tcpdump/print-telnet.c head/contrib/tcpdump/print-udp.c head/contrib/tcpdump/print-vxlan.c head/contrib/tcpdump/print-wb.c head/contrib/tcpdump/print-zeromq.c head/contrib/tcpdump/tcp.h head/contrib/tcpdump/tcpdump.1.in head/contrib/tcpdump/tcpdump.c head/contrib/tcpdump/udp.h head/contrib/tcpdump/util.c head/usr.sbin/tcpdump/tcpdump/Makefile head/usr.sbin/tcpdump/tcpdump/config.h head/usr.sbin/tcpdump/tcpdump/tcpdump.1 Directory Properties: head/contrib/tcpdump/ (props changed) Modified: head/contrib/tcpdump/CHANGES == --- head/contrib/tcpdump/CHANGESWed Jul 8 16:18:28 2015 (r285274) +++ head/contrib/tcpdump/CHANGESWed Jul 8 16:19:32 2015 (r285275) @@ -1,4 +1,35 @@ +Friday April 10, 2015 g...@alum.mit.edu + Summary for 4.7.4 tcpdump release + RPKI to Router Protocol: Fix Segmentation Faults and other problems + RPKI to Router Protocol: print strings with fn_printn() + wb: fix some bounds checks + +Wednesday March 11, 2015 m...@sandelman.ca + Summary for 4.7.3
svn commit: r285273 - in head: share/man/man9 usr.sbin/iovctl
Author: pkelsey Date: Wed Jul 8 16:16:44 2015 New Revision: 285273 URL: https://svnweb.freebsd.org/changeset/base/285273 Log: Replace use of .Po Pc with the preferred .Pq for single line enclosures in iovctl.conf(5), iovctl(8), pci(9), and pci_iov_schema(9). Differential Revision: https://reviews.freebsd.org/D3000 Reviewed by: wblock Approved by: jmallett (mentor) Modified: head/share/man/man9/pci.9 head/share/man/man9/pci_iov_schema.9 head/usr.sbin/iovctl/iovctl.8 head/usr.sbin/iovctl/iovctl.conf.5 Modified: head/share/man/man9/pci.9 == --- head/share/man/man9/pci.9 Wed Jul 8 15:32:59 2015(r285272) +++ head/share/man/man9/pci.9 Wed Jul 8 16:16:44 2015(r285273) @@ -25,7 +25,7 @@ .\ .\ $FreeBSD$ .\ -.Dd May 28, 2015 +.Dd July 8, 2015 .Dt PCI 9 .Os .Sh NAME @@ -445,7 +445,7 @@ The function is used to advertise that the given device .Pq and associated device driver supports PCI Single-Root I/O Virtualization -.Po SR-IOV Pc . +.Pq SR-IOV . A driver that supports SR-IOV must implement the .Xr PCI_IOV_INIT 9 , .Xr PCI_IOV_ADD_VF 9 Modified: head/share/man/man9/pci_iov_schema.9 == --- head/share/man/man9/pci_iov_schema.9Wed Jul 8 15:32:59 2015 (r285272) +++ head/share/man/man9/pci_iov_schema.9Wed Jul 8 16:16:44 2015 (r285273) @@ -25,7 +25,7 @@ .\ .\ $FreeBSD$ .\ -.Dd June 18, 2015 +.Dd July 8, 2015 .Dt PCI_IOV_SCHEMA 9 .Os .Sh NAME @@ -227,7 +227,7 @@ type. Values of type .Vt uint32_t are unsigned integers in the range 0 to -.Po 2**32 - 1 Pc , +.Pq 2**32 - 1 , inclusive. .Pp The @@ -241,7 +241,7 @@ type. Values of type .Vt uint64_t are unsigned integers in the range 0 to -.Po 2**64 - 1 Pc , +.Pq 2**64 - 1 , inclusive. .Pp The Modified: head/usr.sbin/iovctl/iovctl.8 == --- head/usr.sbin/iovctl/iovctl.8 Wed Jul 8 15:32:59 2015 (r285272) +++ head/usr.sbin/iovctl/iovctl.8 Wed Jul 8 16:16:44 2015 (r285273) @@ -25,7 +25,7 @@ .\ .\ $FreeBSD$ .\ -.Dd May 21, 2014 +.Dd July 8, 2015 .Dt IOVCTL 8 .Os .Sh NAME @@ -49,7 +49,7 @@ The utility creates or destroys PCI Single-Root I/O Virtualization .Pq SR-IOV Virtual Functions -.Po VFs Pc . +.Pq VFs . When invoked with the .Fl C flag, Modified: head/usr.sbin/iovctl/iovctl.conf.5 == --- head/usr.sbin/iovctl/iovctl.conf.5 Wed Jul 8 15:32:59 2015 (r285272) +++ head/usr.sbin/iovctl/iovctl.conf.5 Wed Jul 8 16:16:44 2015 (r285273) @@ -25,7 +25,7 @@ .\ .\ $FreeBSD$ .\ -.Dd July 5, 2015 +.Dd July 8, 2015 .Dt IOVCTL.CONF 5 .Os .Sh NAME @@ -77,7 +77,7 @@ The second section type is the VF sectio This section has the key VF- followed by a VF index. VF indices start at 0 and always increment by 1. Valid VF indices are in the range of 0 to -.Po num_vfs - 1 Pc . +.Pq num_vfs - 1 . The VF index must be given as a decimal integer with no leading zeros. This section defines configuration parameters that apply to a single VF. .Pp @@ -108,11 +108,11 @@ Accepts any integer in the range 0 to 25 Accepts any integer in the range 0 to 65535, inclusive. .It uint32_t Accepts any integer in the range 0 to -.Po 2**32 - 1 Pc , +.Pq 2**32 - 1 , inclusive. .It uint64_t Accepts any integer in the range 0 to -.Po 2**64 - 1 Pc , +.Pq 2**64 - 1 , inclusive. .El .Sh OPTIONS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285299 - head/contrib/tcpdump
Author: pkelsey Date: Wed Jul 8 23:57:58 2015 New Revision: 285299 URL: https://svnweb.freebsd.org/changeset/base/285299 Log: MFV r285292: Merge upstream fix to eliminate build-breaking gcc warnings of no importance. commit: cab33b7a0acba7d2268a23c4383be6167106e549 Update ND_TTEST2 to fix issue 443 Add IS_NOT_NEGATIVE macro. Avoid these warnings: - comparison of unsigned expression = 0 is always true [-Wtype-limits], - comparison is always true due to limited range of data type [-Wtype-limits]. Reviewed by: adrian Approved by: jmallett (mentor) MFC after: 1 month Modified: head/contrib/tcpdump/netdissect.h Directory Properties: head/contrib/tcpdump/ (props changed) Modified: head/contrib/tcpdump/netdissect.h == --- head/contrib/tcpdump/netdissect.h Wed Jul 8 23:50:04 2015 (r285298) +++ head/contrib/tcpdump/netdissect.h Wed Jul 8 23:57:58 2015 (r285299) @@ -270,8 +270,11 @@ struct netdissect_options { * * http://www.kb.cert.org/vuls/id/162289 */ + +#define IS_NOT_NEGATIVE(x) (((x) 0) || ((x) == 0)) + #define ND_TTEST2(var, l) \ - ((l) = 0 \ + (IS_NOT_NEGATIVE(l) \ ((uintptr_t)ndo-ndo_snapend - (l) = (uintptr_t)ndo-ndo_snapend \ (uintptr_t)(var) = (uintptr_t)ndo-ndo_snapend - (l))) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285208 - head/sys/kern
Author: pkelsey Date: Mon Jul 6 16:07:21 2015 New Revision: 285208 URL: https://svnweb.freebsd.org/changeset/base/285208 Log: Don't acquire sysctlmemlock in userland_sysctl() when the old value pointer is NULL, as in that case there are no userland pages that could potentially be wired. It is common for old to be NULL and oldlenp to be non-NULL in calls to userland_sysctl(), as this is used to probe for the length of a variable-length sysctl entry before retrieving a value. Note that it is typical for such calls to be made with an uninitialized value in *oldlenp, so sysctlmemlock was essentially being acquired at random (depending on the uninitialized value in *oldlenp being PAGE_SIZE or not) for these calls prior to this patch. Differential Revision: https://reviews.freebsd.org/D2987 Reviewed by: mjg, kib Approved by: jmallett (mentor) MFC after: 1 month Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c == --- head/sys/kern/kern_sysctl.c Mon Jul 6 14:09:00 2015(r285207) +++ head/sys/kern/kern_sysctl.c Mon Jul 6 16:07:21 2015(r285208) @@ -1784,7 +1784,7 @@ userland_sysctl(struct thread *td, int * ktrsysctl(name, namelen); #endif - if (req.oldlen PAGE_SIZE) { + if (req.oldptr req.oldlen PAGE_SIZE) { memlocked = 1; sx_xlock(sysctlmemlock); } else ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285188 - head/lib/libc/gen
Author: pkelsey Date: Mon Jul 6 01:42:12 2015 New Revision: 285188 URL: https://svnweb.freebsd.org/changeset/base/285188 Log: Fix sysctl(3) so it returns the intended values for all mib names in the 'user' sysctl tree, which have all been coming back 0 or empty since r240176. Differential Revision: https://reviews.freebsd.org/D2945 Reviewed by: sbruno Approved by: jmallett (mentor) MFC after: 3 days Modified: head/lib/libc/gen/sysctl.c Modified: head/lib/libc/gen/sysctl.c == --- head/lib/libc/gen/sysctl.c Sun Jul 5 23:24:52 2015(r285187) +++ head/lib/libc/gen/sysctl.c Mon Jul 6 01:42:12 2015(r285188) @@ -51,9 +51,21 @@ sysctl(const int *name, u_int namelen, v const void *newp, size_t newlen) { int retval; + size_t orig_oldlen; + orig_oldlen = oldlenp ? *oldlenp : 0; retval = __sysctl(name, namelen, oldp, oldlenp, newp, newlen); - if (retval != -1 || errno != ENOENT || name[0] != CTL_USER) + /* +* All valid names under CTL_USER have a dummy entry in the sysctl +* tree (to support name lookups and enumerations) with an +* empty/zero value, and the true value is supplied by this routine. +* For all such names, __sysctl() is used solely to validate the +* name. +* +* Return here unless there was a successful lookup for a CTL_USER +* name. +*/ + if (retval || name[0] != CTL_USER) return (retval); if (newp != NULL) { @@ -67,7 +79,7 @@ sysctl(const int *name, u_int namelen, v switch (name[1]) { case USER_CS_PATH: - if (oldp *oldlenp sizeof(_PATH_STDPATH)) { + if (oldp orig_oldlen sizeof(_PATH_STDPATH)) { errno = ENOMEM; return -1; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285189 - head/usr.sbin/iovctl
Author: pkelsey Date: Mon Jul 6 01:48:23 2015 New Revision: 285189 URL: https://svnweb.freebsd.org/changeset/base/285189 Log: Fix range upper bound for uint32_t and uint64_t, and reformat range description for uint8_t, uint16_t, uint32_t, and uint64_t. Differential Revision: https://reviews.freebsd.org/D2988 Reviewed by: rstone, wblock Approved by: jmallett (mentor) Sponsored by: Norse Corp, Inc. Modified: head/usr.sbin/iovctl/iovctl.conf.5 Modified: head/usr.sbin/iovctl/iovctl.conf.5 == --- head/usr.sbin/iovctl/iovctl.conf.5 Mon Jul 6 01:42:12 2015 (r285188) +++ head/usr.sbin/iovctl/iovctl.conf.5 Mon Jul 6 01:48:23 2015 (r285189) @@ -25,7 +25,7 @@ .\ .\ $FreeBSD$ .\ -.Dd May 21, 2014 +.Dd July 5, 2015 .Dt IOVCTL.CONF 5 .Os .Sh NAME @@ -103,13 +103,17 @@ xx:xx:xx:xx:xx:xx, where xx is one or tw .It string Accepts any string value. .It uint8_t -Accepts any integer in the range 0-255, inclusive. +Accepts any integer in the range 0 to 255, inclusive. .It uint16_t -Accepts any integer in the range 0-65535, inclusive. +Accepts any integer in the range 0 to 65535, inclusive. .It uint32_t -Accepts any integer in the range 0-2**32, inclusive. +Accepts any integer in the range 0 to +.Po 2**32 - 1 Pc , +inclusive. .It uint64_t -Accepts any integer in the range 0-2**64, inclusive. +Accepts any integer in the range 0 to +.Po 2**64 - 1 Pc , +inclusive. .El .Sh OPTIONS The following parameters are accepted by all PF drivers: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285190 - head/sys/net
Author: pkelsey Date: Mon Jul 6 02:12:49 2015 New Revision: 285190 URL: https://svnweb.freebsd.org/changeset/base/285190 Log: Fix if_loop so bpfwrite() can use it regardless of the state of bd_hdrcmplt. As if_loop does not use link-level headers, its behavior when used by bpfwrite() should be the same regardless of the state of bd_hdrcmplt. Without this change, libpcap (and other BPF users that work like it) fail when writing to loopback interfaces. Differential Revision: https://reviews.freebsd.org/D2989 Reviewed by: gnn, melifaro Approved by: jmallett (mentor) MFC after: 3 days Modified: head/sys/net/if_loop.c Modified: head/sys/net/if_loop.c == --- head/sys/net/if_loop.c Mon Jul 6 01:48:23 2015(r285189) +++ head/sys/net/if_loop.c Mon Jul 6 02:12:49 2015(r285190) @@ -229,7 +229,7 @@ looutput(struct ifnet *ifp, struct mbuf if_inc_counter(ifp, IFCOUNTER_OBYTES, m-m_pkthdr.len); /* BPF writes need to be handled specially. */ - if (dst-sa_family == AF_UNSPEC) + if (dst-sa_family == AF_UNSPEC || dst-sa_family == pseudo_AF_HDRCMPLT) bcopy(dst-sa_data, af, sizeof(af)); else af = dst-sa_family; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r284891 - head/etc/rc.d
Author: pkelsey Date: Sat Jun 27 18:01:50 2015 New Revision: 284891 URL: https://svnweb.freebsd.org/changeset/base/284891 Log: Use correct flag in iovctl_start(). Differential Revision: https://reviews.freebsd.org/D2921 Reviewed by: rstone Approved by: jmallett (mentor) Sponsored by: Norse Corp, Inc. Modified: head/etc/rc.d/iovctl Modified: head/etc/rc.d/iovctl == --- head/etc/rc.d/iovctlSat Jun 27 15:13:14 2015(r284890) +++ head/etc/rc.d/iovctlSat Jun 27 18:01:50 2015(r284891) @@ -27,7 +27,7 @@ run_iovctl() iovctl_start() { - run_iovctl -E + run_iovctl -C } iovctl_stop() ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r283652 - head/share/man/man3
Author: pkelsey Date: Thu May 28 16:18:41 2015 New Revision: 283652 URL: https://svnweb.freebsd.org/changeset/base/283652 Log: Provide an unambiguous description of the potential hazard in calling pthread_setspecific(3) from a key destructor. Reviewed by: jhb Approved by: jmallett (mentor) MFC after: 3 days Modified: head/share/man/man3/pthread_setspecific.3 Modified: head/share/man/man3/pthread_setspecific.3 == --- head/share/man/man3/pthread_setspecific.3 Thu May 28 16:16:29 2015 (r283651) +++ head/share/man/man3/pthread_setspecific.3 Thu May 28 16:18:41 2015 (r283652) @@ -67,7 +67,10 @@ is undefined. The .Fn pthread_setspecific function may be called from a thread-specific data destructor function, -however this may result in lost storage or infinite loops. +however this may result in lost storage or infinite loops if doing so +causes non-NULL key values to remain after +.Bq PTHREAD_DESTRUCTOR_ITERATIONS +iterations of destructor calls have been made. .Sh RETURN VALUES If successful, the .Fn pthread_setspecific ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r283641 - head/sbin/dhclient
Author: pkelsey Date: Thu May 28 05:38:07 2015 New Revision: 283641 URL: https://svnweb.freebsd.org/changeset/base/283641 Log: Add CAP_FCNTL to the lease file capsicum rights, and limit to CAP_FCNTL_GETFL. Without CAP_FCNTL_GETFL, the lease file truncation in rewrite_client_leases() will fail to trim old data when rewriting the file with a lesser amount of data. Reviewed by: pjd, rwatson Approved by: jmallett (mentor) MFC after: 1 week Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Thu May 28 00:11:36 2015 (r283640) +++ head/sbin/dhclient/dhclient.c Thu May 28 05:38:07 2015 (r283641) @@ -1845,12 +1845,16 @@ rewrite_client_leases(void) leaseFile = fopen(path_dhclient_db, w); if (!leaseFile) error(can't create %s: %m, path_dhclient_db); - cap_rights_init(rights, CAP_FSTAT, CAP_FSYNC, CAP_FTRUNCATE, - CAP_SEEK, CAP_WRITE); + cap_rights_init(rights, CAP_FCNTL, CAP_FSTAT, CAP_FSYNC, + CAP_FTRUNCATE, CAP_SEEK, CAP_WRITE); if (cap_rights_limit(fileno(leaseFile), rights) 0 errno != ENOSYS) { error(can't limit lease descriptor: %m); } + if (cap_fcntls_limit(fileno(leaseFile), CAP_FCNTL_GETFL) 0 + errno != ENOSYS) { + error(can't limit lease descriptor fcntls: %m); + } } else { fflush(leaseFile); rewind(leaseFile); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r283093 - head/share/man/man3
Author: pkelsey Date: Tue May 19 02:24:55 2015 New Revision: 283093 URL: https://svnweb.freebsd.org/changeset/base/283093 Log: Added description of POSIX-specified behavior when invoked on a key from within that key's destructor. Reviewed by: jhb, -doc Approved by: jmallett (mentor) MFC after: 3 days Sponsored by: Norse Corp, Inc. Modified: head/share/man/man3/pthread_getspecific.3 Modified: head/share/man/man3/pthread_getspecific.3 == --- head/share/man/man3/pthread_getspecific.3 Mon May 18 23:46:11 2015 (r283092) +++ head/share/man/man3/pthread_getspecific.3 Tue May 19 02:24:55 2015 (r283093) @@ -64,6 +64,11 @@ is undefined. The .Fn pthread_getspecific function may be called from a thread-specific data destructor function. +A call to +.Fn pthread_getspecific +for the thread-specific data key being destroyed returns the value NULL, +unless the value is changed (after the destructor starts) by a call to +.Fn pthread_setspecific . .Sh RETURN VALUES The .Fn pthread_getspecific ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r282978 - head/sys/dev/netmap
Author: pkelsey Date: Fri May 15 15:36:57 2015 New Revision: 282978 URL: https://svnweb.freebsd.org/changeset/base/282978 Log: When a netmap process terminates without the full set of buffers it was granted via rings and ni_bufs_list_head represented in those rings and lists (e.g., via SIGKILL), those buffers are no longer available for subsequent users for the lifetime of the system. To mitigate this resource leak, reset the allocator state when the last ref to that allocator is released. Note that this only recovers leaked resources for an allocator when there are no longer any users of that allocator, so there remain circumstances in which leaked allocator resources may not ever be recovered - consider a set of multiple netmap processes that are all using the same allocator (say, the global allocator) where members of that set may be killed and restarted over time but at any given point there is one member of that set running. Based on intial work by adrian@. Reviewed by: Giuseppe Lettieri (g.letti...@iet.unipi.it), luigi Approved by: jmallett (mentor) MFC after: 1 week Sponsored by: Norse Corp, Inc. Modified: head/sys/dev/netmap/netmap_mem2.c Modified: head/sys/dev/netmap/netmap_mem2.c == --- head/sys/dev/netmap/netmap_mem2.c Fri May 15 15:13:51 2015 (r282977) +++ head/sys/dev/netmap/netmap_mem2.c Fri May 15 15:36:57 2015 (r282978) @@ -130,9 +130,9 @@ struct netmap_mem_d { /* the three allocators */ struct netmap_obj_pool pools[NETMAP_POOLS_NR]; - netmap_mem_config_t config; - netmap_mem_finalize_t finalize; - netmap_mem_deref_tderef; + netmap_mem_config_t config; /* called with NMA_LOCK held */ + netmap_mem_finalize_t finalize; /* called with NMA_LOCK held */ + netmap_mem_deref_tderef;/* called with NMA_LOCK held */ nm_memid_t nm_id; /* allocator identifier */ int nm_grp; /* iommu groupd id */ @@ -751,6 +751,12 @@ netmap_reset_obj_allocator(struct netmap u_int i; size_t sz = p-_clustsize; + /* +* Free each cluster allocated in +* netmap_finalize_obj_allocator(). The cluster start +* addresses are stored at multiples of p-_clusterentries +* in the lut. +*/ for (i = 0; i p-objtotal; i += p-_clustentries) { if (p-lut[i].vaddr) contigfree(p-lut[i].vaddr, sz, M_NETMAP); @@ -929,6 +935,7 @@ netmap_finalize_obj_allocator(struct net if (i % p-_clustentries == 0 p-lut[i].vaddr) contigfree(p-lut[i].vaddr, n, M_NETMAP); + p-lut[i].vaddr = NULL; } out: p-objtotal = i; @@ -936,6 +943,17 @@ netmap_finalize_obj_allocator(struct net p-numclusters = (i + p-_clustentries - 1) / p-_clustentries; break; } + /* +* Set bitmap and lut state for all buffers in the current +* cluster. +* +* [i, lim) is the set of buffer indexes that cover the +* current cluster. +* +* 'clust' is really the address of the current buffer in +* the current cluster as we index through it with a stride +* of p-_objsize. +*/ for (; i lim; i++, clust += p-_objsize) { p-bitmap[ (i5) ] |= ( 1 (i 31) ); p-lut[i].vaddr = clust; @@ -1092,10 +1110,8 @@ static int netmap_mem_private_finalize(struct netmap_mem_d *nmd) { int err; - NMA_LOCK(nmd); nmd-refcount++; err = netmap_mem_finalize_all(nmd); - NMA_UNLOCK(nmd); return err; } @@ -1103,10 +1119,8 @@ netmap_mem_private_finalize(struct netma static void netmap_mem_private_deref(struct netmap_mem_d *nmd) { - NMA_LOCK(nmd); if (--nmd-refcount = 0) netmap_mem_reset_all(nmd); - NMA_UNLOCK(nmd); } @@ -1242,10 +1256,7 @@ static int netmap_mem_global_finalize(struct netmap_mem_d *nmd) { int err; - - NMA_LOCK(nmd); - - + /* update configuration if changed */ if (netmap_mem_global_config(nmd)) goto out; @@ -1268,8 +1279,6 @@ out: nmd-refcount--; err = nmd-lasterr; - NMA_UNLOCK(nmd); - return err; } @@ -1518,7 +1527,6 @@ netmap_mem_if_delete(struct netmap_adapt static void netmap_mem_global_deref(struct netmap_mem_d *nmd) { - NMA_LOCK(nmd);
svn commit: r266917 - in head: share/misc usr.bin/calendar/calendars
Author: pkelsey Date: Sat May 31 05:16:12 2014 New Revision: 266917 URL: http://svnweb.freebsd.org/changeset/base/266917 Log: - Added myself and mentor/mentee relationship to the src committers graph. - Added my info to the FreeBSD calendar. Approved by: jmallett (mentor) Modified: head/share/misc/committers-src.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-src.dot == --- head/share/misc/committers-src.dot Sat May 31 01:44:11 2014 (r266916) +++ head/share/misc/committers-src.dot Sat May 31 05:16:12 2014 (r266917) @@ -241,6 +241,7 @@ philip [label=Philip Paeps\nphilip@Free phk [label=Poul-Henning Kamp\n...@freebsd.org\n1994/02/21] pho [label=Peter Holm\n...@freebsd.org\n2008/11/16] pjd [label=Pawel Jakub Dawidek\n...@freebsd.org\n2004/02/02] +pkelsey [label=Patrick Kelsey\pkel...@freebsd.org\n2014/05/29] pluknet [label=Sergey Kandaurov\npluk...@freebsd.org\n2010/10/05] ps [label=Paul Saab\n...@freebsd.org\n2000/02/23] qingli [label=Qing Li\nqin...@freebsd.org\n2005/04/13] @@ -509,6 +510,8 @@ jkoshy - rstone jlemon - bmilekic jlemon - brooks +jmallett - pkelsey + joerg - brian joerg - eik joerg - jmg Modified: head/usr.bin/calendar/calendars/calendar.freebsd == --- head/usr.bin/calendar/calendars/calendar.freebsdSat May 31 01:44:11 2014(r266916) +++ head/usr.bin/calendar/calendars/calendar.freebsdSat May 31 05:16:12 2014(r266917) @@ -143,6 +143,7 @@ 05/01 Randall Stewart r...@freebsd.org born in Spokane, Washington, United States, 1959 05/02 Wojciech A. Koszek wkos...@freebsd.org born in Czestochowa, Poland, 1987 05/03 Brian Dean b...@freebsd.org born in Elkins, West Virginia, United States, 1966 +05/03 Patrick Kelsey pkel...@freebsd.org born in Freehold, New Jersey, United States, 1976 05/03 Robert Nicholas Maxwell Watson rwat...@freebsd.org born in Harrow, Middlesex, United Kingdom, 1977 05/04 Denis Peplin d...@freebsd.org born in Nizhniy Novgorod, Russian Federation, 1977 05/08 Kirill Ponomarew kr...@freebsd.org born in Volgograd, Russian Federation, 1977 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org