Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F105785138
D19489.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D19489.diff
View Options
Index: head/sys/dev/e1000/if_em.c
===================================================================
--- head/sys/dev/e1000/if_em.c
+++ head/sys/dev/e1000/if_em.c
@@ -1270,14 +1270,7 @@
/* 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? */
Index: head/sys/dev/ixgbe/if_ix.c
===================================================================
--- head/sys/dev/ixgbe/if_ix.c
+++ head/sys/dev/ixgbe/if_ix.c
@@ -2880,10 +2880,7 @@
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);
Index: head/sys/dev/ixgbe/if_ixv.c
===================================================================
--- head/sys/dev/ixgbe/if_ixv.c
+++ head/sys/dev/ixgbe/if_ixv.c
@@ -629,14 +629,7 @@
/* 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);
Index: head/sys/dev/ixl/if_iavf.c
===================================================================
--- head/sys/dev/ixl/if_iavf.c
+++ head/sys/dev/ixl/if_iavf.c
@@ -614,7 +614,6 @@
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 @@
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);
}
Index: head/sys/dev/ixl/ixl_pf_main.c
===================================================================
--- head/sys/dev/ixl/ixl_pf_main.c
+++ head/sys/dev/ixl/ixl_pf_main.c
@@ -1300,10 +1300,7 @@
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;
Index: head/sys/net/iflib.h
===================================================================
--- head/sys/net/iflib.h
+++ head/sys/net/iflib.h
@@ -381,6 +381,8 @@
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
*/
Index: head/sys/net/iflib.c
===================================================================
--- head/sys/net/iflib.c
+++ head/sys/net/iflib.c
@@ -171,6 +171,7 @@
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_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_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 @@
}
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 @@
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
Index: head/sys/sys/param.h
===================================================================
--- head/sys/sys/param.h
+++ head/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,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 4:15 PM (19 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15543031
Default Alt Text
D19489.diff (5 KB)
Attached To
Mode
D19489: iflib: expose the Rx mbuf buffer size to drivers
Attached
Detach File
Event Timeline
Log In to Comment