diff mbox series

[iwl-net,05/10] ice: report VF tx_dropped with tx_errors instead of tx_discards

Message ID 20261002130752.2597259-6-poros@redhat.com
State Under Review
Delegated to: Anthony Nguyen
Headers show
Series ice: port missing i40e fixes | expand

Commit Message

Petr Oros Oct. 2, 2026, 1:07 p.m. UTC
ice_get_vf_stats() fills tx_dropped from eth_stats.tx_discards, which
ice_update_eth_stats() never updates because the GLV_TDPC register it
would come from is not implemented in E810 hardware. The Tx drops of a
VF, such as switch drops on an anti spoof violation, malicious driver
drops or TTL expiry, are counted by GLV_TEPC into eth_stats.tx_errors
instead, so the VF always reports zero dropped packets.

With spoof checking on, a VF sending 60 valid frames and 30 frames with
a forged source MAC shows:

  vf 0 ... spoof checking on, link-state auto, trust off
    TX: bytes  packets   dropped
          3600       60        0

Report tx_errors as tx_dropped, the VF stats have no separate error
field. With the change the same test reports 30 dropped packets.

i40e fixed the same issue in commit 50b2af451597 ("i40e: report VF
tx_dropped with tx_errors instead of tx_discards").

Fixes: 730fdea40bef ("ice: implement VF stats NDO")
Assisted-by: LLM
Signed-off-by: Petr Oros <poros@redhat.com>
---
 drivers/net/ethernet/intel/ice/ice_sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ivan Vecera Oct. 3, 2026, 9:55 a.m. UTC | #1
On October 2, 2026 3:07:47 PM GMT+02:00, Petr Oros <poros@redhat.com> wrote:
>ice_get_vf_stats() fills tx_dropped from eth_stats.tx_discards, which
>ice_update_eth_stats() never updates because the GLV_TDPC register it
>would come from is not implemented in E810 hardware. The Tx drops of a
>VF, such as switch drops on an anti spoof violation, malicious driver
>drops or TTL expiry, are counted by GLV_TEPC into eth_stats.tx_errors
>instead, so the VF always reports zero dropped packets.
>
>With spoof checking on, a VF sending 60 valid frames and 30 frames with
>a forged source MAC shows:
>
>  vf 0 ... spoof checking on, link-state auto, trust off
>    TX: bytes  packets   dropped
>          3600       60        0
>
>Report tx_errors as tx_dropped, the VF stats have no separate error
>field. With the change the same test reports 30 dropped packets.
>
>i40e fixed the same issue in commit 50b2af451597 ("i40e: report VF
>tx_dropped with tx_errors instead of tx_discards").
>
>Fixes: 730fdea40bef ("ice: implement VF stats NDO")
>Assisted-by: LLM
>Signed-off-by: Petr Oros <poros@redhat.com>
>---
> drivers/net/ethernet/intel/ice/ice_sriov.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
>index b21279f0f5f1e1..8faddf8ba0d523 100644
>--- a/drivers/net/ethernet/intel/ice/ice_sriov.c
>+++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
>@@ -1640,7 +1640,7 @@ int ice_get_vf_stats(struct net_device *netdev, int vf_id,
> 	vf_stats->broadcast  = stats->rx_broadcast;
> 	vf_stats->multicast  = stats->rx_multicast;
> 	vf_stats->rx_dropped = stats->rx_discards;
>-	vf_stats->tx_dropped = stats->tx_discards;
>+	vf_stats->tx_dropped = stats->tx_errors;
> 
> out_put_vf:
> 	ice_put_vf(vf);

Reviewed-by: Ivan Vecera <ivecera@redhat.com>
Loktionov, Aleksandr Oct. 5, 2026, 10:26 a.m. UTC | #2
> -----Original Message-----
> From: Petr Oros <poros@redhat.com>
> Sent: Friday, October 2, 2026 3:08 PM
> To: netdev@vger.kernel.org
> Cc: Oros, Petr <poros@redhat.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>;
> David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@kernel.org>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; Lobakin, Aleksander
> <aleksander.lobakin@intel.com>; Alexei Starovoitov <ast@kernel.org>;
> Daniel Borkmann <daniel@iogearbox.net>; Jesper Dangaard Brouer
> <hawk@kernel.org>; John Fastabend <john.fastabend@gmail.com>;
> Stanislav Fomichev <sdf@fomichev.me>; Henry Tieman
> <henry.w.tieman@intel.com>; Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>; Michal Swiatkowski
> <michal.swiatkowski@linux.intel.com>; Jesse Brandeburg
> <jbrandeb@kernel.org>; Preethi Banala <preethi.banala@intel.com>;
> Kiran Patil <kiran.patil@intel.com>; Dan Nowlin
> <dan.nowlin@intel.com>; Stephen Hemminger
> <stephen@networkplumber.org>; intel-wired-lan@lists.osuosl.org; linux-
> kernel@vger.kernel.org; bpf@vger.kernel.org
> Subject: [PATCH iwl-net 05/10] ice: report VF tx_dropped with
> tx_errors instead of tx_discards
> 
> ice_get_vf_stats() fills tx_dropped from eth_stats.tx_discards, which
> ice_update_eth_stats() never updates because the GLV_TDPC register it
> would come from is not implemented in E810 hardware. The Tx drops of a
> VF, such as switch drops on an anti spoof violation, malicious driver
> drops or TTL expiry, are counted by GLV_TEPC into eth_stats.tx_errors
> instead, so the VF always reports zero dropped packets.
> 
> With spoof checking on, a VF sending 60 valid frames and 30 frames
> with a forged source MAC shows:
> 
>   vf 0 ... spoof checking on, link-state auto, trust off
>     TX: bytes  packets   dropped
>           3600       60        0
> 
> Report tx_errors as tx_dropped, the VF stats have no separate error
> field. With the change the same test reports 30 dropped packets.
> 
> i40e fixed the same issue in commit 50b2af451597 ("i40e: report VF
> tx_dropped with tx_errors instead of tx_discards").
> 
> Fixes: 730fdea40bef ("ice: implement VF stats NDO")
> Assisted-by: LLM
> Signed-off-by: Petr Oros <poros@redhat.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_sriov.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c
> b/drivers/net/ethernet/intel/ice/ice_sriov.c
> index b21279f0f5f1e1..8faddf8ba0d523 100644
> --- a/drivers/net/ethernet/intel/ice/ice_sriov.c
> +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
> @@ -1640,7 +1640,7 @@ int ice_get_vf_stats(struct net_device *netdev,
> int vf_id,
>  	vf_stats->broadcast  = stats->rx_broadcast;
>  	vf_stats->multicast  = stats->rx_multicast;
>  	vf_stats->rx_dropped = stats->rx_discards;
> -	vf_stats->tx_dropped = stats->tx_discards;
> +	vf_stats->tx_dropped = stats->tx_errors;
> 
>  out_put_vf:
>  	ice_put_vf(vf);
> --
> 2.55.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
index b21279f0f5f1e1..8faddf8ba0d523 100644
--- a/drivers/net/ethernet/intel/ice/ice_sriov.c
+++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
@@ -1640,7 +1640,7 @@  int ice_get_vf_stats(struct net_device *netdev, int vf_id,
 	vf_stats->broadcast  = stats->rx_broadcast;
 	vf_stats->multicast  = stats->rx_multicast;
 	vf_stats->rx_dropped = stats->rx_discards;
-	vf_stats->tx_dropped = stats->tx_discards;
+	vf_stats->tx_dropped = stats->tx_errors;
 
 out_put_vf:
 	ice_put_vf(vf);