Skip to content

Commit 03c82e8

Browse files
committed
Merge branch 'octeontx2-af-fixes'
Subbaraya Sundeep says: ==================== octeontx-af2: Fixes for CN10K and CN9xxx platforms 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. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 67ab559 + 745166f commit 03c82e8

File tree

15 files changed

+164
-76
lines changed

15 files changed

+164
-76
lines changed

drivers/net/ethernet/marvell/octeontx2/af/cgx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,8 @@ static struct mac_ops cgx_mac_ops = {
15701570
.mac_enadis_pause_frm = cgx_lmac_enadis_pause_frm,
15711571
.mac_pause_frm_config = cgx_lmac_pause_frm_config,
15721572
.mac_enadis_ptp_config = cgx_lmac_ptp_config,
1573+
.mac_rx_tx_enable = cgx_lmac_rx_tx_enable,
1574+
.mac_tx_enable = cgx_lmac_tx_enable,
15731575
};
15741576

15751577
static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)

drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ struct mac_ops {
107107
void (*mac_enadis_ptp_config)(void *cgxd,
108108
int lmac_id,
109109
bool enable);
110+
111+
int (*mac_rx_tx_enable)(void *cgxd, int lmac_id, bool enable);
112+
int (*mac_tx_enable)(void *cgxd, int lmac_id, bool enable);
110113
};
111114

