Commit bd522d68 authored by Jerin Jacob's avatar Jerin Jacob Committed by David S. Miller

octeontx2-af: Add response for RSS flow key cfg message

Added response for nix_rss_flowkey_cfg message to return
selected RSS algorithm index.

The FLOW_KEY_TYPE* definition is part of the mbox message and
it will be used by the other consumers of AF driver hence moving to mbox.h.

Also renamed FLOW_* definitions to NIX_FLOW_* to avoid global
name space collisions, as we have various coming from
include/uapi/linux/pkt_cls.h for example.
Signed-off-by: default avatarJerin Jacob <jerinj@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c5e4e4d1
...@@ -193,26 +193,18 @@ enum nix_scheduler { ...@@ -193,26 +193,18 @@ enum nix_scheduler {
#define DEFAULT_RSS_CONTEXT_GROUP 0 #define DEFAULT_RSS_CONTEXT_GROUP 0
#define MAX_RSS_INDIR_TBL_SIZE 256 /* 1 << Max adder bits */ #define MAX_RSS_INDIR_TBL_SIZE 256 /* 1 << Max adder bits */
/* NIX flow tag, key type flags */
#define FLOW_KEY_TYPE_PORT BIT(0)
#define FLOW_KEY_TYPE_IPV4 BIT(1)
#define FLOW_KEY_TYPE_IPV6 BIT(2)
#define FLOW_KEY_TYPE_TCP BIT(3)
#define FLOW_KEY_TYPE_UDP BIT(4)
#define FLOW_KEY_TYPE_SCTP BIT(5)
/* NIX flow tag algorithm indices, max is 31 */ /* NIX flow tag algorithm indices, max is 31 */
enum { enum {
FLOW_KEY_ALG_PORT, NIX_FLOW_KEY_ALG_PORT,
FLOW_KEY_ALG_IP, NIX_FLOW_KEY_ALG_IP,
FLOW_KEY_ALG_TCP, NIX_FLOW_KEY_ALG_TCP,
FLOW_KEY_ALG_UDP, NIX_FLOW_KEY_ALG_UDP,
FLOW_KEY_ALG_SCTP, NIX_FLOW_KEY_ALG_SCTP,
FLOW_KEY_ALG_TCP_UDP, NIX_FLOW_KEY_ALG_TCP_UDP,
FLOW_KEY_ALG_TCP_SCTP, NIX_FLOW_KEY_ALG_TCP_SCTP,
FLOW_KEY_ALG_UDP_SCTP, NIX_FLOW_KEY_ALG_UDP_SCTP,
FLOW_KEY_ALG_TCP_UDP_SCTP, NIX_FLOW_KEY_ALG_TCP_UDP_SCTP,
FLOW_KEY_ALG_MAX, NIX_FLOW_KEY_ALG_MAX,
}; };
#endif /* COMMON_H */ #endif /* COMMON_H */
...@@ -193,7 +193,8 @@ M(NIX_TXSCHQ_CFG, 0x8006, nix_txschq_cfg, nix_txschq_config, msg_rsp) \ ...@@ -193,7 +193,8 @@ 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_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_VTAG_CFG, 0x8008, nix_vtag_cfg, nix_vtag_config, msg_rsp) \
M(NIX_RSS_FLOWKEY_CFG, 0x8009, nix_rss_flowkey_cfg, \ M(NIX_RSS_FLOWKEY_CFG, 0x8009, nix_rss_flowkey_cfg, \
nix_rss_flowkey_cfg, msg_rsp) \ nix_rss_flowkey_cfg, \
nix_rss_flowkey_cfg_rsp) \
M(NIX_SET_MAC_ADDR, 0x800a, nix_set_mac_addr, nix_set_mac_addr, 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_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_SET_HW_FRS, 0x800c, nix_set_hw_frs, nix_frs_cfg, msg_rsp) \
...@@ -560,10 +561,21 @@ struct nix_vtag_config { ...@@ -560,10 +561,21 @@ struct nix_vtag_config {
struct nix_rss_flowkey_cfg { struct nix_rss_flowkey_cfg {
struct mbox_msghdr hdr; struct mbox_msghdr hdr;
int mcam_index; /* MCAM entry index to modify */ int mcam_index; /* MCAM entry index to modify */
#define NIX_FLOW_KEY_TYPE_PORT BIT(0)
#define NIX_FLOW_KEY_TYPE_IPV4 BIT(1)
#define NIX_FLOW_KEY_TYPE_IPV6 BIT(2)
#define NIX_FLOW_KEY_TYPE_TCP BIT(3)
#define NIX_FLOW_KEY_TYPE_UDP BIT(4)
#define NIX_FLOW_KEY_TYPE_SCTP BIT(5)
u32 flowkey_cfg; /* Flowkey types selected */ u32 flowkey_cfg; /* Flowkey types selected */
u8 group; /* RSS context or group */ u8 group; /* RSS context or group */
}; };
struct nix_rss_flowkey_cfg_rsp {
struct mbox_msghdr hdr;
u8 alg_idx; /* Selected algo index */
};
struct nix_set_mac_addr { struct nix_set_mac_addr {
struct mbox_msghdr hdr; struct mbox_msghdr hdr;
u8 mac_addr[ETH_ALEN]; /* MAC address to be set for this pcifunc */ u8 mac_addr[ETH_ALEN]; /* MAC address to be set for this pcifunc */
......
...@@ -398,7 +398,7 @@ int rvu_mbox_handler_nix_rxvlan_alloc(struct rvu *rvu, struct msg_req *req, ...@@ -398,7 +398,7 @@ int rvu_mbox_handler_nix_rxvlan_alloc(struct rvu *rvu, struct msg_req *req,
struct msg_rsp *rsp); struct msg_rsp *rsp);
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 nix_rss_flowkey_cfg *req,
struct msg_rsp *rsp); struct nix_rss_flowkey_cfg_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 nix_set_mac_addr *req,
struct msg_rsp *rsp); struct msg_rsp *rsp);
......
...@@ -1601,32 +1601,35 @@ static int get_flowkey_alg_idx(u32 flow_cfg) ...@@ -1601,32 +1601,35 @@ static int get_flowkey_alg_idx(u32 flow_cfg)
{ {
u32 ip_cfg; u32 ip_cfg;
flow_cfg &= ~FLOW_KEY_TYPE_PORT; flow_cfg &= ~NIX_FLOW_KEY_TYPE_PORT;
ip_cfg = FLOW_KEY_TYPE_IPV4 | FLOW_KEY_TYPE_IPV6; ip_cfg = NIX_FLOW_KEY_TYPE_IPV4 | NIX_FLOW_KEY_TYPE_IPV6;
if (flow_cfg == ip_cfg) if (flow_cfg == ip_cfg)
return FLOW_KEY_ALG_IP; return NIX_FLOW_KEY_ALG_IP;
else if (flow_cfg == (ip_cfg | FLOW_KEY_TYPE_TCP)) else if (flow_cfg == (ip_cfg | NIX_FLOW_KEY_TYPE_TCP))
return FLOW_KEY_ALG_TCP; return NIX_FLOW_KEY_ALG_TCP;
else if (flow_cfg == (ip_cfg | FLOW_KEY_TYPE_UDP)) else if (flow_cfg == (ip_cfg | NIX_FLOW_KEY_TYPE_UDP))
return FLOW_KEY_ALG_UDP; return NIX_FLOW_KEY_ALG_UDP;
else if (flow_cfg == (ip_cfg | FLOW_KEY_TYPE_SCTP)) else if (flow_cfg == (ip_cfg | NIX_FLOW_KEY_TYPE_SCTP))
return FLOW_KEY_ALG_SCTP; return NIX_FLOW_KEY_ALG_SCTP;
else if (flow_cfg == (ip_cfg | FLOW_KEY_TYPE_TCP | FLOW_KEY_TYPE_UDP)) else if (flow_cfg == (ip_cfg | NIX_FLOW_KEY_TYPE_TCP |
return FLOW_KEY_ALG_TCP_UDP; NIX_FLOW_KEY_TYPE_UDP))
else if (flow_cfg == (ip_cfg | FLOW_KEY_TYPE_TCP | FLOW_KEY_TYPE_SCTP)) return NIX_FLOW_KEY_ALG_TCP_UDP;
return FLOW_KEY_ALG_TCP_SCTP; else if (flow_cfg == (ip_cfg | NIX_FLOW_KEY_TYPE_TCP |
else if (flow_cfg == (ip_cfg | FLOW_KEY_TYPE_UDP | FLOW_KEY_TYPE_SCTP)) NIX_FLOW_KEY_TYPE_SCTP))
return FLOW_KEY_ALG_UDP_SCTP; return NIX_FLOW_KEY_ALG_TCP_SCTP;
else if (flow_cfg == (ip_cfg | FLOW_KEY_TYPE_TCP | else if (flow_cfg == (ip_cfg | NIX_FLOW_KEY_TYPE_UDP |
FLOW_KEY_TYPE_UDP | FLOW_KEY_TYPE_SCTP)) NIX_FLOW_KEY_TYPE_SCTP))
return FLOW_KEY_ALG_TCP_UDP_SCTP; return NIX_FLOW_KEY_ALG_UDP_SCTP;
else if (flow_cfg == (ip_cfg | NIX_FLOW_KEY_TYPE_TCP |
return FLOW_KEY_ALG_PORT; NIX_FLOW_KEY_TYPE_UDP | NIX_FLOW_KEY_TYPE_SCTP))
return NIX_FLOW_KEY_ALG_TCP_UDP_SCTP;
return NIX_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 nix_rss_flowkey_cfg *req,
struct msg_rsp *rsp) struct nix_rss_flowkey_cfg_rsp *rsp)
{ {
struct rvu_hwinfo *hw = rvu->hw; struct rvu_hwinfo *hw = rvu->hw;
u16 pcifunc = req->hdr.pcifunc; u16 pcifunc = req->hdr.pcifunc;
...@@ -1641,7 +1644,7 @@ int rvu_mbox_handler_nix_rss_flowkey_cfg(struct rvu *rvu, ...@@ -1641,7 +1644,7 @@ int rvu_mbox_handler_nix_rss_flowkey_cfg(struct rvu *rvu,
return NIX_AF_ERR_AF_LF_INVALID; return NIX_AF_ERR_AF_LF_INVALID;
alg_idx = get_flowkey_alg_idx(req->flowkey_cfg); alg_idx = get_flowkey_alg_idx(req->flowkey_cfg);
rsp->alg_idx = alg_idx;
rvu_npc_update_flowkey_alg_idx(rvu, pcifunc, nixlf, req->group, rvu_npc_update_flowkey_alg_idx(rvu, pcifunc, nixlf, req->group,
alg_idx, req->mcam_index); alg_idx, req->mcam_index);
return 0; return 0;
...@@ -1674,13 +1677,13 @@ static void set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg) ...@@ -1674,13 +1677,13 @@ static void set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg)
if (!key_type) if (!key_type)
continue; continue;
switch (key_type) { switch (key_type) {
case FLOW_KEY_TYPE_PORT: case NIX_FLOW_KEY_TYPE_PORT:
field = &alg[0]; field = &alg[0];
field->sel_chan = true; field->sel_chan = true;
/* This should be set to 1, when SEL_CHAN is set */ /* This should be set to 1, when SEL_CHAN is set */
field->bytesm1 = 1; field->bytesm1 = 1;
break; break;
case FLOW_KEY_TYPE_IPV4: case NIX_FLOW_KEY_TYPE_IPV4:
field = &alg[0]; field = &alg[0];
field->lid = NPC_LID_LC; field->lid = NPC_LID_LC;
field->ltype_match = NPC_LT_LC_IP; field->ltype_match = NPC_LT_LC_IP;
...@@ -1688,7 +1691,7 @@ static void set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg) ...@@ -1688,7 +1691,7 @@ static void set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg)
field->bytesm1 = 7; /* SIP + DIP, 8 bytes */ field->bytesm1 = 7; /* SIP + DIP, 8 bytes */
field->ltype_mask = 0xF; /* Match only IPv4 */ field->ltype_mask = 0xF; /* Match only IPv4 */
break; break;
case FLOW_KEY_TYPE_IPV6: case NIX_FLOW_KEY_TYPE_IPV6:
field = &alg[1]; field = &alg[1];
field->lid = NPC_LID_LC; field->lid = NPC_LID_LC;
field->ltype_match = NPC_LT_LC_IP6; field->ltype_match = NPC_LT_LC_IP6;
...@@ -1696,17 +1699,17 @@ static void set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg) ...@@ -1696,17 +1699,17 @@ static void set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg)
field->bytesm1 = 31; /* SIP + DIP, 32 bytes */ field->bytesm1 = 31; /* SIP + DIP, 32 bytes */
field->ltype_mask = 0xF; /* Match only IPv6 */ field->ltype_mask = 0xF; /* Match only IPv6 */
break; break;
case FLOW_KEY_TYPE_TCP: case NIX_FLOW_KEY_TYPE_TCP:
case FLOW_KEY_TYPE_UDP: case NIX_FLOW_KEY_TYPE_UDP:
case FLOW_KEY_TYPE_SCTP: case NIX_FLOW_KEY_TYPE_SCTP:
field = &alg[2]; field = &alg[2];
field->lid = NPC_LID_LD; field->lid = NPC_LID_LD;
field->bytesm1 = 3; /* Sport + Dport, 4 bytes */ field->bytesm1 = 3; /* Sport + Dport, 4 bytes */
if (key_type == FLOW_KEY_TYPE_TCP) if (key_type == NIX_FLOW_KEY_TYPE_TCP)
field->ltype_match |= NPC_LT_LD_TCP; field->ltype_match |= NPC_LT_LD_TCP;
else if (key_type == FLOW_KEY_TYPE_UDP) else if (key_type == NIX_FLOW_KEY_TYPE_UDP)
field->ltype_match |= NPC_LT_LD_UDP; field->ltype_match |= NPC_LT_LD_UDP;
else if (key_type == FLOW_KEY_TYPE_SCTP) else if (key_type == NIX_FLOW_KEY_TYPE_SCTP)
field->ltype_match |= NPC_LT_LD_SCTP; field->ltype_match |= NPC_LT_LD_SCTP;
field->key_offset = 32; /* After IPv4/v6 SIP, DIP */ field->key_offset = 32; /* After IPv4/v6 SIP, DIP */
field->ltype_mask = ~field->ltype_match; field->ltype_mask = ~field->ltype_match;
...@@ -1721,15 +1724,15 @@ static void set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg) ...@@ -1721,15 +1724,15 @@ static void set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg)
static void nix_rx_flowkey_alg_cfg(struct rvu *rvu, int blkaddr) static void nix_rx_flowkey_alg_cfg(struct rvu *rvu, int blkaddr)
{ {
#define FIELDS_PER_ALG 5 #define FIELDS_PER_ALG 5
u64 field[FLOW_KEY_ALG_MAX][FIELDS_PER_ALG]; u64 field[NIX_FLOW_KEY_ALG_MAX][FIELDS_PER_ALG];
u32 flowkey_cfg, minkey_cfg; u32 flowkey_cfg, minkey_cfg;
int alg, fid; int alg, fid;
memset(&field, 0, sizeof(u64) * FLOW_KEY_ALG_MAX * FIELDS_PER_ALG); memset(&field, 0, sizeof(u64) * NIX_FLOW_KEY_ALG_MAX * FIELDS_PER_ALG);
/* Only incoming channel number */ /* Only incoming channel number */
flowkey_cfg = FLOW_KEY_TYPE_PORT; flowkey_cfg = NIX_FLOW_KEY_TYPE_PORT;
set_flowkey_fields((void *)&field[FLOW_KEY_ALG_PORT], flowkey_cfg); set_flowkey_fields((void *)&field[NIX_FLOW_KEY_ALG_PORT], flowkey_cfg);
/* For a incoming pkt if none of the fields match then flowkey /* For a incoming pkt if none of the fields match then flowkey
* will be zero, hence tag generated will also be zero. * will be zero, hence tag generated will also be zero.
...@@ -1738,41 +1741,47 @@ static void nix_rx_flowkey_alg_cfg(struct rvu *rvu, int blkaddr) ...@@ -1738,41 +1741,47 @@ static void nix_rx_flowkey_alg_cfg(struct rvu *rvu, int blkaddr)
*/ */
/* IPv4/IPv6 SIP/DIPs */ /* IPv4/IPv6 SIP/DIPs */
flowkey_cfg = FLOW_KEY_TYPE_IPV4 | FLOW_KEY_TYPE_IPV6; flowkey_cfg = NIX_FLOW_KEY_TYPE_IPV4 | NIX_FLOW_KEY_TYPE_IPV6;
set_flowkey_fields((void *)&field[FLOW_KEY_ALG_IP], flowkey_cfg); set_flowkey_fields((void *)&field[NIX_FLOW_KEY_ALG_IP], flowkey_cfg);
/* TCPv4/v6 4-tuple, SIP, DIP, Sport, Dport */ /* TCPv4/v6 4-tuple, SIP, DIP, Sport, Dport */
minkey_cfg = flowkey_cfg; minkey_cfg = flowkey_cfg;
flowkey_cfg = minkey_cfg | FLOW_KEY_TYPE_TCP; flowkey_cfg = minkey_cfg | NIX_FLOW_KEY_TYPE_TCP;
set_flowkey_fields((void *)&field[FLOW_KEY_ALG_TCP], flowkey_cfg); set_flowkey_fields((void *)&field[NIX_FLOW_KEY_ALG_TCP], flowkey_cfg);
/* UDPv4/v6 4-tuple, SIP, DIP, Sport, Dport */ /* UDPv4/v6 4-tuple, SIP, DIP, Sport, Dport */
flowkey_cfg = minkey_cfg | FLOW_KEY_TYPE_UDP; flowkey_cfg = minkey_cfg | NIX_FLOW_KEY_TYPE_UDP;
set_flowkey_fields((void *)&field[FLOW_KEY_ALG_UDP], flowkey_cfg); set_flowkey_fields((void *)&field[NIX_FLOW_KEY_ALG_UDP], flowkey_cfg);
/* SCTPv4/v6 4-tuple, SIP, DIP, Sport, Dport */ /* SCTPv4/v6 4-tuple, SIP, DIP, Sport, Dport */
flowkey_cfg = minkey_cfg | FLOW_KEY_TYPE_SCTP; flowkey_cfg = minkey_cfg | NIX_FLOW_KEY_TYPE_SCTP;
set_flowkey_fields((void *)&field[FLOW_KEY_ALG_SCTP], flowkey_cfg); set_flowkey_fields((void *)&field[NIX_FLOW_KEY_ALG_SCTP], flowkey_cfg);
/* TCP/UDP v4/v6 4-tuple, rest IP pkts 2-tuple */ /* TCP/UDP v4/v6 4-tuple, rest IP pkts 2-tuple */
flowkey_cfg = minkey_cfg | FLOW_KEY_TYPE_TCP | FLOW_KEY_TYPE_UDP; flowkey_cfg = minkey_cfg | NIX_FLOW_KEY_TYPE_TCP |
set_flowkey_fields((void *)&field[FLOW_KEY_ALG_TCP_UDP], flowkey_cfg); NIX_FLOW_KEY_TYPE_UDP;
set_flowkey_fields((void *)&field[NIX_FLOW_KEY_ALG_TCP_UDP],
flowkey_cfg);
/* TCP/SCTP v4/v6 4-tuple, rest IP pkts 2-tuple */ /* TCP/SCTP v4/v6 4-tuple, rest IP pkts 2-tuple */
flowkey_cfg = minkey_cfg | FLOW_KEY_TYPE_TCP | FLOW_KEY_TYPE_SCTP; flowkey_cfg = minkey_cfg | NIX_FLOW_KEY_TYPE_TCP |
set_flowkey_fields((void *)&field[FLOW_KEY_ALG_TCP_SCTP], flowkey_cfg); NIX_FLOW_KEY_TYPE_SCTP;
set_flowkey_fields((void *)&field[NIX_FLOW_KEY_ALG_TCP_SCTP],
flowkey_cfg);
/* UDP/SCTP v4/v6 4-tuple, rest IP pkts 2-tuple */ /* UDP/SCTP v4/v6 4-tuple, rest IP pkts 2-tuple */
flowkey_cfg = minkey_cfg | FLOW_KEY_TYPE_UDP | FLOW_KEY_TYPE_SCTP; flowkey_cfg = minkey_cfg | NIX_FLOW_KEY_TYPE_UDP |
set_flowkey_fields((void *)&field[FLOW_KEY_ALG_UDP_SCTP], flowkey_cfg); NIX_FLOW_KEY_TYPE_SCTP;
set_flowkey_fields((void *)&field[NIX_FLOW_KEY_ALG_UDP_SCTP],
flowkey_cfg);
/* TCP/UDP/SCTP v4/v6 4-tuple, rest IP pkts 2-tuple */ /* TCP/UDP/SCTP v4/v6 4-tuple, rest IP pkts 2-tuple */
flowkey_cfg = minkey_cfg | FLOW_KEY_TYPE_TCP | flowkey_cfg = minkey_cfg | NIX_FLOW_KEY_TYPE_TCP |
FLOW_KEY_TYPE_UDP | FLOW_KEY_TYPE_SCTP; NIX_FLOW_KEY_TYPE_UDP | NIX_FLOW_KEY_TYPE_SCTP;
set_flowkey_fields((void *)&field[FLOW_KEY_ALG_TCP_UDP_SCTP], set_flowkey_fields((void *)&field[NIX_FLOW_KEY_ALG_TCP_UDP_SCTP],
flowkey_cfg); flowkey_cfg);
for (alg = 0; alg < FLOW_KEY_ALG_MAX; alg++) { for (alg = 0; alg < NIX_FLOW_KEY_ALG_MAX; alg++) {
for (fid = 0; fid < FIELDS_PER_ALG; fid++) for (fid = 0; fid < FIELDS_PER_ALG; fid++)
rvu_write64(rvu, blkaddr, rvu_write64(rvu, blkaddr,
NIX_AF_RX_FLOW_KEY_ALGX_FIELDX(alg, fid), NIX_AF_RX_FLOW_KEY_ALGX_FIELDX(alg, fid),
......
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