Skip to contentSkip to conversation

Fixes for CN10K and CN9xxx platforms

PATCH In review Subbaraya Sundeep 3 participants 13 messages Jan 21, 2022 – Jan 28, 2022

Subsystems (4)
lore
Share & tools
lore

Subbaraya Sundeep

author maintainer
#0 lore raw

cover Fixes for CN10K and CN9xxx platforms

Hi,

This patchset has consolidated fixes in Octeontx2 driver handling CN10K and CN9xxx platforms. When testing the new CN10K hardware some issues resurfaced like accessing wrong register for CN10K and enabling loopback on not supported interfaces. Some fixes are needed for CN9xxx platforms as well.

Below is the description of patches

Patch 1: AF sets RX RSS action for all the VFs when a VF is brought up. But when a PF sets RX action for its VF like Drop/Direct to a queue in ntuple filter it is not retained because of AF fixup. This patch skips modifying VF RX RSS action if PF has already set its action.

Patch 2: When configuring backpressure wrong register is being read for LBKs hence fixed it.

Patch 3: Some RVU blocks may take longer time to reset but are guaranteed to complete the reset. Hence wait till reset is complete.

Patch 4: For enabling LMAC CN10K needs another register compared to CN9xxx platforms. Hence changed it.

Patch 5: Adds missing barrier before submitting memory pointer to the aura hardware.

Patch 6: Increase polling time while link credit restore and also return proper error code when timeout occurs.

Patch 7: Internal loopback not supported on LPCS interfaces like SGMII/QSGMII so do not enable it.

Patch 8: When there is a error in message processing, AF sets the error response and replies back to requestor. PF forwards a invalid message to VF back if AF reply has error in it. This way VF lacks the actual error set by AF for its message. This is changed such that PF simply forwards the actual reply and let VF handle the error.

Patch 9: ntuple filter with "flow-type ether proto 0x8842 vlan 0x92e" was not working since ethertype 0x8842 is NGIO protocol. Hardware parser explicitly parses such NGIO packets and sets the packet as NGIO and do not set it as tagged packet. Fix this by changing parser such that it sets the packet as both NGIO and tagged by using separate layer types.

Thanks,
Sundeep

Geetha sowjanya (5):
octeontx2-af: Retry until RVU block reset complete
octeontx2-af: cn10k: Use appropriate register for LMAC enable
octeontx2-pf: cn10k: Ensure valid pointers are freed to aura
octeontx2-af: Increase link credit restore polling timeout
octeontx2-af: cn10k: Do not enable RPM loopback for LPC interfaces

Kiran Kumar K (1):
octeontx2-af: Add KPU changes to parse NGIO as separate layer

Subbaraya Sundeep (2):
octeontx2-af: Do not fixup all VF action entries
octeontx2-pf: Forward error codes to VF

Sunil Goutham (1):
octeontx2-af: Fix LBK backpressure id count

 drivers/net/ethernet/marvell/octeontx2/af/cgx.c    |  2 +
 .../ethernet/marvell/octeontx2/af/lmac_common.h    |  3 +
 drivers/net/ethernet/marvell/octeontx2/af/mbox.h   |  1 +
 .../ethernet/marvell/octeontx2/af/npc_profile.h    | 70 +++++++++++-----------
 drivers/net/ethernet/marvell/octeontx2/af/rpm.c    | 66 +++++++++++++++-----
 drivers/net/ethernet/marvell/octeontx2/af/rpm.h    |  4 ++
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c    |  7 ++-
 drivers/net/ethernet/marvell/octeontx2/af/rvu.h    |  1 +
 .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c    | 14 ++++-
 .../ethernet/marvell/octeontx2/af/rvu_debugfs.c    |  2 +
 .../net/ethernet/marvell/octeontx2/af/rvu_nix.c    | 20 +++----
 .../net/ethernet/marvell/octeontx2/af/rvu_npc.c    | 22 ++++++-
 .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 20 ++++---
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |  1 +
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   |  7 ++-
 15 files changed, 164 insertions(+), 76 deletions(-)
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 1/9 octeontx2-af: Do not fixup all VF action entries

AF modifies all the rules destined for VF to use the action same as default RSS action. This fixup was needed because AF only installs default rules with RSS action. But the action in rules installed by a PF for its VFs should not be changed by this fixup. This is because action can be drop or direct to queue as specified by user(ntuple filters). This patch fixes that problem.

Fixes 967db3529eca ("octeontx2-af: add support for multicast/promisc packet")
---
 .../net/ethernet/marvell/octeontx2/af/rvu_npc.c    | 22 +++++++++++++++++++---
 .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 20 ++++++++++++--------
 2 files changed, 31 insertions(+), 11 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +19 -3