112115
struct cgx {

drivers/net/ethernet/marvell/octeontx2/af/mbox.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ enum nix_af_status {
732732
NIX_AF_ERR_BANDPROF_INVAL_REQ = -428,
733733
NIX_AF_ERR_CQ_CTX_WRITE_ERR = -429,
734734
NIX_AF_ERR_AQ_CTX_RETRY_WRITE = -430,
735+
NIX_AF_ERR_LINK_CREDITS = -431,
735736
};
736737

737738
/* For NIX RX vtag action */

drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ enum npc_kpu_parser_state {
185185
NPC_S_KPU2_QINQ,
186186
NPC_S_KPU2_ETAG,
187187
NPC_S_KPU2_EXDSA,
188-
NPC_S_KPU2_NGIO,
189188
NPC_S_KPU2_CPT_CTAG,
190189
NPC_S_KPU2_CPT_QINQ,
191190
NPC_S_KPU3_CTAG,
@@ -212,6 +211,7 @@ enum npc_kpu_parser_state {
212211
NPC_S_KPU5_NSH,
213212
NPC_S_KPU5_CPT_IP,
214213
NPC_S_KPU5_CPT_IP6,
214+
NPC_S_KPU5_NGIO,
215215
NPC_S_KPU6_IP6_EXT,
216216
NPC_S_KPU6_IP6_HOP_DEST,
217217
NPC_S_KPU6_IP6_ROUT,
@@ -1120,15 +1120,6 @@ static struct npc_kpu_profile_cam kpu1_cam_entries[] = {
11201120
0x0000,
11211121
0x0000,
11221122
},
1123-
{
1124-
NPC_S_KPU1_ETHER, 0xff,
1125-
NPC_ETYPE_CTAG,
1126-
0xffff,
1127-
NPC_ETYPE_NGIO,
1128-
0xffff,
1129-
0x0000,
1130-
0x0000,
1131-
},
11321123
{
11331124
NPC_S_KPU1_ETHER, 0xff,
11341125
NPC_ETYPE_CTAG,
@@ -1966,6 +1957,15 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = {
19661957
0x0000,
19671958
0x0000,
19681959
},
1960+
{
1961+
NPC_S_KPU2_CTAG, 0xff,
1962+
NPC_ETYPE_NGIO,
1963+
0xffff,
1964+
0x0000,
1965+
0x0000,
1966+
0x0000,
1967+
0x0000,
1968+
},
19691969
{
19701970
NPC_S_KPU2_CTAG, 0xff,
19711971
NPC_ETYPE_PPPOE,
@@ -2749,15 +2749,6 @@ static struct npc_kpu_profile_cam kpu2_cam_entries[] = {
27492749
0x0000,
27502750
0x0000,
27512751
},
2752-
{
2753-
NPC_S_KPU2_NGIO, 0xff,
2754-
0x0000,
2755-
0x0000,
2756-
0x0000,
2757-
0x0000,
2758-
0x0000,
2759-
0x0000,
2760-
},
27612752
{
27622753
NPC_S_KPU2_CPT_CTAG, 0xff,
27632754
NPC_ETYPE_IP,
@@ -5089,6 +5080,15 @@ static struct npc_kpu_profile_cam kpu5_cam_entries[] = {
50895080
0x0000,
50905081
0x0000,
50915082
},
5083+
{
5084+
NPC_S_KPU5_NGIO, 0xff,
5085+
0x0000,
5086+
0x0000,
5087+
0x0000,
5088+
0x0000,
5089+
0x0000,
5090+
0x0000,
5091+
},
50925092
{
50935093
NPC_S_NA, 0X00,
50945094
0x0000,
@@ -8422,14 +8422,6 @@ static struct npc_kpu_profile_action kpu1_action_entries[] = {
84228422
0,
84238423
0, 0, 0, 0,
84248424
},
8425-
{
8426-
NPC_ERRLEV_RE, NPC_EC_NOERR,
8427-
8, 12, 0, 0, 0,
8428-
NPC_S_KPU2_NGIO, 12, 1,
8429-
NPC_LID_LA, NPC_LT_LA_ETHER,
8430-
0,
8431-
0, 0, 0, 0,
8432-
},
84338425
{
84348426
NPC_ERRLEV_RE, NPC_EC_NOERR,
84358427
8, 12, 0, 0, 0,
@@ -9194,6 +9186,14 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = {
91949186
0,
91959187
0, 0, 0, 0,
91969188
},
9189+
{
9190+
NPC_ERRLEV_RE, NPC_EC_NOERR,
9191+
0, 0, 0, 2, 0,
9192+
NPC_S_KPU5_NGIO, 6, 1,
9193+
NPC_LID_LB, NPC_LT_LB_CTAG,
9194+
0,
9195+
0, 0, 0, 0,
9196+
},
91979197
{
91989198
NPC_ERRLEV_RE, NPC_EC_NOERR,
91999199
8, 0, 6, 2, 0,
@@ -9890,14 +9890,6 @@ static struct npc_kpu_profile_action kpu2_action_entries[] = {
98909890
NPC_F_LB_U_UNK_ETYPE | NPC_F_LB_L_EXDSA,
98919891
0, 0, 0, 0,
98929892
},
9893-
{
9894-
NPC_ERRLEV_RE, NPC_EC_NOERR,
9895-
0, 0, 0, 0, 1,
9896-
NPC_S_NA, 0, 1,
9897-
NPC_LID_LC, NPC_LT_LC_NGIO,
9898-
0,
9899-
0, 0, 0, 0,
9900-
},
99019893
{
99029894
NPC_ERRLEV_RE, NPC_EC_NOERR,
99039895
8, 0, 6, 2, 0,
@@ -11973,6 +11965,14 @@ static struct npc_kpu_profile_action kpu5_action_entries[] = {
1197311965
0,
1197411966
0, 0, 0, 0,
1197511967
},
11968+
{
11969+
NPC_ERRLEV_RE, NPC_EC_NOERR,
11970+
0, 0, 0, 0, 1,
11971+
NPC_S_NA, 0, 1,
11972+
NPC_LID_LC, NPC_LT_LC_NGIO,
11973+
0,
11974+
0, 0, 0, 0,
11975+
},
1197611976
{
1197711977
NPC_ERRLEV_LC, NPC_EC_UNK,
1197811978
0, 0, 0, 0, 1,

drivers/net/ethernet/marvell/octeontx2/af/rpm.c

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ static struct mac_ops rpm_mac_ops = {
3030
.mac_enadis_pause_frm = rpm_lmac_enadis_pause_frm,
3131
.mac_pause_frm_config = rpm_lmac_pause_frm_config,
3232
.mac_enadis_ptp_config = rpm_lmac_ptp_config,
33+
.mac_rx_tx_enable = rpm_lmac_rx_tx_enable,
34+
.mac_tx_enable = rpm_lmac_tx_enable,
3335
};
3436

3537
struct mac_ops *rpm_get_mac_ops(void)
@@ -54,6 +56,43 @@ int rpm_get_nr_lmacs(void *rpmd)
5456
return hweight8(rpm_read(rpm, 0, CGXX_CMRX_RX_LMACS) & 0xFULL);
5557
}
5658

59+
int rpm_lmac_tx_enable(void *rpmd, int lmac_id, bool enable)
60+
{
61+
rpm_t *rpm = rpmd;
62+
u64 cfg, last;
63+
64+
if (!is_lmac_valid(rpm, lmac_id))
65+
return -ENODEV;
66+
67+
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
68+
last = cfg;
69+
if (enable)
70+
cfg |= RPM_TX_EN;
71+
else
72+
cfg &= ~(RPM_TX_EN);
73+
74+
if (cfg != last)
75+
rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg);
76+
return !!(last & RPM_TX_EN);
77+
}
78+
79+
int rpm_lmac_rx_tx_enable(void *rpmd, int lmac_id, bool enable)
80+
{
81+
rpm_t *rpm = rpmd;
82+
u64 cfg;
83+
84+
if (!is_lmac_valid(rpm, lmac_id))
85+
return -ENODEV;
86+
87+
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
88+
if (enable)
89+
cfg |= RPM_RX_EN | RPM_TX_EN;
90+
else
91+
cfg &= ~(RPM_RX_EN | RPM_TX_EN);
92+
rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg);
93+
return 0;
94+
}
95+
5796
void rpm_lmac_enadis_rx_pause_fwding(void *rpmd, int lmac_id, bool enable)
5897
{
5998
rpm_t *rpm = rpmd;
@@ -252,23 +291,20 @@ int rpm_lmac_internal_loopback(void *rpmd, int lmac_id, bool enable)
252291
if (!rpm || lmac_id >= rpm->lmac_count)
253292
return -ENODEV;
254293
lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id);
255-
if (lmac_type == LMAC_MODE_100G_R) {
256-
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1);
257-
258-
if (enable)
259-
cfg |= RPMX_MTI_PCS_LBK;
260-
else
261-
cfg &= ~RPMX_MTI_PCS_LBK;
262-
rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg);
263-
} else {
264-
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1);
265-
if (enable)
266-
cfg |= RPMX_MTI_PCS_LBK;
267-
else
268-
cfg &= ~RPMX_MTI_PCS_LBK;
269-
rpm_write(rpm, lmac_id, RPMX_MTI_LPCSX_CONTROL1, cfg);
294+
295+
if (lmac_type == LMAC_MODE_QSGMII || lmac_type == LMAC_MODE_SGMII) {
296+
dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n");
297+
return 0;
270298
}
271299

300+
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1);
301+
302+
if (enable)
303+
cfg |= RPMX_MTI_PCS_LBK;
304+
else
305+
cfg &= ~RPMX_MTI_PCS_LBK;
306+
rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg);
307+
272308
return 0;
273309
}
274310

drivers/net/ethernet/marvell/octeontx2/af/rpm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#define RPMX_MTI_STAT_DATA_HI_CDC 0x10038
4444

4545
#define RPM_LMAC_FWI 0xa
46+
#define RPM_TX_EN BIT_ULL(0)
47+
#define RPM_RX_EN BIT_ULL(1)
4648

4749
/* Function Declarations */
4850
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,
5759
int rpm_get_tx_stats(void *rpmd, int lmac_id, int idx, u64 *tx_stat);
5860
int rpm_get_rx_stats(void *rpmd, int lmac_id, int idx, u64 *rx_stat);
5961
void rpm_lmac_ptp_config(void *rpmd, int lmac_id, bool enable);
62+
int rpm_lmac_rx_tx_enable(void *rpmd, int lmac_id, bool enable);
63+
int rpm_lmac_tx_enable(void *rpmd, int lmac_id, bool enable);
6064
#endif /* RPM_H */

drivers/net/ethernet/marvell/octeontx2/af/rvu.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,11 @@ static void rvu_block_reset(struct rvu *rvu, int blkaddr, u64 rst_reg)
520520

521521
rvu_write64(rvu, blkaddr, rst_reg, BIT_ULL(0));
522522
err = rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true);
523-
if (err)
524-
dev_err(rvu->dev, "HW block:%d reset failed\n", blkaddr);
523+
if (err) {
524+
dev_err(rvu->dev, "HW block:%d reset timeout retrying again\n", blkaddr);
525+
while (rvu_poll_reg(rvu, blkaddr, rst_reg, BIT_ULL(63), true) == -EBUSY)
526+
;
527+
}
525528
}
526529

527530
static void rvu_reset_all_blocks(struct rvu *rvu)

drivers/net/ethernet/marvell/octeontx2/af/rvu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,7 @@ bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature);
806806
u32 rvu_cgx_get_fifolen(struct rvu *rvu);
807807
void *rvu_first_cgx_pdata(struct rvu *rvu);
808808
int cgxlmac_to_pf(struct rvu *rvu, int cgx_id, int lmac_id);
809+
int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable);
809810

