X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fcxgbe%2Fcxgbe_filter.c;h=7fcee5c0ad2636df42c92bf136ab20152f72aad8;hb=c3318f529c28e8320ac43f86f214f93e2190445d;hp=86a6158fd45e28964d1486b489d242966c304fea;hpb=89c8bd956bedb4ef6c442e82d5bc116f72b6e56a;p=dpdk.git diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c index 86a6158fd4..7fcee5c0ad 100644 --- a/drivers/net/cxgbe/cxgbe_filter.c +++ b/drivers/net/cxgbe/cxgbe_filter.c @@ -854,7 +854,7 @@ int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id, struct ch_filter_specification *fs, struct filter_ctx *ctx) { - struct port_info *pi = (struct port_info *)(dev->data->dev_private); + struct port_info *pi = dev->data->dev_private; struct adapter *adapter = pi->adapter; struct filter_entry *f; unsigned int chip_ver; @@ -1305,6 +1305,55 @@ get_count: return 0; } +/* + * Clear the packet count for the specified filter. + */ +int cxgbe_clear_filter_count(struct adapter *adapter, unsigned int fidx, + int hash, bool clear_byte) +{ + u64 tcb_mask = 0, tcb_val = 0; + struct filter_entry *f = NULL; + u16 tcb_word = 0; + + if (is_hashfilter(adapter) && hash) { + if (fidx >= adapter->tids.ntids) + return -ERANGE; + + /* No hitcounts supported for T5 hashfilters */ + if (is_t5(adapter->params.chip)) + return 0; + + f = adapter->tids.tid_tab[fidx]; + } else { + if (fidx >= adapter->tids.nftids) + return -ERANGE; + + f = &adapter->tids.ftid_tab[fidx]; + } + + if (!f || !f->valid) + return -EINVAL; + + tcb_word = W_TCB_TIMESTAMP; + tcb_mask = V_TCB_TIMESTAMP(M_TCB_TIMESTAMP); + tcb_val = V_TCB_TIMESTAMP(0ULL); + + set_tcb_field(adapter, f->tid, tcb_word, tcb_mask, tcb_val, 1); + + if (clear_byte) { + tcb_word = W_TCB_T_RTT_TS_RECENT_AGE; + tcb_mask = + V_TCB_T_RTT_TS_RECENT_AGE(M_TCB_T_RTT_TS_RECENT_AGE) | + V_TCB_T_RTSEQ_RECENT(M_TCB_T_RTSEQ_RECENT); + tcb_val = V_TCB_T_RTT_TS_RECENT_AGE(0ULL) | + V_TCB_T_RTSEQ_RECENT(0ULL); + + set_tcb_field(adapter, f->tid, tcb_word, tcb_mask, tcb_val, 1); + } + + return 0; +} + /** * Handle a Hash filter delete reply. */