index c0005a1..91f86d7 100644
@@ -402,6 +402,7 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam,
 			      int blkaddr, int index, struct mcam_entry *entry,
 			      bool *enable)
 {
+	struct rvu_npc_mcam_rule *rule;
 	u16 owner, target_func;
 	struct rvu_pfvf *pfvf;
 	u64 rx_action;
@@ -423,6 +424,12 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam,
 	      test_bit(NIXLF_INITIALIZED, &pfvf->flags)))
 		*enable = false;
 
+	/* fix up not needed for the rules added by user(ntuple filters) */
+	list_for_each_entry(rule, &mcam->mcam_rules, list) {
+		if (rule->entry == index)
+			return;
+	}
+
 	/* copy VF default entry action to the VF mcam entry */
 	rx_action = npc_get_default_entry_action(rvu, mcam, blkaddr,
 						 target_func);
@@ -489,8 +496,8 @@ static void npc_config_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam,
 	}
 
 	/* PF installing VF rule */
-	if (intf == NIX_INTF_RX && actindex < mcam->bmap_entries)
-		npc_fixup_vf_rule(rvu, mcam, blkaddr, index, entry, &enable);
+	if (is_npc_intf_rx(intf) && actindex < mcam->bmap_entries)
+		npc_fixup_vf_rule(rvu, mcam, blkaddr, actindex, entry, &enable);
 
 	/* Set 'action' */
 	rvu_write64(rvu, blkaddr,
@@ -916,7 +923,8 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
 				     int blkaddr, u16 pcifunc, u64 rx_action)
 {
 	int actindex, index, bank, entry;
-	bool enable;
+	struct rvu_npc_mcam_rule *rule;
+	bool enable, update;
 
 	if (!(pcifunc & RVU_PFVF_FUNC_MASK))
 		return;
@@ -924,6 +932,14 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
 	mutex_lock(&mcam->lock);
 	for (index = 0; index < mcam->bmap_entries; index++) {
 		if (mcam->entry2target_pffunc[index] == pcifunc) {
+			update = true;
+			/* update not needed for the rules added via ntuple filters */
+			list_for_each_entry(rule, &mcam->mcam_rules, list) {
+				if (rule->entry == index)
+					update = false;
+			}
+			if (!update)
+				continue;
 			bank = npc_get_bank(mcam, index);
 			actindex = index;
 			entry = index & (mcam->banksize - 1);
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +12 -8
index ff2b219..19c53e5 100644
@@ -1098,14 +1098,6 @@ static int npc_install_flow(struct rvu *rvu, int blkaddr, u16 target,
 		write_req.cntr = rule->cntr;
 	}
 
-	err = rvu_mbox_handler_npc_mcam_write_entry(rvu, &write_req,
-						    &write_rsp);
-	if (err) {
-		rvu_mcam_remove_counter_from_rule(rvu, owner, rule);
-		if (new)
-			kfree(rule);
-		return err;
-	}
 	/* update rule */
 	memcpy(&rule->packet, &dummy.packet, sizeof(rule->packet));
 	memcpy(&rule->mask, &dummy.mask, sizeof(rule->mask));
@@ -1132,6 +1124,18 @@ static int npc_install_flow(struct rvu *rvu, int blkaddr, u16 target,
 	if (req->default_rule)
 		pfvf->def_ucast_rule = rule;
 
+	/* write to mcam entry registers */
+	err = rvu_mbox_handler_npc_mcam_write_entry(rvu, &write_req,
+						    &write_rsp);
+	if (err) {
+		rvu_mcam_remove_counter_from_rule(rvu, owner, rule);
+		if (new) {
+			list_del(&rule->list);
+			kfree(rule);
+		}
+		return err;
+	}
+
 	/* VF's MAC address is being changed via PF  */
 	if (pf_set_vfs_mac) {
 		ether_addr_copy(pfvf->default_mac, req->packet.dmac);
Signature · 1 line
2.7.4
author maintainer
#2 lore raw

PATCH 2/9 octeontx2-af: Fix LBK backpressure id count

In reply to Subbaraya Sundeep

From: Sunil Goutham <[email protected]>

In rvu_nix_get_bpid() lbk_bpid_cnt is being read from wrong register. Due to this backpressure enable is failing for LBK VF32 onwards. This patch fixes that.

Fixes fe1939bb2340 ("octeontx2-af: Add SDP interface support")
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +3 -3
index d8b1948..b74ab0d 100644
@@ -512,11 +512,11 @@ static int rvu_nix_get_bpid(struct rvu *rvu, struct nix_bp_cfg_req *req,
 	cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST);
 	lmac_chan_cnt = cfg & 0xFF;
 
-	cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
-	sdp_chan_cnt = cfg & 0xFFF;
-
 	cgx_bpid_cnt = hw->cgx_links * lmac_chan_cnt;
 	lbk_bpid_cnt = hw->lbk_links * ((cfg >> 16) & 0xFF);
+
+	cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
+	sdp_chan_cnt = cfg & 0xFFF;
 	sdp_bpid_cnt = hw->sdp_links * sdp_chan_cnt;
 
 	pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc);
Signature · 1 line
2.7.4
author maintainer
#3 lore raw

PATCH 3/9 octeontx2-af: Retry until RVU block reset complete

In reply to Subbaraya Sundeep

From: Geetha sowjanya <[email protected]>

Few RVU blocks like SSO require more time for reset on some silicons. Hence retrying the block reset until success.

Fixes c0fa2cff8822c ("octeontx2-af: Handle return value in block reset")
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +5 -2
index 3ca6b94..54e1b27 100644
@@ -520,8 +520,11 @@ static void rvu_block_reset(struct rvu *rvu, int blkaddr, u64 rst_reg)
 
 	rvu_write64(rvu, blkaddr, rst_reg, BIT_ULL(0));
 	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);
+	if (err) {
+		dev_err(rvu->dev, "HW block:%d reset timeout retrying again\n", blkaddr);
+		while (rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true) == -EBUSY)
+			;
+	}
 }
 
 static void rvu_reset_all_blocks(struct rvu *rvu)
Signature · 1 line
2.7.4
author maintainer
#4 lore raw

PATCH 4/9 octeontx2-af: cn10k: Use appropriate register for LMAC enable

In reply to Subbaraya Sundeep

From: Geetha sowjanya <[email protected]>

CN10K platforms uses RPM(0..2)_MTI_MAC100(0..3)_COMMAND_CONFIG register for lmac TX/RX enable whereas CN9xxx platforms use CGX_CMRX_CONFIG register. This config change was missed when adding support for CN10K RPM.

Fixes 91c6945ea1f9 ("octeontx2-af: cn10k: Add RPM MAC support")
---
 drivers/net/ethernet/marvell/octeontx2/af/cgx.c    |  2 ++
 .../ethernet/marvell/octeontx2/af/lmac_common.h    |  3 ++
 drivers/net/ethernet/marvell/octeontx2/af/rpm.c    | 39 ++++++++++++++++++++++
 drivers/net/ethernet/marvell/octeontx2/af/rpm.h    |  4 +++
 drivers/net/ethernet/marvell/octeontx2/af/rvu.h    |  1 +
 .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c    | 14 ++++++--
 .../net/ethernet/marvell/octeontx2/af/rvu_nix.c    | 10 +++---
 7 files changed, 66 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +2 -0
index 186d00a9..3631d61 100644
@@ -1570,6 +1570,8 @@ static struct mac_ops	cgx_mac_ops    = {
 	.mac_enadis_pause_frm =		cgx_lmac_enadis_pause_frm,
 	.mac_pause_frm_config =		cgx_lmac_pause_frm_config,
 	.mac_enadis_ptp_config =	cgx_lmac_ptp_config,
+	.mac_rx_tx_enable =		cgx_lmac_rx_tx_enable,
+	.mac_tx_enable =		cgx_lmac_tx_enable,
 };
 
 static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h +3 -0
index fc6e742..b33e7d1 100644
@@ -107,6 +107,9 @@ struct mac_ops {
 	void			(*mac_enadis_ptp_config)(void  *cgxd,
 							 int lmac_id,
 							 bool enable);
+
+	int			(*mac_rx_tx_enable)(void *cgxd, int lmac_id, bool enable);
+	int			(*mac_tx_enable)(void *cgxd, int lmac_id, bool enable);
 };
 
 struct cgx {
drivers/net/ethernet/marvell/octeontx2/af/rpm.c +39 -0
index e695fa0..4cbd915 100644
@@ -30,6 +30,8 @@ static struct mac_ops	rpm_mac_ops   = {
 	.mac_enadis_pause_frm =		rpm_lmac_enadis_pause_frm,
 	.mac_pause_frm_config =		rpm_lmac_pause_frm_config,
 	.mac_enadis_ptp_config =	rpm_lmac_ptp_config,
+	.mac_rx_tx_enable =		rpm_lmac_rx_tx_enable,
+	.mac_tx_enable =		rpm_lmac_tx_enable,
 };
 
 struct mac_ops *rpm_get_mac_ops(void)
@@ -54,6 +56,43 @@ int rpm_get_nr_lmacs(void *rpmd)
 	return hweight8(rpm_read(rpm, 0, CGXX_CMRX_RX_LMACS) & 0xFULL);
 }
 
+int rpm_lmac_tx_enable(void *rpmd, int lmac_id, bool enable)
+{
+	rpm_t *rpm = rpmd;
+	u64 cfg, last;
+
+	if (!is_lmac_valid(rpm, lmac_id))
+		return -ENODEV;
+
+	cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
+	last = cfg;
+	if (enable)
+		cfg |= RPM_TX_EN;
+	else
+		cfg &= ~(RPM_TX_EN);
+
+	if (cfg != last)
+		rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg);
+	return !!(last & RPM_TX_EN);
+}
+
+int rpm_lmac_rx_tx_enable(void *rpmd, int lmac_id, bool enable)
+{
+	rpm_t *rpm = rpmd;
+	u64 cfg;
+
+	if (!is_lmac_valid(rpm, lmac_id))
+		return -ENODEV;
+
+	cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
+	if (enable)
+		cfg |= RPM_RX_EN | RPM_TX_EN;
+	else
+		cfg &= ~(RPM_RX_EN | RPM_TX_EN);
+	rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg);
+	return 0;
+}
+
 void rpm_lmac_enadis_rx_pause_fwding(void *rpmd, int lmac_id, bool enable)
 {
 	rpm_t *rpm = rpmd;
drivers/net/ethernet/marvell/octeontx2/af/rpm.h +4 -0
index 57c8a68..ff58031 100644
@@ -43,6 +43,8 @@
 #define RPMX_MTI_STAT_DATA_HI_CDC            0x10038
 
 #define RPM_LMAC_FWI			0xa
+#define RPM_TX_EN			BIT_ULL(0)
+#define RPM_RX_EN			BIT_ULL(1)
 
 /* Function Declarations */
 int rpm_get_nr_lmacs(void *rpmd);
@@ -57,4 +59,6 @@ int rpm_lmac_enadis_pause_frm(void *rpmd, int lmac_id, u8 tx_pause,
 int rpm_get_tx_stats(void *rpmd, int lmac_id, int idx, u64 *tx_stat);
 int rpm_get_rx_stats(void *rpmd, int lmac_id, int idx, u64 *rx_stat);
 void rpm_lmac_ptp_config(void *rpmd, int lmac_id, bool enable);
+int rpm_lmac_rx_tx_enable(void *rpmd, int lmac_id, bool enable);
+int rpm_lmac_tx_enable(void *rpmd, int lmac_id, bool enable);
 #endif /* RPM_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +1 -0
index 66e45d7..5ed94cf 100644
@@ -806,6 +806,7 @@ bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature);
 u32  rvu_cgx_get_fifolen(struct rvu *rvu);
 void *rvu_first_cgx_pdata(struct rvu *rvu);
 int cgxlmac_to_pf(struct rvu *rvu, int cgx_id, int lmac_id);
+int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable);
 
 int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
 			     int type);
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +12 -2
index 2ca182a..8a7ac5a 100644
@@ -441,16 +441,26 @@ void rvu_cgx_enadis_rx_bp(struct rvu *rvu, int pf, bool enable)
 int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start)
 {
 	int pf = rvu_get_pf(pcifunc);
+	struct mac_ops *mac_ops;
 	u8 cgx_id, lmac_id;
+	void *cgxd;
 
 	if (!is_cgx_config_permitted(rvu, pcifunc))
 		return LMAC_AF_ERR_PERM_DENIED;
 
 	rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
+	cgxd = rvu_cgx_pdata(cgx_id, rvu);
+	mac_ops = get_mac_ops(cgxd);
+
+	return mac_ops->mac_rx_tx_enable(cgxd, lmac_id, start);
+}
 
