lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 11 Oct 2019 17:15:03 +0300
From:   Ilias Apalodimas <ilias.apalodimas@...aro.org>
To:     Lorenzo Bianconi <lorenzo@...nel.org>
Cc:     davem@...emloft.net, netdev@...r.kernel.org,
        lorenzo.bianconi@...hat.com
Subject: Re: [PATCH net] net: socionext: netsec: fix xdp stats accounting

Hi Lorenzo, 

On Fri, Oct 11, 2019 at 03:45:38PM +0200, Lorenzo Bianconi wrote:
> Increment netdev rx counters even for XDP_DROP verdict. Moreover report
> even tx bytes for xdp buffers (TYPE_NETSEC_XDP_TX or
> TYPE_NETSEC_XDP_NDO)

The RX counters work fine. The TX change is causing a panic though and i am
looking into it since your patch seems harmless. In any case please don't merge
this yet

Thanks
/Ilias

> Fixes: ba2b232108d3 ("net: netsec: add XDP support")
> Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> ---
> just compiled not tested on a real device
> ---
>  drivers/net/ethernet/socionext/netsec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
> index f9e6744d8fd6..b1c2a79899b3 100644
> --- a/drivers/net/ethernet/socionext/netsec.c
> +++ b/drivers/net/ethernet/socionext/netsec.c
> @@ -252,7 +252,6 @@
>  #define NETSEC_XDP_CONSUMED      BIT(0)
>  #define NETSEC_XDP_TX            BIT(1)
>  #define NETSEC_XDP_REDIR         BIT(2)
> -#define NETSEC_XDP_RX_OK (NETSEC_XDP_PASS | NETSEC_XDP_TX | NETSEC_XDP_REDIR)
>  
>  enum ring_id {
>  	NETSEC_RING_TX = 0,
> @@ -661,6 +660,7 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv)
>  			bytes += desc->skb->len;
>  			dev_kfree_skb(desc->skb);
>  		} else {
> +			bytes += desc->xdpf->len;
>  			xdp_return_frame(desc->xdpf);
>  		}
>  next:
> @@ -1030,7 +1030,7 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget)
>  
>  next:
>  		if ((skb && napi_gro_receive(&priv->napi, skb) != GRO_DROP) ||
> -		    xdp_result & NETSEC_XDP_RX_OK) {
> +		    xdp_result) {
>  			ndev->stats.rx_packets++;
>  			ndev->stats.rx_bytes += xdp.data_end - xdp.data;
>  		}
> -- 
> 2.21.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