# HG changeset patch # User Navdeep Parhar <navdeep@chelsio.com> # Date 1434521450 25200 # Tue Jun 16 23:10:50 2015 -0700 # Branch freebsd-head # Node ID 8ee5b5aee29eda163368fd457773ed9e131465a4 # Parent 0fd8f76e4112b19a7f2eff9f1a1b8a29c445bdac Save the first 128B of the mbuf constructed by get_scatter_segment and also the mbuf sent up to the stack. diff -r 0fd8f76e4112 -r 8ee5b5aee29e sys/dev/cxgbe/adapter.h --- a/sys/dev/cxgbe/adapter.h Thu Jun 04 21:49:38 2015 -0700 +++ b/sys/dev/cxgbe/adapter.h Tue Jun 16 23:10:50 2015 -0700 @@ -303,10 +303,19 @@ struct cluster_metadata { #endif }; +#if 1 +struct last_mbuf { + uint8_t raw[128]; +}; +#endif + struct fl_sdesc { caddr_t cl; uint16_t nmbuf; /* # of driver originated mbufs with ref on cluster */ struct cluster_layout cll; +#if 1 + struct last_mbuf last_mbuf; +#endif }; struct tx_desc { @@ -525,6 +534,9 @@ struct sge_rxq { /* stats for not-that-common events */ +#if 1 + struct last_mbuf *last_mbuf; +#endif } __aligned(CACHE_LINE_SIZE); static inline struct sge_rxq * diff -r 0fd8f76e4112 -r 8ee5b5aee29e sys/dev/cxgbe/t4_sge.c --- a/sys/dev/cxgbe/t4_sge.c Thu Jun 04 21:49:38 2015 -0700 +++ b/sys/dev/cxgbe/t4_sge.c Tue Jun 16 23:10:50 2015 -0700 @@ -1647,6 +1647,14 @@ get_scatter_segment(struct adapter *sc, if (fr_offset == 0) m->m_pkthdr.len = remaining; m->m_len = len; +#if 1 + /* + * This is the mbuf for this scatter segment. It may have M_PKTHDR but + * only m_pkthdr.len is set correctly at this point. Most other header + * fields are set later by t4_eth_rx. + */ + bcopy(m, &sd->last_mbuf, sizeof(struct last_mbuf)); +#endif if (fl->flags & FL_BUF_PACKING) { fl->rx_offset += blen; @@ -1779,6 +1787,10 @@ t4_eth_rx(struct sge_iq *iq, const struc rxq->vlan_extraction++; } +#if 1 + /* This is the header mbuf that cxgbe passed up to the stack */ + bcopy(m0, &rxq->last_mbuf[iq->cidx], sizeof(struct last_mbuf)); +#endif #if defined(INET) || defined(INET6) if (cpl->l2info & htobe32(F_RXF_LRO) && iq->flags & IQ_LRO_ENABLED && @@ -2960,6 +2972,10 @@ alloc_rxq(struct port_info *pi, struct s rxq->iq.flags |= IQ_LRO_ENABLED; #endif rxq->ifp = pi->ifp; +#if 1 + rxq->last_mbuf = malloc(rxq->iq.sidx * sizeof(struct last_mbuf), + M_CXGBE, M_ZERO | M_WAITOK); +#endif children = SYSCTL_CHILDREN(oid);