All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: marvell: return csum computation result from mvneta_rx_csum/mvpp2_rx_csum
@ 2021-06-17 15:34 Lorenzo Bianconi
  2021-06-22  8:22 ` Lorenzo Bianconi
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2021-06-17 15:34 UTC (permalink / raw)
  To: netdev
  Cc: lorenzo.bianconi, mcroce, davem, kuba, sgoutham, sbhatta,
	stefanc, brouer

This is a preliminary patch to add hw csum hint support to
mvneta/mvpp2 xdp implementation

Tested-by: Matteo Croce <mcroce@linux.microsoft.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/marvell/mvneta.c         | 19 +++++++------------
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   | 14 +++++---------
 2 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index c15ce06427d0..88a755034c39 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -1805,18 +1805,14 @@ static void mvneta_rx_error(struct mvneta_port *pp,
 }
 
 /* Handle RX checksum offload based on the descriptor's status */
-static void mvneta_rx_csum(struct mvneta_port *pp, u32 status,
-			   struct sk_buff *skb)
+static int mvneta_rx_csum(struct mvneta_port *pp, u32 status)
 {
 	if ((pp->dev->features & NETIF_F_RXCSUM) &&
 	    (status & MVNETA_RXD_L3_IP4) &&
-	    (status & MVNETA_RXD_L4_CSUM_OK)) {
-		skb->csum = 0;
-		skb->ip_summed = CHECKSUM_UNNECESSARY;
-		return;
-	}
+	    (status & MVNETA_RXD_L4_CSUM_OK))
+		return CHECKSUM_UNNECESSARY;
 
-	skb->ip_summed = CHECKSUM_NONE;
+	return CHECKSUM_NONE;
 }
 
 /* Return tx queue pointer (find last set bit) according to <cause> returned
@@ -2335,7 +2331,7 @@ mvneta_swbm_build_skb(struct mvneta_port *pp, struct page_pool *pool,
 
 	skb_reserve(skb, xdp->data - xdp->data_hard_start);
 	skb_put(skb, xdp->data_end - xdp->data);
-	mvneta_rx_csum(pp, desc_status, skb);
+	skb->ip_summed = mvneta_rx_csum(pp, desc_status);
 
 	for (i = 0; i < num_frags; i++) {
 		skb_frag_t *frag = &sinfo->frags[i];
@@ -2535,7 +2531,7 @@ static int mvneta_rx_hwbm(struct napi_struct *napi,
 				     rx_bytes);
 
 			skb->protocol = eth_type_trans(skb, dev);
-			mvneta_rx_csum(pp, rx_status, skb);
+			skb->ip_summed = mvneta_rx_csum(pp, rx_status);
 			napi_gro_receive(napi, skb);
 
 			rcvd_pkts++;
@@ -2584,8 +2580,7 @@ static int mvneta_rx_hwbm(struct napi_struct *napi,
 		skb_put(skb, rx_bytes);
 
 		skb->protocol = eth_type_trans(skb, dev);
-
-		mvneta_rx_csum(pp, rx_status, skb);
+		skb->ip_summed = mvneta_rx_csum(pp, rx_status);
 
 		napi_gro_receive(napi, skb);
 	}
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 9bca8c8f9f8d..01f6078bc859 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -3543,21 +3543,17 @@ static void mvpp2_rx_error(struct mvpp2_port *port,
 }
 
 /* Handle RX checksum offload */
-static void mvpp2_rx_csum(struct mvpp2_port *port, u32 status,
-			  struct sk_buff *skb)
+static int mvpp2_rx_csum(struct mvpp2_port *port, u32 status)
 {
 	if (((status & MVPP2_RXD_L3_IP4) &&
 	     !(status & MVPP2_RXD_IP4_HEADER_ERR)) ||
 	    (status & MVPP2_RXD_L3_IP6))
 		if (((status & MVPP2_RXD_L4_UDP) ||
 		     (status & MVPP2_RXD_L4_TCP)) &&
-		     (status & MVPP2_RXD_L4_CSUM_OK)) {
-			skb->csum = 0;
-			skb->ip_summed = CHECKSUM_UNNECESSARY;
-			return;
-		}
+		     (status & MVPP2_RXD_L4_CSUM_OK))
+			return CHECKSUM_UNNECESSARY;
 
-	skb->ip_summed = CHECKSUM_NONE;
+	return CHECKSUM_NONE;
 }
 
 /* Allocate a new skb and add it to BM pool */
@@ -4012,7 +4008,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
 
 		skb_reserve(skb, MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM);
 		skb_put(skb, rx_bytes);
-		mvpp2_rx_csum(port, rx_status, skb);
+		skb->ip_summed = mvpp2_rx_csum(port, rx_status);
 		skb->protocol = eth_type_trans(skb, dev);
 
 		napi_gro_receive(napi, skb);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: marvell: return csum computation result from mvneta_rx_csum/mvpp2_rx_csum
  2021-06-17 15:34 [PATCH net-next] net: marvell: return csum computation result from mvneta_rx_csum/mvpp2_rx_csum Lorenzo Bianconi
@ 2021-06-22  8:22 ` Lorenzo Bianconi
  2021-06-22 17:05   ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2021-06-22  8:22 UTC (permalink / raw)
  To: netdev
  Cc: mcroce, davem, kuba, sgoutham, sbhatta, stefanc, brouer,
	thomas.petazzoni, linux, mw

