diff options
author | Eric Joyner <erj@FreeBSD.org> | 2019-03-19 17:59:56 +0000 |
---|---|---|
committer | Eric Joyner <erj@FreeBSD.org> | 2019-03-19 17:59:56 +0000 |
commit | 1b9d93948a37858a81e04a9fca16fef98172063f (patch) | |
tree | 8a2daa892585d2cc950981dfc58d2cc47aae83c8 | |
parent | 3e8d1bae5f49aab7132bd3f4be24867f18d5b103 (diff) |
Notes
-rw-r--r-- | sys/dev/e1000/if_em.c | 9 | ||||
-rw-r--r-- | sys/dev/ixgbe/if_ix.c | 5 | ||||
-rw-r--r-- | sys/dev/ixgbe/if_ixv.c | 9 | ||||
-rw-r--r-- | sys/dev/ixl/if_iavf.c | 6 | ||||
-rw-r--r-- | sys/dev/ixl/ixl_pf_main.c | 5 | ||||
-rw-r--r-- | sys/net/iflib.c | 40 | ||||
-rw-r--r-- | sys/net/iflib.h | 2 | ||||
-rw-r--r-- | sys/sys/param.h | 2 |
8 files changed, 39 insertions, 39 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index e25e102a2da1..c36f7785440b 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1270,14 +1270,7 @@ em_if_init(if_ctx_t ctx) /* Setup Multicast table */ em_if_multi_set(ctx); - /* - * Figure out the desired mbuf - * pool for doing jumbos - */ - if (adapter->hw.mac.max_frame_size <= 2048) - adapter->rx_mbuf_sz = MCLBYTES; - else - adapter->rx_mbuf_sz = MJUMPAGESIZE; + adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); em_initialize_receive_unit(ctx); /* Use real VLAN Filter support? */ diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 75019765bb5a..6a1bd13af6de 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -2880,10 +2880,7 @@ ixgbe_if_init(if_ctx_t ctx) ixgbe_if_multi_set(ctx); /* Determine the correct mbuf pool, based on frame size */ - if (adapter->max_frame_size <= MCLBYTES) - adapter->rx_mbuf_sz = MCLBYTES; - else - adapter->rx_mbuf_sz = MJUMPAGESIZE; + adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); /* Configure RX settings */ ixgbe_initialize_receive_units(ctx); diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 79b7d78d4c73..bad39ab316d3 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -629,14 +629,7 @@ ixv_if_init(if_ctx_t ctx) /* Setup Multicast table */ ixv_if_multi_set(ctx); - /* - * Determine the correct mbuf pool - * for doing jumbo/headersplit - */ - if (ifp->if_mtu > ETHERMTU) - adapter->rx_mbuf_sz = MJUMPAGESIZE; - else - adapter->rx_mbuf_sz = MCLBYTES; + adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); /* Configure RX settings */ ixv_initialize_receive_units(ctx); diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index aa84e5776813..be2b39345849 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -614,7 +614,6 @@ iavf_send_vc_msg(struct iavf_sc *sc, u32 op) static void iavf_init_queues(struct ixl_vsi *vsi) { - if_softc_ctx_t scctx = vsi->shared; struct ixl_tx_queue *tx_que = vsi->tx_queues; struct ixl_rx_queue *rx_que = vsi->rx_queues; struct rx_ring *rxr; @@ -625,10 +624,7 @@ iavf_init_queues(struct ixl_vsi *vsi) for (int i = 0; i < vsi->num_rx_queues; i++, rx_que++) { rxr = &rx_que->rxr; - if (scctx->isc_max_frame_size <= MCLBYTES) - rxr->mbuf_sz = MCLBYTES; - else - rxr->mbuf_sz = MJUMPAGESIZE; + rxr->mbuf_sz = iflib_get_rx_mbuf_sz(vsi->ctx); wr32(vsi->hw, rxr->tail, 0); } diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 3a4a0dc31aff..8182cf210b86 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -1300,10 +1300,7 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) struct i40e_hmc_obj_rxq rctx; /* Next setup the HMC RX Context */ - if (scctx->isc_max_frame_size <= MCLBYTES) - rxr->mbuf_sz = MCLBYTES; - else - rxr->mbuf_sz = MJUMPAGESIZE; + rxr->mbuf_sz = iflib_get_rx_mbuf_sz(vsi->ctx); u16 max_rxmax = rxr->mbuf_sz * hw->func_caps.rx_buf_chain_len; diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 694dd9b632fb..c1f1df1a3874 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -171,6 +171,7 @@ struct iflib_ctx { uint32_t ifc_if_flags; uint32_t ifc_flags; uint32_t ifc_max_fl_buf_size; + uint32_t ifc_rx_mbuf_sz; int ifc_link_state; int ifc_link_irq; @@ -2172,7 +2173,6 @@ 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 sctx = &ctx->ifc_softc_ctx; bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size - 1); /* @@ -2181,14 +2181,7 @@ iflib_fl_setup(iflib_fl_t fl) iflib_fl_bufs_free(fl); /* Now replenish the mbufs */ MPASS(fl->ifl_credits == 0); - /* - * XXX don't set the max_frame_size to larger - * than the hardware can handle - */ - if (sctx->isc_max_frame_size <= 2048) - fl->ifl_buf_size = MCLBYTES; - else - fl->ifl_buf_size = MJUMPAGESIZE; + fl->ifl_buf_size = ctx->ifc_rx_mbuf_sz; 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); @@ -2314,6 +2307,27 @@ iflib_timer(void *arg) } static void +iflib_calc_rx_mbuf_sz(if_ctx_t ctx) +{ + if_softc_ctx_t sctx = &ctx->ifc_softc_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; +} + +uint32_t +iflib_get_rx_mbuf_sz(if_ctx_t ctx) +{ + return (ctx->ifc_rx_mbuf_sz); +} + +static void iflib_init_locked(if_ctx_t ctx) { if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; @@ -2347,6 +2361,14 @@ iflib_init_locked(if_ctx_t ctx) CALLOUT_UNLOCK(txq); iflib_netmap_txq_init(ctx, txq); } + + /* + * Calculate a suitable Rx mbuf size prior to calling IFDI_INIT, so + * that drivers can use the value when setting up the hardware receive + * buffers. + */ + iflib_calc_rx_mbuf_sz(ctx); + #ifdef INVARIANTS i = if_getdrvflags(ifp); #endif diff --git a/sys/net/iflib.h b/sys/net/iflib.h index f8524859391c..5934ccd1deb8 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -381,6 +381,8 @@ void iflib_set_mac(if_ctx_t ctx, uint8_t mac[ETHER_ADDR_LEN]); void iflib_request_reset(if_ctx_t ctx); uint8_t iflib_in_detach(if_ctx_t ctx); +uint32_t iflib_get_rx_mbuf_sz(if_ctx_t ctx); + /* * If the driver can plug cleanly in to newbus use these */ diff --git a/sys/sys/param.h b/sys/sys/param.h index edaac5307a40..309d8c51319a 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300016 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300017 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, |