RE: [EXT] Re: [PATCH net-next] net: mvpp2: Add parsing support for different IPv4 IHL values

2021-04-13 Thread Stefan Chulski


> -Original Message-
> From: Marcin Wojtas 
> Sent: Tuesday, April 13, 2021 12:59 PM
> To: Stefan Chulski 
> Cc: Russell King - ARM Linux admin ;
> net...@vger.kernel.org; thomas.petazz...@bootlin.com;
> da...@davemloft.net; Nadav Haklai ; Yan
> Markman ; linux-kernel@vger.kernel.org;
> k...@kernel.org; and...@lunn.ch; aten...@kernel.org; Liron Himi
> ; Dana Vardi 
> Subject: Re: [EXT] Re: [PATCH net-next] net: mvpp2: Add parsing support for
> different IPv4 IHL values
> 
> Hi Stefan,
> 
> wt., 13 kwi 2021 o 11:56 Stefan Chulski  napisał(a):
> >
> > > > -Original Message-
> > > > From: Russell King - ARM Linux admin 
> > > > Sent: Tuesday, April 13, 2021 12:18 PM
> > > > To: Stefan Chulski 
> > > > Cc: net...@vger.kernel.org; thomas.petazz...@bootlin.com;
> > > > da...@davemloft.net; Nadav Haklai ; Yan
> > > Markman
> > > > ; linux-kernel@vger.kernel.org;
> > > k...@kernel.org;
> > > > m...@semihalf.com; and...@lunn.ch; aten...@kernel.org; Liron Himi
> > > > ; Dana Vardi 
> > > > Subject: [EXT] Re: [PATCH net-next] net: mvpp2: Add parsing
> > > > support for different IPv4 IHL values
> > > >
> > > > External Email
> > > >
> > > > --
> > > >  On Tue, Apr 13, 2021 at 11:45:31AM +0300, stef...@marvell.com
> > > > wrote:
> > > > > From: Stefan Chulski 
> > > > >
> > > > > Add parser entries for different IPv4 IHL values.
> > > > > Each entry will set the L4 header offset according to the IPv4 IHL 
> > > > > field.
> > > > > L3 header offset will set during the parsing of the IPv4 protocol.
> > > >
> > > > What is the impact of this commit? Is something broken at the
> > > > moment, if so what? Does this need to be backported to stable
> kernels?
> > > >
> > > > These are key questions, of which the former two should be covered
> > > > in every commit message so that the reason for the change can be
> known.
> > > > It's no good just describing what is being changed in the commit
> > > > without also describing why the change is being made.
> > > >
> > > > Thanks.
> > >
> > > Due to missed parser support for IP header length > 20, RX IPv4
> > > checksum offload fail.
> > >
> > > Regards.
> >
> > Currently driver set skb->ip_summed = CHECKSUM_NONE and checksum
> done by software.
> > So this just improve performance for packets with IP header length > 20.
> > IMO we can keep it in net-next.
> >
> > Stefan.
> 
> Please update the commit message in v2 with the explanation.
> 
> Also - is there an easy way to test it? L3 forwarding with forced header
> length?
> 
> Thanks,
> Marcin

I will wait for additional comments and resend it tomorrow.
We probably should see this in "perf top" in L3 forwarding. Less cycles 
consumed by Network stack checksum callback.

Regards. 




Re: [EXT] Re: [PATCH net-next] net: mvpp2: Add parsing support for different IPv4 IHL values

2021-04-13 Thread Marcin Wojtas
Hi Stefan,

