Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151156322
D23947.id69516.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D23947.id69516.diff
View Options
Index: head/sys/net/iflib.h
===================================================================
--- head/sys/net/iflib.h
+++ head/sys/net/iflib.h
@@ -220,6 +220,9 @@
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. */
Index: head/sys/net/iflib.c
===================================================================
--- head/sys/net/iflib.c
+++ head/sys/net/iflib.c
@@ -708,6 +708,7 @@
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_rxq_t rxq = fl->ifl_rxq;
if_ctx_t ctx = rxq->ifr_ctx;
+ if_softc_ctx_t scctx = &ctx->ifc_softc_ctx;
+ int qidx;
bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size - 1);
/*
@@ -2171,7 +2174,16 @@
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 @@
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 @@
* 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 @@
SYSCTL_ADD_U16(ctx_list, fl_list, OID_AUTO, "credits",
CTLFLAG_RD,
&fl->ifl_credits, 1, "credits available");
+ SYSCTL_ADD_U16(ctx_list, fl_list, OID_AUTO, "buf_size",
+ CTLFLAG_RD,
+ &fl->ifl_buf_size, 1, "buffer size");
#if MEMORY_LOGGING
SYSCTL_ADD_QUAD(ctx_list, fl_list, OID_AUTO, "fl_m_enqueued",
CTLFLAG_RD,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 7, 11:53 AM (5 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31027572
Default Alt Text
D23947.id69516.diff (2 KB)
Attached To
Mode
D23947: Allow iflib drivers to specify the buffer size used for each receive queue
Attached
Detach File
Event Timeline
Log In to Comment