From nobody Sun Feb 8 20:29:19 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 451F4EB8FA5 for ; Wed, 6 Sep 2023 07:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232942AbjIFH2W (ORCPT ); Wed, 6 Sep 2023 03:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230361AbjIFH2V (ORCPT ); Wed, 6 Sep 2023 03:28:21 -0400 Received: from out-227.mta1.migadu.com (out-227.mta1.migadu.com [95.215.58.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2611792 for ; Wed, 6 Sep 2023 00:28:16 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1693985294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=938feFunuVXrcQFgTRaCo4N0Cd13MIgXYg/3Qnd6T7g=; b=OlHVPoQNIIWLajc/u/NPrn8F8+xDKk2SY0BWtBkfBz3Xn51WktNbj5XpWZ2IR0/aWW+Bdy jy/sSX7uz3wVfm18fYS6eGuqhqgA1fboaTlV1sFtW1IjCQBUyLBdLhiRI0OpGpWtWlxn8p Jqn11zt98CKVXa7uQBPeG2D5JWZMnSQ= From: Yajun Deng To: anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH] i40e: Add rx_missed_errors for buffer exhaustion Date: Wed, 6 Sep 2023 15:27:57 +0800 Message-Id: <20230906072757.3929754-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As the comment in struct rtnl_link_stats64, rx_dropped should not include packets dropped by the device due to buffer exhaustion. They are counted in rx_missed_errors, procfs folds those two counters together. Add rx_missed_errors for buffer exhaustion, rx_missed_errors corresponds to rx_discards, rx_dropped corresponds to rx_discards_other. Signed-off-by: Yajun Deng Tested-by: Arpana Arland (A Contingent worker at= Intel) --- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 3 ++- drivers/net/ethernet/intel/i40e/i40e_main.c | 18 +++++++----------- .../net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/e= thernet/intel/i40e/i40e_ethtool.c index bd1321bf7e26..77e4ac103866 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -245,6 +245,7 @@ static const struct i40e_stats i40e_gstrings_net_stats[= ] =3D { I40E_NETDEV_STAT(rx_errors), I40E_NETDEV_STAT(tx_errors), I40E_NETDEV_STAT(rx_dropped), + I40E_NETDEV_STAT(rx_missed_errors), I40E_NETDEV_STAT(tx_dropped), I40E_NETDEV_STAT(collisions), I40E_NETDEV_STAT(rx_length_errors), @@ -321,7 +322,7 @@ static const struct i40e_stats i40e_gstrings_stats[] = =3D { I40E_PF_STAT("port.rx_broadcast", stats.eth.rx_broadcast), I40E_PF_STAT("port.tx_broadcast", stats.eth.tx_broadcast), I40E_PF_STAT("port.tx_errors", stats.eth.tx_errors), - I40E_PF_STAT("port.rx_dropped", stats.eth.rx_discards), + I40E_PF_STAT("port.rx_discards", stats.eth.rx_discards), I40E_PF_STAT("port.tx_dropped_link_down", stats.tx_dropped_link_down), I40E_PF_STAT("port.rx_crc_errors", stats.crc_errors), I40E_PF_STAT("port.illegal_bytes", stats.illegal_bytes), diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethe= rnet/intel/i40e/i40e_main.c index de7fd43dc11c..290c011168c2 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -489,6 +489,7 @@ static void i40e_get_netdev_stats_struct(struct net_dev= ice *netdev, stats->tx_dropped =3D vsi_stats->tx_dropped; stats->rx_errors =3D vsi_stats->rx_errors; stats->rx_dropped =3D vsi_stats->rx_dropped; + stats->rx_missed_errors =3D vsi_stats->rx_missed_errors; stats->rx_crc_errors =3D vsi_stats->rx_crc_errors; stats->rx_length_errors =3D vsi_stats->rx_length_errors; } @@ -680,17 +681,13 @@ i40e_stats_update_rx_discards(struct i40e_vsi *vsi, s= truct i40e_hw *hw, struct i40e_eth_stats *stat_offset, struct i40e_eth_stats *stat) { - u64 rx_rdpc, rx_rxerr; - i40e_stat_update32(hw, I40E_GLV_RDPC(stat_idx), offset_loaded, - &stat_offset->rx_discards, &rx_rdpc); + &stat_offset->rx_discards, &stat->rx_discards); i40e_stat_update64(hw, I40E_GL_RXERR1H(i40e_compute_pci_to_hw_id(vsi, hw)), I40E_GL_RXERR1L(i40e_compute_pci_to_hw_id(vsi, hw)), offset_loaded, &stat_offset->rx_discards_other, - &rx_rxerr); - - stat->rx_discards =3D rx_rdpc + rx_rxerr; + &stat->rx_discards_other); } =20 /** @@ -712,9 +709,6 @@ void i40e_update_eth_stats(struct i40e_vsi *vsi) i40e_stat_update32(hw, I40E_GLV_TEPC(stat_idx), vsi->stat_offsets_loaded, &oes->tx_errors, &es->tx_errors); - i40e_stat_update32(hw, I40E_GLV_RDPC(stat_idx), - vsi->stat_offsets_loaded, - &oes->rx_discards, &es->rx_discards); i40e_stat_update32(hw, I40E_GLV_RUPP(stat_idx), vsi->stat_offsets_loaded, &oes->rx_unknown_protocol, &es->rx_unknown_protocol); @@ -971,8 +965,10 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) ns->tx_errors =3D es->tx_errors; ons->multicast =3D oes->rx_multicast; ns->multicast =3D es->rx_multicast; - ons->rx_dropped =3D oes->rx_discards; - ns->rx_dropped =3D es->rx_discards; + ons->rx_dropped =3D oes->rx_discards_other; + ns->rx_dropped =3D es->rx_discards_other; + ons->rx_missed_errors =3D oes->rx_discards; + ns->rx_missed_errors =3D es->rx_discards; ons->tx_dropped =3D oes->tx_discards; ns->tx_dropped =3D es->tx_discards; =20 diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/n= et/ethernet/intel/i40e/i40e_virtchnl_pf.c index 8ea1a238dcef..3b514abfaa1e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -4914,7 +4914,7 @@ int i40e_get_vf_stats(struct net_device *netdev, int = vf_id, vf_stats->tx_bytes =3D stats->tx_bytes; vf_stats->broadcast =3D stats->rx_broadcast; vf_stats->multicast =3D stats->rx_multicast; - vf_stats->rx_dropped =3D stats->rx_discards; + vf_stats->rx_dropped =3D stats->rx_discards + stats->rx_discards_other; vf_stats->tx_dropped =3D stats->tx_discards; =20 return 0; --=20 2.25.1