Support for OcteonTx2 98xx silcion
Subsystems (4)
v2 cover Support for OcteonTx2 98xx silcion
From: Subbaraya Sundeep <[email protected]>
OcteonTx2 series of silicons have multiple variants, the 98xx variant has two network interface controllers (NIX blocks) each of which supports upto 100Gbps. Similarly 98xx supports two crypto blocks (CPT) to double the crypto performance. The current RVU drivers support a single NIX and
CPT blocks, this patchset adds support for multiple blocks of same type to be active at the same time.
Also the number of serdes controllers (CGX) have increased from three to five on 98xx. Each of the CGX block supports upto 4 physical interfaces depending on the serdes mode ie upto 20 physical interfaces. At a time each CGX block can be mapped to a single NIX. The HW configuration to map CGX and NIX blocks is done by firmware.
NPC has two new interfaces added NIX1_RX and NIX1_TX similar to NIX0 interfaces. Also MCAM entries is increased from 4k to 16k. To support the 16k entries extended set is added in hardware which are at completely different register offsets. Fortunately new constant registers can be read to figure out the extended set is present or not.
This patch set modifies existing AF and PF drivers
in below order to support 98xx:
- Prepare for supporting multiple blocks of same type. Functions which operate with block type to get or set resources count are modified to operate with block address
- Manage allocating and freeing LFs from new NIX1 and CPT1 RVU blocks.
- NIX block specific initialization and teardown for NIX1
- Based on the mapping set by Firmware, assign the NIX block LFs to a PF/VF.
- Multicast entries context is setup for NIX1 along with NIX0
- NPC changes to support extended set of MCAM entries, counters and NIX1 interfaces to NPC.
- All the mailbox changes required for the new blocks in 98xx.
- Since there are more CGX links in 98xx the hardcoded LBK link value needed by netdev drivers is not sufficient any more. Hence AF consumers need to get the number of all links and calculate the LBK link.
- Debugfs changes to display NIX1 contexts similar to NIX0
- Debugfs change to display mapping between CGX, NIX and PF.
v2:
Resending since net-next is open now
Rakesh Babu (4):
octeontx2-af: Manage new blocks in 98xx
octeontx2-af: Initialize NIX1 block
octeontx2-af: Display NIX1 also in debugfs
octeontx2-af: Display CGX, NIX and PF map in debugfs.
Subbaraya Sundeep (6):
octeontx2-af: Update get/set resource count functions
octeontx2-af: Map NIX block from CGX connection
octeontx2-af: Setup MCE context for assigned NIX
octeontx2-af: Add NIX1 interfaces to NPC
octeontx2-af: Mbox changes for 98xx
octeontx2-pf: Calculate LBK link instead of hardcoding
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 13 +- drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 5 + drivers/net/ethernet/marvell/octeontx2/af/common.h | 10 +- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 19 +- .../ethernet/marvell/octeontx2/af/npc_profile.h | 2 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 361 ++++++++++++++++----- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 26 +- .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 15 + .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 223 ++++++++++--- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 199 +++++++++--- .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 328 ++++++++++++++----- .../net/ethernet/marvell/octeontx2/af/rvu_reg.c | 2 +- .../net/ethernet/marvell/octeontx2/af/rvu_reg.h | 87 ++++- .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 6 +- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 8 +- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 2 + 16 files changed, 1008 insertions(+), 298 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/10 octeontx2-af: Update get/set resource count functions
From: Subbaraya Sundeep <[email protected]>
Since multiple blocks of same type are present in 98xx, modify functions which get resource count and which update resource count to work with individual block address instead of block type.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 73 +++++++++++++++++-------- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 2 + 2 files changed, 53 insertions(+), 22 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +51 -22
@@ -306,31 +306,36 @@ static void rvu_update_rsrc_map(struct rvu *rvu, struct rvu_pfvf *pfvf, block->fn_map[lf] = attach ? pcifunc :0 ; -switch (block->type) { -case BLKTYPE_NPA : +switch (block->addr) { +case BLKADDR_NPA : pfvf->npalf = attach ? true : false; num_lfs = pfvf->npalf;break ; -case BLKTYPE_NIX : +case BLKADDR_NIX0 : +case BLKADDR_NIX1 : pfvf->nixlf = attach ? true : false; num_lfs = pfvf->nixlf;break ; -case BLKTYPE_SSO : +case BLKADDR_SSO : attach ? pfvf->sso++ : pfvf->sso--; num_lfs = pfvf->sso;break ; -case BLKTYPE_SSOW : +case BLKADDR_SSOW : attach ? pfvf->ssow++ : pfvf->ssow--; num_lfs = pfvf->ssow;break ; -case BLKTYPE_TIM : +case BLKADDR_TIM : attach ? pfvf->timlfs++ : pfvf->timlfs--; num_lfs = pfvf->timlfs;break ; -case BLKTYPE_CPT : +case BLKADDR_CPT0 : attach ? pfvf->cptlfs++ : pfvf->cptlfs--; num_lfs = pfvf->cptlfs;break ; +case BLKADDR_CPT1 : + attach ? pfvf->cpt1_lfs++ : pfvf->cpt1_lfs--; + num_lfs = pfvf->cpt1_lfs; +break ; } reg = is_pf ? block->pf_lfcnt_reg : block->vf_lfcnt_reg;
@@ -1025,7 +1030,30 @@ int rvu_mbox_handler_ready(struct rvu *rvu, struct msg_req *req,/* Get current count of a RVU block's LF/slots * provisioned to a given RVU func. */ -static u16 rvu_get_rsrc_mapcount (struct rvu_pfvf *pfvf,int blktype) +u16 rvu_get_rsrc_mapcount (struct rvu_pfvf *pfvf,int blkaddr) +{ +switch (blkaddr) { +case BLKADDR_NPA : +return pfvf->npalf ?1 :0 ; +case BLKADDR_NIX0 : +case BLKADDR_NIX1 : +return pfvf->nixlf ?1 :0 ; +case BLKADDR_SSO : +return pfvf->sso; +case BLKADDR_SSOW : +return pfvf->ssow; +case BLKADDR_TIM : +return pfvf->timlfs; +case BLKADDR_CPT0 : +return pfvf->cptlfs; +case BLKADDR_CPT1 : +return pfvf->cpt1_lfs; + } +return 0 ; +} + +/* Return true if LFs of block type are attached to pcifunc */ +static bool is_blktype_attached (struct rvu_pfvf *pfvf,int blktype) {switch (blktype) {case BLKTYPE_NPA :
@@ -1033,15 +1061,16 @@ static u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blktype)case BLKTYPE_NIX :return pfvf->nixlf ?1 :0 ;case BLKTYPE_SSO : -return pfvf->sso; +return !!pfvf->sso;case BLKTYPE_SSOW : -return pfvf->ssow; +return !!pfvf->ssow;case BLKTYPE_TIM : -return pfvf->timlfs; +return !!pfvf->timlfs;case BLKTYPE_CPT : -return pfvf->cptlfs; +return pfvf->cptlfs || pfvf->cpt1_lfs; } -return 0 ; + +return false; }bool is_pffunc_map_valid (struct rvu *rvu,u16 pcifunc,int blktype)
@@ -1054,7 +1083,7 @@ bool is_pffunc_map_valid(struct rvu *rvu, u16 pcifunc, int blktype) pfvf =rvu_get_pfvf (rvu, pcifunc);/* Check if this PFFUNC has a LF of type blktype attached */ -if (!rvu_get_rsrc_mapcount (pfvf, blktype)) +if (!is_blktype_attached (pfvf, blktype))return false;return true;
@@ -1095,7 +1124,7 @@ static void rvu_detach_block(struct rvu *rvu, int pcifunc, int blktype) block = &hw->block[blkaddr]; - num_lfs =rvu_get_rsrc_mapcount (pfvf, block->type); + num_lfs =rvu_get_rsrc_mapcount (pfvf, block->addr);if (!num_lfs)return ;
@@ -1216,7 +1245,7 @@ static int rvu_check_rsrc_availability(struct rvu *rvu,int free_lfs, mappedlfs;/* Only one NPA LF can be attached */ -if (req->npalf && !rvu_get_rsrc_mapcount (pfvf,BLKTYPE_NPA )) { +if (req->npalf && !is_blktype_attached (pfvf,BLKTYPE_NPA )) { block = &hw->block[BLKADDR_NPA ]; free_lfs =rvu_rsrc_free_count (&block->lf);if (!free_lfs)
@@ -1229,7 +1258,7 @@ static int rvu_check_rsrc_availability(struct rvu *rvu, }/* Only one NIX LF can be attached */ -if (req->nixlf && !rvu_get_rsrc_mapcount (pfvf,BLKTYPE_NIX )) { +if (req->nixlf && !is_blktype_attached (pfvf,BLKTYPE_NIX )) { block = &hw->block[BLKADDR_NIX0 ]; free_lfs =rvu_rsrc_free_count (&block->lf);if (!free_lfs)
@@ -1250,7 +1279,7 @@ static int rvu_check_rsrc_availability(struct rvu *rvu, pcifunc, req->sso, block->lf.max);return -EINVAL ; } - mappedlfs =rvu_get_rsrc_mapcount (pfvf, block->type); + mappedlfs =rvu_get_rsrc_mapcount (pfvf, block->addr); free_lfs =rvu_rsrc_free_count (&block->lf);/* Check if additional resources are available */ if (req->sso > mappedlfs &&
@@ -1266,7 +1295,7 @@ static int rvu_check_rsrc_availability(struct rvu *rvu, pcifunc, req->sso, block->lf.max);return -EINVAL ; } - mappedlfs =rvu_get_rsrc_mapcount (pfvf, block->type); + mappedlfs =rvu_get_rsrc_mapcount (pfvf, block->addr); free_lfs =rvu_rsrc_free_count (&block->lf);if (req->ssow > mappedlfs && ((req->ssow - mappedlfs) > free_lfs))
@@ -1281,7 +1310,7 @@ static int rvu_check_rsrc_availability(struct rvu *rvu, pcifunc, req->timlfs, block->lf.max);return -EINVAL ; } - mappedlfs =rvu_get_rsrc_mapcount (pfvf, block->type); + mappedlfs =rvu_get_rsrc_mapcount (pfvf, block->addr); free_lfs =rvu_rsrc_free_count (&block->lf);if (req->timlfs > mappedlfs && ((req->timlfs - mappedlfs) > free_lfs))
@@ -1296,7 +1325,7 @@ static int rvu_check_rsrc_availability(struct rvu *rvu, pcifunc, req->cptlfs, block->lf.max);return -EINVAL ; } - mappedlfs =rvu_get_rsrc_mapcount (pfvf, block->type); + mappedlfs =rvu_get_rsrc_mapcount (pfvf, block->addr); free_lfs =rvu_rsrc_free_count (&block->lf);if (req->cptlfs > mappedlfs && ((req->cptlfs - mappedlfs) > free_lfs))
@@ -1932,7 +1961,7 @@ static void rvu_blklf_teardown(struct rvu *rvu, u16 pcifunc, u8 blkaddr) block = &rvu->hw->block[blkaddr]; num_lfs =rvu_get_rsrc_mapcount (rvu_get_pfvf (rvu, pcifunc), - block->type); + block->addr);if (!num_lfs)return ;for (slot =0 ; slot < num_lfs; slot++) {
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +2 -0
@@ -137,6 +137,7 @@ struct rvu_pfvf {u16 ssow;u16 cptlfs;u16 timlfs; +u16 cpt1_lfs;u8 cgx_lmac;/* Block LF's MSIX vector info */
@@ -420,6 +421,7 @@ void rvu_free_rsrc(struct rsrc_bmap *rsrc, int id);int rvu_rsrc_free_count (struct rsrc_bmap *rsrc);int rvu_alloc_rsrc_contig (struct rsrc_bmap *rsrc,int nrsrc);bool rvu_rsrc_check_contig (struct rsrc_bmap *rsrc,int nrsrc); +u16 rvu_get_rsrc_mapcount (struct rvu_pfvf *pfvf,int blkaddr);int rvu_get_pf (u16 pcifunc);struct rvu_pfvf *rvu_get_pfvf (struct rvu *rvu,int pcifunc);void rvu_get_pf_numvfs (struct rvu *rvu,int pf,int *numvfs,int *hwvf);
Signature · 1 line
2.7.4
PATCH v2 2/10 octeontx2-af: Manage new blocks in 98xx
In reply to [email protected]From: Rakesh Babu <[email protected]>
AF manages the tasks of allocating, freeing
LFs from RVU blocks to PF and VFs. With new
NIX1 and CPT1 blocks in 98xx, this patch
adds support for handling new blocks too.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 142 ++++++++++++++------- .../net/ethernet/marvell/octeontx2/af/rvu_reg.h | 8 +- .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 4 +- 3 files changed, 105 insertions(+), 49 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +98 -44
@@ -210,6 +210,9 @@ int rvu_get_lf(struct rvu *rvu, struct rvu_block *block, u16 pcifunc, u16 slot)* multiple blocks of same type. * * @pcifunc has to be zero when no LF is yet attached. +* +* For a pcifunc if LFs are attached from multiple blocks of same type, then +* return blkaddr of first encountered block. */ int rvu_get_blkaddr (struct rvu *rvu,int blktype,u16 pcifunc) {
@@ -258,20 +261,39 @@ int rvu_get_blkaddr(struct rvu *rvu, int blktype, u16 pcifunc) devnum =rvu_get_pf (pcifunc); } -/* Check if the 'pcifunc' has a NIX LF from 'BLKADDR_NIX0' */ +/* Check if the 'pcifunc' has a NIX LF from 'BLKADDR_NIX0' or +* 'BLKADDR_NIX1'. +*/ if (blktype ==BLKTYPE_NIX ) { - reg = is_pf ?RVU_PRIV_PFX_NIX0_CFG :RVU_PRIV_HWVFX_NIX0_CFG ; + reg = is_pf ?RVU_PRIV_PFX_NIXX_CFG (0 ) : +RVU_PRIV_HWVFX_NIXX_CFG (0 ); cfg =rvu_read64 (rvu,BLKADDR_RVUM , reg | (devnum <<16 )); -if (cfg) +if (cfg) { blkaddr =BLKADDR_NIX0 ; + goto exit; + } + + reg = is_pf ?RVU_PRIV_PFX_NIXX_CFG (1 ) : +RVU_PRIV_HWVFX_NIXX_CFG (1 ); + cfg =rvu_read64 (rvu,BLKADDR_RVUM , reg | (devnum <<16 )); +if (cfg) + blkaddr =BLKADDR_NIX1 ; } -/* Check if the 'pcifunc' has a CPT LF from 'BLKADDR_CPT0' */ if (blktype ==BLKTYPE_CPT ) { - reg = is_pf ?RVU_PRIV_PFX_CPT0_CFG :RVU_PRIV_HWVFX_CPT0_CFG ; + reg = is_pf ?RVU_PRIV_PFX_CPTX_CFG (0 ) : +RVU_PRIV_HWVFX_CPTX_CFG (0 ); cfg =rvu_read64 (rvu,BLKADDR_RVUM , reg | (devnum <<16 )); -if (cfg) +if (cfg) { blkaddr =BLKADDR_CPT0 ; + goto exit; + } + + reg = is_pf ?RVU_PRIV_PFX_CPTX_CFG (1 ) : +RVU_PRIV_HWVFX_CPTX_CFG (1 ); + cfg =rvu_read64 (rvu,BLKADDR_RVUM , reg | (devnum <<16 )); +if (cfg) + blkaddr =BLKADDR_CPT1 ; } exit:
@@ -471,12 +493,16 @@ static void rvu_reset_all_blocks(struct rvu *rvu)/* Do a HW reset of all RVU blocks */ rvu_block_reset (rvu,BLKADDR_NPA ,NPA_AF_BLK_RST );rvu_block_reset (rvu,BLKADDR_NIX0 ,NIX_AF_BLK_RST ); +rvu_block_reset (rvu,BLKADDR_NIX1 ,NIX_AF_BLK_RST );rvu_block_reset (rvu,BLKADDR_NPC ,NPC_AF_BLK_RST );rvu_block_reset (rvu,BLKADDR_SSO ,SSO_AF_BLK_RST );rvu_block_reset (rvu,BLKADDR_TIM ,TIM_AF_BLK_RST );rvu_block_reset (rvu,BLKADDR_CPT0 ,CPT_AF_BLK_RST ); +rvu_block_reset (rvu,BLKADDR_CPT1 ,CPT_AF_BLK_RST );rvu_block_reset (rvu,BLKADDR_NDC_NIX0_RX ,NDC_AF_BLK_RST );rvu_block_reset (rvu,BLKADDR_NDC_NIX0_TX ,NDC_AF_BLK_RST ); +rvu_block_reset (rvu,BLKADDR_NDC_NIX1_RX ,NDC_AF_BLK_RST ); +rvu_block_reset (rvu,BLKADDR_NDC_NIX1_TX ,NDC_AF_BLK_RST );rvu_block_reset (rvu,BLKADDR_NDC_NPA0 ,NDC_AF_BLK_RST ); }
@@ -762,6 +788,61 @@ static void rvu_fwdata_exit(struct rvu *rvu)iounmap (rvu->fwdata); } +static int rvu_setup_nix_hw_resource (struct rvu *rvu,int blkaddr) +{ +struct rvu_hwinfo *hw = rvu->hw; +struct rvu_block *block; +int blkid; +u64 cfg; + +/* Init NIX LF's bitmap */ + block = &hw->block[blkaddr]; +if (!block->implemented) +return 0 ; + blkid = (blkaddr ==BLKADDR_NIX0 ) ?0 :1 ; + cfg =rvu_read64 (rvu, blkaddr,NIX_AF_CONST2 ); + block->lf.max = cfg &0xFFF ; + block->addr = blkaddr; + block->type =BLKTYPE_NIX ; + block->lfshift =8 ; + block->lookup_reg =NIX_AF_RVU_LF_CFG_DEBUG ; + block->pf_lfcnt_reg =RVU_PRIV_PFX_NIXX_CFG (blkid); + block->vf_lfcnt_reg =RVU_PRIV_HWVFX_NIXX_CFG (blkid); + block->lfcfg_reg =NIX_PRIV_LFX_CFG ; + block->msixcfg_reg =NIX_PRIV_LFX_INT_CFG ; + block->lfreset_reg =NIX_AF_LF_RST ; +sprintf (block->name,"NIX%d" , blkid); +return rvu_alloc_bitmap (&block->lf); +} + +static int rvu_setup_cpt_hw_resource (struct rvu *rvu,int blkaddr) +{ +struct rvu_hwinfo *hw = rvu->hw; +struct rvu_block *block; +int blkid; +u64 cfg; + +/* Init CPT LF's bitmap */ + block = &hw->block[blkaddr]; +if (!block->implemented) +return 0 ; + blkid = (blkaddr ==BLKADDR_CPT0 ) ?0 :1 ; + cfg =rvu_read64 (rvu, blkaddr,CPT_AF_CONSTANTS0 ); + block->lf.max = cfg &0xFF ; + block->addr = blkaddr; + block->type =BLKTYPE_CPT ; + block->multislot = true; + block->lfshift =3 ; + block->lookup_reg =CPT_AF_RVU_LF_CFG_DEBUG ; + block->pf_lfcnt_reg =RVU_PRIV_PFX_CPTX_CFG (blkid); + block->vf_lfcnt_reg =RVU_PRIV_HWVFX_CPTX_CFG (blkid); + block->lfcfg_reg =CPT_PRIV_LFX_CFG ; + block->msixcfg_reg =CPT_PRIV_LFX_INT_CFG ; + block->lfreset_reg =CPT_AF_LF_RST ; +sprintf (block->name,"CPT%d" , blkid); +return rvu_alloc_bitmap (&block->lf); +} +static int rvu_setup_hw_resources (struct rvu *rvu) {struct rvu_hwinfo *hw = rvu->hw;
@@ -796,27 +877,13 @@ static int rvu_setup_hw_resources(struct rvu *rvu)return err; nix: -/* Init NIX LF's bitmap */ - block = &hw->block[BLKADDR_NIX0 ]; -if (!block->implemented) - goto sso; - cfg =rvu_read64 (rvu,BLKADDR_NIX0 ,NIX_AF_CONST2 ); - block->lf.max = cfg &0xFFF ; - block->addr =BLKADDR_NIX0 ; - block->type =BLKTYPE_NIX ; - block->lfshift =8 ; - block->lookup_reg =NIX_AF_RVU_LF_CFG_DEBUG ; - block->pf_lfcnt_reg =RVU_PRIV_PFX_NIX0_CFG ; - block->vf_lfcnt_reg =RVU_PRIV_HWVFX_NIX0_CFG ; - block->lfcfg_reg =NIX_PRIV_LFX_CFG ; - block->msixcfg_reg =NIX_PRIV_LFX_INT_CFG ; - block->lfreset_reg =NIX_AF_LF_RST ; -sprintf (block->name,"NIX" ); - err =rvu_alloc_bitmap (&block->lf); + err =rvu_setup_nix_hw_resource (rvu,BLKADDR_NIX0 ); +if (err) +return err; + err =rvu_setup_nix_hw_resource (rvu,BLKADDR_NIX1 );if (err)return err; -sso:/* Init SSO group's bitmap */ block = &hw->block[BLKADDR_SSO ];if (!block->implemented)
@@ -882,28 +949,13 @@ static int rvu_setup_hw_resources(struct rvu *rvu)return err; cpt: -/* Init CPT LF's bitmap */ - block = &hw->block[BLKADDR_CPT0 ]; -if (!block->implemented) - goto init; - cfg =rvu_read64 (rvu,BLKADDR_CPT0 ,CPT_AF_CONSTANTS0 ); - block->lf.max = cfg &0xFF ; - block->addr =BLKADDR_CPT0 ; - block->type =BLKTYPE_CPT ; - block->multislot = true; - block->lfshift =3 ; - block->lookup_reg =CPT_AF_RVU_LF_CFG_DEBUG ; - block->pf_lfcnt_reg =RVU_PRIV_PFX_CPT0_CFG ; - block->vf_lfcnt_reg =RVU_PRIV_HWVFX_CPT0_CFG ; - block->lfcfg_reg =CPT_PRIV_LFX_CFG ; - block->msixcfg_reg =CPT_PRIV_LFX_INT_CFG ; - block->lfreset_reg =CPT_AF_LF_RST ; -sprintf (block->name,"CPT" ); - err =rvu_alloc_bitmap (&block->lf); + err =rvu_setup_cpt_hw_resource (rvu,BLKADDR_CPT0 ); +if (err) +return err; + err =rvu_setup_cpt_hw_resource (rvu,BLKADDR_CPT1 );if (err)return err; -init:/* Allocate memory for PFVF data */ rvu->pf =devm_kcalloc (rvu->dev, hw->total_pfs,sizeof (struct rvu_pfvf ),GFP_KERNEL );
@@ -1970,7 +2022,7 @@ static void rvu_blklf_teardown(struct rvu *rvu, u16 pcifunc, u8 blkaddr)continue ;/* Cleanup LF and reset it */ -if (block->addr ==BLKADDR_NIX0 ) +if (block->addr ==BLKADDR_NIX0 || block->addr ==BLKADDR_NIX1 )rvu_nix_lf_teardown (rvu, pcifunc, block->addr, lf);else if (block->addr ==BLKADDR_NPA )rvu_npa_lf_teardown (rvu, pcifunc, lf);
@@ -1992,7 +2044,9 @@ static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)* 3. Cleanup pools (NPA) */ rvu_blklf_teardown (rvu, pcifunc,BLKADDR_NIX0 ); +rvu_blklf_teardown (rvu, pcifunc,BLKADDR_NIX1 );rvu_blklf_teardown (rvu, pcifunc,BLKADDR_CPT0 ); +rvu_blklf_teardown (rvu, pcifunc,BLKADDR_CPT1 );rvu_blklf_teardown (rvu, pcifunc,BLKADDR_TIM );rvu_blklf_teardown (rvu, pcifunc,BLKADDR_SSOW );rvu_blklf_teardown (rvu, pcifunc,BLKADDR_SSO );
drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h +4 -4
@@ -54,20 +54,20 @@#define RVU_PRIV_PFX_MSIX_CFG (a) (0x8000110 | (a) << 16)#define RVU_PRIV_PFX_ID_CFG (a) (0x8000120 | (a) << 16)#define RVU_PRIV_PFX_INT_CFG (a) (0x8000200 | (a) << 16) -#define RVU_PRIV_PFX_NIX0_CFG (0x8000300) +#define RVU_PRIV_PFX_NIXX_CFG (a) (0x8000300 | (a) << 3)#define RVU_PRIV_PFX_NPA_CFG (0x8000310)#define RVU_PRIV_PFX_SSO_CFG (0x8000320)#define RVU_PRIV_PFX_SSOW_CFG (0x8000330)#define RVU_PRIV_PFX_TIM_CFG (0x8000340) -#define RVU_PRIV_PFX_CPT0_CFG (0x8000350) +#define RVU_PRIV_PFX_CPTX_CFG (a) (0x8000350 | (a) << 3)#define RVU_PRIV_BLOCK_TYPEX_REV (a) (0x8000400 | (a) << 3)#define RVU_PRIV_HWVFX_INT_CFG (a) (0x8001280 | (a) << 16) -#define RVU_PRIV_HWVFX_NIX0_CFG (0x8001300) +#define RVU_PRIV_HWVFX_NIXX_CFG (a) (0x8001300 | (a) << 3)#define RVU_PRIV_HWVFX_NPA_CFG (0x8001310)#define RVU_PRIV_HWVFX_SSO_CFG (0x8001320)#define RVU_PRIV_HWVFX_SSOW_CFG (0x8001330)#define RVU_PRIV_HWVFX_TIM_CFG (0x8001340) -#define RVU_PRIV_HWVFX_CPT0_CFG (0x8001350) +#define RVU_PRIV_HWVFX_CPTX_CFG (a) (0x8001350 | (a) << 3)/* RVU PF registers */ #define RVU_PF_VFX_PFVF_MBOX0 (0x00000)
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h +3 -1
@@ -31,7 +31,9 @@ enum rvu_block_addr_e {BLKADDR_NDC_NIX0_RX =0xcULL ,BLKADDR_NDC_NIX0_TX =0xdULL ,BLKADDR_NDC_NPA0 =0xeULL , - BLK_COUNT = 0xfULL, +BLKADDR_NDC_NIX1_RX =0x10ULL , +BLKADDR_NDC_NIX1_TX =0x11ULL , + BLK_COUNT = 0x12ULL, };/* RVU Block Type Enumeration */
Signature · 1 line
2.7.4
PATCH v2 3/10 octeontx2-af: Initialize NIX1 block
In reply to [email protected]From: Rakesh Babu <[email protected]>
This patch modifies NIX functions to operate with nix_hw context so that existing functions can be used for both NIX0 and NIX1 blocks. And the NIX blocks present in the system are initialized during driver init and freed during exit.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 2 + drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 9 +- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 128 +++++++++++++++------ 3 files changed, 104 insertions(+), 35 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +2 -0
@@ -66,6 +66,7 @@ static void rvu_setup_hw_capabilities(struct rvu *rvu) hw->cap.nix_shaping = true; hw->cap.nix_tx_link_bp = true; hw->cap.nix_rx_multicast = true; + hw->rvu = rvu;if (is_rvu_96xx_B0 (rvu)) { hw->cap.nix_fixed_txschq_mapping = true;
@@ -812,6 +813,7 @@ static int rvu_setup_nix_hw_resource(struct rvu *rvu, int blkaddr) block->msixcfg_reg =NIX_PRIV_LFX_INT_CFG ; block->lfreset_reg =NIX_AF_LF_RST ;sprintf (block->name,"NIX%d" , blkid); + rvu->nix_blkaddr[blkid] = blkaddr;return rvu_alloc_bitmap (&block->lf); }
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +8 -1
@@ -28,6 +28,7 @@#define PCI_MBOX_BAR_NUM 4#define NAME_SIZE 32 +#define MAX_NIX_BLKS 2/* PF_FUNC */ #define RVU_PFVF_PF_SHIFT 10
@@ -220,6 +221,8 @@ struct nix_lso { };struct nix_hw { +int blkaddr; +struct rvu *rvu;struct nix_txsch txsch[NIX_TXSCH_LVL_CNT ];/* Tx schedulers */ struct nix_mcast mcast;struct nix_flowkey flowkey;
@@ -255,7 +258,8 @@ struct rvu_hwinfo {struct hw_cap cap;struct rvu_block block[BLK_COUNT ];/* Block info */ -struct nix_hw *nix0; +struct nix_hw *nix; +struct rvu *rvu;struct npc_pkind pkind;struct npc_mcam mcam; };
@@ -316,6 +320,7 @@ struct rvu {struct rvu_pfvf *hwvf;struct mutex rsrc_lock;/* Serialize resource alloc/free */ int vfs;/* Number of VFs attached to RVU */ +int nix_blkaddr[MAX_NIX_BLKS ];/* Mbox */ struct mbox_wq_info afpf_wq_info;
@@ -487,6 +492,8 @@ int rvu_get_nixlf_count(struct rvu *rvu);void rvu_nix_lf_teardown (struct rvu *rvu,u16 pcifunc,int blkaddr,int npalf);int nix_get_nixlf (struct rvu *rvu,u16 pcifunc,int *nixlf,int *nix_blkaddr);int nix_update_bcast_mce_list (struct rvu *rvu,u16 pcifunc,bool add); +struct nix_hw *get_nix_hw (struct rvu_hwinfo *hw,int blkaddr); +int rvu_get_next_nix_blkaddr (struct rvu *rvu,int blkaddr);/* NPC APIs */ int rvu_npc_init (struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +94 -34
217 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 4/10 octeontx2-af: Map NIX block from CGX connection
In reply to [email protected]From: Subbaraya Sundeep <[email protected]>
Firmware configures NIX block mapping for all CGXs to achieve maximum throughput. This patch reads the configuration and create mapping between RVU PF and NIX blocks. And for LBK VFs assign NIX0 for even numbered VFs and NIX1 for odd numbered VFs.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 13 ++++- drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 5 ++ drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 61 ++++++++++++++++++++-- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 2 + .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 15 ++++++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 21 ++++++-- 6 files changed, 107 insertions(+), 10 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +11 -2
@@ -145,6 +145,16 @@ int cgx_get_cgxid(void *cgxd)return cgx->cgx_id; } +u8 cgx_lmac_get_p2x (int cgx_id,int lmac_id) +{ +struct cgx *cgx_dev =cgx_get_pdata (cgx_id); +u64 cfg; + + cfg =cgx_read (cgx_dev, lmac_id,CGXX_CMRX_CFG ); + +return (cfg &CMR_P2X_SEL_MASK ) >>CMR_P2X_SEL_SHIFT ; +} +/* Ensure the required lock for event queue(where asynchronous events are * posted) is acquired before calling this API. Else an asynchronous event(with * latest link status) can reach the destination before this function returns
@@ -814,8 +824,7 @@ static int cgx_lmac_verify_fwi_version(struct cgx *cgx) minor_ver =FIELD_GET (RESP_MINOR_VER , resp);dev_dbg (dev,"Firmware command interface version = %d.%d\n" , major_ver, minor_ver); -if (major_ver !=CGX_FIRMWARE_MAJOR_VER || - minor_ver !=CGX_FIRMWARE_MINOR_VER ) +if (major_ver !=CGX_FIRMWARE_MAJOR_VER )return -EIO ;else return 0 ;
drivers/net/ethernet/marvell/octeontx2/af/cgx.h +5 -0
@@ -27,6 +27,10 @@/* Registers */ #define CGXX_CMRX_CFG 0x00 +#define CMR_P2X_SEL_MASK GENMASK_ULL(61, 59) +#define CMR_P2X_SEL_SHIFT 59ULL +#define CMR_P2X_SEL_NIX0 1ULL +#define CMR_P2X_SEL_NIX1 2ULL#define CMR_EN BIT_ULL(55)#define DATA_PKT_TX_EN BIT_ULL(53)#define DATA_PKT_RX_EN BIT_ULL(54)
@@ -142,5 +146,6 @@ int cgx_lmac_get_pause_frm(void *cgxd, int lmac_id,int cgx_lmac_set_pause_frm (void *cgxd,int lmac_id,u8 tx_pause,u8 rx_pause);void cgx_lmac_ptp_config (void *cgxd,int lmac_id,bool enable); +u8 cgx_lmac_get_p2x (int cgx_id,int lmac_id);#endif /* CGX_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +58 -3
87 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +2 -0
@@ -184,6 +184,8 @@ struct rvu_pfvf {bool cgx_in_use;/* this PF/VF using CGX? */ int cgx_users;/* number of cgx users - used only by PFs */ + +u8 nix_blkaddr;/* BLKADDR_NIX0/1 assigned to this PF */ };struct nix_txsch {
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +15 -0
@@ -74,6 +74,20 @@ void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu)return rvu->cgx_idmap[cgx_id]; } +/* Based on P2X connectivity find mapped NIX block for a PF */ +static void rvu_map_cgx_nix_block (struct rvu *rvu,int pf, +int cgx_id,int lmac_id) +{ +struct rvu_pfvf *pfvf = &rvu->pf[pf]; +u8 p2x; + + 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 ) + pfvf->nix_blkaddr =BLKADDR_NIX1 ; +} +static int rvu_map_cgx_lmac_pf (struct rvu *rvu) {struct npc_pkind *pkind = &rvu->hw->pkind;
@@ -117,6 +131,7 @@ static int rvu_map_cgx_lmac_pf(struct rvu *rvu) rvu->cgxlmac2pf_map[CGX_OFFSET (cgx) + lmac] =1 << pf; free_pkind =rvu_alloc_rsrc (&pkind->rsrc); pkind->pfchan_map[free_pkind] = ((pf) &0x3F ) <<16 ; +rvu_map_cgx_nix_block (rvu, pf, cgx, lmac); rvu->cgx_mapped_pfs++; } }
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +16 -5
@@ -213,8 +213,8 @@ static bool is_valid_txschq(struct rvu *rvu, int blkaddr,static int nix_interface_init (struct rvu *rvu,u16 pcifunc,int type,int nixlf) {struct rvu_pfvf *pfvf =rvu_get_pfvf (rvu, pcifunc); +int pkind, pf, vf, lbkid;u8 cgx_id, lmac_id; -int pkind, pf, vf;int err; pf =rvu_get_pf (pcifunc);
@@ -247,13 +247,24 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)case NIX_INTF_TYPE_LBK : vf = (pcifunc &RVU_PFVF_FUNC_MASK ) -1 ; +/* If NIX1 block is present on the silicon then NIXes are +* assigned alternatively for lbk interfaces. NIX0 should +* send packets on lbk link 1 channels and NIX1 should send +* on lbk link 0 channels for the communication between +* NIX0 and NIX1. +*/ + lbkid =0 ; +if (rvu->hw->lbk_links >1 ) + lbkid = vf &0x1 ?0 :1 ; +/* Note that AF's VFs work in pairs and talk over consecutive * loopback channels.Therefore if odd number of AF VFs are * enabled then the last VF remains with no pair. */ - pfvf->rx_chan_base =NIX_CHAN_LBK_CHX (0 , vf); - pfvf->tx_chan_base = vf &0x1 ?NIX_CHAN_LBK_CHX (0 , vf -1 ) : -NIX_CHAN_LBK_CHX (0 , vf +1 ); + pfvf->rx_chan_base =NIX_CHAN_LBK_CHX (lbkid, vf); + pfvf->tx_chan_base = vf &0x1 ? +NIX_CHAN_LBK_CHX (lbkid, vf -1 ) : +NIX_CHAN_LBK_CHX (lbkid, vf +1 ); pfvf->rx_chan_cnt =1 ; pfvf->tx_chan_cnt =1 ; rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf,
@@ -3183,7 +3194,7 @@ static int rvu_nix_block_init(struct rvu *rvu, struct nix_hw *nix_hw) hw->cgx = (cfg >>12 ) &0xF ; hw->lmac_per_cgx = (cfg >>8 ) &0xF ; hw->cgx_links = hw->cgx * hw->lmac_per_cgx; - hw->lbk_links =1 ; + hw->lbk_links = (cfg >>24 ) &0xF ; hw->sdp_links =1 ;/* Initialize admin queue */
Signature · 1 line
2.7.4
PATCH v2 5/10 octeontx2-af: Setup MCE context for assigned NIX
In reply to [email protected]From: Subbaraya Sundeep <[email protected]>
Initialize MCE context for the assigned NIX0/1 block for a CGX mapped PF. Modified rvu_nix_aq_enq_inst function to work with nix_hw so that MCE contexts for both NIX blocks can be inited.
--- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 56 ++++++++++++++-------- 1 file changed, 36 insertions(+), 20 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +36 -20
@@ -649,8 +649,9 @@ static int nix_aq_enqueue_wait(struct rvu *rvu, struct rvu_block *block,return 0 ; } -static int rvu_nix_aq_enq_inst (struct rvu *rvu,struct nix_aq_enq_req *req, -struct nix_aq_enq_rsp *rsp) +static int rvu_nix_blk_aq_enq_inst (struct rvu *rvu,struct nix_hw *nix_hw, +struct nix_aq_enq_req *req, +struct nix_aq_enq_rsp *rsp) {struct rvu_hwinfo *hw = rvu->hw;u16 pcifunc = req->hdr.pcifunc;
@@ -659,15 +660,11 @@ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,struct rvu_block *block;struct admin_queue *aq;struct rvu_pfvf *pfvf; -struct nix_hw *nix_hw;void *ctx, *mask;bool ena;u64 cfg; - blkaddr =rvu_get_blkaddr (rvu,BLKTYPE_NIX , pcifunc); -if (blkaddr <0 ) -return NIX_AF_ERR_AF_LF_INVALID ; - + blkaddr = nix_hw->blkaddr; block = &hw->block[blkaddr]; aq = block->aq;if (!aq) {
@@ -675,10 +672,6 @@ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,return NIX_AF_ERR_AQ_ENQUEUE ; } - nix_hw =get_nix_hw (rvu->hw, blkaddr); -if (!nix_hw) -return -EINVAL ; - pfvf =rvu_get_pfvf (rvu, pcifunc); nixlf =rvu_get_lf (rvu, block, pcifunc,0 );
@@ -875,6 +868,23 @@ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,return 0 ; } +static int rvu_nix_aq_enq_inst (struct rvu *rvu,struct nix_aq_enq_req *req, +struct nix_aq_enq_rsp *rsp) +{ +struct nix_hw *nix_hw; +int blkaddr; + + blkaddr =rvu_get_blkaddr (rvu,BLKTYPE_NIX , req->hdr.pcifunc); +if (blkaddr <0 ) +return NIX_AF_ERR_AF_LF_INVALID ; + + nix_hw =get_nix_hw (rvu->hw, blkaddr); +if (!nix_hw) +return -EINVAL ; + +return rvu_nix_blk_aq_enq_inst (rvu, nix_hw, req, rsp); +} +static const char *nix_get_ctx_name (int ctype) {switch (ctype) {
@@ -1993,8 +2003,8 @@ int rvu_mbox_handler_nix_vtag_cfg(struct rvu *rvu,return 0 ; } -static int nix_setup_mce (struct rvu *rvu,int mce,u8 op, -u16 pcifunc,int next,bool eol) +static int nix_blk_setup_mce (struct rvu *rvu,struct nix_hw *nix_hw, +int mce,u8 op,u16 pcifunc,int next,bool eol) {struct nix_aq_enq_req aq_req;int err;
@@ -2014,7 +2024,7 @@ static int nix_setup_mce(struct rvu *rvu, int mce, u8 op,/* All fields valid */ *(u64 *)(&aq_req.mce_mask) = ~0ULL ; - err =rvu_nix_aq_enq_inst (rvu, &aq_req,NULL ); + err =rvu_nix_blk_aq_enq_inst (rvu, nix_hw, &aq_req,NULL );if (err) {dev_err (rvu->dev,"Failed to setup Bcast MCE for PF%d:VF%d\n" ,rvu_get_pf (pcifunc), pcifunc &RVU_PFVF_FUNC_MASK );
@@ -2120,9 +2130,9 @@ int nix_update_bcast_mce_list(struct rvu *rvu, u16 pcifunc, bool add) next_idx = idx +1 ;/* EOL should be set in last MCE */ - err =nix_setup_mce (rvu, idx,NIX_AQ_INSTOP_WRITE , - mce->pcifunc, next_idx, - (next_idx > last_idx) ? true : false); + err =nix_blk_setup_mce (rvu, nix_hw, idx,NIX_AQ_INSTOP_WRITE , + mce->pcifunc, next_idx, + (next_idx > last_idx) ? true : false);if (err) goto end; idx++;
@@ -2151,6 +2161,11 @@ static int nix_setup_bcast_tables(struct rvu *rvu, struct nix_hw *nix_hw) numvfs = (cfg >>12 ) &0xFF ; pfvf = &rvu->pf[pf]; + +/* This NIX0/1 block mapped to PF ? */ +if (pfvf->nix_blkaddr != nix_hw->blkaddr) +continue ; +/* Save the start MCE */ pfvf->bcast_mce_idx =nix_alloc_mce_list (mcast, numvfs +1 );
@@ -2165,9 +2180,10 @@ static int nix_setup_bcast_tables(struct rvu *rvu, struct nix_hw *nix_hw)* Will be updated when a NIXLF is attached/detached to * these PF/VFs. */ - err =nix_setup_mce (rvu, pfvf->bcast_mce_idx + idx, -NIX_AQ_INSTOP_INIT , - pcifunc,0 , true); + err =nix_blk_setup_mce (rvu, nix_hw, + pfvf->bcast_mce_idx + idx, +NIX_AQ_INSTOP_INIT , + pcifunc,0 , true);if (err)return err; }
Signature · 1 line
2.7.4
PATCH v2 6/10 octeontx2-af: Add NIX1 interfaces to NPC
In reply to [email protected]From: Subbaraya Sundeep <[email protected]>
On 98xx silicon, NPC block has additional
mcam entries, counters and NIX1 interfaces. Extended set of registers are present for the new mcam entries and counters.
This patch does the following:
- updates the register accessing macros
to use extended set if present.
- configures the MKEX profile for NIX1 interfaces also.
- updates mcam entry write functions to use assigned NIX0/1 interfaces for the PF/VF.
--- drivers/net/ethernet/marvell/octeontx2/af/common.h | 8 +- .../ethernet/marvell/octeontx2/af/npc_profile.h | 2 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 4 + drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 13 +- .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 10 +- .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 328 +++++++++++++++------ .../net/ethernet/marvell/octeontx2/af/rvu_reg.h | 79 ++++- 7 files changed, 337 insertions(+), 107 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/common.h +6 -2
@@ -174,8 +174,12 @@ enum nix_scheduler {#define NPC_MCAM_KEY_X2 1#define NPC_MCAM_KEY_X4 2 -#define NIX_INTF_RX 0 -#define NIX_INTF_TX 1 +#define NIX_INTFX_RX (a) (0x0ull | (a) << 1) +#define NIX_INTFX_TX (a) (0x1ull | (a) << 1) + +/* Default interfaces are NIX0_RX and NIX0_TX */ +#define NIX_INTF_RX NIX_INTFX_RX(0) +#define NIX_INTF_TX NIX_INTFX_TX(0)#define NIX_INTF_TYPE_CGX 0#define NIX_INTF_TYPE_LBK 1
drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h +1 -1
@@ -13380,7 +13380,7 @@ static const struct npc_lt_def_cfg npc_lt_defaults = { }, }; -static const struct npc_mcam_kex npc_mkex_default = { +static struct npc_mcam_kex npc_mkex_default = { .mkex_sign =MKEX_SIGN , .name ="default" , .kpu_version =NPC_KPU_PROFILE_VER ,
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +4 -0
@@ -1276,10 +1276,14 @@ static int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc)switch (blkaddr) {case BLKADDR_NIX1 : pfvf->nix_blkaddr =BLKADDR_NIX1 ; + pfvf->nix_rx_intf =NIX_INTFX_RX (1 ); + pfvf->nix_tx_intf =NIX_INTFX_TX (1 );break ;case BLKADDR_NIX0 :default : pfvf->nix_blkaddr =BLKADDR_NIX0 ; + pfvf->nix_rx_intf =NIX_INTFX_RX (0 ); + pfvf->nix_tx_intf =NIX_INTFX_TX (0 );break ; }
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +12 -1
@@ -186,6 +186,8 @@ struct rvu_pfvf {int cgx_users;/* number of cgx users - used only by PFs */ u8 nix_blkaddr;/* BLKADDR_NIX0/1 assigned to this PF */ +u8 nix_rx_intf;/* NIX0_RX/NIX1_RX interface to NPC */ +u8 nix_tx_intf;/* NIX0_TX/NIX1_TX interface to NPC */ };struct nix_txsch {
@@ -257,6 +259,11 @@ struct rvu_hwinfo {u8 lbk_links;u8 sdp_links;u8 npc_kpus;/* No of parser units */ +u8 npc_pkinds;/* No of port kinds */ +u8 npc_intfs;/* No of interfaces */ +u8 npc_kpu_entries;/* No of KPU entries */ +u16 npc_counters;/* No of match stats counters */ +bool npc_ext_set;/* Extended register set */ struct hw_cap cap;struct rvu_block block[BLK_COUNT ];/* Block info */
@@ -307,7 +314,7 @@ struct npc_kpu_profile_adapter {const struct npc_lt_def_cfg *lt_def;const struct npc_kpu_profile_action *ikpu;/* array[pkinds] */ const struct npc_kpu_profile *kpu;/* array[kpus] */ -const struct npc_mcam_kex *mkex; +struct npc_mcam_kex *mkex;size_t pkinds;size_t kpus; };
@@ -524,6 +531,10 @@ void rvu_npc_get_mcam_entry_alloc_info(struct rvu *rvu, u16 pcifunc,void rvu_npc_get_mcam_counter_alloc_info (struct rvu *rvu,u16 pcifunc,int blkaddr,int *alloc_cnt,int *enable_cnt); +bool is_npc_intf_tx (u8 intf); +bool is_npc_intf_rx (u8 intf); +bool is_npc_interface_valid (struct rvu *rvu,u8 intf); +int rvu_npc_get_tx_nibble_cfg (struct rvu *rvu,u64 nibble_ena);#ifdef CONFIG_DEBUG_FS void rvu_dbg_init (struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +5 -5
@@ -1565,7 +1565,7 @@ static int rvu_dbg_npc_mcam_info_display(struct seq_file *filp, void *unsued)struct rvu *rvu = filp->private;int pf, vf, numvfs, blkaddr;struct npc_mcam *mcam; -u16 pcifunc; +u16 pcifunc, counters;u64 cfg; blkaddr =rvu_get_blkaddr (rvu,BLKTYPE_NPC ,0 );
@@ -1573,6 +1573,7 @@ static int rvu_dbg_npc_mcam_info_display(struct seq_file *filp, void *unsued)return -ENODEV ; mcam = &rvu->hw->mcam; + counters = rvu->hw->npc_counters;seq_puts (filp,"\nNPC MCAM info:\n" );/* MCAM keywidth on receive and transmit sides */
@@ -1595,10 +1596,9 @@ static int rvu_dbg_npc_mcam_info_display(struct seq_file *filp, void *unsued)seq_printf (filp,"\t\t Available \t: %d\n" , mcam->bmap_fcnt);/* MCAM counters */ - cfg =rvu_read64 (rvu, blkaddr,NPC_AF_CONST ); - cfg = (cfg >>48 ) &0xFFFF ; -seq_printf (filp,"\n\t\t MCAM counters \t: %lld\n" , cfg); -seq_printf (filp,"\t\t Reserved \t: %lld\n" , cfg - mcam->counters.max); +seq_printf (filp,"\n\t\t MCAM counters \t: %d\n" , counters); +seq_printf (filp,"\t\t Reserved \t: %d\n" , + counters - mcam->counters.max);seq_printf (filp,"\t\t Available \t: %d\n" ,rvu_rsrc_free_count (&mcam->counters));
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +243 -85
519 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h +66 -13
98 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 7/10 octeontx2-af: Mbox changes for 98xx
In reply to [email protected]From: Subbaraya Sundeep <[email protected]>
This patch puts together all mailbox changes for 98xx silicon:
Attach ->
Modify resource attach mailbox handler to request LFs from a block address out of multiple blocks of same type. If a PF/VF need LFs from two blocks of same type then attach mbox should be called twice.
Example:
struct rsrc_attach *attach;
.. Allocate memory for message ..
attach->cptlfs = 3; /* 3 LFs from CPT0 */
.. Send message ..
.. Allocate memory for message ..
attach->modify = 1;
attach->cpt_blkaddr = BLKADDR_CPT1;
attach->cptlfs = 2; /* 2 LFs from CPT1 */
.. Send message ..Detach ->
Update detach mailbox and its handler to detach resources from CPT1 and NIX1 blocks.
MSIX ->
Updated the MSIX mailbox and its handler to return MSIX offsets for the new block CPT1.
Free resources ->
Update free_rsrc mailbox and its handler to return the free resources count of new blocks NIX1 and CPT1
Links ->
Number of CGX,LBK and SDP links may vary between platforms. For example, in 98xx number of CGX and LBK links are more than 96xx. Hence the info about number of links present in hardware is useful for consumers to request link configuration properly. This patch sends this info in nix_lf_alloc_rsp.
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 19 ++++- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 85 ++++++++++++++++++---- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 4 + .../net/ethernet/marvell/octeontx2/af/rvu_reg.c | 2 +- .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 2 + 5 files changed, 94 insertions(+), 18 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +18 -1
@@ -86,7 +86,7 @@ struct mbox_msghdr {#define OTX2_MBOX_REQ_SIG (0xdead)#define OTX2_MBOX_RSP_SIG (0xbeef)u16 sig;/* Signature, for validating corrupted msgs */ -#define OTX2_MBOX_VERSION (0x0001) +#define OTX2_MBOX_VERSION (0x0007)u16 ver;/* Version of msg's structure for this ID */ u16 next_msgoff;/* Offset of next msg within mailbox region */ int rc;/* Msg process'ed response code */
@@ -271,6 +271,17 @@ struct ready_msg_rsp {* or to detach partial of a cetain resource type. * Rest of the fields specify how many of what type to * be attached. +* To request LFs from two blocks of same type this mailbox +* can be sent twice as below: +* struct rsrc_attach *attach; +* .. Allocate memory for message .. +* attach->cptlfs = 3; <3 LFs from CPT0> +* .. Send message .. +* .. Allocate memory for message .. +* attach->modify = 1; +* attach->cpt_blkaddr = BLKADDR_CPT1; +* attach->cptlfs = 2; <2 LFs from CPT1> +* .. Send message .. */ struct rsrc_attach {struct mbox_msghdr hdr;
@@ -281,6 +292,7 @@ struct rsrc_attach {u16 ssow;u16 timlfs;u16 cptlfs; +int cpt_blkaddr;/* BLKADDR_CPT0/BLKADDR_CPT1 or 0 for BLKADDR_CPT0 */ };/* Structure for relinquishing resources.
@@ -314,6 +326,8 @@ struct msix_offset_rsp {u16 ssow_msixoff[MAX_RVU_BLKLF_CNT ];u16 timlf_msixoff[MAX_RVU_BLKLF_CNT ];u16 cptlf_msixoff[MAX_RVU_BLKLF_CNT ]; +u8 cpt1_lfs; +u16 cpt1_lf_msixoff[MAX_RVU_BLKLF_CNT ]; };struct get_hw_cap_rsp {
@@ -491,6 +505,9 @@ struct nix_lf_alloc_rsp {u8 lf_tx_stats;/* NIX_AF_CONST1::LF_TX_STATS */ u16 cints;/* NIX_AF_CONST2::CINTS */ u16 qints;/* NIX_AF_CONST2::QINTS */ +u8 cgx_links;/* No. of CGX links present in HW */ +u8 lbk_links;/* No. of LBK links present in HW */ +u8 sdp_links;/* No. of SDP links present in HW */ };/* NIX AQ enqueue msg */
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +69 -16
185 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +4 -0
@@ -1217,6 +1217,10 @@ int rvu_mbox_handler_nix_lf_alloc(struct rvu *rvu, cfg =rvu_read64 (rvu, blkaddr,NIX_AF_CONST2 ); rsp->qints = ((cfg >>12 ) &0xFFF ); rsp->cints = ((cfg >>24 ) &0xFFF ); + rsp->cgx_links = hw->cgx_links; + rsp->lbk_links = hw->lbk_links; + rsp->sdp_links = hw->sdp_links; +return rc; }
drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.c +1 -1
@@ -35,7 +35,7 @@ static struct hw_reg_map txsch_reg_map[NIX_TXSCH_LVL_CNT] = { {0x1200, 0x12E0} } }, {NIX_TXSCH_LVL_TL3, 3, 0xFFFF, {{0x1000, 0x10E0}, {0x1600, 0x1608}, {0x1610, 0x1618} } }, - {NIX_TXSCH_LVL_TL2, 2, 0xFFFF, {{0x0E00, 0x0EE0}, {0x1700, 0x1768} } }, + {NIX_TXSCH_LVL_TL2, 2, 0xFFFF, {{0x0E00, 0x0EE0}, {0x1700, 0x17B0} } }, {NIX_TXSCH_LVL_TL1, 1, 0xFFFF, {{0x0C00, 0x0D98} } }, };
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h +2 -0
@@ -14,6 +14,8 @@/* RVU Block revision IDs */ #define RVU_BLK_RVUM_REVID 0x01 +#define RVU_MULTI_BLK_VER 0x7ULL +/* RVU Block Address Enumeration */ enum rvu_block_addr_e {BLKADDR_RVUM =0x0ULL ,
Signature · 1 line
2.7.4
PATCH v2 8/10 octeontx2-pf: Calculate LBK link instead of hardcoding
In reply to [email protected]From: Subbaraya Sundeep <[email protected]>
CGX links are followed by LBK links but number of CGX and LBK links varies between platforms. Hence get the number of links present in hardware from AF and use it to calculate LBK link number.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 8 ++++++-- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +6 -2
@@ -531,8 +531,10 @@ static int otx2_get_link(struct otx2_nic *pfvf) link =4 * ((map >>8 ) &0xF ) + ((map >>4 ) &0xF ); }/* LBK channel */ -if (pfvf->hw.tx_chan_base <SDP_CHAN_BASE ) - link =12 ; +if (pfvf->hw.tx_chan_base <SDP_CHAN_BASE ) { + map = pfvf->hw.tx_chan_base &0x7FF ; + link = pfvf->hw.cgx_links | ((map >>8 ) &0xF ); + }return link; }
@@ -1503,6 +1505,8 @@ void mbox_handler_nix_lf_alloc(struct otx2_nic *pfvf, pfvf->hw.tx_chan_base = rsp->tx_chan_base; pfvf->hw.lso_tsov4_idx = rsp->lso_tsov4_idx; pfvf->hw.lso_tsov6_idx = rsp->lso_tsov6_idx; + pfvf->hw.cgx_links = rsp->cgx_links; + pfvf->hw.lbk_links = rsp->lbk_links; }EXPORT_SYMBOL (mbox_handler_nix_lf_alloc);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +2 -0
@@ -197,6 +197,8 @@ struct otx2_hw {struct otx2_drv_stats drv_stats;u64 cgx_rx_stats[CGX_RX_STATS_COUNT ];u64 cgx_tx_stats[CGX_TX_STATS_COUNT ]; +u8 cgx_links;/* No. of CGX links present in HW */ +u8 lbk_links;/* No. of LBK links present in HW */ };struct otx2_vf_config {
Signature · 1 line
2.7.4
PATCH v2 9/10 octeontx2-af: Display NIX1 also in debugfs
In reply to [email protected]From: Rakesh Babu <[email protected]>
If NIX1 block is also implemented then add a new directory for NIX1 in debugfs root. Stats of NIX1 block can be read/writen from/to the files in directory "/sys/kernel/debug/octeontx2/nix1/".
--- drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 + .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 166 +++++++++++++++------ 2 files changed, 125 insertions(+), 43 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/common.h +2 -0
@@ -210,6 +210,8 @@ enum ndc_idx_e {NIX0_RX =0x0 ,NIX0_TX =0x1 ,NPA0_U =0x2 , +NIX1_RX =0x4 , + NIX1_TX = 0x5, }; enum ndc_ctype_e {
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +123 -43
339 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 10/10 octeontx2-af: Display CGX, NIX and PF map in debugfs.
In reply to [email protected]From: Rakesh Babu <[email protected]>
Unlike earlier silicon variants, OcteonTx2 98xx silicon has 2 NIX blocks and each of the CGX is mapped to either of the NIX blocks. Each NIX block supports 100G. Mapping btw NIX blocks and CGX is done by firmware based on CGX speed config to have a maximum possible network bandwidth. Since the mapping is not fixed, it's difficult for a user to figure out. Hence added a debugfs entry which displays mapping between CGX LMAC, NIX block and RVU PF.
Sample result of this entry ::
~# cat /sys/kernel/debug/octeontx2/rvu_pf_cgx_map
PCI dev RVU PF Func NIX block CGX LMAC 0002:02:00.0 0x400 NIX0 CGX0 LMAC0
--- .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +47 -0
@@ -224,6 +224,48 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,RVU_DEBUG_FOPS (rsrc_status, rsrc_attach_status,NULL ); +static int rvu_dbg_rvu_pf_cgx_map_display (struct seq_file *filp,void *unused) +{ +struct rvu *rvu = filp->private; +struct pci_dev *pdev =NULL ; +char cgx[10 ], lmac[10 ]; +struct rvu_pfvf *pfvf; +int pf, domain, blkid; +u8 cgx_id, lmac_id; +u16 pcifunc; + + domain =2 ; +seq_puts (filp,"PCI dev\t\tRVU PF Func\tNIX block\tCGX\tLMAC\n" ); +for (pf =0 ; pf < rvu->hw->total_pfs; pf++) { +if (!is_pf_cgxmapped (rvu, pf)) +continue ; + + pdev =pci_get_domain_bus_and_slot (domain, pf +1 ,0 ); +if (!pdev) +continue ; + + cgx[0 ] =0 ; + lmac[0 ] =0 ; + pcifunc = pf <<10 ; + pfvf =rvu_get_pfvf (rvu, pcifunc); + +if (pfvf->nix_blkaddr ==BLKADDR_NIX0 ) + blkid =0 ; +else + blkid =1 ; + +rvu_get_cgx_lmac_id (rvu->pf2cgxlmac_map[pf], &cgx_id, + &lmac_id); +sprintf (cgx,"CGX%d" , cgx_id); +sprintf (lmac,"LMAC%d" , lmac_id); +seq_printf (filp,"%s\t0x%x\t\tNIX%d\t\t%s\t%s\n" , +dev_name (&pdev->dev), pcifunc, blkid, cgx, lmac); + } +return 0 ; +} + +RVU_DEBUG_SEQ_FOPS (rvu_pf_cgx_map, rvu_pf_cgx_map_display,NULL ); +static bool rvu_dbg_is_valid_lf (struct rvu *rvu,int blkaddr,int lf,u16 *pcifunc) {
@@ -1769,6 +1811,11 @@ void rvu_dbg_init(struct rvu *rvu)if (!pfile) goto create_failed; + pfile =debugfs_create_file ("rvu_pf_cgx_map" ,0444 , rvu->rvu_dbg.root, + rvu, &rvu_dbg_rvu_pf_cgx_map_fops); +if (!pfile) + goto create_failed; +rvu_dbg_npa_init (rvu);rvu_dbg_nix_init (rvu,BLKADDR_NIX0 );
Signature · 1 line
2.7.4
Quoted 17 lines · On Thu, 29 Oct 2020 10:45:39 +0530 [email protected] wrote:
From: Subbaraya Sundeep <[email protected]>
OcteonTx2 series of silicons have multiple variants, the 98xx variant has two network interface controllers (NIX blocks) each of which supports upto 100Gbps. Similarly 98xx supports two crypto blocks (CPT) to double the crypto performance. The current RVU drivers support a single NIX and
CPT blocks, this patchset adds support for multiple blocks of same type to be active at the same time.Also the number of serdes controllers (CGX) have increased from three to five on 98xx. Each of the CGX block supports upto 4 physical interfaces depending on the serdes mode ie upto 20 physical interfaces. At a time each CGX block can be mapped to a single NIX. The HW configuration to map CGX and NIX blocks is done by firmware.
Quoted 7 lines
NPC has two new interfaces added
NIX1_RXandNIX1_TXsimilar to NIX0 interfaces. Also MCAM entries is increased from 4k to 16k. To support the 16k entries extended set is added in hardware which are at completely different register offsets. Fortunately new constant registers can be read to figure out the extended set is present or not.
Applied, thanks!
Thanks Jakub,
Sundeep
Quoted 28 lines · Jakub Kicinski
Quoted 17 lines · On Thu, 29 Oct 2020 10:45:39 +0530 [email protected] wrote:
From: Subbaraya Sundeep <[email protected]>
OcteonTx2 series of silicons have multiple variants, the 98xx variant has two network interface controllers (NIX blocks) each of which supports upto 100Gbps. Similarly 98xx supports two crypto blocks (CPT) to double the crypto performance. The current RVU drivers support a single NIX and
CPT blocks, this patchset adds support for multiple blocks of same type to be active at the same time.Also the number of serdes controllers (CGX) have increased from three to five on 98xx. Each of the CGX block supports upto 4 physical interfaces depending on the serdes mode ie upto 20 physical interfaces. At a time each CGX block can be mapped to a single NIX. The HW configuration to map CGX and NIX blocks is done by firmware.
Quoted 7 lines
NPC has two new interfaces added
NIX1_RXandNIX1_TXsimilar to NIX0 interfaces. Also MCAM entries is increased from 4k to 16k. To support the 16k entries extended set is added in hardware which are at completely different register offsets. Fortunately new constant registers can be read to figure out the extended set is present or not.Applied, thanks!