mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
Merge branch 'octeontx2-af-NPC-MCAM-support-and-FLR-handling'
Sunil Goutham says: ==================== octeontx2-af: NPC MCAM support and FLR handling This patchset is a continuation to earlier submitted three patch series to add a new driver for Marvell's OcteonTX2 SOC's Resource virtualization unit (RVU) admin function driver. 1. octeontx2-af: Add RVU Admin Function driver https://www.spinics.net/lists/netdev/msg528272.html 2. octeontx2-af: NPA and NIX blocks initialization https://www.spinics.net/lists/netdev/msg529163.html 3. octeontx2-af: NPC parser and NIX blocks initialization https://www.spinics.net/lists/netdev/msg530252.html This patch series adds support for below RVU generic: - Function Level Reset irq handler When FLR is triggered for PFs, AF receives interrupt. This patchset adds logic for cleaning up of NPA, NIX and NPC block resources being used by PF. - Mailbox communication between AF and it's VFs. Unlike VFs of PF1-PFn, AF which is PF0 can communicate with it's VFs directly. Added support for the same. - AF's VFs IO configuration These VFs are mapped to use internal HW loopback channels instead of CGX LMACs. Each pair of VFs work as two of ends of hardwired interfaces. VF0's TX is VF1's Rx & viceversa. NPC block: - MCAM entry management Alloc/Free of contiguous/non-contiguous and lower/higher priority MCAM entry allocation and programming support. - MCAM counters management and map/unmap with MCAM entries - Default KEY extract profile - HW errata workarounds NIX block: - Minimum and maximum allowed packet length config - HW errata workarounds Few more changes like shift to use mutex instead of spinlock etc are done in this patchset. Changes from v2: 1 Fixed commit message of patch 'Relax resource lock into mutex' to a more unambiguous one. - Suggested by David Miller. Changes from v1: 1 Converted all mailbox message handler API names to small letters from mixed small and capital letters. - Suggested by David Miller. 2 Fixed endian issues in patch 'Add support for stripping STAG/CTAG' - Suggested by Arnd Bergmann 3 Elaborated commit message of patch 'Add FLR interrupt handler' to make it a bit more easy to understand. - Suggested by Arnd Bergmann Will fix the padding and alignment in mailbox message structure in a follow-up patch. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
7abaf9a8b4
11 changed files with 3066 additions and 324 deletions
|
@ -22,6 +22,7 @@
|
|||
|
||||
#define MAX_CGX 3
|
||||
#define MAX_LMAC_PER_CGX 4
|
||||
#define CGX_FIFO_LEN 65536 /* 64K for both Rx & Tx */
|
||||
#define CGX_OFFSET(x) ((x) * MAX_LMAC_PER_CGX)
|
||||
|
||||
/* Registers */
|
||||
|
|
|
@ -143,6 +143,11 @@ enum nix_scheduler {
|
|||
NIX_TXSCH_LVL_CNT = 0x5,
|
||||
};
|
||||
|
||||
/* Min/Max packet sizes, excluding FCS */
|
||||
#define NIC_HW_MIN_FRS 40
|
||||
#define NIC_HW_MAX_FRS 9212
|
||||
#define SDP_HW_MAX_FRS 65535
|
||||
|
||||
/* NIX RX action operation*/
|
||||
#define NIX_RX_ACTIONOP_DROP (0x0ull)
|
||||
#define NIX_RX_ACTIONOP_UCAST (0x1ull)
|
||||
|
@ -169,7 +174,9 @@ enum nix_scheduler {
|
|||
|
||||
#define MAX_LMAC_PKIND 12
|
||||
#define NIX_LINK_CGX_LMAC(a, b) (0 + 4 * (a) + (b))
|
||||
#define NIX_LINK_LBK(a) (12 + (a))
|
||||
#define NIX_CHAN_CGX_LMAC_CHX(a, b, c) (0x800 + 0x100 * (a) + 0x10 * (b) + (c))
|
||||
#define NIX_CHAN_LBK_CHX(a, b) (0 + 0x100 * (a) + (b))
|
||||
|
||||
/* NIX LSO format indices.
|
||||
* As of now TSO is the only one using, so statically assigning indices.
|
||||
|
|
|
@ -290,7 +290,7 @@ EXPORT_SYMBOL(otx2_mbox_nonempty);
|
|||
const char *otx2_mbox_id2name(u16 id)
|
||||
{
|
||||
switch (id) {
|
||||
#define M(_name, _id, _1, _2) case _id: return # _name;
|
||||
#define M(_name, _id, _1, _2, _3) case _id: return # _name;
|
||||
MBOX_MESSAGES
|
||||
#undef M
|
||||
default:
|
||||
|
|
|
@ -120,54 +120,93 @@ static inline struct mbox_msghdr *otx2_mbox_alloc_msg(struct otx2_mbox *mbox,
|
|||
|
||||
#define MBOX_MESSAGES \
|
||||
/* Generic mbox IDs (range 0x000 - 0x1FF) */ \
|
||||
M(READY, 0x001, msg_req, ready_msg_rsp) \
|
||||
M(ATTACH_RESOURCES, 0x002, rsrc_attach, msg_rsp) \
|
||||
M(DETACH_RESOURCES, 0x003, rsrc_detach, msg_rsp) \
|
||||
M(MSIX_OFFSET, 0x004, msg_req, msix_offset_rsp) \
|
||||
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(VF_FLR, 0x006, vf_flr, msg_req, msg_rsp) \
|
||||
/* CGX mbox IDs (range 0x200 - 0x3FF) */ \
|
||||
M(CGX_START_RXTX, 0x200, msg_req, msg_rsp) \
|
||||
M(CGX_STOP_RXTX, 0x201, msg_req, msg_rsp) \
|
||||
M(CGX_STATS, 0x202, msg_req, cgx_stats_rsp) \
|
||||
M(CGX_MAC_ADDR_SET, 0x203, cgx_mac_addr_set_or_get, \
|
||||
M(CGX_START_RXTX, 0x200, cgx_start_rxtx, msg_req, msg_rsp) \
|
||||
M(CGX_STOP_RXTX, 0x201, cgx_stop_rxtx, msg_req, msg_rsp) \
|
||||
M(CGX_STATS, 0x202, cgx_stats, msg_req, cgx_stats_rsp) \
|
||||
M(CGX_MAC_ADDR_SET, 0x203, cgx_mac_addr_set, cgx_mac_addr_set_or_get, \
|
||||
cgx_mac_addr_set_or_get) \
|
||||
M(CGX_MAC_ADDR_GET, 0x204, cgx_mac_addr_set_or_get, \
|
||||
M(CGX_MAC_ADDR_GET, 0x204, cgx_mac_addr_get, cgx_mac_addr_set_or_get, \
|
||||
cgx_mac_addr_set_or_get) \
|
||||
M(CGX_PROMISC_ENABLE, 0x205, msg_req, msg_rsp) \
|
||||
M(CGX_PROMISC_DISABLE, 0x206, msg_req, msg_rsp) \
|
||||
M(CGX_START_LINKEVENTS, 0x207, msg_req, msg_rsp) \
|
||||
M(CGX_STOP_LINKEVENTS, 0x208, msg_req, msg_rsp) \
|
||||
M(CGX_GET_LINKINFO, 0x209, msg_req, cgx_link_info_msg) \
|
||||
M(CGX_INTLBK_ENABLE, 0x20A, msg_req, msg_rsp) \
|
||||
M(CGX_INTLBK_DISABLE, 0x20B, msg_req, msg_rsp) \
|
||||
M(CGX_PROMISC_ENABLE, 0x205, cgx_promisc_enable, msg_req, msg_rsp) \
|
||||
M(CGX_PROMISC_DISABLE, 0x206, cgx_promisc_disable, msg_req, msg_rsp) \
|
||||
M(CGX_START_LINKEVENTS, 0x207, cgx_start_linkevents, msg_req, msg_rsp) \
|
||||
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) \
|
||||
/* NPA mbox IDs (range 0x400 - 0x5FF) */ \
|
||||
M(NPA_LF_ALLOC, 0x400, npa_lf_alloc_req, npa_lf_alloc_rsp) \
|
||||
M(NPA_LF_FREE, 0x401, msg_req, msg_rsp) \
|
||||
M(NPA_AQ_ENQ, 0x402, npa_aq_enq_req, npa_aq_enq_rsp) \
|
||||
M(NPA_HWCTX_DISABLE, 0x403, hwctx_disable_req, msg_rsp) \
|
||||
M(NPA_LF_ALLOC, 0x400, npa_lf_alloc, \
|
||||
npa_lf_alloc_req, npa_lf_alloc_rsp) \
|
||||
M(NPA_LF_FREE, 0x401, npa_lf_free, msg_req, msg_rsp) \
|
||||
M(NPA_AQ_ENQ, 0x402, npa_aq_enq, npa_aq_enq_req, npa_aq_enq_rsp) \
|
||||
M(NPA_HWCTX_DISABLE, 0x403, npa_hwctx_disable, hwctx_disable_req, msg_rsp)\
|
||||
/* SSO/SSOW mbox IDs (range 0x600 - 0x7FF) */ \
|
||||
/* TIM mbox IDs (range 0x800 - 0x9FF) */ \
|
||||
/* CPT mbox IDs (range 0xA00 - 0xBFF) */ \
|
||||
/* NPC mbox IDs (range 0x6000 - 0x7FFF) */ \
|
||||
M(NPC_MCAM_ALLOC_ENTRY, 0x6000, npc_mcam_alloc_entry, npc_mcam_alloc_entry_req,\
|
||||
npc_mcam_alloc_entry_rsp) \
|
||||
M(NPC_MCAM_FREE_ENTRY, 0x6001, npc_mcam_free_entry, \
|
||||
npc_mcam_free_entry_req, msg_rsp) \
|
||||
M(NPC_MCAM_WRITE_ENTRY, 0x6002, npc_mcam_write_entry, \
|
||||
npc_mcam_write_entry_req, msg_rsp) \
|
||||
M(NPC_MCAM_ENA_ENTRY, 0x6003, npc_mcam_ena_entry, \
|
||||
npc_mcam_ena_dis_entry_req, msg_rsp) \
|
||||
M(NPC_MCAM_DIS_ENTRY, 0x6004, npc_mcam_dis_entry, \
|
||||
npc_mcam_ena_dis_entry_req, msg_rsp) \
|
||||
M(NPC_MCAM_SHIFT_ENTRY, 0x6005, npc_mcam_shift_entry, npc_mcam_shift_entry_req,\
|
||||
npc_mcam_shift_entry_rsp) \
|
||||
M(NPC_MCAM_ALLOC_COUNTER, 0x6006, npc_mcam_alloc_counter, \
|
||||
npc_mcam_alloc_counter_req, \
|
||||
npc_mcam_alloc_counter_rsp) \
|
||||
M(NPC_MCAM_FREE_COUNTER, 0x6007, npc_mcam_free_counter, \
|
||||
npc_mcam_oper_counter_req, msg_rsp) \
|
||||
M(NPC_MCAM_UNMAP_COUNTER, 0x6008, npc_mcam_unmap_counter, \
|
||||
npc_mcam_unmap_counter_req, msg_rsp) \
|
||||
M(NPC_MCAM_CLEAR_COUNTER, 0x6009, npc_mcam_clear_counter, \
|
||||
npc_mcam_oper_counter_req, msg_rsp) \
|
||||
M(NPC_MCAM_COUNTER_STATS, 0x600a, npc_mcam_counter_stats, \
|
||||
npc_mcam_oper_counter_req, \
|
||||
npc_mcam_oper_counter_rsp) \
|
||||
M(NPC_MCAM_ALLOC_AND_WRITE_ENTRY, 0x600b, npc_mcam_alloc_and_write_entry, \
|
||||
npc_mcam_alloc_and_write_entry_req, \
|
||||
npc_mcam_alloc_and_write_entry_rsp) \
|
||||
M(NPC_GET_KEX_CFG, 0x600c, npc_get_kex_cfg, \
|
||||
msg_req, npc_get_kex_cfg_rsp) \
|
||||
/* NIX mbox IDs (range 0x8000 - 0xFFFF) */ \
|
||||
M(NIX_LF_ALLOC, 0x8000, nix_lf_alloc_req, nix_lf_alloc_rsp) \
|
||||
M(NIX_LF_FREE, 0x8001, msg_req, msg_rsp) \
|
||||
M(NIX_AQ_ENQ, 0x8002, nix_aq_enq_req, nix_aq_enq_rsp) \
|
||||
M(NIX_HWCTX_DISABLE, 0x8003, hwctx_disable_req, msg_rsp) \
|
||||
M(NIX_TXSCH_ALLOC, 0x8004, nix_txsch_alloc_req, nix_txsch_alloc_rsp) \
|
||||
M(NIX_TXSCH_FREE, 0x8005, nix_txsch_free_req, msg_rsp) \
|
||||
M(NIX_TXSCHQ_CFG, 0x8006, nix_txschq_config, msg_rsp) \
|
||||
M(NIX_STATS_RST, 0x8007, msg_req, msg_rsp) \
|
||||
M(NIX_VTAG_CFG, 0x8008, nix_vtag_config, msg_rsp) \
|
||||
M(NIX_RSS_FLOWKEY_CFG, 0x8009, nix_rss_flowkey_cfg, msg_rsp) \
|
||||
M(NIX_SET_MAC_ADDR, 0x800a, nix_set_mac_addr, msg_rsp) \
|
||||
M(NIX_SET_RX_MODE, 0x800b, nix_rx_mode, msg_rsp)
|
||||
M(NIX_LF_ALLOC, 0x8000, nix_lf_alloc, \
|
||||
nix_lf_alloc_req, nix_lf_alloc_rsp) \
|
||||
M(NIX_LF_FREE, 0x8001, nix_lf_free, msg_req, msg_rsp) \
|
||||
M(NIX_AQ_ENQ, 0x8002, nix_aq_enq, nix_aq_enq_req, nix_aq_enq_rsp) \
|
||||
M(NIX_HWCTX_DISABLE, 0x8003, nix_hwctx_disable, \
|
||||
hwctx_disable_req, msg_rsp) \
|
||||
M(NIX_TXSCH_ALLOC, 0x8004, nix_txsch_alloc, \
|
||||
nix_txsch_alloc_req, nix_txsch_alloc_rsp) \
|
||||
M(NIX_TXSCH_FREE, 0x8005, nix_txsch_free, nix_txsch_free_req, msg_rsp) \
|
||||
M(NIX_TXSCHQ_CFG, 0x8006, nix_txschq_cfg, nix_txschq_config, msg_rsp) \
|
||||
M(NIX_STATS_RST, 0x8007, nix_stats_rst, msg_req, msg_rsp) \
|
||||
M(NIX_VTAG_CFG, 0x8008, nix_vtag_cfg, nix_vtag_config, msg_rsp) \
|
||||
M(NIX_RSS_FLOWKEY_CFG, 0x8009, nix_rss_flowkey_cfg, \
|
||||
nix_rss_flowkey_cfg, msg_rsp) \
|
||||
M(NIX_SET_MAC_ADDR, 0x800a, nix_set_mac_addr, nix_set_mac_addr, msg_rsp) \
|
||||
M(NIX_SET_RX_MODE, 0x800b, nix_set_rx_mode, nix_rx_mode, msg_rsp) \
|
||||
M(NIX_SET_HW_FRS, 0x800c, nix_set_hw_frs, nix_frs_cfg, msg_rsp) \
|
||||
M(NIX_LF_START_RX, 0x800d, nix_lf_start_rx, msg_req, msg_rsp) \
|
||||
M(NIX_LF_STOP_RX, 0x800e, nix_lf_stop_rx, msg_req, msg_rsp) \
|
||||
M(NIX_RXVLAN_ALLOC, 0x8012, nix_rxvlan_alloc, msg_req, msg_rsp)
|
||||
|
||||
/* Messages initiated by AF (range 0xC00 - 0xDFF) */
|
||||
#define MBOX_UP_CGX_MESSAGES \
|
||||
M(CGX_LINK_EVENT, 0xC00, cgx_link_info_msg, msg_rsp)
|
||||
M(CGX_LINK_EVENT, 0xC00, cgx_link_event, cgx_link_info_msg, msg_rsp)
|
||||
|
||||
enum {
|
||||
#define M(_name, _id, _1, _2) MBOX_MSG_ ## _name = _id,
|
||||
#define M(_name, _id, _1, _2, _3) MBOX_MSG_ ## _name = _id,
|
||||
MBOX_MESSAGES
|
||||
MBOX_UP_CGX_MESSAGES
|
||||
#undef M
|
||||
|
@ -191,6 +230,13 @@ struct msg_rsp {
|
|||
struct mbox_msghdr hdr;
|
||||
};
|
||||
|
||||
/* RVU mailbox error codes
|
||||
* Range 256 - 300.
|
||||
*/
|
||||
enum rvu_af_status {
|
||||
RVU_INVALID_VF_ID = -256,
|
||||
};
|
||||
|
||||
struct ready_msg_rsp {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 sclk_feq; /* SCLK frequency */
|
||||
|
@ -347,6 +393,8 @@ struct hwctx_disable_req {
|
|||
u8 ctype;
|
||||
};
|
||||
|
||||
/* NIX mbox message formats */
|
||||
|
||||
/* NIX mailbox error codes
|
||||
* Range 401 - 500.
|
||||
*/
|
||||
|
@ -365,6 +413,8 @@ enum nix_af_status {
|
|||
NIX_AF_INVAL_TXSCHQ_CFG = -412,
|
||||
NIX_AF_SMQ_FLUSH_FAILED = -413,
|
||||
NIX_AF_ERR_LF_RESET = -414,
|
||||
NIX_AF_INVAL_NPA_PF_FUNC = -419,
|
||||
NIX_AF_INVAL_SSO_PF_FUNC = -420,
|
||||
};
|
||||
|
||||
/* For NIX LF context alloc and init */
|
||||
|
@ -392,6 +442,10 @@ struct nix_lf_alloc_rsp {
|
|||
u8 lso_tsov4_idx;
|
||||
u8 lso_tsov6_idx;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
u8 lf_rx_stats; /* NIX_AF_CONST1::LF_RX_STATS */
|
||||
u8 lf_tx_stats; /* NIX_AF_CONST1::LF_TX_STATS */
|
||||
u16 cints; /* NIX_AF_CONST2::CINTS */
|
||||
u16 qints; /* NIX_AF_CONST2::QINTS */
|
||||
};
|
||||
|
||||
/* NIX AQ enqueue msg */
|
||||
|
@ -472,6 +526,7 @@ struct nix_txschq_config {
|
|||
|
||||
struct nix_vtag_config {
|
||||
struct mbox_msghdr hdr;
|
||||
/* '0' for 4 octet VTAG, '1' for 8 octet VTAG */
|
||||
u8 vtag_size;
|
||||
/* cfg_type is '0' for tx vlan cfg
|
||||
* cfg_type is '1' for rx vlan cfg
|
||||
|
@ -492,7 +547,7 @@ struct nix_vtag_config {
|
|||
|
||||
/* valid when cfg_type is '1' */
|
||||
struct {
|
||||
/* rx vtag type index */
|
||||
/* rx vtag type index, valid values are in 0..7 range */
|
||||
u8 vtag_type;
|
||||
/* rx vtag strip */
|
||||
u8 strip_vtag :1;
|
||||
|
@ -522,4 +577,159 @@ struct nix_rx_mode {
|
|||
u16 mode;
|
||||
};
|
||||
|
||||
struct nix_frs_cfg {
|
||||
struct mbox_msghdr hdr;
|
||||
u8 update_smq; /* Update SMQ's min/max lens */
|
||||
u8 update_minlen; /* Set minlen also */
|
||||
u8 sdp_link; /* Set SDP RX link */
|
||||
u16 maxlen;
|
||||
u16 minlen;
|
||||
};
|
||||
|
||||
/* NPC mbox message structs */
|
||||
|
||||
#define NPC_MCAM_ENTRY_INVALID 0xFFFF
|
||||
#define NPC_MCAM_INVALID_MAP 0xFFFF
|
||||
|
||||
/* NPC mailbox error codes
|
||||
* Range 701 - 800.
|
||||
*/
|
||||
enum npc_af_status {
|
||||
NPC_MCAM_INVALID_REQ = -701,
|
||||
NPC_MCAM_ALLOC_DENIED = -702,
|
||||
NPC_MCAM_ALLOC_FAILED = -703,
|
||||
NPC_MCAM_PERM_DENIED = -704,
|
||||
};
|
||||
|
||||
struct npc_mcam_alloc_entry_req {
|
||||
struct mbox_msghdr hdr;
|
||||
#define NPC_MAX_NONCONTIG_ENTRIES 256
|
||||
u8 contig; /* Contiguous entries ? */
|
||||
#define NPC_MCAM_ANY_PRIO 0
|
||||
#define NPC_MCAM_LOWER_PRIO 1
|
||||
#define NPC_MCAM_HIGHER_PRIO 2
|
||||
u8 priority; /* Lower or higher w.r.t ref_entry */
|
||||
u16 ref_entry;
|
||||
u16 count; /* Number of entries requested */
|
||||
};
|
||||
|
||||
struct npc_mcam_alloc_entry_rsp {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 entry; /* Entry allocated or start index if contiguous.
|
||||
* Invalid incase of non-contiguous.
|
||||
*/
|
||||
u16 count; /* Number of entries allocated */
|
||||
u16 free_count; /* Number of entries available */
|
||||
u16 entry_list[NPC_MAX_NONCONTIG_ENTRIES];
|
||||
};
|
||||
|
||||
struct npc_mcam_free_entry_req {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 entry; /* Entry index to be freed */
|
||||
u8 all; /* If all entries allocated to this PFVF to be freed */
|
||||
};
|
||||
|
||||
struct mcam_entry {
|
||||
#define NPC_MAX_KWS_IN_KEY 7 /* Number of keywords in max keywidth */
|
||||
u64 kw[NPC_MAX_KWS_IN_KEY];
|
||||
u64 kw_mask[NPC_MAX_KWS_IN_KEY];
|
||||
u64 action;
|
||||
u64 vtag_action;
|
||||
};
|
||||
|
||||
struct npc_mcam_write_entry_req {
|
||||
struct mbox_msghdr hdr;
|
||||
struct mcam_entry entry_data;
|
||||
u16 entry; /* MCAM entry to write this match key */
|
||||
u16 cntr; /* Counter for this MCAM entry */
|
||||
u8 intf; /* Rx or Tx interface */
|
||||
u8 enable_entry;/* Enable this MCAM entry ? */
|
||||
u8 set_cntr; /* Set counter for this entry ? */
|
||||
};
|
||||
|
||||
/* Enable/Disable a given entry */
|
||||
struct npc_mcam_ena_dis_entry_req {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 entry;
|
||||
};
|
||||
|
||||
struct npc_mcam_shift_entry_req {
|
||||
struct mbox_msghdr hdr;
|
||||
#define NPC_MCAM_MAX_SHIFTS 64
|
||||
u16 curr_entry[NPC_MCAM_MAX_SHIFTS];
|
||||
u16 new_entry[NPC_MCAM_MAX_SHIFTS];
|
||||
u16 shift_count; /* Number of entries to shift */
|
||||
};
|
||||
|
||||
struct npc_mcam_shift_entry_rsp {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 failed_entry_idx; /* Index in 'curr_entry', not entry itself */
|
||||
};
|
||||
|
||||
struct npc_mcam_alloc_counter_req {
|
||||
struct mbox_msghdr hdr;
|
||||
u8 contig; /* Contiguous counters ? */
|
||||
#define NPC_MAX_NONCONTIG_COUNTERS 64
|
||||
u16 count; /* Number of counters requested */
|
||||
};
|
||||
|
||||
struct npc_mcam_alloc_counter_rsp {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 cntr; /* Counter allocated or start index if contiguous.
|
||||
* Invalid incase of non-contiguous.
|
||||
*/
|
||||
u16 count; /* Number of counters allocated */
|
||||
u16 cntr_list[NPC_MAX_NONCONTIG_COUNTERS];
|
||||
};
|
||||
|
||||
struct npc_mcam_oper_counter_req {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 cntr; /* Free a counter or clear/fetch it's stats */
|
||||
};
|
||||
|
||||
struct npc_mcam_oper_counter_rsp {
|
||||
struct mbox_msghdr hdr;
|
||||
u64 stat; /* valid only while fetching counter's stats */
|
||||
};
|
||||
|
||||
struct npc_mcam_unmap_counter_req {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 cntr;
|
||||
u16 entry; /* Entry and counter to be unmapped */
|
||||
u8 all; /* Unmap all entries using this counter ? */
|
||||
};
|
||||
|
||||
struct npc_mcam_alloc_and_write_entry_req {
|
||||
struct mbox_msghdr hdr;
|
||||
struct mcam_entry entry_data;
|
||||
u16 ref_entry;
|
||||
u8 priority; /* Lower or higher w.r.t ref_entry */
|
||||
u8 intf; /* Rx or Tx interface */
|
||||
u8 enable_entry;/* Enable this MCAM entry ? */
|
||||
u8 alloc_cntr; /* Allocate counter and map ? */
|
||||
};
|
||||
|
||||
struct npc_mcam_alloc_and_write_entry_rsp {
|
||||
struct mbox_msghdr hdr;
|
||||
u16 entry;
|
||||
u16 cntr;
|
||||
};
|
||||
|
||||
struct npc_get_kex_cfg_rsp {
|
||||
struct mbox_msghdr hdr;
|
||||
u64 rx_keyx_cfg; /* NPC_AF_INTF(0)_KEX_CFG */
|
||||
u64 tx_keyx_cfg; /* NPC_AF_INTF(1)_KEX_CFG */
|
||||
#define NPC_MAX_INTF 2
|
||||
#define NPC_MAX_LID 8
|
||||
#define NPC_MAX_LT 16
|
||||
#define NPC_MAX_LD 2
|
||||
#define NPC_MAX_LFL 16
|
||||
/* NPC_AF_KEX_LDATA(0..1)_FLAGS_CFG */
|
||||
u64 kex_ld_flags[NPC_MAX_LD];
|
||||
/* NPC_AF_INTF(0..1)_LID(0..7)_LT(0..15)_LD(0..1)_CFG */
|
||||
u64 intf_lid_lt_ld[NPC_MAX_INTF][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD];
|
||||
/* NPC_AF_INTF(0..1)_LDATA(0..1)_FLAGS(0..15)_CFG */
|
||||
u64 intf_ld_flags[NPC_MAX_INTF][NPC_MAX_LD][NPC_MAX_LFL];
|
||||
};
|
||||
|
||||
#endif /* MBOX_H */
|
||||
|
|
|
@ -259,4 +259,10 @@ struct nix_rx_action {
|
|||
#endif
|
||||
};
|
||||
|
||||
/* NIX Receive Vtag Action Structure */
|
||||
#define VTAG0_VALID_BIT BIT_ULL(15)
|
||||
#define VTAG0_TYPE_MASK GENMASK_ULL(14, 12)
|
||||
#define VTAG0_LID_MASK GENMASK_ULL(10, 8)
|
||||
#define VTAG0_RELPTR_MASK GENMASK_ULL(7, 0)
|
||||
|
||||
#endif /* NPC_H */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -11,6 +11,7 @@
|
|||
#ifndef RVU_H
|
||||
#define RVU_H
|
||||
|
||||
#include <linux/pci.h>
|
||||
#include "rvu_struct.h"
|
||||
#include "common.h"
|
||||
#include "mbox.h"
|
||||
|
@ -18,6 +19,9 @@
|
|||
/* PCI device IDs */
|
||||
#define PCI_DEVID_OCTEONTX2_RVU_AF 0xA065
|
||||
|
||||
/* Subsystem Device ID */
|
||||
#define PCI_SUBSYS_DEVID_96XX 0xB200
|
||||
|
||||
/* PCI BAR nos */
|
||||
#define PCI_AF_REG_BAR_NUM 0
|
||||
#define PCI_PF_REG_BAR_NUM 2
|
||||
|
@ -64,7 +68,7 @@ struct nix_mcast {
|
|||
struct qmem *mcast_buf;
|
||||
int replay_pkind;
|
||||
int next_free_mce;
|
||||
spinlock_t mce_lock; /* Serialize MCE updates */
|
||||
struct mutex mce_lock; /* Serialize MCE updates */
|
||||
};
|
||||
|
||||
struct nix_mce_list {
|
||||
|
@ -74,15 +78,27 @@ struct nix_mce_list {
|
|||
};
|
||||
|
||||
struct npc_mcam {
|
||||
spinlock_t lock; /* MCAM entries and counters update lock */
|
||||
struct rsrc_bmap counters;
|
||||
struct mutex lock; /* MCAM entries and counters update lock */
|
||||
unsigned long *bmap; /* bitmap, 0 => bmap_entries */
|
||||
unsigned long *bmap_reverse; /* Reverse bitmap, bmap_entries => 0 */
|
||||
u16 bmap_entries; /* Number of unreserved MCAM entries */
|
||||
u16 bmap_fcnt; /* MCAM entries free count */
|
||||
u16 *entry2pfvf_map;
|
||||
u16 *entry2cntr_map;
|
||||
u16 *cntr2pfvf_map;
|
||||
u16 *cntr_refcnt;
|
||||
u8 keysize; /* MCAM keysize 112/224/448 bits */
|
||||
u8 banks; /* Number of MCAM banks */
|
||||
u8 banks_per_entry;/* Number of keywords in key */
|
||||
u16 banksize; /* Number of MCAM entries in each bank */
|
||||
u16 total_entries; /* Total number of MCAM entries */
|
||||
u16 entries; /* Total minus reserved for NIX LFs */
|
||||
u16 nixlf_offset; /* Offset of nixlf rsvd uncast entries */
|
||||
u16 pf_offset; /* Offset of PF's rsvd bcast, promisc entries */
|
||||
u16 lprio_count;
|
||||
u16 lprio_start;
|
||||
u16 hprio_count;
|
||||
u16 hprio_end;
|
||||
};
|
||||
|
||||
/* Structure for per RVU func info ie PF/VF */
|
||||
|
@ -122,12 +138,19 @@ struct rvu_pfvf {
|
|||
u16 tx_chan_base;
|
||||
u8 rx_chan_cnt; /* total number of RX channels */
|
||||
u8 tx_chan_cnt; /* total number of TX channels */
|
||||
u16 maxlen;
|
||||
u16 minlen;
|
||||
|
||||
u8 mac_addr[ETH_ALEN]; /* MAC address of this PF/VF */
|
||||
|
||||
/* Broadcast pkt replication info */
|
||||
u16 bcast_mce_idx;
|
||||
struct nix_mce_list bcast_mce_list;
|
||||
|
||||
/* VLAN offload */
|
||||
struct mcam_entry entry;
|
||||
int rxvlan_index;
|
||||
bool rxvlan;
|
||||
};
|
||||
|
||||
struct nix_txsch {
|
||||
|
@ -164,6 +187,16 @@ struct rvu_hwinfo {
|
|||
struct npc_mcam mcam;
|
||||
};
|
||||
|
||||
struct mbox_wq_info {
|
||||
struct otx2_mbox mbox;
|
||||
struct rvu_work *mbox_wrk;
|
||||
|
||||
struct otx2_mbox mbox_up;
|
||||
struct rvu_work *mbox_wrk_up;
|
||||
|
||||
struct workqueue_struct *mbox_wq;
|
||||
};
|
||||
|
||||
struct rvu {
|
||||
void __iomem *afreg_base;
|
||||
void __iomem *pfreg_base;
|
||||
|
@ -172,14 +205,17 @@ struct rvu {
|
|||
struct rvu_hwinfo *hw;
|
||||
struct rvu_pfvf *pf;
|
||||
struct rvu_pfvf *hwvf;
|
||||
spinlock_t rsrc_lock; /* Serialize resource alloc/free */
|
||||
struct mutex rsrc_lock; /* Serialize resource alloc/free */
|
||||
int vfs; /* Number of VFs attached to RVU */
|
||||
|
||||
/* Mbox */
|
||||
struct otx2_mbox mbox;
|
||||
struct rvu_work *mbox_wrk;
|
||||
struct otx2_mbox mbox_up;
|
||||
struct rvu_work *mbox_wrk_up;
|
||||
struct workqueue_struct *mbox_wq;
|
||||
struct mbox_wq_info afpf_wq_info;
|
||||
struct mbox_wq_info afvf_wq_info;
|
||||
|
||||
/* PF FLR */
|
||||
struct rvu_work *flr_wrk;
|
||||
struct workqueue_struct *flr_wq;
|
||||
struct mutex flr_lock; /* Serialize FLRs */
|
||||
|
||||
/* MSI-X */
|
||||
u16 num_vec;
|
||||
|
@ -223,9 +259,22 @@ static inline u64 rvupf_read64(struct rvu *rvu, u64 offset)
|
|||
return readq(rvu->pfreg_base + offset);
|
||||
}
|
||||
|
||||
static inline bool is_rvu_9xxx_A0(struct rvu *rvu)
|
||||
{
|
||||
struct pci_dev *pdev = rvu->pdev;
|
||||
|
||||
return (pdev->revision == 0x00) &&
|
||||
(pdev->subsystem_device == PCI_SUBSYS_DEVID_96XX);
|
||||
}
|
||||
|
||||
/* Function Prototypes
|
||||
* RVU
|
||||
*/
|
||||
static inline int is_afvf(u16 pcifunc)
|
||||
{
|
||||
return !(pcifunc & ~RVU_PFVF_FUNC_MASK);
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -236,6 +285,7 @@ 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);
|
||||
bool is_block_implemented(struct rvu_hwinfo *hw, int blkaddr);
|
||||
bool is_pffunc_map_valid(struct rvu *rvu, u16 pcifunc, int blktype);
|
||||
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);
|
||||
|
@ -270,85 +320,96 @@ int rvu_cgx_probe(struct rvu *rvu);
|
|||
void rvu_cgx_wq_destroy(struct rvu *rvu);
|
||||
void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu);
|
||||
int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start);
|
||||
int rvu_mbox_handler_CGX_START_RXTX(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_start_rxtx(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_CGX_STOP_RXTX(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_stop_rxtx(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_CGX_STATS(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_stats(struct rvu *rvu, struct msg_req *req,
|
||||
struct cgx_stats_rsp *rsp);
|
||||
int rvu_mbox_handler_CGX_MAC_ADDR_SET(struct rvu *rvu,
|
||||
int rvu_mbox_handler_cgx_mac_addr_set(struct rvu *rvu,
|
||||
struct cgx_mac_addr_set_or_get *req,
|
||||
struct cgx_mac_addr_set_or_get *rsp);
|
||||
int rvu_mbox_handler_CGX_MAC_ADDR_GET(struct rvu *rvu,
|
||||
int rvu_mbox_handler_cgx_mac_addr_get(struct rvu *rvu,
|
||||
struct cgx_mac_addr_set_or_get *req,
|
||||
struct cgx_mac_addr_set_or_get *rsp);
|
||||
int rvu_mbox_handler_CGX_PROMISC_ENABLE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_promisc_enable(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_CGX_PROMISC_DISABLE(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);
|
||||
int rvu_mbox_handler_CGX_START_LINKEVENTS(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_start_linkevents(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_CGX_STOP_LINKEVENTS(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_stop_linkevents(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_CGX_GET_LINKINFO(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_get_linkinfo(struct rvu *rvu, struct msg_req *req,
|
||||
struct cgx_link_info_msg *rsp);
|
||||
int rvu_mbox_handler_CGX_INTLBK_ENABLE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_intlbk_enable(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_CGX_INTLBK_DISABLE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_intlbk_disable(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
|
||||
/* NPA APIs */
|
||||
int rvu_npa_init(struct rvu *rvu);
|
||||
void rvu_npa_freemem(struct rvu *rvu);
|
||||
int rvu_mbox_handler_NPA_AQ_ENQ(struct rvu *rvu,
|
||||
void rvu_npa_lf_teardown(struct rvu *rvu, u16 pcifunc, int npalf);
|
||||
int rvu_mbox_handler_npa_aq_enq(struct rvu *rvu,
|
||||
struct npa_aq_enq_req *req,
|
||||
struct npa_aq_enq_rsp *rsp);
|
||||
int rvu_mbox_handler_NPA_HWCTX_DISABLE(struct rvu *rvu,
|
||||
int rvu_mbox_handler_npa_hwctx_disable(struct rvu *rvu,
|
||||
struct hwctx_disable_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_NPA_LF_ALLOC(struct rvu *rvu,
|
||||
int rvu_mbox_handler_npa_lf_alloc(struct rvu *rvu,
|
||||
struct npa_lf_alloc_req *req,
|
||||
struct npa_lf_alloc_rsp *rsp);
|
||||
int rvu_mbox_handler_NPA_LF_FREE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_npa_lf_free(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
|
||||
/* NIX APIs */
|
||||
bool is_nixlf_attached(struct rvu *rvu, u16 pcifunc);
|
||||
int rvu_nix_init(struct rvu *rvu);
|
||||
void rvu_nix_freemem(struct rvu *rvu);
|
||||
int rvu_get_nixlf_count(struct rvu *rvu);
|
||||
int rvu_mbox_handler_NIX_LF_ALLOC(struct rvu *rvu,
|
||||
void rvu_nix_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int npalf);
|
||||
int rvu_mbox_handler_nix_lf_alloc(struct rvu *rvu,
|
||||
struct nix_lf_alloc_req *req,
|
||||
struct nix_lf_alloc_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_LF_FREE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_nix_lf_free(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_AQ_ENQ(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_aq_enq(struct rvu *rvu,
|
||||
struct nix_aq_enq_req *req,
|
||||
struct nix_aq_enq_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_HWCTX_DISABLE(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_hwctx_disable(struct rvu *rvu,
|
||||
struct hwctx_disable_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_TXSCH_ALLOC(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_txsch_alloc(struct rvu *rvu,
|
||||
struct nix_txsch_alloc_req *req,
|
||||
struct nix_txsch_alloc_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_TXSCH_FREE(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_txsch_free(struct rvu *rvu,
|
||||
struct nix_txsch_free_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_TXSCHQ_CFG(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_txschq_cfg(struct rvu *rvu,
|
||||
struct nix_txschq_config *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_STATS_RST(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_nix_stats_rst(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_VTAG_CFG(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_vtag_cfg(struct rvu *rvu,
|
||||
struct nix_vtag_config *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_RSS_FLOWKEY_CFG(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_rxvlan_alloc(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_nix_rss_flowkey_cfg(struct rvu *rvu,
|
||||
struct nix_rss_flowkey_cfg *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_SET_MAC_ADDR(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_set_mac_addr(struct rvu *rvu,
|
||||
struct nix_set_mac_addr *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_NIX_SET_RX_MODE(struct rvu *rvu, struct nix_rx_mode *req,
|
||||
int rvu_mbox_handler_nix_set_rx_mode(struct rvu *rvu, struct nix_rx_mode *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_nix_set_hw_frs(struct rvu *rvu, struct nix_frs_cfg *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_nix_lf_start_rx(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_nix_lf_stop_rx(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
|
||||
/* NPC APIs */
|
||||
int rvu_npc_init(struct rvu *rvu);
|
||||
|
@ -360,9 +421,48 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
|
|||
void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
|
||||
int nixlf, u64 chan, bool allmulti);
|
||||
void rvu_npc_disable_promisc_entry(struct rvu *rvu, u16 pcifunc, int nixlf);
|
||||
void rvu_npc_enable_promisc_entry(struct rvu *rvu, u16 pcifunc, int nixlf);
|
||||
void rvu_npc_install_bcast_match_entry(struct rvu *rvu, u16 pcifunc,
|
||||
int nixlf, u64 chan);
|
||||
int rvu_npc_update_rxvlan(struct rvu *rvu, u16 pcifunc, int nixlf);
|
||||
void rvu_npc_disable_mcam_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
|
||||
void rvu_npc_disable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
|
||||
void rvu_npc_enable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
|
||||
void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf,
|
||||
int group, int alg_idx, int mcam_index);
|
||||
int rvu_mbox_handler_npc_mcam_alloc_entry(struct rvu *rvu,
|
||||
struct npc_mcam_alloc_entry_req *req,
|
||||
struct npc_mcam_alloc_entry_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_free_entry(struct rvu *rvu,
|
||||
struct npc_mcam_free_entry_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_write_entry(struct rvu *rvu,
|
||||
struct npc_mcam_write_entry_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_ena_entry(struct rvu *rvu,
|
||||
struct npc_mcam_ena_dis_entry_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_dis_entry(struct rvu *rvu,
|
||||
struct npc_mcam_ena_dis_entry_req *req,
|
||||
struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_shift_entry(struct rvu *rvu,
|
||||
struct npc_mcam_shift_entry_req *req,
|
||||
struct npc_mcam_shift_entry_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_alloc_counter(struct rvu *rvu,
|
||||
struct npc_mcam_alloc_counter_req *req,
|
||||
struct npc_mcam_alloc_counter_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_free_counter(struct rvu *rvu,
|
||||
struct npc_mcam_oper_counter_req *req, struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_clear_counter(struct rvu *rvu,
|
||||
struct npc_mcam_oper_counter_req *req, struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_unmap_counter(struct rvu *rvu,
|
||||
struct npc_mcam_unmap_counter_req *req, struct msg_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_counter_stats(struct rvu *rvu,
|
||||
struct npc_mcam_oper_counter_req *req,
|
||||
struct npc_mcam_oper_counter_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_mcam_alloc_and_write_entry(struct rvu *rvu,
|
||||
struct npc_mcam_alloc_and_write_entry_req *req,
|
||||
struct npc_mcam_alloc_and_write_entry_rsp *rsp);
|
||||
int rvu_mbox_handler_npc_get_kex_cfg(struct rvu *rvu, struct msg_req *req,
|
||||
struct npc_get_kex_cfg_rsp *rsp);
|
||||
#endif /* RVU_H */
|
||||
|
|
|
@ -20,14 +20,14 @@ struct cgx_evq_entry {
|
|||
struct cgx_link_event link_event;
|
||||
};
|
||||
|
||||
#define M(_name, _id, _req_type, _rsp_type) \
|
||||
#define M(_name, _id, _fn_name, _req_type, _rsp_type) \
|
||||
static struct _req_type __maybe_unused \
|
||||
*otx2_mbox_alloc_msg_ ## _name(struct rvu *rvu, int devid) \
|
||||
*otx2_mbox_alloc_msg_ ## _fn_name(struct rvu *rvu, int devid) \
|
||||
{ \
|
||||
struct _req_type *req; \
|
||||
\
|
||||
req = (struct _req_type *)otx2_mbox_alloc_msg_rsp( \
|
||||
&rvu->mbox_up, devid, sizeof(struct _req_type), \
|
||||
&rvu->afpf_wq_info.mbox_up, devid, sizeof(struct _req_type), \
|
||||
sizeof(struct _rsp_type)); \
|
||||
if (!req) \
|
||||
return NULL; \
|
||||
|
@ -177,12 +177,12 @@ static void cgx_notify_pfs(struct cgx_link_event *event, struct rvu *rvu)
|
|||
}
|
||||
|
||||
/* Send mbox message to PF */
|
||||
msg = otx2_mbox_alloc_msg_CGX_LINK_EVENT(rvu, pfid);
|
||||
msg = otx2_mbox_alloc_msg_cgx_link_event(rvu, pfid);
|
||||
if (!msg)
|
||||
continue;
|
||||
msg->link_info = *linfo;
|
||||
otx2_mbox_msg_send(&rvu->mbox_up, pfid);
|
||||
err = otx2_mbox_wait_for_rsp(&rvu->mbox_up, pfid);
|
||||
otx2_mbox_msg_send(&rvu->afpf_wq_info.mbox_up, pfid);
|
||||
err = otx2_mbox_wait_for_rsp(&rvu->afpf_wq_info.mbox_up, pfid);
|
||||
if (err)
|
||||
dev_warn(rvu->dev, "notification to pf %d failed\n",
|
||||
pfid);
|
||||
|
@ -303,21 +303,21 @@ int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_START_RXTX(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_start_rxtx(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
rvu_cgx_config_rxtx(rvu, req->hdr.pcifunc, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_STOP_RXTX(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_stop_rxtx(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
rvu_cgx_config_rxtx(rvu, req->hdr.pcifunc, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_STATS(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_stats(struct rvu *rvu, struct msg_req *req,
|
||||
struct cgx_stats_rsp *rsp)
|
||||
{
|
||||
int pf = rvu_get_pf(req->hdr.pcifunc);
|
||||
|
@ -354,7 +354,7 @@ int rvu_mbox_handler_CGX_STATS(struct rvu *rvu, struct msg_req *req,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_MAC_ADDR_SET(struct rvu *rvu,
|
||||
int rvu_mbox_handler_cgx_mac_addr_set(struct rvu *rvu,
|
||||
struct cgx_mac_addr_set_or_get *req,
|
||||
struct cgx_mac_addr_set_or_get *rsp)
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ int rvu_mbox_handler_CGX_MAC_ADDR_SET(struct rvu *rvu,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_MAC_ADDR_GET(struct rvu *rvu,
|
||||
int rvu_mbox_handler_cgx_mac_addr_get(struct rvu *rvu,
|
||||
struct cgx_mac_addr_set_or_get *req,
|
||||
struct cgx_mac_addr_set_or_get *rsp)
|
||||
{
|
||||
|
@ -387,7 +387,7 @@ int rvu_mbox_handler_CGX_MAC_ADDR_GET(struct rvu *rvu,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_PROMISC_ENABLE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_promisc_enable(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
u16 pcifunc = req->hdr.pcifunc;
|
||||
|
@ -407,7 +407,7 @@ int rvu_mbox_handler_CGX_PROMISC_ENABLE(struct rvu *rvu, struct msg_req *req,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_PROMISC_DISABLE(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;
|
||||
|
@ -451,21 +451,21 @@ static int rvu_cgx_config_linkevents(struct rvu *rvu, u16 pcifunc, bool en)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_START_LINKEVENTS(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_start_linkevents(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_STOP_LINKEVENTS(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_stop_linkevents(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_GET_LINKINFO(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_get_linkinfo(struct rvu *rvu, struct msg_req *req,
|
||||
struct cgx_link_info_msg *rsp)
|
||||
{
|
||||
u8 cgx_id, lmac_id;
|
||||
|
@ -500,14 +500,14 @@ static int rvu_cgx_config_intlbk(struct rvu *rvu, u16 pcifunc, bool en)
|
|||
lmac_id, en);
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_INTLBK_ENABLE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_intlbk_enable(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
rvu_cgx_config_intlbk(rvu, req->hdr.pcifunc, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_CGX_INTLBK_DISABLE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_cgx_intlbk_disable(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
rvu_cgx_config_intlbk(rvu, req->hdr.pcifunc, false);
|
||||
|
|
|
@ -55,6 +55,17 @@ struct mce {
|
|||
u16 pcifunc;
|
||||
};
|
||||
|
||||
bool is_nixlf_attached(struct rvu *rvu, u16 pcifunc)
|
||||
{
|
||||
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
int blkaddr;
|
||||
|
||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
||||
if (!pfvf->nixlf || blkaddr < 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
int rvu_get_nixlf_count(struct rvu *rvu)
|
||||
{
|
||||
struct rvu_block *block;
|
||||
|
@ -94,6 +105,23 @@ static inline struct nix_hw *get_nix_hw(struct rvu_hwinfo *hw, int blkaddr)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void nix_rx_sync(struct rvu *rvu, int blkaddr)
|
||||
{
|
||||
int err;
|
||||
|
||||
/*Sync all in flight RX packets to LLC/DRAM */
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_RX_SW_SYNC, BIT_ULL(0));
|
||||
err = rvu_poll_reg(rvu, blkaddr, NIX_AF_RX_SW_SYNC, BIT_ULL(0), true);
|
||||
if (err)
|
||||
dev_err(rvu->dev, "NIX RX software sync failed\n");
|
||||
|
||||
/* As per a HW errata in 9xxx A0 silicon, HW may clear SW_SYNC[ENA]
|
||||
* bit too early. Hence wait for 50us more.
|
||||
*/
|
||||
if (is_rvu_9xxx_A0(rvu))
|
||||
usleep_range(50, 60);
|
||||
}
|
||||
|
||||
static bool is_valid_txschq(struct rvu *rvu, int blkaddr,
|
||||
int lvl, u16 pcifunc, u16 schq)
|
||||
{
|
||||
|
@ -109,12 +137,12 @@ static bool is_valid_txschq(struct rvu *rvu, int blkaddr,
|
|||
if (schq >= txsch->schq.max)
|
||||
return false;
|
||||
|
||||
spin_lock(&rvu->rsrc_lock);
|
||||
mutex_lock(&rvu->rsrc_lock);
|
||||
if (txsch->pfvf_map[schq] != pcifunc) {
|
||||
spin_unlock(&rvu->rsrc_lock);
|
||||
mutex_unlock(&rvu->rsrc_lock);
|
||||
return false;
|
||||
}
|
||||
spin_unlock(&rvu->rsrc_lock);
|
||||
mutex_unlock(&rvu->rsrc_lock);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -122,7 +150,7 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)
|
|||
{
|
||||
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
u8 cgx_id, lmac_id;
|
||||
int pkind, pf;
|
||||
int pkind, pf, vf;
|
||||
int err;
|
||||
|
||||
pf = rvu_get_pf(pcifunc);
|
||||
|
@ -148,6 +176,14 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)
|
|||
rvu_npc_set_pkind(rvu, pkind, pfvf);
|
||||
break;
|
||||
case NIX_INTF_TYPE_LBK:
|
||||
vf = (pcifunc & RVU_PFVF_FUNC_MASK) - 1;
|
||||
pfvf->rx_chan_base = NIX_CHAN_LBK_CHX(0, vf);
|
||||
pfvf->tx_chan_base = vf & 0x1 ? NIX_CHAN_LBK_CHX(0, vf - 1) :
|
||||
NIX_CHAN_LBK_CHX(0, vf + 1);
|
||||
pfvf->rx_chan_cnt = 1;
|
||||
pfvf->tx_chan_cnt = 1;
|
||||
rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf,
|
||||
pfvf->rx_chan_base, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -168,14 +204,21 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)
|
|||
|
||||
rvu_npc_install_bcast_match_entry(rvu, pcifunc,
|
||||
nixlf, pfvf->rx_chan_base);
|
||||
pfvf->maxlen = NIC_HW_MIN_FRS;
|
||||
pfvf->minlen = NIC_HW_MIN_FRS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void nix_interface_deinit(struct rvu *rvu, u16 pcifunc, u8 nixlf)
|
||||
{
|
||||
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
int err;
|
||||
|
||||
pfvf->maxlen = 0;
|
||||
pfvf->minlen = 0;
|
||||
pfvf->rxvlan = false;
|
||||
|
||||
/* Remove this PF_FUNC from bcast pkt replication list */
|
||||
err = nix_update_bcast_mce_list(rvu, pcifunc, false);
|
||||
if (err) {
|
||||
|
@ -637,25 +680,25 @@ static int nix_lf_hwctx_disable(struct rvu *rvu, struct hwctx_disable_req *req)
|
|||
return err;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_AQ_ENQ(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_aq_enq(struct rvu *rvu,
|
||||
struct nix_aq_enq_req *req,
|
||||
struct nix_aq_enq_rsp *rsp)
|
||||
{
|
||||
return rvu_nix_aq_enq_inst(rvu, req, rsp);
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_HWCTX_DISABLE(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_hwctx_disable(struct rvu *rvu,
|
||||
struct hwctx_disable_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
return nix_lf_hwctx_disable(rvu, req);
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_LF_ALLOC(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_lf_alloc(struct rvu *rvu,
|
||||
struct nix_lf_alloc_req *req,
|
||||
struct nix_lf_alloc_rsp *rsp)
|
||||
{
|
||||
int nixlf, qints, hwctx_size, err, rc = 0;
|
||||
int nixlf, qints, hwctx_size, intf, err, rc = 0;
|
||||
struct rvu_hwinfo *hw = rvu->hw;
|
||||
u16 pcifunc = req->hdr.pcifunc;
|
||||
struct rvu_block *block;
|
||||
|
@ -676,6 +719,24 @@ int rvu_mbox_handler_NIX_LF_ALLOC(struct rvu *rvu,
|
|||
if (nixlf < 0)
|
||||
return NIX_AF_ERR_AF_LF_INVALID;
|
||||
|
||||
/* Check if requested 'NIXLF <=> NPALF' mapping is valid */
|
||||
if (req->npa_func) {
|
||||
/* If default, use 'this' NIXLF's PFFUNC */
|
||||
if (req->npa_func == RVU_DEFAULT_PF_FUNC)
|
||||
req->npa_func = pcifunc;
|
||||
if (!is_pffunc_map_valid(rvu, req->npa_func, BLKTYPE_NPA))
|
||||
return NIX_AF_INVAL_NPA_PF_FUNC;
|
||||
}
|
||||
|
||||
/* Check if requested 'NIXLF <=> SSOLF' mapping is valid */
|
||||
if (req->sso_func) {
|
||||
/* If default, use 'this' NIXLF's PFFUNC */
|
||||
if (req->sso_func == RVU_DEFAULT_PF_FUNC)
|
||||
req->sso_func = pcifunc;
|
||||
if (!is_pffunc_map_valid(rvu, req->sso_func, BLKTYPE_SSO))
|
||||
return NIX_AF_INVAL_SSO_PF_FUNC;
|
||||
}
|
||||
|
||||
/* If RSS is being enabled, check if requested config is valid.
|
||||
* RSS table size should be power of two, otherwise
|
||||
* RSS_GRP::OFFSET + adder might go beyond that group or
|
||||
|
@ -780,18 +841,10 @@ int rvu_mbox_handler_NIX_LF_ALLOC(struct rvu *rvu,
|
|||
/* Enable LMTST for this NIX LF */
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_LFX_TX_CFG2(nixlf), BIT_ULL(0));
|
||||
|
||||
/* Set CQE/WQE size, NPA_PF_FUNC for SQBs and also SSO_PF_FUNC
|
||||
* If requester has sent a 'RVU_DEFAULT_PF_FUNC' use this NIX LF's
|
||||
* PCIFUNC itself.
|
||||
*/
|
||||
if (req->npa_func == RVU_DEFAULT_PF_FUNC)
|
||||
cfg = pcifunc;
|
||||
else
|
||||
/* Set CQE/WQE size, NPA_PF_FUNC for SQBs and also SSO_PF_FUNC */
|
||||
if (req->npa_func)
|
||||
cfg = req->npa_func;
|
||||
|
||||
if (req->sso_func == RVU_DEFAULT_PF_FUNC)
|
||||
cfg |= (u64)pcifunc << 16;
|
||||
else
|
||||
if (req->sso_func)
|
||||
cfg |= (u64)req->sso_func << 16;
|
||||
|
||||
cfg |= (u64)req->xqe_sz << 33;
|
||||
|
@ -800,10 +853,14 @@ 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);
|
||||
|
||||
err = nix_interface_init(rvu, pcifunc, NIX_INTF_TYPE_CGX, nixlf);
|
||||
intf = is_afvf(pcifunc) ? NIX_INTF_TYPE_LBK : NIX_INTF_TYPE_CGX;
|
||||
err = nix_interface_init(rvu, pcifunc, intf, nixlf);
|
||||
if (err)
|
||||
goto free_mem;
|
||||
|
||||
/* Disable NPC entries as NIXLF's contexts are not initialized yet */
|
||||
rvu_npc_disable_default_entries(rvu, pcifunc, nixlf);
|
||||
|
||||
goto exit;
|
||||
|
||||
free_mem:
|
||||
|
@ -823,10 +880,18 @@ exit:
|
|||
rsp->tx_chan_cnt = pfvf->tx_chan_cnt;
|
||||
rsp->lso_tsov4_idx = NIX_LSO_FORMAT_IDX_TSOV4;
|
||||
rsp->lso_tsov6_idx = NIX_LSO_FORMAT_IDX_TSOV6;
|
||||
/* Get HW supported stat count */
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
|
||||
rsp->lf_rx_stats = ((cfg >> 32) & 0xFF);
|
||||
rsp->lf_tx_stats = ((cfg >> 24) & 0xFF);
|
||||
/* Get count of CQ IRQs and error IRQs supported per LF */
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST2);
|
||||
rsp->qints = ((cfg >> 12) & 0xFFF);
|
||||
rsp->cints = ((cfg >> 24) & 0xFFF);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_LF_FREE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_nix_lf_free(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
struct rvu_hwinfo *hw = rvu->hw;
|
||||
|
@ -918,7 +983,7 @@ static void nix_reset_tx_linkcfg(struct rvu *rvu, int blkaddr,
|
|||
NIX_AF_TL3_TL2X_LINKX_CFG(schq, link), 0x00);
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_TXSCH_ALLOC(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_txsch_alloc(struct rvu *rvu,
|
||||
struct nix_txsch_alloc_req *req,
|
||||
struct nix_txsch_alloc_rsp *rsp)
|
||||
{
|
||||
|
@ -939,7 +1004,7 @@ int rvu_mbox_handler_NIX_TXSCH_ALLOC(struct rvu *rvu,
|
|||
if (!nix_hw)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock(&rvu->rsrc_lock);
|
||||
mutex_lock(&rvu->rsrc_lock);
|
||||
for (lvl = 0; lvl < NIX_TXSCH_LVL_CNT; lvl++) {
|
||||
txsch = &nix_hw->txsch[lvl];
|
||||
req_schq = req->schq_contig[lvl] + req->schq[lvl];
|
||||
|
@ -995,7 +1060,7 @@ int rvu_mbox_handler_NIX_TXSCH_ALLOC(struct rvu *rvu,
|
|||
err:
|
||||
rc = NIX_AF_ERR_TLX_ALLOC_FAIL;
|
||||
exit:
|
||||
spin_unlock(&rvu->rsrc_lock);
|
||||
mutex_unlock(&rvu->rsrc_lock);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1085,7 @@ static int nix_txschq_free(struct rvu *rvu, u16 pcifunc)
|
|||
return NIX_AF_ERR_AF_LF_INVALID;
|
||||
|
||||
/* Disable TL2/3 queue links before SMQ flush*/
|
||||
spin_lock(&rvu->rsrc_lock);
|
||||
mutex_lock(&rvu->rsrc_lock);
|
||||
for (lvl = NIX_TXSCH_LVL_TL4; lvl < NIX_TXSCH_LVL_CNT; lvl++) {
|
||||
if (lvl != NIX_TXSCH_LVL_TL2 && lvl != NIX_TXSCH_LVL_TL4)
|
||||
continue;
|
||||
|
@ -1062,7 +1127,7 @@ static int nix_txschq_free(struct rvu *rvu, u16 pcifunc)
|
|||
txsch->pfvf_map[schq] = 0;
|
||||
}
|
||||
}
|
||||
spin_unlock(&rvu->rsrc_lock);
|
||||
mutex_unlock(&rvu->rsrc_lock);
|
||||
|
||||
/* Sync cached info for this LF in NDC-TX to LLC/DRAM */
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_NDC_TX_SYNC, BIT_ULL(12) | nixlf);
|
||||
|
@ -1073,7 +1138,7 @@ static int nix_txschq_free(struct rvu *rvu, u16 pcifunc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_TXSCH_FREE(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_txsch_free(struct rvu *rvu,
|
||||
struct nix_txsch_free_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
|
@ -1118,7 +1183,7 @@ static bool is_txschq_config_valid(struct rvu *rvu, u16 pcifunc, int blkaddr,
|
|||
return true;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_TXSCHQ_CFG(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_txschq_cfg(struct rvu *rvu,
|
||||
struct nix_txschq_config *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
|
@ -1181,35 +1246,22 @@ int rvu_mbox_handler_NIX_TXSCHQ_CFG(struct rvu *rvu,
|
|||
static int nix_rx_vtag_cfg(struct rvu *rvu, int nixlf, int blkaddr,
|
||||
struct nix_vtag_config *req)
|
||||
{
|
||||
u64 regval = 0;
|
||||
u64 regval = req->vtag_size;
|
||||
|
||||
#define NIX_VTAGTYPE_MAX 0x8ull
|
||||
#define NIX_VTAGSIZE_MASK 0x7ull
|
||||
#define NIX_VTAGSTRIP_CAP_MASK 0x30ull
|
||||
|
||||
if (req->rx.vtag_type >= NIX_VTAGTYPE_MAX ||
|
||||
req->vtag_size > VTAGSIZE_T8)
|
||||
if (req->rx.vtag_type > 7 || req->vtag_size > VTAGSIZE_T8)
|
||||
return -EINVAL;
|
||||
|
||||
regval = rvu_read64(rvu, blkaddr,
|
||||
NIX_AF_LFX_RX_VTAG_TYPEX(nixlf, req->rx.vtag_type));
|
||||
|
||||
if (req->rx.strip_vtag && req->rx.capture_vtag)
|
||||
regval |= BIT_ULL(4) | BIT_ULL(5);
|
||||
else if (req->rx.strip_vtag)
|
||||
if (req->rx.capture_vtag)
|
||||
regval |= BIT_ULL(5);
|
||||
if (req->rx.strip_vtag)
|
||||
regval |= BIT_ULL(4);
|
||||
else
|
||||
regval &= ~(BIT_ULL(4) | BIT_ULL(5));
|
||||
|
||||
regval &= ~NIX_VTAGSIZE_MASK;
|
||||
regval |= req->vtag_size & NIX_VTAGSIZE_MASK;
|
||||
|
||||
rvu_write64(rvu, blkaddr,
|
||||
NIX_AF_LFX_RX_VTAG_TYPEX(nixlf, req->rx.vtag_type), regval);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_VTAG_CFG(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_vtag_cfg(struct rvu *rvu,
|
||||
struct nix_vtag_config *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
|
@ -1294,7 +1346,7 @@ static int nix_update_mce_list(struct nix_mce_list *mce_list,
|
|||
return 0;
|
||||
|
||||
/* Add a new one to the list, at the tail */
|
||||
mce = kzalloc(sizeof(*mce), GFP_ATOMIC);
|
||||
mce = kzalloc(sizeof(*mce), GFP_KERNEL);
|
||||
if (!mce)
|
||||
return -ENOMEM;
|
||||
mce->idx = idx;
|
||||
|
@ -1317,6 +1369,10 @@ static int nix_update_bcast_mce_list(struct rvu *rvu, u16 pcifunc, bool add)
|
|||
struct rvu_pfvf *pfvf;
|
||||
int blkaddr;
|
||||
|
||||
/* Broadcast pkt replication is not needed for AF's VFs, hence skip */
|
||||
if (is_afvf(pcifunc))
|
||||
return 0;
|
||||
|
||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
||||
if (blkaddr < 0)
|
||||
return 0;
|
||||
|
@ -1340,7 +1396,7 @@ static int nix_update_bcast_mce_list(struct rvu *rvu, u16 pcifunc, bool add)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
spin_lock(&mcast->mce_lock);
|
||||
mutex_lock(&mcast->mce_lock);
|
||||
|
||||
err = nix_update_mce_list(mce_list, pcifunc, idx, add);
|
||||
if (err)
|
||||
|
@ -1370,7 +1426,7 @@ static int nix_update_bcast_mce_list(struct rvu *rvu, u16 pcifunc, bool add)
|
|||
}
|
||||
|
||||
end:
|
||||
spin_unlock(&mcast->mce_lock);
|
||||
mutex_unlock(&mcast->mce_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -1455,7 +1511,7 @@ static int nix_setup_mcast(struct rvu *rvu, struct nix_hw *nix_hw, int blkaddr)
|
|||
BIT_ULL(63) | (mcast->replay_pkind << 24) |
|
||||
BIT_ULL(20) | MC_BUF_CNT);
|
||||
|
||||
spin_lock_init(&mcast->mce_lock);
|
||||
mutex_init(&mcast->mce_lock);
|
||||
|
||||
return nix_setup_bcast_tables(rvu, nix_hw);
|
||||
}
|
||||
|
@ -1506,7 +1562,7 @@ static int nix_setup_txschq(struct rvu *rvu, struct nix_hw *nix_hw, int blkaddr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_STATS_RST(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_nix_stats_rst(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
struct rvu_hwinfo *hw = rvu->hw;
|
||||
|
@ -1564,7 +1620,7 @@ static int get_flowkey_alg_idx(u32 flow_cfg)
|
|||
return FLOW_KEY_ALG_PORT;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_RSS_FLOWKEY_CFG(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_rss_flowkey_cfg(struct rvu *rvu,
|
||||
struct nix_rss_flowkey_cfg *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
|
@ -1720,7 +1776,7 @@ static void nix_rx_flowkey_alg_cfg(struct rvu *rvu, int blkaddr)
|
|||
}
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_SET_MAC_ADDR(struct rvu *rvu,
|
||||
int rvu_mbox_handler_nix_set_mac_addr(struct rvu *rvu,
|
||||
struct nix_set_mac_addr *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
|
@ -1742,10 +1798,13 @@ int rvu_mbox_handler_NIX_SET_MAC_ADDR(struct rvu *rvu,
|
|||
|
||||
rvu_npc_install_ucast_entry(rvu, pcifunc, nixlf,
|
||||
pfvf->rx_chan_base, req->mac_addr);
|
||||
|
||||
rvu_npc_update_rxvlan(rvu, pcifunc, nixlf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NIX_SET_RX_MODE(struct rvu *rvu, struct nix_rx_mode *req,
|
||||
int rvu_mbox_handler_nix_set_rx_mode(struct rvu *rvu, struct nix_rx_mode *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
bool allmulti = false, disable_promisc = false;
|
||||
|
@ -1775,9 +1834,261 @@ int rvu_mbox_handler_NIX_SET_RX_MODE(struct rvu *rvu, struct nix_rx_mode *req,
|
|||
else
|
||||
rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf,
|
||||
pfvf->rx_chan_base, allmulti);
|
||||
|
||||
rvu_npc_update_rxvlan(rvu, pcifunc, nixlf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void nix_find_link_frs(struct rvu *rvu,
|
||||
struct nix_frs_cfg *req, u16 pcifunc)
|
||||
{
|
||||
int pf = rvu_get_pf(pcifunc);
|
||||
struct rvu_pfvf *pfvf;
|
||||
int maxlen, minlen;
|
||||
int numvfs, hwvf;
|
||||
int vf;
|
||||
|
||||
/* Update with requester's min/max lengths */
|
||||
pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
pfvf->maxlen = req->maxlen;
|
||||
if (req->update_minlen)
|
||||
pfvf->minlen = req->minlen;
|
||||
|
||||
maxlen = req->maxlen;
|
||||
minlen = req->update_minlen ? req->minlen : 0;
|
||||
|
||||
/* Get this PF's numVFs and starting hwvf */
|
||||
rvu_get_pf_numvfs(rvu, pf, &numvfs, &hwvf);
|
||||
|
||||
/* For each VF, compare requested max/minlen */
|
||||
for (vf = 0; vf < numvfs; vf++) {
|
||||
pfvf = &rvu->hwvf[hwvf + vf];
|
||||
if (pfvf->maxlen > maxlen)
|
||||
maxlen = pfvf->maxlen;
|
||||
if (req->update_minlen &&
|
||||
pfvf->minlen && pfvf->minlen < minlen)
|
||||
minlen = pfvf->minlen;
|
||||
}
|
||||
|
||||
/* Compare requested max/minlen with PF's max/minlen */
|
||||
pfvf = &rvu->pf[pf];
|
||||
if (pfvf->maxlen > maxlen)
|
||||
maxlen = pfvf->maxlen;
|
||||
if (req->update_minlen &&
|
||||
pfvf->minlen && pfvf->minlen < minlen)
|
||||
minlen = pfvf->minlen;
|
||||
|
||||
/* Update the request with max/min PF's and it's VF's max/min */
|
||||
req->maxlen = maxlen;
|
||||
if (req->update_minlen)
|
||||
req->minlen = minlen;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_set_hw_frs(struct rvu *rvu, struct nix_frs_cfg *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
struct rvu_hwinfo *hw = rvu->hw;
|
||||
u16 pcifunc = req->hdr.pcifunc;
|
||||
int pf = rvu_get_pf(pcifunc);
|
||||
int blkaddr, schq, link = -1;
|
||||
struct nix_txsch *txsch;
|
||||
u64 cfg, lmac_fifo_len;
|
||||
struct nix_hw *nix_hw;
|
||||
u8 cgx = 0, lmac = 0;
|
||||
|
||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
||||
if (blkaddr < 0)
|
||||
return NIX_AF_ERR_AF_LF_INVALID;
|
||||
|
||||
nix_hw = get_nix_hw(rvu->hw, blkaddr);
|
||||
if (!nix_hw)
|
||||
return -EINVAL;
|
||||
|
||||
if (!req->sdp_link && req->maxlen > NIC_HW_MAX_FRS)
|
||||
return NIX_AF_ERR_FRS_INVALID;
|
||||
|
||||
if (req->update_minlen && req->minlen < NIC_HW_MIN_FRS)
|
||||
return NIX_AF_ERR_FRS_INVALID;
|
||||
|
||||
/* Check if requester wants to update SMQ's */
|
||||
if (!req->update_smq)
|
||||
goto rx_frscfg;
|
||||
|
||||
/* Update min/maxlen in each of the SMQ attached to this PF/VF */
|
||||
txsch = &nix_hw->txsch[NIX_TXSCH_LVL_SMQ];
|
||||
mutex_lock(&rvu->rsrc_lock);
|
||||
for (schq = 0; schq < txsch->schq.max; schq++) {
|
||||
if (txsch->pfvf_map[schq] != pcifunc)
|
||||
continue;
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_SMQX_CFG(schq));
|
||||
cfg = (cfg & ~(0xFFFFULL << 8)) | ((u64)req->maxlen << 8);
|
||||
if (req->update_minlen)
|
||||
cfg = (cfg & ~0x7FULL) | ((u64)req->minlen & 0x7F);
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_SMQX_CFG(schq), cfg);
|
||||
}
|
||||
mutex_unlock(&rvu->rsrc_lock);
|
||||
|
||||
rx_frscfg:
|
||||
/* Check if config is for SDP link */
|
||||
if (req->sdp_link) {
|
||||
if (!hw->sdp_links)
|
||||
return NIX_AF_ERR_RX_LINK_INVALID;
|
||||
link = hw->cgx_links + hw->lbk_links;
|
||||
goto linkcfg;
|
||||
}
|
||||
|
||||
/* Check if the request is from CGX mapped RVU PF */
|
||||
if (is_pf_cgxmapped(rvu, pf)) {
|
||||
/* Get CGX and LMAC to which this PF is mapped and find link */
|
||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx, &lmac);
|
||||
link = (cgx * hw->lmac_per_cgx) + lmac;
|
||||
} else if (pf == 0) {
|
||||
/* For VFs of PF0 ingress is LBK port, so config LBK link */
|
||||
link = hw->cgx_links;
|
||||
}
|
||||
|
||||
if (link < 0)
|
||||
return NIX_AF_ERR_RX_LINK_INVALID;
|
||||
|
||||
nix_find_link_frs(rvu, req, pcifunc);
|
||||
|
||||
linkcfg:
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_LINKX_CFG(link));
|
||||
cfg = (cfg & ~(0xFFFFULL << 16)) | ((u64)req->maxlen << 16);
|
||||
if (req->update_minlen)
|
||||
cfg = (cfg & ~0xFFFFULL) | req->minlen;
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_RX_LINKX_CFG(link), cfg);
|
||||
|
||||
if (req->sdp_link || pf == 0)
|
||||
return 0;
|
||||
|
||||
/* Update transmit credits for CGX links */
|
||||
lmac_fifo_len =
|
||||
CGX_FIFO_LEN / cgx_get_lmac_cnt(rvu_cgx_pdata(cgx, rvu));
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_TX_LINKX_NORM_CREDIT(link));
|
||||
cfg &= ~(0xFFFFFULL << 12);
|
||||
cfg |= ((lmac_fifo_len - req->maxlen) / 16) << 12;
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_TX_LINKX_NORM_CREDIT(link), cfg);
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_TX_LINKX_EXPR_CREDIT(link), cfg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_rxvlan_alloc(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
struct npc_mcam_alloc_entry_req alloc_req = { };
|
||||
struct npc_mcam_alloc_entry_rsp alloc_rsp = { };
|
||||
struct npc_mcam_free_entry_req free_req = { };
|
||||
u16 pcifunc = req->hdr.pcifunc;
|
||||
int blkaddr, nixlf, err;
|
||||
struct rvu_pfvf *pfvf;
|
||||
|
||||
/* LBK VFs do not have separate MCAM UCAST entry hence
|
||||
* skip allocating rxvlan for them
|
||||
*/
|
||||
if (is_afvf(pcifunc))
|
||||
return 0;
|
||||
|
||||
pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
if (pfvf->rxvlan)
|
||||
return 0;
|
||||
|
||||
/* alloc new mcam entry */
|
||||
alloc_req.hdr.pcifunc = pcifunc;
|
||||
alloc_req.count = 1;
|
||||
|
||||
err = rvu_mbox_handler_npc_mcam_alloc_entry(rvu, &alloc_req,
|
||||
&alloc_rsp);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* update entry to enable rxvlan offload */
|
||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
||||
if (blkaddr < 0) {
|
||||
err = NIX_AF_ERR_AF_LF_INVALID;
|
||||
goto free_entry;
|
||||
}
|
||||
|
||||
nixlf = rvu_get_lf(rvu, &rvu->hw->block[blkaddr], pcifunc, 0);
|
||||
if (nixlf < 0) {
|
||||
err = NIX_AF_ERR_AF_LF_INVALID;
|
||||
goto free_entry;
|
||||
}
|
||||
|
||||
pfvf->rxvlan_index = alloc_rsp.entry_list[0];
|
||||
/* all it means is that rxvlan_index is valid */
|
||||
pfvf->rxvlan = true;
|
||||
|
||||
err = rvu_npc_update_rxvlan(rvu, pcifunc, nixlf);
|
||||
if (err)
|
||||
goto free_entry;
|
||||
|
||||
return 0;
|
||||
free_entry:
|
||||
free_req.hdr.pcifunc = pcifunc;
|
||||
free_req.entry = alloc_rsp.entry_list[0];
|
||||
rvu_mbox_handler_npc_mcam_free_entry(rvu, &free_req, rsp);
|
||||
pfvf->rxvlan = false;
|
||||
return err;
|
||||
}
|
||||
|
||||
static void nix_link_config(struct rvu *rvu, int blkaddr)
|
||||
{
|
||||
struct rvu_hwinfo *hw = rvu->hw;
|
||||
int cgx, lmac_cnt, slink, link;
|
||||
u64 tx_credits;
|
||||
|
||||
/* Set default min/max packet lengths allowed on NIX Rx links.
|
||||
*
|
||||
* With HW reset minlen value of 60byte, HW will treat ARP pkts
|
||||
* as undersize and report them to SW as error pkts, hence
|
||||
* setting it to 40 bytes.
|
||||
*/
|
||||
for (link = 0; link < (hw->cgx_links + hw->lbk_links); link++) {
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_RX_LINKX_CFG(link),
|
||||
NIC_HW_MAX_FRS << 16 | NIC_HW_MIN_FRS);
|
||||
}
|
||||
|
||||
if (hw->sdp_links) {
|
||||
link = hw->cgx_links + hw->lbk_links;
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_RX_LINKX_CFG(link),
|
||||
SDP_HW_MAX_FRS << 16 | NIC_HW_MIN_FRS);
|
||||
}
|
||||
|
||||
/* Set credits for Tx links assuming max packet length allowed.
|
||||
* This will be reconfigured based on MTU set for PF/VF.
|
||||
*/
|
||||
for (cgx = 0; cgx < hw->cgx; cgx++) {
|
||||
lmac_cnt = cgx_get_lmac_cnt(rvu_cgx_pdata(cgx, rvu));
|
||||
tx_credits = ((CGX_FIFO_LEN / lmac_cnt) - NIC_HW_MAX_FRS) / 16;
|
||||
/* Enable credits and set credit pkt count to max allowed */
|
||||
tx_credits = (tx_credits << 12) | (0x1FF << 2) | BIT_ULL(1);
|
||||
slink = cgx * hw->lmac_per_cgx;
|
||||
for (link = slink; link < (slink + lmac_cnt); link++) {
|
||||
rvu_write64(rvu, blkaddr,
|
||||
NIX_AF_TX_LINKX_NORM_CREDIT(link),
|
||||
tx_credits);
|
||||
rvu_write64(rvu, blkaddr,
|
||||
NIX_AF_TX_LINKX_EXPR_CREDIT(link),
|
||||
tx_credits);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set Tx credits for LBK link */
|
||||
slink = hw->cgx_links;
|
||||
for (link = slink; link < (slink + hw->lbk_links); link++) {
|
||||
tx_credits = 1000; /* 10 * max LBK datarate = 10 * 100Gbps */
|
||||
/* Enable credits and set credit pkt count to max allowed */
|
||||
tx_credits = (tx_credits << 12) | (0x1FF << 2) | BIT_ULL(1);
|
||||
rvu_write64(rvu, blkaddr,
|
||||
NIX_AF_TX_LINKX_NORM_CREDIT(link), tx_credits);
|
||||
rvu_write64(rvu, blkaddr,
|
||||
NIX_AF_TX_LINKX_EXPR_CREDIT(link), tx_credits);
|
||||
}
|
||||
}
|
||||
|
||||
static int nix_calibrate_x2p(struct rvu *rvu, int blkaddr)
|
||||
{
|
||||
int idx, err;
|
||||
|
@ -1830,10 +2141,10 @@ static int nix_aq_init(struct rvu *rvu, struct rvu_block *block)
|
|||
/* Set admin queue endianness */
|
||||
cfg = rvu_read64(rvu, block->addr, NIX_AF_CFG);
|
||||
#ifdef __BIG_ENDIAN
|
||||
cfg |= BIT_ULL(1);
|
||||
cfg |= BIT_ULL(8);
|
||||
rvu_write64(rvu, block->addr, NIX_AF_CFG, cfg);
|
||||
#else
|
||||
cfg &= ~BIT_ULL(1);
|
||||
cfg &= ~BIT_ULL(8);
|
||||
rvu_write64(rvu, block->addr, NIX_AF_CFG, cfg);
|
||||
#endif
|
||||
|
||||
|
@ -1870,6 +2181,14 @@ int rvu_nix_init(struct rvu *rvu)
|
|||
return 0;
|
||||
block = &hw->block[blkaddr];
|
||||
|
||||
/* As per a HW errata in 9xxx A0 silicon, NIX may corrupt
|
||||
* internal state when conditional clocks are turned off.
|
||||
* Hence enable them.
|
||||
*/
|
||||
if (is_rvu_9xxx_A0(rvu))
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_CFG,
|
||||
rvu_read64(rvu, blkaddr, NIX_AF_CFG) | 0x5EULL);
|
||||
|
||||
/* Calibrate X2P bus to check if CGX/LBK links are fine */
|
||||
err = nix_calibrate_x2p(rvu, blkaddr);
|
||||
if (err)
|
||||
|
@ -1922,6 +2241,9 @@ int rvu_nix_init(struct rvu *rvu)
|
|||
(NPC_LID_LC << 8) | (NPC_LT_LC_IP << 4) | 0x0F);
|
||||
|
||||
nix_rx_flowkey_alg_cfg(rvu, blkaddr);
|
||||
|
||||
/* Initialize CGX/LBK/SDP link credits, min/max pkt lengths */
|
||||
nix_link_config(rvu, blkaddr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1955,5 +2277,88 @@ void rvu_nix_freemem(struct rvu *rvu)
|
|||
mcast = &nix_hw->mcast;
|
||||
qmem_free(rvu->dev, mcast->mce_ctx);
|
||||
qmem_free(rvu->dev, mcast->mcast_buf);
|
||||
mutex_destroy(&mcast->mce_lock);
|
||||
}
|
||||
}
|
||||
|
||||
static int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf)
|
||||
{
|
||||
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
struct rvu_hwinfo *hw = rvu->hw;
|
||||
int blkaddr;
|
||||
|
||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
||||
if (!pfvf->nixlf || blkaddr < 0)
|
||||
return NIX_AF_ERR_AF_LF_INVALID;
|
||||
|
||||
*nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
|
||||
if (*nixlf < 0)
|
||||
return NIX_AF_ERR_AF_LF_INVALID;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_lf_start_rx(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
u16 pcifunc = req->hdr.pcifunc;
|
||||
int nixlf, err;
|
||||
|
||||
err = nix_get_nixlf(rvu, pcifunc, &nixlf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
rvu_npc_enable_default_entries(rvu, pcifunc, nixlf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_lf_stop_rx(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
u16 pcifunc = req->hdr.pcifunc;
|
||||
int nixlf, err;
|
||||
|
||||
err = nix_get_nixlf(rvu, pcifunc, &nixlf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
rvu_npc_disable_default_entries(rvu, pcifunc, nixlf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rvu_nix_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int nixlf)
|
||||
{
|
||||
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
struct hwctx_disable_req ctx_req;
|
||||
int err;
|
||||
|
||||
ctx_req.hdr.pcifunc = pcifunc;
|
||||
|
||||
/* Cleanup NPC MCAM entries, free Tx scheduler queues being used */
|
||||
nix_interface_deinit(rvu, pcifunc, nixlf);
|
||||
nix_rx_sync(rvu, blkaddr);
|
||||
nix_txschq_free(rvu, pcifunc);
|
||||
|
||||
if (pfvf->sq_ctx) {
|
||||
ctx_req.ctype = NIX_AQ_CTYPE_SQ;
|
||||
err = nix_lf_hwctx_disable(rvu, &ctx_req);
|
||||
if (err)
|
||||
dev_err(rvu->dev, "SQ ctx disable failed\n");
|
||||
}
|
||||
|
||||
if (pfvf->rq_ctx) {
|
||||
ctx_req.ctype = NIX_AQ_CTYPE_RQ;
|
||||
err = nix_lf_hwctx_disable(rvu, &ctx_req);
|
||||
if (err)
|
||||
dev_err(rvu->dev, "RQ ctx disable failed\n");
|
||||
}
|
||||
|
||||
if (pfvf->cq_ctx) {
|
||||
ctx_req.ctype = NIX_AQ_CTYPE_CQ;
|
||||
err = nix_lf_hwctx_disable(rvu, &ctx_req);
|
||||
if (err)
|
||||
dev_err(rvu->dev, "CQ ctx disable failed\n");
|
||||
}
|
||||
|
||||
nix_ctx_free(rvu, pfvf);
|
||||
}
|
||||
|
|
|
@ -241,14 +241,14 @@ static int npa_lf_hwctx_disable(struct rvu *rvu, struct hwctx_disable_req *req)
|
|||
return err;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NPA_AQ_ENQ(struct rvu *rvu,
|
||||
int rvu_mbox_handler_npa_aq_enq(struct rvu *rvu,
|
||||
struct npa_aq_enq_req *req,
|
||||
struct npa_aq_enq_rsp *rsp)
|
||||
{
|
||||
return rvu_npa_aq_enq_inst(rvu, req, rsp);
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NPA_HWCTX_DISABLE(struct rvu *rvu,
|
||||
int rvu_mbox_handler_npa_hwctx_disable(struct rvu *rvu,
|
||||
struct hwctx_disable_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ static void npa_ctx_free(struct rvu *rvu, struct rvu_pfvf *pfvf)
|
|||
pfvf->npa_qints_ctx = NULL;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NPA_LF_ALLOC(struct rvu *rvu,
|
||||
int rvu_mbox_handler_npa_lf_alloc(struct rvu *rvu,
|
||||
struct npa_lf_alloc_req *req,
|
||||
struct npa_lf_alloc_rsp *rsp)
|
||||
{
|
||||
|
@ -372,7 +372,7 @@ exit:
|
|||
return rc;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_NPA_LF_FREE(struct rvu *rvu, struct msg_req *req,
|
||||
int rvu_mbox_handler_npa_lf_free(struct rvu *rvu, struct msg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
struct rvu_hwinfo *hw = rvu->hw;
|
||||
|
@ -470,3 +470,20 @@ void rvu_npa_freemem(struct rvu *rvu)
|
|||
block = &hw->block[blkaddr];
|
||||
rvu_aq_free(rvu, block->aq);
|
||||
}
|
||||
|
||||
void rvu_npa_lf_teardown(struct rvu *rvu, u16 pcifunc, int npalf)
|
||||
{
|
||||
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
struct hwctx_disable_req ctx_req;
|
||||
|
||||
/* Disable all pools */
|
||||
ctx_req.hdr.pcifunc = pcifunc;
|
||||
ctx_req.ctype = NPA_AQ_CTYPE_POOL;
|
||||
npa_lf_hwctx_disable(rvu, &ctx_req);
|
||||
|
||||
/* Disable all auras */
|
||||
ctx_req.ctype = NPA_AQ_CTYPE_AURA;
|
||||
npa_lf_hwctx_disable(rvu, &ctx_req);
|
||||
|
||||
npa_ctx_free(rvu, pfvf);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue