Skip to content

Commit 2cb5942

Browse files
committed
Merge branch 'octeonx2-mcam-management-rework'
Subbaraya Sundeep says: ==================== octeontx2: Rework MCAM flows management for VFs From Octeontx2 hardware point of view there is no difference between PFs and VFs. Hence with refactoring in driver the packet classification features or offloads can be supported by VFs also. This patchset unifies the mcam flows management so that VFs can also support ntuple filters. Since there are MCAM allocations by all PFs and VFs in the system it is required to have the ability to modify number of mcam rules count for a PF/VF in runtime. This is achieved by using devlink. Below is the summary of patches: Patch 1,2,3 are trivial patches which helps in debugging in case of errors by using custom error codes and displaying proper error messages. Patches 4,5 brings rx-all and ntuple support for CGX mapped VFs and LBK VFs. Patches 6,7,8 brings devlink support to PF netdev driver so that mcam entries count can be changed at runtime. To change mcam rule count at runtime where multiple rule allocations are done sorting is required. Also both ntuple and TC rules needs to be unified. Patch 9 is related to AF NPC where a PF allocated entries are allocated at bottom(low priority). On CN10K there is slight change in reading NPC counters which is handled by patch 10. Patch 11 is to allow packets from CPT for NPC parsing on CN10K. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 354e1f9 + aee5122 commit 2cb5942

File tree

16 files changed

+585
-173
lines changed

16 files changed

+585
-173
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,13 @@ enum npc_af_status {
10781078
NPC_MCAM_ALLOC_DENIED = -702,
10791079
NPC_MCAM_ALLOC_FAILED = -703,
10801080
NPC_MCAM_PERM_DENIED = -704,
1081+
NPC_FLOW_INTF_INVALID = -707,
1082+
NPC_FLOW_CHAN_INVALID = -708,
1083+
NPC_FLOW_NO_NIXLF = -709,
1084+
NPC_FLOW_NOT_SUPPORTED = -710,
1085+
NPC_FLOW_VF_PERM_DENIED = -711,
1086+
NPC_FLOW_VF_NOT_INIT = -712,
1087+
NPC_FLOW_VF_OVERLAP = -713,
10811088
};
10821089

