From: Simon Horman <horms@kernel.org>
To: Hariprasad Kelam <hkelam@marvell.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Sunil Goutham <sgoutham@marvell.com>,
Linu Cherian <lcherian@marvell.com>,
Geetha sowjanya <gakula@marvell.com>,
Jerin Jacob <jerinj@marvell.com>,
Subbaraya Sundeep <sbhatta@marvell.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Ratheesh Kannoth <rkannoth@marvell.com>
Subject: Re: [net] Octeontx2-af: Skip overlap check for SPI field
Date: Sat, 26 Jul 2025 18:44:28 +0100 [thread overview]
Message-ID: <20250726174428.GL1367887@horms.kernel.org> (raw)
In-Reply-To: <20250725064802.2440356-1-hkelam@marvell.com>
On Fri, Jul 25, 2025 at 12:18:02PM +0530, Hariprasad Kelam wrote:
> Octeontx2/CN10K silicon supports generating a 256-bit key per packet.
> The specific fields to be extracted from a packet for key generation
> are configurable via a Key Extraction (MKEX) Profile.
>
> The AF driver scans the configured extraction profile to ensure that
> fields from upper layers do not overwrite fields from lower layers in
> the key.
>
> Example Packet Field Layout:
> LA: DMAC + SMAC
> LB: VLAN
> LC: IPv4/IPv6
> LD: TCP/UDP
>
> Valid MKEX Profile Configuration:
>
> LA -> DMAC -> key_offset[0-5]
> LC -> SIP -> key_offset[20-23]
> LD -> SPORT -> key_offset[30-31]
>
> Invalid MKEX profile configuration:
>
> LA -> DMAC -> key_offset[0-5]
> LC -> SIP -> key_offset[20-23]
> LD -> SPORT -> key_offset[2-3] // Overlaps with DMAC field
>
> In another scenario, if the MKEX profile is configured to extract
> the SPI field from both AH and ESP headers at the same key offset,
> the driver rejecting this configuration. In a regular traffic,
> ipsec packet will be having either AF(LD) or ESP (LE). This patch
Should "AF" be "AH ?
> relaxes the check for the same.
>
> Fixes: 12aa0a3b93f3 ("octeontx2-af: Harden rule validation.")
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> ---
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> index 1b765045aa63..d8d491a01e5b 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> @@ -607,7 +607,7 @@ static void npc_set_features(struct rvu *rvu, int blkaddr, u8 intf)
> *features &= ~BIT_ULL(NPC_OUTER_VID);
>
> /* Set SPI flag only if AH/ESP and IPSEC_SPI are in the key */
> - if (npc_check_field(rvu, blkaddr, NPC_IPSEC_SPI, intf) &&
> + if (npc_is_field_present(rvu, NPC_IPSEC_SPI, intf) &&
As this checks now differs in form from that of other's in this function,
perhaps expanding the comment above is warranted.
> (*features & (BIT_ULL(NPC_IPPROTO_ESP) | BIT_ULL(NPC_IPPROTO_AH))))
> *features |= BIT_ULL(NPC_IPSEC_SPI);
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-07-26 17:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 6:48 [net] Octeontx2-af: Skip overlap check for SPI field Hariprasad Kelam
2025-07-26 17:44 ` Simon Horman [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-05-25 9:58 Hariprasad Kelam
2025-05-28 14:50 ` Simon Horman
2025-05-29 1:49 ` Jakub Kicinski
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=20250726174428.GL1367887@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gakula@marvell.com \
--cc=hkelam@marvell.com \
--cc=jerinj@marvell.com \
--cc=kuba@kernel.org \
--cc=lcherian@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).