cxgb4: add support for high priority filters
Subsystems (3)
PATCH 1/1 cxgb4: add support for high priority filters
T6 has a separate region known as high priority filter region that allows classifying packets going through ULD path. So, query firmware for HPFILTER resources and enable the high priority offload filter support when it is available.
Signed-off-by Shahjada Abul Husain <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 11 + .../ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 3 + .../net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 220 ++++++++++++------ .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 53 +++-- .../ethernet/chelsio/cxgb4/cxgb4_tc_flower.c | 7 +- .../chelsio/cxgb4/cxgb4_tc_matchall.c | 2 + .../net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c | 18 +- .../net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 5 + drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 1 + 9 files changed, 234 insertions(+), 86 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +11 -0
@@ -56,6 +56,7 @@#include <asm/io.h> #include "t4_chip_type.h" #include "cxgb4_uld.h" +#include "t4fw_api.h" #define CH_WARN (adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)extern struct list_head adapter_list;
@@ -68,6 +69,16 @@ extern struct mutex uld_mutex;#define ETHTXQ_STOP_THRES \ (1 + DIV_ROUND_UP((3 * MAX_SKB_FRAGS) / 2 + (MAX_SKB_FRAGS & 1), 8)) +#define FW_PARAM_DEV (param) \ + (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | \ + FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_##param)) + +#define FW_PARAM_PFVF (param) \ + (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_PFVF) | \ + FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_PFVF_##param) | \ + FW_PARAMS_PARAM_Y_V(0) | \ + FW_PARAMS_PARAM_Z_V(0)) +enum {MAX_NPORTS =4 ,/* max # of ports */ SERNUM_LEN =24 ,/* Serial # length */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +3 -0
@@ -3240,6 +3240,9 @@ static int tid_info_show(struct seq_file *seq, void *v)seq_printf (seq,"SFTID range: %u..%u in use: %u\n" , t->sftid_base, t->sftid_base + t->nsftids -2 , t->sftids_in_use); +if (t->nhpftids) +seq_printf (seq,"HPFTID range: %u..%u\n" , t->hpftid_base, + t->hpftid_base + t->nhpftids -1 );if (t->ntids) seq_printf(seq, "HW TID usage: %u IP users, %u IPv6 users\n", t4_read_reg(adap, LE_DB_ACT_CNT_IPV4_A),
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +153 -67
398 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +40 -13
113 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +5 -2
@@ -672,10 +672,13 @@ int cxgb4_tc_flower_replace(struct net_device *dev,* 0 to driver. However, the hardware TCAM index * starts from 0. Hence, the -1 here. */ -if (cls->common.prio <= adap->tids.nftids) +if (cls->common.prio <= adap->tids.nftids) { fidx = cls->common.prio -1 ; -else +if (fidx < adap->tids.nhpftids) + fs->prio =1 ; + }else { fidx =cxgb4_get_free_ftid (dev, inet_family); + }/* Only insert FLOWER rule if its priority doesn't * conflict with existing rules in the LETCAM.
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_matchall.c +2 -0
@@ -156,6 +156,8 @@ static int cxgb4_matchall_alloc_filter(struct net_device *dev, fs = &tc_port_matchall->ingress.fs;memset (fs,0 ,sizeof (*fs)); +if (fidx < adap->tids.nhpftids) + fs->prio =1 ; fs->tc_prio = cls->common.prio; fs->tc_cookie = cls->cookie; fs->hitcnts =1 ;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +14 -4
@@ -176,7 +176,7 @@ int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls)/* Only insert U32 rule if its priority doesn't conflict with * existing rules in the LETCAM. */ -if (filter_id >= adapter->tids.nftids || +if (filter_id >= adapter->tids.nftids + adapter->tids.nhpftids || !cxgb4_filter_prio_in_range (dev, filter_id, cls->common.prio)) {NL_SET_ERR_MSG_MOD (extack,"No free LETCAM index available" );
@@ -199,6 +199,8 @@ int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls)memset (&fs,0 ,sizeof (fs)); +if (filter_id < adapter->tids.nhpftids) + fs.prio =1 ; fs.tc_prio = cls->common.prio; fs.tc_cookie = cls->knode.handle;
@@ -355,6 +357,7 @@ int cxgb4_delete_knode(struct net_device *dev, struct tc_cls_u32_offload *cls)unsigned int filter_id, max_tids, i, j;struct cxgb4_link *link =NULL ;struct cxgb4_tc_u32_table *t; +struct filter_entry *f;u32 handle, uhtid;int ret;
@@ -363,8 +366,15 @@ int cxgb4_delete_knode(struct net_device *dev, struct tc_cls_u32_offload *cls)/* Fetch the location to delete the filter. */ filter_id =TC_U32_NODE (cls->knode.handle) -1 ; -if (filter_id >= adapter->tids.nftids || - cls->knode.handle != adapter->tids.ftid_tab[filter_id].fs.tc_cookie) +if (filter_id >= adapter->tids.nftids + adapter->tids.nhpftids) +return -ERANGE ; + +if (filter_id < adapter->tids.nhpftids) + f = &adapter->tids.hpftid_tab[filter_id]; +else + f = &adapter->tids.ftid_tab[filter_id - adapter->tids.nhpftids]; + +if (cls->knode.handle != f->fs.tc_cookie)return -ERANGE ; t = adapter->tc_u32;
@@ -445,7 +455,7 @@ void cxgb4_cleanup_tc_u32(struct adapter *adap)struct cxgb4_tc_u32_table *cxgb4_init_tc_u32 (struct adapter *adap) { -unsigned int max_tids = adap->tids.nftids; +unsigned int max_tids = adap->tids.nftids + adap->tids.nhpftids;struct cxgb4_tc_u32_table *t;unsigned int i;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +5 -0
@@ -111,6 +111,11 @@ struct tid_info {unsigned int natids;unsigned int atid_base; +struct filter_entry *hpftid_tab; +unsigned long *hpftid_bmap; +unsigned int nhpftids; +unsigned int hpftid_base; +struct filter_entry *ftid_tab;unsigned long *ftid_bmap;unsigned int nftids;
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +1 -0
@@ -1321,6 +1321,7 @@ enum fw_params_param_dev {FW_PARAMS_PARAM_DEV_RDMA_WRITE_WITH_IMM =0x21 ,FW_PARAMS_PARAM_DEV_PPOD_EDRAM =0x23 ,FW_PARAMS_PARAM_DEV_RI_WRITE_CMPL_WR =0x24 , +FW_PARAMS_PARAM_DEV_HPFILTER_REGION_SUPPORT =0x26 ,FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN =0x27 ,FW_PARAMS_PARAM_DEV_HASHFILTER_WITH_OFLD =0x28 , FW_PARAMS_PARAM_DEV_DBQ_TIMER = 0x29,
Signature · 1 line
2.23.0.256.g4c86140