* [PATCH v2 net] octeontx2-af: npc: Fix CPT channel mask in npc_install_flow
@ 2026-06-02 4:58 Ratheesh Kannoth
2026-06-03 5:07 ` Ratheesh Kannoth
2026-06-04 15:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Ratheesh Kannoth @ 2026-06-02 4:58 UTC (permalink / raw)
To: davem, linux-kernel, naveenm, netdev
Cc: andrew+netdev, edumazet, kuba, pabeni, sgoutham,
Nithin Dabilpuram, Ratheesh Kannoth
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
Use the CPT-aware NIX channel mask in the npc_install_flow path so that
when the host PF installs steering rules in kernel for a VF used from
userspace (e.g. DPDK), MCAM entries see the same channel mask semantics as
other RX paths.
Fixes: 56bcef528bd8 ("octeontx2-af: Use npc_install_flow API for promisc and broadcast entries")
Cc: Naveen Mamindlapalli <naveenm@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
.../net/ethernet/marvell/octeontx2/af/rvu.h | 1 +
.../ethernet/marvell/octeontx2/af/rvu_npc.c | 32 +++++++++----------
.../marvell/octeontx2/af/rvu_npc_fs.c | 2 +-
3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
index de3fbd3d15d6..65397daae4c2 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
@@ -1145,6 +1145,7 @@ int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf,
int slot);
int rvu_cpt_ctx_flush(struct rvu *rvu, u16 pcifunc);
int rvu_cpt_init(struct rvu *rvu);
+u32 rvu_get_cpt_chan_mask(struct rvu *rvu);
#define NDC_AF_BANK_MASK GENMASK_ULL(7, 0)
#define NDC_AF_BANK_LINE_MASK GENMASK_ULL(31, 16)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
index 607d0cf1a778..12074f3b3e39 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
@@ -701,6 +701,19 @@ void npc_set_mcam_action(struct rvu *rvu, struct npc_mcam *mcam,
return rvu_write64(rvu, blkaddr, reg, cfg);
}
+u32 rvu_get_cpt_chan_mask(struct rvu *rvu)
+{
+ /* For cn10k the upper two bits of the channel number are
+ * cpt channel number. with masking out these bits in the
+ * mcam entry, same entry used for NIX will allow packets
+ * received from cpt for parsing.
+ */
+ if (!is_rvu_otx2(rvu))
+ return NIX_CHAN_CPT_X2P_MASK;
+ else
+ return 0xFFFu;
+}
+
void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
int nixlf, u64 chan, u8 *mac_addr)
{
@@ -750,7 +763,7 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
eth_broadcast_addr((u8 *)&req.mask.dmac);
req.features = BIT_ULL(NPC_DMAC);
req.channel = chan;
- req.chan_mask = 0xFFFU;
+ req.chan_mask = rvu_get_cpt_chan_mask(rvu);
req.intf = pfvf->nix_rx_intf;
req.op = action.op;
req.hdr.pcifunc = 0; /* AF is requester */
@@ -845,11 +858,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
* mcam entry, same entry used for NIX will allow packets
* received from cpt for parsing.
*/
- if (!is_rvu_otx2(rvu)) {
- req.chan_mask = NIX_CHAN_CPT_X2P_MASK;
- } else {
- req.chan_mask = 0xFFFU;
- }
+ req.chan_mask = rvu_get_cpt_chan_mask(rvu);
if (chan_cnt > 1) {
if (!is_power_of_2(chan_cnt)) {
@@ -1053,16 +1062,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
ether_addr_copy(req.mask.dmac, mac_addr);
req.features = BIT_ULL(NPC_DMAC);
- /* For cn10k the upper two bits of the channel number are
- * cpt channel number. with masking out these bits in the
- * mcam entry, same entry used for NIX will allow packets
- * received from cpt for parsing.
- */
- if (!is_rvu_otx2(rvu))
- req.chan_mask = NIX_CHAN_CPT_X2P_MASK;
- else
- req.chan_mask = 0xFFFU;
-
+ req.chan_mask = rvu_get_cpt_chan_mask(rvu);
req.channel = chan;
req.intf = pfvf->nix_rx_intf;
req.entry = index;
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 6ae9cdcb608b..34f1e066707b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
@@ -1820,7 +1820,7 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
/* ignore chan_mask in case pf func is not AF, revisit later */
if (!is_pffunc_af(req->hdr.pcifunc))
- req->chan_mask = 0xFFF;
+ req->chan_mask = rvu_get_cpt_chan_mask(rvu);
err = npc_check_unsupported_flows(rvu, req->features, req->intf);
if (err) {
--
2.43.0
--
v1 -> v2: Addressed Sashiko comments
https://lore.kernel.org/netdev/20260601023221.858168-1-rkannoth@marvell.com/
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net] octeontx2-af: npc: Fix CPT channel mask in npc_install_flow
2026-06-02 4:58 [PATCH v2 net] octeontx2-af: npc: Fix CPT channel mask in npc_install_flow Ratheesh Kannoth
@ 2026-06-03 5:07 ` Ratheesh Kannoth
2026-06-04 15:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Ratheesh Kannoth @ 2026-06-03 5:07 UTC (permalink / raw)
To: davem, linux-kernel, naveenm, netdev
Cc: andrew+netdev, edumazet, kuba, pabeni, sgoutham,
Nithin Dabilpuram
On 2026-06-02 at 10:28:53, Ratheesh Kannoth (rkannoth@marvell.com) wrote:
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
>
> Use the CPT-aware NIX channel mask in the npc_install_flow path so that
> when the host PF installs steering rules in kernel for a VF used from
> userspace (e.g. DPDK), MCAM entries see the same channel mask semantics as
> other RX paths.
>
> Fixes: 56bcef528bd8 ("octeontx2-af: Use npc_install_flow API for promisc and broadcast entries")
> Cc: Naveen Mamindlapalli <naveenm@marvell.com>
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
> ---
https://sashiko.dev/#/patchset/20260602045853.1558530-1-rkannoth%40marvell.com
sashiko says:
> - /* For cn10k the upper two bits of the channel number are
>> - * cpt channel number. with masking out these bits in the
>> - * mcam entry, same entry used for NIX will allow packets
>> - * received from cpt for parsing.
>> - */
>> - if (!is_rvu_otx2(rvu))
>> - req.chan_mask = NIX_CHAN_CPT_X2P_MASK;
>> - else
>> - req.chan_mask = 0xFFFU;
>> -
>> + req.chan_mask = rvu_get_cpt_chan_mask(rvu);
>> req.channel = chan;
>> req.intf = pfvf->nix_rx_intf;
>> req.entry = index;
>This isn't a bug introduced by this patch, but should the channel mask
>also be updated in rvu_npc_install_bcast_match_entry() and
>rvu_switch_disable()?
No. we dont need this in bcast and switch_disable().
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net] octeontx2-af: npc: Fix CPT channel mask in npc_install_flow
2026-06-02 4:58 [PATCH v2 net] octeontx2-af: npc: Fix CPT channel mask in npc_install_flow Ratheesh Kannoth
2026-06-03 5:07 ` Ratheesh Kannoth
@ 2026-06-04 15:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-04 15:40 UTC (permalink / raw)
To: Ratheesh Kannoth
Cc: davem, linux-kernel, naveenm, netdev, andrew+netdev, edumazet,
kuba, pabeni, sgoutham, ndabilpuram
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 2 Jun 2026 10:28:53 +0530 you wrote:
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
>
> Use the CPT-aware NIX channel mask in the npc_install_flow path so that
> when the host PF installs steering rules in kernel for a VF used from
> userspace (e.g. DPDK), MCAM entries see the same channel mask semantics as
> other RX paths.
>
> [...]
Here is the summary with links:
- [v2,net] octeontx2-af: npc: Fix CPT channel mask in npc_install_flow
https://git.kernel.org/netdev/net/c/1d31eb27e570
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-04 15:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 4:58 [PATCH v2 net] octeontx2-af: npc: Fix CPT channel mask in npc_install_flow Ratheesh Kannoth
2026-06-03 5:07 ` Ratheesh Kannoth
2026-06-04 15:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox