All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Sven Auhagen <Sven.Auhagen@voleatech.de>
Cc: netdev@vger.kernel.org, mw@semihalf.com, linux@armlinux.org.uk,
	kuba@kernel.org, davem@davemloft.net,
	maxime.chevallier@bootlin.com
Subject: Re: [PATCH 3/3] net: mvpp2: parser fix PPPoE
Date: Wed, 15 Mar 2023 12:53:02 +0100	[thread overview]
Message-ID: <ZBGxnjxwmY0NyVt7@localhost.localdomain> (raw)
In-Reply-To: <20230311071024.irbtnpzvihm37hna@Svens-MacBookPro.local>

On Sat, Mar 11, 2023 at 08:10:24AM +0100, Sven Auhagen wrote:
> In PPPoE add all IPv4 header option length to the parser
> and adjust the L3 and L4 offset accordingly.
> Currently the L4 match does not work with PPPoE and
> all packets are matched as L3 IP4 OPT.
> 
> Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
> 
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c
> index ed8be396428b..9af22f497a40 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c
> @@ -1607,59 +1607,45 @@ static int mvpp2_prs_vlan_init(struct platform_device *pdev, struct mvpp2 *priv)
>  static int mvpp2_prs_pppoe_init(struct mvpp2 *priv)
>  {
>  	struct mvpp2_prs_entry pe;
> -	int tid;
> -
> -	/* IPv4 over PPPoE with options */
> -	tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID,
> -					MVPP2_PE_LAST_FREE_TID);
> -	if (tid < 0)
> -		return tid;
> -
> -	memset(&pe, 0, sizeof(pe));
> -	mvpp2_prs_tcam_lu_set(&pe, MVPP2_PRS_LU_PPPOE);
> -	pe.index = tid;
> -
> -	mvpp2_prs_match_etype(&pe, 0, PPP_IP);
> -
> -	mvpp2_prs_sram_next_lu_set(&pe, MVPP2_PRS_LU_IP4);
> -	mvpp2_prs_sram_ri_update(&pe, MVPP2_PRS_RI_L3_IP4_OPT,
> -				 MVPP2_PRS_RI_L3_PROTO_MASK);
> -	/* goto ipv4 dest-address (skip eth_type + IP-header-size - 4) */
> -	mvpp2_prs_sram_shift_set(&pe, MVPP2_ETH_TYPE_LEN +
> -				 sizeof(struct iphdr) - 4,
> -				 MVPP2_PRS_SRAM_OP_SEL_SHIFT_ADD);
> -	/* Set L3 offset */
> -	mvpp2_prs_sram_offset_set(&pe, 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_PPPOE);
> -	mvpp2_prs_hw_write(priv, &pe);
> +	int tid, ihl;
>  
> -	/* IPv4 over PPPoE without options */
> -	tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID,
> -					MVPP2_PE_LAST_FREE_TID);
> -	if (tid < 0)
> -		return tid;
> +	/* IPv4 over PPPoE 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);
pe can be defined here:
struct mvpp2_prs_entry pe = {};

and now memset can be ommited.

> +		if (tid < 0)
> +			return tid;
>  
> -	pe.index = tid;
> +		memset(&pe, 0, sizeof(pe));
> +		mvpp2_prs_tcam_lu_set(&pe, MVPP2_PRS_LU_PPPOE);
> +		pe.index = tid;
[...]
>  
> -- 
> 2.33.1
> 

      parent reply	other threads:[~2023-03-15 11:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-11  7:10 [PATCH 3/3] net: mvpp2: parser fix PPPoE Sven Auhagen
2023-03-15  7:00 ` Jakub Kicinski
2023-03-15  7:54   ` Sven Auhagen
2023-03-15 11:53 ` Michal Swiatkowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBGxnjxwmY0NyVt7@localhost.localdomain \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=Sven.Auhagen@voleatech.de \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mw@semihalf.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.