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

scsi: qedf: Keep track of num of pending flogi

If a port is brought down for an extended period of time, the fipvlan
counter gets exhausted and the driver will fall back to default VLAN 1002
and call fcoe_ctlr_link_up to log in. However, the switch will discard the
FLOGI attempt because the VLAN is now different.

Keep track of the number of FLOGI attempts and if a threshold of
QEDF_FLOGI_RETRY_CNT is exceeded, perform a context soft reset.

Link: https://lore.kernel.org/r/20200416084314.18851-2-skashyap@marvell.comSigned-off-by: default avatarSaurav Kashyap <skashyap@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d2148199
...@@ -388,6 +388,7 @@ struct qedf_ctx { ...@@ -388,6 +388,7 @@ struct qedf_ctx {
mempool_t *io_mempool; mempool_t *io_mempool;
struct workqueue_struct *dpc_wq; struct workqueue_struct *dpc_wq;
struct delayed_work grcdump_work; struct delayed_work grcdump_work;
struct delayed_work stag_work;
u32 slow_sge_ios; u32 slow_sge_ios;
u32 fast_sge_ios; u32 fast_sge_ios;
...@@ -403,6 +404,7 @@ struct qedf_ctx { ...@@ -403,6 +404,7 @@ struct qedf_ctx {
u32 flogi_cnt; u32 flogi_cnt;
u32 flogi_failed; u32 flogi_failed;
u32 flogi_pending;
/* Used for fc statistics */ /* Used for fc statistics */
struct mutex stats_mutex; struct mutex stats_mutex;
......
...@@ -282,6 +282,7 @@ static void qedf_flogi_resp(struct fc_seq *seq, struct fc_frame *fp, ...@@ -282,6 +282,7 @@ static void qedf_flogi_resp(struct fc_seq *seq, struct fc_frame *fp,
else if (fc_frame_payload_op(fp) == ELS_LS_ACC) { else if (fc_frame_payload_op(fp) == ELS_LS_ACC) {
/* Set the source MAC we will use for FCoE traffic */ /* Set the source MAC we will use for FCoE traffic */
qedf_set_data_src_addr(qedf, fp); qedf_set_data_src_addr(qedf, fp);
qedf->flogi_pending = 0;
} }
/* Complete flogi_compl so we can proceed to sending ADISCs */ /* Complete flogi_compl so we can proceed to sending ADISCs */
...@@ -307,6 +308,11 @@ static struct fc_seq *qedf_elsct_send(struct fc_lport *lport, u32 did, ...@@ -307,6 +308,11 @@ static struct fc_seq *qedf_elsct_send(struct fc_lport *lport, u32 did,
*/ */
if (resp == fc_lport_flogi_resp) { if (resp == fc_lport_flogi_resp) {
qedf->flogi_cnt++; qedf->flogi_cnt++;
if (qedf->flogi_pending >= QEDF_FLOGI_RETRY_CNT) {
schedule_delayed_work(&qedf->stag_work, 2);
return NULL;
}
qedf->flogi_pending++;
return fc_elsct_send(lport, did, fp, op, qedf_flogi_resp, return fc_elsct_send(lport, did, fp, op, qedf_flogi_resp,
arg, timeout); arg, timeout);
} }
...@@ -850,6 +856,7 @@ void qedf_ctx_soft_reset(struct fc_lport *lport) ...@@ -850,6 +856,7 @@ void qedf_ctx_soft_reset(struct fc_lport *lport)
qedf = lport_priv(lport); qedf = lport_priv(lport);
qedf->flogi_pending = 0;
/* For host reset, essentially do a soft link up/down */ /* For host reset, essentially do a soft link up/down */
atomic_set(&qedf->link_state, QEDF_LINK_DOWN); atomic_set(&qedf->link_state, QEDF_LINK_DOWN);
QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC,
...@@ -3197,6 +3204,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) ...@@ -3197,6 +3204,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
init_completion(&qedf->fipvlan_compl); init_completion(&qedf->fipvlan_compl);
mutex_init(&qedf->stats_mutex); mutex_init(&qedf->stats_mutex);
mutex_init(&qedf->flush_mutex); mutex_init(&qedf->flush_mutex);
qedf->flogi_pending = 0;
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO,
"QLogic FastLinQ FCoE Module qedf %s, " "QLogic FastLinQ FCoE Module qedf %s, "
...@@ -3227,6 +3235,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) ...@@ -3227,6 +3235,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
INIT_DELAYED_WORK(&qedf->link_update, qedf_handle_link_update); INIT_DELAYED_WORK(&qedf->link_update, qedf_handle_link_update);
INIT_DELAYED_WORK(&qedf->link_recovery, qedf_link_recovery); INIT_DELAYED_WORK(&qedf->link_recovery, qedf_link_recovery);
INIT_DELAYED_WORK(&qedf->grcdump_work, qedf_wq_grcdump); INIT_DELAYED_WORK(&qedf->grcdump_work, qedf_wq_grcdump);
INIT_DELAYED_WORK(&qedf->stag_work, qedf_stag_change_work);
qedf->fipvlan_retries = qedf_fipvlan_retries; qedf->fipvlan_retries = qedf_fipvlan_retries;
/* Set a default prio in case DCBX doesn't converge */ /* Set a default prio in case DCBX doesn't converge */
if (qedf_default_prio > -1) { if (qedf_default_prio > -1) {
...@@ -3762,6 +3771,20 @@ void qedf_get_protocol_tlv_data(void *dev, void *data) ...@@ -3762,6 +3771,20 @@ void qedf_get_protocol_tlv_data(void *dev, void *data)
fcoe->scsi_tsk_full = qedf->task_set_fulls; fcoe->scsi_tsk_full = qedf->task_set_fulls;
} }
/* Deferred work function to perform soft context reset on STAG change */
void qedf_stag_change_work(struct work_struct *work)
{
struct qedf_ctx *qedf =
container_of(work, struct qedf_ctx, stag_work.work);
if (!qedf) {
QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
return;
}
QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n");
qedf_ctx_soft_reset(qedf->lport);
}
static void qedf_shutdown(struct pci_dev *pdev) static void qedf_shutdown(struct pci_dev *pdev)
{ {
__qedf_remove(pdev, QEDF_MODE_NORMAL); __qedf_remove(pdev, QEDF_MODE_NORMAL);
......
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