wt., 13 kwi 2021 o 11:56 Stefan Chulski  napisał(a):
>
> > > -Original Message-
> > > From: Russell King - ARM Linux admin 
> > > Sent: Tuesday, April 13, 2021 12:18 PM
> > > To: Stefan Chulski 
> > > Cc: net...@vger.kernel.org; thomas.petazz...@bootlin.com;
> > > da...@davemloft.net; Nadav Haklai ; Yan
> > Markman
> > > ; linux-kernel@vger.kernel.org;
> > k...@kernel.org;
> > > m...@semihalf.com; and...@lunn.ch; aten...@kernel.org; Liron Himi
> > > ; Dana Vardi 
> > > Subject: [EXT] Re: [PATCH net-next] net: mvpp2: Add parsing support
> > > for different IPv4 IHL values
> > >
> > > External Email
> > >
> > > --
> > > On Tue, Apr 13, 2021 at 11:45:31AM +0300, stef...@marvell.com wrote:
> > > > From: Stefan Chulski 
> > > >
> > > > Add parser entries for different IPv4 IHL values.
> > > > Each entry will set the L4 header offset according to the IPv4 IHL 
> > > > field.
> > > > L3 header offset will set during the parsing of the IPv4 protocol.
> > >
> > > What is the impact of this commit? Is something broken at the moment,
> > > if so what? Does this need to be backported to stable kernels?
> > >
> > > These are key questions, of which the former two should be covered in
> > > every commit message so that the reason for the change can be known.
> > > It's no good just describing what is being changed in the commit
> > > without also describing why the change is being made.
> > >
> > > Thanks.
> >
> > Due to missed parser support for IP header length > 20, RX IPv4 checksum
> > offload fail.
> >
> > Regards.
>
> Currently driver set skb->ip_summed = CHECKSUM_NONE and checksum done by 
> software.
> So this just improve performance for packets with IP header length > 20.
> IMO we can keep it in net-next.
>
> Stefan.

Please update the commit message in v2 with the explanation.

Also - is there an easy way to test it? L3 forwarding with forced header length?

Thanks,
Marcin


RE: [EXT] Re: [PATCH net-next] net: mvpp2: Add parsing support for different IPv4 IHL values

2021-04-13 Thread Stefan Chulski
> > -Original Message-
> > From: Russell King - ARM Linux admin 
> > Sent: Tuesday, April 13, 2021 12:18 PM
> > To: Stefan Chulski 
> > Cc: net...@vger.kernel.org; thomas.petazz...@bootlin.com;
> > da...@davemloft.net; Nadav Haklai ; Yan
> Markman
> > ; linux-kernel@vger.kernel.org;
> k...@kernel.org;
> > m...@semihalf.com; and...@lunn.ch; aten...@kernel.org; Liron Himi
> > ; Dana Vardi 
> > Subject: [EXT] Re: [PATCH net-next] net: mvpp2: Add parsing support
> > for different IPv4 IHL values
> >
> > External Email
> >
> > --
> > On Tue, Apr 13, 2021 at 11:45:31AM +0300, stef...@marvell.com wrote:
> > > From: Stefan Chulski 
> > >
> > > Add parser entries for different IPv4 IHL values.
> > > Each entry will set the L4 header offset according to the IPv4 IHL field.
> > > L3 header offset will set during the parsing of the IPv4 protocol.
> >
> > What is the impact of this commit? Is something broken at the moment,
> > if so what? Does this need to be backported to stable kernels?
> >
> > These are key questions, of which the former two should be covered in
> > every commit message so that the reason for the change can be known.
> > It's no good just describing what is being changed in the commit
> > without also describing why the change is being made.
> >
> > Thanks.
> 
> Due to missed parser support for IP header length > 20, RX IPv4 checksum
> offload fail.
> 
> Regards.

Currently driver set skb->ip_summed = CHECKSUM_NONE and checksum done by 
software.
So this just improve performance for packets with IP header length > 20. 
IMO we can keep it in net-next.

Stefan.


RE: [EXT] Re: [PATCH net-next] net: mvpp2: Add parsing support for different IPv4 IHL values

