netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net PATCH 00/10] Miscellaneous fixes
@ 2021-08-22 12:02 Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 01/10] octeontx2-pf: Fix NIX1_RX interface backpressure Sunil Goutham
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Sunil Goutham

This patch series contains a bunch of miscellaneous fixes
for various issues like
- Free unallocated memory during driver unload
- HW reading transmit descriptor from wrong address
- VF VLAN strip offload MCAM entry installation failure
- Pkts not being distributed across queues in RSS context
- Wrong interface backpressure configuration for NIX1 block on 98xx
- etc

Geetha sowjanya (4):
  octeontx2-af: Handle return value in block reset.
  octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc
  octeontx2-af: Check capability flag while freeing ipolicer memory
  octeontx2-af: cn10k: Use FLIT0 register instead of FLIT1

Hariprasad Kelam (1):
  octeontx2-pf: Don't mask out supported link modes

Naveen Mamindlapalli (1):
  octeontx2-pf: send correct vlan priority mask to npc_install_flow_req

Subbaraya Sundeep (2):
  octeontx2-pf: Fix NIX1_RX interface backpressure
  octeontx2-af: cn10k: Fix SDP base channel number

Sunil Goutham (2):
  octeontx2-pf: Don't install VLAN offload rule if netdev is down
  octeontx2-pf: Fix algorithm index in MCAM rules with RSS action

 drivers/net/ethernet/marvell/octeontx2/af/common.h | 13 ++++----
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c    |  5 +++-
 .../net/ethernet/marvell/octeontx2/af/rvu_cn10k.c  | 35 +++++++++++++++-------
 .../net/ethernet/marvell/octeontx2/af/rvu_nix.c    |  9 ++++--
 .../net/ethernet/marvell/octeontx2/af/rvu_reg.h    |  2 +-
 .../ethernet/marvell/octeontx2/nic/otx2_common.c   | 29 +++++++++++++++++-
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |  3 ++
 .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  |  5 ----
 .../ethernet/marvell/octeontx2/nic/otx2_flows.c    |  1 +
 .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c   |  4 +--
 10 files changed, 75 insertions(+), 31 deletions(-)

-- 
2.7.4


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

* [net PATCH 01/10] octeontx2-pf: Fix NIX1_RX interface backpressure
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 02/10] octeontx2-af: cn10k: Fix SDP base channel number Sunil Goutham
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Subbaraya Sundeep, Hariprasad Kelam, Sunil Goutham

From: Subbaraya Sundeep <sbhatta@marvell.com>

'bp_ena' in Aura context is NIX block index, setting it
zero will always backpressure NIX0 block, even if NIXLF
belongs to NIX1. Hence fix this by setting it appropriately
based on NIX block address.

Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 70fcc1f..2112008 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -1190,7 +1190,22 @@ static int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
 	/* Enable backpressure for RQ aura */
 	if (aura_id < pfvf->hw.rqpool_cnt && !is_otx2_lbkvf(pfvf->pdev)) {
 		aq->aura.bp_ena = 0;
+		/* If NIX1 LF is attached then specify NIX1_RX.
+		 *
+		 * Below NPA_AURA_S[BP_ENA] is set according to the
+		 * NPA_BPINTF_E enumeration given as:
+		 * 0x0 + a*0x1 where 'a' is 0 for NIX0_RX and 1 for NIX1_RX so
+		 * NIX0_RX is 0x0 + 0*0x1 = 0
+		 * NIX1_RX is 0x0 + 1*0x1 = 1
+		 * But in HRM it is given that
+		 * "NPA_AURA_S[BP_ENA](w1[33:32]) - Enable aura backpressure to
+		 * NIX-RX based on [BP] level. One bit per NIX-RX; index
+		 * enumerated by NPA_BPINTF_E."
+		 */
+		if (pfvf->nix_blkaddr == BLKADDR_NIX1)
+			aq->aura.bp_ena = 1;
 		aq->aura.nix0_bpid = pfvf->bpid[0];
+
 		/* Set backpressure level for RQ's Aura */
 		aq->aura.bp = RQ_BP_LVL_AURA;
 	}
-- 
2.7.4


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

* [net PATCH 02/10] octeontx2-af: cn10k: Fix SDP base channel number
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 01/10] octeontx2-pf: Fix NIX1_RX interface backpressure Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 03/10] octeontx2-af: Handle return value in block reset Sunil Goutham
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Subbaraya Sundeep, Sunil Goutham