[-- Attachment #1: Type: text/plain, Size: 4247 bytes --]

> This is a preliminary patch to add hw csum hint support to
> mvneta/mvpp2 xdp implementation
> 
> Tested-by: Matteo Croce <mcroce@linux.microsoft.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>

Hi Dave and Jakub,

I have just noticed this patch is marked as "Not Applicable" in patchwork. I
tried to rebase it on top of net-next and it applies and compiles so I am
wondering why it is "not applicable". Am I missing something?

Regards,
Lorenzo

> ---
>  drivers/net/ethernet/marvell/mvneta.c         | 19 +++++++------------
>  .../net/ethernet/marvell/mvpp2/mvpp2_main.c   | 14 +++++---------
>  2 files changed, 12 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index c15ce06427d0..88a755034c39 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -1805,18 +1805,14 @@ static void mvneta_rx_error(struct mvneta_port *pp,
>  }
>  
>  /* Handle RX checksum offload based on the descriptor's status */
> -static void mvneta_rx_csum(struct mvneta_port *pp, u32 status,
> -			   struct sk_buff *skb)
> +static int mvneta_rx_csum(struct mvneta_port *pp, u32 status)
>  {
>  	if ((pp->dev->features & NETIF_F_RXCSUM) &&
>  	    (status & MVNETA_RXD_L3_IP4) &&
> -	    (status & MVNETA_RXD_L4_CSUM_OK)) {
> -		skb->csum = 0;
> -		skb->ip_summed = CHECKSUM_UNNECESSARY;
> -		return;
> -	}
> +	    (status & MVNETA_RXD_L4_CSUM_OK))
> +		return CHECKSUM_UNNECESSARY;
>  
> -	skb->ip_summed = CHECKSUM_NONE;
> +	return CHECKSUM_NONE;
>  }
>  
>  /* Return tx queue pointer (find last set bit) according to <cause> returned
> @@ -2335,7 +2331,7 @@ mvneta_swbm_build_skb(struct mvneta_port *pp, struct page_pool *pool,
>  
>  	skb_reserve(skb, xdp->data - xdp->data_hard_start);
>  	skb_put(skb, xdp->data_end - xdp->data);
> -	mvneta_rx_csum(pp, desc_status, skb);
> +	skb->ip_summed = mvneta_rx_csum(pp, desc_status);
>  
>  	for (i = 0; i < num_frags; i++) {
>  		skb_frag_t *frag = &sinfo->frags[i];
> @@ -2535,7 +2531,7 @@ static int mvneta_rx_hwbm(struct napi_struct *napi,
>  				     rx_bytes);
>  
>  			skb->protocol = eth_type_trans(skb, dev);
> -			mvneta_rx_csum(pp, rx_status, skb);
> +			skb->ip_summed = mvneta_rx_csum(pp, rx_status);
>  			napi_gro_receive(napi, skb);
>  
>  			rcvd_pkts++;
> @@ -2584,8 +2580,7 @@ static int mvneta_rx_hwbm(struct napi_struct *napi,
>  		skb_put(skb, rx_bytes);
>  
>  		skb->protocol = eth_type_trans(skb, dev);
> -
> -		mvneta_rx_csum(pp, rx_status, skb);
> +		skb->ip_summed = mvneta_rx_csum(pp, rx_status);
>  
>  		napi_gro_receive(napi, skb);
>  	}
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 9bca8c8f9f8d..01f6078bc859 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -3543,21 +3543,17 @@ static void mvpp2_rx_error(struct mvpp2_port *port,
>  }
>  
>  /* Handle RX checksum offload */
> -static void mvpp2_rx_csum(struct mvpp2_port *port, u32 status,
> -			  struct sk_buff *skb)
> +static int mvpp2_rx_csum(struct mvpp2_port *port, u32 status)
>  {
>  	if (((status & MVPP2_RXD_L3_IP4) &&
>  	     !(status & MVPP2_RXD_IP4_HEADER_ERR)) ||
>  	    (status & MVPP2_RXD_L3_IP6))
>  		if (((status & MVPP2_RXD_L4_UDP) ||
>  		     (status & MVPP2_RXD_L4_TCP)) &&
> -		     (status & MVPP2_RXD_L4_CSUM_OK)) {
> -			skb->csum = 0;
> -			skb->ip_summed = CHECKSUM_UNNECESSARY;
> -			return;
> -		}
> +		     (status & MVPP2_RXD_L4_CSUM_OK))
> +			return CHECKSUM_UNNECESSARY;
>  
> -	skb->ip_summed = CHECKSUM_NONE;
> +	return CHECKSUM_NONE;
>  }
>  
>  /* Allocate a new skb and add it to BM pool */
> @@ -4012,7 +4008,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
>  
>  		skb_reserve(skb, MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM);
>  		skb_put(skb, rx_bytes);
> -		mvpp2_rx_csum(port, rx_status, skb);
> +		skb->ip_summed = mvpp2_rx_csum(port, rx_status);
>  		skb->protocol = eth_type_trans(skb, dev);
>  
>  		napi_gro_receive(napi, skb);
> -- 
> 2.31.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: marvell: return csum computation result from mvneta_rx_csum/mvpp2_rx_csum
  2021-06-22  8:22 ` Lorenzo Bianconi
@ 2021-06-22 17:05   ` David Miller
  2021-06-22 17:19     ` Lorenzo Bianconi
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2021-06-22 17:05 UTC (permalink / raw)
  To: lorenzo.bianconi
  Cc: netdev, mcroce, kuba, sgoutham, sbhatta, stefanc, brouer,
	thomas.petazzoni, linux, mw

From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date: Tue, 22 Jun 2021 10:22:27 +0200

>> This is a preliminary patch to add hw csum hint support to
>> mvneta/mvpp2 xdp implementation
>> 
>> Tested-by: Matteo Croce <mcroce@linux.microsoft.com>
>> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> Hi Dave and Jakub,
> 
> I have just noticed this patch is marked as "Not Applicable" in patchwork. I
> tried to rebase it on top of net-next and it applies and compiles so I am
> wondering why it is "not applicable". Am I missing something?

It did not apply cleanly for me, please resend.

Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: marvell: return csum computation result from mvneta_rx_csum/mvpp2_rx_csum
  2021-06-22 17:05   ` David Miller
