cxgbe(4): Retire the allow_mbufs_in_cluster optimization.

This simplifies the driver's rx fast path as well as the bookkeeping
code that tracks various rx buffer sizes and layouts.

MFC after:	1 week
Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar committed 2020-02-04 00:51:10 +00:00
1 parent febe2bd226
commit 46e1e307ed
5 files changed
+249 -535
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357481

No files matched your search

-5
View File
@@ -317,11 +317,6 @@ Allow the hardware to deliver multiple frames in the same receive buffer
opportunistically.
The default is -1 which lets the driver decide.
0 or 1 explicitly disable or enable this feature.
.It Va hw.cxgbe.allow_mbufs_in_cluster
1 allows the driver to lay down one or more mbufs within the receive buffer
opportunistically.
This is the default.
0 prohibits the driver from doing so.
.It Va hw.cxgbe.largest_rx_cluster
.It Va hw.cxgbe.safest_rx_cluster
Sizes of rx clusters.
+14 -29
View File
@@ -316,15 +316,6 @@ struct port_info {
#define IS_MAIN_VI(vi) ((vi) == &((vi)->pi->vi[0]))
/* Where the cluster came from, how it has been carved up. */
struct cluster_layout {
int8_t zidx;
int8_t hwidx;
uint16_t region1; /* mbufs laid out within this region */
/* region2 is the DMA region */
uint16_t region3; /* cluster_metadata within this region */
};
struct cluster_metadata {
uma_zone_t zone;
caddr_t cl;
@@ -334,7 +325,8 @@ struct cluster_metadata {
struct fl_sdesc {
caddr_t cl;
uint16_t nmbuf; /* # of driver originated mbufs with ref on cluster */
struct cluster_layout cll;
int16_t moff; /* offset of metadata from cl */
uint8_t zidx;
};
struct tx_desc {
@@ -466,18 +458,15 @@ struct sge_eq {
char lockname[16];
};
struct sw_zone_info {
struct rx_buf_info {
uma_zone_t zone; /* zone that this cluster comes from */
int size; /* size of cluster: 2K, 4K, 9K, 16K, etc. */
int type; /* EXT_xxx type of the cluster */
int8_t head_hwidx;
int8_t tail_hwidx;
};
struct hw_buf_info {
int8_t zidx; /* backpointer to zone; -ve means unused */
int8_t next; /* next hwidx for this zone; -1 means no more */
int size;
uint16_t size1; /* same as size of cluster: 2K/4K/9K/16K.
* hwsize[hwidx1] = size1. No spare. */
uint16_t size2; /* hwsize[hwidx2] = size2.
* spare in cluster = size1 - size2. */
int8_t hwidx1; /* SGE bufsize idx for size1 */
int8_t hwidx2; /* SGE bufsize idx for size2 */
uint8_t type; /* EXT_xxx type of the cluster */
};
enum {
@@ -519,7 +508,8 @@ struct sge_fl {
struct mtx fl_lock;
__be64 *desc; /* KVA of descriptor ring, ptr to addresses */
struct fl_sdesc *sdesc; /* KVA of software descriptor ring */
struct cluster_layout cll_def; /* default refill zone, layout */
uint16_t zidx; /* refill zone idx */
uint16_t safe_zidx;
uint16_t lowat; /* # of buffers <= this means fl needs help */
int flags;
uint16_t buf_boundary;
@@ -537,8 +527,6 @@ struct sge_fl {
u_int rx_offset; /* offset in fl buf (when buffer packing) */
volatile uint32_t *udb;
uint64_t mbuf_allocated;/* # of mbuf allocated from zone_mbuf */
uint64_t mbuf_inlined; /* # of mbuf created within clusters */
uint64_t cl_allocated; /* # of clusters allocated */
uint64_t cl_recycled; /* # of clusters recycled */
uint64_t cl_fast_recycled; /* # of clusters recycled (fast) */
@@ -555,7 +543,6 @@ struct sge_fl {
bus_dmamap_t desc_map;
char lockname[16];
bus_addr_t ba; /* bus address of descriptor ring */
struct cluster_layout cll_alt; /* alternate refill zone, layout */
};
struct mp_ring;
@@ -781,10 +768,8 @@ struct sge {
struct sge_iq **iqmap; /* iq->cntxt_id to iq mapping */
struct sge_eq **eqmap; /* eq->cntxt_id to eq mapping */
int8_t safe_hwidx1; /* may not have room for metadata */
int8_t safe_hwidx2; /* with room for metadata and maybe more */
struct sw_zone_info sw_zone_info[SW_ZONE_SIZES];
struct hw_buf_info hw_buf_info[SGE_FLBUF_SIZES];
int8_t safe_zidx;
struct rx_buf_info rx_buf_info[SW_ZONE_SIZES];
};
struct devnames {
-4
View File
@@ -10291,8 +10291,6 @@ clear_stats(struct adapter *sc, u_int port_id)
rxq->rxcsum = 0;
rxq->vlan_extraction = 0;
rxq->fl.mbuf_allocated = 0;
rxq->fl.mbuf_inlined = 0;
rxq->fl.cl_allocated = 0;
rxq->fl.cl_recycled = 0;
rxq->fl.cl_fast_recycled = 0;
@@ -10334,8 +10332,6 @@ clear_stats(struct adapter *sc, u_int port_id)
#endif
#ifdef TCP_OFFLOAD
for_each_ofld_rxq(vi, i, ofld_rxq) {
ofld_rxq->fl.mbuf_allocated = 0;
ofld_rxq->fl.mbuf_inlined = 0;
ofld_rxq->fl.cl_allocated = 0;
ofld_rxq->fl.cl_recycled = 0;
ofld_rxq->fl.cl_fast_recycled = 0;
+11 -6
View File
@@ -345,7 +345,7 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp,
struct sge_nm_rxq *nm_rxq;
struct sge_nm_txq *nm_txq;
int rc, i, j, hwidx, defq, nrssq;
struct hw_buf_info *hwb;
struct rx_buf_info *rxb;
ASSERT_SYNCHRONIZED_OP(sc);
@@ -353,17 +353,22 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp,
(ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return (EAGAIN);
hwb = &sc->sge.hw_buf_info[0];
for (i = 0; i < SGE_FLBUF_SIZES; i++, hwb++) {
if (hwb->size == NETMAP_BUF_SIZE(na))
rxb = &sc->sge.rx_buf_info[0];
for (i = 0; i < SW_ZONE_SIZES; i++, rxb++) {
if (rxb->size1 == NETMAP_BUF_SIZE(na)) {
hwidx = rxb->hwidx1;
break;
}
if (rxb->size2 == NETMAP_BUF_SIZE(na)) {
hwidx = rxb->hwidx2;
break;
}
}
if (i >= SGE_FLBUF_SIZES) {
if (i >= SW_ZONE_SIZES) {
if_printf(ifp, "no hwidx for netmap buffer size %d.\n",
NETMAP_BUF_SIZE(na));
return (ENXIO);
}
hwidx = i;
/* Must set caps before calling netmap_reset */
nm_set_native_flags(na);
+224 -491
View File
File diff suppressed because it is too large. Load diff