-	cgx_lmac_rx_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, start);
+int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable)
+{
+	struct mac_ops *mac_ops;
 
-	return 0;
+	mac_ops = get_mac_ops(cgxd);
+	return mac_ops->mac_tx_enable(cgxd, lmac_id, enable);
 }
 
 void rvu_cgx_disable_dmac_entries(struct rvu *rvu, u16 pcifunc)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +5 -5
index b74ab0d..de6e5a1 100644
@@ -2068,8 +2068,8 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr,
 	/* enable cgx tx if disabled */
 	if (is_pf_cgxmapped(rvu, pf)) {
 		rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
-		restore_tx_en = !cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu),
-						    lmac_id, true);
+		restore_tx_en = !rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu),
+						   lmac_id, true);
 	}
 
 	cfg = rvu_read64(rvu, blkaddr, NIX_AF_SMQX_CFG(smq));
@@ -2092,7 +2092,7 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr,
 	rvu_cgx_enadis_rx_bp(rvu, pf, true);
 	/* restore cgx tx state */
 	if (restore_tx_en)
-		cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
+		rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
 	return err;
 }
 
@@ -3878,7 +3878,7 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link,
 	/* Enable cgx tx if disabled for credits to be back */
 	if (is_pf_cgxmapped(rvu, pf)) {
 		rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
-		restore_tx_en = !cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu),
+		restore_tx_en = !rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu),
 						    lmac_id, true);
 	}
 
