Commit cf291163 authored by Chad Dupuis's avatar Chad Dupuis Committed by Martin K. Petersen

scsi: qedf: Corrent VLAN tag insertion in fallback VLAN case.

Currently in the driver the qedf_ctx attribute vlan_hw_insert is used to
which whether to insert a VLAN tag in FIP frames (except for FIP VLAN
request which is explicitly sent out untagged at least from the driver's
point of view).

When we receive a FIP VLAN response, we set qedf->vlan_hw_insert to 0 which
makes the qedf_fip_send function insert the VLAN.  However when we exhaust
our FIP VLAN retries, we do not set qedf->vlan_hw_insert to 0 which means
that the driver will not tag the FIP frame with the correct VLAN ID.  The
result that was observed on the wire is that some entity either in the LL2
or L2 firmware is adding a NULL VLAN tag which can cause FIP solicitation
to fail.

The offload FCoE frame function, qedf_xmit, does not use the vlan_hw_insert
attribute to decide whether to tag frames with the FIP/FCoE VLAN.  Instead
it unilaterially tags the offload frames with the VLAN ID stored in
qedf->vlan_id. This is the correct behavior so the driver can guarantee
that non-offload FIP frames go out with the correct VLAN ID.

Also use the Linux network layer helpers instead of doing the VLAN insert
manually.

Also fix setting the fallback VLAN so that it used the module parameter and
is not hardcoded to 1002 (though 1002 is the default).

