X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fcxgbe%2Fcxgbe_filter.c;h=a77935a657323fc5321569e0c1526514652e4525;hb=1def64c2d79e07eb3ec73f5d1ca797e512a3e4d5;hp=b876abf432d19090eeab380507439b8fbc06f17c;hpb=48f523f62563cbc9c4916fdfe1b6ec3a283fbf68;p=dpdk.git diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c index b876abf432..a77935a657 100644 --- a/drivers/net/cxgbe/cxgbe_filter.c +++ b/drivers/net/cxgbe/cxgbe_filter.c @@ -3,9 +3,10 @@ * All rights reserved. */ #include -#include "common.h" -#include "t4_tcb.h" -#include "t4_regs.h" + +#include "base/common.h" +#include "base/t4_tcb.h" +#include "base/t4_regs.h" #include "cxgbe_filter.h" #include "clip_tbl.h" #include "l2t.h" @@ -92,6 +93,9 @@ int validate_filter(struct adapter *adapter, struct ch_filter_specification *fs) if (!fs->cap && fs->nat_mode && !adapter->params.filter2_wr_support) return -EOPNOTSUPP; + if (!fs->cap && fs->swapmac && !adapter->params.filter2_wr_support) + return -EOPNOTSUPP; + return 0; } @@ -260,8 +264,8 @@ 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->port_shift >= 0 && f->fs.mask.iport) + ntuple |= (u64)f->fs.val.iport << tp->port_shift; if (tp->protocol_shift >= 0) { if (!f->fs.val.proto) @@ -275,9 +279,6 @@ static u64 hash_filter_ntuple(const struct filter_entry *f) 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; - return ntuple; } @@ -456,6 +457,7 @@ static void mk_act_open_req6(struct filter_entry *f, struct rte_mbuf *mbuf, V_RSS_QUEUE(f->fs.iq) | F_T5_OPT_2_VALID | F_RX_CHANNEL | + V_SACK_EN(f->fs.swapmac) | V_CONG_CNTRL((f->fs.action == FILTER_DROP) | (f->fs.dirsteer << 1)) | V_CCTRL_ECN(f->fs.action == FILTER_SWITCH)); @@ -502,6 +504,7 @@ static void mk_act_open_req(struct filter_entry *f, struct rte_mbuf *mbuf, V_RSS_QUEUE(f->fs.iq) | F_T5_OPT_2_VALID | F_RX_CHANNEL | + V_SACK_EN(f->fs.swapmac) | V_CONG_CNTRL((f->fs.action == FILTER_DROP) | (f->fs.dirsteer << 1)) | V_CCTRL_ECN(f->fs.action == FILTER_SWITCH)); @@ -773,9 +776,13 @@ int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx) fwr->fp = cpu_to_be16(f->fs.val.fport); fwr->fpm = cpu_to_be16(f->fs.mask.fport); - if (adapter->params.filter2_wr_support && f->fs.nat_mode) { + if (adapter->params.filter2_wr_support) { + fwr->filter_type_swapmac = + V_FW_FILTER2_WR_SWAPMAC(f->fs.swapmac); fwr->natmode_to_ulp_type = - V_FW_FILTER2_WR_ULP_TYPE(ULP_MODE_TCPDDP) | + V_FW_FILTER2_WR_ULP_TYPE(f->fs.nat_mode ? + ULP_MODE_TCPDDP : + ULP_MODE_NONE) | V_FW_FILTER2_WR_NATMODE(f->fs.nat_mode); memcpy(fwr->newlip, f->fs.nat_lip, sizeof(fwr->newlip)); memcpy(fwr->newfip, f->fs.nat_fip, sizeof(fwr->newfip)); @@ -1298,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. */