10831090
struct npc_mcam_alloc_entry_req {
@@ -1426,4 +1433,13 @@ struct cpt_rxc_time_cfg_req {
14261433
u16 active_limit;
14271434
};
14281435

1436+
/* CGX mailbox error codes
1437+
* Range 1101 - 1200.
1438+
*/
1439+
enum cgx_af_status {
1440+
LMAC_AF_ERR_INVALID_PARAM = -1101,
1441+
LMAC_AF_ERR_PF_NOT_MAPPED = -1102,
1442+
LMAC_AF_ERR_PERM_DENIED = -1103,
1443+
};
1444+
14291445
#endif /* MBOX_H */

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

Lines changed: 73 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -924,16 +924,26 @@ static int rvu_setup_hw_resources(struct rvu *rvu)
924924
block->lfreset_reg = NPA_AF_LF_RST;
925925
sprintf(block->name, "NPA");
926926
err = rvu_alloc_bitmap(&block->lf);
927-
if (err)
927+
if (err) {
928+
dev_err(rvu->dev,
929+
"%s: Failed to allocate NPA LF bitmap\n", __func__);
928930
return err;
931+
}
929932

930933
nix:
931934
err = rvu_setup_nix_hw_resource(rvu, BLKADDR_NIX0);
932-
if (err)
935+
if (err) {
936+
dev_err(rvu->dev,
937+
"%s: Failed to allocate NIX0 LFs bitmap\n", __func__);
933938
return err;
939+
}
940+
934941
err = rvu_setup_nix_hw_resource(rvu, BLKADDR_NIX1);
935-
if (err)
942+
if (err) {
943+
dev_err(rvu->dev,
944+
"%s: Failed to allocate NIX1 LFs bitmap\n", __func__);
936945
return err;
946+
}
937947

938948
/* Init SSO group's bitmap */
939949
block = &hw->block[BLKADDR_SSO];
@@ -953,8 +963,11 @@ static int rvu_setup_hw_resources(struct rvu *rvu)
953963
block->lfreset_reg = SSO_AF_LF_HWGRP_RST;
954964
sprintf(block->name, "SSO GROUP");
955965
err = rvu_alloc_bitmap(&block->lf);
956-
if (err)
966+
if (err) {
967+
dev_err(rvu->dev,
968+
"%s: Failed to allocate SSO LF bitmap\n", __func__);
957969
return err;
970+
}
958971

959972
ssow:
960973
/* Init SSO workslot's bitmap */
@@ -974,8 +987,11 @@ static int rvu_setup_hw_resources(struct rvu *rvu)
974987
block->lfreset_reg = SSOW_AF_LF_HWS_RST;
975988
sprintf(block->name, "SSOWS");
976989
err = rvu_alloc_bitmap(&block->lf);
977-
if (err)
990+
if (err) {
991+
dev_err(rvu->dev,
992+
"%s: Failed to allocate SSOW LF bitmap\n", __func__);
978993
return err;
994+
}
979995

980996
tim:
981997
/* Init TIM LF's bitmap */
@@ -996,35 +1012,55 @@ static int rvu_setup_hw_resources(struct rvu *rvu)
9961012
block->lfreset_reg = TIM_AF_LF_RST;
9971013
sprintf(block->name, "TIM");
9981014
err = rvu_alloc_bitmap(&block->lf);
999-
if (err)
1015+
if (err) {
1016+
dev_err(rvu->dev,
1017+
"%s: Failed to allocate TIM LF bitmap\n", __func__);
10001018
return err;
1019+
}
10011020

10021021
cpt:
10031022
err = rvu_setup_cpt_hw_resource(rvu, BLKADDR_CPT0);
1004-
if (err)
1023+
if (err) {
1024+
dev_err(rvu->dev,
1025+
"%s: Failed to allocate CPT0 LF bitmap\n", __func__);
10051026
return err;
1027+
}
10061028
err = rvu_setup_cpt_hw_resource(rvu, BLKADDR_CPT1);
1029+
if (err) {
1030+
dev_err(rvu->dev,
1031+
"%s: Failed to allocate CPT1 LF bitmap\n", __func__);
1032+
return err;
1033+
}
10071034
if (err)
10081035
return err;
10091036

10101037
/* Allocate memory for PFVF data */
10111038
rvu->pf = devm_kcalloc(rvu->dev, hw->total_pfs,
10121039
sizeof(struct rvu_pfvf), GFP_KERNEL);
1013-
if (!rvu->pf)
1040+
if (!rvu->pf) {
1041+
dev_err(rvu->dev,
1042+
"%s: Failed to allocate memory for PF's rvu_pfvf struct\n", __func__);
10141043
return -ENOMEM;
1044+
}
10151045

10161046
rvu->hwvf = devm_kcalloc(rvu->dev, hw->total_vfs,
10171047
sizeof(struct rvu_pfvf), GFP_KERNEL);
1018-
if (!rvu->hwvf)
1048+
if (!rvu->hwvf) {
1049+
dev_err(rvu->dev,
1050+
"%s: Failed to allocate memory for VF's rvu_pfvf struct\n", __func__);
10191051
return -ENOMEM;
1052+
}
10201053

10211054
mutex_init(&rvu->rsrc_lock);
10221055

10231056
rvu_fwdata_init(rvu);
10241057

10251058
err = rvu_setup_msix_resources(rvu);
1026-
if (err)
1059+
if (err) {
1060+
dev_err(rvu->dev,
1061+
"%s: Failed to setup MSIX resources\n", __func__);
10271062
return err;
1063+
}
10281064

10291065
for (blkid = 0; blkid < BLK_COUNT; blkid++) {
10301066
block = &hw->block[blkid];
@@ -1050,25 +1086,33 @@ static int rvu_setup_hw_resources(struct rvu *rvu)
10501086
goto msix_err;
10511087

10521088
err = rvu_npc_init(rvu);
1053-
if (err)
1089+
if (err) {
1090+
dev_err(rvu->dev, "%s: Failed to initialize npc\n", __func__);
10541091
goto npc_err;
1092+
}
10551093

10561094
err = rvu_cgx_init(rvu);
1057-
if (err)
1095+
if (err) {
1096+
dev_err(rvu->dev, "%s: Failed to initialize cgx\n", __func__);
10581097
goto cgx_err;
1098+
}
10591099

10601100
/* Assign MACs for CGX mapped functions */
10611101
rvu_setup_pfvf_macaddress(rvu);
10621102

10631103
err = rvu_npa_init(rvu);
1064-
if (err)
1104+
if (err) {
1105+
dev_err(rvu->dev, "%s: Failed to initialize npa\n", __func__);
10651106
goto npa_err;
1107+
}
10661108

10671109
rvu_get_lbk_bufsize(rvu);
10681110

10691111
err = rvu_nix_init(rvu);
1070-
if (err)
1112+
if (err) {
1113+
dev_err(rvu->dev, "%s: Failed to initialize nix\n", __func__);
10711114
goto nix_err;
1115+
}
10721116

10731117
rvu_program_channels(rvu);
10741118

@@ -2984,27 +3028,37 @@ static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
29843028
err = rvu_mbox_init(rvu, &rvu->afpf_wq_info, TYPE_AFPF,
29853029
rvu->hw->total_pfs, rvu_afpf_mbox_handler,
29863030
rvu_afpf_mbox_up_handler);
2987-
if (err)
3031+
if (err) {
3032+
dev_err(dev, "%s: Failed to initialize mbox\n", __func__);
29883033
goto err_hwsetup;
3034+
}
29893035

29903036
err = rvu_flr_init(rvu);
2991-
if (err)
3037+
if (err) {
3038+
dev_err(dev, "%s: Failed to initialize flr\n", __func__);
29923039
goto err_mbox;
3040+
}
29933041

29943042
err = rvu_register_interrupts(rvu);
2995-
if (err)
3043+
if (err) {
3044+
dev_err(dev, "%s: Failed to register interrupts\n", __func__);
29963045
goto err_flr;
3046+
}
29973047

29983048
err = rvu_register_dl(rvu);
2999-
if (err)
3049+
if (err) {
3050+
dev_err(dev, "%s: Failed to register devlink\n", __func__);
30003051
goto err_irq;
3052+
}
30013053

30023054
rvu_setup_rvum_blk_revid(rvu);
30033055

30043056
/* Enable AF's VFs (if any) */
30053057
err = rvu_enable_sriov(rvu);
3006-
if (err)
3058+
if (err) {
3059+
dev_err(dev, "%s: Failed to enable sriov\n", __func__);
30073060
goto err_dl;
3061+
}
30083062

30093063
/* Initialize debugfs */
30103064
rvu_dbg_init(rvu);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ struct rvu_hwinfo {
356356
u16 npc_counters; /* No of match stats counters */
357357
u32 lbk_bufsize; /* FIFO size supported by LBK */
358358
bool npc_ext_set; /* Extended register set */
359+
u64 npc_stat_ena; /* Match stats enable bit */
359360

360361
struct hw_cap cap;
361362
struct rvu_block block[BLK_COUNT]; /* Block info */

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start)
448448
u8 cgx_id, lmac_id;
449449

450450
if (!is_cgx_config_permitted(rvu, pcifunc))
451-
return -EPERM;
451+
return LMAC_AF_ERR_PERM_DENIED;
452452

453453
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
454454

@@ -507,7 +507,7 @@ static int rvu_lmac_get_stats(struct rvu *rvu, struct msg_req *req,
507507
void *cgxd;
508508

509509
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
510-
return -ENODEV;
510+
return LMAC_AF_ERR_PERM_DENIED;
511511

512512
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_idx, &lmac);
513513
cgxd = rvu_cgx_pdata(cgx_idx, rvu);
@@ -561,7 +561,7 @@ int rvu_mbox_handler_cgx_fec_stats(struct rvu *rvu,
561561
void *cgxd;
562562

563563
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
564-
return -EPERM;
564+
return LMAC_AF_ERR_PERM_DENIED;
565565
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_idx, &lmac);
566566

567567
cgxd = rvu_cgx_pdata(cgx_idx, rvu);
@@ -888,7 +888,7 @@ int rvu_mbox_handler_cgx_get_phy_fec_stats(struct rvu *rvu, struct msg_req *req,
888888
u8 cgx_id, lmac_id;
889889

890890
if (!is_pf_cgxmapped(rvu, pf))
891-
return -EPERM;
891+
return LMAC_AF_ERR_PF_NOT_MAPPED;
892892

893893
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
894894
return cgx_get_phy_fec_stats(rvu_cgx_pdata(cgx_id, rvu), lmac_id);
@@ -1046,7 +1046,7 @@ int rvu_mbox_handler_cgx_mac_addr_reset(struct rvu *rvu, struct msg_req *req,
10461046
u8 cgx_id, lmac_id;
10471047

10481048
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
1049-
return -EPERM;
1049+
return LMAC_AF_ERR_PERM_DENIED;
10501050

10511051
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
10521052
return cgx_lmac_addr_reset(cgx_id, lmac_id);
@@ -1060,7 +1060,7 @@ int rvu_mbox_handler_cgx_mac_addr_update(struct rvu *rvu,
10601060
u8 cgx_id, lmac_id;
10611061

10621062
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
1063-
return -EPERM;
1063+
return LMAC_AF_ERR_PERM_DENIED;
10641064

10651065
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
10661066
return cgx_lmac_addr_update(cgx_id, lmac_id, req->mac_addr, req->index);

0 commit comments

Comments
 (0)