* [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB
@ 2023-06-30 6:28 Hariprasad Kelam
2023-06-30 6:28 ` [net Patch 1/4] octeontx2-af: cn10kb: fix interrupt csr addresses Hariprasad Kelam
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Hariprasad Kelam @ 2023-06-30 6:28 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: edumazet, kuba, pabeni, davem, sgoutham, lcherian, gakula, jerinj,
sbhatta
This patch set contains fixes for the issues encountered in testing
CN10KB MAC block RPM_USX.
Patch1: firmware to kernel communication is not working due to wrong
interrupt configuration. CSR addresses are corrected.
Patch2: NIX to RVU PF mapping errors encountered due to wrong firmware
config. Corrects this mapping error.
Patch3: Driver is trying to access non exist cgx/lmac which is resulting
in kernel panic. Address this issue by adding proper checks.
Patch4: MAC features are not getting reset on FLR. Fix the issue by
resetting the stale config.
Hariprasad Kelam (4):
octeontx2-af: cn10kb: fix interrupt csr addresses
octeontx2-af: Fix mapping for NIX block from CGX connection
octeontx2-af: Add validation before accessing cgx and lmac
octeontx2-af: Reset MAC features in FLR
.../net/ethernet/marvell/octeontx2/af/cgx.c | 33 +++++++++++++++++--
.../net/ethernet/marvell/octeontx2/af/cgx.h | 2 ++
.../marvell/octeontx2/af/lmac_common.h | 3 ++
.../net/ethernet/marvell/octeontx2/af/rpm.c | 32 +++++++++++++++---
.../net/ethernet/marvell/octeontx2/af/rpm.h | 5 ++-
.../net/ethernet/marvell/octeontx2/af/rvu.c | 1 +
.../net/ethernet/marvell/octeontx2/af/rvu.h | 12 +++++++
.../ethernet/marvell/octeontx2/af/rvu_cgx.c | 20 ++++++++++-
8 files changed, 99 insertions(+), 9 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [net Patch 1/4] octeontx2-af: cn10kb: fix interrupt csr addresses
2023-06-30 6:28 [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB Hariprasad Kelam
@ 2023-06-30 6:28 ` Hariprasad Kelam
2023-06-30 13:26 ` Simon Horman
2023-06-30 6:28 ` [net Patch 2/4] octeontx2-af: Fix mapping for NIX block from CGX connection Hariprasad Kelam
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Hariprasad Kelam @ 2023-06-30 6:28 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: edumazet, kuba, pabeni, davem, sgoutham, lcherian, gakula, jerinj,
sbhatta
The current design is that, for asynchronous events like link_up and
link_down firmware raises the interrupt to kernel. The previous patch
which added RPM_USX driver has a bug where it uses old csr addresses
for configuring interrupts. Which is resulting in losing interrupts
from source firmware.
This patch fixes the issue by correcting csr addresses.
Fixes: b9d0fedc6234 ("octeontx2-af: cn10kb: Add RPM_USX MAC support")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
drivers/net/ethernet/marvell/octeontx2/af/rpm.c | 2 +-
drivers/net/ethernet/marvell/octeontx2/af/rpm.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
index de0d88dd10d6..a433f92c51ea 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
@@ -47,7 +47,7 @@ static struct mac_ops rpm2_mac_ops = {
.int_set_reg = RPM2_CMRX_SW_INT_ENA_W1S,
.irq_offset = 1,
.int_ena_bit = BIT_ULL(0),
- .lmac_fwi = RPM_LMAC_FWI,
+ .lmac_fwi = RPM2_LMAC_FWI,
.non_contiguous_serdes_lane = true,
.rx_stats_cnt = 43,
.tx_stats_cnt = 34,
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rpm.h b/drivers/net/ethernet/marvell/octeontx2/af/rpm.h
index 22147b4c2137..be294eebab26 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rpm.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rpm.h
@@ -94,7 +94,8 @@
/* CN10KB CSR Declaration */
#define RPM2_CMRX_SW_INT 0x1b0
-#define RPM2_CMRX_SW_INT_ENA_W1S 0x1b8
+#define RPM2_CMRX_SW_INT_ENA_W1S 0x1c8
+#define RPM2_LMAC_FWI 0x12
#define RPM2_CMR_CHAN_MSK_OR 0x3120
#define RPM2_CMR_RX_OVR_BP_EN BIT_ULL(2)
#define RPM2_CMR_RX_OVR_BP_BP BIT_ULL(1)
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [net Patch 2/4] octeontx2-af: Fix mapping for NIX block from CGX connection
2023-06-30 6:28 [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB Hariprasad Kelam
2023-06-30 6:28 ` [net Patch 1/4] octeontx2-af: cn10kb: fix interrupt csr addresses Hariprasad Kelam
@ 2023-06-30 6:28 ` Hariprasad Kelam
2023-06-30 13:27 ` Simon Horman
2023-06-30 6:28 ` [net Patch 3/4] octeontx2-af: Add validation before accessing cgx and lmac Hariprasad Kelam
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Hariprasad Kelam @ 2023-06-30 6:28 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: edumazet, kuba, pabeni, davem, sgoutham, lcherian, gakula, jerinj,
sbhatta
Firmware configures NIX block mapping for all MAC blocks.
The current implementation reads the configuration and
creates the mapping between RVU PF and NIX blocks. But
this configuration is only valid for silicons that support
multiple blocks. For all other silicons, all MAC blocks
map to NIX0.
This patch corrects the mapping by adding a check for the same.
Fixes: c5a73b632b90 ("octeontx2-af: Map NIX block from CGX connection")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 11 +++++++++++
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
index b5a7ee63508c..d4b8d4546de2 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
@@ -23,6 +23,7 @@
#define PCI_DEVID_OCTEONTX2_LBK 0xA061
/* Subsystem Device ID */
+#define PCI_SUBSYS_DEVID_98XX 0xB100
#define PCI_SUBSYS_DEVID_96XX 0xB200
#define PCI_SUBSYS_DEVID_CN10K_A 0xB900
#define PCI_SUBSYS_DEVID_CNF10K_B 0xBC00
@@ -686,6 +687,16 @@ static inline u16 rvu_nix_chan_cpt(struct rvu *rvu, u8 chan)
return rvu->hw->cpt_chan_base + chan;
}
+static inline bool is_rvu_supports_nix1(struct rvu *rvu)
+{
+ struct pci_dev *pdev = rvu->pdev;
+
+ if (pdev->subsystem_device == PCI_SUBSYS_DEVID_98XX)
+ return true;
+
+ return false;
+}
+
/* Function Prototypes
* RVU
*/
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
index 83b342fa8d75..48611e603228 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
@@ -114,7 +114,7 @@ static void rvu_map_cgx_nix_block(struct rvu *rvu, int pf,
p2x = cgx_lmac_get_p2x(cgx_id, lmac_id);
/* Firmware sets P2X_SELECT as either NIX0 or NIX1 */
pfvf->nix_blkaddr = BLKADDR_NIX0;
- if (p2x == CMR_P2X_SEL_NIX1)
+ if (is_rvu_supports_nix1(rvu) && p2x == CMR_P2X_SEL_NIX1)
pfvf->nix_blkaddr = BLKADDR_NIX1;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [net Patch 3/4] octeontx2-af: Add validation before accessing cgx and lmac
2023-06-30 6:28 [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB Hariprasad Kelam
2023-06-30 6:28 ` [net Patch 1/4] octeontx2-af: cn10kb: fix interrupt csr addresses Hariprasad Kelam
2023-06-30 6:28 ` [net Patch 2/4] octeontx2-af: Fix mapping for NIX block from CGX connection Hariprasad Kelam
@ 2023-06-30 6:28 ` Hariprasad Kelam
2023-06-30 13:27 ` Simon Horman
2023-06-30 6:28 ` [net Patch 4/4] octeontx2-af: Reset MAC features in FLR Hariprasad Kelam
2023-07-02 14:50 ` [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB patchwork-bot+netdevbpf
4 siblings, 1 reply; 9+ messages in thread
From: Hariprasad Kelam @ 2023-06-30 6:28 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: edumazet, kuba, pabeni, davem, sgoutham, lcherian, gakula, jerinj,
sbhatta
with the addition of new MAC blocks like CN10K RPM and CN10KB
RPM_USX, LMACs are noncontiguous and CGX blocks are also
noncontiguous. But during RVU driver initialization, the driver
is assuming they are contiguous and trying to access
cgx or lmac with their id which is resulting in kernel panic.
This patch fixes the issue by adding proper checks.
[ 23.219150] pc : cgx_lmac_read+0x38/0x70
[ 23.219154] lr : rvu_program_channels+0x3f0/0x498
[ 23.223852] sp : ffff000100d6fc80
[ 23.227158] x29: ffff000100d6fc80 x28: ffff00010009f880 x27:
000000000000005a
[ 23.234288] x26: ffff000102586768 x25: 0000000000002500 x24:
fffffffffff0f000
Fixes: 91c6945ea1f9 ("octeontx2-af: cn10k: Add RPM MAC support")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index bd77152bb8d7..f4bdca662d61 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -169,6 +169,9 @@ void cgx_lmac_write(int cgx_id, int lmac_id, u64 offset, u64 val)
{
struct cgx *cgx_dev = cgx_get_pdata(cgx_id);
+ /* Software must not access disabled LMAC registers */
+ if (!is_lmac_valid(cgx_dev, lmac_id))
+ return;
cgx_write(cgx_dev, lmac_id, offset, val);
}
@@ -176,6 +179,10 @@ u64 cgx_lmac_read(int cgx_id, int lmac_id, u64 offset)
{
struct cgx *cgx_dev = cgx_get_pdata(cgx_id);
+ /* Software must not access disabled LMAC registers */
+ if (!is_lmac_valid(cgx_dev, lmac_id))
+ return 0;
+
return cgx_read(cgx_dev, lmac_id, offset);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [net Patch 4/4] octeontx2-af: Reset MAC features in FLR
2023-06-30 6:28 [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB Hariprasad Kelam
` (2 preceding siblings ...)
2023-06-30 6:28 ` [net Patch 3/4] octeontx2-af: Add validation before accessing cgx and lmac Hariprasad Kelam
@ 2023-06-30 6:28 ` Hariprasad Kelam
2023-07-02 14:50 ` [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB patchwork-bot+netdevbpf
4 siblings, 0 replies; 9+ messages in thread
From: Hariprasad Kelam @ 2023-06-30 6:28 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: edumazet, kuba, pabeni, davem, sgoutham, lcherian, gakula, jerinj,
sbhatta
AF driver configures MAC features like internal loopback and PFC upon
receiving the request from PF and its VF netdev. But these
features are not getting reset in FLR. This patch fixes the issue by
resetting the same.
Fixes: 23999b30ae67 ("octeontx2-af: Enable or disable CGX internal loopback")
Fixes: 1121f6b02e7a ("octeontx2-af: Priority flow control configuration support")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
.../net/ethernet/marvell/octeontx2/af/cgx.c | 26 ++++++++++++++--
.../net/ethernet/marvell/octeontx2/af/cgx.h | 2 ++
.../marvell/octeontx2/af/lmac_common.h | 3 ++
.../net/ethernet/marvell/octeontx2/af/rpm.c | 30 +++++++++++++++++--
.../net/ethernet/marvell/octeontx2/af/rpm.h | 2 ++
.../net/ethernet/marvell/octeontx2/af/rvu.c | 1 +
.../net/ethernet/marvell/octeontx2/af/rvu.h | 1 +
.../ethernet/marvell/octeontx2/af/rvu_cgx.c | 18 +++++++++++
8 files changed, 77 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index f4bdca662d61..592037f4e55b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -537,14 +537,15 @@ static u32 cgx_get_lmac_fifo_len(void *cgxd, int lmac_id)
int cgx_lmac_internal_loopback(void *cgxd, int lmac_id, bool enable)
{
struct cgx *cgx = cgxd;
- u8 lmac_type;
+ struct lmac *lmac;
u64 cfg;
if (!is_lmac_valid(cgx, lmac_id))
return -ENODEV;
- lmac_type = cgx->mac_ops->get_lmac_type(cgx, lmac_id);
- if (lmac_type == LMAC_MODE_SGMII || lmac_type == LMAC_MODE_QSGMII) {
+ lmac = lmac_pdata(lmac_id, cgx);
+ if (lmac->lmac_type == LMAC_MODE_SGMII ||
+ lmac->lmac_type == LMAC_MODE_QSGMII) {
cfg = cgx_read(cgx, lmac_id, CGXX_GMP_PCS_MRX_CTL);
if (enable)
cfg |= CGXX_GMP_PCS_MRX_CTL_LBK;
@@ -1563,6 +1564,23 @@ int cgx_lmac_linkup_start(void *cgxd)
return 0;
}
+int cgx_lmac_reset(void *cgxd, int lmac_id, u8 pf_req_flr)
+{
+ struct cgx *cgx = cgxd;
+ u64 cfg;
+
+ if (!is_lmac_valid(cgx, lmac_id))
+ return -ENODEV;
+
+ /* Resetting PFC related CSRs */
+ cfg = 0xff;
+ cgx_write(cgxd, lmac_id, CGXX_CMRX_RX_LOGL_XON, cfg);
+
+ if (pf_req_flr)
+ cgx_lmac_internal_loopback(cgxd, lmac_id, false);
+ return 0;
+}
+
static int cgx_configure_interrupt(struct cgx *cgx, struct lmac *lmac,
int cnt, bool req_free)
{
@@ -1682,6 +1700,7 @@ static int cgx_lmac_init(struct cgx *cgx)
cgx->lmac_idmap[lmac->lmac_id] = lmac;
set_bit(lmac->lmac_id, &cgx->lmac_bmap);
cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, true);
+ lmac->lmac_type = cgx->mac_ops->get_lmac_type(cgx, lmac->lmac_id);
}
return cgx_lmac_verify_fwi_version(cgx);
@@ -1778,6 +1797,7 @@ static struct mac_ops cgx_mac_ops = {
.mac_tx_enable = cgx_lmac_tx_enable,
.pfc_config = cgx_lmac_pfc_config,
.mac_get_pfc_frm_cfg = cgx_lmac_get_pfc_frm_cfg,
+ .mac_reset = cgx_lmac_reset,
};
static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.h b/drivers/net/ethernet/marvell/octeontx2/af/cgx.h
index 5a20d93004c7..574114179688 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.h
@@ -35,6 +35,7 @@
#define CGXX_CMRX_INT_ENA_W1S 0x058
#define CGXX_CMRX_RX_ID_MAP 0x060
#define CGXX_CMRX_RX_STAT0 0x070
+#define CGXX_CMRX_RX_LOGL_XON 0x100
#define CGXX_CMRX_RX_LMACS 0x128
#define CGXX_CMRX_RX_DMAC_CTL0 (0x1F8 + mac_ops->csr_offset)
#define CGX_DMAC_CTL0_CAM_ENABLE BIT_ULL(3)
@@ -181,4 +182,5 @@ int cgx_lmac_get_pfc_frm_cfg(void *cgxd, int lmac_id, u8 *tx_pause,
u8 *rx_pause);
int verify_lmac_fc_cfg(void *cgxd, int lmac_id, u8 tx_pause, u8 rx_pause,
int pfvf_idx);
+int cgx_lmac_reset(void *cgxd, int lmac_id, u8 pf_req_flr);
#endif /* CGX_H */
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h b/drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h
index 39aaf0e4467d..0b4cba03f2e8 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h
@@ -24,6 +24,7 @@
* @cgx: parent cgx port
* @mcast_filters_count: Number of multicast filters installed
* @lmac_id: lmac port id
+ * @lmac_type: lmac type like SGMII/XAUI
* @cmd_pend: flag set before new command is started
* flag cleared after command response is received
* @name: lmac port name
@@ -43,6 +44,7 @@ struct lmac {
struct cgx *cgx;
u8 mcast_filters_count;
u8 lmac_id;
+ u8 lmac_type;
bool cmd_pend;
char *name;
};
@@ -125,6 +127,7 @@ struct mac_ops {
int (*mac_get_pfc_frm_cfg)(void *cgxd, int lmac_id,
u8 *tx_pause, u8 *rx_pause);
+ int (*mac_reset)(void *cgxd, int lmac_id, u8 pf_req_flr);
/* FEC stats */
int (*get_fec_stats)(void *cgxd, int lmac_id,
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
index a433f92c51ea..b4fcb20c3f4f 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
@@ -37,6 +37,7 @@ static struct mac_ops rpm_mac_ops = {
.mac_tx_enable = rpm_lmac_tx_enable,
.pfc_config = rpm_lmac_pfc_config,
.mac_get_pfc_frm_cfg = rpm_lmac_get_pfc_frm_cfg,
+ .mac_reset = rpm_lmac_reset,
};
static struct mac_ops rpm2_mac_ops = {
@@ -68,6 +69,7 @@ static struct mac_ops rpm2_mac_ops = {
.mac_tx_enable = rpm_lmac_tx_enable,
.pfc_config = rpm_lmac_pfc_config,
.mac_get_pfc_frm_cfg = rpm_lmac_get_pfc_frm_cfg,
+ .mac_reset = rpm_lmac_reset,
};
bool is_dev_rpm2(void *rpmd)
@@ -537,14 +539,15 @@ u32 rpm2_get_lmac_fifo_len(void *rpmd, int lmac_id)
int rpm_lmac_internal_loopback(void *rpmd, int lmac_id, bool enable)
{
rpm_t *rpm = rpmd;
- u8 lmac_type;
+ struct lmac *lmac;
u64 cfg;
if (!is_lmac_valid(rpm, lmac_id))
return -ENODEV;
- lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id);
- if (lmac_type == LMAC_MODE_QSGMII || lmac_type == LMAC_MODE_SGMII) {
+ lmac = lmac_pdata(lmac_id, rpm);
+ if (lmac->lmac_type == LMAC_MODE_QSGMII ||
+ lmac->lmac_type == LMAC_MODE_SGMII) {
dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n");
return 0;
}
@@ -713,3 +716,24 @@ int rpm_get_fec_stats(void *rpmd, int lmac_id, struct cgx_fec_stats_rsp *rsp)
return 0;
}
+
+int rpm_lmac_reset(void *rpmd, int lmac_id, u8 pf_req_flr)
+{
+ u64 rx_logl_xon, cfg;
+ rpm_t *rpm = rpmd;
+
+ if (!is_lmac_valid(rpm, lmac_id))
+ return -ENODEV;
+
+ /* Resetting PFC related CSRs */
+ rx_logl_xon = is_dev_rpm2(rpm) ? RPM2_CMRX_RX_LOGL_XON :
+ RPMX_CMRX_RX_LOGL_XON;
+ cfg = 0xff;
+
+ rpm_write(rpm, lmac_id, rx_logl_xon, cfg);
+
+ if (pf_req_flr)
+ rpm_lmac_internal_loopback(rpm, lmac_id, false);
+
+ return 0;
+}
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rpm.h b/drivers/net/ethernet/marvell/octeontx2/af/rpm.h
index be294eebab26..b79cfbc6f877 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rpm.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rpm.h
@@ -74,6 +74,7 @@
#define RPMX_MTI_MAC100X_CL01_PAUSE_QUANTA 0x80A8
#define RPMX_MTI_MAC100X_CL89_PAUSE_QUANTA 0x8108
#define RPM_DEFAULT_PAUSE_TIME 0x7FF
+#define RPMX_CMRX_RX_LOGL_XON 0x4100
#define RPMX_MTI_MAC100X_XIF_MODE 0x8100
#define RPMX_ONESTEP_ENABLE BIT_ULL(5)
@@ -132,4 +133,5 @@ int rpm_lmac_get_pfc_frm_cfg(void *rpmd, int lmac_id, u8 *tx_pause,
int rpm2_get_nr_lmacs(void *rpmd);
bool is_dev_rpm2(void *rpmd);
int rpm_get_fec_stats(void *cgxd, int lmac_id, struct cgx_fec_stats_rsp *rsp);
+int rpm_lmac_reset(void *rpmd, int lmac_id, u8 pf_req_flr);
#endif /* RPM_H */
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index 0069e60afa3b..8dbc35c481f6 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -2629,6 +2629,7 @@ static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)
* Since LF is detached use LF number as -1.
*/
rvu_npc_free_mcam_entries(rvu, pcifunc, -1);
+ rvu_mac_reset(rvu, pcifunc);
mutex_unlock(&rvu->flr_lock);
}
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
index d4b8d4546de2..e8e65fd7888d 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
@@ -895,6 +895,7 @@ int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable);
int rvu_cgx_prio_flow_ctrl_cfg(struct rvu *rvu, u16 pcifunc, u8 tx_pause, u8 rx_pause,
u16 pfc_en);
int rvu_cgx_cfg_pause_frm(struct rvu *rvu, u16 pcifunc, u8 tx_pause, u8 rx_pause);
+void rvu_mac_reset(struct rvu *rvu, u16 pcifunc);
u32 rvu_cgx_get_lmac_fifolen(struct rvu *rvu, int cgx, int lmac);
int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
int type);
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
index 48611e603228..4b8559ac0404 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
@@ -1250,3 +1250,21 @@ int rvu_mbox_handler_cgx_prio_flow_ctrl_cfg(struct rvu *rvu,
mac_ops->mac_get_pfc_frm_cfg(cgxd, lmac_id, &rsp->tx_pause, &rsp->rx_pause);
return err;
}
+
+void rvu_mac_reset(struct rvu *rvu, u16 pcifunc)
+{
+ int pf = rvu_get_pf(pcifunc);
+ struct mac_ops *mac_ops;
+ struct cgx *cgxd;
+ u8 cgx, lmac;
+
+ if (!is_pf_cgxmapped(rvu, pf))
+ return;
+
+ rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx, &lmac);
+ cgxd = rvu_cgx_pdata(cgx, rvu);
+ mac_ops = get_mac_ops(cgxd);
+
+ if (mac_ops->mac_reset(cgxd, lmac, !is_vf(pcifunc)))
+ dev_err(rvu->dev, "Failed to reset MAC\n");
+}
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [net Patch 1/4] octeontx2-af: cn10kb: fix interrupt csr addresses
2023-06-30 6:28 ` [net Patch 1/4] octeontx2-af: cn10kb: fix interrupt csr addresses Hariprasad Kelam
@ 2023-06-30 13:26 ` Simon Horman
0 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2023-06-30 13:26 UTC (permalink / raw)
To: Hariprasad Kelam
Cc: netdev, linux-kernel, edumazet, kuba, pabeni, davem, sgoutham,
lcherian, gakula, jerinj, sbhatta
On Fri, Jun 30, 2023 at 11:58:42AM +0530, Hariprasad Kelam wrote:
> The current design is that, for asynchronous events like link_up and
> link_down firmware raises the interrupt to kernel. The previous patch
> which added RPM_USX driver has a bug where it uses old csr addresses
> for configuring interrupts. Which is resulting in losing interrupts
> from source firmware.
>
> This patch fixes the issue by correcting csr addresses.
>
> Fixes: b9d0fedc6234 ("octeontx2-af: cn10kb: Add RPM_USX MAC support")
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [net Patch 2/4] octeontx2-af: Fix mapping for NIX block from CGX connection
2023-06-30 6:28 ` [net Patch 2/4] octeontx2-af: Fix mapping for NIX block from CGX connection Hariprasad Kelam
@ 2023-06-30 13:27 ` Simon Horman
0 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2023-06-30 13:27 UTC (permalink / raw)
To: Hariprasad Kelam
Cc: netdev, linux-kernel, edumazet, kuba, pabeni, davem, sgoutham,
lcherian, gakula, jerinj, sbhatta
On Fri, Jun 30, 2023 at 11:58:43AM +0530, Hariprasad Kelam wrote:
> Firmware configures NIX block mapping for all MAC blocks.
> The current implementation reads the configuration and
> creates the mapping between RVU PF and NIX blocks. But
> this configuration is only valid for silicons that support
> multiple blocks. For all other silicons, all MAC blocks
> map to NIX0.
>
> This patch corrects the mapping by adding a check for the same.
>
> Fixes: c5a73b632b90 ("octeontx2-af: Map NIX block from CGX connection")
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [net Patch 3/4] octeontx2-af: Add validation before accessing cgx and lmac
2023-06-30 6:28 ` [net Patch 3/4] octeontx2-af: Add validation before accessing cgx and lmac Hariprasad Kelam
@ 2023-06-30 13:27 ` Simon Horman
0 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2023-06-30 13:27 UTC (permalink / raw)
To: Hariprasad Kelam
Cc: netdev, linux-kernel, edumazet, kuba, pabeni, davem, sgoutham,
lcherian, gakula, jerinj, sbhatta
On Fri, Jun 30, 2023 at 11:58:44AM +0530, Hariprasad Kelam wrote:
> with the addition of new MAC blocks like CN10K RPM and CN10KB
> RPM_USX, LMACs are noncontiguous and CGX blocks are also
> noncontiguous. But during RVU driver initialization, the driver
> is assuming they are contiguous and trying to access
> cgx or lmac with their id which is resulting in kernel panic.
>
> This patch fixes the issue by adding proper checks.
>
> [ 23.219150] pc : cgx_lmac_read+0x38/0x70
> [ 23.219154] lr : rvu_program_channels+0x3f0/0x498
> [ 23.223852] sp : ffff000100d6fc80
> [ 23.227158] x29: ffff000100d6fc80 x28: ffff00010009f880 x27:
> 000000000000005a
> [ 23.234288] x26: ffff000102586768 x25: 0000000000002500 x24:
> fffffffffff0f000
>
> Fixes: 91c6945ea1f9 ("octeontx2-af: cn10k: Add RPM MAC support")
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB
2023-06-30 6:28 [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB Hariprasad Kelam
` (3 preceding siblings ...)
2023-06-30 6:28 ` [net Patch 4/4] octeontx2-af: Reset MAC features in FLR Hariprasad Kelam
@ 2023-07-02 14:50 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-02 14:50 UTC (permalink / raw)
To: Hariprasad Kelam
Cc: netdev, linux-kernel, edumazet, kuba, pabeni, davem, sgoutham,
lcherian, gakula, jerinj, sbhatta
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Fri, 30 Jun 2023 11:58:41 +0530 you wrote:
> This patch set contains fixes for the issues encountered in testing
> CN10KB MAC block RPM_USX.
>
> Patch1: firmware to kernel communication is not working due to wrong
> interrupt configuration. CSR addresses are corrected.
>
> Patch2: NIX to RVU PF mapping errors encountered due to wrong firmware
> config. Corrects this mapping error.
>
> [...]
Here is the summary with links:
- [net,1/4] octeontx2-af: cn10kb: fix interrupt csr addresses
https://git.kernel.org/netdev/net/c/4c5a331cacda
- [net,2/4] octeontx2-af: Fix mapping for NIX block from CGX connection
https://git.kernel.org/netdev/net/c/2e7bc57b976b
- [net,3/4] octeontx2-af: Add validation before accessing cgx and lmac
https://git.kernel.org/netdev/net/c/79ebb53772c9
- [net,4/4] octeontx2-af: Reset MAC features in FLR
https://git.kernel.org/netdev/net/c/2e3e94c2f5dc
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] 9+ messages in thread
end of thread, other threads:[~2023-07-02 14:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-30 6:28 [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB Hariprasad Kelam
2023-06-30 6:28 ` [net Patch 1/4] octeontx2-af: cn10kb: fix interrupt csr addresses Hariprasad Kelam
2023-06-30 13:26 ` Simon Horman
2023-06-30 6:28 ` [net Patch 2/4] octeontx2-af: Fix mapping for NIX block from CGX connection Hariprasad Kelam
2023-06-30 13:27 ` Simon Horman
2023-06-30 6:28 ` [net Patch 3/4] octeontx2-af: Add validation before accessing cgx and lmac Hariprasad Kelam
2023-06-30 13:27 ` Simon Horman
2023-06-30 6:28 ` [net Patch 4/4] octeontx2-af: Reset MAC features in FLR Hariprasad Kelam
2023-07-02 14:50 ` [net Patch 0/4] octeontx2-af: MAC block fixes for CN10KB 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