octeontx2-af: SSO, TIM HW blocks and other config support
v2 cover octeontx2-af: SSO, TIM HW blocks and other config support
From: Sunil Goutham <[email protected]>
SSO HW block provides packet (or work) queueing, scheduling and synchronization. Also supports priorities and ordering. TIM or the timer HW block enables software to schedule SSO work for a future time.
This patch series adds support for SSO and TIM HW blocks, enables them to be configured and used by RVU PF/VF devices or drivers.
Also added support for
- Backpressure configuration.
- Pause frames or flow control enabling/disabling.
- Added a shared data structure between firmware and RVU admin function (AF) which will be used to get static information like interface MAC addresses, link modes, speeds, autoneg support etc.
- FEC (Forward error correction) config support for CGX.
- Retrieve FEC stats, PHY EEPROM etc from firmware
- Retrieving CGX LMAC info and to toggle it.
- Added debug prints for each of error interrupts raised by NIX, NPA and SSO blocks. These will help in identifying configuration and underlying HW functionality issues.
Changes from v1:
* Made changes to TIM HW block support patch to use generic API to get HW ticks.
* Removed inline keyword
- Suggested by David Miller.
* Fixed sparse warnings
- Reported by Kbuild test robot.
Andrew Pinski (1):
octeontx2-af: Add TIM unit support.
Christina Jacob (1):
octeontx2-af: Support to get CGX link info like current speed, fec etc
Geetha sowjanya (2):
octeontx2-af: Interface backpressure configuration support
octeontx2-af: Ingress and egress pause frame configuration
Jerin Jacob (2):
octeontx2-af: add debug msgs for NPA block errors
octeontx2-af: add debug msgs for NIX block errors
Kiran Kumar K (1):
octeontx2-af: NPC Tx parsed data key extraction profile
Linu Cherian (1):
octeontx2-af: Add support for importing firmware data
Pavan Nikhilesh (3):
octeontx2-af: Config support for per HWGRP thresholds
octeontx2-af: add debug msgs for SSO block errors
octeontx2-af: add debugfs support for sso
Radha Mohan Chintakuntla (1):
octeontx2-af: Add SSO unit support to the AF driver
Subbaraya Sundeep (1):
octeontx2-af: verify ingress channel in MCAM entry
Sunil Goutham (2):
octeontx2-af: Cleanup CGX config permission checks
octeontx2-af: Set discovery ID for RVUM block
drivers/net/ethernet/marvell/octeontx2/af/Makefile | 3 +- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 434 +++++++- drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 26 +- .../net/ethernet/marvell/octeontx2/af/cgx_fw_if.h | 78 +- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 322 +++++- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 197 +++- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 72 ++ .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 178 ++- .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 699 ++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 388 ++++++- .../net/ethernet/marvell/octeontx2/af/rvu_npa.c | 243 ++++- .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 282 ++++- .../net/ethernet/marvell/octeontx2/af/rvu_reg.h | 192 +++- .../net/ethernet/marvell/octeontx2/af/rvu_sso.c | 1146 ++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 44 + .../net/ethernet/marvell/octeontx2/af/rvu_tim.c | 322 ++++++ 16 files changed, 4489 insertions(+), 137 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_sso.c create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_tim.c
Signature · 1 line
2.7.4
PATCH v2 1/15 octeontx2-af: Interface backpressure configuration support
From: Geetha sowjanya <[email protected]>
Enables backpressure and assigns BPID for CGX and LBK channels. 96xx support upto 512 BPIDs, these BPIDs are statically divided across CGX/LBK/SDP interfaces as follows.
BPIDs 0 - 191 are mapped to LMAC channels.
BPIDs 192 - 255 are mapped to LBK channels.
BPIDs 256 - 511 are mapped to SDP channels.
BPIDs across CGX LMAC channels are divided as follows. CGX(0)_LMAC(0)_CHAN(0 - 15) mapped to BPIDs(0 - 15) CGX(0)_LMAC(1)_CHAN(0 - 15) mapped to BPIDs(16 - 31)
.......
CGX(1)_LMAC(0)_CHAN(0 - 15) mapped to BPIDs(64 - 79)
....
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 26 +++- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 152 ++++++++++++++++++++- .../net/ethernet/marvell/octeontx2/af/rvu_npa.c | 13 +- 3 files changed, 184 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +24 -2
@@ -125,7 +125,7 @@ static inline struct mbox_msghdr *otx2_mbox_alloc_msg(struct otx2_mbox *mbox, M(READY, 0x001, ready, msg_req, ready_msg_rsp) \ M(ATTACH_RESOURCES, 0x002, attach_resources, rsrc_attach, msg_rsp) \ M(DETACH_RESOURCES, 0x003, detach_resources, rsrc_detach, msg_rsp) \ -M(MSIX_OFFSET, 0x004, msix_offset, msg_req, msix_offset_rsp) \ +M(MSIX_OFFSET, 0x005, msix_offset, msg_req, msix_offset_rsp) \ M(VF_FLR, 0x006, vf_flr, msg_req, msg_rsp) \M (GET_HW_CAP ,0x008 , get_hw_cap, msg_req, get_hw_cap_rsp) \/* CGX mbox IDs (range 0x200 - 0x3FF) */ \
@@ -210,7 +210,10 @@ M(NIX_SET_RX_CFG, 0x8010, nix_set_rx_cfg, nix_rx_cfg, msg_rsp) \M (NIX_LSO_FORMAT_CFG ,0x8011 , nix_lso_format_cfg, \ nix_lso_format_cfg, \ nix_lso_format_cfg_rsp) \ -M (NIX_RXVLAN_ALLOC ,0x8012 , nix_rxvlan_alloc, msg_req, msg_rsp) +M(NIX_RXVLAN_ALLOC, 0x8012, nix_rxvlan_alloc, msg_req, msg_rsp) \ +M (NIX_BP_ENABLE ,0x8016 , nix_bp_enable, nix_bp_cfg_req, \ + nix_bp_cfg_rsp) \ +M (NIX_BP_DISABLE ,0x8017 , nix_bp_disable, nix_bp_cfg_req, msg_rsp) \ /* Messages initiated by AF (range 0xC00 - 0xDFF) */#define MBOX_UP_CGX_MESSAGES \
@@ -670,6 +673,25 @@ struct nix_lso_format_cfg_rsp {u8 lso_format_idx; }; +struct nix_bp_cfg_req { +struct mbox_msghdr hdr; +u16 chan_base;/* Starting channel number */ +u8 chan_cnt;/* Number of channels */ +u8 bpid_per_chan; +/* bpid_per_chan = 0 assigns single bp id for range of channels */ +/* bpid_per_chan = 1 assigns separate bp id for each channel */ +}; + +/* PF can be mapped to either CGX or LBK interface, +* so maximum 64 channels are possible. +*/ +#define NIX_MAX_BPID_CHAN 64 +struct nix_bp_cfg_rsp { +struct mbox_msghdr hdr; +u16 chan_bpid[NIX_MAX_BPID_CHAN ];/* Channel and bpid mapping */ +u8 chan_cnt;/* Number of channel for which bpids are assigned */ +}; +/* NPC mbox message structs */ #define NPC_MCAM_ENTRY_INVALID 0xFFFF
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +150 -2
191 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_npa.c +10 -3
@@ -94,6 +94,11 @@ int rvu_npa_aq_enq_inst(struct rvu *rvu, struct npa_aq_enq_req *req,*/ inst.res_addr = (u64 )aq->res->iova; +/* Hardware uses same aq->res->base for updating result of +* previous instruction hence wait here till it is done. +*/ +spin_lock (&aq->lock); +/* Clean result + context memory */ memset (aq->res->base,0 , aq->res->entry_sz);/* Context needs to be written at RES_ADDR + 128 */
@@ -138,10 +143,10 @@ int rvu_npa_aq_enq_inst(struct rvu *rvu, struct npa_aq_enq_req *req,break ; } -if (rc) +if (rc) { +spin_unlock (&aq->lock);return rc; - -spin_lock (&aq->lock); + }/* Submit the instruction to AQ */ rc =npa_aq_enqueue_wait (rvu, block, &inst);
@@ -218,6 +223,8 @@ static int npa_lf_hwctx_disable(struct rvu *rvu, struct hwctx_disable_req *req) }else if (req->ctype ==NPA_AQ_CTYPE_AURA ) { aq_req.aura.ena =0 ; aq_req.aura_mask.ena =1 ; + aq_req.aura.bp_ena =0 ; + aq_req.aura_mask.bp_ena =1 ; cnt = pfvf->aura_ctx->qsize; bmap = pfvf->aura_bmap; }
Signature · 1 line
2.7.4
PATCH v2 2/15 octeontx2-af: Add support for importing firmware data
In reply to [email protected]From: Linu Cherian <[email protected]>
Firmware data is essentially a block of one time configuration data exported from firmware to kernel through shared memory. Base address of this memory is obtained through CGX firmware interface commands.
With this in place, MAC address of CGX mapped functions are inited from firmware data if available else they are inited with random MAC address.
Also
- Added a new mbox for PF/VF to retrieve it's MAC address.
- Now RVU MSIX vector address is also retrieved from this fwdata struct instead of from CSR. Otherwise when kexec/kdump crash kernel loads CSR will have a IOVA setup by primary kernel which impacts RVU PF/VF's interrupts.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 18 ++++ drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 1 + .../net/ethernet/marvell/octeontx2/af/cgx_fw_if.h | 8 +- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 9 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 112 +++++++++++++++++++-- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 30 ++++++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 23 ++++- 7 files changed, 192 insertions(+), 9 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +18 -0
@@ -697,6 +697,24 @@ int cgx_lmac_evh_unregister(void *cgxd, int lmac_id) }EXPORT_SYMBOL (cgx_lmac_evh_unregister); +int cgx_get_fwdata_base (u64 *base) +{ +u64 req =0 , resp; +struct cgx *cgx; +int err; + + cgx = list_first_entry_or_null(&cgx_list, struct cgx, cgx_list); +if (!cgx) +return -ENXIO ; + + req =FIELD_SET (CMDREG_ID ,CGX_CMD_GET_FWD_BASE , req); + err =cgx_fwi_cmd_generic (req, &resp, cgx,0 ); +if (!err) + *base =FIELD_GET (RESP_FWD_BASE , resp); + +return err; +} +static int cgx_fwi_link_change (struct cgx *cgx,int lmac_id,bool enable) {u64 req =0 ;
drivers/net/ethernet/marvell/octeontx2/af/cgx.h +1 -0
@@ -124,5 +124,6 @@ int cgx_lmac_internal_loopback(void *cgxd, int lmac_id, bool enable);int cgx_get_link_info (void *cgxd,int lmac_id,struct cgx_link_user_info *linfo);int cgx_lmac_linkup_start (void *cgxd); +int cgx_get_fwdata_base (u64 *base);int cgx_get_mkex_prfl_info (u64 *addr,u64 *size);#endif /* CGX_H */
drivers/net/ethernet/marvell/octeontx2/af/cgx_fw_if.h +7 -1
@@ -79,7 +79,8 @@ enum cgx_cmd_id {CGX_CMD_MODE_CHANGE ,/* hot plug support */ CGX_CMD_INTF_SHUTDOWN ,CGX_CMD_GET_MKEX_PRFL_SIZE , - CGX_CMD_GET_MKEX_PRFL_ADDR +CGX_CMD_GET_MKEX_PRFL_ADDR , + CGX_CMD_GET_FWD_BASE, /* get base address of shared FW data */ };/* async event ids */
@@ -149,6 +150,11 @@ enum cgx_cmd_own {*/ #define RESP_MKEX_PRFL_ADDR GENMASK_ULL(63, 9) +/* Response to cmd ID as CGX_CMD_GET_FWD_BASE with cmd status as +* CGX_STAT_SUCCESS +*/ +#define RESP_FWD_BASE GENMASK_ULL(56, 9) +/* Response to cmd ID - CGX_CMD_LINK_BRING_UP/DOWN, event ID CGX_EVT_LINK_CHANGE * status can be either CGX_STAT_FAIL or CGX_STAT_SUCCESS *
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +8 -1
@@ -214,6 +214,7 @@ M(NIX_RXVLAN_ALLOC, 0x8012, nix_rxvlan_alloc, msg_req, msg_rsp) \M (NIX_BP_ENABLE ,0x8016 , nix_bp_enable, nix_bp_cfg_req, \ nix_bp_cfg_rsp) \ M(NIX_BP_DISABLE, 0x8017, nix_bp_disable, nix_bp_cfg_req, msg_rsp) \ +M (NIX_GET_MAC_ADDR ,0x8018 , nix_get_mac_addr, msg_req, nix_get_mac_addr_rsp) /* Messages initiated by AF (range 0xC00 - 0xDFF) */#define MBOX_UP_CGX_MESSAGES \
@@ -253,7 +254,8 @@ enum rvu_af_status {struct ready_msg_rsp {struct mbox_msghdr hdr; -u16 sclk_feq;/* SCLK frequency */ +u16 sclk_freq;/* SCLK frequency (in MHz) */ +u16 rclk_freq;/* RCLK frequency (in MHz) */ };/* Structure for requesting resource provisioning.
@@ -621,6 +623,11 @@ struct nix_set_mac_addr {u8 mac_addr[ETH_ALEN ];/* MAC address to be set for this pcifunc */ }; +struct nix_get_mac_addr_rsp { +struct mbox_msghdr hdr; +u8 mac_addr[ETH_ALEN ]; +}; +struct nix_mark_format_cfg {struct mbox_msghdr hdr;u8 offset;
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +106 -6
178 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +30 -0
@@ -269,6 +269,26 @@ struct mbox_wq_info {struct workqueue_struct *mbox_wq; }; +struct rvu_fwdata { +#define RVU_FWDATA_HEADER_MAGIC 0xCFDA/*Custom Firmware Data*/ +#define RVU_FWDATA_VERSION 0x0001 +u32 header_magic; +u32 version;/* version id */ + +/* MAC address */ +#define PF_MACNUM_MAX 32 +#define VF_MACNUM_MAX 256 +u64 pf_macs[PF_MACNUM_MAX ]; +u64 vf_macs[VF_MACNUM_MAX ]; +u64 sclk; +u64 rclk; +u64 mcam_addr; +u64 mcam_sz; +u64 msixtr_base; +#define FWDATA_RESERVED_MEM 1023 +u64 reserved[FWDATA_RESERVED_MEM ]; +}; +struct rvu {void __iomem *afreg_base;void __iomem *pfreg_base;
@@ -294,6 +314,7 @@ struct rvu {char *irq_name;bool *irq_allocated;dma_addr_t msix_base_iova; +u64 msixtr_base_phy;/* Register reset value */ /* CGX */ #define PF_CGXMAP_BASE 1/* PF 0 is reserved for RVU PF */
@@ -313,6 +334,9 @@ struct rvu {char mkex_pfl_name[MKEX_NAME_LEN ];/* Configured MKEX profile name */ +/* Firmware data */ +struct rvu_fwdata *fwdata; +#ifdef CONFIG_DEBUG_FS struct rvu_debugfs rvu_dbg;#endif
@@ -363,6 +387,12 @@ static inline int is_afvf(u16 pcifunc)return !(pcifunc & ~RVU_PFVF_FUNC_MASK ); } +static inline bool is_rvu_fwdata_valid (struct rvu *rvu) +{ +return (rvu->fwdata->header_magic ==RVU_FWDATA_HEADER_MAGIC ) && + (rvu->fwdata->version ==RVU_FWDATA_VERSION ); +} +int rvu_alloc_bitmap (struct rsrc_bmap *rsrc);int rvu_alloc_rsrc (struct rsrc_bmap *rsrc);void rvu_free_rsrc (struct rsrc_bmap *rsrc,int id);
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +22 -1
@@ -2666,6 +2666,7 @@ int rvu_mbox_handler_nix_set_mac_addr(struct rvu *rvu,struct nix_set_mac_addr *req, struct msg_rsp *rsp) { + bool from_vf = !!(req->hdr.pcifunc & RVU_PFVF_FUNC_MASK);struct rvu_hwinfo *hw = rvu->hw;u16 pcifunc = req->hdr.pcifunc;struct rvu_pfvf *pfvf;
@@ -2680,7 +2681,10 @@ int rvu_mbox_handler_nix_set_mac_addr(struct rvu *rvu,if (nixlf <0 )return NIX_AF_ERR_AF_LF_INVALID ; -ether_addr_copy (pfvf->mac_addr, req->mac_addr); +/* Skip updating mac addr if request is from vf */ +if (!from_vf) +ether_addr_copy (pfvf->mac_addr, req->mac_addr); +rvu_npc_install_ucast_entry (rvu, pcifunc, nixlf, pfvf->rx_chan_base, req->mac_addr);
@@ -2690,6 +2694,23 @@ int rvu_mbox_handler_nix_set_mac_addr(struct rvu *rvu,return 0 ; } +int rvu_mbox_handler_nix_get_mac_addr (struct rvu *rvu, +struct msg_req *req, +struct nix_get_mac_addr_rsp *rsp) +{ +u16 pcifunc = req->hdr.pcifunc; +struct rvu_pfvf *pfvf; + +if (!is_nixlf_attached (rvu, pcifunc)) +return NIX_AF_ERR_AF_LF_INVALID ; + + pfvf =rvu_get_pfvf (rvu, pcifunc); + +ether_addr_copy (rsp->mac_addr, pfvf->mac_addr); + +return 0 ; +} +int rvu_mbox_handler_nix_set_rx_mode (struct rvu *rvu,struct nix_rx_mode *req,struct msg_rsp *rsp) {
Signature · 1 line
2.7.4
PATCH v2 3/15 octeontx2-af: Cleanup CGX config permission checks
In reply to [email protected]From: Sunil Goutham <[email protected]>
Most of the CGX register config is restricted to mapped RVU PFs, this patch cleans up these permission checks spread across the rvu_cgx.c file by moving the checks to a common fn().
--- .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 55 ++++++++++------------ 1 file changed, 24 insertions(+), 31 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +24 -31
@@ -350,6 +350,18 @@ int rvu_cgx_exit(struct rvu *rvu)return 0 ; } +/* Most of the CGX configuration is restricted to the mapped PF only, +* VF's of mapped PF and other PFs are not allowed. This fn() checks +* whether a PFFUNC is permitted to do the config or not. +*/ +static bool is_cgx_config_permitted (struct rvu *rvu,u16 pcifunc) +{ +if ((pcifunc &RVU_PFVF_FUNC_MASK ) || + !is_pf_cgxmapped (rvu,rvu_get_pf (pcifunc))) +return false; +return true; +} +void rvu_cgx_enadis_rx_bp (struct rvu *rvu,int pf,bool enable) {u8 cgx_id, lmac_id;
@@ -373,11 +385,8 @@ int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start)int pf =rvu_get_pf (pcifunc);u8 cgx_id, lmac_id; -/* This msg is expected only from PFs that are mapped to CGX LMACs, -* if received from other PF/VF simply ACK, nothing to do. -*/ -if ((pcifunc &RVU_PFVF_FUNC_MASK ) || !is_pf_cgxmapped (rvu, pf)) -return -ENODEV ; +if (!is_cgx_config_permitted (rvu, pcifunc)) +return -EPERM ;rvu_get_cgx_lmac_id (rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
@@ -409,8 +418,7 @@ int rvu_mbox_handler_cgx_stats(struct rvu *rvu, struct msg_req *req,u8 cgx_idx, lmac;void *cgxd; -if ((req->hdr.pcifunc &RVU_PFVF_FUNC_MASK ) || - !is_pf_cgxmapped (rvu, pf)) +if (!is_cgx_config_permitted (rvu, req->hdr.pcifunc))return -ENODEV ;rvu_get_cgx_lmac_id (rvu->pf2cgxlmac_map[pf], &cgx_idx, &lmac);
@@ -477,12 +485,8 @@ int rvu_mbox_handler_cgx_promisc_enable(struct rvu *rvu, struct msg_req *req,int pf =rvu_get_pf (pcifunc);u8 cgx_id, lmac_id; -/* This msg is expected only from PFs that are mapped to CGX LMACs, -* if received from other PF/VF simply ACK, nothing to do. -*/ -if ((req->hdr.pcifunc &RVU_PFVF_FUNC_MASK ) || - !is_pf_cgxmapped (rvu, pf)) -return -ENODEV ; +if (!is_cgx_config_permitted (rvu, req->hdr.pcifunc)) +return -EPERM ;rvu_get_cgx_lmac_id (rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
@@ -493,16 +497,11 @@ int rvu_mbox_handler_cgx_promisc_enable(struct rvu *rvu, struct msg_req *req,int rvu_mbox_handler_cgx_promisc_disable (struct rvu *rvu,struct msg_req *req,struct msg_rsp *rsp) { -u16 pcifunc = req->hdr.pcifunc; -int pf =rvu_get_pf (pcifunc); +int pf =rvu_get_pf (req->hdr.pcifunc);u8 cgx_id, lmac_id; -/* This msg is expected only from PFs that are mapped to CGX LMACs, -* if received from other PF/VF simply ACK, nothing to do. -*/ -if ((req->hdr.pcifunc &RVU_PFVF_FUNC_MASK ) || - !is_pf_cgxmapped (rvu, pf)) -return -ENODEV ; +if (!is_cgx_config_permitted (rvu, req->hdr.pcifunc)) +return -EPERM ;rvu_get_cgx_lmac_id (rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
@@ -515,11 +514,8 @@ static int rvu_cgx_config_linkevents(struct rvu *rvu, u16 pcifunc, bool en)int pf =rvu_get_pf (pcifunc);u8 cgx_id, lmac_id; -/* This msg is expected only from PFs that are mapped to CGX LMACs, -* if received from other PF/VF simply ACK, nothing to do. -*/ -if ((pcifunc &RVU_PFVF_FUNC_MASK ) || !is_pf_cgxmapped (rvu, pf)) -return -ENODEV ; +if (!is_cgx_config_permitted (rvu, pcifunc)) +return -EPERM ;rvu_get_cgx_lmac_id (rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
@@ -571,11 +567,8 @@ static int rvu_cgx_config_intlbk(struct rvu *rvu, u16 pcifunc, bool en)int pf =rvu_get_pf (pcifunc);u8 cgx_id, lmac_id; -/* This msg is expected only from PFs that are mapped to CGX LMACs, -* if received from other PF/VF simply ACK, nothing to do. -*/ -if ((pcifunc &RVU_PFVF_FUNC_MASK ) || !is_pf_cgxmapped (rvu, pf)) -return -ENODEV ; +if (!is_cgx_config_permitted (rvu, pcifunc)) +return -EPERM ;rvu_get_cgx_lmac_id (rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
Signature · 1 line
2.7.4
PATCH v2 4/15 octeontx2-af: Ingress and egress pause frame configuration
In reply to [email protected]From: Geetha sowjanya <[email protected]>
Pause frames can be generated when NIX/NPA asserts backpressure due to insufficient resources. This patch enables generation of pause frames by CGX. Also enabled processing of received pause frames and asserting backpressure on NIX transmit path.
Also added mailbox config messages for PF/VF to enable/disable flow control any time.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 106 +++++++++++++++++++++ drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 14 +++ drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 11 +++ .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 24 +++++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 5 + 5 files changed, 160 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +106 -0
@@ -381,6 +381,110 @@ int cgx_lmac_tx_enable(void *cgxd, int lmac_id, bool enable) }EXPORT_SYMBOL (cgx_lmac_tx_enable); +int cgx_lmac_get_pause_frm (void *cgxd,int lmac_id, +u8 *tx_pause,u8 *rx_pause) +{ +struct cgx *cgx = cgxd; +u64 cfg; + +if (!cgx || lmac_id >= cgx->lmac_count) +return -ENODEV ; + + cfg =cgx_read (cgx, lmac_id,CGXX_SMUX_RX_FRM_CTL ); + *rx_pause = !!(cfg &CGX_SMUX_RX_FRM_CTL_CTL_BCK ); + + cfg =cgx_read (cgx, lmac_id,CGXX_SMUX_TX_CTL ); + *tx_pause = !!(cfg &CGX_SMUX_TX_CTL_L2P_BP_CONV ); +return 0 ; +} +EXPORT_SYMBOL (cgx_lmac_get_pause_frm); + +int cgx_lmac_set_pause_frm (void *cgxd,int lmac_id, +u8 tx_pause,u8 rx_pause) +{ +struct cgx *cgx = cgxd; +u64 cfg; + +if (!cgx || lmac_id >= cgx->lmac_count) +return -ENODEV ; + + cfg =cgx_read (cgx, lmac_id,CGXX_SMUX_RX_FRM_CTL ); + cfg &= ~CGX_SMUX_RX_FRM_CTL_CTL_BCK ; + cfg |= rx_pause ?CGX_SMUX_RX_FRM_CTL_CTL_BCK :0x0 ; +cgx_write (cgx, lmac_id,CGXX_SMUX_RX_FRM_CTL , cfg); + + cfg =cgx_read (cgx, lmac_id,CGXX_SMUX_TX_CTL ); + cfg &= ~CGX_SMUX_TX_CTL_L2P_BP_CONV ; + cfg |= tx_pause ?CGX_SMUX_TX_CTL_L2P_BP_CONV :0x0 ; +cgx_write (cgx, lmac_id,CGXX_SMUX_TX_CTL , cfg); + + cfg =cgx_read (cgx,0 ,CGXX_CMR_RX_OVR_BP ); +if (tx_pause) { + cfg &= ~CGX_CMR_RX_OVR_BP_EN (lmac_id); + }else { + cfg |=CGX_CMR_RX_OVR_BP_EN (lmac_id); + cfg &= ~CGX_CMR_RX_OVR_BP_BP (lmac_id); + } +cgx_write (cgx,0 ,CGXX_CMR_RX_OVR_BP , cfg); +return 0 ; +} +EXPORT_SYMBOL (cgx_lmac_set_pause_frm); + +static void cgx_lmac_pause_frm_config (struct cgx *cgx,int lmac_id,bool enable) +{ +u64 cfg; + +if (!cgx || lmac_id >= cgx->lmac_count) +return ; +if (enable) { +/* Enable receive pause frames */ + cfg =cgx_read (cgx, lmac_id,CGXX_SMUX_RX_FRM_CTL ); + cfg |=CGX_SMUX_RX_FRM_CTL_CTL_BCK ; +cgx_write (cgx, lmac_id,CGXX_SMUX_RX_FRM_CTL , cfg); + + cfg =cgx_read (cgx, lmac_id,CGXX_GMP_GMI_RXX_FRM_CTL ); + cfg |=CGX_GMP_GMI_RXX_FRM_CTL_CTL_BCK ; +cgx_write (cgx, lmac_id,CGXX_GMP_GMI_RXX_FRM_CTL , cfg); + +/* Enable pause frames transmission */ + cfg =cgx_read (cgx, lmac_id,CGXX_SMUX_TX_CTL ); + cfg |=CGX_SMUX_TX_CTL_L2P_BP_CONV ; +cgx_write (cgx, lmac_id,CGXX_SMUX_TX_CTL , cfg); + +/* Set pause time and interval*/ +cgx_write (cgx, lmac_id,CGXX_SMUX_TX_PAUSE_PKT_TIME , +DEFAULT_PAUSE_TIME ); +/* Set pause interval as the hardware default is too short */ + cfg =cgx_read (cgx, lmac_id,CGXX_SMUX_TX_PAUSE_PKT_INTERVAL ); + cfg &= ~0xFFFFULL ; +cgx_write (cgx, lmac_id,CGXX_SMUX_TX_PAUSE_PKT_INTERVAL , + cfg | (DEFAULT_PAUSE_TIME -0x1000 )); + +cgx_write (cgx, lmac_id,CGXX_GMP_GMI_TX_PAUSE_PKT_TIME , +DEFAULT_PAUSE_TIME ); + + cfg =cgx_read (cgx, lmac_id, +CGXX_GMP_GMI_TX_PAUSE_PKT_INTERVAL ); + cfg &= ~0xFFFFULL ; +cgx_write (cgx, lmac_id,CGXX_GMP_GMI_TX_PAUSE_PKT_INTERVAL , + cfg | (DEFAULT_PAUSE_TIME -0x1000 )); + }else { +/* ALL pause frames received are completely ignored */ + cfg =cgx_read (cgx, lmac_id,CGXX_SMUX_RX_FRM_CTL ); + cfg &= ~CGX_SMUX_RX_FRM_CTL_CTL_BCK ; +cgx_write (cgx, lmac_id,CGXX_SMUX_RX_FRM_CTL , cfg); + + cfg =cgx_read (cgx, lmac_id,CGXX_GMP_GMI_RXX_FRM_CTL ); + cfg &= ~CGX_GMP_GMI_RXX_FRM_CTL_CTL_BCK ; +cgx_write (cgx, lmac_id,CGXX_GMP_GMI_RXX_FRM_CTL , cfg); + +/* Disable pause frames transmission */ + cfg =cgx_read (cgx, lmac_id,CGXX_SMUX_TX_CTL ); + cfg &= ~CGX_SMUX_TX_CTL_L2P_BP_CONV ; +cgx_write (cgx, lmac_id,CGXX_SMUX_TX_CTL , cfg); + } +} +/* CGX Firmware interface low level support */ static int cgx_fwi_cmd_send (u64 req,u64 *resp,struct lmac *lmac) {
@@ -823,6 +927,7 @@ static int cgx_lmac_init(struct cgx *cgx)/* Add reference */ cgx->lmac_idmap[i] = lmac; +cgx_lmac_pause_frm_config (cgx, i, true); }return cgx_lmac_verify_fwi_version (cgx);
@@ -841,6 +946,7 @@ static int cgx_lmac_exit(struct cgx *cgx)/* Free all lmac related resources */ for (i =0 ; i < cgx->lmac_count; i++) { +cgx_lmac_pause_frm_config (cgx, i, false); lmac = cgx->lmac_idmap[i];if (!lmac)continue ;
drivers/net/ethernet/marvell/octeontx2/af/cgx.h +14 -0
@@ -60,10 +60,20 @@#define CGX_SMUX_RX_FRM_CTL_CTL_BCK BIT_ULL(3)#define CGXX_GMP_GMI_RXX_FRM_CTL 0x38028#define CGX_GMP_GMI_RXX_FRM_CTL_CTL_BCK BIT_ULL(3) +#define CGXX_SMUX_TX_CTL 0x20178 +#define CGXX_SMUX_TX_PAUSE_PKT_TIME 0x20110 +#define CGXX_SMUX_TX_PAUSE_PKT_INTERVAL 0x20120 +#define CGXX_GMP_GMI_TX_PAUSE_PKT_TIME 0x38230 +#define CGXX_GMP_GMI_TX_PAUSE_PKT_INTERVAL 0x38248 +#define CGX_SMUX_TX_CTL_L2P_BP_CONV BIT_ULL(7) +#define CGXX_CMR_RX_OVR_BP 0x130 +#define CGX_CMR_RX_OVR_BP_EN (X ) BIT_ULL(((X) + 8)) +#define CGX_CMR_RX_OVR_BP_BP (X ) BIT_ULL(((X) + 4))#define CGX_COMMAND_REG CGXX_SCRATCH1_REG#define CGX_EVENT_REG CGXX_SCRATCH0_REG#define CGX_CMD_TIMEOUT 2200/* msecs */ +#define DEFAULT_PAUSE_TIME 0xFFFF#define CGX_NVEC 37#define CGX_LMAC_FWI 0
@@ -125,5 +135,9 @@ int cgx_get_link_info(void *cgxd, int lmac_id, struct cgx_link_user_info *linfo);int cgx_lmac_linkup_start (void *cgxd);int cgx_get_fwdata_base (u64 *base); +int cgx_lmac_get_pause_frm (void *cgxd,int lmac_id, +u8 *tx_pause,u8 *rx_pause); +int cgx_lmac_set_pause_frm (void *cgxd,int lmac_id, +u8 tx_pause,u8 rx_pause);int cgx_get_mkex_prfl_info (u64 *addr,u64 *size);#endif /* CGX_H */
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +11 -0
@@ -143,6 +143,8 @@ M(CGX_STOP_LINKEVENTS, 0x208, cgx_stop_linkevents, msg_req, msg_rsp) \ M(CGX_GET_LINKINFO, 0x209, cgx_get_linkinfo, msg_req, cgx_link_info_msg) \ M(CGX_INTLBK_ENABLE, 0x20A, cgx_intlbk_enable, msg_req, msg_rsp) \ M(CGX_INTLBK_DISABLE, 0x20B, cgx_intlbk_disable, msg_req, msg_rsp) \ +M (CGX_CFG_PAUSE_FRM ,0x20E , cgx_cfg_pause_frm, cgx_pause_frm_cfg, \ + cgx_pause_frm_cfg) \ /* NPA mbox IDs (range 0x400 - 0x5FF) */ \M (NPA_LF_ALLOC ,0x400 , npa_lf_alloc, \ npa_lf_alloc_req, npa_lf_alloc_rsp) \
@@ -346,6 +348,15 @@ struct cgx_link_info_msg {struct cgx_link_user_info link_info; }; +struct cgx_pause_frm_cfg { +struct mbox_msghdr hdr; +u8 set; +/* set = 1 if the request is to config pause frames */ +/* set = 0 if the request is to fetch pause frames config */ +u8 rx_pause; +u8 tx_pause; +}; +/* NPA mbox message formats */ /* NPA mailbox error codes
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +24 -0
@@ -590,6 +590,30 @@ int rvu_mbox_handler_cgx_intlbk_disable(struct rvu *rvu, struct msg_req *req,return 0 ; } +int rvu_mbox_handler_cgx_cfg_pause_frm (struct rvu *rvu, +struct cgx_pause_frm_cfg *req, +struct cgx_pause_frm_cfg *rsp) +{ +int pf =rvu_get_pf (req->hdr.pcifunc); +u8 cgx_id, lmac_id; + +/* This msg is expected only from PF/VFs that are mapped to CGX LMACs, +* if received from other PF/VF simply ACK, nothing to do. +*/ +if (!is_pf_cgxmapped (rvu, pf)) +return -ENODEV ; + +rvu_get_cgx_lmac_id (rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); + +if (req->set) +cgx_lmac_set_pause_frm (rvu_cgx_pdata (cgx_id, rvu), lmac_id, + req->tx_pause, req->rx_pause); +else +cgx_lmac_get_pause_frm (rvu_cgx_pdata (cgx_id, rvu), lmac_id, + &rsp->tx_pause, &rsp->rx_pause); +return 0 ; +} +/* Finds cumulative status of NIX rx/tx counters from LF of a PF and those * from its VFs as well. ie. NIX rx/tx counters at the CGX port level */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +5 -0
@@ -193,6 +193,11 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf) pfvf->tx_chan_cnt =1 ;cgx_set_pkind (rvu_cgx_pdata (cgx_id, rvu), lmac_id, pkind);rvu_npc_set_pkind (rvu, pkind, pfvf); + +/* By default we enable pause frames */ +if ((pcifunc &RVU_PFVF_FUNC_MASK ) ==0 ) +cgx_lmac_set_pause_frm (rvu_cgx_pdata (cgx_id, rvu), + lmac_id, true, true);break ;case NIX_INTF_TYPE_LBK : vf = (pcifunc &RVU_PFVF_FUNC_MASK ) -1 ;
Signature · 1 line
2.7.4
PATCH v2 5/15 octeontx2-af: Set discovery ID for RVUM block
In reply to [email protected]From: Sunil Goutham <[email protected]>
Currently there is no way for AF dependent drivers in any domain to check if the AF driver is loaded. This patch sets a ID for RVUM block which will automatically reflects in PF/VFs discovery register which they can check and defer their probe until AF is up.
Also fixed an issue which occurs when kernel driver is unbinded, bus mastering gets disabled by the PCI subsystem which results interrupts not working when driver is reloaded. Hence enabled bus mastering in probe(). Also cleared transaction pending bit which gets set during driver unbind due to clearing of bus mastering ME bit.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 23 +++++++++++++++++++++- .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 3 +++ 2 files changed, 25 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +22 -1
@@ -421,6 +421,19 @@ static void rvu_check_block_implemented(struct rvu *rvu) } } +static void rvu_setup_rvum_blk_revid (struct rvu *rvu) +{ +rvu_write64 (rvu,BLKADDR_RVUM , +RVU_PRIV_BLOCK_TYPEX_REV (BLKTYPE_RVUM ), +RVU_BLK_RVUM_REVID ); +} + +static void rvu_clear_rvum_blk_revid (struct rvu *rvu) +{ +rvu_write64 (rvu,BLKADDR_RVUM , +RVU_PRIV_BLOCK_TYPEX_REV (BLKTYPE_RVUM ),0x00 ); +} +int rvu_lf_reset (struct rvu *rvu,struct rvu_block *block,int lf) {int err;
@@ -2226,6 +2239,9 @@ static int rvu_register_interrupts(struct rvu *rvu) } rvu->irq_allocated[RVU_AF_INT_VEC_PFME ] = true; +/* Clear TRPEND bit for all PF */ +rvu_write64 (rvu,BLKADDR_RVUM , +RVU_AF_PFTRPEND ,INTR_MASK (rvu->hw->total_pfs));/* Enable ME interrupt for all PFs*/ rvu_write64 (rvu,BLKADDR_RVUM ,RVU_AF_PFME_INT ,INTR_MASK (rvu->hw->total_pfs));
@@ -2549,6 +2565,8 @@ static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_release_regions; } +pci_set_master (pdev); +/* Map Admin function CSRs */ rvu->afreg_base =pcim_iomap (pdev,PCI_AF_REG_BAR_NUM ,0 ); rvu->pfreg_base =pcim_iomap (pdev,PCI_PF_REG_BAR_NUM ,0 );
@@ -2587,6 +2605,8 @@ static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (err) goto err_flr; +rvu_setup_rvum_blk_revid (rvu); +/* Enable AF's VFs (if any) */ err =rvu_enable_sriov (rvu);if (err)
@@ -2607,6 +2627,7 @@ static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id)rvu_fwdata_exit (rvu);rvu_reset_all_blocks (rvu);rvu_free_hw_resources (rvu); +rvu_clear_rvum_blk_revid (rvu); err_release_regions:pci_release_regions (pdev); err_disable_device:
@@ -2631,7 +2652,7 @@ static void rvu_remove(struct pci_dev *pdev)rvu_disable_sriov (rvu);rvu_reset_all_blocks (rvu);rvu_free_hw_resources (rvu); - +rvu_clear_rvum_blk_revid (rvu);pci_release_regions (pdev);pci_disable_device (pdev);pci_set_drvdata (pdev,NULL );
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h +3 -0
@@ -11,6 +11,9 @@#ifndef RVU_STRUCT_H #define RVU_STRUCT_H +/* RVU Block revision IDs */ +#define RVU_BLK_RVUM_REVID 0x01 +/* RVU Block Address Enumeration */ enum rvu_block_addr_e { BLKADDR_RVUM = 0x0ULL,
Signature · 1 line
2.7.4
PATCH v2 6/15 octeontx2-af: add debug msgs for NPA block errors
In reply to [email protected]From: Jerin Jacob <[email protected]>
Added debug messages for NPA NPA_AF_RVU_INT, NPA_AF_GEN_INT, NPA_AF_ERR_INT and NPA_AF_RAS error AF interrupts.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 8 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 2 + .../net/ethernet/marvell/octeontx2/af/rvu_npa.c | 230 +++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 23 +++ 4 files changed, 262 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +7 -1
@@ -2126,6 +2126,8 @@ static void rvu_unregister_interrupts(struct rvu *rvu) {int irq; +rvu_npa_unregister_interrupts (rvu); +/* Disable the Mbox interrupt */ rvu_write64 (rvu,BLKADDR_RVUM ,RVU_AF_PFAF_MBOX_INT_ENA_W1C ,INTR_MASK (rvu->hw->total_pfs) & ~1ULL );
@@ -2333,8 +2335,12 @@ static int rvu_register_interrupts(struct rvu *rvu) goto fail; } rvu->irq_allocated[offset] = true; -return 0 ; + ret =rvu_npa_register_interrupts (rvu); +if (ret) + goto fail; + +return 0 ; fail:rvu_unregister_interrupts (rvu);return ret;
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +2 -0
@@ -453,6 +453,8 @@ void rvu_npa_freemem(struct rvu *rvu);void rvu_npa_lf_teardown (struct rvu *rvu,u16 pcifunc,int npalf);int rvu_npa_aq_enq_inst (struct rvu *rvu,struct npa_aq_enq_req *req,struct npa_aq_enq_rsp *rsp); +int rvu_npa_register_interrupts (struct rvu *rvu); +void rvu_npa_unregister_interrupts (struct rvu *rvu);/* NIX APIs */ bool is_nixlf_attached (struct rvu *rvu,u16 pcifunc);
drivers/net/ethernet/marvell/octeontx2/af/rvu_npa.c +230 -0
241 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h +23 -0
@@ -60,6 +60,16 @@ enum rvu_af_int_vec_e { RVU_AF_INT_VEC_CNT = 0x5, }; +/* NPA Admin function Interrupt Vector Enumeration */ +enum npa_af_int_vec_e { +NPA_AF_INT_VEC_RVU =0x0 , +NPA_AF_INT_VEC_GEN =0x1 , +NPA_AF_INT_VEC_AQ_DONE =0x2 , +NPA_AF_INT_VEC_AF_ERR =0x3 , +NPA_AF_INT_VEC_POISON =0x4 , +NPA_AF_INT_VEC_CNT =0x5 , +}; +/** * RVU PF Interrupt Vector Enumeration */
@@ -100,6 +110,19 @@ enum npa_aq_instop { NPA_AQ_INSTOP_UNLOCK = 0x5, }; +/* ALLOC/FREE input queues Enumeration from coprocessors */ +enum npa_inpq { +NPA_INPQ_NIX0_RX =0x0 , +NPA_INPQ_NIX0_TX =0x1 , +NPA_INPQ_NIX1_RX =0x2 , +NPA_INPQ_NIX1_TX =0x3 , +NPA_INPQ_SSO =0x4 , +NPA_INPQ_TIM =0x5 , +NPA_INPQ_DPI =0x6 , +NPA_INPQ_AURA_OP =0xe , +NPA_INPQ_INTERNAL_RSV =0xf , +}; +/* NPA admin queue instruction structure */ struct npa_aq_inst_s {#if defined(__BIG_ENDIAN_BITFIELD)
Signature · 1 line
2.7.4
PATCH v2 7/15 octeontx2-af: add debug msgs for NIX block errors
In reply to [email protected]From: Jerin Jacob <[email protected]>
Added debug messages for NIX_AF_RVU_INT, NIX_AF_ERR_INT and NIX_AF_RAS error AF interrupts.
These will help in detecting issues wrt AQ instruction faults, LF misconfiguration, NPC MCAM entry trying to forward pkt to PF_FUNC with no NIXLF mapped etc.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 5 + drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 2 + .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 202 +++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 10 + 4 files changed, 219 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +5 -0
@@ -2127,6 +2127,7 @@ static void rvu_unregister_interrupts(struct rvu *rvu)int irq;rvu_npa_unregister_interrupts (rvu); +rvu_nix_unregister_interrupts (rvu);/* Disable the Mbox interrupt */ rvu_write64(rvu, BLKADDR_RVUM, RVU_AF_PFAF_MBOX_INT_ENA_W1C,
@@ -2340,6 +2341,10 @@ static int rvu_register_interrupts(struct rvu *rvu)if (ret) goto fail; + ret =rvu_nix_register_interrupts (rvu); +if (ret) + goto fail; +return 0 ; fail:rvu_unregister_interrupts (rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +2 -0
@@ -465,6 +465,8 @@ void rvu_nix_freemem(struct rvu *rvu);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 rvu_nix_register_interrupts (struct rvu *rvu); +void rvu_nix_unregister_interrupts (struct rvu *rvu);/* NPC APIs */ int rvu_npc_init (struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +202 -0
205 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h +10 -0
@@ -70,6 +70,16 @@ enum npa_af_int_vec_e { NPA_AF_INT_VEC_CNT = 0x5, }; +/* NIX Admin function Interrupt Vector Enumeration */ +enum nix_af_int_vec_e { +NIX_AF_INT_VEC_RVU =0x0 , +NIX_AF_INT_VEC_GEN =0x1 , +NIX_AF_INT_VEC_AQ_DONE =0x2 , +NIX_AF_INT_VEC_AF_ERR =0x3 , +NIX_AF_INT_VEC_POISON =0x4 , +NIX_AF_INT_VEC_CNT =0x5 , +}; +/** * RVU PF Interrupt Vector Enumeration */
Signature · 1 line
2.7.4
PATCH v2 8/15 octeontx2-af: Add SSO unit support to the AF driver
In reply to [email protected]From: Radha Mohan Chintakuntla <[email protected]>
This patch adds the SSO (Schedule/Synchronize/Order) unit support to the Adming Function (AF) driver including initial mailboxes, initialization of SSO hardware groups and workslots and their teardown sequence.
--- drivers/net/ethernet/marvell/octeontx2/af/Makefile | 2 +- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 90 +++ drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 28 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 24 + .../net/ethernet/marvell/octeontx2/af/rvu_reg.h | 180 ++++- .../net/ethernet/marvell/octeontx2/af/rvu_sso.c | 837 +++++++++++++++++++++ 6 files changed, 1157 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_sso.c
drivers/net/ethernet/marvell/octeontx2/af/Makefile +1 -1
@@ -8,4 +8,4 @@ obj-$(CONFIG_OCTEONTX2_AF) += octeontx2_af.o octeontx2_mbox-y := mbox.o octeontx2_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \ - rvu_reg.o rvu_npc.o rvu_debugfs.o + rvu_reg.o rvu_npc.o rvu_debugfs.o rvu_sso.o
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +90 -0
102 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +26 -2
@@ -653,6 +653,7 @@ static void rvu_free_hw_resources(struct rvu *rvu)rvu_npa_freemem (rvu);rvu_npc_freemem (rvu);rvu_nix_freemem (rvu); +rvu_sso_freemem (rvu);/* Free block LF bitmaps */ for (id =0 ; id <BLK_COUNT ; id++) {
@@ -954,6 +955,10 @@ static int rvu_setup_hw_resources(struct rvu *rvu)if (err) goto cgx_err; + err =rvu_sso_init (rvu); +if (err) + goto cgx_err; +return 0 ; cgx_err:
@@ -1018,7 +1023,7 @@ 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 blktype) {switch (blktype) {case BLKTYPE_NPA :
@@ -1047,7 +1052,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 (blktype !=BLKTYPE_SSO && !rvu_get_rsrc_mapcount (pfvf, blktype))return false;return true;
@@ -1933,12 +1938,30 @@ static void rvu_blklf_teardown(struct rvu *rvu, u16 pcifunc, u8 blkaddr)rvu_nix_lf_teardown (rvu, pcifunc, block->addr, lf); else if (block->addr == BLKADDR_NPA) rvu_npa_lf_teardown(rvu, pcifunc, lf); + else if (block->addr == BLKADDR_SSO) + rvu_sso_lf_teardown(rvu, pcifunc, lf, slot); + else if (block->addr == BLKADDR_SSOW) + rvu_ssow_lf_teardown(rvu, pcifunc, lf, slot); err = rvu_lf_reset(rvu, block, lf);if (err) {dev_err (rvu->dev,"Failed to reset blkaddr %d LF%d\n" , block->addr, lf); } + +if (block->addr ==BLKADDR_SSO ) +rvu_sso_hwgrp_config_thresh (rvu, block->addr, lf); + } +} + +static void rvu_sso_pfvf_rst (struct rvu *rvu,u16 pcifunc) +{ +struct rvu_pfvf *pfvf =rvu_get_pfvf (rvu, pcifunc); +struct rvu_hwinfo *hw = rvu->hw; + +if (pfvf->sso_uniq_ident) { +rvu_free_rsrc (&hw->sso.pfvf_ident, pfvf->sso_uniq_ident); + pfvf->sso_uniq_ident =0 ; } }
@@ -1957,6 +1980,7 @@ static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)rvu_blklf_teardown (rvu, pcifunc,BLKADDR_SSO );rvu_blklf_teardown (rvu, pcifunc,BLKADDR_NPA );rvu_detach_rsrcs (rvu,NULL , pcifunc); +rvu_sso_pfvf_rst (rvu, pcifunc);mutex_unlock (&rvu->flr_lock); }
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +24 -0
@@ -129,6 +129,19 @@ struct npc_mcam {u16 rx_miss_act_cntr;/* Counter for RX MISS action */ }; +struct sso_rsrc { +u8 sso_hws; +u16 sso_hwgrps; +u16 sso_xaq_num_works; +u16 sso_xaq_buf_size; +u16 sso_iue; +u64 iaq_rsvd; +u64 iaq_max; +u64 taq_rsvd; +u64 taq_max; +struct rsrc_bmap pfvf_ident; +}; +/* Structure for per RVU func info ie PF/VF */ struct rvu_pfvf {bool npalf;/* Only one NPALF per RVU_FUNC */
@@ -138,6 +151,7 @@ struct rvu_pfvf {u16 cptlfs;u16 timlfs;u8 cgx_lmac; +u8 sso_uniq_ident;/* Block LF's MSIX vector info */ struct rsrc_bmap msix;/* Bitmap for MSIX vector alloc */
@@ -257,6 +271,7 @@ struct rvu_hwinfo {struct nix_hw *nix0;struct npc_pkind pkind;struct npc_mcam mcam; +struct sso_rsrc sso; };struct mbox_wq_info {
@@ -399,6 +414,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 blktype);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);
@@ -447,6 +463,14 @@ void rvu_cgx_enadis_rx_bp(struct rvu *rvu, int pf, bool enable);int rvu_cgx_start_stop_io (struct rvu *rvu,u16 pcifunc,bool start);int rvu_cgx_nix_cuml_stats (struct rvu *rvu,void *cgxd,int lmac_id,int index,int rxtxflag,u64 *stat); + +/* SSO APIs */ +int rvu_sso_init (struct rvu *rvu); +void rvu_sso_freemem (struct rvu *rvu); +int rvu_sso_lf_teardown (struct rvu *rvu,u16 pcifunc,int lf,int slot_id); +int rvu_ssow_lf_teardown (struct rvu *rvu,u16 pcifunc,int lf,int slot_id); +void rvu_sso_hwgrp_config_thresh (struct rvu *rvu,int blkaddr,int lf); +/* NPA APIs */ int rvu_npa_init (struct rvu *rvu);void rvu_npa_freemem (struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h +179 -1
203 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_sso.c new file +837 -0
837 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 9/15 octeontx2-af: Config support for per HWGRP thresholds
In reply to [email protected]From: Pavan Nikhilesh <[email protected]>
Add mbox to support configuring per queue XAQ/TAQ/IAQ thresholds that helps in prioritizing each HWGRP differently
Also added support to retrieve stats of a given GWS/GGRP by a PF/VF.
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 30 ++++++ .../net/ethernet/marvell/octeontx2/af/rvu_sso.c | 101 +++++++++++++++++++++ 2 files changed, 131 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +30 -0
@@ -167,6 +167,9 @@ M(SSO_GRP_SET_PRIORITY, 0x605, sso_grp_set_priority, \M (SSO_GRP_GET_PRIORITY ,0x606 , sso_grp_get_priority, \ sso_info_req, sso_grp_priority) \ M(SSO_WS_CACHE_INV, 0x607, sso_ws_cache_inv, msg_req, msg_rsp) \ +M(SSO_GRP_QOS_CONFIG, 0x608, sso_grp_qos_config, sso_grp_qos_cfg, msg_rsp)\ +M(SSO_GRP_GET_STATS, 0x609, sso_grp_get_stats, sso_info_req, sso_grp_stats)\ +M (SSO_HWS_GET_STATS ,0x610 , sso_hws_get_stats, sso_info_req, sso_hws_stats)\/* TIM mbox IDs (range 0x800 - 0x9FF) */ \/* CPT mbox IDs (range 0xA00 - 0xBFF) */ \/* NPC mbox IDs (range 0x6000 - 0x7FFF) */ \
@@ -800,6 +803,33 @@ struct ssow_lf_free_req {u16 hws; }; +struct sso_grp_qos_cfg { +struct mbox_msghdr hdr; +u16 grp; +u32 xaq_limit; +u16 taq_thr; +u16 iaq_thr; +}; + +struct sso_grp_stats { +struct mbox_msghdr hdr; +u16 grp; +u64 ws_pc; +u64 ext_pc; +u64 wa_pc; +u64 ts_pc; +u64 ds_pc; +u64 dq_pc; +u64 aw_status; +u64 page_cnt; +}; + +struct sso_hws_stats { +struct mbox_msghdr hdr; +u16 hws; +u64 arbitration; +}; +/* NPC mbox message structs */ #define NPC_MCAM_ENTRY_INVALID 0xFFFF
drivers/net/ethernet/marvell/octeontx2/af/rvu_sso.c +101 -0
107 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 10/15 octeontx2-af: add debug msgs for SSO block errors
In reply to [email protected]From: Pavan Nikhilesh <[email protected]>
Added debug messages for SSO_AF_ERR0, SSO_AF_ERR2 and SSO_AF_RAS SSO AF error interrupts.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 5 + drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 2 + .../net/ethernet/marvell/octeontx2/af/rvu_sso.c | 208 +++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 8 + 4 files changed, 223 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +5 -0
@@ -2152,6 +2152,7 @@ static void rvu_unregister_interrupts(struct rvu *rvu)rvu_npa_unregister_interrupts (rvu);rvu_nix_unregister_interrupts (rvu); +rvu_sso_unregister_interrupts (rvu);/* Disable the Mbox interrupt */ rvu_write64(rvu, BLKADDR_RVUM, RVU_AF_PFAF_MBOX_INT_ENA_W1C,
@@ -2369,6 +2370,10 @@ static int rvu_register_interrupts(struct rvu *rvu)if (ret) goto fail; + ret =rvu_sso_register_interrupts (rvu); +if (ret) + goto fail; +return 0 ; fail:rvu_unregister_interrupts (rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +2 -0
@@ -467,6 +467,8 @@ int rvu_cgx_nix_cuml_stats(struct rvu *rvu, void *cgxd, int lmac_id, int index,/* SSO APIs */ int rvu_sso_init (struct rvu *rvu);void rvu_sso_freemem (struct rvu *rvu); +int rvu_sso_register_interrupts (struct rvu *rvu); +void rvu_sso_unregister_interrupts (struct rvu *rvu);int rvu_sso_lf_teardown (struct rvu *rvu,u16 pcifunc,int lf,int slot_id);int rvu_ssow_lf_teardown (struct rvu *rvu,u16 pcifunc,int lf,int slot_id);void rvu_sso_hwgrp_config_thresh (struct rvu *rvu,int blkaddr,int lf);
drivers/net/ethernet/marvell/octeontx2/af/rvu_sso.c +208 -0
220 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h +8 -0
@@ -80,6 +80,14 @@ enum nix_af_int_vec_e { NIX_AF_INT_VEC_CNT = 0x5, }; +/* SSO Admin function Interrupt Vector Enumeration */ +enum sso_af_int_vec_e { +SSO_AF_INT_VEC_ERR0 =0x0 , +SSO_AF_INT_VEC_ERR2 =0x1 , +SSO_AF_INT_VEC_RAS =0x2 , +SSO_AF_INT_VEC_CNT =0x3 , +}; +/** * RVU PF Interrupt Vector Enumeration */
Signature · 1 line
2.7.4
PATCH v2 11/15 octeontx2-af: add debugfs support for sso
In reply to [email protected]From: Pavan Nikhilesh <[email protected]>
Add debugfs for HWGRP performance counter stats, internal queue walks and few HWS debug registers.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 3 + .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 699 +++++++++++++++++++++ 2 files changed, 702 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +3 -0
@@ -50,6 +50,9 @@ struct rvu_debugfs {struct dentry *npa;struct dentry *nix;struct dentry *npc; +struct dentry *sso; +struct dentry *sso_hwgrp; +struct dentry *sso_hws;struct dump_ctx npa_aura_ctx;struct dump_ctx npa_pool_ctx;struct dump_ctx nix_cq_ctx;
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +699 -0
711 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 12/15 octeontx2-af: Add TIM unit support.
In reply to [email protected]From: Andrew Pinski <[email protected]>
Add TIM (Timer) unit support to AF driver that involves initializing and configuring TIM and its rings through mailbox. This block helps software to schedule SSO work entries for a future time.
--- drivers/net/ethernet/marvell/octeontx2/af/Makefile | 3 +- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 80 +++++ drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 12 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 4 + .../net/ethernet/marvell/octeontx2/af/rvu_reg.h | 12 + .../net/ethernet/marvell/octeontx2/af/rvu_tim.c | 322 +++++++++++++++++++++ 6 files changed, 429 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_tim.c
drivers/net/ethernet/marvell/octeontx2/af/Makefile +2 -1
@@ -8,4 +8,5 @@ obj-$(CONFIG_OCTEONTX2_AF) += octeontx2_af.o octeontx2_mbox-y := mbox.o octeontx2_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \ - rvu_reg.o rvu_npc.o rvu_debugfs.o rvu_sso.o + rvu_reg.o rvu_npc.o rvu_debugfs.o rvu_sso.o \ + rvu_tim.o
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +80 -0
90 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +9 -3
@@ -959,6 +959,10 @@ static int rvu_setup_hw_resources(struct rvu *rvu)if (err) goto cgx_err; + err =rvu_tim_init (rvu); +if (err) + goto cgx_err; +return 0 ; cgx_err:
@@ -1327,12 +1331,12 @@ int rvu_mbox_handler_attach_resources(struct rvu *rvu, goto exit;/* Now attach the requested resources */ -if (attach->npalf) -rvu_attach_block (rvu, pcifunc,BLKTYPE_NPA ,1 ); -if (attach->nixlf)rvu_attach_block (rvu, pcifunc,BLKTYPE_NIX ,1 ); +if (attach->npalf) +rvu_attach_block (rvu, pcifunc,BLKTYPE_NPA ,1 ); +if (attach->sso) {/* RVU func doesn't know which exact LF or slot is attached * to it, it always sees as slot 0,1,2. So for a 'modify'
@@ -1942,6 +1946,8 @@ static void rvu_blklf_teardown(struct rvu *rvu, u16 pcifunc, u8 blkaddr)rvu_sso_lf_teardown (rvu, pcifunc, lf, slot); else if (block->addr == BLKADDR_SSOW) rvu_ssow_lf_teardown(rvu, pcifunc, lf, slot); + else if (block->addr == BLKADDR_TIM) + rvu_tim_lf_teardown(rvu, pcifunc, lf, slot); err = rvu_lf_reset(rvu, block, lf);if (err) {
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +4 -0
@@ -524,6 +524,10 @@ void rvu_npc_get_mcam_counter_alloc_info(struct rvu *rvu, u16 pcifunc, int blkaddr, int *alloc_cnt, int *enable_cnt); +/* TIM APIs */ +int rvu_tim_init (struct rvu *rvu); +int rvu_tim_lf_teardown (struct rvu *rvu,u16 pcifunc,int lf,int slot); +#ifdef CONFIG_DEBUG_FS void rvu_dbg_init (struct rvu *rvu);void rvu_dbg_exit (struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h +12 -0
@@ -596,6 +596,18 @@#define TIM_AF_RVU_LF_CFG_DEBUG (0x30000)#define TIM_AF_BLK_RST (0x10)#define TIM_AF_LF_RST (0x20) +#define TIM_AF_BLK_RST (0x10) +#define TIM_AF_RINGX_GMCTL (a) (0x2000 | (a) << 3) +#define TIM_AF_RINGX_CTL0 (a) (0x4000 | (a) << 3) +#define TIM_AF_RINGX_CTL1 (a) (0x6000 | (a) << 3) +#define TIM_AF_RINGX_CTL2 (a) (0x8000 | (a) << 3) +#define TIM_AF_FLAGS_REG (0x80) +#define TIM_AF_FLAGS_REG_ENA_TIM BIT_ULL(0) +#define TIM_AF_RINGX_CTL1_ENA BIT_ULL(47) +#define TIM_AF_RINGX_CTL1_RCF_BUSY BIT_ULL(50) + +#define TIM_AF_RING_GMCTL_SHIFT 3 +#define TIM_AF_RING_SSO_PF_FUNC_SHIFT 0/* CPT */ #define CPT_AF_CONSTANTS0 (0x0000)
drivers/net/ethernet/marvell/octeontx2/af/rvu_tim.c new file +322 -0
322 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 13/15 octeontx2-af: verify ingress channel in MCAM entry
In reply to [email protected]From: Subbaraya Sundeep <[email protected]>
A RVU PF and it's VFs share a CGX port and can only take pkts received at that port. While installing MCAM entries for forwarding packets it should be made sure that this is not violated. Hence before installing MCAM entry sent by PF/VF the ingress channel in the match key needs to be verified.
This patch does this channel verification.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 4 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 1 + .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 47 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +2 -2
@@ -2479,7 +2479,7 @@ static void rvu_enable_afvf_intr(struct rvu *rvu)#define PCI_DEVID_OCTEONTX2_LBK 0xA061 -static int lbk_get_num_chans (void ) +int rvu_get_num_lbk_chans (void ) {struct pci_dev *pdev;void __iomem *base;
@@ -2514,7 +2514,7 @@ static int rvu_enable_sriov(struct rvu *rvu)return 0 ; } - chans =lbk_get_num_chans (); + chans =rvu_get_num_lbk_chans ();if (chans <0 )return chans;
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +1 -0
@@ -427,6 +427,7 @@ int rvu_get_lf(struct rvu *rvu, struct rvu_block *block, u16 pcifunc, u16 slot);int rvu_lf_reset (struct rvu *rvu,struct rvu_block *block,int lf);int rvu_get_blkaddr (struct rvu *rvu,int blktype,u16 pcifunc);int rvu_poll_reg (struct rvu *rvu,u64 block,u64 offset,u64 mask,bool zero); +int rvu_get_num_lbk_chans (void );/* RVU HW reg validation */ enum regmap_block {
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +47 -0
88 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 14/15 octeontx2-af: NPC Tx parsed data key extraction profile
In reply to [email protected]From: Kiran Kumar K <[email protected]>
This patch enables Tx side parsing by configuring the pkind 63 in tx_parse_cfg and add default ldata profile for tx.
Unlike Ingress parsing where CHAN field represents the port where the pkt is received, for a transmitted pkt, NIX HW adds a header which will have PF_FUNC, SQ idx information, which if extracted to NPC parse key can be used to do egress side filtering/forwarding.
This patch configures HW to extract this header info into parse key.
--- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 6 + .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 235 ++++++++++++++++----- 2 files changed, 191 insertions(+), 50 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +6 -0
@@ -58,6 +58,8 @@ enum nix_makr_fmt_indexes { NIX_MARK_CFG_MAX, }; +#define NIX_TX_PKIND 63ULL +/* For now considering MC resources needed for broadcast * pkt replication only. i.e 256 HWVFs + 12 PFs. */
@@ -1110,6 +1112,10 @@ int rvu_mbox_handler_nix_lf_alloc(struct rvu *rvu,/* Config Rx pkt length, csum checks and apad enable / disable */ rvu_write64 (rvu, blkaddr,NIX_AF_LFX_RX_CFG (nixlf), req->rx_cfg); +/* Configure pkind for TX parse config, 63 from npc_profile */ + cfg =NIX_TX_PKIND ; +rvu_write64 (rvu, blkaddr,NIX_AF_LFX_TX_PARSE_CFG (nixlf), cfg); + intf =is_afvf (pcifunc) ?NIX_INTF_TYPE_LBK :NIX_INTF_TYPE_CGX ; err =nix_interface_init (rvu, pcifunc, intf, nixlf);if (err)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +185 -50
374 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 15/15 octeontx2-af: Support to get CGX link info like current speed, fec etc
In reply to [email protected]From: Christina Jacob <[email protected]>
- Implements CGX_FW_DATA_GET command to get the cgx link info shared from atf.
- Implement CGX_FEC_SET mailbox message to set current FEC value.
- Update the link status structre in cgx with additional information such as the port type, current fec etc.
- Upon request, fetch FEC corrected and uncorrected block counters for the mapped CGX LMAC.
- If present get phy's EEPROM data as response to ethtool command.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 310 +++++++++++++++++++-- drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 11 +- .../net/ethernet/marvell/octeontx2/af/cgx_fw_if.h | 72 ++++- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 76 +++++ drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 4 + .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 99 ++++++- 6 files changed, 542 insertions(+), 30 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +292 -18
@@ -14,12 +14,14 @@#include <linux/pci.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> +#include <linux/ethtool.h> #include <linux/phy.h> #include <linux/of.h> #include <linux/of_mdio.h> #include <linux/of_net.h> #include "cgx.h" +#include "rvu.h" #define DRV_NAME "octeontx2-cgx"#define DRV_STRING "Marvell OcteonTX2 CGX/MAC Driver"
@@ -326,6 +328,11 @@ int cgx_get_rx_stats(void *cgxd, int lmac_id, int idx, u64 *rx_stat)if (!cgx || lmac_id >= cgx->lmac_count)return -ENODEV ; +#define CGX_RX_STAT_GLOBAL_INDEX 9 +/* pass lmac as 0 for CGX_CMR_RX_STAT9-12 */ +if (idx >=CGX_RX_STAT_GLOBAL_INDEX ) + lmac_id =0 ; + *rx_stat =cgx_read (cgx, lmac_id,CGXX_CMRX_RX_STAT0 + (idx *8 ));return 0 ; }
@@ -342,6 +349,58 @@ int cgx_get_tx_stats(void *cgxd, int lmac_id, int idx, u64 *tx_stat) }EXPORT_SYMBOL (cgx_get_tx_stats); +static int cgx_set_fec_stats_count (struct cgx_link_user_info *linfo) +{ +if (linfo->fec) { +switch (linfo->lmac_type_id) { +case LMAC_MODE_SGMII : +case LMAC_MODE_XAUI : +case LMAC_MODE_RXAUI : +case LMAC_MODE_QSGMII : +return 0 ; +case LMAC_MODE_10G_R : +case LMAC_MODE_25G_R : +case LMAC_MODE_100G_R : +case LMAC_MODE_USXGMII : +return 1 ; +case LMAC_MODE_40G_R : +return 4 ; +case LMAC_MODE_50G_R : +if (linfo->fec ==OTX2_FEC_BASER ) +return 2 ; +else +return 1 ; + } + } +return 0 ; +} + +int cgx_get_fec_stats (void *cgxd,int lmac_id,struct cgx_fec_stats_rsp *rsp) +{ +int stats, fec_stats_count =0 ; +int corr_reg, uncorr_reg; +struct cgx *cgx = cgxd; + +if (!cgx || lmac_id >= cgx->lmac_count) +return -ENODEV ; + fec_stats_count = +cgx_set_fec_stats_count (&cgx->lmac_idmap[lmac_id]->link_info); +if (cgx->lmac_idmap[lmac_id]->link_info.fec ==OTX2_FEC_BASER ) { + corr_reg =CGXX_SPUX_LNX_FEC_CORR_BLOCKS ; + uncorr_reg =CGXX_SPUX_LNX_FEC_UNCORR_BLOCKS ; + }else { + corr_reg =CGXX_SPUX_RSFEC_CORR ; + uncorr_reg =CGXX_SPUX_RSFEC_UNCORR ; + } +for (stats =0 ; stats < fec_stats_count; stats++) { + rsp->fec_corr_blks += +cgx_read (cgx, lmac_id, corr_reg + (stats *8 )); + rsp->fec_uncorr_blks += +cgx_read (cgx, lmac_id, uncorr_reg + (stats *8 )); + } +return 0 ; +} +int cgx_lmac_rx_tx_enable (void *cgxd,int lmac_id,bool enable) {struct cgx *cgx = cgxd;
@@ -352,9 +411,9 @@ int cgx_lmac_rx_tx_enable(void *cgxd, int lmac_id, bool enable) cfg =cgx_read (cgx, lmac_id,CGXX_CMRX_CFG );if (enable) - cfg |=CMR_EN |DATA_PKT_RX_EN |DATA_PKT_TX_EN ; + cfg |=DATA_PKT_RX_EN |DATA_PKT_TX_EN ;else - cfg &= ~(CMR_EN |DATA_PKT_RX_EN |DATA_PKT_TX_EN ); + cfg &= ~(DATA_PKT_RX_EN |DATA_PKT_TX_EN );cgx_write (cgx, lmac_id,CGXX_CMRX_CFG , cfg);return 0 ; }
@@ -534,8 +593,8 @@ static int cgx_fwi_cmd_send(u64 req, u64 *resp, struct lmac *lmac)return err; } -static inline int cgx_fwi_cmd_generic (u64 req,u64 *resp, -struct cgx *cgx,int lmac_id) +static int cgx_fwi_cmd_generic (u64 req,u64 *resp, +struct cgx *cgx,int lmac_id) {struct lmac *lmac;int err;
@@ -557,7 +616,7 @@ static inline int cgx_fwi_cmd_generic(u64 req, u64 *resp,return err; } -static inline void cgx_link_usertable_init (void ) +static void cgx_link_usertable_init (void ) { cgx_speed_mbps[CGX_LINK_NONE ] =0 ; cgx_speed_mbps[CGX_LINK_10M ] =10 ;
@@ -570,6 +629,7 @@ static inline void cgx_link_usertable_init(void) cgx_speed_mbps[CGX_LINK_25G ] =25000 ; cgx_speed_mbps[CGX_LINK_40G ] =40000 ; cgx_speed_mbps[CGX_LINK_50G ] =50000 ; + cgx_speed_mbps[CGX_LINK_80G ] =80000 ; cgx_speed_mbps[CGX_LINK_100G ] =100000 ; cgx_lmactype_string[LMAC_MODE_SGMII ] ="SGMII" ;
@@ -584,23 +644,175 @@ static inline void cgx_link_usertable_init(void) cgx_lmactype_string[LMAC_MODE_USXGMII ] ="USXGMII" ; } -static inline void link_status_user_format (u64 lstat, -struct cgx_link_user_info *linfo, -struct cgx *cgx,u8 lmac_id) +static int cgx_link_usertable_index_map (int speed) +{ +switch (speed) { +case SPEED_10 : +return CGX_LINK_10M ; +case SPEED_100 : +return CGX_LINK_100M ; +case SPEED_1000 : +return CGX_LINK_1G ; +case SPEED_2500 : +return CGX_LINK_2HG ; +case SPEED_5000 : +return CGX_LINK_5G ; +case SPEED_10000 : +return CGX_LINK_10G ; +case SPEED_20000 : +return CGX_LINK_20G ; +case SPEED_25000 : +return CGX_LINK_25G ; +case SPEED_40000 : +return CGX_LINK_40G ; +case SPEED_50000 : +return CGX_LINK_50G ; +case 80000 : +return CGX_LINK_80G ; +case SPEED_100000 : +return CGX_LINK_100G ; +case SPEED_UNKNOWN : +return CGX_LINK_NONE ; + } +return CGX_LINK_NONE ; +} + +static void set_mod_args (struct cgx_set_link_mode_args *args, +u32 speed,u8 duplex,u8 autoneg,u64 mode) +{ +/* firmware requires this value in the reverse format */ + args->duplex = duplex; + args->speed = speed; + args->mode = mode; + args->an = autoneg; + args->ports =0 ; +} + +static void otx2_map_ethtool_link_modes (u64 bitmask, +struct cgx_set_link_mode_args *args) +{ +switch (bitmask) { +case BIT_ULL (ETHTOOL_LINK_MODE_10baseT_Half_BIT): +set_mod_args (args,10 ,1 ,1 ,BIT_ULL (CGX_MODE_SGMII )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_10baseT_Full_BIT): +set_mod_args (args,10 ,0 ,1 ,BIT_ULL (CGX_MODE_SGMII )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_100baseT_Half_BIT): +set_mod_args (args,100 ,1 ,1 ,BIT_ULL (CGX_MODE_SGMII )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_100baseT_Full_BIT): +set_mod_args (args,100 ,0 ,1 ,BIT_ULL (CGX_MODE_SGMII )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_1000baseT_Half_BIT): +set_mod_args (args,1000 ,1 ,1 ,BIT_ULL (CGX_MODE_SGMII )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_1000baseT_Full_BIT): +set_mod_args (args,1000 ,0 ,1 ,BIT_ULL (CGX_MODE_SGMII )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_1000baseX_Full_BIT): +set_mod_args (args,1000 ,0 ,0 ,BIT_ULL (CGX_MODE_1000_BASEX )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_10000baseT_Full_BIT): +set_mod_args (args,1000 ,0 ,1 ,BIT_ULL (CGX_MODE_QSGMII )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT): +set_mod_args (args,10000 ,0 ,0 ,BIT_ULL (CGX_MODE_10G_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_10000baseR_FEC_BIT): +set_mod_args (args,10000 ,0 ,0 ,BIT_ULL (CGX_MODE_10G_C2M )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_10000baseKR_Full_BIT): +set_mod_args (args,10000 ,0 ,1 ,BIT_ULL (CGX_MODE_10G_KR )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT): +set_mod_args (args,20000 ,0 ,0 ,BIT_ULL (CGX_MODE_20G_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_10000baseCR_Full_BIT): +set_mod_args (args,25000 ,0 ,0 ,BIT_ULL (CGX_MODE_25G_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_25000baseSR_Full_BIT): +set_mod_args (args,25000 ,0 ,0 ,BIT_ULL (CGX_MODE_25G_C2M )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT): +set_mod_args (args,25000 ,0 ,0 ,BIT_ULL (CGX_MODE_25G_2_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_25000baseCR_Full_BIT): +set_mod_args (args,25000 ,0 ,1 ,BIT_ULL (CGX_MODE_25G_CR )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_25000baseKR_Full_BIT): +set_mod_args (args,25000 ,0 ,1 ,BIT_ULL (CGX_MODE_25G_KR )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT): +set_mod_args (args,40000 ,0 ,0 ,BIT_ULL (CGX_MODE_40G_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT): +set_mod_args (args,40000 ,0 ,0 ,BIT_ULL (CGX_MODE_40G_C2M )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT): +set_mod_args (args,40000 ,0 ,1 ,BIT_ULL (CGX_MODE_40G_CR4 )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT): +set_mod_args (args,40000 ,0 ,1 ,BIT_ULL (CGX_MODE_40G_KR4 )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_10000baseSR_Full_BIT): +set_mod_args (args,40000 ,0 ,0 ,BIT_ULL (CGX_MODE_40GAUI_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT): +set_mod_args (args,50000 ,0 ,0 ,BIT_ULL (CGX_MODE_50G_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT): +set_mod_args (args,50000 ,0 ,0 ,BIT_ULL (CGX_MODE_50G_4_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_10000baseLR_Full_BIT): +set_mod_args (args,50000 ,0 ,0 ,BIT_ULL (CGX_MODE_50G_C2M )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT): +set_mod_args (args,50000 ,0 ,1 ,BIT_ULL (CGX_MODE_50G_CR )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT): +set_mod_args (args,50000 ,0 ,1 ,BIT_ULL (CGX_MODE_50G_KR )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT): +set_mod_args (args,80000 ,0 ,0 ,BIT_ULL (CGX_MODE_80GAUI_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT): +set_mod_args (args,100000 ,0 ,0 ,BIT_ULL (CGX_MODE_100G_C2C )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT): +set_mod_args (args,100000 ,0 ,0 ,BIT_ULL (CGX_MODE_100G_C2M )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT): +set_mod_args (args,100000 ,0 ,1 ,BIT_ULL (CGX_MODE_100G_CR4 )); +break ; +case BIT_ULL (ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT): +set_mod_args (args,100000 ,0 ,1 ,BIT_ULL (CGX_MODE_100G_KR4 )); +break ; +default : +set_mod_args (args,0 ,1 ,0 ,BIT_ULL (CGX_MODE_MAX )); +break ; + } +} + +static void link_status_user_format (u64 lstat, +struct cgx_link_user_info *linfo, +struct cgx *cgx,u8 lmac_id) {char *lmac_string; linfo->link_up =FIELD_GET (RESP_LINKSTAT_UP , lstat); linfo->full_duplex =FIELD_GET (RESP_LINKSTAT_FDUPLEX , lstat); linfo->speed = cgx_speed_mbps[FIELD_GET (RESP_LINKSTAT_SPEED , lstat)]; + linfo->an =FIELD_GET (RESP_LINKSTAT_AN , lstat); + linfo->fec =FIELD_GET (RESP_LINKSTAT_FEC , lstat); + linfo->port =FIELD_GET (RESP_LINKSTAT_PORT , lstat); linfo->lmac_type_id =cgx_get_lmac_type (cgx, lmac_id); lmac_string = cgx_lmactype_string[linfo->lmac_type_id];strncpy (linfo->lmac_type, lmac_string,LMACTYPE_STR_LEN -1 ); }/* Hardware event handlers */ -static inline void cgx_link_change_handler (u64 lstat, -struct lmac *lmac) +static void cgx_link_change_handler (u64 lstat,struct lmac *lmac) {struct cgx_link_user_info *linfo;struct cgx *cgx = lmac->cgx;
@@ -620,6 +832,8 @@ static inline void cgx_link_change_handler(u64 lstat, lmac->link_info = event.link_uinfo; linfo = &lmac->link_info; +if (err_type ==CGX_ERR_SPEED_CHANGE_INVALID ) +return ;/* Ensure callback doesn't get unregistered until we finish it */ spin_lock (&lmac->event_cb_lock);
@@ -642,13 +856,14 @@ static inline void cgx_link_change_handler(u64 lstat,spin_unlock (&lmac->event_cb_lock); } -static inline bool cgx_cmdresp_is_linkevent (u64 event) +static bool cgx_cmdresp_is_linkevent (u64 event) {u8 id; id =FIELD_GET (EVTREG_ID , event);if (id ==CGX_CMD_LINK_BRING_UP || - id ==CGX_CMD_LINK_BRING_DOWN ) + id ==CGX_CMD_LINK_BRING_DOWN || + id ==CGX_CMD_MODE_CHANGE )return true;else return false;
@@ -746,7 +961,7 @@ static irqreturn_t cgx_fwi_event_handler(int irq, void *data)/* Release thread waiting for completion */ lmac->cmd_pend = false; -wake_up_interruptible (&lmac->wq_cmd_cmplt); +wake_up (&lmac->wq_cmd_cmplt);break ;case CGX_EVT_ASYNC :if (cgx_event_is_linkevent (event))
@@ -819,6 +1034,53 @@ int cgx_get_fwdata_base(u64 *base)return err; } +int cgx_set_fec (u64 fec,int cgx_id,int lmac_id) +{ +u64 req =0 , resp; +struct cgx *cgx; +int err =0 ; + + cgx =cgx_get_pdata (cgx_id); +if (!cgx) +return -ENXIO ; + + req =FIELD_SET (CMDREG_ID ,CGX_CMD_SET_FEC , req); + req =FIELD_SET (CMDSETFEC , fec, req); + err =cgx_fwi_cmd_generic (req, &resp, cgx, lmac_id); +if (!err) { + cgx->lmac_idmap[lmac_id]->link_info.fec = +FIELD_GET (RESP_LINKSTAT_FEC , resp); +return cgx->lmac_idmap[lmac_id]->link_info.fec; + } +return err; +} + +int cgx_set_link_mode (void *cgxd,struct cgx_set_link_mode_args args, +int cgx_id,int lmac_id) +{ +struct cgx *cgx = cgxd; +u64 req =0 , resp; +int err =0 ; + +if (!cgx) +return -ENODEV ; + +if (args.mode) +otx2_map_ethtool_link_modes (args.mode, &args); +if (!args.speed && args.duplex && !args.an) +return -EINVAL ; + + req =FIELD_SET (CMDREG_ID ,CGX_CMD_MODE_CHANGE , req); + req =FIELD_SET (CMDMODECHANGE_SPEED , +cgx_link_usertable_index_map (args.speed), req); + req =FIELD_SET (CMDMODECHANGE_DUPLEX , args.duplex, req); + req =FIELD_SET (CMDMODECHANGE_AN , args.an, req); + req =FIELD_SET (CMDMODECHANGE_PORT , args.ports, req); + req =FIELD_SET (CMDMODECHANGE_FLAGS , args.mode, req); + err =cgx_fwi_cmd_generic (req, &resp, cgx, lmac_id); +return err; +} +static int cgx_fwi_link_change (struct cgx *cgx,int lmac_id,bool enable) {u64 req =0 ;
@@ -880,6 +1142,16 @@ static void cgx_lmac_linkup_work(struct work_struct *work) } } +int cgx_set_link_state (void *cgxd,int lmac_id,bool enable) +{ +struct cgx *cgx = cgxd; + +if (!cgx) +return -ENODEV ; + +return cgx_fwi_link_change (cgx, lmac_id, enable); +} +int cgx_lmac_linkup_start (void *cgxd) {struct cgx *cgx = cgxd;
@@ -912,6 +1184,7 @@ static int cgx_lmac_init(struct cgx *cgx)sprintf (lmac->name,"cgx_fwi_%d_%d" , cgx->cgx_id, i); lmac->lmac_id = i; lmac->cgx = cgx; +init_waitqueue_head (&lmac->wq_cmd_cmplt);mutex_init (&lmac->cmd_lock);spin_lock_init (&lmac->event_cb_lock);
@@ -1009,7 +1282,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (!cgx->cgx_cmd_workq) {dev_err (dev,"alloc workqueue failed for cgx cmd" ); err = -ENOMEM ; - goto err_free_irq_vectors; + goto err_release_regions; }list_add (&cgx->cgx_list, &cgx_list);
@@ -1025,8 +1298,6 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_release_lmac:cgx_lmac_exit (cgx);list_del (&cgx->cgx_list); -err_free_irq_vectors: -pci_free_irq_vectors (pdev); err_release_regions:pci_release_regions (pdev); err_disable_device:
@@ -1039,8 +1310,11 @@ static void cgx_remove(struct pci_dev *pdev) {struct cgx *cgx =pci_get_drvdata (pdev); -cgx_lmac_exit (cgx); -list_del (&cgx->cgx_list); +if (cgx) { +cgx_lmac_exit (cgx); +list_del (&cgx->cgx_list); + } +pci_free_irq_vectors (pdev);pci_release_regions (pdev);pci_disable_device (pdev);
drivers/net/ethernet/marvell/octeontx2/af/cgx.h +10 -1
@@ -52,10 +52,14 @@#define CGXX_SCRATCH1_REG 0x1058#define CGX_CONST 0x2000#define CGXX_SPUX_CONTROL1 0x10000 +#define CGXX_SPUX_LNX_FEC_CORR_BLOCKS 0x10700 +#define CGXX_SPUX_LNX_FEC_UNCORR_BLOCKS 0x10800 +#define CGXX_SPUX_RSFEC_CORR 0x10088 +#define CGXX_SPUX_RSFEC_UNCORR 0x10090 +#define CGXX_SPUX_CONTROL1_LBK BIT_ULL(14)#define CGXX_GMP_PCS_MRX_CTL 0x30000#define CGXX_GMP_PCS_MRX_CTL_LBK BIT_ULL(14) -#define CGXX_SMUX_RX_FRM_CTL 0x20020#define CGX_SMUX_RX_FRM_CTL_CTL_BCK BIT_ULL(3)#define CGXX_GMP_GMI_RXX_FRM_CTL 0x38028
@@ -124,6 +128,7 @@ int cgx_lmac_evh_register(struct cgx_event_cb *cb, void *cgxd, int lmac_id);int cgx_lmac_evh_unregister (void *cgxd,int lmac_id);int cgx_get_tx_stats (void *cgxd,int lmac_id,int idx,u64 *tx_stat);int cgx_get_rx_stats (void *cgxd,int lmac_id,int idx,u64 *rx_stat); +int cgx_get_fec_stats (void *cgxd,int lmac_id,struct cgx_fec_stats_rsp *rsp);int cgx_lmac_rx_tx_enable (void *cgxd,int lmac_id,bool enable);int cgx_lmac_tx_enable (void *cgxd,int lmac_id,bool enable);int cgx_lmac_addr_set (u8 cgx_id,u8 lmac_id,u8 *mac_addr);
@@ -135,9 +140,13 @@ int cgx_get_link_info(void *cgxd, int lmac_id, struct cgx_link_user_info *linfo);int cgx_lmac_linkup_start (void *cgxd);int cgx_get_fwdata_base (u64 *base); +int cgx_set_fec (u64 fec,int cgx_id,int lmac_id); +int cgx_set_link_mode (void *cgxd,struct cgx_set_link_mode_args args, +int cgx_id,int lmac_id);int cgx_lmac_get_pause_frm (void *cgxd,int lmac_id,u8 *tx_pause,u8 *rx_pause);int cgx_lmac_set_pause_frm (void *cgxd,int lmac_id,u8 tx_pause,u8 rx_pause); +int cgx_set_link_state (void *cgxd,int lmac_id,bool enable);int cgx_get_mkex_prfl_info (u64 *addr,u64 *size);#endif /* CGX_H */
drivers/net/ethernet/marvell/octeontx2/af/cgx_fw_if.h +68 -4
122 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +76 -0
100 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +4 -0
@@ -305,6 +305,10 @@ struct rvu_fwdata {u64 msixtr_base;#define FWDATA_RESERVED_MEM 1023u64 reserved[FWDATA_RESERVED_MEM ]; +/* Do not add new fields below this line */ +#define CGX_MAX 4 +#define CGX_LMACS_MAX 4 +struct cgx_lmac_fwdata_s cgx_fw_data[CGX_MAX ][CGX_LMACS_MAX ]; };struct rvu {
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +92 -7
127 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 9 lines · On Tue, 19 Nov 2019 16:47:24 +0530, [email protected] wrote:
From: Sunil Goutham <[email protected]>
SSO HW block provides packet (or work) queueing, scheduling and synchronization. Also supports priorities and ordering. TIM or the timer HW block enables software to schedule SSO work for a future time.
This patch series adds support for SSO and TIM HW blocks, enables them to be configured and used by RVU PF/VF devices or drivers.
Quoted 12 lines
Also added support for
- Backpressure configuration.
- Pause frames or flow control enabling/disabling.
- Added a shared data structure between firmware and RVU admin function (AF) which will be used to get static information like interface MAC addresses, link modes, speeds, autoneg support etc.
- FEC (Forward error correction) config support for CGX.
- Retrieve FEC stats, PHY EEPROM etc from firmware
- Retrieving CGX LMAC info and to toggle it.
- Added debug prints for each of error interrupts raised by NIX, NPA and SSO blocks. These will help in identifying configuration and underlying HW functionality issues.
Please CC people who gave you reviews on new version of the patches. Especially if you didn't bother to address/answer it.
This driver doesn't seem to function in ways which are familiar in the upstream Linux kernel.
As I asked in my review of patch 4 in v1, please provide us with accurate description of how does a system with a octeontx2 operate. Best in the form of RST documentation in the Documentation/ directory, otherwise it's very hard for upstream folks to review what you're doing.
Thank you.
David Miller
maintainerFrom: Jakub Kicinski <[email protected]>
Date: Tue, 19 Nov 2019 13:46:38 -0800
Quoted 4 lines
As I asked in my review of patch 4 in v1, please provide us with accurate description of how does a system with a octeontx2 operate. Best in the form of RST documentation in the
Documentation/directory, otherwise it's very hard for upstream folks to review what you're doing.
Yes, please do this.
Some of us are strongly suspecting that there is a third agent (via an SDK or similar) that programs part of this chip in a complete system and if that is the case you must fully disclose how all of this is intended to work.
Right now nobody has any idea what any of these new feature components are, how there are used, how they are configured by the user, etc.
And the choices of things to put into debugfs seem completely arbitrary.
In short, these octeontx2 submissions are for huge complicated chip and lack any wholistic description of how this stuff works, understandable by those reviewing your changes rather than those who are experts about this networking chip.
Thank you.
Quoted 10 lines · David Miller
From: Jakub Kicinski <[email protected]>
Date: Tue, 19 Nov 2019 13:46:38 -0800Quoted 4 lines
As I asked in my review of patch 4 in v1, please provide us with accurate description of how does a system with a octeontx2 operate. Best in the form of RST documentation in the
Documentation/directory, otherwise it's very hard for upstream folks to review what you're doing.Yes, please do this.
Sure, will submit v3 with documentation which provides a high level overview of the hardware
and the kernel drivers.
Quoted 6 lines
Some of us are strongly suspecting that there is a third agent (via an SDK or similar) that programs part of this chip in a complete system and if that is the case you must fully disclose how all of this is intended to work.
The ones which configures HW are the drivers which may be in kernel or userspace.
Few minor things are setup by firmware before kernel boots.
Thanks,
Sunil.