@@ -3918,7 +3918,7 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link,
 
 	/* Restore state of cgx tx */
 	if (restore_tx_en)
-		cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
+		rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
 
 	mutex_unlock(&rvu->rsrc_lock);
 	return rc;
Signature · 1 line
2.7.4
author maintainer
#5 lore raw

PATCH 5/9 octeontx2-pf: cn10k: Ensure valid pointers are freed to aura

In reply to Subbaraya Sundeep

From: Geetha sowjanya <[email protected]>

While freeing SQB pointers to aura, driver first memcpy to target address and then triggers lmtst operation to free pointer to the aura. We need to ensure(by adding dmb barrier)that memcpy is finished before pointers are freed to the aura. This patch also adds the missing sq context structure entry in debugfs.

Fixes ef6c8da71eaf ("octeontx2-pf: cn10K: Reserve LMTST lines per core")
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c  | 2 ++
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 1 +
 2 files changed, 3 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +2 -0
index a09a507..d1eddb7 100644
@@ -1224,6 +1224,8 @@ static void print_nix_cn10k_sq_ctx(struct seq_file *m,
 	seq_printf(m, "W3: head_offset\t\t\t%d\nW3: smenq_next_sqb_vld\t\t%d\n\n",
 		   sq_ctx->head_offset, sq_ctx->smenq_next_sqb_vld);
 
+	seq_printf(m, "W3: smq_next_sq_vld\t\t%d\nW3: smq_pend\t\t\t%d\n",
+		   sq_ctx->smq_next_sq_vld, sq_ctx->smq_pend);
 	seq_printf(m, "W4: next_sqb \t\t\t%llx\n\n", sq_ctx->next_sqb);
 	seq_printf(m, "W5: tail_sqb \t\t\t%llx\n\n", sq_ctx->tail_sqb);
 	seq_printf(m, "W6: smenq_sqb \t\t\t%llx\n\n", sq_ctx->smenq_sqb);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -0
index 61e5281..14509fc 100644
@@ -603,6 +603,7 @@ static inline void __cn10k_aura_freeptr(struct otx2_nic *pfvf, u64 aura,
 			size++;
 		tar_addr |=  ((size - 1) & 0x7) << 4;
 	}
+	dma_wmb();
 	memcpy((u64 *)lmt_info->lmt_addr, ptrs, sizeof(u64) * num_ptrs);
 	/* Perform LMTST flush */
 	cn10k_lmt_flush(val, tar_addr);
Signature · 1 line
2.7.4
author maintainer
#6 lore raw

PATCH 6/9 octeontx2-af: Increase link credit restore polling timeout

In reply to Subbaraya Sundeep

From: Geetha sowjanya <[email protected]>

It's been observed that sometimes link credit restore takes a lot of time than the current timeout. This patch increases the default timeout value and return the proper error value on failure.

Fixes 1c74b89171c3 ("octeontx2-af: Wait for TX link idle for credits change")
---
 drivers/net/ethernet/marvell/octeontx2/af/mbox.h    | 1 +
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +1 -0
index 4e79e91..58e2aee 100644
@@ -732,6 +732,7 @@ enum nix_af_status {
 	NIX_AF_ERR_BANDPROF_INVAL_REQ  = -428,
 	NIX_AF_ERR_CQ_CTX_WRITE_ERR  = -429,
 	NIX_AF_ERR_AQ_CTX_RETRY_WRITE  = -430,
+	NIX_AF_ERR_LINK_CREDITS  = -431,
 };
 
 /* For NIX RX vtag action  */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +2 -2
index de6e5a1..97fb619 100644
@@ -3891,8 +3891,8 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link,
 			    NIX_AF_TL1X_SW_XOFF(schq), BIT_ULL(0));
 	}
 