810811
int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
811812
int type);

drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,16 +441,26 @@ void rvu_cgx_enadis_rx_bp(struct rvu *rvu, int pf, bool enable)
441441
int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start)
442442
{
443443
int pf = rvu_get_pf(pcifunc);
444+
struct mac_ops *mac_ops;
444445
u8 cgx_id, lmac_id;
446+
void *cgxd;
445447

446448
if (!is_cgx_config_permitted(rvu, pcifunc))
447449
return LMAC_AF_ERR_PERM_DENIED;
448450

449451
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
452+
cgxd = rvu_cgx_pdata(cgx_id, rvu);
453+
mac_ops = get_mac_ops(cgxd);
454+
455+
return mac_ops->mac_rx_tx_enable(cgxd, lmac_id, start);
456+
}
450457

451-
cgx_lmac_rx_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, start);
458+
int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable)
459+
{
460+
struct mac_ops *mac_ops;
452461

453-
return 0;
462+
mac_ops = get_mac_ops(cgxd);
463+
return mac_ops->mac_tx_enable(cgxd, lmac_id, enable);
454464
}
455465

456466
void rvu_cgx_disable_dmac_entries(struct rvu *rvu, u16 pcifunc)

drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,8 @@ static void print_nix_cn10k_sq_ctx(struct seq_file *m,
12241224
seq_printf(m, "W3: head_offset\t\t\t%d\nW3: smenq_next_sqb_vld\t\t%d\n\n",
12251225
sq_ctx->head_offset, sq_ctx->smenq_next_sqb_vld);
12261226

1227+
seq_printf(m, "W3: smq_next_sq_vld\t\t%d\nW3: smq_pend\t\t\t%d\n",
1228+
sq_ctx->smq_next_sq_vld, sq_ctx->smq_pend);
12271229
seq_printf(m, "W4: next_sqb \t\t\t%llx\n\n", sq_ctx->next_sqb);
12281230
seq_printf(m, "W5: tail_sqb \t\t\t%llx\n\n", sq_ctx->tail_sqb);
12291231
seq_printf(m, "W6: smenq_sqb \t\t\t%llx\n\n", sq_ctx->smenq_sqb);

0 commit comments

Comments
 (0)