cxgb4: Assign filter server TIDs properly
The LE workaround code is incorrectly reusing the TCAM TIDs (meant for allocation by firmware in case of hash collisions) for filter servers. This patch assigns the filter server TIDs properly starting from sftid_base index. Based on original work by Santosh Rastapur <santosh@chelsio.com> Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7c89e5550c
commit
470c60c47a
|
@ -3012,7 +3012,8 @@ int cxgb4_alloc_sftid(struct tid_info *t, int family, void *data)
|
|||
}
|
||||
if (stid >= 0) {
|
||||
t->stid_tab[stid].data = data;
|
||||
stid += t->stid_base;
|
||||
stid -= t->nstids;
|
||||
stid += t->sftid_base;
|
||||
t->stids_in_use++;
|
||||
}
|
||||
spin_unlock_bh(&t->stid_lock);
|
||||
|
@ -3024,7 +3025,14 @@ EXPORT_SYMBOL(cxgb4_alloc_sftid);
|
|||
*/
|
||||
void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family)
|
||||
{
|
||||
stid -= t->stid_base;
|
||||
/* Is it a server filter TID? */
|
||||
if (t->nsftids && (stid >= t->sftid_base)) {
|
||||
stid -= t->sftid_base;
|
||||
stid += t->nstids;
|
||||
} else {
|
||||
stid -= t->stid_base;
|
||||
}
|
||||
|
||||
spin_lock_bh(&t->stid_lock);
|
||||
if (family == PF_INET)
|
||||
__clear_bit(stid, t->stid_bmap);
|
||||
|
@ -4185,7 +4193,7 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid,
|
|||
adap = netdev2adap(dev);
|
||||
|
||||
/* Adjust stid to correct filter index */
|
||||
stid -= adap->tids.nstids;
|
||||
stid -= adap->tids.sftid_base;
|
||||
stid += adap->tids.nftids;
|
||||
|
||||
/* Check to make sure the filter requested is writable ...
|
||||
|
@ -4248,7 +4256,7 @@ int cxgb4_remove_server_filter(const struct net_device *dev, unsigned int stid,
|
|||
adap = netdev2adap(dev);
|
||||
|
||||
/* Adjust stid to correct filter index */
|
||||
stid -= adap->tids.nstids;
|
||||
stid -= adap->tids.sftid_base;
|
||||
stid += adap->tids.nftids;
|
||||
|
||||
f = &adap->tids.ftid_tab[stid];
|
||||
|
|
|
@ -131,7 +131,14 @@ static inline void *lookup_atid(const struct tid_info *t, unsigned int atid)
|
|||
|
||||
static inline void *lookup_stid(const struct tid_info *t, unsigned int stid)
|
||||
{
|
||||
stid -= t->stid_base;
|
||||
/* Is it a server filter TID? */
|
||||
if (t->nsftids && (stid >= t->sftid_base)) {
|
||||
stid -= t->sftid_base;
|
||||
stid += t->nstids;
|
||||
} else {
|
||||
stid -= t->stid_base;
|
||||
}
|
||||
|
||||
return stid < (t->nstids + t->nsftids) ? t->stid_tab[stid].data : NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue