Commit 7abaf9a8 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 93c3de3e e12890f4
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define MAX_CGX 3 #define MAX_CGX 3
#define MAX_LMAC_PER_CGX 4 #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) #define CGX_OFFSET(x) ((x) * MAX_LMAC_PER_CGX)
/* Registers */ /* Registers */
......
...@@ -143,6 +143,11 @@ enum nix_scheduler { ...@@ -143,6 +143,11 @@ enum nix_scheduler {
NIX_TXSCH_LVL_CNT = 0x5, 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*/ /* NIX RX action operation*/
#define NIX_RX_ACTIONOP_DROP (0x0ull) #define NIX_RX_ACTIONOP_DROP (0x0ull)
#define NIX_RX_ACTIONOP_UCAST (0x1ull) #define NIX_RX_ACTIONOP_UCAST (0x1ull)
...@@ -169,7 +174,9 @@ enum nix_scheduler { ...@@ -169,7 +174,9 @@ enum nix_scheduler {
#define MAX_LMAC_PKIND 12 #define MAX_LMAC_PKIND 12
#define NIX_LINK_CGX_LMAC(a, b) (0 + 4 * (a) + (b)) #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_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. /* NIX LSO format indices.
* As of now TSO is the only one using, so statically assigning indices. * As of now TSO is the only one using, so statically assigning indices.
......
...@@ -290,7 +290,7 @@ EXPORT_SYMBOL(otx2_mbox_nonempty); ...@@ -290,7 +290,7 @@ EXPORT_SYMBOL(otx2_mbox_nonempty);
const char *otx2_mbox_id2name(u16 id) const char *otx2_mbox_id2name(u16 id)
{ {
switch (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 MBOX_MESSAGES
#undef M #undef M
default: default:
......
...@@ -259,4 +259,10 @@ struct nix_rx_action { ...@@ -259,4 +259,10 @@ struct nix_rx_action {
#endif #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 */ #endif /* NPC_H */
...@@ -20,14 +20,14 @@ struct cgx_evq_entry { ...@@ -20,14 +20,14 @@ struct cgx_evq_entry {
struct cgx_link_event link_event; 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 \ 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; \ struct _req_type *req; \
\ \
req = (struct _req_type *)otx2_mbox_alloc_msg_rsp( \ 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)); \ sizeof(struct _rsp_type)); \
if (!req) \ if (!req) \
return NULL; \ return NULL; \
...@@ -177,12 +177,12 @@ static void cgx_notify_pfs(struct cgx_link_event *event, struct rvu *rvu) ...@@ -177,12 +177,12 @@ static void cgx_notify_pfs(struct cgx_link_event *event, struct rvu *rvu)
} }
/* Send mbox message to PF */ /* 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) if (!msg)
continue; continue;
msg->link_info = *linfo; msg->link_info = *linfo;
otx2_mbox_msg_send(&rvu->mbox_up, pfid); otx2_mbox_msg_send(&rvu->afpf_wq_info.mbox_up, pfid);
err = otx2_mbox_wait_for_rsp(&rvu->mbox_up, pfid); err = otx2_mbox_wait_for_rsp(&rvu->afpf_wq_info.mbox_up, pfid);
if (err) if (err)
dev_warn(rvu->dev, "notification to pf %d failed\n", dev_warn(rvu->dev, "notification to pf %d failed\n",
pfid); pfid);
...@@ -303,21 +303,21 @@ int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start) ...@@ -303,21 +303,21 @@ int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start)
return 0; 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) struct msg_rsp *rsp)
{ {
rvu_cgx_config_rxtx(rvu, req->hdr.pcifunc, true); rvu_cgx_config_rxtx(rvu, req->hdr.pcifunc, true);
return 0; 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) struct msg_rsp *rsp)
{ {
rvu_cgx_config_rxtx(rvu, req->hdr.pcifunc, false); rvu_cgx_config_rxtx(rvu, req->hdr.pcifunc, false);
return 0; 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) struct cgx_stats_rsp *rsp)
{ {
int pf = rvu_get_pf(req->hdr.pcifunc); 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, ...@@ -354,7 +354,7 @@ int rvu_mbox_handler_CGX_STATS(struct rvu *rvu, struct msg_req *req,
return 0; 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 *req,
struct cgx_mac_addr_set_or_get *rsp) struct cgx_mac_addr_set_or_get *rsp)
{ {
...@@ -368,7 +368,7 @@ int rvu_mbox_handler_CGX_MAC_ADDR_SET(struct rvu *rvu, ...@@ -368,7 +368,7 @@ int rvu_mbox_handler_CGX_MAC_ADDR_SET(struct rvu *rvu,
return 0; 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 *req,
struct cgx_mac_addr_set_or_get *rsp) struct cgx_mac_addr_set_or_get *rsp)
{ {
...@@ -387,7 +387,7 @@ int rvu_mbox_handler_CGX_MAC_ADDR_GET(struct rvu *rvu, ...@@ -387,7 +387,7 @@ int rvu_mbox_handler_CGX_MAC_ADDR_GET(struct rvu *rvu,
return 0; 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) struct msg_rsp *rsp)
{ {
u16 pcifunc = req->hdr.pcifunc; u16 pcifunc = req->hdr.pcifunc;
...@@ -407,7 +407,7 @@ int rvu_mbox_handler_CGX_PROMISC_ENABLE(struct rvu *rvu, struct msg_req *req, ...@@ -407,7 +407,7 @@ int rvu_mbox_handler_CGX_PROMISC_ENABLE(struct rvu *rvu, struct msg_req *req,
return 0; 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) struct msg_rsp *rsp)
{ {
u16 pcifunc = req->hdr.pcifunc; u16 pcifunc = req->hdr.pcifunc;
...@@ -451,21 +451,21 @@ static int rvu_cgx_config_linkevents(struct rvu *rvu, u16 pcifunc, bool en) ...@@ -451,21 +451,21 @@ static int rvu_cgx_config_linkevents(struct rvu *rvu, u16 pcifunc, bool en)
return 0; 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) struct msg_rsp *rsp)
{ {
rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, true); rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, true);
return 0; 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) struct msg_rsp *rsp)
{ {
rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, false); rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, false);
return 0; 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) struct cgx_link_info_msg *rsp)
{ {
u8 cgx_id, lmac_id; u8 cgx_id, lmac_id;
...@@ -500,14 +500,14 @@ static int rvu_cgx_config_intlbk(struct rvu *rvu, u16 pcifunc, bool en) ...@@ -500,14 +500,14 @@ static int rvu_cgx_config_intlbk(struct rvu *rvu, u16 pcifunc, bool en)
lmac_id, 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) struct msg_rsp *rsp)
{ {
rvu_cgx_config_intlbk(rvu, req->hdr.pcifunc, true); rvu_cgx_config_intlbk(rvu, req->hdr.pcifunc, true);
return 0; 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) struct msg_rsp *rsp)
{ {
rvu_cgx_config_intlbk(rvu, req->hdr.pcifunc, false); rvu_cgx_config_intlbk(rvu, req->hdr.pcifunc, false);
......
...@@ -241,14 +241,14 @@ static int npa_lf_hwctx_disable(struct rvu *rvu, struct hwctx_disable_req *req) ...@@ -241,14 +241,14 @@ static int npa_lf_hwctx_disable(struct rvu *rvu, struct hwctx_disable_req *req)
return err; 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_req *req,
struct npa_aq_enq_rsp *rsp) struct npa_aq_enq_rsp *rsp)
{ {
return rvu_npa_aq_enq_inst(rvu, req, 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 hwctx_disable_req *req,
struct msg_rsp *rsp) struct msg_rsp *rsp)
{ {
...@@ -273,7 +273,7 @@ static void npa_ctx_free(struct rvu *rvu, struct rvu_pfvf *pfvf) ...@@ -273,7 +273,7 @@ static void npa_ctx_free(struct rvu *rvu, struct rvu_pfvf *pfvf)
pfvf->npa_qints_ctx = NULL; 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_req *req,
struct npa_lf_alloc_rsp *rsp) struct npa_lf_alloc_rsp *rsp)
{ {
...@@ -372,7 +372,7 @@ int rvu_mbox_handler_NPA_LF_ALLOC(struct rvu *rvu, ...@@ -372,7 +372,7 @@ int rvu_mbox_handler_NPA_LF_ALLOC(struct rvu *rvu,
return rc; 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 msg_rsp *rsp)
{ {
struct rvu_hwinfo *hw = rvu->hw; struct rvu_hwinfo *hw = rvu->hw;
...@@ -470,3 +470,20 @@ void rvu_npa_freemem(struct rvu *rvu) ...@@ -470,3 +470,20 @@ void rvu_npa_freemem(struct rvu *rvu)
block = &hw->block[blkaddr]; block = &hw->block[blkaddr];
rvu_aq_free(rvu, block->aq); 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);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment