Skip to content

Commit 2078a34

Browse files
author
Paolo Abeni
committed
Merge branch 'octeontx2-af-miscellaneous-fixes'
Geetha sowjanya says: ==================== octeontx2-af: miscellaneous fixes The series of patches fixes various issues related to mcs and NIX link registers. v3-v4: Used FIELD_PREP macro and proper data types. v2-v3: Fixed typo error in patch 4 commit message. v1-v2: Fixed author name for patch 5. Added Reviewed-by. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 3142dbf + 7336fc1 commit 2078a34

File tree

9 files changed

+60
-10
lines changed

9 files changed

+60
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ struct mcs_hw_info {
19451945
u8 tcam_entries; /* RX/TX Tcam entries per mcs block */
19461946
u8 secy_entries; /* RX/TX SECY entries per mcs block */
19471947
u8 sc_entries; /* RX/TX SC CAM entries per mcs block */
1948-
u8 sa_entries; /* PN table entries = SA entries */
1948+
u16 sa_entries; /* PN table entries = SA entries */
19491949
u64 rsvd[16];
19501950
};
19511951

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void mcs_get_rx_secy_stats(struct mcs *mcs, struct mcs_secy_stats *stats, int id
117117
reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYTAGGEDCTLX(id);
118118
stats->pkt_tagged_ctl_cnt = mcs_reg_read(mcs, reg);
119119

120-
reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYUNTAGGEDORNOTAGX(id);
120+
reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYUNTAGGEDX(id);
121121
stats->pkt_untaged_cnt = mcs_reg_read(mcs, reg);
122122

123123
reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYCTLX(id);
@@ -215,7 +215,7 @@ void mcs_get_sc_stats(struct mcs *mcs, struct mcs_sc_stats *stats,
215215
reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSCNOTVALIDX(id);
216216
stats->pkt_notvalid_cnt = mcs_reg_read(mcs, reg);
217217

218-
reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSCUNCHECKEDOROKX(id);
218+
reg = MCSX_CSE_RX_MEM_SLAVE_INPKTSSCUNCHECKEDX(id);
219219
stats->pkt_unchecked_cnt = mcs_reg_read(mcs, reg);
220220

221221
if (mcs->hw->mcs_blks > 1) {
@@ -1219,6 +1219,17 @@ struct mcs *mcs_get_pdata(int mcs_id)
12191219
return NULL;
12201220
}
12211221

1222+
bool is_mcs_bypass(int mcs_id)
1223+
{
1224+
struct mcs *mcs_dev;
1225+
1226+
list_for_each_entry(mcs_dev, &mcs_list, mcs_list) {
1227+
if (mcs_dev->mcs_id == mcs_id)
1228+
return mcs_dev->bypass;
1229+
}
1230+
return true;
1231+
}
1232+
12221233
void mcs_set_port_cfg(struct mcs *mcs, struct mcs_port_cfg_set_req *req)
12231234
{
12241235
u64 val = 0;
@@ -1436,7 +1447,7 @@ static int mcs_x2p_calibration(struct mcs *mcs)
14361447
return err;
14371448
}
14381449

1439-
static void mcs_set_external_bypass(struct mcs *mcs, u8 bypass)
1450+
static void mcs_set_external_bypass(struct mcs *mcs, bool bypass)
14401451
{
14411452
u64 val;
14421453

@@ -1447,6 +1458,7 @@ static void mcs_set_external_bypass(struct mcs *mcs, u8 bypass)
14471458
else
14481459
val &= ~BIT_ULL(6);
14491460
mcs_reg_write(mcs, MCSX_MIL_GLOBAL, val);
1461+
mcs->bypass = bypass;
14501462
}
14511463

14521464
static void mcs_global_cfg(struct mcs *mcs)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ struct mcs {
149149
u16 num_vec;
150150
void *rvu;
151151
u16 *tx_sa_active;
152+
bool bypass;
152153
};
153154

154155
struct mcs_ops {
@@ -206,6 +207,7 @@ void mcs_get_custom_tag_cfg(struct mcs *mcs, struct mcs_custom_tag_cfg_get_req *
206207
int mcs_alloc_ctrlpktrule(struct rsrc_bmap *rsrc, u16 *pf_map, u16 offset, u16 pcifunc);
207208
int mcs_free_ctrlpktrule(struct mcs *mcs, struct mcs_free_ctrl_pkt_rule_req *req);
208209
int mcs_ctrlpktrule_write(struct mcs *mcs, struct mcs_ctrl_pkt_rule_write_req *req);
210+
bool is_mcs_bypass(int mcs_id);
209211

210212
/* CN10K-B APIs */
211213
void cn10kb_mcs_set_hw_capabilities(struct mcs *mcs);

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

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -810,14 +810,37 @@
810810
offset = 0x9d8ull; \
811811
offset; })
812812

813+
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSCUNCHECKEDX(a) ({ \
814+
u64 offset; \
815+
\
816+
offset = 0xee80ull; \
817+
if (mcs->hw->mcs_blks > 1) \
818+
offset = 0xe818ull; \
819+
offset += (a) * 0x8ull; \
820+
offset; })
821+
822+
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYUNTAGGEDX(a) ({ \
823+
u64 offset; \
824+
\
825+
offset = 0xa680ull; \
826+
if (mcs->hw->mcs_blks > 1) \
827+
offset = 0xd018ull; \
828+
offset += (a) * 0x8ull; \
829+
offset; })
830+
831+
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSCLATEORDELAYEDX(a) ({ \
832+
u64 offset; \
833+
\
834+
offset = 0xf680ull; \
835+
if (mcs->hw->mcs_blks > 1) \
836+
offset = 0xe018ull; \
837+
offset += (a) * 0x8ull; \
838+
offset; })
839+
813840
#define MCSX_CSE_RX_MEM_SLAVE_INOCTETSSCDECRYPTEDX(a) (0xe680ull + (a) * 0x8ull)
814841
#define MCSX_CSE_RX_MEM_SLAVE_INOCTETSSCVALIDATEX(a) (0xde80ull + (a) * 0x8ull)
815-
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYUNTAGGEDORNOTAGX(a) (0xa680ull + (a) * 0x8ull)
816842
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYNOTAGX(a) (0xd218 + (a) * 0x8ull)
817-
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYUNTAGGEDX(a) (0xd018ull + (a) * 0x8ull)
818-
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSCUNCHECKEDOROKX(a) (0xee80ull + (a) * 0x8ull)
819843
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSECYCTLX(a) (0xb680ull + (a) * 0x8ull)
820-
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSCLATEORDELAYEDX(a) (0xf680ull + (a) * 0x8ull)
821844
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSAINVALIDX(a) (0x12680ull + (a) * 0x8ull)
822845
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSANOTUSINGSAERRORX(a) (0x15680ull + (a) * 0x8ull)
823846
#define MCSX_CSE_RX_MEM_SLAVE_INPKTSSANOTVALIDX(a) (0x13680ull + (a) * 0x8ull)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,6 +2631,9 @@ static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)
26312631
rvu_npc_free_mcam_entries(rvu, pcifunc, -1);
26322632
rvu_mac_reset(rvu, pcifunc);
26332633

2634+
if (rvu->mcs_blk_cnt)
2635+
rvu_mcs_flr_handler(rvu, pcifunc);
2636+
26342637
mutex_unlock(&rvu->flr_lock);
26352638
}
26362639

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ struct nix_hw {
345345
struct nix_txvlan txvlan;
346346
struct nix_ipolicer *ipolicer;
347347
u64 *tx_credits;
348+
u8 cc_mcs_cnt;
348349
};
349350

350351
/* RVU block's capabilities or functionality,

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "rvu_reg.h"
1313
#include "rvu.h"
1414
#include "npc.h"
15+
#include "mcs.h"
1516
#include "cgx.h"
1617
#include "lmac_common.h"
1718
#include "rvu_npc_hash.h"
@@ -4389,6 +4390,12 @@ static void nix_link_config(struct rvu *rvu, int blkaddr,
43894390
SDP_HW_MAX_FRS << 16 | NIC_HW_MIN_FRS);
43904391
}
43914392

4393+
/* Get MCS external bypass status for CN10K-B */
4394+
if (mcs_get_blkcnt() == 1) {
4395+
/* Adjust for 2 credits when external bypass is disabled */
4396+
nix_hw->cc_mcs_cnt = is_mcs_bypass(0) ? 0 : 2;
4397+
}
4398+
43924399
/* Set credits for Tx links assuming max packet length allowed.
43934400
* This will be reconfigured based on MTU set for PF/VF.
43944401
*/
@@ -4412,6 +4419,7 @@ static void nix_link_config(struct rvu *rvu, int blkaddr,
44124419
tx_credits = (lmac_fifo_len - lmac_max_frs) / 16;
44134420
/* Enable credits and set credit pkt count to max allowed */
44144421
cfg = (tx_credits << 12) | (0x1FF << 2) | BIT_ULL(1);
4422+
cfg |= FIELD_PREP(NIX_AF_LINKX_MCS_CNT_MASK, nix_hw->cc_mcs_cnt);
44154423

44164424
link = iter + slink;
44174425
nix_hw->tx_credits[link] = tx_credits;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ static struct hw_reg_map txsch_reg_map[NIX_TXSCH_LVL_CNT] = {
3131
{NIX_TXSCH_LVL_TL4, 3, 0xFFFF, {{0x0B00, 0x0B08}, {0x0B10, 0x0B18},
3232
{0x1200, 0x12E0} } },
3333
{NIX_TXSCH_LVL_TL3, 4, 0xFFFF, {{0x1000, 0x10E0}, {0x1600, 0x1608},
34-
{0x1610, 0x1618}, {0x1700, 0x17B0} } },
35-
{NIX_TXSCH_LVL_TL2, 2, 0xFFFF, {{0x0E00, 0x0EE0}, {0x1700, 0x17B0} } },
34+
{0x1610, 0x1618}, {0x1700, 0x17C8} } },
35+
{NIX_TXSCH_LVL_TL2, 2, 0xFFFF, {{0x0E00, 0x0EE0}, {0x1700, 0x17C8} } },
3636
{NIX_TXSCH_LVL_TL1, 1, 0xFFFF, {{0x0C00, 0x0D98} } },
3737
};
3838

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@
437437

438438
#define NIX_AF_LINKX_BASE_MASK GENMASK_ULL(11, 0)
439439
#define NIX_AF_LINKX_RANGE_MASK GENMASK_ULL(19, 16)
440+
#define NIX_AF_LINKX_MCS_CNT_MASK GENMASK_ULL(33, 32)
440441

441442
/* SSO */
442443
#define SSO_AF_CONST (0x1000)

0 commit comments

Comments
 (0)