net/cxgbe: add destination MAC match and VLAN rewrite support for flow API
Subsystems (2)
cover net/cxgbe: add destination MAC match and VLAN rewrite support for flow API
This series of patches add support to offload flows with destination MAC match item and VLAN push/pop/rewrite actions.
Patch 1 adds API to program and manage hardware Layer 2 Table (L2T). L2T holds destination node information to be used for VLAN rewrite.
Patch 2 implements offloading VLAN push/pop/rewrite actions.
Patch 3 adds API to program and manage hardware Multi Port Switch (MPS) table. MPS holds the destination MAC addresses to be matched against incoming packets.
Patch 4 implements offloading destination MAC match item.
Thanks,
Rahul
Shagun Agrawal (4):
net/cxgbe: add API to program hardware layer 2 table net/cxgbe: add flow operations to offload vlan actions net/cxgbe: add API to program hardware MPS table net/cxgbe: add flow operations to match based on destination MAC
address
doc/guides/rel_notes/release_18_11.rst | 7 + drivers/net/cxgbe/Makefile | 2 + drivers/net/cxgbe/base/adapter.h | 4 + drivers/net/cxgbe/base/common.h | 7 + drivers/net/cxgbe/base/t4_hw.c | 108 ++++++++++++++ drivers/net/cxgbe/base/t4_msg.h | 40 ++++++ drivers/net/cxgbe/base/t4_regs.h | 8 ++ drivers/net/cxgbe/base/t4_tcb.h | 5 + drivers/net/cxgbe/base/t4fw_interface.h | 26 ++++ drivers/net/cxgbe/cxgbe_ethdev.c | 4 +- drivers/net/cxgbe/cxgbe_filter.c | 71 +++++++++- drivers/net/cxgbe/cxgbe_filter.h | 11 ++ drivers/net/cxgbe/cxgbe_flow.c | 90 +++++++++++- drivers/net/cxgbe/cxgbe_flow.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 43 ++++-- drivers/net/cxgbe/l2t.c | 227 +++++++++++++++++++++++++++++ drivers/net/cxgbe/l2t.h | 57 ++++++++ drivers/net/cxgbe/meson.build | 2 + drivers/net/cxgbe/mps_tcam.c | 243 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/mps_tcam.h | 52 +++++++ 20 files changed, 987 insertions(+), 21 deletions(-) create mode 100644 drivers/net/cxgbe/l2t.c create mode 100644 drivers/net/cxgbe/l2t.h create mode 100644 drivers/net/cxgbe/mps_tcam.c create mode 100644 drivers/net/cxgbe/mps_tcam.h
Signature · 1 line
2.14.1
PATCH 1/4 net/cxgbe: add API to program hardware layer 2 table
From: Shagun Agrawal <[email protected]>
Add API to program and manage hardware Layer 2 Table. L2T holds information necessary to rewrite specific fields in packet, such as destination MAC address and vlan id.
--- drivers/net/cxgbe/Makefile | 1 + drivers/net/cxgbe/base/adapter.h | 3 + drivers/net/cxgbe/base/t4_msg.h | 34 +++++ drivers/net/cxgbe/base/t4fw_interface.h | 2 + drivers/net/cxgbe/cxgbe_filter.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 30 ++++- drivers/net/cxgbe/l2t.c | 227 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/l2t.h | 57 ++++++++ drivers/net/cxgbe/meson.build | 1 + 9 files changed, 349 insertions(+), 7 deletions(-) create mode 100644 drivers/net/cxgbe/l2t.c create mode 100644 drivers/net/cxgbe/l2t.h
drivers/net/cxgbe/Makefile +1 -0
@@ -53,6 +53,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_filter.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_flow.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += t4_hw.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += clip_tbl.c +SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += l2t.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += t4vf_hw.c include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/cxgbe/base/adapter.h +3 -0
@@ -324,7 +324,10 @@ struct adapter {unsigned int clipt_start;/* CLIP table start */ unsigned int clipt_end;/* CLIP table end */ +unsigned int l2t_start;/* Layer 2 table start */ +unsigned int l2t_end;/* Layer 2 table end */ struct clip_tbl *clipt;/* CLIP table */ +struct l2t_data *l2t;/* Layer 2 table */ struct tid_info tids;/* Info used to access TID related tables */ };
drivers/net/cxgbe/base/t4_msg.h +34 -0
@@ -11,7 +11,9 @@ enum {CPL_SET_TCB_FIELD =0x5 ,CPL_ABORT_REQ =0xA ,CPL_ABORT_RPL =0xB , +CPL_L2T_WRITE_REQ =0x12 ,CPL_TID_RELEASE =0x1A , +CPL_L2T_WRITE_RPL =0x23 ,CPL_ACT_OPEN_RPL =0x25 ,CPL_ABORT_RPL_RSS =0x2D , CPL_SET_TCB_RPL = 0x3A,
@@ -66,6 +68,9 @@ union opcode_tid {#define M_TID_TID 0x3fff#define G_TID_TID (x) (((x) >> S_TID_TID) & M_TID_TID) +#define S_TID_QID 14 +#define V_TID_QID (x) ((x) << S_TID_QID) +struct rss_header {__u8 opcode;#if RTE_BYTE_ORDER ==RTE_LITTLE_ENDIAN
@@ -421,6 +426,35 @@ struct cpl_rx_pkt {__be16 err_vec; }; +struct cpl_l2t_write_req { +WR_HDR ; +union opcode_tid ot; +__be16 params; +__be16 l2t_idx; +__be16 vlan; +__u8 dst_mac[6 ]; +}; + +/* cpl_l2t_write_req.params fields */ +#define S_L2T_W_PORT 8 +#define V_L2T_W_PORT (x) ((x) << S_L2T_W_PORT) + +#define S_L2T_W_LPBK 10 +#define V_L2T_W_LPBK (x) ((x) << S_L2T_W_LPBK) + +#define S_L2T_W_ARPMISS 11 +#define V_L2T_W_ARPMISS (x) ((x) << S_L2T_W_ARPMISS) + +#define S_L2T_W_NOREPLY 15 +#define V_L2T_W_NOREPLY (x) ((x) << S_L2T_W_NOREPLY) + +struct cpl_l2t_write_rpl { +RSS_HDR + union opcode_tid ot; +__u8 status; +__u8 rsvd[3 ]; +}; +/* rx_pkt.l2info fields */ #define S_RXF_UDP 22#define V_RXF_UDP (x) ((x) << S_RXF_UDP)
drivers/net/cxgbe/base/t4fw_interface.h +2 -0
@@ -665,6 +665,8 @@ enum fw_params_param_pfvf {FW_PARAMS_PARAM_PFVF_CLIP_END =0x04 ,FW_PARAMS_PARAM_PFVF_FILTER_START =0x05 ,FW_PARAMS_PARAM_PFVF_FILTER_END =0x06 , +FW_PARAMS_PARAM_PFVF_L2T_START =0x13 , +FW_PARAMS_PARAM_PFVF_L2T_END =0x14 ,FW_PARAMS_PARAM_PFVF_CPLFW4MSG_ENCAP =0x31 , FW_PARAMS_PARAM_PFVF_PORT_CAPS32 = 0x3A };
drivers/net/cxgbe/cxgbe_filter.h +1 -0
@@ -145,6 +145,7 @@ struct filter_entry { u32 pending:1; /* filter action is pending FW reply */struct filter_ctx *ctx;/* caller's completion hook */ struct clip_entry *clipt;/* CLIP Table entry for IPv6 */ +struct l2t_entry *l2t;/* Layer Two Table entry for dmac */ struct rte_eth_dev *dev;/* Port's rte eth device */ void *private;/* For use by apps using filter_entry */
drivers/net/cxgbe/cxgbe_main.c +23 -7
@@ -38,6 +38,7 @@#include "t4_msg.h" #include "cxgbe.h" #include "clip_tbl.h" +#include "l2t.h" /** * Allocate a chunk of memory. The allocated memory is cleared.
@@ -99,6 +100,10 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp,const struct cpl_act_open_rpl *p = (const void *)rsp;hash_filter_rpl (q->adapter, p); + }else if (opcode ==CPL_L2T_WRITE_RPL ) { +const struct cpl_l2t_write_rpl *p = (const void *)rsp; + +do_l2t_write_rpl (q->adapter, p); }else {dev_err (adapter,"unexpected CPL %#x on FW event queue\n" , opcode);
@@ -1135,13 +1140,17 @@ static int adap_init0(struct adapter *adap)V_FW_PARAMS_PARAM_Y (0 ) | \ V_FW_PARAMS_PARAM_Z(0)) - params[0] = FW_PARAM_PFVF(FILTER_START); - params[1 ] =FW_PARAM_PFVF (FILTER_END ); - ret =t4_query_params (adap, adap->mbox, adap->pf,0 ,2 , params, val); + params[0] = FW_PARAM_PFVF(L2T_START); + params[1 ] =FW_PARAM_PFVF (L2T_END ); + params[2 ] =FW_PARAM_PFVF (FILTER_START ); + params[3 ] =FW_PARAM_PFVF (FILTER_END ); + ret =t4_query_params (adap, adap->mbox, adap->pf,0 ,4 , params, val);if (ret <0 ) goto bye; - adap->tids.ftid_base = val[0 ]; - adap->tids.nftids = val[1 ] - val[0 ] +1 ; + adap->l2t_start = val[0 ]; + adap->l2t_end = val[1 ]; + adap->tids.ftid_base = val[2 ]; + adap->tids.nftids = val[3 ] - val[2 ] +1 ; params[0 ] =FW_PARAM_PFVF (CLIP_START ); params[1 ] =FW_PARAM_PFVF (CLIP_END );
@@ -1679,10 +1688,11 @@ void cxgbe_close(struct adapter *adapter)int i;if (adapter->flags &FULL_INIT_DONE ) { -if (is_pf4 (adapter)) -t4_intr_disable (adapter);tid_free (&adapter->tids);t4_cleanup_clip_tbl (adapter); +t4_cleanup_l2t (adapter); +if (is_pf4 (adapter)) +t4_intr_disable (adapter);t4_sge_tx_monitor_stop (adapter);t4_free_sge_resources (adapter);for_each_port (adapter, i) {
@@ -1855,6 +1865,12 @@ int cxgbe_probe(struct adapter *adapter)dev_warn (adapter,"could not allocate CLIP. Continuing\n" ); } + adapter->l2t =t4_init_l2t (adapter->l2t_start, adapter->l2t_end); +if (!adapter->l2t) { +/* We tolerate a lack of L2T, giving up some functionality */ +dev_warn (adapter,"could not allocate L2T. Continuing\n" ); + } +if (tid_init (&adapter->tids) <0 ) {/* Disable filtering support */ dev_warn(adapter, "could not allocate TID table, "
drivers/net/cxgbe/l2t.c new file +227 -0
227 lines not on this page · raw message
drivers/net/cxgbe/l2t.h new file +57 -0
57 lines not on this page · raw message
drivers/net/cxgbe/meson.build +1 -0
@@ -9,6 +9,7 @@ sources = files('cxgbe_ethdev.c', 'cxgbe_filter.c', 'cxgbe_flow.c', 'clip_tbl.c', + 'l2t.c', 'base/t4_hw.c', 'base/t4vf_hw.c') includes += include_directories('base')
Signature · 1 line
2.14.1
PATCH 2/4 net/cxgbe: add flow operations to offload vlan actions
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add flow API operations to offload vlan push, pop, and rewrite actions. For vlan push or rewrite actions, allocate and program an entry from L2T table. Use the L2T index to program vlan actions for LETCAM (maskfull) and HASH (maskless) filters.
--- doc/guides/rel_notes/release_18_11.rst | 6 ++++ drivers/net/cxgbe/base/t4_msg.h | 6 ++++ drivers/net/cxgbe/base/t4_tcb.h | 5 +++ drivers/net/cxgbe/cxgbe_filter.c | 62 ++++++++++++++++++++++++++++++++-- drivers/net/cxgbe/cxgbe_filter.h | 9 +++++ drivers/net/cxgbe/cxgbe_flow.c | 24 +++++++++++++ 6 files changed, 109 insertions(+), 3 deletions(-)
doc/guides/rel_notes/release_18_11.rst +6 -0
@@ -54,6 +54,12 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Add support to offload more flow match and actions for CXGBE PMD** + + Flow API support has been enhanced for CXGBE Poll Mode Driver to offload: + + * Action items: push/pop/rewrite vlan header. + API Changes -----------
drivers/net/cxgbe/base/t4_msg.h +6 -0
@@ -138,6 +138,12 @@ struct work_request_hdr {#define V_TCAM_BYPASS (x) ((__u64)(x) << S_TCAM_BYPASS)#define F_TCAM_BYPASS V_TCAM_BYPASS(1ULL) +#define S_L2T_IDX 36 +#define V_L2T_IDX (x) ((__u64)(x) << S_L2T_IDX) + +#define S_NAGLE 49 +#define V_NAGLE (x) ((__u64)(x) << S_NAGLE) +/* option 2 fields */ #define S_RSS_QUEUE 0#define V_RSS_QUEUE (x) ((x) << S_RSS_QUEUE)
drivers/net/cxgbe/base/t4_tcb.h +5 -0
@@ -6,6 +6,9 @@#ifndef _T4_TCB_DEFS_H#define _T4_TCB_DEFS_H +/* 95:32 */ +#define W_TCB_T_FLAGS 1 +/* 105:96 */ #define W_TCB_RSS_INFO 3#define S_TCB_RSS_INFO 0
@@ -23,4 +26,6 @@#define M_TCB_T_RTT_TS_RECENT_AGE 0xffffffffULL#define V_TCB_T_RTT_TS_RECENT_AGE (x) ((x) << S_TCB_T_RTT_TS_RECENT_AGE) +#define S_TF_CCTRL_RFR 62 +#endif /* _T4_TCB_DEFS_H */
drivers/net/cxgbe/cxgbe_filter.c +59 -3
112 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_filter.h +9 -0
@@ -99,6 +99,9 @@ struct ch_filter_specification { uint32_t iq:10; /* ingress queue */ uint32_t eport:2; /* egress port to switch packet out */ + uint32_t newvlan:2; /* rewrite VLAN Tag */ +uint8_t dmac[ETHER_ADDR_LEN ];/* new destination MAC address */ +uint16_t vlan;/* VLAN Tag to insert */ /* Filter rule value/mask pairs. */ struct ch_filter_tuple val;
@@ -111,6 +114,12 @@ enum {FILTER_SWITCH }; +enum { +VLAN_REMOVE =1 , +VLAN_INSERT , +VLAN_REWRITE +}; +enum filter_type {FILTER_TYPE_IPV4 =0 ,FILTER_TYPE_IPV6 ,
drivers/net/cxgbe/cxgbe_flow.c +24 -0
@@ -331,9 +331,30 @@ ch_rte_parse_atype_switch(const struct rte_flow_action *a,struct ch_filter_specification *fs, struct rte_flow_error *e) { + const struct rte_flow_action_of_set_vlan_vid *vlanid; +const struct rte_flow_action_of_push_vlan *pushvlan;const struct rte_flow_action_phy_port *port;switch (a->type) { +case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID : + vlanid = (const struct rte_flow_action_of_set_vlan_vid *) + a->conf; + fs->newvlan =VLAN_REWRITE ; + fs->vlan = vlanid->vlan_vid; +break ; +case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN : + pushvlan = (const struct rte_flow_action_of_push_vlan *) + a->conf; +if (pushvlan->ethertype !=ETHER_TYPE_VLAN ) +return rte_flow_error_set (e,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , a, +"only ethertype 0x8100 " +"supported for push vlan." ); + fs->newvlan =VLAN_INSERT ; +break ; +case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN : + fs->newvlan =VLAN_REMOVE ; +break ;case RTE_FLOW_ACTION_TYPE_PHY_PORT : port = (const struct rte_flow_action_phy_port *)a->conf; fs->eport = port->index;
@@ -391,6 +412,9 @@ cxgbe_rtef_parse_actions(struct rte_flow *flow,case RTE_FLOW_ACTION_TYPE_COUNT : fs->hitcnts =1 ;break ; +case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID : +case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN : +case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN :case RTE_FLOW_ACTION_TYPE_PHY_PORT :/* We allow multiple switch actions, but switch is * not compatible with either queue or drop
Signature · 1 line
2.14.1
PATCH 3/4 net/cxgbe: add API to program hardware MPS table
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add API to program and manage hardware Multi Port Switch table. MPS holds destination MAC addresses to be matched against incoming packets for further rule processing. Packets not matching any entry in MPS table will be dropped by default, unless the underlying port is in promiscuous mode.
--- drivers/net/cxgbe/Makefile | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/base/common.h | 6 + drivers/net/cxgbe/base/t4_hw.c | 106 ++++++++++++++ drivers/net/cxgbe/base/t4_regs.h | 8 ++ drivers/net/cxgbe/base/t4fw_interface.h | 24 ++++ drivers/net/cxgbe/cxgbe_main.c | 7 + drivers/net/cxgbe/meson.build | 1 + drivers/net/cxgbe/mps_tcam.c | 243 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/mps_tcam.h | 52 +++++++ 10 files changed, 449 insertions(+) create mode 100644 drivers/net/cxgbe/mps_tcam.c create mode 100644 drivers/net/cxgbe/mps_tcam.h
drivers/net/cxgbe/Makefile +1 -0
@@ -53,6 +53,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_filter.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_flow.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += t4_hw.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += clip_tbl.c +SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += mps_tcam.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += l2t.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += t4vf_hw.c
drivers/net/cxgbe/base/adapter.h +1 -0
@@ -328,6 +328,7 @@ struct adapter {unsigned int l2t_end;/* Layer 2 table end */ struct clip_tbl *clipt;/* CLIP table */ struct l2t_data *l2t;/* Layer 2 table */ +struct mpstcam_table *mpstcam;struct tid_info tids;/* Info used to access TID related tables */ };
drivers/net/cxgbe/base/common.h +6 -0
@@ -388,6 +388,12 @@ int t4_free_vi(struct adapter *adap, unsigned int mbox,int t4_set_rxmode (struct adapter *adap,unsigned int mbox,unsigned int viid,int mtu,int promisc,int all_multi,int bcast,int vlanex,bool sleep_ok); +int t4_free_raw_mac_filt (struct adapter *adap,unsigned int viid, +const u8 *addr,const u8 *mask,unsigned int idx, +u8 lookup_type,u8 port_id,bool sleep_ok); +int t4_alloc_raw_mac_filt (struct adapter *adap,unsigned int viid, +const u8 *addr,const u8 *mask,unsigned int idx, +u8 lookup_type,u8 port_id,bool sleep_ok);int t4_change_mac (struct adapter *adap,unsigned int mbox,unsigned int viid,int idx,const u8 *addr,bool persist,bool add_smt); int t4_enable_vi_params(struct adapter *adap, unsigned int mbox,
drivers/net/cxgbe/base/t4_hw.c +106 -0
112 lines not on this page · raw message
drivers/net/cxgbe/base/t4_regs.h +8 -0
@@ -45,6 +45,14 @@#define MPS_T5_CLS_SRAM_H (idx) (A_MPS_T5_CLS_SRAM_H + (idx) * 8)#define NUM_MPS_T5_CLS_SRAM_H_INSTANCES 512 +#define S_DATAPORTNUM 12 +#define M_DATAPORTNUM 0xfU +#define V_DATAPORTNUM (x) ((x) << S_DATAPORTNUM) + +#define S_DATALKPTYPE 10 +#define M_DATALKPTYPE 0x3U +#define V_DATALKPTYPE (x) ((x) << S_DATALKPTYPE) +/* registers for module SGE */ #define SGE_BASE_ADDR 0x1000
drivers/net/cxgbe/base/t4fw_interface.h +24 -0
@@ -1282,12 +1282,17 @@ struct fw_vi_cmd {/* Special VI_MAC command index ids */ #define FW_VI_MAC_ADD_MAC 0x3FF#define FW_VI_MAC_ADD_PERSIST_MAC 0x3FE +#define FW_VI_MAC_ID_BASED_FREE 0x3FCenum fw_vi_mac_smac {FW_VI_MAC_MPS_TCAM_ENTRY ,FW_VI_MAC_SMT_AND_MPSTCAM }; +enum fw_vi_mac_entry_types { +FW_VI_MAC_TYPE_RAW =0x2 , +}; +struct fw_vi_mac_cmd {__be32 op_to_viid;__be32 freemacs_to_len16;
@@ -1299,6 +1304,13 @@ struct fw_vi_mac_cmd {struct fw_vi_mac_hash {__be64 hashvec; } hash; +struct fw_vi_mac_raw { +__be32 raw_idx_pkd; +__be32 data0_pkd; +__be32 data1[2 ]; +__be64 data0m_pkd; +__be32 data1m[2 ]; + } raw; } u; };
@@ -1308,6 +1320,12 @@ struct fw_vi_mac_cmd {#define G_FW_VI_MAC_CMD_VIID (x) \ (((x) >> S_FW_VI_MAC_CMD_VIID) & M_FW_VI_MAC_CMD_VIID) +#define S_FW_VI_MAC_CMD_FREEMACS 31 +#define V_FW_VI_MAC_CMD_FREEMACS (x) ((x) << S_FW_VI_MAC_CMD_FREEMACS) + +#define S_FW_VI_MAC_CMD_ENTRY_TYPE 23 +#define V_FW_VI_MAC_CMD_ENTRY_TYPE (x) ((x) << S_FW_VI_MAC_CMD_ENTRY_TYPE) +#define S_FW_VI_MAC_CMD_VALID 15#define M_FW_VI_MAC_CMD_VALID 0x1#define V_FW_VI_MAC_CMD_VALID (x) ((x) << S_FW_VI_MAC_CMD_VALID)
@@ -1327,6 +1345,12 @@ struct fw_vi_mac_cmd {#define G_FW_VI_MAC_CMD_IDX (x) \ (((x) >> S_FW_VI_MAC_CMD_IDX) & M_FW_VI_MAC_CMD_IDX) +#define S_FW_VI_MAC_CMD_RAW_IDX 16 +#define M_FW_VI_MAC_CMD_RAW_IDX 0xffff +#define V_FW_VI_MAC_CMD_RAW_IDX (x) ((x) << S_FW_VI_MAC_CMD_RAW_IDX) +#define G_FW_VI_MAC_CMD_RAW_IDX (x) \ + (((x) >> S_FW_VI_MAC_CMD_RAW_IDX) & M_FW_VI_MAC_CMD_RAW_IDX) +struct fw_vi_rxmode_cmd {__be32 op_to_viid;__be32 retval_len16;
drivers/net/cxgbe/cxgbe_main.c +7 -0
@@ -39,6 +39,7 @@#include "cxgbe.h" #include "clip_tbl.h" #include "l2t.h" +#include "mps_tcam.h" /** * Allocate a chunk of memory. The allocated memory is cleared.
@@ -1689,6 +1690,7 @@ void cxgbe_close(struct adapter *adapter)if (adapter->flags &FULL_INIT_DONE ) {tid_free (&adapter->tids); +t4_cleanup_mpstcam (adapter);t4_cleanup_clip_tbl (adapter);t4_cleanup_l2t (adapter);if (is_pf4 (adapter))
@@ -1877,6 +1879,11 @@ int cxgbe_probe(struct adapter *adapter) "filter support disabled. Continuing\n"); } + adapter->mpstcam =t4_init_mpstcam (adapter); +if (!adapter->mpstcam) +dev_warn (adapter,"could not allocate mps tcam table." +" Continuing\n" ); +if (is_hashfilter (adapter)) {if (t4_read_reg (adapter,A_LE_DB_CONFIG ) &F_HASHEN ) {u32 hash_base, hash_reg;
drivers/net/cxgbe/meson.build +1 -0
@@ -9,6 +9,7 @@ sources = files('cxgbe_ethdev.c', 'cxgbe_filter.c', 'cxgbe_flow.c', 'clip_tbl.c', + 'mps_tcam.c', 'l2t.c', 'base/t4_hw.c', 'base/t4vf_hw.c')
drivers/net/cxgbe/mps_tcam.c new file +243 -0
243 lines not on this page · raw message
drivers/net/cxgbe/mps_tcam.h new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH 4/4 net/cxgbe: add flow operations to match based on destination MAC address
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add flow operations to match packets based on destination MAC address. Allocate and program hardware MPS table with the destination MAC address to be matched against. The returned MPS index is then used while offloading flows to LETCAM (maskfull) and HASH (maskless) filter regions.
Also update existing mac_addr_set() to use the new MPS table API.
--- doc/guides/rel_notes/release_18_11.rst | 1 + drivers/net/cxgbe/base/common.h | 1 + drivers/net/cxgbe/base/t4_hw.c | 2 ++ drivers/net/cxgbe/cxgbe_ethdev.c | 4 +-- drivers/net/cxgbe/cxgbe_filter.c | 9 +++-- drivers/net/cxgbe/cxgbe_filter.h | 1 + drivers/net/cxgbe/cxgbe_flow.c | 66 ++++++++++++++++++++++++++++++++-- drivers/net/cxgbe/cxgbe_flow.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 6 ++-- 9 files changed, 80 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_18_11.rst +1 -0
@@ -58,6 +58,7 @@ New Features Flow API support has been enhanced for CXGBE Poll Mode Driver to offload: + * Match items: destination MAC address. * Action items: push/pop/rewrite vlan header.
drivers/net/cxgbe/base/common.h +1 -0
@@ -157,6 +157,7 @@ struct tp_params {int port_shift;int protocol_shift;int ethertype_shift; +int macmatch_shift;u64 hash_filter_mask; };
drivers/net/cxgbe/base/t4_hw.c +2 -0
@@ -5251,6 +5251,8 @@ int t4_init_tp_params(struct adapter *adap) F_PROTOCOL); adap->params.tp.ethertype_shift =t4_filter_field_shift (adap,F_ETHERTYPE ); + adap->params.tp.macmatch_shift =t4_filter_field_shift (adap, +F_MACMATCH );/* * If TP_INGRESS_CONFIG.VNID == 0, then TP_VLAN_PRI_MAP.VNIC_ID
drivers/net/cxgbe/cxgbe_ethdev.c +1 -3
@@ -1075,11 +1075,9 @@ static int cxgbe_get_regs(struct rte_eth_dev *eth_dev,int cxgbe_mac_addr_set (struct rte_eth_dev *dev,struct ether_addr *addr) {struct port_info *pi = (struct port_info *)(dev->data->dev_private); -struct adapter *adapter = pi->adapter;int ret; - ret =t4_change_mac (adapter, adapter->mbox, pi->viid, - pi->xact_addr_filt, (u8 *)addr, true, true); + ret =cxgbe_mpstcam_modify (pi, (int )pi->xact_addr_filt, (u8 *)addr);if (ret <0 ) {dev_err (adapter,"failed to set mac addr; err = %d\n" , ret);
drivers/net/cxgbe/cxgbe_filter.c +7 -2
@@ -66,7 +66,8 @@ int validate_filter(struct adapter *adapter, struct ch_filter_specification *fs)#define U (_mask, _field) \ (!(fconf & (_mask)) && S(_field)) -if (U (F_PORT , iport) ||U (F_ETHERTYPE , ethtype) ||U (F_PROTOCOL , proto)) +if (U (F_PORT , iport) ||U (F_ETHERTYPE , ethtype) || +U (F_PROTOCOL , proto) ||U (F_MACMATCH , macidx))return -EOPNOTSUPP ;#undef S
@@ -268,6 +269,8 @@ static u64 hash_filter_ntuple(const struct filter_entry *f)if (tp->ethertype_shift >=0 && f->fs.mask.ethtype) ntuple |= (u64)(f->fs.val.ethtype) << tp->ethertype_shift; +if (tp->macmatch_shift >=0 && f->fs.mask.macidx) + ntuple |= (u64)(f->fs.val.macidx) << tp->macmatch_shift;if (ntuple != tp->hash_filter_mask)return 0 ;
@@ -744,7 +747,9 @@ int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)V_FW_FILTER_WR_RX_RPL_IQ (adapter->sge.fw_evtq.abs_id )); fwr->maci_to_matchtypem = -cpu_to_be32 (V_FW_FILTER_WR_PORT (f->fs.val.iport) | +cpu_to_be32 (V_FW_FILTER_WR_MACI (f->fs.val.macidx) | +V_FW_FILTER_WR_MACIM (f->fs.mask.macidx) | +V_FW_FILTER_WR_PORT (f->fs.val.iport) |V_FW_FILTER_WR_PORTM (f->fs.mask.iport)); fwr->ptcl = f->fs.val.proto; fwr->ptclm = f->fs.mask.proto;
drivers/net/cxgbe/cxgbe_filter.h +1 -0
@@ -77,6 +77,7 @@ struct ch_filter_tuple {* Filter specification */ struct ch_filter_specification { +void *private;/* Administrative fields for filter. */ uint32_t hitcnts:1 ;/* count filter hits in TCB */ uint32_t prio:1 ;/* filter has priority over active/server */
drivers/net/cxgbe/cxgbe_flow.c +64 -2
102 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_flow.h +1 -0
@@ -7,6 +7,7 @@#include <rte_flow_driver.h> #include "cxgbe_filter.h" +#include "mps_tcam.h" #include "cxgbe.h" #define CXGBE_FLOW_POLL_US 10
drivers/net/cxgbe/cxgbe_main.c +2 -4
@@ -1342,10 +1342,8 @@ int link_start(struct port_info *pi) ret =t4_set_rxmode (adapter, adapter->mbox, pi->viid, mtu,-1 ,-1 ,-1 ,1 , true);if (ret ==0 ) { - ret =t4_change_mac (adapter, adapter->mbox, pi->viid, - pi->xact_addr_filt, - (u8 *)&pi->eth_dev->data->mac_addrs[0 ], - true, true); + ret =cxgbe_mpstcam_modify (pi, (int )pi->xact_addr_filt, + (u8 *)&pi->eth_dev->data->mac_addrs[0 ]);if (ret >=0 ) { pi->xact_addr_filt = ret; ret =0 ;
Signature · 1 line
2.14.1
Quoted 17 lines · Rahul Lakkireddy
This series of patches add support to offload flows with destination MAC match item and VLAN push/pop/rewrite actions.
Patch 1 adds API to program and manage hardware Layer 2 Table (L2T). L2T holds destination node information to be used for VLAN rewrite.
Patch 2 implements offloading VLAN push/pop/rewrite actions.
Patch 3 adds API to program and manage hardware Multi Port Switch (MPS) table. MPS holds the destination MAC addresses to be matched against incoming packets.
Patch 4 implements offloading destination MAC match item.
Thanks,
Rahul
Quoted 6 lines
Shagun Agrawal (4):
net/cxgbe: add API to program hardware layer 2 table net/cxgbe: add flow operations to offload vlan actions net/cxgbe: add API to program hardware MPS table net/cxgbe: add flow operations to match based on destination MAC
address
Series applied to dpdk-next-net/master, thanks.