diff options
-rw-r--r-- | sys/dev/pci/if_ix.c | 32 | ||||
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 5 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 8 | ||||
-rw-r--r-- | usr.bin/netstat/inet.c | 5 |
4 files changed, 44 insertions, 6 deletions
diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index 4119a2416dc..98815b51d62 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.195 2023/05/18 08:22:37 jan Exp $ */ +/* $OpenBSD: if_ix.c,v 1.196 2023/05/23 09:16:16 jan Exp $ */ /****************************************************************************** @@ -3214,12 +3214,23 @@ ixgbe_rxeof(struct rx_ring *rxr) sendmp = rxbuf->fmp; rxbuf->buf = rxbuf->fmp = NULL; - if (sendmp != NULL) /* secondary frag */ + if (sendmp != NULL) { /* secondary frag */ sendmp->m_pkthdr.len += mp->m_len; - else { + + /* + * This function iterates over interleaved descriptors. + * Thus, we reuse ph_mss as global segment counter per + * TCP connection, instead of introducing a new variable + * in m_pkthdr. + */ + if (rsccnt) + sendmp->m_pkthdr.ph_mss += rsccnt - 1; + } else { /* first desc of a non-ps chain */ sendmp = mp; sendmp->m_pkthdr.len = mp->m_len; + if (rsccnt) + sendmp->m_pkthdr.ph_mss = rsccnt - 1; #if NVLAN > 0 if (sc->vlan_stripping && staterr & IXGBE_RXD_STAT_VP) { sendmp->m_pkthdr.ether_vtag = vtag; @@ -3241,6 +3252,21 @@ ixgbe_rxeof(struct rx_ring *rxr) SET(sendmp->m_pkthdr.csum_flags, M_FLOWID); } + if (sendmp->m_pkthdr.ph_mss == 1) + sendmp->m_pkthdr.ph_mss = 0; + + if (sendmp->m_pkthdr.ph_mss > 0) { + struct ether_extracted ext; + uint16_t pkts = sendmp->m_pkthdr.ph_mss; + + ether_extract_headers(sendmp, &ext); + if (ext.tcp) + tcpstat_inc(tcps_inhwlro); + else + tcpstat_inc(tcps_inbadlro); + tcpstat_add(tcps_inpktlro, pkts); + } + ml_enqueue(&ml, sendmp); } next_desc: diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 120e3cc5ea7..e321da334cd 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.218 2023/05/10 12:07:16 bluhm Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.219 2023/05/23 09:16:16 jan Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -1340,6 +1340,9 @@ tcp_sysctl_tcpstat(void *oldp, size_t *oldlenp, void *newp) ASSIGN(tcps_outhwtso); ASSIGN(tcps_outpkttso); ASSIGN(tcps_outbadtso); + ASSIGN(tcps_inhwlro); + ASSIGN(tcps_inpktlro); + ASSIGN(tcps_inbadlro); #undef ASSIGN diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 0a9630d719f..0cc13c6e08c 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.166 2023/05/18 08:22:37 jan Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.167 2023/05/23 09:16:16 jan Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -447,6 +447,9 @@ struct tcpstat { u_int32_t tcps_outhwtso; /* output tso processed by hardware */ u_int32_t tcps_outpkttso; /* packets generated by tso */ u_int32_t tcps_outbadtso; /* output tso failed, packet dropped */ + u_int32_t tcps_inhwlro; /* input lro from hardware */ + u_int32_t tcps_inpktlro; /* packets coalesced by hardware lro */ + u_int32_t tcps_inbadlro; /* input bad lro packets */ }; /* @@ -625,6 +628,9 @@ enum tcpstat_counters { tcps_outhwtso, tcps_outpkttso, tcps_outbadtso, + tcps_inhwlro, + tcps_inpktlro, + tcps_inbadlro, tcps_ncounters, }; diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index e04355ed078..b84c287fee9 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.175 2023/05/10 12:07:17 bluhm Exp $ */ +/* $OpenBSD: inet.c,v 1.176 2023/05/23 09:16:16 jan Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -439,6 +439,9 @@ tcp_stats(char *name) p(tcps_inswcsum, "\t\t%u packet%s software-checksummed\n"); p(tcps_rcvbadsig, "\t\t%u bad/missing md5 checksum%s\n"); p(tcps_rcvgoodsig, "\t\t%llu good md5 checksum%s\n"); + p(tcps_inhwlro, "\t\t%u input LRO generated packet%s from hardware\n"); + p(tcps_inpktlro, "\t\t%u input LRO coalesced packet%s by hardware\n"); + p(tcps_inbadlro, "\t\t%u input bad LRO packet%s\n"); p(tcps_connattempt, "\t%u connection request%s\n"); p(tcps_accepts, "\t%u connection accept%s\n"); p(tcps_connects, "\t%u connection%s established (including accepts)\n"); |