Skip to content

Commit 0eefa27

Browse files
Subbaraya SundeepPaolo Abeni
authored andcommitted
octeontx2-af: Set LMT_ENA bit for APR table entries
This patch enables the LMT line for a PF/VF by setting the LMT_ENA bit in the APR_LMT_MAP_ENTRY_S structure. Additionally, it simplifies the logic for calculating the LMTST table index by consistently using the maximum number of hw supported VFs (i.e., 256). Fixes: 873a1e3 ("octeontx2-af: cn10k: Setting up lmtst map table"). Signed-off-by: Subbaraya Sundeep <[email protected]> Signed-off-by: Geetha sowjanya <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent bd2ec34 commit 0eefa27

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@
1515
#define LMT_TBL_OP_WRITE 1
1616
#define LMT_MAP_TABLE_SIZE (128 * 1024)
1717
#define LMT_MAPTBL_ENTRY_SIZE 16
18+
#define LMT_MAX_VFS 256
19+
20+
#define LMT_MAP_ENTRY_ENA BIT_ULL(20)
21+
#define LMT_MAP_ENTRY_LINES GENMASK_ULL(18, 16)
1822

1923
/* Function to perform operations (read/write) on lmtst map table */
2024
static int lmtst_map_table_ops(struct rvu *rvu, u32 index, u64 *val,
2125
int lmt_tbl_op)
2226
{
2327
void __iomem *lmt_map_base;
24-
u64 tbl_base;
28+
u64 tbl_base, cfg;
2529

2630
tbl_base = rvu_read64(rvu, BLKADDR_APR, APR_AF_LMT_MAP_BASE);
2731

@@ -35,6 +39,13 @@ static int lmtst_map_table_ops(struct rvu *rvu, u32 index, u64 *val,
3539
*val = readq(lmt_map_base + index);
3640
} else {
3741
writeq((*val), (lmt_map_base + index));
42+
43+
cfg = FIELD_PREP(LMT_MAP_ENTRY_ENA, 0x1);
44+
/* 2048 LMTLINES */
45+
cfg |= FIELD_PREP(LMT_MAP_ENTRY_LINES, 0x6);
46+
47+
writeq(cfg, (lmt_map_base + (index + 8)));
48+
3849
/* Flushing the AP interceptor cache to make APR_LMT_MAP_ENTRY_S
3950
* changes effective. Write 1 for flush and read is being used as a
4051
* barrier and sets up a data dependency. Write to 0 after a write
@@ -52,7 +63,7 @@ static int lmtst_map_table_ops(struct rvu *rvu, u32 index, u64 *val,
5263
#define LMT_MAP_TBL_W1_OFF 8
5364
static u32 rvu_get_lmtst_tbl_index(struct rvu *rvu, u16 pcifunc)
5465
{
55-
return ((rvu_get_pf(pcifunc) * rvu->hw->total_vfs) +
66+
return ((rvu_get_pf(pcifunc) * LMT_MAX_VFS) +
5667
(pcifunc & RVU_PFVF_FUNC_MASK)) * LMT_MAPTBL_ENTRY_SIZE;
5768
}
5869

0 commit comments

Comments
 (0)