From: Subbaraya Sundeep <sbhatta@marvell.com>

As per hardware the base channel number configured
for programmable channels of a block must be multiple
of number of channels of that block. This condition
is not met for SDP base channel currently. Hence this
patch ensures all the base channel numbers of all
blocks are multiple of number of channels present in
the blocks. Also instead of hardcoding SDP number
of channels the same is read from the NIX_AF_CONST1
register.

Fixes: 242da439214b ("octeontx2-af: cn10k: Add support for programmable")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/common.h |  2 --
 .../net/ethernet/marvell/octeontx2/af/rvu_cn10k.c  | 31 +++++++++++++++-------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/common.h b/drivers/net/ethernet/marvell/octeontx2/af/common.h
index 47f5ed0..e0b43aa 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/common.h
@@ -195,8 +195,6 @@ enum nix_scheduler {
 #define NIX_CHAN_LBK_CHX(a, b)		(0 + 0x100 * (a) + (b))
 #define NIX_CHAN_SDP_CH_START		(0x700ull)
 
-#define SDP_CHANNELS			256
-
 /* The mask is to extract lower 10-bits of channel number
  * which CPT will pass to X2P.
  */
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
index 8d48b64..28dcce7 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
@@ -212,9 +212,10 @@ void rvu_reset_lmt_map_tbl(struct rvu *rvu, u16 pcifunc)
 
 int rvu_set_channels_base(struct rvu *rvu)
 {
+	u16 nr_lbk_chans, nr_sdp_chans, nr_cgx_chans, nr_cpt_chans;
+	u16 sdp_chan_base, cgx_chan_base, cpt_chan_base;
 	struct rvu_hwinfo *hw = rvu->hw;
-	u16 cpt_chan_base;
-	u64 nix_const;
+	u64 nix_const, nix_const1;
 	int blkaddr;
 
 	blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, 0);
@@ -222,6 +223,7 @@ int rvu_set_channels_base(struct rvu *rvu)
 		return blkaddr;
 
 	nix_const = rvu_read64(rvu, blkaddr, NIX_AF_CONST);
+	nix_const1 = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
 
 	hw->cgx = (nix_const >> 12) & 0xFULL;
 	hw->lmac_per_cgx = (nix_const >> 8) & 0xFULL;
@@ -244,14 +246,24 @@ int rvu_set_channels_base(struct rvu *rvu)
 	 * channels such that all channel numbers are contiguous
 	 * leaving no holes. This way the new CPT channels can be
 	 * accomodated. The order of channel numbers assigned is
-	 * LBK, SDP, CGX and CPT.
+	 * LBK, SDP, CGX and CPT. Also the base channel number
+	 * of a block must be multiple of number of channels
+	 * of the block.
 	 */
-	hw->sdp_chan_base = hw->lbk_chan_base + hw->lbk_links *
-				((nix_const >> 16) & 0xFFULL);
-	hw->cgx_chan_base = hw->sdp_chan_base + hw->sdp_links * SDP_CHANNELS;
+	nr_lbk_chans = (nix_const >> 16) & 0xFFULL;
+	nr_sdp_chans = nix_const1 & 0xFFFULL;
+	nr_cgx_chans = nix_const & 0xFFULL;
+	nr_cpt_chans = (nix_const >> 32) & 0xFFFULL;
 
-	cpt_chan_base = hw->cgx_chan_base + hw->cgx_links *
-				(nix_const & 0xFFULL);
+	sdp_chan_base = hw->lbk_chan_base + hw->lbk_links * nr_lbk_chans;
+	/* Round up base channel to multiple of number of channels */
+	hw->sdp_chan_base = ALIGN(sdp_chan_base, nr_sdp_chans);
+
+	cgx_chan_base = hw->sdp_chan_base + hw->sdp_links * nr_sdp_chans;
+	hw->cgx_chan_base = ALIGN(cgx_chan_base, nr_cgx_chans);
+
+	cpt_chan_base = hw->cgx_chan_base + hw->cgx_links * nr_cgx_chans;
+	hw->cpt_chan_base = ALIGN(cpt_chan_base, nr_cpt_chans);
 
 	/* Out of 4096 channels start CPT from 2048 so
 	 * that MSB for CPT channels is always set
@@ -355,6 +367,7 @@ static void rvu_lbk_set_channels(struct rvu *rvu)
 
 static void __rvu_nix_set_channels(struct rvu *rvu, int blkaddr)
 {
+	u64 nix_const1 = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
 	u64 nix_const = rvu_read64(rvu, blkaddr, NIX_AF_CONST);
 	u16 cgx_chans, lbk_chans, sdp_chans, cpt_chans;
 	struct rvu_hwinfo *hw = rvu->hw;
@@ -364,7 +377,7 @@ static void __rvu_nix_set_channels(struct rvu *rvu, int blkaddr)
 
 	cgx_chans = nix_const & 0xFFULL;
 	lbk_chans = (nix_const >> 16) & 0xFFULL;
-	sdp_chans = SDP_CHANNELS;
+	sdp_chans = nix_const1 & 0xFFFULL;
 	cpt_chans = (nix_const >> 32) & 0xFFFULL;
 
 	start = hw->cgx_chan_base;
-- 
2.7.4


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

* [net PATCH 03/10] octeontx2-af: Handle return value in block reset.
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 01/10] octeontx2-pf: Fix NIX1_RX interface backpressure Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 02/10] octeontx2-af: cn10k: Fix SDP base channel number Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 04/10] octeontx2-pf: Don't mask out supported link modes Sunil Goutham
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Geetha sowjanya, Sunil Goutham

From: Geetha sowjanya <gakula@marvell.com>

Print debug message if any of the RVU hardware blocks
reset fails.

Signed-off-by: Geetha sowjanya <gakula@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index 5fe277e..633ba6c 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -498,12 +498,15 @@ int rvu_lf_reset(struct rvu *rvu, struct rvu_block *block, int lf)
 static void rvu_block_reset(struct rvu *rvu, int blkaddr, u64 rst_reg)
 {
 	struct rvu_block *block = &rvu->hw->block[blkaddr];
+	int err;
 
 	if (!block->implemented)
 		return;
 
 	rvu_write64(rvu, blkaddr, rst_reg, BIT_ULL(0));
-	rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true);
+	err = rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true);
+	if (err)
+		dev_err(rvu->dev, "HW block:%d reset failed\n", blkaddr);
 }
 
 static void rvu_reset_all_blocks(struct rvu *rvu)
-- 
2.7.4


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

* [net PATCH 04/10] octeontx2-pf: Don't mask out supported link modes
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
                   ` (2 preceding siblings ...)
  2021-08-22 12:02 ` [net PATCH 03/10] octeontx2-af: Handle return value in block reset Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 05/10] octeontx2-pf: send correct vlan priority mask to npc_install_flow_req Sunil Goutham
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Hariprasad Kelam, Sunil Goutham

From: Hariprasad Kelam <hkelam@marvell.com>

Supported link modes are updated by firmware in shared
structure per interface. Kernel uses this value to display
supported link modes via ethtool.

Currently there is extra validation that firmware updated
modes are validated against internal list of supported modes.
As intenal list of supported modes are not updated frequently
new modes supported by firmware are not updated to ethtool.

Hence remove extra validation and report all firmware updated
modes.

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index b906a0e..b90decf 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -33,9 +33,6 @@ struct otx2_stat {
 	.index = offsetof(struct otx2_dev_stats, stat) / sizeof(u64), \
 }
 
-/* Physical link config */
-#define OTX2_ETHTOOL_SUPPORTED_MODES 0x638CCBF //110001110001100110010111111
-
 enum link_mode {
 	OTX2_MODE_SUPPORTED,
 	OTX2_MODE_ADVERTISED
@@ -1116,8 +1113,6 @@ static void otx2_get_link_mode_info(u64 link_mode_bmap,
 	};
 	u8 bit;
 
-	link_mode_bmap = link_mode_bmap & OTX2_ETHTOOL_SUPPORTED_MODES;
-
 	for_each_set_bit(bit, (unsigned long *)&link_mode_bmap, 27) {
 		/* SGMII mode is set */
 		if (bit == 0)
-- 
2.7.4


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

* [net PATCH 05/10] octeontx2-pf: send correct vlan priority mask to npc_install_flow_req
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
                   ` (3 preceding siblings ...)
  2021-08-22 12:02 ` [net PATCH 04/10] octeontx2-pf: Don't mask out supported link modes Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 06/10] octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc Sunil Goutham
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Naveen Mamindlapalli, Sunil Goutham

From: Naveen Mamindlapalli <naveenm@marvell.com>

This patch corrects the erroneous vlan priority mask field that was
send to npc_install_flow_req.

Fixes: 1d4d9e42c240 ("octeontx2-pf: Add tc flower hardware offload on ingress traffic")
Signed-off-by: Naveen Mamindlapalli <naveenm@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
index 972b202..32d5c62 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
@@ -485,8 +485,8 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node,
 				   match.key->vlan_priority << 13;
 
 			vlan_tci_mask = match.mask->vlan_id |
-					match.key->vlan_dei << 12 |
-					match.key->vlan_priority << 13;
+					match.mask->vlan_dei << 12 |
+					match.mask->vlan_priority << 13;
 
 			flow_spec->vlan_tci = htons(vlan_tci);
 			flow_mask->vlan_tci = htons(vlan_tci_mask);
-- 
2.7.4


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

* [net PATCH 06/10] octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
                   ` (4 preceding siblings ...)
  2021-08-22 12:02 ` [net PATCH 05/10] octeontx2-pf: send correct vlan priority mask to npc_install_flow_req Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 07/10] octeontx2-af: Check capability flag while freeing ipolicer memory Sunil Goutham
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Geetha sowjanya, Sunil Goutham

From: Geetha sowjanya <gakula@marvell.com>

CN10K platform requires physically contiguous memory for LMTST
operations which goes beyond a single page. Not having physically
contiguous memory will result in HW fetching transmit descriptors from
a wrong memory location.

Hence use DMA_ATTR_FORCE_CONTIGUOUS attribute while allocating
LMTST regions.

Signed-off-by: Geetha sowjanya <gakula@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/common.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/common.h b/drivers/net/ethernet/marvell/octeontx2/af/common.h
index e0b43aa..459fa95 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/common.h
@@ -64,8 +64,8 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q,
 
 	qmem->entry_sz = entry_sz;
 	qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN;
-	qmem->base = dma_alloc_coherent(dev, qmem->alloc_sz,
-					 &qmem->iova, GFP_KERNEL);
+	qmem->base = dma_alloc_attrs(dev, qmem->alloc_sz, &qmem->iova,
+				     GFP_KERNEL, DMA_ATTR_FORCE_CONTIGUOUS);
 	if (!qmem->base)
 		return -ENOMEM;
 
@@ -84,9 +84,10 @@ static inline void qmem_free(struct device *dev, struct qmem *qmem)
 		return;
 
 	if (qmem->base)
-		dma_free_coherent(dev, qmem->alloc_sz,
-				  qmem->base - qmem->align,
-				  qmem->iova - qmem->align);
+		dma_free_attrs(dev, qmem->alloc_sz,
+			       qmem->base - qmem->align,
+			       qmem->iova - qmem->align,
+			       DMA_ATTR_FORCE_CONTIGUOUS);
 	devm_kfree(dev, qmem);
 }
 
-- 
2.7.4


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

* [net PATCH 07/10] octeontx2-af: Check capability flag while freeing ipolicer memory
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
                   ` (5 preceding siblings ...)
  2021-08-22 12:02 ` [net PATCH 06/10] octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 08/10] octeontx2-pf: Don't install VLAN offload rule if netdev is down Sunil Goutham
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Geetha sowjanya, Sunil Goutham

