diff mbox series

[net,2/2] net: socionext: fix xdp_result initialization in netsec_process_rx

Message ID 6c5c8394590826f4d69172cf31e95d44eae92245.1579952387.git.lorenzo@kernel.org
State Accepted
Delegated to: David Miller
Headers show
Series XDP fixes for socionext driver | expand

Commit Message

Lorenzo Bianconi Jan. 25, 2020, 11:48 a.m. UTC
Fix xdp_result initialization in netsec_process_rx in order to not
increase rx counters if there is no bpf program attached to the xdp hook
and napi_gro_receive returns GRO_DROP

Fixes: ba2b232108d3c ("net: netsec: add XDP support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/socionext/netsec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jesper Dangaard Brouer Jan. 25, 2020, 12:50 p.m. UTC | #1
On Sat, 25 Jan 2020 12:48:51 +0100
Lorenzo Bianconi <lorenzo@kernel.org> wrote:

> Fix xdp_result initialization in netsec_process_rx in order to not
> increase rx counters if there is no bpf program attached to the xdp hook
> and napi_gro_receive returns GRO_DROP
> 
> Fixes: ba2b232108d3c ("net: netsec: add XDP support")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>


>  drivers/net/ethernet/socionext/netsec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
> index 0e12a9856aea..56c0e643f430 100644
> --- a/drivers/net/ethernet/socionext/netsec.c
> +++ b/drivers/net/ethernet/socionext/netsec.c
> @@ -942,8 +942,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget)
>  		struct netsec_de *de = dring->vaddr + (DESC_SZ * idx);
>  		struct netsec_desc *desc = &dring->desc[idx];
>  		struct page *page = virt_to_page(desc->addr);
> +		u32 xdp_result = NETSEC_XDP_PASS;

As a help to reviewers value is:
#define NETSEC_XDP_PASS          0

>  		struct sk_buff *skb = NULL;
> -		u32 xdp_result = XDP_PASS;

XDP_PASS == 2
>  		u16 pkt_len, desc_len;
>  		dma_addr_t dma_handle;
>  		struct xdp_buff xdp;
Ilias Apalodimas Jan. 27, 2020, 8:01 a.m. UTC | #2
On Sat, Jan 25, 2020 at 12:48:51PM +0100, Lorenzo Bianconi wrote:
> Fix xdp_result initialization in netsec_process_rx in order to not
> increase rx counters if there is no bpf program attached to the xdp hook
> and napi_gro_receive returns GRO_DROP
> 
> Fixes: ba2b232108d3c ("net: netsec: add XDP support")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  drivers/net/ethernet/socionext/netsec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
> index 0e12a9856aea..56c0e643f430 100644
> --- a/drivers/net/ethernet/socionext/netsec.c
> +++ b/drivers/net/ethernet/socionext/netsec.c
> @@ -942,8 +942,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget)
>  		struct netsec_de *de = dring->vaddr + (DESC_SZ * idx);
>  		struct netsec_desc *desc = &dring->desc[idx];
>  		struct page *page = virt_to_page(desc->addr);
> +		u32 xdp_result = NETSEC_XDP_PASS;
>  		struct sk_buff *skb = NULL;
> -		u32 xdp_result = XDP_PASS;
>  		u16 pkt_len, desc_len;
>  		dma_addr_t dma_handle;
>  		struct xdp_buff xdp;
> -- 
> 2.21.1
> 

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index 0e12a9856aea..56c0e643f430 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -942,8 +942,8 @@  static int netsec_process_rx(struct netsec_priv *priv, int budget)
 		struct netsec_de *de = dring->vaddr + (DESC_SZ * idx);
 		struct netsec_desc *desc = &dring->desc[idx];
 		struct page *page = virt_to_page(desc->addr);
+		u32 xdp_result = NETSEC_XDP_PASS;
 		struct sk_buff *skb = NULL;
-		u32 xdp_result = XDP_PASS;
 		u16 pkt_len, desc_len;
 		dma_addr_t dma_handle;
 		struct xdp_buff xdp;