All of lore.kernel.org
 help / color / mirror / Atom feed
* [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC
@ 2022-08-03  7:54 Subbaraya Sundeep
  2022-08-03  7:54 ` [net v4 PATCH 1/4] octeontx2-af: Apply tx nibble fixup always Subbaraya Sundeep
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Subbaraya Sundeep @ 2022-08-03  7:54 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev, sgoutham; +Cc: Subbaraya Sundeep

This patchset includes AF driver fixes wrt packet parser NPC.
Following are the changes:

Patch 1: The parser nibble configuration must be same for
TX and RX interfaces and if not fix up is applied. This fixup was
applied only for default profile currently and it has been fixed
to apply for all profiles.
Patch 2: Firmware image may not be present all times in the kernel image
and default profile is used mostly hence suppress the warning.
Patch 3: This patch fixes a corner case where NIXLF is detached but
without freeing its mcam entries which results in resource leak.
Patch 4: SMAC is overlapped with DMAC mistakenly while installing
rules based on SMAC. This patch fixes that.


v4 changes:
As per Jakub's comment,
  removed one of the patches from v3 since it is not a fix

v3 changes:
As suggested by Jakub, 
  used request_firmware_direct() since no fallback is needed in patch 2.
  refactored code in patch 3 to avoid goto.

v2 changes:
Added the space which was missing between commit hash
and ("octeontx2-af for patch 4.

Thanks,
Sundeep


Harman Kalra (1):
  octeontx2-af: suppress external profile loading warning

Stanislaw Kardach (1):
  octeontx2-af: Apply tx nibble fixup always

Subbaraya Sundeep (2):
  octeontx2-af: Fix mcam entry resource leak
  octeontx2-af: Fix key checking for source mac

 drivers/net/ethernet/marvell/octeontx2/af/rvu.c        |  6 ++++++
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c    | 15 +++++++++++----
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c |  3 ++-
 3 files changed, 19 insertions(+), 5 deletions(-)

-- 
2.7.4


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

* [net v4 PATCH 1/4] octeontx2-af: Apply tx nibble fixup always
  2022-08-03  7:54 [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC Subbaraya Sundeep
@ 2022-08-03  7:54 ` Subbaraya Sundeep
  2022-08-03  7:54 ` [net v4 PATCH 2/4] octeontx2-af: suppress external profile loading warning Subbaraya Sundeep
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Subbaraya Sundeep @ 2022-08-03  7:54 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev, sgoutham
  Cc: Stanislaw Kardach, Subbaraya Sundeep

From: Stanislaw Kardach <skardach@marvell.com>

NPC_PARSE_NIBBLE for TX interface has to be equal to the RX one for some
silicon revisions. Mistakenly this fixup was only applied to the default
MKEX profile while it should also be applied to any loaded profile.

Fixes: 1c1935c9945d ("octeontx2-af: Add NIX1 interfaces to NPC")
Signed-off-by: Stanislaw Kardach <skardach@marvell.com>
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
index 3a31fb8..3d99cb9 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
@@ -1915,6 +1915,7 @@ static void rvu_npc_hw_init(struct rvu *rvu, int blkaddr)
 
 static void rvu_npc_setup_interfaces(struct rvu *rvu, int blkaddr)
 {
+	struct npc_mcam_kex *mkex = rvu->kpu.mkex;
 	struct npc_mcam *mcam = &rvu->hw->mcam;
 	struct rvu_hwinfo *hw = rvu->hw;
 	u64 nibble_ena, rx_kex, tx_kex;
@@ -1927,15 +1928,15 @@ static void rvu_npc_setup_interfaces(struct rvu *rvu, int blkaddr)
 	mcam->counters.max--;
 	mcam->rx_miss_act_cntr = mcam->counters.max;
 
-	rx_kex = npc_mkex_default.keyx_cfg[NIX_INTF_RX];
-	tx_kex = npc_mkex_default.keyx_cfg[NIX_INTF_TX];
+	rx_kex = mkex->keyx_cfg[NIX_INTF_RX];
+	tx_kex = mkex->keyx_cfg[NIX_INTF_TX];
 	nibble_ena = FIELD_GET(NPC_PARSE_NIBBLE, rx_kex);
 
 	nibble_ena = rvu_npc_get_tx_nibble_cfg(rvu, nibble_ena);
 	if (nibble_ena) {
 		tx_kex &= ~NPC_PARSE_NIBBLE;
 		tx_kex |= FIELD_PREP(NPC_PARSE_NIBBLE, nibble_ena);
-		npc_mkex_default.keyx_cfg[NIX_INTF_TX] = tx_kex;
+		mkex->keyx_cfg[NIX_INTF_TX] = tx_kex;
 	}
 
 	/* Configure RX interfaces */
-- 
2.7.4


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

* [net v4 PATCH 2/4] octeontx2-af: suppress external profile loading warning
  2022-08-03  7:54 [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC Subbaraya Sundeep
  2022-08-03  7:54 ` [net v4 PATCH 1/4] octeontx2-af: Apply tx nibble fixup always Subbaraya Sundeep
@ 2022-08-03  7:54 ` Subbaraya Sundeep
  2022-08-03  7:54 ` [net v4 PATCH 3/4] octeontx2-af: Fix mcam entry resource leak Subbaraya Sundeep
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Subbaraya Sundeep @ 2022-08-03  7:54 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev, sgoutham
  Cc: Harman Kalra, Subbaraya Sundeep

From: Harman Kalra <hkalra@marvell.com>

The packet parser profile supplied as firmware may not
be present all the time and default profile is used mostly.
Hence suppress firmware loading warning from kernel due to
absence of firmware in kernel image.

Fixes: 3a7244152f9c ("octeontx2-af: add support for custom KPU entries")
Signed-off-by: Harman Kalra <hkalra@marvell.com>
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
index 3d99cb9..10a4210 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
@@ -1650,7 +1650,7 @@ static void npc_load_kpu_profile(struct rvu *rvu)
 	 * Firmware database method.
 	 * Default KPU profile.
 	 */
-	if (!request_firmware(&fw, kpu_profile, rvu->dev)) {
+	if (!request_firmware_direct(&fw, kpu_profile, rvu->dev)) {
 		dev_info(rvu->dev, "Loading KPU profile from firmware: %s\n",
 			 kpu_profile);
 		rvu->kpu_fwdata = kzalloc(fw->size, GFP_KERNEL);
-- 
2.7.4


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

* [net v4 PATCH 3/4] octeontx2-af: Fix mcam entry resource leak
  2022-08-03  7:54 [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC Subbaraya Sundeep
  2022-08-03  7:54 ` [net v4 PATCH 1/4] octeontx2-af: Apply tx nibble fixup always Subbaraya Sundeep
  2022-08-03  7:54 ` [net v4 PATCH 2/4] octeontx2-af: suppress external profile loading warning Subbaraya Sundeep
@ 2022-08-03  7:54 ` Subbaraya Sundeep
  2022-08-03  7:54 ` [net v4 PATCH 4/4] octeontx2-af: Fix key checking for source mac Subbaraya Sundeep
  2022-08-06  2:00 ` [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Subbaraya Sundeep @ 2022-08-03  7:54 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev, sgoutham; +Cc: Subbaraya Sundeep

The teardown sequence in FLR handler returns if no NIX LF
is attached to PF/VF because it indicates that graceful
shutdown of resources already happened. But there is a
chance of all allocated MCAM entries not being freed by
PF/VF. Hence free mcam entries even in case of detached LF.

Fixes: c554f9c1574e ("octeontx2-af: Teardown NPA, NIX LF upon receiving FLR")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c     | 6 ++++++
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index 54e1b27..1484d33 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -2564,6 +2564,12 @@ static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)
 	rvu_blklf_teardown(rvu, pcifunc, BLKADDR_NPA);
 	rvu_reset_lmt_map_tbl(rvu, pcifunc);
 	rvu_detach_rsrcs(rvu, NULL, pcifunc);
+	/* In scenarios where PF/VF drivers detach NIXLF without freeing MCAM
+	 * entries, check and free the MCAM entries explicitly to avoid leak.
+	 * Since LF is detached use LF number as -1.
+	 */
+	rvu_npc_free_mcam_entries(rvu, pcifunc, -1);
+
 	mutex_unlock(&rvu->flr_lock);
 }
 
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
index 10a4210..13f8dfaa 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
@@ -1096,6 +1096,9 @@ static void npc_enadis_default_entries(struct rvu *rvu, u16 pcifunc,
 
 void rvu_npc_disable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf)
 {
+	if (nixlf < 0)
+		return;
+
 	npc_enadis_default_entries(rvu, pcifunc, nixlf, false);
 
 	/* Delete multicast and promisc MCAM entries */
@@ -1107,6 +1110,9 @@ void rvu_npc_disable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf)
 
 void rvu_npc_enable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf)
 {
+	if (nixlf < 0)
+		return;
+
 	/* Enables only broadcast match entry. Promisc/Allmulti are enabled
 	 * in set_rx_mode mbox handler.
 	 */
-- 
2.7.4


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

* [net v4 PATCH 4/4] octeontx2-af: Fix key checking for source mac
  2022-08-03  7:54 [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC Subbaraya Sundeep
                   ` (2 preceding siblings ...)
  2022-08-03  7:54 ` [net v4 PATCH 3/4] octeontx2-af: Fix mcam entry resource leak Subbaraya Sundeep
@ 2022-08-03  7:54 ` Subbaraya Sundeep
  2022-08-06  2:00 ` [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Subbaraya Sundeep @ 2022-08-03  7:54 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev, sgoutham; +Cc: Subbaraya Sundeep

Given a field with its location/offset in input packet,
the key checking logic verifies whether extracting the
field can be supported or not based on the mkex profile
loaded in hardware. This logic is wrong wrt source mac
and this patch fixes that.

Fixes: 9b179a960a96 ("octeontx2-af: Generate key field bit mask from KEX profile")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 3 ++-
 1 file changed, 2 insertions(+), 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 19c53e5..64654bd 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
@@ -445,7 +445,8 @@ do {									       \
 	NPC_SCAN_HDR(NPC_VLAN_TAG1, NPC_LID_LB, NPC_LT_LB_CTAG, 2, 2);
 	NPC_SCAN_HDR(NPC_VLAN_TAG2, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 2, 2);
 	NPC_SCAN_HDR(NPC_DMAC, NPC_LID_LA, la_ltype, la_start, 6);
-	NPC_SCAN_HDR(NPC_SMAC, NPC_LID_LA, la_ltype, la_start, 6);
+	/* SMAC follows the DMAC(which is 6 bytes) */
+	NPC_SCAN_HDR(NPC_SMAC, NPC_LID_LA, la_ltype, la_start + 6, 6);
 	/* PF_FUNC is 2 bytes at 0th byte of NPC_LT_LA_IH_NIX_ETHER */
 	NPC_SCAN_HDR(NPC_PF_FUNC, NPC_LID_LA, NPC_LT_LA_IH_NIX_ETHER, 0, 2);
 }
-- 
2.7.4


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

* Re: [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC
  2022-08-03  7:54 [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC Subbaraya Sundeep
                   ` (3 preceding siblings ...)
  2022-08-03  7:54 ` [net v4 PATCH 4/4] octeontx2-af: Fix key checking for source mac Subbaraya Sundeep
@ 2022-08-06  2:00 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-06  2:00 UTC (permalink / raw)
  To: Subbaraya Sundeep; +Cc: davem, kuba, pabeni, edumazet, netdev, sgoutham

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 3 Aug 2022 13:24:11 +0530 you wrote:
> This patchset includes AF driver fixes wrt packet parser NPC.
> Following are the changes:
> 
> Patch 1: The parser nibble configuration must be same for
> TX and RX interfaces and if not fix up is applied. This fixup was
> applied only for default profile currently and it has been fixed
> to apply for all profiles.
> Patch 2: Firmware image may not be present all times in the kernel image
> and default profile is used mostly hence suppress the warning.
> Patch 3: This patch fixes a corner case where NIXLF is detached but
> without freeing its mcam entries which results in resource leak.
> Patch 4: SMAC is overlapped with DMAC mistakenly while installing
> rules based on SMAC. This patch fixes that.
> 
> [...]

Here is the summary with links:
  - [net,v4,1/4] octeontx2-af: Apply tx nibble fixup always
    https://git.kernel.org/netdev/net/c/dd1d1a8a6b29
  - [net,v4,2/4] octeontx2-af: suppress external profile loading warning
    https://git.kernel.org/netdev/net/c/cf2437626502
  - [net,v4,3/4] octeontx2-af: Fix mcam entry resource leak
    https://git.kernel.org/netdev/net/c/3f8fe40ab773
  - [net,v4,4/4] octeontx2-af: Fix key checking for source mac
    https://git.kernel.org/netdev/net/c/c3c290276927

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] 6+ messages in thread

end of thread, other threads:[~2022-08-06  2:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03  7:54 [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC Subbaraya Sundeep
2022-08-03  7:54 ` [net v4 PATCH 1/4] octeontx2-af: Apply tx nibble fixup always Subbaraya Sundeep
2022-08-03  7:54 ` [net v4 PATCH 2/4] octeontx2-af: suppress external profile loading warning Subbaraya Sundeep
2022-08-03  7:54 ` [net v4 PATCH 3/4] octeontx2-af: Fix mcam entry resource leak Subbaraya Sundeep
2022-08-03  7:54 ` [net v4 PATCH 4/4] octeontx2-af: Fix key checking for source mac Subbaraya Sundeep
2022-08-06  2:00 ` [net v4 PATCH 0/4] Octeontx2 AF driver fixes for NPC patchwork-bot+netdevbpf

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.