2021-04-13 Thread Stefan Chulski
> -Original Message-
> From: Russell King - ARM Linux admin 
> Sent: Tuesday, April 13, 2021 12:18 PM
> To: Stefan Chulski 
> Cc: net...@vger.kernel.org; thomas.petazz...@bootlin.com;
> da...@davemloft.net; Nadav Haklai ; Yan
> Markman ; linux-kernel@vger.kernel.org;
> k...@kernel.org; m...@semihalf.com; and...@lunn.ch;
> aten...@kernel.org; Liron Himi ; Dana Vardi
> 
> Subject: [EXT] Re: [PATCH net-next] net: mvpp2: Add parsing support for
> different IPv4 IHL values
> 
> External Email
> 
> --
> On Tue, Apr 13, 2021 at 11:45:31AM +0300, stef...@marvell.com wrote:
> > From: Stefan Chulski 
> >
> > Add parser entries for different IPv4 IHL values.
> > Each entry will set the L4 header offset according to the IPv4 IHL field.
> > L3 header offset will set during the parsing of the IPv4 protocol.
> 
> What is the impact of this commit? Is something broken at the moment, if so
> what? Does this need to be backported to stable kernels?
> 
> These are key questions, of which the former two should be covered in
> every commit message so that the reason for the change can be known.
> It's no good just describing what is being changed in the commit without also
> describing why the change is being made.
> 
> Thanks.

Due to missed parser support for IP header length > 20, RX IPv4 checksum 
offload fail.

Regards. 


Re: [PATCH net-next] net: mvpp2: Add parsing support for different IPv4 IHL values

2021-04-13 Thread Russell King - ARM Linux admin
On Tue, Apr 13, 2021 at 11:45:31AM +0300, stef...@marvell.com wrote:
> From: Stefan Chulski 
> 
> Add parser entries for different IPv4 IHL values.
> Each entry will set the L4 header offset according to the IPv4 IHL field.
> L3 header offset will set during the parsing of the IPv4 protocol.

What is the impact of this commit? Is something broken at the moment,
if so what? Does this need to be backported to stable kernels?

These are key questions, of which the former two should be covered in
every commit message so that the reason for the change can be known.
It's no good just describing what is being changed in the commit without
also describing why the change is being made.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!


[PATCH net-next] net: mvpp2: Add parsing support for different IPv4 IHL values

2021-04-13 Thread stefanc
From: Stefan Chulski 

Add parser entries for different IPv4 IHL values.
Each entry will set the L4 header offset according to the IPv4 IHL field.
L3 header offset will set during the parsing of the IPv4 protocol.

Suggested-by: Dana Vardi 
Signed-off-by: Stefan Chulski 
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c | 107 
 drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.h |   3 +-
 2 files changed, 43 insertions(+), 67 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c 
