net/cxgbe: add support for offloading flows to HASH region
cover net/cxgbe: add support for offloading flows to HASH region
This series of patches add support to offload flows to HASH region available on Chelsio T6 NICs. HASH region can only offload exact match (maskless) flows and hence the masks must be all set for all match items.
Patch 1 queries firmware for HASH filter support.
Patch 2 updates cxgbe_flow to decide whether to place flows in LE-TCAM or HASH region based on supported hardware configuration and masks of match items.
Patch 3 adds Compressed Local IP (CLIP) region support for offloading IPv6 flows in HASH region. Also updates LE-TCAM region to use CLIP for offloading IPv6 flows on Chelsio T6 NICs.
Patch 4 adds support for offloading flows to HASH region.
Patch 5 adds support for deleting flows in HASH region.
Patch 6 adds support to query hit and byte counters for offloaded flows in HASH region.
Patch 7 adds support to flush filters in HASH region.
Patch 8 adds support to match flows based on physical ingress port.
Patch 9 adds support to redirect packets matching flows to specified physical egress port without sending them to host.
Thanks,
Rahul
Shagun Agrawal (9):
net/cxgbe: query firmware for HASH filter resources net/cxgbe: validate flows offloaded to HASH region net/cxgbe: add Compressed Local IP region
net/cxgbe: add support to offload flows to HASH region net/cxgbe: add support to delete flows in HASH region net/cxgbe: add support to query hit counters for flows in HASH region net/cxgbe: add support to flush flows in HASH region net/cxgbe: add support to match on ingress physical port net/cxgbe: add support to redirect packets to egress physical port
drivers/net/cxgbe/Makefile | 1 + drivers/net/cxgbe/base/adapter.h | 43 ++ drivers/net/cxgbe/base/common.h | 10 + drivers/net/cxgbe/base/t4_hw.c | 7 + drivers/net/cxgbe/base/t4_msg.h | 188 +++++++++ drivers/net/cxgbe/base/t4_regs.h | 12 + drivers/net/cxgbe/base/t4_tcb.h | 26 ++ drivers/net/cxgbe/base/t4fw_interface.h | 31 ++ drivers/net/cxgbe/clip_tbl.c | 195 +++++++++ drivers/net/cxgbe/clip_tbl.h | 31 ++ drivers/net/cxgbe/cxgbe_compat.h | 12 + drivers/net/cxgbe/cxgbe_filter.c | 697 ++++++++++++++++++++++++++++++-- drivers/net/cxgbe/cxgbe_filter.h | 13 +- drivers/net/cxgbe/cxgbe_flow.c | 151 ++++++- drivers/net/cxgbe/cxgbe_main.c | 170 +++++++- drivers/net/cxgbe/cxgbe_ofld.h | 66 ++- 16 files changed, 1614 insertions(+), 39 deletions(-) create mode 100644 drivers/net/cxgbe/base/t4_tcb.h create mode 100644 drivers/net/cxgbe/clip_tbl.c create mode 100644 drivers/net/cxgbe/clip_tbl.h
Signature · 1 line
2.14.1
PATCH 1/9 net/cxgbe: query firmware for HASH filter resources
From: Shagun Agrawal <[email protected]>
Fetch available HASH filter resources and allocate table for managing them. Currently only supported on Chelsio T6 family of NICs.
--- drivers/net/cxgbe/base/common.h | 7 ++++++ drivers/net/cxgbe/base/t4_regs.h | 9 ++++++++ drivers/net/cxgbe/cxgbe_compat.h | 12 ++++++++++ drivers/net/cxgbe/cxgbe_filter.c | 38 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_filter.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 47 ++++++++++++++++++++++++++++++++++++---- drivers/net/cxgbe/cxgbe_ofld.h | 26 ++++++++++++++++++++-- 7 files changed, 134 insertions(+), 6 deletions(-)
drivers/net/cxgbe/base/common.h +7 -0
@@ -251,6 +251,8 @@ struct adapter_params {unsigned char nports;/* # of ethernet ports */ unsigned char portvec; +unsigned char hash_filter; +enum chip_type chip;/* chip code */ struct arch_specific_params arch;/* chip specific params */
@@ -314,6 +316,11 @@ static inline int is_pf4(struct adapter *adap)#define for_each_port (adapter, iter) \ for (iter = 0; iter < (adapter)->params.nports; ++iter) +static inline int is_hashfilter (const struct adapter *adap) +{ +return adap->params.hash_filter; +} +void t4_read_mtu_tbl (struct adapter *adap,u16 *mtus,u8 *mtu_log);void t4_tp_wr_bits_indirect (struct adapter *adap,unsigned int addr,unsigned int mask,unsigned int val);
drivers/net/cxgbe/base/t4_regs.h +9 -0
@@ -937,3 +937,12 @@#define M_REV 0xfU#define V_REV (x) ((x) << S_REV)#define G_REV (x) (((x) >> S_REV) & M_REV) + +/* registers for module LE */ +#define A_LE_DB_CONFIG 0x19c04 + +#define S_HASHEN 20 +#define V_HASHEN (x) ((x) << S_HASHEN) +#define F_HASHEN V_HASHEN(1U) + +#define A_LE_DB_TID_HASHBASE 0x19df8
drivers/net/cxgbe/cxgbe_compat.h +12 -0
@@ -250,4 +250,16 @@ static inline void writel_relaxed(unsigned int val, volatile void __iomem *addr) rte_write32_relaxed(val, addr); } +/* +* Multiplies an integer by a fraction, while avoiding unnecessary +* overflow or loss of precision. +*/ +#define mult_frac (x, numer, denom)( \ +{ \ + typeof(x) quot = (x) / (denom); \ + typeof(x) rem = (x) % (denom); \ + (quot * (numer)) + ((rem * (numer)) / (denom)); \ +} \ +) +#endif /* _CXGBE_COMPAT_H_ */
drivers/net/cxgbe/cxgbe_filter.c +38 -0
@@ -7,6 +7,44 @@#include "t4_regs.h" #include "cxgbe_filter.h" +/** +* Initialize Hash Filters +*/ +int init_hash_filter (struct adapter *adap) +{ +unsigned int n_user_filters; +unsigned int user_filter_perc; +int ret; +u32 params[7 ], val[7 ]; + +#define FW_PARAM_DEV (param) \ + (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \ + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param)) + +#define FW_PARAM_PFVF (param) \ + (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \ + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param) | \ + V_FW_PARAMS_PARAM_Y(0) | \ + V_FW_PARAMS_PARAM_Z(0)) + + params[0 ] =FW_PARAM_DEV (NTID ); + ret =t4_query_params (adap, adap->mbox, adap->pf,0 ,1 , + params, val); +if (ret <0 ) +return ret; + adap->tids.ntids = val[0 ]; + adap->tids.natids =min (adap->tids.ntids /2 ,MAX_ATIDS ); + + user_filter_perc =100 ; + n_user_filters =mult_frac (adap->tids.nftids, + user_filter_perc, +100 ); + + adap->tids.nftids = n_user_filters; + adap->params.hash_filter =1 ; +return 0 ; +} +/** * Validate if the requested filter specification can be set by checking * if the requested features have been enabled
drivers/net/cxgbe/cxgbe_filter.h +1 -0
@@ -220,6 +220,7 @@ int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id,struct ch_filter_specification *fs, struct filter_ctx *ctx);int cxgbe_alloc_ftid (struct adapter *adap,unsigned int family); +int init_hash_filter (struct adapter *adap);int validate_filter (struct adapter *adap,struct ch_filter_specification *fs);int cxgbe_get_filter_count (struct adapter *adapter,unsigned int fidx,u64 *c,bool get_byte);
drivers/net/cxgbe/cxgbe_main.c +43 -4
93 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_ofld.h +24 -2
@@ -10,6 +10,16 @@#include "cxgbe_filter.h" +/* +* Max # of ATIDs. The absolute HW max is 16K but we keep it lower. +*/ +#define MAX_ATIDS 8192U + +union aopen_entry { +void *data; +union aopen_entry *next; +}; +/* * Holds the size, base address, free list start, etc of filter TID. * The tables themselves are allocated dynamically.
@@ -18,10 +28,22 @@ struct tid_info {void **tid_tab;unsigned int ntids;struct filter_entry *ftid_tab;/* Normal filters */ +union aopen_entry *atid_tab;struct rte_bitmap *ftid_bmap;uint8_t *ftid_bmap_array; -unsigned int nftids; -unsigned int ftid_base; +unsigned int nftids, natids; +unsigned int ftid_base, hash_base; + +union aopen_entry *afree; +unsigned int atids_in_use; + +/* TIDs in the TCAM */ +rte_atomic32_t tids_in_use; +/* TIDs in the HASH */ +rte_atomic32_t hash_tids_in_use; +rte_atomic32_t conns_in_use; + + rte_spinlock_t atid_lock __rte_cache_aligned; rte_spinlock_t ftid_lock; };#endif /* _CXGBE_OFLD_H_ */
Signature · 1 line
2.14.1
PATCH 2/9 net/cxgbe: validate flows offloaded to HASH region
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Fetch supported match items in HASH region. Ensure the mask is all set for all the supported match items to be offloaded to HASH region. Otherwise, offload them to LE-TCAM region.
--- drivers/net/cxgbe/base/common.h | 3 +++ drivers/net/cxgbe/base/t4_hw.c | 7 +++++ drivers/net/cxgbe/base/t4_regs.h | 3 +++ drivers/net/cxgbe/cxgbe_filter.h | 1 + drivers/net/cxgbe/cxgbe_flow.c | 57 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+)
drivers/net/cxgbe/base/common.h +3 -0
@@ -156,6 +156,9 @@ struct tp_params {int vnic_shift;int port_shift;int protocol_shift; +int ethertype_shift; + +u64 hash_filter_mask; };struct vpd_params {
drivers/net/cxgbe/base/t4_hw.c +7 -0
@@ -5032,6 +5032,8 @@ int t4_init_tp_params(struct adapter *adap) adap->params.tp.port_shift =t4_filter_field_shift (adap,F_PORT ); adap->params.tp.protocol_shift =t4_filter_field_shift (adap,F_PROTOCOL ); + adap->params.tp.ethertype_shift =t4_filter_field_shift (adap, +F_ETHERTYPE );/* * If TP_INGRESS_CONFIG.VNID == 0, then TP_VLAN_PRI_MAP.VNIC_ID
@@ -5040,6 +5042,11 @@ int t4_init_tp_params(struct adapter *adap)if ((adap->params.tp.ingress_config &F_VNIC ) ==0 ) adap->params.tp.vnic_shift =-1 ; + v =t4_read_reg (adap,LE_3_DB_HASH_MASK_GEN_IPV4_T6_A ); + adap->params.tp.hash_filter_mask = v; + v =t4_read_reg (adap,LE_4_DB_HASH_MASK_GEN_IPV4_T6_A ); + adap->params.tp.hash_filter_mask |= ((u64 )v <<32 ); +return 0 ; }
drivers/net/cxgbe/base/t4_regs.h +3 -0
@@ -946,3 +946,6 @@#define F_HASHEN V_HASHEN(1U)#define A_LE_DB_TID_HASHBASE 0x19df8 + +#define LE_3_DB_HASH_MASK_GEN_IPV4_T6_A 0x19eac +#define LE_4_DB_HASH_MASK_GEN_IPV4_T6_A 0x19eb0
drivers/net/cxgbe/cxgbe_filter.h +1 -0
@@ -86,6 +86,7 @@ struct ch_filter_specification {* matching that doesn't exist as a (value, mask) tuple. */ uint32_t type:1; /* 0 => IPv4, 1 => IPv6 */ + uint32_t cap:1; /* 0 => LE-TCAM, 1 => Hash *//* * Packet dispatch information. Ingress packets which match the
drivers/net/cxgbe/cxgbe_flow.c +57 -0
81 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH 3/9 net/cxgbe: add Compressed Local IP region
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
CLIP region holds destination IPv6 addresses to be matched for corresponding flows. Query firmware for CLIP resources and allocate table to manage them. Also update LE-TCAM to use CLIP to reduce number of slots needed to offload IPv6 flows.
--- drivers/net/cxgbe/Makefile | 1 + drivers/net/cxgbe/base/adapter.h | 32 ++++++ drivers/net/cxgbe/base/t4fw_interface.h | 19 ++++ drivers/net/cxgbe/clip_tbl.c | 195 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/clip_tbl.h | 31 +++++ drivers/net/cxgbe/cxgbe_filter.c | 99 ++++++++++++---- drivers/net/cxgbe/cxgbe_filter.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 19 ++++ 8 files changed, 377 insertions(+), 20 deletions(-) create mode 100644 drivers/net/cxgbe/clip_tbl.c create mode 100644 drivers/net/cxgbe/clip_tbl.h
drivers/net/cxgbe/Makefile +1 -0
@@ -52,6 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += sge.c 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) += t4vf_hw.c include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/cxgbe/base/adapter.h +32 -0
@@ -11,6 +11,7 @@#include <rte_bus_pci.h> #include <rte_mbuf.h> #include <rte_io.h> +#include <rte_rwlock.h> #include <rte_ethdev.h> #include "cxgbe_compat.h"
@@ -321,9 +322,40 @@ struct adapter {int use_unpacked_mode;/* unpacked rx mode state */ rte_spinlock_t win0_lock; +unsigned int clipt_start;/* CLIP table start */ +unsigned int clipt_end;/* CLIP table end */ +struct clip_tbl *clipt;/* CLIP table */ +struct tid_info tids;/* Info used to access TID related tables */ }; +/** +* t4_os_rwlock_init - initialize rwlock +* @lock: the rwlock +*/ +static inline void t4_os_rwlock_init (rte_rwlock_t *lock) +{ +rte_rwlock_init (lock); +} + +/** +* t4_os_write_lock - get a write lock +* @lock: the rwlock +*/ +static inline void t4_os_write_lock (rte_rwlock_t *lock) +{ +rte_rwlock_write_lock (lock); +} + +/** +* t4_os_write_unlock - unlock a write lock +* @lock: the rwlock +*/ +static inline void t4_os_write_unlock (rte_rwlock_t *lock) +{ +rte_rwlock_write_unlock (lock); +} +/** * ethdev2pinfo - return the port_info structure associated with a rte_eth_dev * @dev: the rte_eth_dev
drivers/net/cxgbe/base/t4fw_interface.h +19 -0
@@ -333,6 +333,7 @@ enum fw_cmd_opcodes {FW_RSS_IND_TBL_CMD =0x20 ,FW_RSS_GLB_CONFIG_CMD =0x22 ,FW_RSS_VI_CONFIG_CMD =0x23 , +FW_CLIP_CMD =0x28 , FW_DEBUG_CMD = 0x81, };
@@ -648,6 +649,8 @@ enum fw_params_param_dev {* physical and virtual function parameters */ enum fw_params_param_pfvf { +FW_PARAMS_PARAM_PFVF_CLIP_START =0x03 , +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_CPLFW4MSG_ENCAP =0x31 ,
@@ -2167,6 +2170,22 @@ struct fw_rss_vi_config_cmd { (((x) >> S_FW_RSS_VI_CONFIG_CMD_UDPEN) & M_FW_RSS_VI_CONFIG_CMD_UDPEN)#define F_FW_RSS_VI_CONFIG_CMD_UDPEN V_FW_RSS_VI_CONFIG_CMD_UDPEN(1U) +struct fw_clip_cmd { +__be32 op_to_write; +__be32 alloc_to_len16; +__be64 ip_hi; +__be64 ip_lo; +__be32 r4[2 ]; +}; + +#define S_FW_CLIP_CMD_ALLOC 31 +#define V_FW_CLIP_CMD_ALLOC (x) ((x) << S_FW_CLIP_CMD_ALLOC) +#define F_FW_CLIP_CMD_ALLOC V_FW_CLIP_CMD_ALLOC(1U) + +#define S_FW_CLIP_CMD_FREE 30 +#define V_FW_CLIP_CMD_FREE (x) ((x) << S_FW_CLIP_CMD_FREE) +#define F_FW_CLIP_CMD_FREE V_FW_CLIP_CMD_FREE(1U) +/****************************************************************************** * D E B U G C O M M A N D s ******************************************************/
drivers/net/cxgbe/clip_tbl.c new file +195 -0
195 lines not on this page · raw message
drivers/net/cxgbe/clip_tbl.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018 Chelsio Communications. +* All rights reserved. +*/ + +#ifndef _CXGBE_CLIP_H_ +#define _CXGBE_CLIP_H_ + +/* +* State for the corresponding entry of the HW CLIP table. +*/ +struct clip_entry { +enum filter_type type;/* entry type */ +u32 addr[4 ];/* IPV4 or IPV6 address */ +rte_spinlock_t lock;/* entry lock */ +rte_atomic32_t refcnt;/* entry reference count */ +}; + +struct clip_tbl { +unsigned int clipt_start;/* start index of CLIP table */ +unsigned int clipt_size;/* size of CLIP table */ +rte_rwlock_t lock;/* table rw lock */ +struct clip_entry cl_list[0 ];/* MUST BE LAST */ +}; + +struct clip_tbl *t4_init_clip_tbl (unsigned int clipt_start, +unsigned int clipt_end); +void t4_cleanup_clip_tbl (struct adapter *adap); +struct clip_entry *cxgbe_clip_alloc (struct rte_eth_dev *dev,u32 *lip); +void cxgbe_clip_release (struct rte_eth_dev *dev,struct clip_entry *ce); +#endif /* _CXGBE_CLIP_H_ */
drivers/net/cxgbe/cxgbe_filter.c +79 -20
176 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_filter.h +1 -0
@@ -141,6 +141,7 @@ struct filter_entry { u32 locked:1; /* filter is administratively locked */ 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 rte_eth_dev *dev;/* Port's rte eth device */ void *private;/* For use by apps using filter_entry */
drivers/net/cxgbe/cxgbe_main.c +19 -0
@@ -37,6 +37,7 @@#include "t4_regs.h" #include "t4_msg.h" #include "cxgbe.h" +#include "clip_tbl.h" /** * Allocate a chunk of memory. The allocated memory is cleared.
@@ -995,6 +996,14 @@ static int adap_init0(struct adapter *adap) adap->tids.ftid_base = val[0 ]; adap->tids.nftids = val[1 ] - val[0 ] +1 ; + params[0 ] =FW_PARAM_PFVF (CLIP_START ); + params[1 ] =FW_PARAM_PFVF (CLIP_END ); + ret =t4_query_params (adap, adap->mbox, adap->pf,0 ,2 , params, val); +if (ret <0 ) + goto bye; + adap->clipt_start = val[0 ]; + adap->clipt_end = val[1 ]; +/* * Get device capabilities so we can determine what resources we need * to manage.
@@ -1509,6 +1518,7 @@ void cxgbe_close(struct adapter *adapter)if (is_pf4 (adapter))t4_intr_disable (adapter);tid_free (&adapter->tids); +t4_cleanup_clip_tbl (adapter);t4_sge_tx_monitor_stop (adapter);t4_free_sge_resources (adapter);for_each_port (adapter, i) {
@@ -1672,6 +1682,15 @@ int cxgbe_probe(struct adapter *adapter)print_adapter_info (adapter);print_port_info (adapter); + adapter->clipt =t4_init_clip_tbl (adapter->clipt_start, + adapter->clipt_end); +if (!adapter->clipt) { +/* We tolerate a lack of clip_table, giving up some +* functionality +*/ +dev_warn (adapter,"could not allocate CLIP. Continuing\n" ); + } +if (tid_init (&adapter->tids) <0 ) {/* Disable filtering support */ dev_warn(adapter, "could not allocate TID table, "
Signature · 1 line
2.14.1
Re: [PATCH 3/9] net/cxgbe: add Compressed Local IP region
Quoted 7 lines · Rahul Lakkireddy
From: Shagun Agrawal <[email protected]>
CLIP region holds destination IPv6 addresses to be matched for corresponding flows. Query firmware for CLIP resources and allocate table to manage them. Also update LE-TCAM to use CLIP to reduce number of slots needed to offload IPv6 flows.
Quoted 7 lines
Signed-off-by Shagun Agrawal <[email protected]>Signed-off-by Rahul Lakkireddy <[email protected]>--- drivers/net/cxgbe/Makefile | 1 + drivers/net/cxgbe/base/adapter.h | 32 ++++++ drivers/net/cxgbe/base/t4fw_interface.h | 19 ++++ drivers/net/cxgbe/clip_tbl.c | 195 ++++++++++++++++++++++++++++++++
This breaks the meson build, new added file 'clip_tbl.c' needs to be added meson.build, if this is the only issue I can fix while applying.
Quoted 7 lines
drivers/net/cxgbe/clip_tbl.h | 31 +++++ drivers/net/cxgbe/cxgbe_filter.c | 99 ++++++++++++---- drivers/net/cxgbe/cxgbe_filter.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 19 ++++ 8 files changed, 377 insertions(+), 20 deletions(-) create mode 100644 drivers/net/cxgbe/clip_tbl.c create mode 100644 drivers/net/cxgbe/clip_tbl.h
PATCH 4/9 net/cxgbe: add support to offload flows to HASH region
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add interface to offload flows to HASH region. Translate internal filter specification to requests to offload flows to HASH region. Save the returned hash index of the offloaded flow for deletion later.
--- drivers/net/cxgbe/base/adapter.h | 11 ++ drivers/net/cxgbe/base/t4_msg.h | 110 +++++++++++++ drivers/net/cxgbe/base/t4fw_interface.h | 6 + drivers/net/cxgbe/cxgbe_filter.c | 265 +++++++++++++++++++++++++++++++- drivers/net/cxgbe/cxgbe_filter.h | 1 + drivers/net/cxgbe/cxgbe_flow.c | 10 +- drivers/net/cxgbe/cxgbe_main.c | 56 +++++++ drivers/net/cxgbe/cxgbe_ofld.h | 25 +++ 8 files changed, 481 insertions(+), 3 deletions(-)
drivers/net/cxgbe/base/adapter.h +11 -0
@@ -771,6 +771,17 @@ static inline void t4_complete(struct t4_completion *c)t4_os_unlock (&c->lock); } +/** +* cxgbe_port_viid - get the VI id of a port +* @dev: the device for the port +* +* Return the VI id of the given port. +*/ +static inline unsigned int cxgbe_port_viid (const struct rte_eth_dev *dev) +{ +return ethdev2pinfo (dev)->viid; +} +void *t4_alloc_mem (size_t size);void t4_free_mem (void *addr);#define t4_os_alloc (_size) t4_alloc_mem((_size))
drivers/net/cxgbe/base/t4_msg.h +110 -0
142 lines not on this page · raw message
drivers/net/cxgbe/base/t4fw_interface.h +6 -0
@@ -55,6 +55,7 @@ enum fw_memtype {enum fw_wr_opcodes {FW_FILTER_WR =0x02 , +FW_TP_WR =0x05 ,FW_ETH_TX_PKT_WR =0x08 ,FW_ETH_TX_PKTS_WR =0x09 ,FW_ETH_TX_PKT_VM_WR =0x11 ,
@@ -93,6 +94,11 @@ struct fw_wr_hdr {#define G_FW_WR_EQUEQ (x) (((x) >> S_FW_WR_EQUEQ) & M_FW_WR_EQUEQ)#define F_FW_WR_EQUEQ V_FW_WR_EQUEQ(1U) +/* flow context identifier (lo) +*/ +#define S_FW_WR_FLOWID 8 +#define V_FW_WR_FLOWID (x) ((x) << S_FW_WR_FLOWID) +/* length in units of 16-bytes (lo) */ #define S_FW_WR_LEN16 0
drivers/net/cxgbe/cxgbe_filter.c +264 -1
289 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_filter.h +1 -0
@@ -223,6 +223,7 @@ int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id, struct filter_ctx *ctx);int cxgbe_alloc_ftid (struct adapter *adap,unsigned int family);int init_hash_filter (struct adapter *adap); +void hash_filter_rpl (struct adapter *adap,const struct cpl_act_open_rpl *rpl);int validate_filter (struct adapter *adap,struct ch_filter_specification *fs);int cxgbe_get_filter_count (struct adapter *adapter,unsigned int fidx,u64 *c,bool get_byte);
drivers/net/cxgbe/cxgbe_flow.c +8 -2
@@ -452,6 +452,7 @@ static int __cxgbe_flow_create(struct rte_eth_dev *dev, struct rte_flow *flow) {struct ch_filter_specification *fs = &flow->fs;struct adapter *adap =ethdev2adap (dev); +struct tid_info *t = &adap->tids;struct filter_ctx ctx;unsigned int fidx;int err;
@@ -484,8 +485,13 @@ static int __cxgbe_flow_create(struct rte_eth_dev *dev, struct rte_flow *flow)return ctx.result; } - flow->fidx = fidx; - flow->f = &adap->tids.ftid_tab[fidx]; +if (fs->cap) {/* to destroy the filter */ + flow->fidx = ctx.tid; + flow->f =lookup_tid (t, ctx.tid); + }else { + flow->fidx = fidx; + flow->f = &adap->tids.ftid_tab[fidx]; + }return 0 ; }
drivers/net/cxgbe/cxgbe_main.c +56 -0
68 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_ofld.h +25 -0
@@ -10,6 +10,15 @@#include "cxgbe_filter.h" +#define INIT_TP_WR (w, tid) do { \ + (w)->wr.wr_hi = cpu_to_be32(V_FW_WR_OP(FW_TP_WR) | \ + V_FW_WR_IMMDLEN(sizeof(*w) - sizeof(w->wr))); \ + (w)->wr.wr_mid = cpu_to_be32( \ + V_FW_WR_LEN16(DIV_ROUND_UP(sizeof(*w), 16)) | \ + V_FW_WR_FLOWID(tid)); \ + (w)->wr.wr_lo = cpu_to_be64(0); \ +} while (0) +/* * Max # of ATIDs. The absolute HW max is 16K but we keep it lower. */
@@ -46,4 +55,20 @@ struct tid_info { rte_spinlock_t atid_lock __rte_cache_aligned; rte_spinlock_t ftid_lock; }; + +static inline void *lookup_tid (const struct tid_info *t,unsigned int tid) +{ +return tid < t->ntids ? t->tid_tab[tid] :NULL ; +} + +static inline void *lookup_atid (const struct tid_info *t,unsigned int atid) +{ +return atid < t->natids ? t->atid_tab[atid].data :NULL ; +} + +int cxgbe_alloc_atid (struct tid_info *t,void *data); +void cxgbe_free_atid (struct tid_info *t,unsigned int atid); +void cxgbe_insert_tid (struct tid_info *t,void *data,unsigned int tid, +unsigned short family); +#endif /* _CXGBE_OFLD_H_ */
Signature · 1 line
2.14.1
PATCH 5/9 net/cxgbe: add support to delete flows in HASH region
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add interface to delete offloaded flows in HASH region. Use the hash index saved during insertion to delete the corresponding flow.
--- drivers/net/cxgbe/base/t4_msg.h | 72 ++++++++++++ drivers/net/cxgbe/base/t4_tcb.h | 15 +++ drivers/net/cxgbe/base/t4fw_interface.h | 6 + drivers/net/cxgbe/cxgbe_filter.c | 193 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_filter.h | 2 + drivers/net/cxgbe/cxgbe_main.c | 48 ++++++++ drivers/net/cxgbe/cxgbe_ofld.h | 15 +++ 7 files changed, 351 insertions(+) create mode 100644 drivers/net/cxgbe/base/t4_tcb.h
drivers/net/cxgbe/base/t4_msg.h +72 -0
@@ -8,7 +8,12 @@enum {CPL_ACT_OPEN_REQ =0x3 , +CPL_SET_TCB_FIELD =0x5 , +CPL_ABORT_REQ =0xA , +CPL_ABORT_RPL =0xB , +CPL_TID_RELEASE =0x1A ,CPL_ACT_OPEN_RPL =0x25 , +CPL_ABORT_RPL_RSS =0x2D ,CPL_SET_TCB_RPL =0x3A ,CPL_ACT_OPEN_REQ6 =0x83 ,CPL_SGE_EGR_UPDATE =0xA5 ,
@@ -27,6 +32,11 @@ enum { ULP_MODE_NONE = 0, }; +enum { +CPL_ABORT_SEND_RST =0 , +CPL_ABORT_NO_RST , +}; +enum {/* TX_PKT_XT checksum types */ TX_CSUM_TCPIP =8 ,TX_CSUM_UDPIP =9 ,
@@ -189,6 +199,29 @@ struct cpl_act_open_rpl {#define M_AOPEN_ATID 0xFFFFFF#define G_AOPEN_ATID (x) (((x) >> S_AOPEN_ATID) & M_AOPEN_ATID) +struct cpl_set_tcb_field { +WR_HDR ; +union opcode_tid ot; +__be16 reply_ctrl; +__be16 word_cookie; +__be64 mask; +__be64 val; +}; + +/* cpl_set_tcb_field.word_cookie fields */ +#define S_WORD 0 +#define V_WORD (x) ((x) << S_WORD) + +/* cpl_get_tcb.reply_ctrl fields */ +#define S_QUEUENO 0 +#define V_QUEUENO (x) ((x) << S_QUEUENO) + +#define S_REPLY_CHAN 14 +#define V_REPLY_CHAN (x) ((x) << S_REPLY_CHAN) + +#define S_NO_REPLY 15 +#define V_NO_REPLY (x) ((x) << S_NO_REPLY) +struct cpl_set_tcb_rpl {RSS_HDR union opcode_tid ot;
@@ -198,6 +231,39 @@ struct cpl_set_tcb_rpl {__be64 oldval; }; +/* cpl_abort_req status command code +*/ +struct cpl_abort_req { +WR_HDR ; +union opcode_tid ot; +__be32 rsvd0; +__u8 rsvd1; +__u8 cmd; +__u8 rsvd2[6 ]; +}; + +struct cpl_abort_rpl_rss { +RSS_HDR + union opcode_tid ot; +__u8 rsvd[3 ]; +__u8 status; +}; + +struct cpl_abort_rpl { +WR_HDR ; +union opcode_tid ot; +__be32 rsvd0; +__u8 rsvd1; +__u8 cmd; +__u8 rsvd2[6 ]; +}; + +struct cpl_tid_release { +WR_HDR ; +union opcode_tid ot; +__be32 rsvd; +}; +struct cpl_tx_data {union opcode_tid ot;__be32 len;
@@ -403,7 +469,13 @@ struct cpl_fw6_msg {__be64 data[4 ]; }; +/* ULP_TX opcodes */ +enum { +ULP_TX_PKT =4 +}; +enum { +ULP_TX_SC_NOOP =0x80 ,ULP_TX_SC_IMM =0x81 ,ULP_TX_SC_DSGL =0x82 ,ULP_TX_SC_ISGL =0x83
drivers/net/cxgbe/base/t4_tcb.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018 Chelsio Communications. +* All rights reserved. +*/ + +#ifndef _T4_TCB_DEFS_H +#define _T4_TCB_DEFS_H + +/* 105:96 */ +#define W_TCB_RSS_INFO 3 +#define S_TCB_RSS_INFO 0 +#define M_TCB_RSS_INFO 0x3ffULL +#define V_TCB_RSS_INFO (x) ((x) << S_TCB_RSS_INFO) + +#endif /* _T4_TCB_DEFS_H */
drivers/net/cxgbe/base/t4fw_interface.h +6 -0
@@ -55,6 +55,7 @@ enum fw_memtype {enum fw_wr_opcodes {FW_FILTER_WR =0x02 , +FW_ULPTX_WR =0x04 ,FW_TP_WR =0x05 ,FW_ETH_TX_PKT_WR =0x08 ,FW_ETH_TX_PKTS_WR =0x09 ,
@@ -78,6 +79,11 @@ struct fw_wr_hdr {#define V_FW_WR_OP (x) ((x) << S_FW_WR_OP)#define G_FW_WR_OP (x) (((x) >> S_FW_WR_OP) & M_FW_WR_OP) +/* atomic flag (hi) - firmware encapsulates CPLs in CPL_BARRIER +*/ +#define S_FW_WR_ATOMIC 23 +#define V_FW_WR_ATOMIC (x) ((x) << S_FW_WR_ATOMIC) +/* work request immediate data length (hi) */ #define S_FW_WR_IMMDLEN 0
drivers/net/cxgbe/cxgbe_filter.c +193 -0
220 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_filter.h +2 -0
@@ -224,6 +224,8 @@ int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id,int cxgbe_alloc_ftid (struct adapter *adap,unsigned int family);int init_hash_filter (struct adapter *adap);void hash_filter_rpl (struct adapter *adap,const struct cpl_act_open_rpl *rpl); +void hash_del_filter_rpl (struct adapter *adap, +const struct cpl_abort_rpl_rss *rpl);int validate_filter (struct adapter *adap,struct ch_filter_specification *fs);int cxgbe_get_filter_count (struct adapter *adapter,unsigned int fidx,u64 *c,bool get_byte);
drivers/net/cxgbe/cxgbe_main.c +48 -0
60 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_ofld.h +15 -0
@@ -19,6 +19,19 @@ (w)->wr.wr_lo =cpu_to_be64 (0 ); \ } while (0) +#define INIT_TP_WR_MIT_CPL (w, cpl, tid) do { \ + INIT_TP_WR(w, tid); \ + OPCODE_TID(w) = cpu_to_be32(MK_OPCODE_TID(cpl, tid)); \ +} while (0) + +#define INIT_ULPTX_WR (w, wrlen, atomic, tid) do { \ + (w)->wr.wr_hi = cpu_to_be32(V_FW_WR_OP(FW_ULPTX_WR) | \ + V_FW_WR_ATOMIC(atomic)); \ + (w)->wr.wr_mid = cpu_to_be32(V_FW_WR_LEN16(DIV_ROUND_UP(wrlen, 16)) | \ + V_FW_WR_FLOWID(tid)); \ + (w)->wr.wr_lo = cpu_to_be64(0); \ +} while (0) +/* * Max # of ATIDs. The absolute HW max is 16K but we keep it lower. */
@@ -68,6 +81,8 @@ static inline void *lookup_atid(const struct tid_info *t, unsigned int atid)int cxgbe_alloc_atid (struct tid_info *t,void *data);void cxgbe_free_atid (struct tid_info *t,unsigned int atid); +void cxgbe_remove_tid (struct tid_info *t,unsigned int qid,unsigned int tid, +unsigned short family);void cxgbe_insert_tid (struct tid_info *t,void *data,unsigned int tid,unsigned short family);
Signature · 1 line
2.14.1
PATCH 6/9 net/cxgbe: add support to query hit counters for flows in HASH region
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add interface to enable hit counters for flows offloaded in HASH region.
--- drivers/net/cxgbe/base/t4_tcb.h | 11 +++++++ drivers/net/cxgbe/cxgbe_filter.c | 71 +++++++++++++++++++++++++++++++++++++--- drivers/net/cxgbe/cxgbe_filter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 5 +-- 4 files changed, 81 insertions(+), 8 deletions(-)
drivers/net/cxgbe/base/t4_tcb.h +11 -0
@@ -12,4 +12,15 @@#define M_TCB_RSS_INFO 0x3ffULL#define V_TCB_RSS_INFO (x) ((x) << S_TCB_RSS_INFO) +/* 191:160 */ +#define W_TCB_TIMESTAMP 5 +#define S_TCB_TIMESTAMP 0 +#define M_TCB_TIMESTAMP 0xffffffffULL +#define V_TCB_TIMESTAMP (x) ((x) << S_TCB_TIMESTAMP) + +/* 223:192 */ +#define S_TCB_T_RTT_TS_RECENT_AGE 0 +#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) +#endif /* _T4_TCB_DEFS_H */
drivers/net/cxgbe/cxgbe_filter.c +66 -5
100 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_filter.h +1 -1
@@ -228,5 +228,5 @@ void hash_del_filter_rpl(struct adapter *adap, const struct cpl_abort_rpl_rss *rpl);int validate_filter (struct adapter *adap,struct ch_filter_specification *fs);int cxgbe_get_filter_count (struct adapter *adapter,unsigned int fidx, -u64 *c,bool get_byte); +u64 *c,int hash,bool get_byte);#endif /* _CXGBE_FILTER_H_ */
drivers/net/cxgbe/cxgbe_flow.c +3 -2
@@ -591,13 +591,14 @@ static int __cxgbe_flow_query(struct rte_flow *flow, u64 *count, u64 *byte_count) {struct adapter *adap =ethdev2adap (flow->dev); +struct ch_filter_specification fs = flow->f->fs;unsigned int fidx = flow->fidx;int ret =0 ; - ret =cxgbe_get_filter_count (adap, fidx, count,0 ); + ret =cxgbe_get_filter_count (adap, fidx, count, fs.cap,0 );if (ret)return ret; -return cxgbe_get_filter_count (adap, fidx, byte_count,1 ); +return cxgbe_get_filter_count (adap, fidx, byte_count, fs.cap,1 ); } static int
Signature · 1 line
2.14.1
PATCH 7/9 net/cxgbe: add support to flush flows in HASH region
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
--- drivers/net/cxgbe/cxgbe_flow.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/cxgbe/cxgbe_flow.c +13 -0
@@ -730,6 +730,19 @@ static int cxgbe_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *e) goto out; } } + +if (is_hashfilter (adap) && adap->tids.tid_tab) { +struct filter_entry *f; + +for (i = adap->tids.hash_base; i <= adap->tids.ntids; i++) { + f = (struct filter_entry *)adap->tids.tid_tab[i]; + + ret =cxgbe_check_n_destroy (f, dev, e); +if (ret <0 ) + goto out; + } + } + out:return ret >=0 ?0 : ret; }
Signature · 1 line
2.14.1
PATCH 8/9 net/cxgbe: add support to match on ingress physical port
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add support to match packets based on ingress physical port.
--- drivers/net/cxgbe/cxgbe_filter.c | 16 +++++++++++++++- drivers/net/cxgbe/cxgbe_flow.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-)
drivers/net/cxgbe/cxgbe_filter.c +15 -1
@@ -65,11 +65,19 @@ int validate_filter(struct adapter *adapter, struct ch_filter_specification *fs)#define U (_mask, _field) \ (!(fconf & (_mask)) && S(_field)) -if (U (F_ETHERTYPE , ethtype) ||U (F_PROTOCOL , proto)) +if (U (F_PORT , iport) ||U (F_ETHERTYPE , ethtype) ||U (F_PROTOCOL , proto))return -EOPNOTSUPP ;#undef S#undef U + +/* +* Don't allow various trivially obvious bogus out-of-range +* values ... +*/ +if (fs->val.iport >= adapter->params.nports) +return -ERANGE ; +return 0 ; }
@@ -228,6 +236,9 @@ static u64 hash_filter_ntuple(const struct filter_entry *f)u64 ntuple =0 ;u16 tcp_proto =IPPROTO_TCP ;/* TCP Protocol Number */ +if (tp->port_shift >=0 ) + ntuple |= (u64 )f->fs.mask.iport << tp->port_shift; +if (tp->protocol_shift >=0 ) {if (!f->fs.val.proto) ntuple |= (u64 )tcp_proto << tp->protocol_shift;
@@ -664,6 +675,9 @@ int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)cpu_to_be16 (V_FW_FILTER_WR_RX_CHAN (0 ) |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) | +V_FW_FILTER_WR_PORTM (f->fs.mask.iport)); fwr->ptcl = f->fs.val.proto; fwr->ptclm = f->fs.mask.proto;rte_memcpy (fwr->lip, f->fs.val.lip,sizeof (fwr->lip));
drivers/net/cxgbe/cxgbe_flow.c +30 -0
@@ -93,6 +93,8 @@ cxgbe_fill_filter_region(struct adapter *adap, ntuple_mask |= (u64 )fs->mask.proto << tp->protocol_shift;if (tp->ethertype_shift >=0 ) ntuple_mask |= (u64 )fs->mask.ethtype << tp->ethertype_shift; +if (tp->port_shift >=0 ) + ntuple_mask |= (u64 )fs->mask.iport << tp->port_shift;if (ntuple_mask != hash_filter_mask)return ;
@@ -100,6 +102,27 @@ cxgbe_fill_filter_region(struct adapter *adap, fs->cap =1 ;/* use hash region */ } +static int +ch_rte_parsetype_port (const void *dmask,const struct rte_flow_item *item, +struct ch_filter_specification *fs, +struct rte_flow_error *e) +{ +const struct rte_flow_item_phy_port *val = item->spec; +const struct rte_flow_item_phy_port *umask = item->mask; +const struct rte_flow_item_phy_port *mask; + + mask = umask ? umask : (const struct rte_flow_item_phy_port *)dmask; + +if (val->index >0x7 ) +return rte_flow_error_set (e,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item, +"port index upto 0x7 is supported" ); + +CXGBE_FILL_FS (val->index, mask->index, iport); + +return 0 ; +} + static int ch_rte_parsetype_udp(const void *dmask, const struct rte_flow_item *item, struct ch_filter_specification *fs,
@@ -357,6 +380,13 @@ cxgbe_rtef_parse_actions(struct rte_flow *flow, }struct chrte_fparse parseitem[] = { + [RTE_FLOW_ITEM_TYPE_PHY_PORT ] = { + .fptr = ch_rte_parsetype_port, + .dmask = &(const struct rte_flow_item_phy_port ){ + .index =0x7 , + } + }, + [RTE_FLOW_ITEM_TYPE_IPV4 ] = { .fptr = ch_rte_parsetype_ipv4, .dmask = &rte_flow_item_ipv4_mask,
Signature · 1 line
2.14.1
PATCH 9/9 net/cxgbe: add support to redirect packets to egress physical port
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add action to redirect matched packets to specified egress physical port without sending them to host.
--- drivers/net/cxgbe/base/t4_msg.h | 6 ++++++ drivers/net/cxgbe/cxgbe_filter.c | 19 +++++++++++++++++-- drivers/net/cxgbe/cxgbe_filter.h | 5 ++++- drivers/net/cxgbe/cxgbe_flow.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 3 deletions(-)
drivers/net/cxgbe/base/t4_msg.h +6 -0
@@ -113,6 +113,9 @@ struct work_request_hdr {#define G_COOKIE (x) (((x) >> S_COOKIE) & M_COOKIE)/* option 0 fields */ +#define S_TX_CHAN 2 +#define V_TX_CHAN (x) ((x) << S_TX_CHAN) +#define S_DELACK 5#define V_DELACK (x) ((x) << S_DELACK)
@@ -145,6 +148,9 @@ struct work_request_hdr {#define V_RX_CHANNEL (x) ((x) << S_RX_CHANNEL)#define F_RX_CHANNEL V_RX_CHANNEL(1U) +#define S_CCTRL_ECN 27 +#define V_CCTRL_ECN (x) ((x) << S_CCTRL_ECN) +#define S_T5_OPT_2_VALID 31#define V_T5_OPT_2_VALID (x) ((x) << S_T5_OPT_2_VALID)#define F_T5_OPT_2_VALID V_T5_OPT_2_VALID(1U)
drivers/net/cxgbe/cxgbe_filter.c +17 -2
@@ -71,6 +71,15 @@ int validate_filter(struct adapter *adapter, struct ch_filter_specification *fs)#undef S#undef U +/* +* If the user is requesting that the filter action loop +* matching packets back out one of our ports, make sure that +* the egress port is in range. +*/ +if (fs->action ==FILTER_SWITCH && + fs->eport >= adapter->params.nports) +return -ERANGE ; +/* * Don't allow various trivially obvious bogus out-of-range * values ...
@@ -419,6 +428,7 @@ static void mk_act_open_req6(struct filter_entry *f, struct rte_mbuf *mbuf, req->opt0 =cpu_to_be64 (V_DELACK (f->fs.hitcnts) |V_SMAC_SEL ((cxgbe_port_viid (f->dev) &0x7F ) <<1 ) | +V_TX_CHAN (f->fs.eport) |V_ULP_MODE (ULP_MODE_NONE ) |F_TCAM_BYPASS |F_NON_OFFLOAD ); req->params =cpu_to_be64 (V_FILTER_TUPLE (hash_filter_ntuple (f)));
@@ -427,7 +437,8 @@ static void mk_act_open_req6(struct filter_entry *f, struct rte_mbuf *mbuf,F_T5_OPT_2_VALID |F_RX_CHANNEL |V_CONG_CNTRL ((f->fs.action ==FILTER_DROP ) | - (f->fs.dirsteer << 1))); + (f->fs.dirsteer <<1 )) | + V_CCTRL_ECN(f->fs.action == FILTER_SWITCH)); }/**
@@ -460,6 +471,7 @@ static void mk_act_open_req(struct filter_entry *f, struct rte_mbuf *mbuf, req->opt0 =cpu_to_be64 (V_DELACK (f->fs.hitcnts) |V_SMAC_SEL ((cxgbe_port_viid (f->dev) &0x7F ) <<1 ) | +V_TX_CHAN (f->fs.eport) |V_ULP_MODE (ULP_MODE_NONE ) |F_TCAM_BYPASS |F_NON_OFFLOAD ); req->params =cpu_to_be64 (V_FILTER_TUPLE (hash_filter_ntuple (f)));
@@ -468,7 +480,8 @@ static void mk_act_open_req(struct filter_entry *f, struct rte_mbuf *mbuf,F_T5_OPT_2_VALID |F_RX_CHANNEL |V_CONG_CNTRL ((f->fs.action ==FILTER_DROP ) | - (f->fs.dirsteer << 1))); + (f->fs.dirsteer <<1 )) | + V_CCTRL_ECN(f->fs.action == FILTER_SWITCH)); }/**
@@ -666,7 +679,9 @@ int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx) fwr->del_filter_to_l2tix =cpu_to_be32 (V_FW_FILTER_WR_DROP (f->fs.action ==FILTER_DROP ) |V_FW_FILTER_WR_DIRSTEER (f->fs.dirsteer) | +V_FW_FILTER_WR_LPBK (f->fs.action ==FILTER_SWITCH ) |V_FW_FILTER_WR_HITCNTS (f->fs.hitcnts) | +V_FW_FILTER_WR_TXCHAN (f->fs.eport) |V_FW_FILTER_WR_PRIO (f->fs.prio)); fwr->ethtype =cpu_to_be16 (f->fs.val.ethtype); fwr->ethtypem =cpu_to_be16 (f->fs.mask.ethtype);
drivers/net/cxgbe/cxgbe_filter.h +4 -1
@@ -98,6 +98,8 @@ struct ch_filter_specification { uint32_t dirsteer:1; /* 0 => RSS, 1 => steer to iq */ uint32_t iq:10; /* ingress queue */ + uint32_t eport:2; /* egress port to switch packet out */ +/* Filter rule value/mask pairs. */ struct ch_filter_tuple val;struct ch_filter_tuple mask;
@@ -105,7 +107,8 @@ struct ch_filter_specification {enum {FILTER_PASS =0 ,/* default */ -FILTER_DROP +FILTER_DROP , +FILTER_SWITCH };enum filter_type {
drivers/net/cxgbe/cxgbe_flow.c +36 -0
@@ -326,6 +326,28 @@ static int cxgbe_get_fidx(struct rte_flow *flow, unsigned int *fidx)return 0 ; } +static int +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_phy_port *port; + +switch (a->type) { +case RTE_FLOW_ACTION_TYPE_PHY_PORT : + port = (const struct rte_flow_action_phy_port *)a->conf; + fs->eport = port->index; +break ; +default : +/* We are not supposed to come here */ +return rte_flow_error_set (e,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , a, +"Action not supported" ); + } + +return 0 ; +} + static int cxgbe_rtef_parse_actions(struct rte_flow *flow, const struct rte_flow_action action[],
@@ -335,6 +357,7 @@ cxgbe_rtef_parse_actions(struct rte_flow *flow,const struct rte_flow_action_queue *q;const struct rte_flow_action *a;char abit =0 ; +int ret;for (a = action; a->type !=RTE_FLOW_ACTION_TYPE_END ; a++) {switch (a->type) {
@@ -368,6 +391,19 @@ cxgbe_rtef_parse_actions(struct rte_flow *flow,case RTE_FLOW_ACTION_TYPE_COUNT : fs->hitcnts =1 ;break ; +case RTE_FLOW_ACTION_TYPE_PHY_PORT : +/* We allow multiple switch actions, but switch is +* not compatible with either queue or drop +*/ +if (abit++ && fs->action !=FILTER_SWITCH ) +return rte_flow_error_set (e,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION , a, +"overlapping action specified" ); + ret =ch_rte_parse_atype_switch (a, fs, e); +if (ret) +return ret; + fs->action =FILTER_SWITCH ; +break ;default :/* Not supported action : return error */ return rte_flow_error_set(e, ENOTSUP,
Signature · 1 line
2.14.1
Quoted 4 lines · Rahul Lakkireddy
This series of patches add support to offload flows to HASH region available on Chelsio T6 NICs. HASH region can only offload exact match (maskless) flows and hence the masks must be all set for all match items.
Hi Shagun, Rahul,
Can you please update driver documentation [1] and release notes [2] for new added features, HASH(?) region offload support, CLIP region support etc...
[1]: doc/guides/nics/cxgbe.rst
[2]: doc/guides/rel_notes/release_18_08.rst
Thanks,
ferruh
Quoted 60 lines
Patch 1 queries firmware for HASH filter support.
Patch 2 updates
cxgbe_flowto decide whether to place flows in LE-TCAM or HASH region based on supported hardware configuration and masks of match items.Patch 3 adds Compressed Local IP (CLIP) region support for offloading IPv6 flows in HASH region. Also updates LE-TCAM region to use CLIP for offloading IPv6 flows on Chelsio T6 NICs.
Patch 4 adds support for offloading flows to HASH region.
Patch 5 adds support for deleting flows in HASH region.
Patch 6 adds support to query hit and byte counters for offloaded flows in HASH region.
Patch 7 adds support to flush filters in HASH region.
Patch 8 adds support to match flows based on physical ingress port.
Patch 9 adds support to redirect packets matching flows to specified physical egress port without sending them to host.
Thanks,
RahulShagun Agrawal (9):
net/cxgbe: query firmware for HASH filter resources net/cxgbe: validate flows offloaded to HASH region net/cxgbe: add Compressed Local IP region
net/cxgbe: add support to offload flows to HASH region net/cxgbe: add support to delete flows in HASH region net/cxgbe: add support to query hit counters for flows in HASH region net/cxgbe: add support to flush flows in HASH region net/cxgbe: add support to match on ingress physical port net/cxgbe: add support to redirect packets to egress physical portdrivers/net/cxgbe/Makefile | 1 + drivers/net/cxgbe/base/adapter.h | 43 ++ drivers/net/cxgbe/base/common.h | 10 + drivers/net/cxgbe/base/t4_hw.c | 7 + drivers/net/cxgbe/base/t4_msg.h | 188 +++++++++ drivers/net/cxgbe/base/t4_regs.h | 12 + drivers/net/cxgbe/base/t4_tcb.h | 26 ++ drivers/net/cxgbe/base/t4fw_interface.h | 31 ++ drivers/net/cxgbe/clip_tbl.c | 195 +++++++++ drivers/net/cxgbe/clip_tbl.h | 31 ++ drivers/net/cxgbe/cxgbe_compat.h | 12 + drivers/net/cxgbe/cxgbe_filter.c | 697 ++++++++++++++++++++++++++++++-- drivers/net/cxgbe/cxgbe_filter.h | 13 +- drivers/net/cxgbe/cxgbe_flow.c | 151 ++++++- drivers/net/cxgbe/cxgbe_main.c | 170 +++++++- drivers/net/cxgbe/cxgbe_ofld.h | 66 ++- 16 files changed, 1614 insertions(+), 39 deletions(-) create mode 100644 drivers/net/cxgbe/base/t4_tcb.h create mode 100644 drivers/net/cxgbe/clip_tbl.c create mode 100644 drivers/net/cxgbe/clip_tbl.h
Quoted 8 lines · Ferruh Yigit
Quoted 4 lines · Rahul Lakkireddy
This series of patches add support to offload flows to HASH region available on Chelsio T6 NICs. HASH region can only offload exact match (maskless) flows and hence the masks must be all set for all match items.
Hi Shagun, Rahul,
Quoted 47 lines
Can you please update driver documentation [1] and release notes [2] for new added features, HASH(?) region offload support, CLIP region support etc...
[1]:
doc/guides/nics/cxgbe.rst
[2]:doc/guides/rel_notes/release_18_08.rstThanks,
ferruhQuoted 38 lines
Patch 1 queries firmware for HASH filter support.
Patch 2 updates
cxgbe_flowto decide whether to place flows in LE-TCAM or HASH region based on supported hardware configuration and masks of match items.Patch 3 adds Compressed Local IP (CLIP) region support for offloading IPv6 flows in HASH region. Also updates LE-TCAM region to use CLIP for offloading IPv6 flows on Chelsio T6 NICs.
Patch 4 adds support for offloading flows to HASH region.
Patch 5 adds support for deleting flows in HASH region.
Patch 6 adds support to query hit and byte counters for offloaded flows in HASH region.
Patch 7 adds support to flush filters in HASH region.
Patch 8 adds support to match flows based on physical ingress port.
Patch 9 adds support to redirect packets matching flows to specified physical egress port without sending them to host.
Thanks,
RahulShagun Agrawal (9):
net/cxgbe: query firmware for HASH filter resources net/cxgbe: validate flows offloaded to HASH region net/cxgbe: add Compressed Local IP region
net/cxgbe: add support to offload flows to HASH region net/cxgbe: add support to delete flows in HASH region net/cxgbe: add support to query hit counters for flows in HASH region net/cxgbe: add support to flush flows in HASH region net/cxgbe: add support to match on ingress physical port net/cxgbe: add support to redirect packets to egress physical port
Series applied to dpdk-next-net/master, thanks.
(meson build fixed while applying. And please remember to check documentation update request.)