diff options
author | Karen Xie <kxie@chelsio.com> | 2014-01-28 20:01:37 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2014-03-15 13:19:18 -0400 |
commit | ac0245ff80942e33458cf32926dc1177239f4e19 (patch) | |
tree | f76c335e465c442273f446014ee7f78138cc5b4d /drivers/scsi/cxgbi | |
parent | 58968fc8fbb3869d9ec84d32b88b58b0423d6793 (diff) |
[SCSI] cxgb4i: Use cxgb4_select_ntuple to correctly calculate ntuple fields
Fixed calculates wrong tuple values on T5 adapter: switch to use the exported
API cxgb4_select_ntuple() from cxgb4 base driver.
Signed-off-by: Karen Xie <kxie@chelsio.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/cxgbi')
-rw-r--r-- | drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 59 |
1 files changed, 7 insertions, 52 deletions
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 5a9f84238a53..e8ee5e5fe0ef 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -175,52 +175,6 @@ static inline int is_ofld_imm(const struct sk_buff *skb) | |||
175 | sizeof(struct fw_ofld_tx_data_wr)); | 175 | sizeof(struct fw_ofld_tx_data_wr)); |
176 | } | 176 | } |
177 | 177 | ||
178 | |||
179 | #define VLAN_NONE 0xfff | ||
180 | #define FILTER_SEL_VLAN_NONE 0xffff | ||
181 | #define FILTER_SEL_WIDTH_P_FC (3+1) /* port uses 3 bits, FCoE one bit */ | ||
182 | #define FILTER_SEL_WIDTH_VIN_P_FC \ | ||
183 | (6 + 7 + FILTER_SEL_WIDTH_P_FC) /* 6 bits are unused, VF uses 7 bits*/ | ||
184 | #define FILTER_SEL_WIDTH_TAG_P_FC \ | ||
185 | (3 + FILTER_SEL_WIDTH_VIN_P_FC) /* PF uses 3 bits */ | ||
186 | #define FILTER_SEL_WIDTH_VLD_TAG_P_FC (1 + FILTER_SEL_WIDTH_TAG_P_FC) | ||
187 | |||
188 | static unsigned int select_ntuple(struct cxgbi_device *cdev, | ||
189 | struct l2t_entry *l2t) | ||
190 | { | ||
191 | struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev); | ||
192 | unsigned int ntuple = 0; | ||
193 | u32 viid; | ||
194 | |||
195 | switch (lldi->filt_mode) { | ||
196 | |||
197 | /* default filter mode */ | ||
198 | case HW_TPL_FR_MT_PR_IV_P_FC: | ||
199 | if (l2t->vlan == VLAN_NONE) | ||
200 | ntuple |= FILTER_SEL_VLAN_NONE << FILTER_SEL_WIDTH_P_FC; | ||
201 | else { | ||
202 | ntuple |= l2t->vlan << FILTER_SEL_WIDTH_P_FC; | ||
203 | ntuple |= 1 << FILTER_SEL_WIDTH_VLD_TAG_P_FC; | ||
204 | } | ||
205 | ntuple |= l2t->lport << S_PORT | IPPROTO_TCP << | ||
206 | FILTER_SEL_WIDTH_VLD_TAG_P_FC; | ||
207 | break; | ||
208 | case HW_TPL_FR_MT_PR_OV_P_FC: { | ||
209 | viid = cxgb4_port_viid(l2t->neigh->dev); | ||
210 | |||
211 | ntuple |= FW_VIID_VIN_GET(viid) << FILTER_SEL_WIDTH_P_FC; | ||
212 | ntuple |= FW_VIID_PFN_GET(viid) << FILTER_SEL_WIDTH_VIN_P_FC; | ||
213 | ntuple |= FW_VIID_VIVLD_GET(viid) << FILTER_SEL_WIDTH_TAG_P_FC; | ||
214 | ntuple |= l2t->lport << S_PORT | IPPROTO_TCP << | ||
215 | FILTER_SEL_WIDTH_VLD_TAG_P_FC; | ||
216 | break; | ||
217 | } | ||
218 | default: | ||
219 | break; | ||
220 | } | ||
221 | return ntuple; | ||
222 | } | ||
223 | |||
224 | static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, | 178 | static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, |
225 | struct l2t_entry *e) | 179 | struct l2t_entry *e) |
226 | { | 180 | { |
@@ -248,8 +202,6 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, | |||
248 | struct cpl_act_open_req *req = | 202 | struct cpl_act_open_req *req = |
249 | (struct cpl_act_open_req *)skb->head; | 203 | (struct cpl_act_open_req *)skb->head; |
250 | 204 | ||
251 | req = (struct cpl_act_open_req *)skb->head; | ||
252 | |||
253 | INIT_TP_WR(req, 0); | 205 | INIT_TP_WR(req, 0); |
254 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, | 206 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, |
255 | qid_atid)); | 207 | qid_atid)); |
@@ -258,7 +210,9 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, | |||
258 | req->local_ip = csk->saddr.sin_addr.s_addr; | 210 | req->local_ip = csk->saddr.sin_addr.s_addr; |
259 | req->peer_ip = csk->daddr.sin_addr.s_addr; | 211 | req->peer_ip = csk->daddr.sin_addr.s_addr; |
260 | req->opt0 = cpu_to_be64(opt0); | 212 | req->opt0 = cpu_to_be64(opt0); |
261 | req->params = cpu_to_be32(select_ntuple(csk->cdev, csk->l2t)); | 213 | req->params = cpu_to_be32(cxgb4_select_ntuple( |
214 | csk->cdev->ports[csk->port_id], | ||
215 | csk->l2t)); | ||
262 | opt2 |= 1 << 22; | 216 | opt2 |= 1 << 22; |
263 | req->opt2 = cpu_to_be32(opt2); | 217 | req->opt2 = cpu_to_be32(opt2); |
264 | 218 | ||
@@ -271,8 +225,6 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, | |||
271 | struct cpl_t5_act_open_req *req = | 225 | struct cpl_t5_act_open_req *req = |
272 | (struct cpl_t5_act_open_req *)skb->head; | 226 | (struct cpl_t5_act_open_req *)skb->head; |
273 | 227 | ||
274 | req = (struct cpl_t5_act_open_req *)skb->head; | ||
275 | |||
276 | INIT_TP_WR(req, 0); | 228 | INIT_TP_WR(req, 0); |
277 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, | 229 | OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, |
278 | qid_atid)); | 230 | qid_atid)); |
@@ -281,7 +233,10 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, | |||
281 | req->local_ip = csk->saddr.sin_addr.s_addr; | 233 | req->local_ip = csk->saddr.sin_addr.s_addr; |
282 | req->peer_ip = csk->daddr.sin_addr.s_addr; | 234 | req->peer_ip = csk->daddr.sin_addr.s_addr; |
283 | req->opt0 = cpu_to_be64(opt0); | 235 | req->opt0 = cpu_to_be64(opt0); |
284 | req->params = cpu_to_be32(select_ntuple(csk->cdev, csk->l2t)); | 236 | req->params = cpu_to_be64(V_FILTER_TUPLE( |
237 | cxgb4_select_ntuple( | ||
238 | csk->cdev->ports[csk->port_id], | ||
239 | csk->l2t))); | ||
285 | opt2 |= 1 << 31; | 240 | opt2 |= 1 << 31; |
286 | req->opt2 = cpu_to_be32(opt2); | 241 | req->opt2 = cpu_to_be32(opt2); |
287 | 242 | ||