From owner-dev-commits-src-branches@freebsd.org Thu Mar 11 01:14:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8444457DF37; Thu, 11 Mar 2021 01:14:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DwrZV2zlFz3F1v; Thu, 11 Mar 2021 01:14:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33D141BA45; Thu, 11 Mar 2021 01:14:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12B1EQ9w056267; Thu, 11 Mar 2021 01:14:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B1EQ4P056266; Thu, 11 Mar 2021 01:14:26 GMT (envelope-from git) Date: Thu, 11 Mar 2021 01:14:26 GMT Message-Id: <202103110114.12B1EQ4P056266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 995755b959a6 - releng/13.0 - ixl(4): Report RX errors as sum of all RX error counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 995755b959a657bf86fbc4535abd3076ba981171 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 01:14:26 -0000 The branch releng/13.0 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=995755b959a657bf86fbc4535abd3076ba981171 commit 995755b959a657bf86fbc4535abd3076ba981171 Author: Krzysztof Galazka AuthorDate: 2021-03-03 01:33:11 +0000 Commit: Eric Joyner CommitDate: 2021-03-11 01:07:13 +0000 ixl(4): Report RX errors as sum of all RX error counters HW keeps track of RX errors using several counters, each for specific type of errors. Report RX errors to OS as sum of all those counters: CRC errors, illegal bytes, checksum, length, undersize, fragment, oversize and jabber errors. There is no HW counter for frames with invalid L3/L4 checksums so add a SW one. Also add a "rx_errors" sysctl with a copy of netstat IERRORS counter value to make it easier accessible from scripts. Reviewed By: erj Tested By: gowtham.kumar.ks@intel.com Approved by: re (gjb) Sponsored By: Intel Corporation Differential Revision: https://reviews.freebsd.org/D27639 (cherry picked from commit 9f99061ef9c95b171fc92d34026222bb5e052337) (cherry picked from commit b149f7c23d13e73b92c2bf8c3691e3e1ebd833c1) --- sys/dev/ixl/ixl.h | 1 + sys/dev/ixl/ixl_pf_main.c | 15 +++++++++++++-- sys/dev/ixl/ixl_txrx.c | 16 +++++++++------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h index 3eb0fa4f6b5a..9828760e4ea6 100644 --- a/sys/dev/ixl/ixl.h +++ b/sys/dev/ixl/ixl.h @@ -390,6 +390,7 @@ struct rx_ring { u64 rx_packets; u64 rx_bytes; u64 desc_errs; + u64 csum_errs; }; /* diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 2714b1a0e6d8..070ddaef522e 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -808,6 +808,11 @@ ixl_vsi_add_sysctls(struct ixl_vsi * vsi, const char * sysctl_name, bool queues_ vsi_list = SYSCTL_CHILDREN(vsi->vsi_node); ixl_add_sysctls_eth_stats(&vsi->sysctl_ctx, vsi_list, &vsi->eth_stats); + /* Copy of netstat RX errors counter for validation purposes */ + SYSCTL_ADD_UQUAD(&vsi->sysctl_ctx, vsi_list, OID_AUTO, "rx_errors", + CTLFLAG_RD, &vsi->ierrors, + "RX packet errors"); + if (queues_sysctls) ixl_vsi_add_queues_stats(vsi, &vsi->sysctl_ctx); } @@ -2183,7 +2188,7 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) struct ixl_pf *pf; struct ifnet *ifp; struct i40e_eth_stats *es; - u64 tx_discards; + u64 tx_discards, csum_errs; struct i40e_hw_port_stats *nsd; @@ -2196,6 +2201,11 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) tx_discards = es->tx_discards + nsd->tx_dropped_link_down; + csum_errs = 0; + for (int i = 0; i < vsi->num_rx_queues; i++) + csum_errs += vsi->rx_queues[i].rxr.csum_errs; + nsd->checksum_error = csum_errs; + /* Update ifnet stats */ IXL_SET_IPACKETS(vsi, es->rx_unicast + es->rx_multicast + @@ -2209,7 +2219,8 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) IXL_SET_OMCASTS(vsi, es->tx_multicast); IXL_SET_IERRORS(vsi, nsd->crc_errors + nsd->illegal_bytes + - nsd->rx_undersize + nsd->rx_oversize + nsd->rx_fragments + + nsd->checksum_error + nsd->rx_length_errors + + nsd->rx_undersize + nsd->rx_fragments + nsd->rx_oversize + nsd->rx_jabber); IXL_SET_OERRORS(vsi, es->tx_errors); IXL_SET_IQDROPS(vsi, es->rx_discards + nsd->eth.rx_discards); diff --git a/sys/dev/ixl/ixl_txrx.c b/sys/dev/ixl/ixl_txrx.c index e589bb8392cd..bdd3cb8725f8 100644 --- a/sys/dev/ixl/ixl_txrx.c +++ b/sys/dev/ixl/ixl_txrx.c @@ -51,7 +51,7 @@ #endif /* Local Prototypes */ -static void ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype); +static u8 ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype); static int ixl_isc_txd_encap(void *arg, if_pkt_info_t pi); static void ixl_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); @@ -720,7 +720,7 @@ ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxr->rx_packets++; if ((if_getcapenable(vsi->ifp) & IFCAP_RXCSUM) != 0) - ixl_rx_checksum(ri, status, error, ptype); + rxr->csum_errs += ixl_rx_checksum(ri, status, error, ptype); ri->iri_flowid = le32toh(cur->wb.qword0.hi_dword.rss); ri->iri_rsstype = ixl_ptype_to_hash(ptype); ri->iri_vtag = vtag; @@ -737,7 +737,7 @@ ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * doesn't spend time verifying the checksum. * *********************************************************************/ -static void +static u8 ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) { struct i40e_rx_ptype_decoded decoded; @@ -746,7 +746,7 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) /* No L3 or L4 checksum was calculated */ if (!(status & (1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT))) - return; + return (0); decoded = decode_rx_desc_ptype(ptype); @@ -756,7 +756,7 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) if (status & (1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT)) { ri->iri_csum_flags = 0; - return; + return (1); } } @@ -764,17 +764,19 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) /* IPv4 checksum error */ if (error & (1 << I40E_RX_DESC_ERROR_IPE_SHIFT)) - return; + return (1); ri->iri_csum_flags |= CSUM_L3_VALID; ri->iri_csum_flags |= CSUM_L4_CALC; /* L4 checksum error */ if (error & (1 << I40E_RX_DESC_ERROR_L4E_SHIFT)) - return; + return (1); ri->iri_csum_flags |= CSUM_L4_VALID; ri->iri_csum_data |= htons(0xffff); + + return (0); } /* Set Report Status queue fields to 0 */