-	rc = -EBUSY;
-	poll_tmo = jiffies + usecs_to_jiffies(10000);
+	rc = NIX_AF_ERR_LINK_CREDITS;
+	poll_tmo = jiffies + usecs_to_jiffies(200000);
 	/* Wait for credits to return */
 	do {
 		if (time_after(jiffies, poll_tmo))
Signature · 1 line
2.7.4
author maintainer
#7 lore raw

PATCH 7/9 octeontx2-af: cn10k: Do not enable RPM loopback for LPC interfaces

In reply to Subbaraya Sundeep

From: Geetha sowjanya <[email protected]>

Internal looback is not supported to low rate LPCS interface like SGMII/QSGMII. Hence don't allow to enable for such interfaces.

Fixes 3ad3f8f93c81 ("octeontx2-af: cn10k: MAC internal loopback support")
---
 drivers/net/ethernet/marvell/octeontx2/af/rpm.c | 27 +++++++++++--------------
 1 file changed, 12 insertions(+), 15 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rpm.c +12 -15
index 4cbd915..9ea2f6a 100644
@@ -291,23 +291,20 @@ int rpm_lmac_internal_loopback(void *rpmd, int lmac_id, bool enable)
 	if (!rpm || lmac_id >= rpm->lmac_count)
 		return -ENODEV;
 	lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id);
