diff options
author | np <np@FreeBSD.org> | 2012-08-15 01:03:13 +0000 |
---|---|---|
committer | np <np@FreeBSD.org> | 2012-08-15 01:03:13 +0000 |
commit | eca813ad76756aea4f70787cf7827d4b319cfe94 (patch) | |
tree | 3d3a7fc3afe3ce2bc4dffed1a34d6f0650c5d1bc | |
parent | 1c0476221e5695b54139fdd6fc55b159e3360d9c (diff) | |
download | FreeBSD-src-eca813ad76756aea4f70787cf7827d4b319cfe94.zip FreeBSD-src-eca813ad76756aea4f70787cf7827d4b319cfe94.tar.gz |
The size of the buffers in an Ethernet freelist has to be higher than the
interface's MTU. Initialize such freelists with correct values.
This wasn't a problem for common MTUs (1500 and 9000) as the buffers (2048
and 9216 in size) happened to have enough spare room. I ran into it when
playing around with unusual MTUs.
MFC after: 2 weeks
-rw-r--r-- | sys/dev/cxgbe/t4_sge.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index eee2742..09e5518 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -542,6 +542,18 @@ port_intr_iq(struct port_info *pi, int idx) return (iq); } +static inline int +mtu_to_bufsize(int mtu) +{ + int bufsize; + + /* large enough for a frame even when VLAN extraction is disabled */ + bufsize = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + mtu; + bufsize = roundup(bufsize + fl_pktshift, fl_pad); + + return (bufsize); +} + int t4_setup_port_queues(struct port_info *pi) { @@ -558,6 +570,7 @@ t4_setup_port_queues(struct port_info *pi) struct adapter *sc = pi->adapter; struct sysctl_oid *oid = device_get_sysctl_tree(pi->dev); struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); + int bufsize = mtu_to_bufsize(pi->ifp->if_mtu); oid = SYSCTL_ADD_NODE(&pi->ctx, children, OID_AUTO, "rxq", CTLFLAG_RD, NULL, "rx queues"); @@ -587,7 +600,7 @@ t4_setup_port_queues(struct port_info *pi) snprintf(name, sizeof(name), "%s rxq%d-fl", device_get_nameunit(pi->dev), i); - init_fl(&rxq->fl, pi->qsize_rxq / 8, pi->ifp->if_mtu, name); + init_fl(&rxq->fl, pi->qsize_rxq / 8, bufsize, name); if (sc->flags & INTR_DIRECT #ifdef TCP_OFFLOAD @@ -1451,11 +1464,8 @@ t4_update_fl_bufsize(struct ifnet *ifp) struct port_info *pi = ifp->if_softc; struct sge_rxq *rxq; struct sge_fl *fl; - int i, bufsize; + int i, bufsize = mtu_to_bufsize(ifp->if_mtu); - /* large enough for a frame even when VLAN extraction is disabled */ - bufsize = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ifp->if_mtu; - bufsize = roundup(bufsize + fl_pktshift, fl_pad); for_each_rxq(pi, i, rxq) { fl = &rxq->fl; |