[mkp: fixed typo]
Signed-off-by: default avatarChad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a3cd42a9
...@@ -300,7 +300,6 @@ struct qedf_ctx { ...@@ -300,7 +300,6 @@ struct qedf_ctx {
#define QEDF_FALLBACK_VLAN 1002 #define QEDF_FALLBACK_VLAN 1002
#define QEDF_DEFAULT_PRIO 3 #define QEDF_DEFAULT_PRIO 3
int vlan_id; int vlan_id;
uint vlan_hw_insert:1;
struct qed_dev *cdev; struct qed_dev *cdev;
struct qed_dev_fcoe_info dev_info; struct qed_dev_fcoe_info dev_info;
struct qed_int_info int_info; struct qed_int_info int_info;
......
...@@ -108,7 +108,6 @@ void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -108,7 +108,6 @@ void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
{ {
struct qedf_ctx *qedf = container_of(fip, struct qedf_ctx, ctlr); struct qedf_ctx *qedf = container_of(fip, struct qedf_ctx, ctlr);
struct ethhdr *eth_hdr; struct ethhdr *eth_hdr;
struct vlan_ethhdr *vlan_hdr;
struct fip_header *fiph; struct fip_header *fiph;
u16 op, vlan_tci = 0; u16 op, vlan_tci = 0;
u8 sub; u8 sub;
...@@ -124,16 +123,14 @@ void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb) ...@@ -124,16 +123,14 @@ void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
op = ntohs(fiph->fip_op); op = ntohs(fiph->fip_op);
sub = fiph->fip_subcode; sub = fiph->fip_subcode;
if (!qedf->vlan_hw_insert) { /*
vlan_hdr = skb_push(skb, sizeof(*vlan_hdr) - sizeof(*eth_hdr)); * Add VLAN tag to non-offload FIP frame based on current stored VLAN
memcpy(vlan_hdr, eth_hdr, 2 * ETH_ALEN); * for FIP/FCoE traffic.
vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q); */
vlan_hdr->h_vlan_encapsulated_proto = eth_hdr->h_proto; __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), qedf->vlan_id);
vlan_hdr->h_vlan_TCI = vlan_tci = htons(qedf->vlan_id);
}
/* Update eth_hdr since we added a VLAN tag */ /* Get VLAN ID from skb for printing purposes */
eth_hdr = (struct ethhdr *)skb_mac_header(skb); __vlan_hwaccel_get_tag(skb, &vlan_tci);
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2, "FIP frame send: " QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2, "FIP frame send: "
"dest=%pM op=%x sub=%x vlan=%04x.", eth_hdr->h_dest, op, sub, "dest=%pM op=%x sub=%x vlan=%04x.", eth_hdr->h_dest, op, sub,
...@@ -174,7 +171,6 @@ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb) ...@@ -174,7 +171,6 @@ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb)
/* Handle FIP VLAN resp in the driver */ /* Handle FIP VLAN resp in the driver */
if (op == FIP_OP_VLAN && sub == FIP_SC_VL_NOTE) { if (op == FIP_OP_VLAN && sub == FIP_SC_VL_NOTE) {
qedf_fcoe_process_vlan_resp(qedf, skb); qedf_fcoe_process_vlan_resp(qedf, skb);
qedf->vlan_hw_insert = 0;
kfree_skb(skb); kfree_skb(skb);
} else if (op == FIP_OP_CTRL && sub == FIP_SC_CLR_VLINK) { } else if (op == FIP_OP_CTRL && sub == FIP_SC_CLR_VLINK) {
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Clear virtual " QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Clear virtual "
......
...@@ -164,7 +164,7 @@ static void qedf_handle_link_update(struct work_struct *work) ...@@ -164,7 +164,7 @@ static void qedf_handle_link_update(struct work_struct *work)
QEDF_WARN(&(qedf->dbg_ctx), "Did not receive FIP VLAN " QEDF_WARN(&(qedf->dbg_ctx), "Did not receive FIP VLAN "
"response, falling back to default VLAN %d.\n", "response, falling back to default VLAN %d.\n",
qedf_fallback_vlan); qedf_fallback_vlan);
qedf_set_vlan_id(qedf, QEDF_FALLBACK_VLAN); qedf_set_vlan_id(qedf, qedf_fallback_vlan);
/* /*
* Zero out data_src_addr so we'll update it with the new * Zero out data_src_addr so we'll update it with the new
...@@ -361,8 +361,9 @@ static void qedf_link_recovery(struct work_struct *work) ...@@ -361,8 +361,9 @@ static void qedf_link_recovery(struct work_struct *work)
/* Since the link when down and up to verify which vlan we're on */ /* Since the link when down and up to verify which vlan we're on */
qedf->fipvlan_retries = qedf_fipvlan_retries; qedf->fipvlan_retries = qedf_fipvlan_retries;
rc = qedf_initiate_fipvlan_req(qedf); rc = qedf_initiate_fipvlan_req(qedf);
/* If getting the VLAN fails, set the VLAN to the fallback one */
if (!rc) if (!rc)
return; qedf_set_vlan_id(qedf, qedf_fallback_vlan);
/* /*
* We need to wait for an FCF to be selected due to the * We need to wait for an FCF to be selected due to the
...@@ -964,6 +965,10 @@ static int qedf_xmit(struct fc_lport *lport, struct fc_frame *fp) ...@@ -964,6 +965,10 @@ static int qedf_xmit(struct fc_lport *lport, struct fc_frame *fp)
skb->mac_len = elen; skb->mac_len = elen;
skb->protocol = htons(ETH_P_FCOE); skb->protocol = htons(ETH_P_FCOE);
/*
* Add VLAN tag to non-offload FCoE frame based on current stored VLAN
* for FIP/FCoE traffic.
*/
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), qedf->vlan_id); __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), qedf->vlan_id);
/* fill up mac and fcoe headers */ /* fill up mac and fcoe headers */
...@@ -3174,8 +3179,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) ...@@ -3174,8 +3179,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
} }
set_bit(QEDF_LL2_STARTED, &qedf->flags); set_bit(QEDF_LL2_STARTED, &qedf->flags);
/* hw will be insterting vlan tag*/ /* Set initial FIP/FCoE VLAN to NULL */
qedf->vlan_hw_insert = 1;
qedf->vlan_id = 0; qedf->vlan_id = 0;
/* /*
......
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