-	if (lmac_type == LMAC_MODE_100G_R) {
-		cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1);
-
-		if (enable)
-			cfg |= RPMX_MTI_PCS_LBK;
-		else
-			cfg &= ~RPMX_MTI_PCS_LBK;
-		rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg);
-	} else {
-		cfg = rpm_read(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1);
-		if (enable)
-			cfg |= RPMX_MTI_PCS_LBK;
-		else
-			cfg &= ~RPMX_MTI_PCS_LBK;
-		rpm_write(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1, cfg);
+
+	if (lmac_type == LMAC_MODE_QSGMII || lmac_type == LMAC_MODE_SGMII) {
+		dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n");
+		return 0;
 	}
 
+	cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1);
+
+	if (enable)
+		cfg |= RPMX_MTI_PCS_LBK;
+	else
+		cfg &= ~RPMX_MTI_PCS_LBK;
+	rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg);
+
 	return 0;
 }
 
Signature · 1 line
2.7.4
author maintainer
#8 lore raw

PATCH 8/9 octeontx2-pf: Forward error codes to VF

In reply to Subbaraya Sundeep

PF forwards its VF messages to AF and corresponding replies from AF to VF. AF sets proper error code in the replies after processing message requests. Currently PF checks the error codes in replies and sends invalid message to VF. This way VF lacks the information of error code set by AF for its messages. This patch changes that such that PF simply forwards AF replies so that VF can handle error codes.

