summaryrefslogtreecommitdiff
path: root/drivers/scsi/qedf/qedf_fip.c
diff options
context:
space:
mode:
authorChad Dupuis <chad.dupuis@cavium.com>2017-08-15 10:08:18 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2017-08-24 22:29:03 -0400
commitcf29116375b7868aabe826ceda6fbe3f2451f8a7 (patch)
treecbe47af0f9bbd0034db6b3658d223a864ef7ea74 /drivers/scsi/qedf/qedf_fip.c
parenta3cd42a9d627fd7c472664e454108829886e123f (diff)
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: Chad Dupuis <chad.dupuis@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qedf/qedf_fip.c')
-rw-r--r--drivers/scsi/qedf/qedf_fip.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c
index 28ce0f7ffc7b..773558fc0697 100644
--- a/drivers/scsi/qedf/qedf_fip.c
+++ b/drivers/scsi/qedf/qedf_fip.c
@@ -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 ethhdr *eth_hdr;
- struct vlan_ethhdr *vlan_hdr;
struct fip_header *fiph;
u16 op, vlan_tci = 0;
u8 sub;
@@ -124,16 +123,14 @@ void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
op = ntohs(fiph->fip_op);
sub = fiph->fip_subcode;
- if (!qedf->vlan_hw_insert) {
- vlan_hdr = skb_push(skb, sizeof(*vlan_hdr) - sizeof(*eth_hdr));
- memcpy(vlan_hdr, eth_hdr, 2 * ETH_ALEN);
- vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);
- vlan_hdr->h_vlan_encapsulated_proto = eth_hdr->h_proto;
- vlan_hdr->h_vlan_TCI = vlan_tci = htons(qedf->vlan_id);
- }
+ /*
+ * Add VLAN tag to non-offload FIP frame based on current stored VLAN
+ * for FIP/FCoE traffic.
+ */
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), qedf->vlan_id);
- /* Update eth_hdr since we added a VLAN tag */
- eth_hdr = (struct ethhdr *)skb_mac_header(skb);
+ /* Get VLAN ID from skb for printing purposes */
+ __vlan_hwaccel_get_tag(skb, &vlan_tci);
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,
@@ -174,7 +171,6 @@ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb)
/* Handle FIP VLAN resp in the driver */
if (op == FIP_OP_VLAN && sub == FIP_SC_VL_NOTE) {
qedf_fcoe_process_vlan_resp(qedf, skb);
- qedf->vlan_hw_insert = 0;
kfree_skb(skb);
} else if (op == FIP_OP_CTRL && sub == FIP_SC_CLR_VLINK) {
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Clear virtual "