CN20K silicon with mbox support
Subsystems (6)
Subbaraya Sundeep
maintainerv11 cover CN20K silicon with mbox support
CN20K is the next generation silicon in the Octeon series with various improvements and new features.
Along with other changes the mailbox communication mechanism between RVU (Resource virtualization Unit) SRIOV PFs/VFs with Admin function (AF) has also gone through some changes.
Some of those changes are
- Separate IRQs for mbox request and response/ack.
- Configurable mbox size, default being 64KB.
- Ability for VFs to communicate with RVU AF instead of going through parent SRIOV PF.
Due to more memory requirement due to configurable mbox size, mbox memory will now have to be allocated by
- AF (PF0) for communicating with other PFs and all VFs in the system.
- PF for communicating with it's child VFs.
On previous silicons mbox memory was reserved and configured by firmware.
This patch series add basic mbox support for AF (PF0) <=> PFs and PF <=> VFs. AF <=> VFs communication and variable mbox size support will come in later.
Patch #1 Supported co-existance of bit encoding PFs and VFs in 16-bit
hardware pcifunc format between CN20K silicon and older octeon series. Also exported PF,VF masks and shifts present in mailbox module to all other modules.
Patch #2 Added basic mbox operation APIs and structures to support both
CN20K and previous version of silicons.
Patch #3 This patch adds support for basic mbox infrastructure
implementation for CN20K silicon in AF perspective. There are few updates w.r.t MBOX ACK interrupt and offsets in CN20k.
Patch #4 Added mbox implementation between NIC PF and AF for CN20K.
Patch #5 Added mbox communication support between AF and AF's VFs.
Patch #6 This patch adds support for MBOX communication between NIC PF and
its VFs.
Sai Krishna (5):
octeontx2-af: CN20k basic mbox operations and structures
octeontx2-af: CN20k mbox to support AF REQ/ACK functionality
octeontx2-pf: CN20K mbox REQ/ACK implementation for NIC PF
octeontx2-af: CN20K mbox implementation for AF's VF
octeontx2-pf: CN20K mbox implementation between PF-VF
Subbaraya Sundeep (1):
octeontx2: Set appropriate PF, VF masks and shifts based on silicon
---
v11 changes:
Fixed comments from Paolo Abeni -
Fixed memory leak of rvu->ng_rvu struct
Removed unnecessary forward declaration of struct rvu Removed code which fixes sparse warnings from this patch set and submitted as separate patches
Changed vf_trig_val type from int to u64
Removed changes which fix warings of -Wenum-enum-conversion as suggested by Simon Horman
v10 changes:
Fixed compilation issue reported by kernel test robot.
v9 changes:
Addressed review comments given by Jakub Kicinski
1. Removed macro indirections and converted PF func mask, shift macros usage into helper APIs and used the same in different modules.
v8 changes:
No changes, re-posting, as the previous patchset got deferred.
v7 changes:
Addressed review comments given by Jakub Kicinski
1. Fixed few clang warnings of enum conversion related to the patchset.
v6 changes:
Addressed review comments given by Jakub Kicinski
1. Fixed minor line alignment issue to fit in 80 char.
2. Jakub also suggested to convert macros from patch1 into helper APIs. Since this will result in lot of changes (at >100 places across multiple drivers), will submit that patch as a separate cleanup patch.
v5 changes:
No changes, re-posting.
v4 changes:
Addressed minor conflits suggested by Jakub Kicinski
1. This V4 version of patch set is just a rebase of V3 on top of net-next to address some minor conflicts.
v3 changes:
Addressed review comments given by Jakub Kicinski, Simon Horman
1. Fixed sparse errors, warnings.
2. Fixed a comment mistake, inline with kernel-doc format.
3. Removed un-necessary type casting to honor Networking code format.
v2 changes:
Addressed review comments given by Kalesh Anakkur Purayil
1. Optimized code in parts of patches, removed redundant code
2. Fixed sparse warning
3. Removed debug log.
drivers/crypto/marvell/octeontx2/otx2_cpt_common.h | 5 +- drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c | 13 +- .../crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 4 +- drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c | 6 +- drivers/net/ethernet/marvell/octeontx2/af/Makefile | 2 +- .../net/ethernet/marvell/octeontx2/af/cn20k/api.h | 32 ++ .../marvell/octeontx2/af/cn20k/mbox_init.c | 424 +++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/cn20k/reg.h | 81 ++++ .../ethernet/marvell/octeontx2/af/cn20k/struct.h | 40 ++ drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +- drivers/net/ethernet/marvell/octeontx2/af/mbox.c | 106 +++++- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 8 + .../net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c | 6 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 222 +++++++---- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 81 +++- .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 68 ++-- .../net/ethernet/marvell/octeontx2/af/rvu_cn10k.c | 4 +- .../net/ethernet/marvell/octeontx2/af/rvu_cpt.c | 4 +- .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 22 +- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 54 +-- .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 8 +- .../ethernet/marvell/octeontx2/af/rvu_npc_hash.c | 16 +- .../ethernet/marvell/octeontx2/af/rvu_npc_hash.h | 4 +- .../net/ethernet/marvell/octeontx2/af/rvu_rep.c | 13 +- .../net/ethernet/marvell/octeontx2/af/rvu_sdp.c | 10 +- .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 6 +- .../net/ethernet/marvell/octeontx2/af/rvu_switch.c | 8 +- .../net/ethernet/marvell/octeontx2/nic/Makefile | 2 +- drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 18 +- drivers/net/ethernet/marvell/octeontx2/nic/cn10k.h | 1 + .../ethernet/marvell/octeontx2/nic/cn10k_ipsec.c | 2 +- .../ethernet/marvell/octeontx2/nic/cn10k_ipsec.h | 2 +- drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c | 252 ++++++++++++ drivers/net/ethernet/marvell/octeontx2/nic/cn20k.h | 17 + .../ethernet/marvell/octeontx2/nic/otx2_common.h | 35 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 166 ++++++-- .../net/ethernet/marvell/octeontx2/nic/otx2_reg.h | 49 +-- .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 3 +- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 44 ++- drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 7 +- include/linux/soc/marvell/silicons.h | 25 ++ 41 files changed, 1570 insertions(+), 302 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/api.h create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/reg.h create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/struct.h create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/cn20k.h create mode 100644 include/linux/soc/marvell/silicons.h
Signature · 1 line
2.7.4
Subbaraya Sundeep
maintainerPATCH v11 1/6 octeontx2: Set appropriate PF, VF masks and shifts based on silicon
Number of RVU PFs on CN20K silicon have increased to 96 from maximum of 32 that were supported on earlier silicons. Every RVU PF and VF is identified by HW using a 16bit PF_FUNC value. Due to the change in Max number of PFs in CN20K, the bit encoding of this PF_FUNC has changed.
This patch handles the change by using helper functions(using silicon check) to use PF,VF masks and shifts to support both new silicon CN20K, OcteonTx series. These helper functions are used in different modules.
Also moved the NIX AF register offset macros to other files which will be posted in coming patches.
--- drivers/crypto/marvell/octeontx2/otx2_cpt_common.h | 5 +- drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c | 13 ++--- .../crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 4 +- drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c | 6 +- .../net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c | 6 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 30 ++++------ drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 52 ++++++++++++++--- .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 68 +++++++++++----------- .../net/ethernet/marvell/octeontx2/af/rvu_cn10k.c | 4 +- .../net/ethernet/marvell/octeontx2/af/rvu_cpt.c | 4 +- .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 22 +++---- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 54 +++++++++-------- .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 8 ++- .../ethernet/marvell/octeontx2/af/rvu_npc_hash.c | 16 ++--- .../ethernet/marvell/octeontx2/af/rvu_npc_hash.h | 4 +- .../net/ethernet/marvell/octeontx2/af/rvu_rep.c | 13 ++--- .../net/ethernet/marvell/octeontx2/af/rvu_sdp.c | 10 ++-- .../net/ethernet/marvell/octeontx2/af/rvu_switch.c | 8 +-- .../ethernet/marvell/octeontx2/nic/cn10k_ipsec.c | 2 +- .../ethernet/marvell/octeontx2/nic/cn10k_ipsec.h | 2 +- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 11 +--- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 21 ++++--- .../net/ethernet/marvell/octeontx2/nic/otx2_reg.h | 30 ---------- .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 3 +- drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 7 ++- include/linux/soc/marvell/silicons.h | 25 ++++++++ 26 files changed, 225 insertions(+), 203 deletions(-) create mode 100644 include/linux/soc/marvell/silicons.h
drivers/crypto/marvell/octeontx2/otx2_cpt_common.h +2 -3
@@ -18,9 +18,8 @@#define OTX2_CPT_MAX_VFS_NUM 128#define OTX2_CPT_RVU_FUNC_ADDR_S (blk, slot, offs) \ (((blk) << 20) | ((slot) << 12) | (offs)) -#define OTX2_CPT_RVU_PFFUNC (pf, func) \ - ((((pf) & RVU_PFVF_PF_MASK) << RVU_PFVF_PF_SHIFT) | \ - (((func) & RVU_PFVF_FUNC_MASK) << RVU_PFVF_FUNC_SHIFT)) + +#define OTX2_CPT_RVU_PFFUNC (pdev, pf, func) rvu_make_pcifunc(pdev, pf, func)#define OTX2_CPT_INVALID_CRYPTO_ENG_GRP 0xFF#define OTX2_CPT_NAME_LENGTH 64
drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c +6 -7
@@ -142,7 +142,7 @@ static int send_inline_ipsec_inbound_msg(struct otx2_cptpf_dev *cptpf,memset (req,0 ,sizeof (*req)); req->hdr.id =MBOX_MSG_CPT_INLINE_IPSEC_CFG ; req->hdr.sig =OTX2_MBOX_REQ_SIG ; - req->hdr.pcifunc =OTX2_CPT_RVU_PFFUNC (cptpf->pf_id,0 ); + req->hdr.pcifunc =OTX2_CPT_RVU_PFFUNC (cptpf->pdev, cptpf->pf_id,0 ); req->dir =CPT_INLINE_INBOUND ; req->slot = slot; req->sso_pf_func_ovrd = cptpf->sso_pf_func_ovrd;
@@ -184,7 +184,8 @@ static int rx_inline_ipsec_lf_cfg(struct otx2_cptpf_dev *cptpf, u8 egrp, nix_req->gen_cfg.opcode =cpt_inline_rx_opcode (pdev); nix_req->gen_cfg.param1 = req->param1; nix_req->gen_cfg.param2 = req->param2; - nix_req->inst_qsel.cpt_pf_func =OTX2_CPT_RVU_PFFUNC (cptpf->pf_id,0 ); + nix_req->inst_qsel.cpt_pf_func = +OTX2_CPT_RVU_PFFUNC (cptpf->pdev, cptpf->pf_id,0 ); nix_req->inst_qsel.cpt_slot =0 ; ret =otx2_cpt_send_mbox_msg (&cptpf->afpf_mbox, pdev);if (ret)
@@ -392,9 +393,8 @@ void otx2_cptpf_vfpf_mbox_handler(struct work_struct *work) msg = (struct mbox_msghdr *)(mdev->mbase + offset);/* Set which VF sent this message based on mbox IRQ */ - msg->pcifunc = ((u16 )cptpf->pf_id <<RVU_PFVF_PF_SHIFT ) | - ((vf->vf_id +1 ) &RVU_PFVF_FUNC_MASK ); - + msg->pcifunc =rvu_make_pcifunc (cptpf->pdev, cptpf->pf_id, + (vf->vf_id +1 )); err =cptpf_handle_vf_req (cptpf, vf, msg, msg->next_msgoff - offset);/*
@@ -469,8 +469,7 @@ static void process_afpf_mbox_msg(struct otx2_cptpf_dev *cptpf,switch (msg->id) {case MBOX_MSG_READY : - cptpf->pf_id = (msg->pcifunc >>RVU_PFVF_PF_SHIFT ) & -RVU_PFVF_PF_MASK ; + cptpf->pf_id =rvu_get_pf (cptpf->pdev, msg->pcifunc);break ;case MBOX_MSG_MSIX_OFFSET : rsp_msix = (struct msix_offset_rsp *) msg;
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c +3 -1
@@ -176,7 +176,9 @@ static int cptx_set_ucode_base(struct otx2_cpt_eng_grp_info *eng_grp,/* Set PF number for microcode fetches */ ret =otx2_cpt_write_af_reg (&cptpf->afpf_mbox, cptpf->pdev,CPT_AF_PF_FUNC , - cptpf->pf_id <<RVU_PFVF_PF_SHIFT , blkaddr); +rvu_make_pcifunc (cptpf->pdev, + cptpf->pf_id,0 ), + blkaddr);if (ret)return ret;
drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c +3 -3
@@ -189,7 +189,7 @@ int otx2_cptvf_send_eng_grp_num_msg(struct otx2_cptvf_dev *cptvf, int eng_type) } req->hdr.id =MBOX_MSG_GET_ENG_GRP_NUM ; req->hdr.sig =OTX2_MBOX_REQ_SIG ; - req->hdr.pcifunc =OTX2_CPT_RVU_PFFUNC (cptvf->vf_id,0 ); + req->hdr.pcifunc =OTX2_CPT_RVU_PFFUNC (cptvf->pdev, cptvf->vf_id,0 ); req->eng_type = eng_type;return otx2_cpt_send_mbox_msg (mbox, pdev);
@@ -210,7 +210,7 @@ int otx2_cptvf_send_kvf_limits_msg(struct otx2_cptvf_dev *cptvf) } req->id =MBOX_MSG_GET_KVF_LIMITS ; req->sig =OTX2_MBOX_REQ_SIG ; - req->pcifunc =OTX2_CPT_RVU_PFFUNC (cptvf->vf_id,0 ); + req->pcifunc =OTX2_CPT_RVU_PFFUNC (cptvf->pdev, cptvf->vf_id,0 );return otx2_cpt_send_mbox_msg (mbox, pdev); }
@@ -230,7 +230,7 @@ int otx2_cptvf_send_caps_msg(struct otx2_cptvf_dev *cptvf) } req->id =MBOX_MSG_GET_CAPS ; req->sig =OTX2_MBOX_REQ_SIG ; - req->pcifunc =OTX2_CPT_RVU_PFFUNC (cptvf->vf_id,0 ); + req->pcifunc =OTX2_CPT_RVU_PFFUNC (cptvf->pdev, cptvf->vf_id,0 );return otx2_cpt_send_mbox_msg (mbox, pdev); }
drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c +3 -3
@@ -97,7 +97,7 @@ int mcs_add_intr_wq_entry(struct mcs *mcs, struct mcs_intr_event *event)if (pcifunc &RVU_PFVF_FUNC_MASK ) pfvf = &mcs->vf[rvu_get_hwvf (rvu, pcifunc)];else - pfvf = &mcs->pf[rvu_get_pf (pcifunc)]; + pfvf = &mcs->pf[rvu_get_pf (rvu->pdev, pcifunc)]; event->intr_mask &= pfvf->intr_mask;
@@ -123,7 +123,7 @@ static int mcs_notify_pfvf(struct mcs_intr_event *event, struct rvu *rvu)struct mcs_intr_info *req;int pf; - pf =rvu_get_pf (event->pcifunc); + pf =rvu_get_pf (rvu->pdev, event->pcifunc);mutex_lock (&rvu->mbox_lock);
@@ -193,7 +193,7 @@ int rvu_mbox_handler_mcs_intr_cfg(struct rvu *rvu,if (pcifunc &RVU_PFVF_FUNC_MASK ) pfvf = &mcs->vf[rvu_get_hwvf (rvu, pcifunc)];else - pfvf = &mcs->pf[rvu_get_pf (pcifunc)]; + pfvf = &mcs->pf[rvu_get_pf (rvu->pdev, pcifunc)]; mcs->pf_map[0 ] = pcifunc; pfvf->intr_mask = req->intr_mask;
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +12 -18
@@ -294,7 +294,7 @@ int rvu_get_blkaddr(struct rvu *rvu, int blktype, u16 pcifunc) devnum =rvu_get_hwvf (rvu, pcifunc); }else { is_pf = true; - devnum =rvu_get_pf (pcifunc); + devnum =rvu_get_pf (rvu->pdev, pcifunc); }/* Check if the 'pcifunc' has a NIX LF from 'BLKADDR_NIX0' or
@@ -359,7 +359,7 @@ static void rvu_update_rsrc_map(struct rvu *rvu, struct rvu_pfvf *pfvf, devnum =rvu_get_hwvf (rvu, pcifunc); }else { is_pf = true; - devnum =rvu_get_pf (pcifunc); + devnum =rvu_get_pf (rvu->pdev, pcifunc); } block->fn_map[lf] = attach ? pcifunc :0 ;
@@ -400,11 +400,6 @@ static void rvu_update_rsrc_map(struct rvu *rvu, struct rvu_pfvf *pfvf,rvu_write64 (rvu,BLKADDR_RVUM , reg | (devnum <<16 ), num_lfs); } -inline int rvu_get_pf (u16 pcifunc) -{ -return (pcifunc >>RVU_PFVF_PF_SHIFT ) &RVU_PFVF_PF_MASK ; -} -void rvu_get_pf_numvfs (struct rvu *rvu,int pf,int *numvfs,int *hwvf) {u64 cfg;
@@ -422,7 +417,7 @@ int rvu_get_hwvf(struct rvu *rvu, int pcifunc)int pf, func;u64 cfg; - pf =rvu_get_pf (pcifunc); + pf =rvu_get_pf (rvu->pdev, pcifunc); func = pcifunc &RVU_PFVF_FUNC_MASK ;/* Get first HWVF attached to this PF */
@@ -437,7 +432,7 @@ struct rvu_pfvf *rvu_get_pfvf(struct rvu *rvu, int pcifunc)if (pcifunc &RVU_PFVF_FUNC_MASK )return &rvu->hwvf[rvu_get_hwvf (rvu, pcifunc)];else -return &rvu->pf[rvu_get_pf (pcifunc)]; +return &rvu->pf[rvu_get_pf (rvu->pdev, pcifunc)]; }static bool is_pf_func_valid (struct rvu *rvu,u16 pcifunc)
@@ -445,7 +440,7 @@ static bool is_pf_func_valid(struct rvu *rvu, u16 pcifunc)int pf, vf, nvfs;u64 cfg; - pf =rvu_get_pf (pcifunc); + pf =rvu_get_pf (rvu->pdev, pcifunc);if (pf >= rvu->hw->total_pfs)return false;
@@ -1487,7 +1482,7 @@ int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc) pf =rvu_get_pfvf (rvu, pcifunc & ~RVU_PFVF_FUNC_MASK );/* All CGX mapped PFs are set with assigned NIX block during init */ -if (is_pf_cgxmapped (rvu,rvu_get_pf (pcifunc))) { +if (is_pf_cgxmapped (rvu,rvu_get_pf (rvu->pdev, pcifunc))) { blkaddr = pf->nix_blkaddr; }else if (is_lbk_vf (rvu, pcifunc)) { vf = pcifunc -1 ;
@@ -1501,7 +1496,7 @@ int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc) }/* if SDP1 then the blkaddr is NIX1 */ -if (is_sdp_pfvf (pcifunc) && pf->sdp_info->node_id ==1 ) +if (is_sdp_pfvf (rvu, pcifunc) && pf->sdp_info->node_id ==1 ) blkaddr =BLKADDR_NIX1 ;switch (blkaddr) {
@@ -2006,7 +2001,7 @@ int rvu_mbox_handler_vf_flr(struct rvu *rvu, struct msg_req *req, vf = pcifunc &RVU_PFVF_FUNC_MASK ; cfg =rvu_read64 (rvu,BLKADDR_RVUM , -RVU_PRIV_PFX_CFG (rvu_get_pf (pcifunc))); +RVU_PRIV_PFX_CFG (rvu_get_pf (rvu->pdev, pcifunc))); numvfs = (cfg >>12 ) &0xFF ;if (vf && vf <= numvfs)
@@ -2229,9 +2224,8 @@ static void __rvu_mbox_handler(struct rvu_work *mwork, int type, bool poll)/* Set which PF/VF sent this message based on mbox IRQ */ switch (type) {case TYPE_AFPF : - msg->pcifunc &= - ~(RVU_PFVF_PF_MASK <<RVU_PFVF_PF_SHIFT ); - msg->pcifunc |= (devid <<RVU_PFVF_PF_SHIFT ); + msg->pcifunc &=rvu_pcifunc_pf_mask (rvu->pdev); + msg->pcifunc |=rvu_make_pcifunc (rvu->pdev, devid,0 );break ;case TYPE_AFVF : msg->pcifunc &=
@@ -2249,7 +2243,7 @@ static void __rvu_mbox_handler(struct rvu_work *mwork, int type, bool poll)if (msg->pcifunc &RVU_PFVF_FUNC_MASK )dev_warn (rvu->dev,"Error %d when processing message %s (0x%x) from PF%d:VF%d\n" , err,otx2_mbox_id2name (msg->id), - msg->id,rvu_get_pf (msg->pcifunc), + msg->id,rvu_get_pf (rvu->pdev, msg->pcifunc), (msg->pcifunc &RVU_PFVF_FUNC_MASK ) -1 );else dev_warn(rvu->dev, "Error %d when processing message %s (0x%x) from PF%d\n",
@@ -2773,7 +2767,7 @@ static void rvu_flr_handler(struct work_struct *work) cfg =rvu_read64 (rvu,BLKADDR_RVUM ,RVU_PRIV_PFX_CFG (pf)); numvfs = (cfg >>12 ) &0xFF ; - pcifunc = pf <<RVU_PFVF_PF_SHIFT ; + pcifunc =rvu_make_pcifunc (rvu->pdev, pf,0 );for (vf =0 ; vf < numvfs; vf++)__rvu_flr_handler (rvu, (pcifunc | (vf +1 )));
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +43 -9
92 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +34 -34
268 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c +2 -2
@@ -66,7 +66,7 @@ static int lmtst_map_table_ops(struct rvu *rvu, u32 index, u64 *val,#define LMT_MAP_TBL_W1_OFF 8static u32 rvu_get_lmtst_tbl_index (struct rvu *rvu,u16 pcifunc) { -return ((rvu_get_pf (pcifunc) *LMT_MAX_VFS ) + +return ((rvu_get_pf (rvu->pdev, pcifunc) *LMT_MAX_VFS ) + (pcifunc &RVU_PFVF_FUNC_MASK )) *LMT_MAPTBL_ENTRY_SIZE ; }
@@ -83,7 +83,7 @@ static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc,mutex_lock (&rvu->rsrc_lock);rvu_write64 (rvu,BLKADDR_RVUM ,RVU_AF_SMMU_ADDR_REQ , iova); - pf =rvu_get_pf (pcifunc) &RVU_PFVF_PF_MASK ; + pf =rvu_get_pf (rvu->pdev, pcifunc) &RVU_OTX2_PFVF_PF_MASK ; val =BIT_ULL (63 ) |BIT_ULL (14 ) |BIT_ULL (13 ) | pf <<8 | ((pcifunc &RVU_PFVF_FUNC_MASK ) &0xFF );rvu_write64 (rvu,BLKADDR_RVUM ,RVU_AF_SMMU_TXN_REQ , val);
drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +2 -2
@@ -410,7 +410,7 @@ static bool is_cpt_pf(struct rvu *rvu, u16 pcifunc) {int cpt_pf_num = rvu->cpt_pf_num; -if (rvu_get_pf (pcifunc) != cpt_pf_num) +if (rvu_get_pf (rvu->pdev, pcifunc) != cpt_pf_num)return false;if (pcifunc &RVU_PFVF_FUNC_MASK )return false;
@@ -422,7 +422,7 @@ static bool is_cpt_vf(struct rvu *rvu, u16 pcifunc) {int cpt_pf_num = rvu->cpt_pf_num; -if (rvu_get_pf (pcifunc) != cpt_pf_num) +if (rvu_get_pf (rvu->pdev, pcifunc) != cpt_pf_num)return false;if (!(pcifunc &RVU_PFVF_FUNC_MASK ))return false;
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +11 -11
@@ -688,7 +688,7 @@ static int get_max_column_width(struct rvu *rvu)for (pf =0 ; pf < rvu->hw->total_pfs; pf++) {for (vf =0 ; vf <= rvu->hw->total_vfs; vf++) { - pcifunc = pf <<10 | vf; + pcifunc =rvu_make_pcifunc (rvu->pdev, pf, vf);if (!pcifunc)continue ;
@@ -759,7 +759,7 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,for (vf =0 ; vf <= rvu->hw->total_vfs; vf++) { off =0 ; flag =0 ; - pcifunc = pf <<10 | vf; + pcifunc =rvu_make_pcifunc (rvu->pdev, pf, vf);if (!pcifunc)continue ;
@@ -842,7 +842,7 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused) cgx[0 ] =0 ; lmac[0 ] =0 ; - pcifunc = pf <<10 ; + pcifunc =rvu_make_pcifunc (rvu->pdev, pf,0 ); pfvf =rvu_get_pfvf (rvu, pcifunc);if (pfvf->nix_blkaddr ==BLKADDR_NIX0 )
@@ -2623,10 +2623,10 @@ static int rvu_dbg_nix_band_prof_ctx_display(struct seq_file *m, void *unused) pcifunc = ipolicer->pfvf_map[idx];if (!(pcifunc &RVU_PFVF_FUNC_MASK ))seq_printf (m,"Allocated to :: PF %d\n" , -rvu_get_pf (pcifunc)); +rvu_get_pf (rvu->pdev, pcifunc));else seq_printf (m,"Allocated to :: PF %d VF %d\n" , -rvu_get_pf (pcifunc), +rvu_get_pf (rvu->pdev, pcifunc), (pcifunc &RVU_PFVF_FUNC_MASK ) -1 );print_band_prof_ctx (m, &aq_rsp.prof); }
@@ -2983,10 +2983,10 @@ static void rvu_print_npc_mcam_info(struct seq_file *s,if (!(pcifunc &RVU_PFVF_FUNC_MASK ))seq_printf (s,"\n\t\t Device \t\t: PF%d\n" , -rvu_get_pf (pcifunc)); +rvu_get_pf (rvu->pdev, pcifunc));else seq_printf (s,"\n\t\t Device \t\t: PF%d VF%d\n" , -rvu_get_pf (pcifunc), +rvu_get_pf (rvu->pdev, pcifunc), (pcifunc &RVU_PFVF_FUNC_MASK ) -1 );if (entry_acnt) {
@@ -3049,13 +3049,13 @@ static int rvu_dbg_npc_mcam_info_display(struct seq_file *filp, void *unsued)seq_puts (filp,"\n\t\t Current allocation\n" );seq_puts (filp,"\t\t====================\n" );for (pf =0 ; pf < rvu->hw->total_pfs; pf++) { - pcifunc = (pf <<RVU_PFVF_PF_SHIFT ); + pcifunc =rvu_make_pcifunc (rvu->pdev, pf,0 );rvu_print_npc_mcam_info (filp, pcifunc, blkaddr); cfg =rvu_read64 (rvu,BLKADDR_RVUM ,RVU_PRIV_PFX_CFG (pf)); numvfs = (cfg >>12 ) &0xFF ;for (vf =0 ; vf < numvfs; vf++) { - pcifunc = (pf <<RVU_PFVF_PF_SHIFT ) | (vf +1 ); + pcifunc =rvu_make_pcifunc (rvu->pdev, pf, (vf +1 ));rvu_print_npc_mcam_info (filp, pcifunc, blkaddr); } }
@@ -3326,7 +3326,7 @@ static int rvu_dbg_npc_mcam_show_rules(struct seq_file *s, void *unused)mutex_lock (&mcam->lock);list_for_each_entry (iter, &mcam->mcam_rules, list) { - pf = (iter->owner >>RVU_PFVF_PF_SHIFT ) &RVU_PFVF_PF_MASK ; + pf =rvu_get_pf (rvu->pdev, iter->owner);seq_printf (s,"\n\tInstalled by: PF%d " , pf);if (iter->owner &RVU_PFVF_FUNC_MASK ) {
@@ -3344,7 +3344,7 @@ static int rvu_dbg_npc_mcam_show_rules(struct seq_file *s, void *unused)rvu_dbg_npc_mcam_show_flows (s, iter);if (is_npc_intf_rx (iter->intf)) { target = iter->rx_action.pf_func; - pf = (target >>RVU_PFVF_PF_SHIFT ) &RVU_PFVF_PF_MASK ; + pf =rvu_get_pf (rvu->pdev, target);seq_printf (s,"\tForward to: PF%d " , pf);if (target &RVU_PFVF_FUNC_MASK ) {
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +29 -25
196 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +5 -3
@@ -147,7 +147,9 @@ static int npc_get_ucast_mcam_index(struct npc_mcam *mcam, u16 pcifunc,int npc_get_nixlf_mcam_index (struct npc_mcam *mcam,u16 pcifunc,int nixlf,int type) { -int pf =rvu_get_pf (pcifunc); + struct rvu_hwinfo *hw = container_of(mcam, struct rvu_hwinfo, mcam); +struct rvu *rvu = hw->rvu; +int pf =rvu_get_pf (rvu->pdev, pcifunc);int index;/* Check if this is for a PF */
@@ -698,7 +700,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,/* RX_ACTION set to MCAST for CGX PF's */ if (hw->cap.nix_rx_multicast && pfvf->use_mce_list && -is_pf_cgxmapped (rvu,rvu_get_pf (pcifunc))) { +is_pf_cgxmapped (rvu,rvu_get_pf (rvu->pdev, pcifunc))) { *(u64 *)&action =0 ; action.op =NIX_RX_ACTIONOP_MCAST ; pfvf =rvu_get_pfvf (rvu, pcifunc & ~RVU_PFVF_FUNC_MASK );
@@ -3434,7 +3436,7 @@ int rvu_npc_set_parse_mode(struct rvu *rvu, u16 pcifunc, u64 mode, u8 dir, {struct rvu_pfvf *pfvf =rvu_get_pfvf (rvu, pcifunc);int blkaddr, nixlf, rc, intf_mode; -int pf =rvu_get_pf (pcifunc); +int pf =rvu_get_pf (rvu->pdev, pcifunc);u64 rxpkind, txpkind;u8 cgx_id, lmac_id;
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +8 -8
@@ -1465,7 +1465,7 @@ static int rvu_npc_exact_update_table_entry(struct rvu *rvu, u8 cgx_id, u8 lmac_int rvu_npc_exact_promisc_disable (struct rvu *rvu,u16 pcifunc) {struct npc_exact_table *table; -int pf =rvu_get_pf (pcifunc); +int pf =rvu_get_pf (rvu->pdev, pcifunc);u8 cgx_id, lmac_id;u32 drop_mcam_idx;bool *promisc;
@@ -1512,7 +1512,7 @@ int rvu_npc_exact_promisc_disable(struct rvu *rvu, u16 pcifunc)int rvu_npc_exact_promisc_enable (struct rvu *rvu,u16 pcifunc) {struct npc_exact_table *table; -int pf =rvu_get_pf (pcifunc); +int pf =rvu_get_pf (rvu->pdev, pcifunc);u8 cgx_id, lmac_id;u32 drop_mcam_idx;bool *promisc;
@@ -1560,7 +1560,7 @@ int rvu_npc_exact_promisc_enable(struct rvu *rvu, u16 pcifunc)int rvu_npc_exact_mac_addr_reset (struct rvu *rvu,struct cgx_mac_addr_reset_req *req,struct msg_rsp *rsp) { -int pf =rvu_get_pf (req->hdr.pcifunc); +int pf =rvu_get_pf (rvu->pdev, req->hdr.pcifunc);u32 seq_id = req->index;struct rvu_pfvf *pfvf;u8 cgx_id, lmac_id;
@@ -1593,7 +1593,7 @@ int rvu_npc_exact_mac_addr_update(struct rvu *rvu,struct cgx_mac_addr_update_req *req, struct cgx_mac_addr_update_rsp *rsp) { - int pf = rvu_get_pf(req->hdr.pcifunc); + int pf = rvu_get_pf(rvu->pdev, req->hdr.pcifunc);struct npc_exact_table_entry *entry;struct npc_exact_table *table;struct rvu_pfvf *pfvf;
@@ -1675,7 +1675,7 @@ int rvu_npc_exact_mac_addr_add(struct rvu *rvu,struct cgx_mac_addr_add_req *req, struct cgx_mac_addr_add_rsp *rsp) { - int pf = rvu_get_pf(req->hdr.pcifunc); + int pf = rvu_get_pf(rvu->pdev, req->hdr.pcifunc);struct rvu_pfvf *pfvf;u8 cgx_id, lmac_id;int rc =0 ;
@@ -1711,7 +1711,7 @@ int rvu_npc_exact_mac_addr_del(struct rvu *rvu,struct cgx_mac_addr_del_req *req, struct msg_rsp *rsp) { - int pf = rvu_get_pf(req->hdr.pcifunc); + int pf = rvu_get_pf(rvu->pdev, req->hdr.pcifunc);int rc; rc =rvu_npc_exact_del_table_entry_by_id (rvu, req->index);
@@ -1736,7 +1736,7 @@ int rvu_npc_exact_mac_addr_del(struct rvu *rvu,int rvu_npc_exact_mac_addr_set (struct rvu *rvu,struct cgx_mac_addr_set_or_get *req,struct cgx_mac_addr_set_or_get *rsp) { -int pf =rvu_get_pf (req->hdr.pcifunc); +int pf =rvu_get_pf (rvu->pdev, req->hdr.pcifunc);u32 seq_id = req->index;struct rvu_pfvf *pfvf;u8 cgx_id, lmac_id;
@@ -2001,7 +2001,7 @@ int rvu_npc_exact_init(struct rvu *rvu) }/* Filter rules are only for PF */ - pcifunc =RVU_PFFUNC (i,0 ); + pcifunc =RVU_PFFUNC (rvu->pdev, i,0 ); dev_dbg(rvu->dev, "%s:Drop rule cgx=%d lmac=%d chan(val=0x%llx, mask=0x%llx\n",
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +1 -3
@@ -139,9 +139,7 @@ static struct npc_mcam_kex_hash npc_mkex_hash_default __maybe_unused = {#define NPC_MCAM_DROP_RULE_MAX 30#define NPC_MCAM_SDP_DROP_RULE_IDX 0 -#define RVU_PFFUNC (pf, func) \ - ((((pf) & RVU_PFVF_PF_MASK) << RVU_PFVF_PF_SHIFT) | \ - (((func) & RVU_PFVF_FUNC_MASK) << RVU_PFVF_FUNC_SHIFT)) +#define RVU_PFFUNC (pdev, pf, func) rvu_make_pcifunc(pdev, pf, func)enum npc_exact_opc_type {NPC_EXACT_OPC_MEM ,
drivers/net/ethernet/marvell/octeontx2/af/rvu_rep.c +6 -7
@@ -39,7 +39,7 @@ static int rvu_rep_up_notify(struct rvu *rvu, struct rep_event *event)struct rep_event *msg;int pf; - pf =rvu_get_pf (event->pcifunc); + pf =rvu_get_pf (rvu->pdev, event->pcifunc);if (event->event &RVU_EVENT_MAC_ADDR_CHANGE )ether_addr_copy (pfvf->mac_addr, event->evt_data.mac);
@@ -114,10 +114,10 @@ int rvu_rep_notify_pfvf_state(struct rvu *rvu, u16 pcifunc, bool enable)struct rep_event *req;int pf; -if (!is_pf_cgxmapped (rvu,rvu_get_pf (pcifunc))) +if (!is_pf_cgxmapped (rvu,rvu_get_pf (rvu->pdev, pcifunc)))return 0 ; - pf =rvu_get_pf (rvu->rep_pcifunc); + pf =rvu_get_pf (rvu->pdev, rvu->rep_pcifunc);mutex_lock (&rvu->mbox_lock); req =otx2_mbox_alloc_msg_rep_event_up_notify (rvu, pf);
@@ -325,7 +325,7 @@ int rvu_rep_install_mcam_rules(struct rvu *rvu)if (!is_pf_cgxmapped (rvu, pf))continue ; - pcifunc = pf <<RVU_PFVF_PF_SHIFT ; + pcifunc =rvu_make_pcifunc (rvu->pdev, pf,0 );rvu_get_nix_blkaddr (rvu, pcifunc); rep = true;for (i =0 ; i <2 ; i++) {
@@ -345,8 +345,7 @@ int rvu_rep_install_mcam_rules(struct rvu *rvu)rvu_get_pf_numvfs (rvu, pf, &numvfs,NULL );for (vf =0 ; vf < numvfs; vf++) { - pcifunc = pf <<RVU_PFVF_PF_SHIFT | - ((vf +1 ) &RVU_PFVF_FUNC_MASK ); + pcifunc =rvu_make_pcifunc (rvu->pdev, pf, vf +1 );rvu_get_nix_blkaddr (rvu, pcifunc);/* Skip installimg rules if nixlf is not attached */
@@ -454,7 +453,7 @@ int rvu_mbox_handler_get_rep_cnt(struct rvu *rvu, struct msg_req *req,for (pf =0 ; pf < rvu->hw->total_pfs; pf++) {if (!is_pf_cgxmapped (rvu, pf))continue ; - pcifunc = pf <<RVU_PFVF_PF_SHIFT ; + pcifunc =rvu_make_pcifunc (rvu->pdev, pf,0 ); rvu->rep2pfvf_map[rep] = pcifunc; rsp->rep_pf_map[rep] = pcifunc; rep++;
drivers/net/ethernet/marvell/octeontx2/af/rvu_sdp.c +5 -5
@@ -17,9 +17,9 @@/* SDP PF number */ static int sdp_pf_num[MAX_SDP ] = {-1 ,-1 }; -bool is_sdp_pfvf (u16 pcifunc) +bool is_sdp_pfvf (struct rvu *rvu,u16 pcifunc) { -u16 pf =rvu_get_pf (pcifunc); +u16 pf =rvu_get_pf (rvu->pdev, pcifunc);u32 found =0 , i =0 ;while (i <MAX_SDP ) {
@@ -34,9 +34,9 @@ bool is_sdp_pfvf(u16 pcifunc)return true; } -bool is_sdp_pf (u16 pcifunc) +bool is_sdp_pf (struct rvu *rvu,u16 pcifunc) { -return (is_sdp_pfvf (pcifunc) && +return (is_sdp_pfvf (rvu, pcifunc) && !(pcifunc &RVU_PFVF_FUNC_MASK )); }
@@ -46,7 +46,7 @@ bool is_sdp_vf(struct rvu *rvu, u16 pcifunc)if (!(pcifunc & ~RVU_PFVF_FUNC_MASK ))return (rvu->vf_devid ==RVU_SDP_VF_DEVID ); -return (is_sdp_pfvf (pcifunc) && +return (is_sdp_pfvf (rvu, pcifunc) && !!(pcifunc &RVU_PFVF_FUNC_MASK )); }
drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c +4 -4
@@ -93,7 +93,7 @@ static int rvu_switch_install_rules(struct rvu *rvu)if (!is_pf_cgxmapped (rvu, pf))continue ; - pcifunc = pf <<10 ; + pcifunc =rvu_make_pcifunc (rvu->pdev, pf,0 );/* rvu_get_nix_blkaddr sets up the corresponding NIX block * address and NIX RX and TX interfaces for a pcifunc. * Generally it is called during attach call of a pcifunc but it
@@ -126,7 +126,7 @@ static int rvu_switch_install_rules(struct rvu *rvu)rvu_get_pf_numvfs (rvu, pf, &numvfs,NULL );for (vf =0 ; vf < numvfs; vf++) { - pcifunc = pf <<10 | ((vf +1 ) &0x3FF ); + pcifunc =rvu_make_pcifunc (rvu->pdev, pf, (vf +1 ));rvu_get_nix_blkaddr (rvu, pcifunc); err =rvu_switch_install_rx_rule (rvu, pcifunc,0x0 );
@@ -236,7 +236,7 @@ void rvu_switch_disable(struct rvu *rvu)if (!is_pf_cgxmapped (rvu, pf))continue ; - pcifunc = pf <<10 ; + pcifunc =rvu_make_pcifunc (rvu->pdev, pf,0 ); err =rvu_switch_install_rx_rule (rvu, pcifunc,0xFFF );if (err) dev_err(rvu->dev,
@@ -248,7 +248,7 @@ void rvu_switch_disable(struct rvu *rvu)rvu_get_pf_numvfs (rvu, pf, &numvfs,NULL );for (vf =0 ; vf < numvfs; vf++) { - pcifunc = pf <<10 | ((vf +1 ) &0x3FF ); + pcifunc =rvu_make_pcifunc (rvu->pdev, pf, (vf +1 )); err =rvu_switch_install_rx_rule (rvu, pcifunc,0xFFF );if (err) dev_err(rvu->dev,
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c +1 -1
@@ -481,7 +481,7 @@ static int cn10k_outb_write_sa(struct otx2_nic *pf, struct qmem *sa_info) goto set_available;/* Trigger CTX flush to write dirty data back to DRAM */ - reg_val =FIELD_PREP (CPT_LF_CTX_FLUSH , sa_iova >>7 ); + reg_val =FIELD_PREP (CPT_LF_CTX_FLUSH_CPTR , sa_iova >>7 );otx2_write64 (pf,CN10K_CPT_LF_CTX_FLUSH , reg_val); set_available:
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.h +1 -1
@@ -220,7 +220,7 @@ struct cpt_sg_s {#define CPT_LF_Q_SIZE_DIV40 GENMASK_ULL(14, 0)/* CPT LF CTX Flush Register */ -#define CPT_LF_CTX_FLUSH GENMASK_ULL(45, 0) +#define CPT_LF_CTX_FLUSH_CPTR GENMASK_ULL(45, 0)#ifdef CONFIG_XFRM_OFFLOAD int cn10k_ipsec_init (struct net_device *netdev);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -10
@@ -28,6 +28,7 @@#include "otx2_reg.h" #include "otx2_txrx.h" #include "otx2_devlink.h" +#include <rvu.h> #include <rvu_trace.h> #include "qos.h" #include "rep.h"
@@ -904,21 +905,11 @@ MBOX_UP_MCS_MESSAGES/* Time to wait before watchdog kicks off */ #define OTX2_TX_TIMEOUT (100 * HZ) -#define RVU_PFVF_PF_SHIFT 10 -#define RVU_PFVF_PF_MASK 0x3F -#define RVU_PFVF_FUNC_SHIFT 0 -#define RVU_PFVF_FUNC_MASK 0x3FF -static inline bool is_otx2_vf (u16 pcifunc) {return !!(pcifunc &RVU_PFVF_FUNC_MASK ); } -static inline int rvu_get_pf (u16 pcifunc) -{ -return (pcifunc >>RVU_PFVF_PF_SHIFT ) &RVU_PFVF_PF_MASK ; -} - static inline dma_addr_t otx2_dma_map_page(struct otx2_nic *pfvf, struct page *page, size_t offset, size_t size,
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +12 -9
@@ -206,7 +206,8 @@ static int otx2_register_flr_me_intr(struct otx2_nic *pf, int numvfs)/* Register ME interrupt handler*/ irq_name = &hw->irq_name[RVU_PF_INT_VEC_VFME0 *NAME_SIZE ]; -snprintf (irq_name,NAME_SIZE ,"RVUPF%d_ME0" ,rvu_get_pf (pf->pcifunc)); +snprintf (irq_name,NAME_SIZE ,"RVUPF%d_ME0" , +rvu_get_pf (pf->pdev, pf->pcifunc)); ret =request_irq (pci_irq_vector (pf->pdev,RVU_PF_INT_VEC_VFME0 ), otx2_pf_me_intr_handler,0 , irq_name, pf);if (ret) {
@@ -216,7 +217,8 @@ static int otx2_register_flr_me_intr(struct otx2_nic *pf, int numvfs)/* Register FLR interrupt handler */ irq_name = &hw->irq_name[RVU_PF_INT_VEC_VFFLR0 *NAME_SIZE ]; -snprintf (irq_name,NAME_SIZE ,"RVUPF%d_FLR0" ,rvu_get_pf (pf->pcifunc)); +snprintf (irq_name,NAME_SIZE ,"RVUPF%d_FLR0" , +rvu_get_pf (pf->pdev, pf->pcifunc)); ret =request_irq (pci_irq_vector (pf->pdev,RVU_PF_INT_VEC_VFFLR0 ), otx2_pf_flr_intr_handler,0 , irq_name, pf);if (ret) {
@@ -228,7 +230,7 @@ static int otx2_register_flr_me_intr(struct otx2_nic *pf, int numvfs)if (numvfs >64 ) { irq_name = &hw->irq_name[RVU_PF_INT_VEC_VFME1 *NAME_SIZE ];snprintf (irq_name,NAME_SIZE ,"RVUPF%d_ME1" , -rvu_get_pf (pf->pcifunc)); +rvu_get_pf (pf->pdev, pf->pcifunc)); ret =request_irq (pci_irq_vector (pf->pdev,RVU_PF_INT_VEC_VFME1 ), otx2_pf_me_intr_handler,0 , irq_name, pf);
@@ -238,7 +240,7 @@ static int otx2_register_flr_me_intr(struct otx2_nic *pf, int numvfs) } irq_name = &hw->irq_name[RVU_PF_INT_VEC_VFFLR1 *NAME_SIZE ];snprintf (irq_name,NAME_SIZE ,"RVUPF%d_FLR1" , -rvu_get_pf (pf->pcifunc)); +rvu_get_pf (pf->pdev, pf->pcifunc)); ret =request_irq (pci_irq_vector (pf->pdev,RVU_PF_INT_VEC_VFFLR1 ), otx2_pf_flr_intr_handler,0 , irq_name, pf);
@@ -700,7 +702,7 @@ static int otx2_register_pfvf_mbox_intr(struct otx2_nic *pf, int numvfs) irq_name = &hw->irq_name[RVU_PF_INT_VEC_VFPF_MBOX0 *NAME_SIZE ];if (pf->pcifunc)snprintf (irq_name,NAME_SIZE , -"RVUPF%d_VF Mbox0" ,rvu_get_pf (pf->pcifunc)); +"RVUPF%d_VF Mbox0" ,rvu_get_pf (pf->pdev, pf->pcifunc));else snprintf (irq_name,NAME_SIZE ,"RVUPF_VF Mbox0" ); err = request_irq(pci_irq_vector(pf->pdev, RVU_PF_INT_VEC_VFPF_MBOX0),
@@ -716,7 +718,8 @@ static int otx2_register_pfvf_mbox_intr(struct otx2_nic *pf, int numvfs) irq_name = &hw->irq_name[RVU_PF_INT_VEC_VFPF_MBOX1 *NAME_SIZE ];if (pf->pcifunc)snprintf (irq_name,NAME_SIZE , -"RVUPF%d_VF Mbox1" ,rvu_get_pf (pf->pcifunc)); +"RVUPF%d_VF Mbox1" , +rvu_get_pf (pf->pdev, pf->pcifunc));else snprintf (irq_name,NAME_SIZE ,"RVUPF_VF Mbox1" ); err = request_irq(pci_irq_vector(pf->pdev,
@@ -1971,7 +1974,7 @@ int otx2_open(struct net_device *netdev)if (err) {dev_err (pf->dev,"RVUPF%d: IRQ registration failed for QERR\n" , -rvu_get_pf (pf->pcifunc)); +rvu_get_pf (pf->pdev, pf->pcifunc)); goto err_disable_napi; }
@@ -1989,7 +1992,7 @@ int otx2_open(struct net_device *netdev)if (name_len >=NAME_SIZE ) {dev_err (pf->dev,"RVUPF%d: IRQ registration failed for CQ%d, irq name is too long\n" , -rvu_get_pf (pf->pcifunc), qidx); +rvu_get_pf (pf->pdev, pf->pcifunc), qidx); err = -EINVAL ; goto err_free_cints; }
@@ -2000,7 +2003,7 @@ int otx2_open(struct net_device *netdev)if (err) {dev_err (pf->dev,"RVUPF%d: IRQ registration failed for CQ%d\n" , -rvu_get_pf (pf->pcifunc), qidx); +rvu_get_pf (pf->pdev, pf->pcifunc), qidx); goto err_free_cints; } vec++;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h +0 -30
@@ -138,36 +138,6 @@#define NIX_LF_CINTX_ENA_W1S (a) (NIX_LFBASE | 0xD40 | (a) << 12)#define NIX_LF_CINTX_ENA_W1C (a) (NIX_LFBASE | 0xD50 | (a) << 12) -/* NIX AF transmit scheduler registers */ -#define NIX_AF_SMQX_CFG (a) (0x700 | (u64)(a) << 16) -#define NIX_AF_TL4X_SDP_LINK_CFG (a) (0xB10 | (u64)(a) << 16) -#define NIX_AF_TL1X_SCHEDULE (a) (0xC00 | (u64)(a) << 16) -#define NIX_AF_TL1X_CIR (a) (0xC20 | (u64)(a) << 16) -#define NIX_AF_TL1X_TOPOLOGY (a) (0xC80 | (u64)(a) << 16) -#define NIX_AF_TL2X_PARENT (a) (0xE88 | (u64)(a) << 16) -#define NIX_AF_TL2X_SCHEDULE (a) (0xE00 | (u64)(a) << 16) -#define NIX_AF_TL2X_TOPOLOGY (a) (0xE80 | (u64)(a) << 16) -#define NIX_AF_TL2X_CIR (a) (0xE20 | (u64)(a) << 16) -#define NIX_AF_TL2X_PIR (a) (0xE30 | (u64)(a) << 16) -#define NIX_AF_TL3X_PARENT (a) (0x1088 | (u64)(a) << 16) -#define NIX_AF_TL3X_SCHEDULE (a) (0x1000 | (u64)(a) << 16) -#define NIX_AF_TL3X_SHAPE (a) (0x1010 | (u64)(a) << 16) -#define NIX_AF_TL3X_CIR (a) (0x1020 | (u64)(a) << 16) -#define NIX_AF_TL3X_PIR (a) (0x1030 | (u64)(a) << 16) -#define NIX_AF_TL3X_TOPOLOGY (a) (0x1080 | (u64)(a) << 16) -#define NIX_AF_TL4X_PARENT (a) (0x1288 | (u64)(a) << 16) -#define NIX_AF_TL4X_SCHEDULE (a) (0x1200 | (u64)(a) << 16) -#define NIX_AF_TL4X_SHAPE (a) (0x1210 | (u64)(a) << 16) -#define NIX_AF_TL4X_CIR (a) (0x1220 | (u64)(a) << 16) -#define NIX_AF_TL4X_PIR (a) (0x1230 | (u64)(a) << 16) -#define NIX_AF_TL4X_TOPOLOGY (a) (0x1280 | (u64)(a) << 16) -#define NIX_AF_MDQX_SCHEDULE (a) (0x1400 | (u64)(a) << 16) -#define NIX_AF_MDQX_SHAPE (a) (0x1410 | (u64)(a) << 16) -#define NIX_AF_MDQX_CIR (a) (0x1420 | (u64)(a) << 16) -#define NIX_AF_MDQX_PIR (a) (0x1430 | (u64)(a) << 16) -#define NIX_AF_MDQX_PARENT (a) (0x1480 | (u64)(a) << 16) -#define NIX_AF_TL3_TL2X_LINKX_CFG (a, b) (0x1700 | (u64)(a) << 16 | (b) << 3) -/* LMT LF registers */ #define LMT_LFBASE BIT_ULL(RVU_FUNC_BLKADDR_SHIFT)#define LMT_LF_LMTLINEX (a) (LMT_LFBASE | 0x000 | (a) << 12)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +2 -1
@@ -467,7 +467,8 @@ static int otx2_tc_parse_actions(struct otx2_nic *nic, target = act->dev;if (target->dev.parent) { priv =netdev_priv (target); -if (rvu_get_pf (nic->pcifunc) !=rvu_get_pf (priv->pcifunc)) { +if (rvu_get_pf (nic->pdev, nic->pcifunc) != +rvu_get_pf (nic->pdev, priv->pcifunc)) {NL_SET_ERR_MSG_MOD (extack,"can't redirect to other pf/vf" );return -EOPNOTSUPP ;
drivers/net/ethernet/marvell/octeontx2/nic/rep.c +4 -3
@@ -244,10 +244,10 @@ static int rvu_rep_devlink_port_register(struct rep_dev *rep)if (!(rep->pcifunc &RVU_PFVF_FUNC_MASK )) { attrs.flavour =DEVLINK_PORT_FLAVOUR_PHYSICAL ; - attrs.phys.port_number =rvu_get_pf (rep->pcifunc); + attrs.phys.port_number =rvu_get_pf (priv->pdev, rep->pcifunc); }else { attrs.flavour =DEVLINK_PORT_FLAVOUR_PCI_VF ; - attrs.pci_vf.pf =rvu_get_pf (rep->pcifunc); + attrs.pci_vf.pf =rvu_get_pf (priv->pdev, rep->pcifunc); attrs.pci_vf.vf = rep->pcifunc &RVU_PFVF_FUNC_MASK ; }
@@ -672,7 +672,8 @@ int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack) rep->pcifunc = pcifunc;snprintf (ndev->name,sizeof (ndev->name),"Rpf%dvf%d" , -rvu_get_pf (pcifunc), (pcifunc &RVU_PFVF_FUNC_MASK )); +rvu_get_pf (priv->pdev, pcifunc), + (pcifunc &RVU_PFVF_FUNC_MASK )); ndev->hw_features = (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXHASH |
include/linux/soc/marvell/silicons.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only +* Copyright (C) 2024 Marvell. +*/ + +#ifndef __SOC_SILICON_H +#define __SOC_SILICON_H + +#include <linux/types.h> +#include <linux/pci.h> + +#if defined(CONFIG_ARM64 ) + +#define CN20K_CHIPID 0x20 +/* +* Silicon check for CN20K family +*/ +static inline bool is_cn20k (struct pci_dev *pdev) +{ +return (pdev->subsystem_device &0xFF ) ==CN20K_CHIPID ; +} +#else +#define is_cn20k (pdev) ((void)(pdev), 0) +#endif + +#endif /* __SOC_SILICON_H */
Signature · 1 line
2.7.4
Subbaraya Sundeep
maintainerPATCH v11 2/6 octeontx2-af: CN20k basic mbox operations and structures
In reply to Subbaraya SundeepFrom: Sai Krishna <[email protected]>
This patch adds basic mbox operation APIs and structures to add support for mbox module on CN20k silicon. There are few CSR offsets, interrupts changed between CN20k and prior Octeon series of devices.
--- drivers/net/ethernet/marvell/octeontx2/af/Makefile | 2 +- .../net/ethernet/marvell/octeontx2/af/cn20k/api.h | 23 ++++++ .../marvell/octeontx2/af/cn20k/mbox_init.c | 95 ++++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/cn20k/reg.h | 27 ++++++ drivers/net/ethernet/marvell/octeontx2/af/mbox.c | 3 + drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 7 ++ drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 76 ++++++++++++++--- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 10 +++ .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 6 +- 9 files changed, 234 insertions(+), 15 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/api.h create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/reg.h
drivers/net/ethernet/marvell/octeontx2/af/Makefile +1 -1
@@ -12,4 +12,4 @@ rvu_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \ rvu_reg.o rvu_npc.o rvu_debugfs.o ptp.o rvu_npc_fs.o \ rvu_cpt.o rvu_devlink.o rpm.o rvu_cn10k.o rvu_switch.o \ rvu_sdp.o rvu_npc_hash.o mcs.o mcs_rvu_if.o mcs_cnf10kb.o \ - rvu_rep.o + rvu_rep.o cn20k/mbox_init.o
drivers/net/ethernet/marvell/octeontx2/af/cn20k/api.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Marvell RVU Admin Function driver +* +* Copyright (C) 2024 Marvell. +* +*/ + +#ifndef CN20K_API_H +#define CN20K_API_H + +#include "../rvu.h" + +struct ng_rvu { +struct mbox_ops *rvu_mbox_ops; +struct qmem *pf_mbox_addr; +}; + +/* Mbox related APIs */ +int cn20k_rvu_mbox_init (struct rvu *rvu,int type,int num); +int cn20k_rvu_get_mbox_regions (struct rvu *rvu,void **mbox_addr, +int num,int type,unsigned long *pf_bmap); +void cn20k_free_mbox_memory (struct rvu *rvu); +#endif /* CN20K_API_H */
drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c new file +95 -0
95 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/cn20k/reg.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Marvell RVU Admin Function driver +* +* Copyright (C) 2024 Marvell. +* +*/ + +#ifndef RVU_MBOX_REG_H +#define RVU_MBOX_REG_H +#include "../rvu.h" +#include "../rvu_reg.h" + +/* RVUM block registers */ +#define RVU_PF_DISC (0x0) +#define RVU_PRIV_PFX_DISC (a) (0x8000208 | (a) << 16) +#define RVU_PRIV_HWVFX_DISC (a) (0xD000000 | (a) << 12) + +/* Mbox Registers */ +/* RVU AF BAR0 Mbox registers for AF => PFx */ +#define RVU_MBOX_AF_PFX_ADDR (a) (0x5000 | (a) << 4) +#define RVU_MBOX_AF_PFX_CFG (a) (0x6000 | (a) << 4) +#define RVU_AF_BAR2_SEL (0x9000000) +#define RVU_AF_BAR2_PFID (0x16400) +#define NIX_CINTX_INT_W1S (a) (0xd30 | (a) << 12) +#define NIX_QINTX_CNT (a) (0xc00 | (a) << 12) + +#endif /* RVU_MBOX_REG_H */
drivers/net/ethernet/marvell/octeontx2/af/mbox.c +3 -0
@@ -10,8 +10,11 @@#include <linux/pci.h> #include "rvu_reg.h" +#include "cn20k/reg.h" +#include "cn20k/api.h" #include "mbox.h" #include "rvu_trace.h" +#include "rvu.h" static const u16 msgs_offset =ALIGN (sizeof (struct mbox_hdr ),MBOX_MSG_ALIGN );
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +7 -0
@@ -50,6 +50,11 @@#define MBOX_DIR_PFVF_UP 6/* PF sends messages to VF */ #define MBOX_DIR_VFPF_UP 7/* VF replies to PF */ +enum { +TYPE_AFVF , +TYPE_AFPF , +}; +struct otx2_mbox_dev {void *mbase;/* This dev's mbox region */ void *hwbase;
@@ -78,6 +83,8 @@ struct otx2_mbox {struct mbox_hdr {u64 msg_size;/* Total msgs size embedded */ u16 num_msgs;/* No of msgs embedded */ +u16 opt_msg; +u8 sig; };/* Header which precedes every msg and is also part of it */
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +64 -12
170 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +10 -0
@@ -471,6 +471,10 @@ struct mbox_wq_info {struct workqueue_struct *mbox_wq; }; +struct mbox_ops { +irqreturn_t (*pf_intr_handler)(int irq,void *rvu_irq); +}; +struct channel_fwdata {struct sdp_node_info info;u8 valid;
@@ -636,6 +640,8 @@ struct rvu {struct list_head rep_evtq_head;/* Representor event lock */ spinlock_t rep_evtq_lock; + +struct ng_rvu *ng_rvu; };static inline void rvu_write64 (struct rvu *rvu,u64 block,u64 offset,u64 val)
@@ -935,6 +941,10 @@ int rvu_mbox_handler_ ## fn_name(struct rvu *, struct req *, struct rsp *); MBOX_MESSAGES#undef M +/* Mbox APIs */ +void rvu_queue_work (struct mbox_wq_info *mw,int first, +int mdevs,u64 intr); +int rvu_cgx_init (struct rvu *rvu);int rvu_cgx_exit (struct rvu *rvu);void *rvu_cgx_pdata (u8 cgx_id,struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h +4 -2
@@ -33,7 +33,8 @@ enum rvu_block_addr_e {BLKADDR_NDC_NIX1_RX =0x10ULL ,BLKADDR_NDC_NIX1_TX =0x11ULL ,BLKADDR_APR =0x16ULL , - BLK_COUNT = 0x17ULL, +BLKADDR_MBOX =0x1bULL , + BLK_COUNT = 0x1cULL, };/* RVU Block Type Enumeration */
@@ -49,7 +50,8 @@ enum rvu_block_type_e {BLKTYPE_TIM =0x8 ,BLKTYPE_CPT =0x9 ,BLKTYPE_NDC =0xa , - BLKTYPE_MAX = 0xa, +BLKTYPE_MBOX =0x13 , + BLKTYPE_MAX = 0x13, };/* RVU Admin function Interrupt Vector Enumeration */
Signature · 1 line
2.7.4
Subbaraya Sundeep
maintainerPATCH v11 3/6 octeontx2-af: CN20k mbox to support AF REQ/ACK functionality
In reply to Subbaraya SundeepFrom: Sai Krishna <[email protected]>
This implementation uses separate trigger interrupts for request, response MBOX messages against using trigger message data in CN10K. This patch adds support for basic mbox implementation for CN20K from AF side.
--- .../net/ethernet/marvell/octeontx2/af/cn20k/api.h | 5 + .../marvell/octeontx2/af/cn20k/mbox_init.c | 172 +++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/cn20k/reg.h | 17 ++ .../ethernet/marvell/octeontx2/af/cn20k/struct.h | 25 +++ drivers/net/ethernet/marvell/octeontx2/af/mbox.c | 83 +++++++++- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 1 + drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 57 +++++-- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 16 +- 8 files changed, 358 insertions(+), 18 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/struct.h
drivers/net/ethernet/marvell/octeontx2/af/cn20k/api.h +5 -0
@@ -20,4 +20,9 @@ int cn20k_rvu_mbox_init(struct rvu *rvu, int type, int num);int cn20k_rvu_get_mbox_regions (struct rvu *rvu,void **mbox_addr,int num,int type,unsigned long *pf_bmap);void cn20k_free_mbox_memory (struct rvu *rvu); +int cn20k_register_afpf_mbox_intr (struct rvu *rvu); +void cn20k_rvu_enable_mbox_intr (struct rvu *rvu); +void cn20k_rvu_unregister_interrupts (struct rvu *rvu); +int cn20k_mbox_setup (struct otx2_mbox *mbox,struct pci_dev *pdev, +void *reg_base,int direction,int ndevs);#endif /* CN20K_API_H */
drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c +172 -0
193 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/cn20k/reg.h +17 -0
@@ -19,6 +19,23 @@/* RVU AF BAR0 Mbox registers for AF => PFx */ #define RVU_MBOX_AF_PFX_ADDR (a) (0x5000 | (a) << 4)#define RVU_MBOX_AF_PFX_CFG (a) (0x6000 | (a) << 4) +#define RVU_MBOX_AF_AFPFX_TRIGX (a) (0x9000 | (a) << 3) +#define RVU_MBOX_AF_PFAF_INT (a) (0x2980 | (a) << 6) +#define RVU_MBOX_AF_PFAF_INT_W1S (a) (0x2988 | (a) << 6) +#define RVU_MBOX_AF_PFAF_INT_ENA_W1S (a) (0x2990 | (a) << 6) +#define RVU_MBOX_AF_PFAF_INT_ENA_W1C (a) (0x2998 | (a) << 6) +#define RVU_MBOX_AF_PFAF1_INT (a) (0x29A0 | (a) << 6) +#define RVU_MBOX_AF_PFAF1_INT_W1S (a) (0x29A8 | (a) << 6) +#define RVU_MBOX_AF_PFAF1_INT_ENA_W1S (a) (0x29B0 | (a) << 6) +#define RVU_MBOX_AF_PFAF1_INT_ENA_W1C (a) (0x29B8 | (a) << 6) + +/* RVU PF => AF mbox registers */ +#define RVU_MBOX_PF_PFAF_TRIGX (a) (0xC00 | (a) << 3) +#define RVU_MBOX_PF_INT (0xC20) +#define RVU_MBOX_PF_INT_W1S (0xC28) +#define RVU_MBOX_PF_INT_ENA_W1S (0xC30) +#define RVU_MBOX_PF_INT_ENA_W1C (0xC38) +#define RVU_AF_BAR2_SEL (0x9000000)#define RVU_AF_BAR2_PFID (0x16400)#define NIX_CINTX_INT_W1S (a) (0xd30 | (a) << 12)
drivers/net/ethernet/marvell/octeontx2/af/cn20k/struct.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Marvell RVU Admin Function driver +* +* Copyright (C) 2024 Marvell. +* +*/ + +#ifndef STRUCT_H +#define STRUCT_H + +/* RVU Admin function Interrupt Vector Enumeration */ +enum rvu_af_cn20k_int_vec_e { +RVU_AF_CN20K_INT_VEC_POISON =0x0 , +RVU_AF_CN20K_INT_VEC_PFFLR0 =0x1 , +RVU_AF_CN20K_INT_VEC_PFFLR1 =0x2 , +RVU_AF_CN20K_INT_VEC_PFME0 =0x3 , +RVU_AF_CN20K_INT_VEC_PFME1 =0x4 , +RVU_AF_CN20K_INT_VEC_GEN =0x5 , +RVU_AF_CN20K_INT_VEC_PFAF_MBOX0 =0x6 , +RVU_AF_CN20K_INT_VEC_PFAF_MBOX1 =0x7 , +RVU_AF_CN20K_INT_VEC_PFAF1_MBOX0 =0x8 , +RVU_AF_CN20K_INT_VEC_PFAF1_MBOX1 =0x9 , +RVU_AF_CN20K_INT_VEC_CNT =0xa , +}; +#endif
drivers/net/ethernet/marvell/octeontx2/af/mbox.c +81 -2
124 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +1 -0
@@ -13,6 +13,7 @@#include "rvu_struct.h" #include "common.h" +#include "cn20k/struct.h" #define MBOX_SIZE SZ_64K
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +42 -15
88 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +15 -1
@@ -73,7 +73,10 @@ static inline int rvu_pcifunc_pf_mask(struct pci_dev *pdev)return ~(RVU_OTX2_PFVF_PF_MASK <<RVU_OTX2_PFVF_PF_SHIFT ); } +#define RVU_AFPF 25 + #ifdef CONFIG_DEBUG_FS + struct dump_ctx { int lf; int id;
@@ -471,6 +474,16 @@ struct mbox_wq_info {struct workqueue_struct *mbox_wq; }; +struct rvu_irq_data { +u64 intr_status; +void (*rvu_queue_work_hdlr)(struct mbox_wq_info *mw,int first, +int mdevs,u64 intr); +struct rvu *rvu; +int vec_num; +int start; +int mdevs; +}; +struct mbox_ops {irqreturn_t (*pf_intr_handler)(int irq,void *rvu_irq); };
@@ -999,7 +1012,8 @@ int rvu_nix_mcast_get_mce_index(struct rvu *rvu, u16 pcifunc,int rvu_nix_mcast_update_mcam_entry (struct rvu *rvu,u16 pcifunc,u32 mcast_grp_idx,u16 mcam_index);void rvu_nix_flr_free_bpids (struct rvu *rvu,u16 pcifunc); - +int rvu_alloc_cint_qint_mem (struct rvu *rvu,struct rvu_pfvf *pfvf, +int blkaddr,int nixlf);/* NPC APIs */ void rvu_npc_freemem (struct rvu *rvu);int rvu_npc_get_pkind (struct rvu *rvu,u16 pf);
Signature · 1 line
2.7.4
Subbaraya Sundeep
maintainerPATCH v11 4/6 octeontx2-pf: CN20K mbox REQ/ACK implementation for NIC PF
In reply to Subbaraya SundeepFrom: Sai Krishna <[email protected]>
This implementation uses separate trigger interrupts for request, response messages against using trigger message data in CN10K. This patch adds support for basic mbox implementation for CN20K from NIC PF side.
--- .../ethernet/marvell/octeontx2/af/cn20k/struct.h | 15 ++++ .../net/ethernet/marvell/octeontx2/nic/Makefile | 2 +- drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 18 +++-- drivers/net/ethernet/marvell/octeontx2/nic/cn10k.h | 1 + drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c | 63 +++++++++++++++++ drivers/net/ethernet/marvell/octeontx2/nic/cn20k.h | 14 ++++ .../ethernet/marvell/octeontx2/nic/otx2_common.h | 5 ++ .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 80 +++++++++++++++++----- .../net/ethernet/marvell/octeontx2/nic/otx2_reg.h | 4 ++ .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 6 ++ 10 files changed, 186 insertions(+), 22 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/cn20k.h
drivers/net/ethernet/marvell/octeontx2/af/cn20k/struct.h +15 -0
@@ -8,6 +8,21 @@#ifndef STRUCT_H #define STRUCT_H +/* +* CN20k RVU PF MBOX Interrupt Vector Enumeration +* +* Vectors 0 - 3 are compatible with pre cn20k and hence +* existing macros are being reused. +*/ +enum rvu_mbox_pf_int_vec_e { +RVU_MBOX_PF_INT_VEC_VFPF_MBOX0 =0x4 , +RVU_MBOX_PF_INT_VEC_VFPF_MBOX1 =0x5 , +RVU_MBOX_PF_INT_VEC_VFPF1_MBOX0 =0x6 , +RVU_MBOX_PF_INT_VEC_VFPF1_MBOX1 =0x7 , +RVU_MBOX_PF_INT_VEC_AFPF_MBOX =0x8 , +RVU_MBOX_PF_INT_VEC_CNT =0x9 , +}; +/* RVU Admin function Interrupt Vector Enumeration */ enum rvu_af_cn20k_int_vec_e { RVU_AF_CN20K_INT_VEC_POISON = 0x0,
drivers/net/ethernet/marvell/octeontx2/nic/Makefile +1 -1
@@ -8,7 +8,7 @@ obj-$(CONFIG_OCTEONTX2_VF) += rvu_nicvf.o otx2_ptp.o obj-$(CONFIG_RVU_ESWITCH) += rvu_rep.o rvu_nicpf-y := otx2_pf.o otx2_common.o otx2_txrx.o otx2_ethtool.o \ - otx2_flows.o otx2_tc.o cn10k.o otx2_dmac_flt.o \ + otx2_flows.o otx2_tc.o cn10k.o cn20k.o otx2_dmac_flt.o \ otx2_devlink.o qos_sq.o qos.o otx2_xsk.o rvu_nicvf-y := otx2_vf.o rvu_rep-y := rep.o
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c +14 -4
@@ -14,6 +14,7 @@ static struct dev_hw_ops otx2_hw_ops = { .sqe_flush = otx2_sqe_flush, .aura_freeptr = otx2_aura_freeptr, .refill_pool_ptrs = otx2_refill_pool_ptrs, + .pfaf_mbox_intr_handler = otx2_pfaf_mbox_intr_handler, };static struct dev_hw_ops cn10k_hw_ops = {
@@ -21,8 +22,20 @@ static struct dev_hw_ops cn10k_hw_ops = { .sqe_flush = cn10k_sqe_flush, .aura_freeptr = cn10k_aura_freeptr, .refill_pool_ptrs = cn10k_refill_pool_ptrs, + .pfaf_mbox_intr_handler = otx2_pfaf_mbox_intr_handler, }; +void otx2_init_hw_ops (struct otx2_nic *pfvf) +{ +if (!test_bit (CN10K_LMTST , &pfvf->hw.cap_flag)) { + pfvf->hw_ops = &otx2_hw_ops; +return ; + } + + pfvf->hw_ops = &cn10k_hw_ops; +} +EXPORT_SYMBOL (otx2_init_hw_ops); +int cn10k_lmtst_init (struct otx2_nic *pfvf) {
@@ -30,12 +43,9 @@ int cn10k_lmtst_init(struct otx2_nic *pfvf)struct otx2_lmt_info *lmt_info;int err, cpu; -if (!test_bit (CN10K_LMTST , &pfvf->hw.cap_flag)) { - pfvf->hw_ops = &otx2_hw_ops; +if (!test_bit (CN10K_LMTST , &pfvf->hw.cap_flag))return 0 ; - } - pfvf->hw_ops = &cn10k_hw_ops;/* Total LMTLINES = num_online_cpus() * 32 (For Burst flush).*/ pfvf->tot_lmt_lines = (num_online_cpus () *LMT_BURST_SIZE ); pfvf->hw.lmt_info = alloc_percpu(struct otx2_lmt_info);
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.h +1 -0
@@ -39,4 +39,5 @@ int cn10k_alloc_leaf_profile(struct otx2_nic *pfvf, u16 *leaf);int cn10k_set_ipolicer_rate (struct otx2_nic *pfvf,u16 profile,u32 burst,u64 rate,bool pps);int cn10k_free_leaf_profile (struct otx2_nic *pfvf,u16 leaf); +void otx2_init_hw_ops (struct otx2_nic *pfvf);#endif /* CN10K_H */
drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c new file +63 -0
63 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/cn20k.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Marvell RVU Ethernet driver +* +* Copyright (C) 2024 Marvell. +* +*/ + +#ifndef CN20K_H +#define CN20K_H + +#include "otx2_common.h" + +void cn20k_init (struct otx2_nic *pfvf); +#endif /* CN20K_H */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +5 -0
@@ -33,6 +33,7 @@#include "qos.h" #include "rep.h" #include "cn10k_ipsec.h" +#include "cn20k.h" /* IPv4 flag more fragment bit */ #define IPV4_FLAG_MORE 0x20
@@ -62,6 +63,9 @@/* Number of segments per SG structure */ #define MAX_SEGS_PER_SG 3 +irqreturn_t otx2_pfaf_mbox_intr_handler (int irq,void *pf_irq); +irqreturn_t cn20k_pfaf_mbox_intr_handler (int irq,void *pf_irq); +enum arua_mapped_qtypes {AURA_NIX_RQ ,AURA_NIX_SQ ,
@@ -367,6 +371,7 @@ struct dev_hw_ops { int size, int qidx);int (*refill_pool_ptrs)(void *dev,struct otx2_cq_queue *cq);void (*aura_freeptr)(void *dev,int aura,u64 buf); +irqreturn_t (*pfaf_mbox_intr_handler)(int irq,void *pf_irq); };#define CN10K_MCS_SA_PER_SC 4
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +63 -17
131 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h +4 -0
@@ -58,6 +58,10 @@#define RVU_VF_MSIX_PBAX (a) (0xF0000 | (a) << 3)#define RVU_VF_MBOX_REGION (0xC0000) +/* CN20K RVU_MBOX_E: RVU PF/VF MBOX Address Range Enumeration */ +#define RVU_MBOX_AF_PFX_ADDR (a) (0x5000 | (a) << 4) +#define RVU_PFX_FUNC_PFAF_MBOX (0x80000) +#define RVU_FUNC_BLKADDR_SHIFT 20#define RVU_FUNC_BLKADDR_MASK 0x1FULL
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +6 -0
@@ -616,6 +616,12 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) }otx2_setup_dev_hw_settings (vf); + +if (is_cn20k (vf->pdev)) +cn20k_init (vf); +else +otx2_init_hw_ops (vf); +/* Init VF <=> PF mailbox stuff */ err =otx2vf_vfaf_mbox_init (vf);if (err)
Signature · 1 line
2.7.4
Subbaraya Sundeep
maintainerPATCH v11 5/6 octeontx2-af: CN20K mbox implementation for AF's VF
In reply to Subbaraya SundeepFrom: Sai Krishna <[email protected]>
This patch implements the CN20k MBOX communication between AF and AF's VFs. This implementation uses separate trigger interrupts for request, response messages against using trigger message data in CN10K.
--- .../net/ethernet/marvell/octeontx2/af/cn20k/api.h | 4 + .../marvell/octeontx2/af/cn20k/mbox_init.c | 163 ++++++++++++++++++++- .../net/ethernet/marvell/octeontx2/af/cn20k/reg.h | 37 +++++ drivers/net/ethernet/marvell/octeontx2/af/mbox.c | 20 +++ drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 67 +++++---- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 3 + drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c | 47 ++++++ .../ethernet/marvell/octeontx2/nic/otx2_common.h | 17 +++ .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 6 +- .../net/ethernet/marvell/octeontx2/nic/otx2_reg.h | 15 ++ .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 38 ++++- 11 files changed, 380 insertions(+), 37 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cn20k/api.h +4 -0
@@ -13,6 +13,7 @@struct ng_rvu {struct mbox_ops *rvu_mbox_ops;struct qmem *pf_mbox_addr; +struct qmem *vf_mbox_addr; };/* Mbox related APIs */
@@ -21,8 +22,11 @@ int cn20k_rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr, int num, int type, unsigned long *pf_bmap);void cn20k_free_mbox_memory (struct rvu *rvu);int cn20k_register_afpf_mbox_intr (struct rvu *rvu); +int cn20k_register_afvf_mbox_intr (struct rvu *rvu,int pf_vec_start);void cn20k_rvu_enable_mbox_intr (struct rvu *rvu);void cn20k_rvu_unregister_interrupts (struct rvu *rvu);int cn20k_mbox_setup (struct otx2_mbox *mbox,struct pci_dev *pdev,void *reg_base,int direction,int ndevs); +void cn20k_rvu_enable_afvf_intr (struct rvu *rvu,int vfs); +void cn20k_rvu_disable_afvf_intr (struct rvu *rvu,int vfs);#endif /* CN20K_API_H */
drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c +160 -3
205 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/cn20k/reg.h +37 -0
@@ -41,4 +41,41 @@#define NIX_CINTX_INT_W1S (a) (0xd30 | (a) << 12)#define NIX_QINTX_CNT (a) (0xc00 | (a) << 12) +#define RVU_MBOX_AF_VFAF_INT (a) (0x3000 | (a) << 6) +#define RVU_MBOX_AF_VFAF_INT_W1S (a) (0x3008 | (a) << 6) +#define RVU_MBOX_AF_VFAF_INT_ENA_W1S (a) (0x3010 | (a) << 6) +#define RVU_MBOX_AF_VFAF_INT_ENA_W1C (a) (0x3018 | (a) << 6) +#define RVU_MBOX_AF_VFAF_INT_ENA_W1C (a) (0x3018 | (a) << 6) +#define RVU_MBOX_AF_VFAF1_INT (a) (0x3020 | (a) << 6) +#define RVU_MBOX_AF_VFAF1_INT_W1S (a) (0x3028 | (a) << 6) +#define RVU_MBOX_AF_VFAF1_IN_ENA_W1S (a) (0x3030 | (a) << 6) +#define RVU_MBOX_AF_VFAF1_IN_ENA_W1C (a) (0x3038 | (a) << 6) + +#define RVU_MBOX_AF_AFVFX_TRIG (a, b) (0x10000 | (a) << 4 | (b) << 3) +#define RVU_MBOX_AF_VFX_ADDR (a) (0x20000 | (a) << 4) +#define RVU_MBOX_AF_VFX_CFG (a) (0x28000 | (a) << 4) + +#define RVU_MBOX_PF_VFX_PFVF_TRIGX (a) (0x2000 | (a) << 3) + +#define RVU_MBOX_PF_VFPF_INTX (a) (0x1000 | (a) << 3) +#define RVU_MBOX_PF_VFPF_INT_W1SX (a) (0x1020 | (a) << 3) +#define RVU_MBOX_PF_VFPF_INT_ENA_W1SX (a) (0x1040 | (a) << 3) +#define RVU_MBOX_PF_VFPF_INT_ENA_W1CX (a) (0x1060 | (a) << 3) + +#define RVU_MBOX_PF_VFPF1_INTX (a) (0x1080 | (a) << 3) +#define RVU_MBOX_PF_VFPF1_INT_W1SX (a) (0x10a0 | (a) << 3) +#define RVU_MBOX_PF_VFPF1_INT_ENA_W1SX (a) (0x10c0 | (a) << 3) +#define RVU_MBOX_PF_VFPF1_INT_ENA_W1CX (a) (0x10e0 | (a) << 3) + +#define RVU_MBOX_PF_VF_ADDR (0xC40) +#define RVU_MBOX_PF_LMTLINE_ADDR (0xC48) +#define RVU_MBOX_PF_VF_CFG (0xC60) + +#define RVU_MBOX_VF_VFPF_TRIGX (a) (0x3000 | (a) << 3) +#define RVU_MBOX_VF_INT (0x20) +#define RVU_MBOX_VF_INT_W1S (0x28) +#define RVU_MBOX_VF_INT_ENA_W1S (0x30) +#define RVU_MBOX_VF_INT_ENA_W1C (0x38) + +#define RVU_MBOX_VF_VFAF_TRIGX (a) (0x2000 | (a) << 3)#endif /* RVU_MBOX_REG_H */
drivers/net/ethernet/marvell/octeontx2/af/mbox.c +20 -0
@@ -63,24 +63,28 @@ int cn20k_mbox_setup(struct otx2_mbox *mbox, struct pci_dev *pdev, {switch (direction) {case MBOX_DIR_AFPF : +case MBOX_DIR_PFVF : mbox->tx_start =MBOX_DOWN_TX_START ; mbox->rx_start =MBOX_DOWN_RX_START ; mbox->tx_size =MBOX_DOWN_TX_SIZE ; mbox->rx_size =MBOX_DOWN_RX_SIZE ;break ;case MBOX_DIR_PFAF : +case MBOX_DIR_VFPF : mbox->tx_start =MBOX_DOWN_RX_START ; mbox->rx_start =MBOX_DOWN_TX_START ; mbox->tx_size =MBOX_DOWN_RX_SIZE ; mbox->rx_size =MBOX_DOWN_TX_SIZE ;break ;case MBOX_DIR_AFPF_UP : +case MBOX_DIR_PFVF_UP : mbox->tx_start =MBOX_UP_TX_START ; mbox->rx_start =MBOX_UP_RX_START ; mbox->tx_size =MBOX_UP_TX_SIZE ; mbox->rx_size =MBOX_UP_RX_SIZE ;break ;case MBOX_DIR_PFAF_UP : +case MBOX_DIR_VFPF_UP : mbox->tx_start =MBOX_UP_RX_START ; mbox->rx_start =MBOX_UP_TX_START ; mbox->tx_size =MBOX_UP_RX_SIZE ;
@@ -107,6 +111,22 @@ int cn20k_mbox_setup(struct otx2_mbox *mbox, struct pci_dev *pdev, mbox->trigger =RVU_MBOX_PF_PFAF_TRIGX (1 ); mbox->tr_shift =0 ;break ; +case MBOX_DIR_PFVF : + mbox->trigger =RVU_MBOX_PF_VFX_PFVF_TRIGX (1 ); + mbox->tr_shift =4 ; +break ; +case MBOX_DIR_PFVF_UP : + mbox->trigger =RVU_MBOX_PF_VFX_PFVF_TRIGX (0 ); + mbox->tr_shift =4 ; +break ; +case MBOX_DIR_VFPF : + mbox->trigger =RVU_MBOX_VF_VFPF_TRIGX (0 ); + mbox->tr_shift =0 ; +break ; +case MBOX_DIR_VFPF_UP : + mbox->trigger =RVU_MBOX_VF_VFPF_TRIGX (1 ); + mbox->tr_shift =0 ; +break ;default :return -ENODEV ; }
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +42 -25
100 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +3 -0
@@ -478,6 +478,8 @@ struct rvu_irq_data {u64 intr_status;void (*rvu_queue_work_hdlr)(struct mbox_wq_info *mw,int first,int mdevs,u64 intr); +void (*afvf_queue_work_hdlr)(struct mbox_wq_info *mw,int first, +int mdevs,u64 intr);struct rvu *rvu;int vec_num;int start;
@@ -486,6 +488,7 @@ struct rvu_irq_data {struct mbox_ops {irqreturn_t (*pf_intr_handler)(int irq,void *rvu_irq); +irqreturn_t (*afvf_intr_handler)(int irq,void *rvu_irq); };struct channel_fwdata {
drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c +47 -0
56 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +17 -0
@@ -65,6 +65,8 @@irqreturn_t otx2_pfaf_mbox_intr_handler (int irq,void *pf_irq);irqreturn_t cn20k_pfaf_mbox_intr_handler (int irq,void *pf_irq); +irqreturn_t cn20k_vfaf_mbox_intr_handler (int irq,void *vf_irq); +irqreturn_t otx2_pfvf_mbox_intr_handler (int irq,void *pf_irq);enum arua_mapped_qtypes {AURA_NIX_RQ ,
@@ -250,6 +252,7 @@ struct otx2_hw {u16 nix_msixoff;/* Offset of NIX vectors */ char *irq_name;cpumask_var_t *affinity_mask; +struct pf_irq_data *pfvf_irq_devid[4 ];/* Stats */ struct otx2_dev_stats dev_stats;
@@ -372,6 +375,7 @@ struct dev_hw_ops {int (*refill_pool_ptrs)(void *dev,struct otx2_cq_queue *cq);void (*aura_freeptr)(void *dev,int aura,u64 buf);irqreturn_t (*pfaf_mbox_intr_handler)(int irq,void *pf_irq); +irqreturn_t (*vfaf_mbox_intr_handler)(int irq,void *pf_irq); };#define CN10K_MCS_SA_PER_SC 4
@@ -439,6 +443,16 @@ struct cn10k_mcs_cfg {struct list_head rxsc_list; }; +struct pf_irq_data { +u64 intr_status; +void (*pf_queue_work_hdlr)(struct mbox *mb,struct workqueue_struct *mw, +int first,int mdevs,u64 intr); +struct otx2_nic *pf; +int vec_num; +int start; +int mdevs; +}; +struct otx2_nic {void __iomem *reg_base;struct net_device *netdev;
@@ -482,6 +496,7 @@ struct otx2_nic {struct mbox *mbox_pfvf;struct workqueue_struct *mbox_wq;struct workqueue_struct *mbox_pfvf_wq; +struct qmem *pfvf_mbox_addr;u8 total_vfs;u16 pcifunc;/* RVU PF_FUNC */
@@ -1192,4 +1207,6 @@ dma_addr_t otx2_dma_map_skb_frag(struct otx2_nic *pfvf, struct sk_buff *skb, int seg, int *len);void otx2_dma_unmap_skb_frags (struct otx2_nic *pfvf,struct sg_list *sg);int otx2_read_free_sqe (struct otx2_nic *pfvf,u16 qidx); +void otx2_queue_vf_work (struct mbox *mw,struct workqueue_struct *mbox_wq, +int first,int mdevs,u64 intr);#endif /* OTX2_COMMON_H */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +3 -3
@@ -296,8 +296,8 @@ static int otx2_pf_flr_init(struct otx2_nic *pf, int num_vfs)return 0 ; } -static void otx2_queue_vf_work (struct mbox *mw,struct workqueue_struct *mbox_wq, -int first,int mdevs,u64 intr) +void otx2_queue_vf_work (struct mbox *mw,struct workqueue_struct *mbox_wq, +int first,int mdevs,u64 intr) {struct otx2_mbox_dev *mdev;struct otx2_mbox *mbox;
@@ -547,7 +547,7 @@ static void otx2_pfvf_mbox_up_handler(struct work_struct *work) } } -static irqreturn_t otx2_pfvf_mbox_intr_handler (int irq,void *pf_irq) +irqreturn_t otx2_pfvf_mbox_intr_handler (int irq,void *pf_irq) {struct otx2_nic *pf = (struct otx2_nic *)(pf_irq);int vfs = pf->total_vfs;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h +15 -0
@@ -44,6 +44,17 @@#define RVU_PF_VF_MBOX_ADDR (0xC40)#define RVU_PF_LMTLINE_ADDR (0xC48) +#define RVU_MBOX_PF_VFX_PFVF_TRIGX (a) (0x2000 | (a) << 3) +#define RVU_MBOX_PF_VFPF_INTX (a) (0x1000 | (a) << 3) +#define RVU_MBOX_PF_VFPF_INT_W1SX (a) (0x1020 | (a) << 3) +#define RVU_MBOX_PF_VFPF_INT_ENA_W1SX (a) (0x1040 | (a) << 3) +#define RVU_MBOX_PF_VFPF_INT_ENA_W1CX (a) (0x1060 | (a) << 3) + +#define RVU_MBOX_PF_VFPF1_INTX (a) (0x1080 | (a) << 3) +#define RVU_MBOX_PF_VFPF1_INT_W1SX (a) (0x10a0 | (a) << 3) +#define RVU_MBOX_PF_VFPF1_INT_ENA_W1SX (a) (0x10c0 | (a) << 3) +#define RVU_MBOX_PF_VFPF1_INT_ENA_W1CX (a) (0x10e0 | (a) << 3) +/* RVU VF registers */ #define RVU_VF_VFPF_MBOX0 (0x00000)#define RVU_VF_VFPF_MBOX1 (0x00008)
@@ -61,6 +72,7 @@/* CN20K RVU_MBOX_E: RVU PF/VF MBOX Address Range Enumeration */ #define RVU_MBOX_AF_PFX_ADDR (a) (0x5000 | (a) << 4)#define RVU_PFX_FUNC_PFAF_MBOX (0x80000) +#define RVU_PFX_FUNCX_VFAF_MBOX (0x40000)#define RVU_FUNC_BLKADDR_SHIFT 20#define RVU_FUNC_BLKADDR_MASK 0x1FULL
@@ -147,4 +159,7 @@#define LMT_LF_LMTLINEX (a) (LMT_LFBASE | 0x000 | (a) << 12)#define LMT_LF_LMTCANCEL (LMT_LFBASE | 0x400) +/* CN20K registers */ +#define RVU_PF_DISC (0x0) +#endif /* OTX2_REG_H */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +32 -6
@@ -240,6 +240,10 @@ static void otx2vf_disable_mbox_intr(struct otx2_nic *vf)/* Disable VF => PF mailbox IRQ */ otx2_write64 (vf,RVU_VF_INT_ENA_W1C ,BIT_ULL (0 )); + +if (is_cn20k (vf->pdev)) +otx2_write64 (vf,RVU_VF_INT_ENA_W1C ,BIT_ULL (0 ) |BIT_ULL (1 )); +free_irq (vector, vf); }
@@ -252,9 +256,18 @@ static int otx2vf_register_mbox_intr(struct otx2_nic *vf, bool probe_pf)/* Register mailbox interrupt handler */ irq_name = &hw->irq_name[RVU_VF_INT_VEC_MBOX *NAME_SIZE ]; -snprintf (irq_name,NAME_SIZE ,"RVUVFAF Mbox" ); - err =request_irq (pci_irq_vector (vf->pdev,RVU_VF_INT_VEC_MBOX ), - otx2vf_vfaf_mbox_intr_handler,0 , irq_name, vf); +snprintf (irq_name,NAME_SIZE ,"RVUVF%d AFVF Mbox" , ((vf->pcifunc & +RVU_PFVF_FUNC_MASK ) -1 )); + +if (!is_cn20k (vf->pdev)) { + err =request_irq (pci_irq_vector (vf->pdev,RVU_VF_INT_VEC_MBOX ), + otx2vf_vfaf_mbox_intr_handler,0 , irq_name, vf); + }else { + err =request_irq (pci_irq_vector (vf->pdev,RVU_VF_INT_VEC_MBOX ), + vf->hw_ops->vfaf_mbox_intr_handler,0 , irq_name, + vf); + } +if (err) {dev_err (vf->dev,"RVUPF: IRQ registration failed for VFAF mbox irq\n" );
@@ -264,8 +277,15 @@ static int otx2vf_register_mbox_intr(struct otx2_nic *vf, bool probe_pf)/* Enable mailbox interrupt for msgs coming from PF. * First clear to avoid spurious interrupts, if any. */ -otx2_write64 (vf,RVU_VF_INT ,BIT_ULL (0 )); -otx2_write64 (vf,RVU_VF_INT_ENA_W1S ,BIT_ULL (0 )); +if (!is_cn20k (vf->pdev)) { +otx2_write64 (vf,RVU_VF_INT ,BIT_ULL (0 )); +otx2_write64 (vf,RVU_VF_INT_ENA_W1S ,BIT_ULL (0 )); + }else { +otx2_write64 (vf,RVU_VF_INT ,BIT_ULL (0 ) |BIT_ULL (1 ) | +BIT_ULL (2 ) |BIT_ULL (3 )); +otx2_write64 (vf,RVU_VF_INT_ENA_W1S ,BIT_ULL (0 ) | +BIT_ULL (1 ) |BIT_ULL (2 ) |BIT_ULL (3 )); + }if (!probe_pf)return 0 ;
@@ -315,7 +335,13 @@ static int otx2vf_vfaf_mbox_init(struct otx2_nic *vf)if (!vf->mbox_wq)return -ENOMEM ; -if (test_bit (CN10K_MBOX , &vf->hw.cap_flag)) { +/* For cn20k platform, VF mailbox region is in dram aliased from AF +* VF MBOX ADDR, MBOX is a separate RVU block. +*/ +if (is_cn20k (vf->pdev)) { + hwbase = vf->reg_base +RVU_VF_MBOX_REGION + ((u64 )BLKADDR_MBOX << +RVU_FUNC_BLKADDR_SHIFT ); + }else if (test_bit (CN10K_MBOX , &vf->hw.cap_flag)) {/* For cn10k platform, VF mailbox region is in its BAR2 * register space */
Signature · 1 line
2.7.4
Subbaraya Sundeep
maintainerPATCH v11 6/6 octeontx2-pf: CN20K mbox implementation between PF-VF
In reply to Subbaraya SundeepFrom: Sai Krishna <[email protected]>
This patch implements the CN20k MBOX communication between PF and it's VFs. CN20K silicon got extra interrupt of MBOX response for trigger interrupt. Also few of the CSR offsets got changed in CN20K against prior series of silicons.
--- drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +- drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c | 142 +++++++++++++++++++++ drivers/net/ethernet/marvell/octeontx2/nic/cn20k.h | 3 + .../ethernet/marvell/octeontx2/nic/otx2_common.h | 2 + .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 59 +++++++-- 5 files changed, 194 insertions(+), 14 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/common.h +1 -1
@@ -39,7 +39,7 @@ struct qmem {void *base;dma_addr_t iova;int alloc_sz; -u16 entry_sz; +u32 entry_sz;u8 align;u32 qsize; };
drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c +142 -0
151 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/cn20k.h +3 -0
@@ -11,4 +11,7 @@#include "otx2_common.h" void cn20k_init (struct otx2_nic *pfvf); +int cn20k_register_pfvf_mbox_intr (struct otx2_nic *pf,int numvfs); +void cn20k_disable_pfvf_mbox_intr (struct otx2_nic *pf,int numvfs); +void cn20k_enable_pfvf_mbox_intr (struct otx2_nic *pf,int numvfs);#endif /* CN20K_H */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +2 -0
@@ -66,6 +66,7 @@irqreturn_t otx2_pfaf_mbox_intr_handler (int irq,void *pf_irq);irqreturn_t cn20k_pfaf_mbox_intr_handler (int irq,void *pf_irq);irqreturn_t cn20k_vfaf_mbox_intr_handler (int irq,void *vf_irq); +irqreturn_t cn20k_pfvf_mbox_intr_handler (int irq,void *pf_irq);irqreturn_t otx2_pfvf_mbox_intr_handler (int irq,void *pf_irq);enum arua_mapped_qtypes {
@@ -376,6 +377,7 @@ struct dev_hw_ops {void (*aura_freeptr)(void *dev,int aura,u64 buf);irqreturn_t (*pfaf_mbox_intr_handler)(int irq,void *pf_irq);irqreturn_t (*vfaf_mbox_intr_handler)(int irq,void *pf_irq); +irqreturn_t (*pfvf_mbox_intr_handler)(int irq,void *pf_irq); };#define CN10K_MCS_SA_PER_SC 4
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +46 -13
98 lines not on this page · raw message
Signature · 1 line
2.7.4
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 11 Jun 2025 16:31:50 +0530 you wrote:
CN20K is the next generation silicon in the Octeon series with various improvements and new features.
Along with other changes the mailbox communication mechanism between RVU (Resource virtualization Unit) SRIOV PFs/VFs with Admin function (AF) has also gone through some changes.
[...]
Here is the summary with links:
- [net-next,v11,1/6] octeontx2: Set appropriate PF, VF masks and shifts based on silicon
https://git.kernel.org/netdev/net-next/c/25d51ebf0f54 - [net-next,v11,2/6] octeontx2-af: CN20k basic mbox operations and structures https://git.kernel.org/netdev/net-next/c/e53ee4acb220 - [net-next,v11,3/6] octeontx2-af: CN20k mbox to support AF REQ/ACK functionality https://git.kernel.org/netdev/net-next/c/f326d5d86e94 - [net-next,v11,4/6] octeontx2-pf: CN20K mbox REQ/ACK implementation for NIC PF https://git.kernel.org/netdev/net-next/c/370c2374bfa9 - [net-next,v11,5/6] octeontx2-af: CN20K mbox implementation for AF's VF https://git.kernel.org/netdev/net-next/c/f8909d3dd554 - [net-next,v11,6/6] octeontx2-pf: CN20K mbox implementation between PF-VF https://git.kernel.org/netdev/net-next/c/70f8986ecef1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html