Commit 3646ae0d authored by Shahjada Abul Husain's avatar Shahjada Abul Husain Committed by David S. Miller

cxgb4: fix missed high priority region calculation

commit c2193999 ("cxgb4: add support for high priority filters")
has missed considering high priority region calculation in some code
paths. This patch fixes them.

Fixes: c2193999 ("cxgb4: add support for high priority filters")
Signed-off-by: default avatarShahjada Abul Husain <shahjada@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8ae67496
...@@ -369,12 +369,16 @@ static int get_filter_count(struct adapter *adapter, unsigned int fidx, ...@@ -369,12 +369,16 @@ static int get_filter_count(struct adapter *adapter, unsigned int fidx,
return -E2BIG; return -E2BIG;
} }
} else { } else {
if ((fidx != (adapter->tids.nftids + if ((fidx != (adapter->tids.nftids + adapter->tids.nsftids +
adapter->tids.nsftids - 1)) && adapter->tids.nhpftids - 1)) &&
fidx >= adapter->tids.nftids) fidx >= (adapter->tids.nftids + adapter->tids.nhpftids))
return -E2BIG; return -E2BIG;
f = &adapter->tids.ftid_tab[fidx]; if (fidx < adapter->tids.nhpftids)
f = &adapter->tids.hpftid_tab[fidx];
else
f = &adapter->tids.ftid_tab[fidx -
adapter->tids.nhpftids];
if (!f->valid) if (!f->valid)
return -EINVAL; return -EINVAL;
} }
...@@ -480,6 +484,7 @@ int cxgb4_get_free_ftid(struct net_device *dev, int family) ...@@ -480,6 +484,7 @@ int cxgb4_get_free_ftid(struct net_device *dev, int family)
ftid -= n; ftid -= n;
} }
spin_unlock_bh(&t->ftid_lock); spin_unlock_bh(&t->ftid_lock);
ftid += t->nhpftids;
return found ? ftid : -ENOMEM; return found ? ftid : -ENOMEM;
} }
...@@ -815,10 +820,14 @@ int delete_filter(struct adapter *adapter, unsigned int fidx) ...@@ -815,10 +820,14 @@ int delete_filter(struct adapter *adapter, unsigned int fidx)
struct filter_entry *f; struct filter_entry *f;
int ret; int ret;
if (fidx >= adapter->tids.nftids + adapter->tids.nsftids) if (fidx >= adapter->tids.nftids + adapter->tids.nsftids +
adapter->tids.nhpftids)
return -EINVAL; return -EINVAL;
f = &adapter->tids.ftid_tab[fidx]; if (fidx < adapter->tids.nhpftids)
f = &adapter->tids.hpftid_tab[fidx];
else
f = &adapter->tids.ftid_tab[fidx - adapter->tids.nhpftids];
ret = writable_filter(f); ret = writable_filter(f);
if (ret) if (ret)
return ret; return ret;
......
...@@ -672,7 +672,8 @@ int cxgb4_tc_flower_replace(struct net_device *dev, ...@@ -672,7 +672,8 @@ int cxgb4_tc_flower_replace(struct net_device *dev,
* 0 to driver. However, the hardware TCAM index * 0 to driver. However, the hardware TCAM index
* starts from 0. Hence, the -1 here. * starts from 0. Hence, the -1 here.
*/ */
if (cls->common.prio <= adap->tids.nftids) { if (cls->common.prio <= (adap->tids.nftids +
adap->tids.nhpftids)) {
fidx = cls->common.prio - 1; fidx = cls->common.prio - 1;
if (fidx < adap->tids.nhpftids) if (fidx < adap->tids.nhpftids)
fs->prio = 1; fs->prio = 1;
......
...@@ -137,7 +137,7 @@ static int cxgb4_matchall_alloc_filter(struct net_device *dev, ...@@ -137,7 +137,7 @@ static int cxgb4_matchall_alloc_filter(struct net_device *dev,
* -1 here. 1 slot is enough to create a wildcard matchall * -1 here. 1 slot is enough to create a wildcard matchall
* VIID rule. * VIID rule.
*/ */
if (cls->common.prio <= adap->tids.nftids) if (cls->common.prio <= (adap->tids.nftids + adap->tids.nhpftids))
fidx = cls->common.prio - 1; fidx = cls->common.prio - 1;
else else
fidx = cxgb4_get_free_ftid(dev, PF_INET); fidx = cxgb4_get_free_ftid(dev, PF_INET);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment