summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@broadcom.com>2017-11-09 11:46:27 -0600
committerFerruh Yigit <ferruh.yigit@intel.com>2017-11-10 09:42:10 +0000
commit1ccdd771d6a00b681d346033ad274d68a2af7a4c (patch)
treedc8a19102bc10e7d631c9a2ee3f14d66808b5256
parent7c90eef52f5bda290861827a6e732c1a0617162c (diff)
downloaddpdk-1ccdd771d6a00b681d346033ad274d68a2af7a4c.zip
dpdk-1ccdd771d6a00b681d346033ad274d68a2af7a4c.tar.gz
dpdk-1ccdd771d6a00b681d346033ad274d68a2af7a4c.tar.xz
net/bnxt: fix duplicate creation of ntuple filter
Prevent the creation of duplicate 5tuple filters. Fixes: b7435d660a8c ("net/bnxt: add ntuple filtering support") Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
-rw-r--r--drivers/net/bnxt/bnxt_ethdev.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e8c7d0e..dc437b4 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1956,25 +1956,29 @@ parse_ntuple_filter(struct bnxt *bp,
}
static struct bnxt_filter_info*
-bnxt_match_ntuple_filter(struct bnxt_vnic_info *vnic,
+bnxt_match_ntuple_filter(struct bnxt *bp,
struct bnxt_filter_info *bfilter)
{
struct bnxt_filter_info *mfilter = NULL;
+ int i;
- STAILQ_FOREACH(mfilter, &vnic->filter, next) {
- if (bfilter->src_ipaddr[0] == mfilter->src_ipaddr[0] &&
- bfilter->src_ipaddr_mask[0] ==
- mfilter->src_ipaddr_mask[0] &&
- bfilter->src_port == mfilter->src_port &&
- bfilter->src_port_mask == mfilter->src_port_mask &&
- bfilter->dst_ipaddr[0] == mfilter->dst_ipaddr[0] &&
- bfilter->dst_ipaddr_mask[0] ==
- mfilter->dst_ipaddr_mask[0] &&
- bfilter->dst_port == mfilter->dst_port &&
- bfilter->dst_port_mask == mfilter->dst_port_mask &&
- bfilter->flags == mfilter->flags &&
- bfilter->enables == mfilter->enables)
- return mfilter;
+ for (i = bp->nr_vnics - 1; i >= 0; i--) {
+ struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+ STAILQ_FOREACH(mfilter, &vnic->filter, next) {
+ if (bfilter->src_ipaddr[0] == mfilter->src_ipaddr[0] &&
+ bfilter->src_ipaddr_mask[0] ==
+ mfilter->src_ipaddr_mask[0] &&
+ bfilter->src_port == mfilter->src_port &&
+ bfilter->src_port_mask == mfilter->src_port_mask &&
+ bfilter->dst_ipaddr[0] == mfilter->dst_ipaddr[0] &&
+ bfilter->dst_ipaddr_mask[0] ==
+ mfilter->dst_ipaddr_mask[0] &&
+ bfilter->dst_port == mfilter->dst_port &&
+ bfilter->dst_port_mask == mfilter->dst_port_mask &&
+ bfilter->flags == mfilter->flags &&
+ bfilter->enables == mfilter->enables)
+ return mfilter;
+ }
}
return NULL;
}
@@ -2023,7 +2027,7 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
bfilter->ethertype = 0x800;
bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE;
- mfilter = bnxt_match_ntuple_filter(vnic, bfilter);
+ mfilter = bnxt_match_ntuple_filter(bp, bfilter);
if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD) {
RTE_LOG(ERR, PMD, "filter exists.");