aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKumar Sanghvi <kumaras@chelsio.com>2013-12-18 06:08:21 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-22 18:09:07 -0500
commit470c60c47a03f74f0ec1a83576eb6000025634a9 (patch)
tree257d63a656d02f0af3d57ac0fd072b33a82e12e3
parent7c89e5550ccb2a3118854639d9525847e896c686 (diff)
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>
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c16
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h9
2 files changed, 20 insertions, 5 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index df1d6b8334a1..f4f46fcea7b7 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -3012,7 +3012,8 @@ int cxgb4_alloc_sftid(struct tid_info *t, int family, void *data)
3012 } 3012 }
3013 if (stid >= 0) { 3013 if (stid >= 0) {
3014 t->stid_tab[stid].data = data; 3014 t->stid_tab[stid].data = data;
3015 stid += t->stid_base; 3015 stid -= t->nstids;
3016 stid += t->sftid_base;
3016 t->stids_in_use++; 3017 t->stids_in_use++;
3017 } 3018 }
3018 spin_unlock_bh(&t->stid_lock); 3019 spin_unlock_bh(&t->stid_lock);
@@ -3024,7 +3025,14 @@ EXPORT_SYMBOL(cxgb4_alloc_sftid);
3024 */ 3025 */
3025void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family) 3026void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family)
3026{ 3027{
3027 stid -= t->stid_base; 3028 /* Is it a server filter TID? */
3029 if (t->nsftids && (stid >= t->sftid_base)) {
3030 stid -= t->sftid_base;
3031 stid += t->nstids;
3032 } else {
3033 stid -= t->stid_base;
3034 }
3035
3028 spin_lock_bh(&t->stid_lock); 3036 spin_lock_bh(&t->stid_lock);
3029 if (family == PF_INET) 3037 if (family == PF_INET)
3030 __clear_bit(stid, t->stid_bmap); 3038 __clear_bit(stid, t->stid_bmap);
@@ -4185,7 +4193,7 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid,
4185 adap = netdev2adap(dev); 4193 adap = netdev2adap(dev);
4186 4194
4187 /* Adjust stid to correct filter index */ 4195 /* Adjust stid to correct filter index */
4188 stid -= adap->tids.nstids; 4196 stid -= adap->tids.sftid_base;
4189 stid += adap->tids.nftids; 4197 stid += adap->tids.nftids;
4190 4198
4191 /* Check to make sure the filter requested is writable ... 4199 /* 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,
4248 adap = netdev2adap(dev); 4256 adap = netdev2adap(dev);
4249 4257
4250 /* Adjust stid to correct filter index */ 4258 /* Adjust stid to correct filter index */
4251 stid -= adap->tids.nstids; 4259 stid -= adap->tids.sftid_base;
4252 stid += adap->tids.nftids; 4260 stid += adap->tids.nftids;
4253 4261
4254 f = &adap->tids.ftid_tab[stid]; 4262 f = &adap->tids.ftid_tab[stid];
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
index 6f21f2451c30..4dd0a82533e4 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
@@ -131,7 +131,14 @@ static inline void *lookup_atid(const struct tid_info *t, unsigned int atid)
131 131
132static inline void *lookup_stid(const struct tid_info *t, unsigned int stid) 132static inline void *lookup_stid(const struct tid_info *t, unsigned int stid)
133{ 133{
134 stid -= t->stid_base; 134 /* Is it a server filter TID? */
135 if (t->nsftids && (stid >= t->sftid_base)) {
136 stid -= t->sftid_base;
137 stid += t->nstids;
138 } else {
139 stid -= t->stid_base;
140 }
141
135 return stid < (t->nstids + t->nsftids) ? t->stid_tab[stid].data : NULL; 142 return stid < (t->nstids + t->nsftids) ? t->stid_tab[stid].data : NULL;
136} 143}
137 144