From: Geetha sowjanya <gakula@marvell.com>

Bandwidth profiles (ipolicer structure)is implemented only on CN10K
platform. But current code try to free the ipolicer memory without
checking the capibility flag leading to driver crash on OCTEONTX2
platform. This patch fixes the issue by add capability flag check.

Fixes: e8e095b3b3700 ("octeontx2-af: cn10k: Bandwidth profiles config support")
Signed-off-by: Geetha sowjanya <gakula@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
index 4bfbbdf..c321950 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
@@ -25,7 +25,7 @@ static int nix_update_mce_rule(struct rvu *rvu, u16 pcifunc,
 			       int type, bool add);
 static int nix_setup_ipolicers(struct rvu *rvu,
 			       struct nix_hw *nix_hw, int blkaddr);
-static void nix_ipolicer_freemem(struct nix_hw *nix_hw);
+static void nix_ipolicer_freemem(struct rvu *rvu, struct nix_hw *nix_hw);
 static int nix_verify_bandprof(struct nix_cn10k_aq_enq_req *req,
 			       struct nix_hw *nix_hw, u16 pcifunc);
 static int nix_free_all_bandprof(struct rvu *rvu, u16 pcifunc);
@@ -3849,7 +3849,7 @@ static void rvu_nix_block_freemem(struct rvu *rvu, int blkaddr,
 			kfree(txsch->schq.bmap);
 		}
 