Fixes d424b6c02415 ("octeontx2-pf: Enable SRIOV and added VF mbox handling")
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +6 -1
index 6080ebd..d39341e 100644
@@ -394,7 +394,12 @@ static int otx2_forward_vf_mbox_msgs(struct otx2_nic *pf,
 		dst_mdev->msg_size = mbox_hdr->msg_size;
 		dst_mdev->num_msgs = num_msgs;
 		err = otx2_sync_mbox_msg(dst_mbox);
-		if (err) {
+		/* Error code -EIO indicate there is a communication failure
+		 * to the AF. Rest of the error codes indicate that AF processed
+		 * VF messages and set the error codes in response messages
+		 * (if any) so simply forward responses to VF.
+		 */
+		if (err == -EIO) {
 			dev_warn(pf->dev,
 				 "AF not responding to VF%d messages\n", vf);
 			/* restore PF mbase and exit */
Signature · 1 line
2.7.4
author maintainer
#9 lore raw

PATCH 9/9 octeontx2-af: Add KPU changes to parse NGIO as separate layer

In reply to Subbaraya Sundeep

From: Kiran Kumar K <[email protected]>

With current KPU profile NGIO is being parsed along with CTAG as a single layer. Because of this MCAM/ntuple rules installed with ethertype as 0x8842 are not being hit. Adding KPU profile changes to parse NGIO in separate ltype and CTAG in separate ltype.

Fixes f9c49be90c05 ("octeontx2-af: Update the default KPU profile and fixes")
---
 .../ethernet/marvell/octeontx2/af/npc_profile.h    | 70 +++++++++++-----------
 1 file changed, 35 insertions(+), 35 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h +35 -35
index 0fe7ad3..4180376 100644
@@ -185,7 +185,6 @@ enum npc_kpu_parser_state {
 	NPC_S_KPU2_QINQ,
 	NPC_S_KPU2_ETAG,
 	NPC_S_KPU2_EXDSA,
-	NPC_S_KPU2_NGIO,
 	NPC_S_KPU2_CPT_CTAG,
 	NPC_S_KPU2_CPT_QINQ,
 	NPC_S_KPU3_CTAG,
@@ -212,6 +211,7 @@ enum npc_kpu_parser_state {
 	NPC_S_KPU5_NSH,
 	NPC_S_KPU5_CPT_IP,
 	NPC_S_KPU5_CPT_IP6,
+	NPC_S_KPU5_NGIO,
 	NPC_S_KPU6_IP6_EXT,
 	NPC_S_KPU6_IP6_HOP_DEST,
 	NPC_S_KPU6_IP6_ROUT,
@@ -1124,15 +1124,6 @@ static struct npc_kpu_profile_cam kpu1_cam_entries[] = {
 		NPC_S_KPU1_ETHER, 0xff,
 		NPC_ETYPE_CTAG,
 		0xffff,
-		NPC_ETYPE_NGIO,
-		0xffff,
-		0x0000,
-		0x0000,
-	},
-	{
-		NPC_S_KPU1_ETHER, 0xff,
-		NPC_ETYPE_CTAG,
-		0xffff,
 		NPC_ETYPE_CTAG,
 		0xffff,
 		0x0000,
@@ -1968,6 +1959,15 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = {
 	},
 	{
 		NPC_S_KPU2_CTAG, 0xff,
+		NPC_ETYPE_NGIO,
+		0xffff,
+		0x0000,
+		0x0000,
+		0x0000,
+		0x0000,
+	},
+	{
+		NPC_S_KPU2_CTAG, 0xff,
 		NPC_ETYPE_PPPOE,
 		0xffff,
 		0x0000,
@@ -2750,15 +2750,6 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = {
 		0x0000,
 	},
 	{
-		NPC_S_KPU2_NGIO, 0xff,
-		0x0000,
-		0x0000,
-		0x0000,
-		0x0000,
-		0x0000,
-		0x0000,
-	},
-	{
 		NPC_S_KPU2_CPT_CTAG, 0xff,
 		NPC_ETYPE_IP,
 		0xffff,
@@ -5090,6 +5081,15 @@ static struct npc_kpu_profile_cam kpu5_cam_entries[] = {
 		0x0000,
 	},
 	{
+		NPC_S_KPU5_NGIO, 0xff,
+		0x0000,
+		0x0000,
+		0x0000,
+		0x0000,
+		0x0000,
+		0x0000,
+	},
+	{
 		NPC_S_NA, 0X00,
 		0x0000,
 		0x0000,
@@ -8425,14 +8425,6 @@ static struct npc_kpu_profile_action kpu1_action_entries[] = {
 	{
 		NPC_ERRLEV_RE, NPC_EC_NOERR,
 		8, 12, 0, 0, 0,
-		NPC_S_KPU2_NGIO, 12, 1,
-		NPC_LID_LA, NPC_LT_LA_ETHER,
-		0,
-		0, 0, 0, 0,
-	},
-	{
-		NPC_ERRLEV_RE, NPC_EC_NOERR,
-		8, 12, 0, 0, 0,
 		NPC_S_KPU2_CTAG2, 12, 1,
 		NPC_LID_LA, NPC_LT_LA_ETHER,
 		NPC_F_LA_U_HAS_TAG | NPC_F_LA_L_WITH_VLAN,
@@ -9196,6 +9188,14 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = {
 	},
 	{
 		NPC_ERRLEV_RE, NPC_EC_NOERR,
+		0, 0, 0, 2, 0,
+		NPC_S_KPU5_NGIO, 6, 1,
+		NPC_LID_LB, NPC_LT_LB_CTAG,
+		0,
+		0, 0, 0, 0,
+	},
+	{
+		NPC_ERRLEV_RE, NPC_EC_NOERR,
 		8, 0, 6, 2, 0,
 		NPC_S_KPU5_IP, 14, 1,
 		NPC_LID_LB, NPC_LT_LB_PPPOE,
@@ -9892,14 +9892,6 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = {
 	},
 	{
 		NPC_ERRLEV_RE, NPC_EC_NOERR,
-		0, 0, 0, 0, 1,
-		NPC_S_NA, 0, 1,
-		NPC_LID_LC, NPC_LT_LC_NGIO,
-		0,
-		0, 0, 0, 0,
-	},
-	{
-		NPC_ERRLEV_RE, NPC_EC_NOERR,
 		8, 0, 6, 2, 0,
 		NPC_S_KPU5_CPT_IP, 6, 1,
 		NPC_LID_LB, NPC_LT_LB_CTAG,
@@ -11974,6 +11966,14 @@ static struct npc_kpu_profile_action kpu5_action_entries[] = {
 		0, 0, 0, 0,
 	},
 	{
+		NPC_ERRLEV_RE, NPC_EC_NOERR,
+		0, 0, 0, 0, 1,
+		NPC_S_NA, 0, 1,
+		NPC_LID_LC, NPC_LT_LC_NGIO,
+		0,
+		0, 0, 0, 0,
+	},
+	{
 		NPC_ERRLEV_LC, NPC_EC_UNK,
 		0, 0, 0, 0, 1,
 		NPC_S_NA, 0, 0,
Signature · 1 line
2.7.4
#10 lore raw
In reply to Subbaraya Sundeep

Hi David and Jakub,

Any comments on this patchset ?

Thanks,
Sundeep

Quoted 88 lines · Subbaraya Sundeep

Hi,

This patchset has consolidated fixes in Octeontx2 driver handling CN10K and CN9xxx platforms. When testing the new CN10K hardware some issues resurfaced like accessing wrong register for CN10K and enabling loopback on not supported interfaces. Some fixes are needed for CN9xxx platforms as well.

Below is the description of patches

Patch 1: AF sets RX RSS action for all the VFs when a VF is brought up. But when a PF sets RX action for its VF like Drop/Direct to a queue in ntuple filter it is not retained because of AF fixup. This patch skips modifying VF RX RSS action if PF has already set its action.

Patch 2: When configuring backpressure wrong register is being read for LBKs hence fixed it.

Patch 3: Some RVU blocks may take longer time to reset but are guaranteed to complete the reset. Hence wait till reset is complete.

Patch 4: For enabling LMAC CN10K needs another register compared to CN9xxx platforms. Hence changed it.

Patch 5: Adds missing barrier before submitting memory pointer to the aura hardware.

Patch 6: Increase polling time while link credit restore and also return proper error code when timeout occurs.

Patch 7: Internal loopback not supported on LPCS interfaces like SGMII/QSGMII so do not enable it.

Patch 8: When there is a error in message processing, AF sets the error response and replies back to requestor. PF forwards a invalid message to VF back if AF reply has error in it. This way VF lacks the actual error set by AF for its message. This is changed such that PF simply forwards the actual reply and let VF handle the error.

Patch 9: ntuple filter with "flow-type ether proto 0x8842 vlan 0x92e" was not working since ethertype 0x8842 is NGIO protocol. Hardware parser explicitly parses such NGIO packets and sets the packet as NGIO and do not set it as tagged packet. Fix this by changing parser such that it sets the packet as both NGIO and tagged by using separate layer types.

Thanks,
Sundeep

Geetha sowjanya (5):
octeontx2-af: Retry until RVU block reset complete
octeontx2-af: cn10k: Use appropriate register for LMAC enable
octeontx2-pf: cn10k: Ensure valid pointers are freed to aura
octeontx2-af: Increase link credit restore polling timeout
octeontx2-af: cn10k: Do not enable RPM loopback for LPC interfaces

Kiran Kumar K (1):
octeontx2-af: Add KPU changes to parse NGIO as separate layer

Subbaraya Sundeep (2):
octeontx2-af: Do not fixup all VF action entries
octeontx2-pf: Forward error codes to VF

Sunil Goutham (1):
octeontx2-af: Fix LBK backpressure id count

 drivers/net/ethernet/marvell/octeontx2/af/cgx.c    |  2 +
 .../ethernet/marvell/octeontx2/af/lmac_common.h    |  3 +
 drivers/net/ethernet/marvell/octeontx2/af/mbox.h   |  1 +
 .../ethernet/marvell/octeontx2/af/npc_profile.h    | 70 +++++++++++-----------
 drivers/net/ethernet/marvell/octeontx2/af/rpm.c    | 66 +++++++++++++++-----
 drivers/net/ethernet/marvell/octeontx2/af/rpm.h    |  4 ++
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c    |  7 ++-
 drivers/net/ethernet/marvell/octeontx2/af/rvu.h    |  1 +
 .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c    | 14 ++++-
 .../ethernet/marvell/octeontx2/af/rvu_debugfs.c    |  2 +
 .../net/ethernet/marvell/octeontx2/af/rvu_nix.c    | 20 +++----
 .../net/ethernet/marvell/octeontx2/af/rvu_npc.c    | 22 ++++++-
 .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 20 ++++---
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |  1 +
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   |  7 ++-
 15 files changed, 164 insertions(+), 76 deletions(-)

--
2.7.4

maintainer
#11 lore raw
Quoted 3 lines · On Thu, 27 Jan 2022 19:02:30 +0530 sundeep subbaraya wrote:

Hi David and Jakub,

Any comments on this patchset ?

This appears to be merged to netdev/net as commit 03c82e80ec28 ("Merge branch 'octeontx2-af-fixes'"), and should be on its way up downstream to Linus. Sorry for the lack of notification the patchwork bot must have had a hiccup.

#12 lore raw

Thanks Jakub and David.

Sundeep

Quoted 10 lines · Jakub Kicinski
Quoted 3 lines · On Thu, 27 Jan 2022 19:02:30 +0530 sundeep subbaraya wrote:

Hi David and Jakub,

Any comments on this patchset ?

This appears to be merged to netdev/net as commit 03c82e80ec28 ("Merge branch 'octeontx2-af-fixes'"), and should be on its way up downstream to Linus. Sorry for the lack of notification the patchwork bot must have had a hiccup.