b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c
index 4812cdb..7cc7d72 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c
@@ -918,9 +918,8 @@ static int mvpp2_prs_ip4_proto(struct mvpp2 *priv, unsigned 
short proto,
mvpp2_prs_sram_next_lu_set(, MVPP2_PRS_LU_FLOWS);
mvpp2_prs_sram_bits_set(, MVPP2_PRS_SRAM_LU_GEN_BIT, 1);
 
-   /* Set L4 offset */
-   mvpp2_prs_sram_offset_set(, MVPP2_PRS_SRAM_UDF_TYPE_L4,
- sizeof(struct iphdr) - 4,
+   /* Set L3 offset */
+   mvpp2_prs_sram_offset_set(, MVPP2_PRS_SRAM_UDF_TYPE_L3, -4,
  MVPP2_PRS_SRAM_OP_SEL_UDF_ADD);
mvpp2_prs_sram_ai_update(, 0, MVPP2_PRS_IPV4_DIP_AI_BIT);
mvpp2_prs_sram_ri_update(, ri, ri_mask | MVPP2_PRS_RI_IP_FRAG_MASK);
@@ -1335,7 +1334,7 @@ static void mvpp2_prs_vid_init(struct mvpp2 *priv)
 static int mvpp2_prs_etype_init(struct mvpp2 *priv)
 {
struct mvpp2_prs_entry pe;
-   int tid;
+   int tid, ihl;
 
/* Ethertype: PPPoE */
tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID,
@@ -1427,67 +1426,43 @@ static int mvpp2_prs_etype_init(struct mvpp2 *priv)
MVPP2_PRS_RI_UDF3_MASK);
mvpp2_prs_hw_write(priv, );
 
-   /* Ethertype: IPv4 without options */
-   tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID,
-   MVPP2_PE_LAST_FREE_TID);
-   if (tid < 0)
-   return tid;
-
-   memset(, 0, sizeof(pe));
-   mvpp2_prs_tcam_lu_set(, MVPP2_PRS_LU_L2);
-   pe.index = tid;
-
-   mvpp2_prs_match_etype(, 0, ETH_P_IP);
-   mvpp2_prs_tcam_data_byte_set(, MVPP2_ETH_TYPE_LEN,
-MVPP2_PRS_IPV4_HEAD | MVPP2_PRS_IPV4_IHL,
-MVPP2_PRS_IPV4_HEAD_MASK |
-MVPP2_PRS_IPV4_IHL_MASK);
-
-   mvpp2_prs_sram_next_lu_set(, MVPP2_PRS_LU_IP4);
-   mvpp2_prs_sram_ri_update(, MVPP2_PRS_RI_L3_IP4,
-MVPP2_PRS_RI_L3_PROTO_MASK);
-   /* goto ipv4 dest-address (skip eth_type + IP-header-size - 4) */
-   mvpp2_prs_sram_shift_set(, MVPP2_ETH_TYPE_LEN +
-sizeof(struct iphdr) - 4,
-MVPP2_PRS_SRAM_OP_SEL_SHIFT_ADD);
-   /* Set L3 offset */
-   mvpp2_prs_sram_offset_set(, MVPP2_PRS_SRAM_UDF_TYPE_L3,
- MVPP2_ETH_TYPE_LEN,
- MVPP2_PRS_SRAM_OP_SEL_UDF_ADD);
-
-   /* Update shadow table and hw entry */
-   mvpp2_prs_shadow_set(priv, pe.index, MVPP2_PRS_LU_L2);
-   priv->prs_shadow[pe.index].udf = MVPP2_PRS_UDF_L2_DEF;
-   priv->prs_shadow[pe.index].finish = false;
-   mvpp2_prs_shadow_ri_set(priv, pe.index, MVPP2_PRS_RI_L3_IP4,
-   MVPP2_PRS_RI_L3_PROTO_MASK);
-   mvpp2_prs_hw_write(priv, );
-
-   /* Ethertype: IPv4 with options */
-   tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID,
-   MVPP2_PE_LAST_FREE_TID);
-   if (tid < 0)
-   return tid;
-
-   pe.index = tid;
+   /* Ethertype: IPv4 with header length >= 5 */
+   for (ihl = MVPP2_PRS_IPV4_IHL_MIN; ihl <= MVPP2_PRS_IPV4_IHL_MAX; 
ihl++) {
+   tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID,
+   MVPP2_PE_LAST_FREE_TID);
+   if (tid < 0)
+   return tid;
 
-   mvpp2_prs_tcam_data_byte_set(, MVPP2_ETH_TYPE_LEN,
-MVPP2_PRS_IPV4_HEAD,
-MVPP2_PRS_IPV4_HEAD_MASK);
+   memset(, 0, sizeof(pe));
+   mvpp2_prs_tcam_lu_set(, MVPP2_PRS_LU_L2);
+   pe.index = tid;
 
-   /* Clear ri before updating */
-   pe.sram[MVPP2_PRS_SRAM_RI_WORD] = 0x0;
-   pe.sram[MVPP2_PRS_SRAM_RI_CTRL_WORD] = 0x0;
-   mvpp2_prs_sram_ri_update(, MVPP2_PRS_RI_L3_IP4_OPT,
-MVPP2_PRS_RI_L3_PROTO_MASK);
+   mvpp2_prs_match_etype(, 0, ETH_P_IP);
+   mvpp2_prs_tcam_data_byte_set(, MVPP2_ETH_TYPE_LEN,
+MVPP2_PRS_IPV4_HEAD | ihl,
+