@ 2021-06-22 17:19     ` Lorenzo Bianconi
  0 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2021-06-22 17:19 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, mcroce, kuba, sgoutham, sbhatta, stefanc, brouer,
	thomas.petazzoni, linux, mw

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

On Jun 22, David Miller wrote:
> From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> Date: Tue, 22 Jun 2021 10:22:27 +0200
> 
> >> This is a preliminary patch to add hw csum hint support to
> >> mvneta/mvpp2 xdp implementation
> >> 
> >> Tested-by: Matteo Croce <mcroce@linux.microsoft.com>
> >> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > 
> > Hi Dave and Jakub,
> > 
> > I have just noticed this patch is marked as "Not Applicable" in patchwork. I
> > tried to rebase it on top of net-next and it applies and compiles so I am
> > wondering why it is "not applicable". Am I missing something?
> 
> It did not apply cleanly for me, please resend.
> 
> Thank you.
> 

ack, I will post v2 soon.

Regards,
Lorenzo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-22 17:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 15:34 [PATCH net-next] net: marvell: return csum computation result from mvneta_rx_csum/mvpp2_rx_csum Lorenzo Bianconi
2021-06-22  8:22 ` Lorenzo Bianconi
2021-06-22 17:05   ` David Miller
2021-06-22 17:19     ` Lorenzo Bianconi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.