-		nix_ipolicer_freemem(nix_hw);
+		nix_ipolicer_freemem(rvu, nix_hw);
 
 		vlan = &nix_hw->txvlan;
 		kfree(vlan->rsrc.bmap);
@@ -4225,11 +4225,14 @@ static int nix_setup_ipolicers(struct rvu *rvu,
 	return 0;
 }
 
-static void nix_ipolicer_freemem(struct nix_hw *nix_hw)
+static void nix_ipolicer_freemem(struct rvu *rvu, struct nix_hw *nix_hw)
 {
 	struct nix_ipolicer *ipolicer;
 	int layer;
 
+	if (!rvu->hw->cap.ipolicer)
+		return;
+
 	for (layer = 0; layer < BAND_PROF_NUM_LAYERS; layer++) {
 		ipolicer = &nix_hw->ipolicer[layer];
 
-- 
2.7.4


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

* [net PATCH 08/10] octeontx2-pf: Don't install VLAN offload rule if netdev is down
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
                   ` (6 preceding siblings ...)
  2021-08-22 12:02 ` [net PATCH 07/10] octeontx2-af: Check capability flag while freeing ipolicer memory Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 09/10] octeontx2-pf: Fix algorithm index in MCAM rules with RSS action Sunil Goutham
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Sunil Goutham

Whenever user changes interface MAC address both default DMAC based
MCAM rule and VLAN offload (for strip) rules are updated with new
MAC address. To update or install VLAN offload rule PF driver needs
interface's receive channel info, which is retrieved from admin
function at the time of NIXLF initialization.

If user changes MAC address before interface is UP, VLAN offload rule
installation will fail and throw error as receive channel is not valid.
To avoid this, skip VLAN offload rule installation if netdev is not UP.
This rule will anyway be reinslatted as part of open() call.

Fixes: fd9d7859db6c ("octeontx2-pf: Implement ingress/egress VLAN offload")
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 2112008..4e125d6 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -208,7 +208,8 @@ int otx2_set_mac_address(struct net_device *netdev, void *p)
 	if (!otx2_hw_set_mac_addr(pfvf, addr->sa_data)) {
 		memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
 		/* update dmac field in vlan offload rule */
-		if (pfvf->flags & OTX2_FLAG_RX_VLAN_SUPPORT)
+		if (netif_running(netdev) &&
+		    pfvf->flags & OTX2_FLAG_RX_VLAN_SUPPORT)
 			otx2_install_rxvlan_offload_flow(pfvf);
 		/* update dmac address in ntuple and DMAC filter list */
 		if (pfvf->flags & OTX2_FLAG_DMACFLTR_SUPPORT)
-- 
2.7.4


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

* [net PATCH 09/10] octeontx2-pf: Fix algorithm index in MCAM rules with RSS action
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
                   ` (7 preceding siblings ...)
  2021-08-22 12:02 ` [net PATCH 08/10] octeontx2-pf: Don't install VLAN offload rule if netdev is down Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 12:02 ` [net PATCH 10/10] octeontx2-af: cn10k: Use FLIT0 register instead of FLIT1 Sunil Goutham
  2021-08-22 20:50 ` [net PATCH 00/10] Miscellaneous fixes patchwork-bot+netdevbpf
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Sunil Goutham

Otherthan setting action as RSS in NPC MCAM entry, RSS flowkey
algorithm index also needs to be set. Otherwise whatever algorithm
is defined at flowkey index '0' will be considered by HW and pkt
flows will be distributed as such.

Fix this by saving the flowkey index sent by admin function while
initializing RSS and then use it when framing MCAM rules.

Fixes: 81a4362016e7 ("octeontx2-pf: Add RSS multi group support")
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 11 +++++++++++
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h |  3 +++
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c  |  1 +
 3 files changed, 15 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 4e125d6..679c3f8 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -269,6 +269,7 @@ int otx2_config_pause_frm(struct otx2_nic *pfvf)
 int otx2_set_flowkey_cfg(struct otx2_nic *pfvf)
 {
 	struct otx2_rss_info *rss = &pfvf->hw.rss_info;
+	struct nix_rss_flowkey_cfg_rsp *rsp;
 	struct nix_rss_flowkey_cfg *req;
 	int err;
 
@@ -283,6 +284,16 @@ int otx2_set_flowkey_cfg(struct otx2_nic *pfvf)
 	req->group = DEFAULT_RSS_CONTEXT_GROUP;
 
 	err = otx2_sync_mbox_msg(&pfvf->mbox);
+	if (err)
+		goto fail;
+
+	rsp = (struct nix_rss_flowkey_cfg_rsp *)
+			otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr);
+	if (IS_ERR(rsp))
+		goto fail;
+
+	pfvf->hw.flowkey_alg_idx = rsp->alg_idx;
+fail:
 	mutex_unlock(&pfvf->mbox.lock);
 	return err;
 }
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index 8fd58cd..8c602d2 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -196,6 +196,9 @@ struct otx2_hw {
 	u8			lso_udpv4_idx;
 	u8			lso_udpv6_idx;
 
+	/* RSS */
+	u8			flowkey_alg_idx;
+
 	/* MSI-X */
 	u8			cint_cnt; /* CQ interrupt count */
 	u16			npa_msixoff; /* Offset of NPA vectors */
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
index 4d9de52..fdd27c4 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
@@ -858,6 +858,7 @@ static int otx2_add_flow_msg(struct otx2_nic *pfvf, struct otx2_flow *flow)
 		if (flow->flow_spec.flow_type & FLOW_RSS) {
 			req->op = NIX_RX_ACTIONOP_RSS;
 			req->index = flow->rss_ctx_id;
+			req->flow_key_alg = pfvf->hw.flowkey_alg_idx;
 		} else {
 			req->op = NIX_RX_ACTIONOP_UCAST;
 			req->index = ethtool_get_flow_spec_ring(ring_cookie);
-- 
2.7.4


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

* [net PATCH 10/10] octeontx2-af: cn10k: Use FLIT0 register instead of FLIT1
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
                   ` (8 preceding siblings ...)
  2021-08-22 12:02 ` [net PATCH 09/10] octeontx2-pf: Fix algorithm index in MCAM rules with RSS action Sunil Goutham
@ 2021-08-22 12:02 ` Sunil Goutham
  2021-08-22 20:50 ` [net PATCH 00/10] Miscellaneous fixes patchwork-bot+netdevbpf
  10 siblings, 0 replies; 12+ messages in thread
From: Sunil Goutham @ 2021-08-22 12:02 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Geetha sowjanya, Sunil Goutham

From: Geetha sowjanya <gakula@marvell.com>

RVU SMMU widget stores the final translated PA at
RVU_AF_SMMU_TLN_FLIT0<57:18> instead of FLIT1 register. This patch
fixes the address translation logic to use the correct register.

Fixes: 893ae97214c3 ("octeontx2-af: cn10k: Support configurable LMTST regions")
Signed-off-by: Geetha sowjanya <gakula@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c | 4 ++--
 drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
index 28dcce7..dbe9149 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
@@ -82,10 +82,10 @@ static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc,
 		dev_err(rvu->dev, "%s LMTLINE iova transulation failed err:%llx\n", __func__, val);
 		return -EIO;
 	}
-	/* PA[51:12] = RVU_AF_SMMU_TLN_FLIT1[60:21]
+	/* PA[51:12] = RVU_AF_SMMU_TLN_FLIT0[57:18]
 	 * PA[11:0] = IOVA[11:0]
 	 */
-	pa = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_TLN_FLIT1) >> 21;
+	pa = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_TLN_FLIT0) >> 18;
 	pa &= GENMASK_ULL(39, 0);
 	*lmt_addr = (pa << 12) | (iova  & 0xFFF);
 
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h
index 8b01ef6..4215841 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h
@@ -53,7 +53,7 @@
 #define RVU_AF_SMMU_TXN_REQ		    (0x6008)
 #define RVU_AF_SMMU_ADDR_RSP_STS	    (0x6010)
 #define RVU_AF_SMMU_ADDR_TLN		    (0x6018)
-#define RVU_AF_SMMU_TLN_FLIT1		    (0x6030)
+#define RVU_AF_SMMU_TLN_FLIT0		    (0x6020)
 
 /* Admin function's privileged PF/VF registers */
 #define RVU_PRIV_CONST                      (0x8000000)
-- 
2.7.4


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

* Re: [net PATCH 00/10] Miscellaneous fixes
  2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
                   ` (9 preceding siblings ...)
  2021-08-22 12:02 ` [net PATCH 10/10] octeontx2-af: cn10k: Use FLIT0 register instead of FLIT1 Sunil Goutham
@ 2021-08-22 20:50 ` patchwork-bot+netdevbpf
  10 siblings, 0 replies; 12+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-22 20:50 UTC (permalink / raw)
  To: Sunil Goutham; +Cc: netdev, davem, kuba

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Sun, 22 Aug 2021 17:32:17 +0530 you wrote:
> This patch series contains a bunch of miscellaneous fixes
> for various issues like
> - Free unallocated memory during driver unload
> - HW reading transmit descriptor from wrong address
> - VF VLAN strip offload MCAM entry installation failure
> - Pkts not being distributed across queues in RSS context
> - Wrong interface backpressure configuration for NIX1 block on 98xx
> - etc
> 
> [...]

Here is the summary with links:
  - [net,01/10] octeontx2-pf: Fix NIX1_RX interface backpressure
    https://git.kernel.org/netdev/net-next/c/e8fb4df1f5d8
  - [net,02/10] octeontx2-af: cn10k: Fix SDP base channel number
    https://git.kernel.org/netdev/net-next/c/477b53f3f95b
  - [net,03/10] octeontx2-af: Handle return value in block reset.
    https://git.kernel.org/netdev/net-next/c/c0fa2cff8822
  - [net,04/10] octeontx2-pf: Don't mask out supported link modes
    https://git.kernel.org/netdev/net-next/c/50602408c8e2
  - [net,05/10] octeontx2-pf: send correct vlan priority mask to npc_install_flow_req
    https://git.kernel.org/netdev/net-next/c/10df5a13ac67
  - [net,06/10] octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc
    https://git.kernel.org/netdev/net-next/c/73d33dbc0723
  - [net,07/10] octeontx2-af: Check capability flag while freeing ipolicer memory
    https://git.kernel.org/netdev/net-next/c/07cccffdbdd3
  - [net,08/10] octeontx2-pf: Don't install VLAN offload rule if netdev is down
    https://git.kernel.org/netdev/net-next/c/05209e3570e4
  - [net,09/10] octeontx2-pf: Fix algorithm index in MCAM rules with RSS action
    https://git.kernel.org/netdev/net-next/c/e7938365459f
  - [net,10/10] octeontx2-af: cn10k: Use FLIT0 register instead of FLIT1
    https://git.kernel.org/netdev/net-next/c/623da5ca70b7

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

end of thread, other threads:[~2021-08-22 20:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-22 12:02 [net PATCH 00/10] Miscellaneous fixes Sunil Goutham
2021-08-22 12:02 ` [net PATCH 01/10] octeontx2-pf: Fix NIX1_RX interface backpressure Sunil Goutham
2021-08-22 12:02 ` [net PATCH 02/10] octeontx2-af: cn10k: Fix SDP base channel number Sunil Goutham
2021-08-22 12:02 ` [net PATCH 03/10] octeontx2-af: Handle return value in block reset Sunil Goutham
2021-08-22 12:02 ` [net PATCH 04/10] octeontx2-pf: Don't mask out supported link modes Sunil Goutham
2021-08-22 12:02 ` [net PATCH 05/10] octeontx2-pf: send correct vlan priority mask to npc_install_flow_req Sunil Goutham
2021-08-22 12:02 ` [net PATCH 06/10] octeontx2-af: Use DMA_ATTR_FORCE_CONTIGUOUS attribute in DMA alloc Sunil Goutham
2021-08-22 12:02 ` [net PATCH 07/10] octeontx2-af: Check capability flag while freeing ipolicer memory Sunil Goutham
2021-08-22 12:02 ` [net PATCH 08/10] octeontx2-pf: Don't install VLAN offload rule if netdev is down Sunil Goutham
2021-08-22 12:02 ` [net PATCH 09/10] octeontx2-pf: Fix algorithm index in MCAM rules with RSS action Sunil Goutham
2021-08-22 12:02 ` [net PATCH 10/10] octeontx2-af: cn10k: Use FLIT0 register instead of FLIT1 Sunil Goutham
2021-08-22 20:50 ` [net PATCH 00/10] Miscellaneous fixes 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;
as well as URLs for NNTP newsgroup(s).