Commit 76dbf4ff authored by Saurav Kashyap's avatar Saurav Kashyap Committed by Martin K. Petersen

scsi: qedf: Check for link state before processing LL2 packets and send fipvlan retries

 - Check if link is UP before sending and processing any packets on wire.
Signed-off-by: default avatarSaurav Kashyap <skashyap@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0cbd0075
...@@ -95,6 +95,12 @@ static void qedf_fcoe_process_vlan_resp(struct qedf_ctx *qedf, ...@@ -95,6 +95,12 @@ static void qedf_fcoe_process_vlan_resp(struct qedf_ctx *qedf,
rlen -= dlen; rlen -= dlen;
} }
if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN) {
QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC,
"Dropping VLAN response as link is down.\n");
return;
}
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "VLAN response, " QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "VLAN response, "
"vid=0x%x.\n", vid); "vid=0x%x.\n", vid);
......
...@@ -124,21 +124,24 @@ static bool qedf_initiate_fipvlan_req(struct qedf_ctx *qedf) ...@@ -124,21 +124,24 @@ static bool qedf_initiate_fipvlan_req(struct qedf_ctx *qedf)
{ {
int rc; int rc;
if (atomic_read(&qedf->link_state) != QEDF_LINK_UP) {
QEDF_ERR(&(qedf->dbg_ctx), "Link not up.\n");
return false;
}
while (qedf->fipvlan_retries--) { while (qedf->fipvlan_retries--) {
/* This is to catch if link goes down during fipvlan retries */
if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN) {
QEDF_ERR(&qedf->dbg_ctx, "Link not up.\n");
return false;
}
if (qedf->vlan_id > 0) if (qedf->vlan_id > 0)
return true; return true;
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
"Retry %d.\n", qedf->fipvlan_retries); "Retry %d.\n", qedf->fipvlan_retries);
init_completion(&qedf->fipvlan_compl); init_completion(&qedf->fipvlan_compl);
qedf_fcoe_send_vlan_req(qedf); qedf_fcoe_send_vlan_req(qedf);
rc = wait_for_completion_timeout(&qedf->fipvlan_compl, rc = wait_for_completion_timeout(&qedf->fipvlan_compl,
1 * HZ); 1 * HZ);
if (rc > 0) { if (rc > 0 &&
(atomic_read(&qedf->link_state) == QEDF_LINK_UP)) {
fcoe_ctlr_link_up(&qedf->ctlr); fcoe_ctlr_link_up(&qedf->ctlr);
return true; return true;
} }
...@@ -159,6 +162,12 @@ static void qedf_handle_link_update(struct work_struct *work) ...@@ -159,6 +162,12 @@ static void qedf_handle_link_update(struct work_struct *work)
rc = qedf_initiate_fipvlan_req(qedf); rc = qedf_initiate_fipvlan_req(qedf);
if (rc) if (rc)
return; return;
if (atomic_read(&qedf->link_state) != QEDF_LINK_UP) {
qedf->vlan_id = 0;
return;
}
/* /*
* If we get here then we never received a repsonse to our * If we get here then we never received a repsonse to our
* fip vlan request so set the vlan_id to the default and * fip vlan request so set the vlan_id to the default and
...@@ -2413,6 +2422,13 @@ static int qedf_ll2_rx(void *cookie, struct sk_buff *skb, ...@@ -2413,6 +2422,13 @@ static int qedf_ll2_rx(void *cookie, struct sk_buff *skb,
struct qedf_ctx *qedf = (struct qedf_ctx *)cookie; struct qedf_ctx *qedf = (struct qedf_ctx *)cookie;
struct qedf_skb_work *skb_work; struct qedf_skb_work *skb_work;
if (atomic_read(&qedf->link_state) == QEDF_LINK_DOWN) {
QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_LL2,
"Dropping frame as link state is down.\n");
kfree_skb(skb);
return 0;
}
skb_work = kzalloc(sizeof(struct qedf_skb_work), GFP_ATOMIC); skb_work = kzalloc(sizeof(struct qedf_skb_work), GFP_ATOMIC);
if (!skb_work) { if (!skb_work) {
QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate skb_work so " QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate skb_work so "
......
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