|
@@ -29,6 +29,12 @@ BFA_TRC_FILE(FCS, RPORT);
|
|
|
static u32
|
|
|
bfa_fcs_rport_del_timeout = BFA_FCS_RPORT_DEF_DEL_TIMEOUT * 1000;
|
|
|
/* In millisecs */
|
|
|
+/*
|
|
|
+ * bfa_fcs_rport_max_logins is max count of bfa_fcs_rports
|
|
|
+ * whereas DEF_CFG_NUM_RPORTS is max count of bfa_rports
|
|
|
+ */
|
|
|
+static u32 bfa_fcs_rport_max_logins = BFA_FCS_MAX_RPORT_LOGINS;
|
|
|
+
|
|
|
/*
|
|
|
* forward declarations
|
|
|
*/
|
|
@@ -36,8 +42,10 @@ static struct bfa_fcs_rport_s *bfa_fcs_rport_alloc(
|
|
|
struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid);
|
|
|
static void bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport);
|
|
|
static void bfa_fcs_rport_hal_online(struct bfa_fcs_rport_s *rport);
|
|
|
-static void bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport);
|
|
|
-static void bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport);
|
|
|
+static void bfa_fcs_rport_fcs_online_action(struct bfa_fcs_rport_s *rport);
|
|
|
+static void bfa_fcs_rport_hal_online_action(struct bfa_fcs_rport_s *rport);
|
|
|
+static void bfa_fcs_rport_fcs_offline_action(struct bfa_fcs_rport_s *rport);
|
|
|
+static void bfa_fcs_rport_hal_offline_action(struct bfa_fcs_rport_s *rport);
|
|
|
static void bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport,
|
|
|
struct fc_logi_s *plogi);
|
|
|
static void bfa_fcs_rport_timeout(void *arg);
|
|
@@ -76,6 +84,7 @@ static void bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport,
|
|
|
static void bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport,
|
|
|
struct fchs_s *rx_fchs, u16 len);
|
|
|
static void bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport);
|
|
|
+static void bfa_fcs_rport_hal_offline(struct bfa_fcs_rport_s *rport);
|
|
|
|
|
|
static void bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport,
|
|
|
enum rport_event event);
|
|
@@ -87,6 +96,8 @@ static void bfa_fcs_rport_sm_plogi_retry(struct bfa_fcs_rport_s *rport,
|
|
|
enum rport_event event);
|
|
|
static void bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport,
|
|
|
enum rport_event event);
|
|
|
+static void bfa_fcs_rport_sm_fc4_fcs_online(struct bfa_fcs_rport_s *rport,
|
|
|
+ enum rport_event event);
|
|
|
static void bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport,
|
|
|
enum rport_event event);
|
|
|
static void bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport,
|
|
@@ -123,6 +134,10 @@ static void bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
|
|
|
enum rport_event event);
|
|
|
static void bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
|
|
|
enum rport_event event);
|
|
|
+static void bfa_fcs_rport_sm_fc4_off_delete(struct bfa_fcs_rport_s *rport,
|
|
|
+ enum rport_event event);
|
|
|
+static void bfa_fcs_rport_sm_delete_pending(struct bfa_fcs_rport_s *rport,
|
|
|
+ enum rport_event event);
|
|
|
|
|
|
static struct bfa_sm_table_s rport_sm_table[] = {
|
|
|
{BFA_SM(bfa_fcs_rport_sm_uninit), BFA_RPORT_UNINIT},
|
|
@@ -130,6 +145,7 @@ static struct bfa_sm_table_s rport_sm_table[] = {
|
|
|
{BFA_SM(bfa_fcs_rport_sm_plogiacc_sending), BFA_RPORT_ONLINE},
|
|
|
{BFA_SM(bfa_fcs_rport_sm_plogi_retry), BFA_RPORT_PLOGI_RETRY},
|
|
|
{BFA_SM(bfa_fcs_rport_sm_plogi), BFA_RPORT_PLOGI},
|
|
|
+ {BFA_SM(bfa_fcs_rport_sm_fc4_fcs_online), BFA_RPORT_ONLINE},
|
|
|
{BFA_SM(bfa_fcs_rport_sm_hal_online), BFA_RPORT_ONLINE},
|
|
|
{BFA_SM(bfa_fcs_rport_sm_online), BFA_RPORT_ONLINE},
|
|
|
{BFA_SM(bfa_fcs_rport_sm_nsquery_sending), BFA_RPORT_NSQUERY},
|
|
@@ -167,8 +183,8 @@ bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_RCVD:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
|
|
|
- bfa_fcs_rport_send_plogiacc(rport, NULL);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
|
|
|
+ bfa_fcs_rport_fcs_online_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
@@ -252,8 +268,8 @@ bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport,
|
|
|
|
|
|
switch (event) {
|
|
|
case RPSM_EVENT_FCXP_SENT:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
|
|
|
- bfa_fcs_rport_hal_online(rport);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
|
|
|
+ bfa_fcs_rport_fcs_online_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_DELETE:
|
|
@@ -348,9 +364,9 @@ bfa_fcs_rport_sm_plogi_retry(struct bfa_fcs_rport_s *rport,
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
|
|
|
bfa_timer_stop(&rport->timer);
|
|
|
- bfa_fcs_rport_hal_online(rport);
|
|
|
+ bfa_fcs_rport_fcs_online_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -370,9 +386,9 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
|
|
|
switch (event) {
|
|
|
case RPSM_EVENT_ACCEPTED:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
|
|
|
rport->plogi_retries = 0;
|
|
|
- bfa_fcs_rport_hal_online(rport);
|
|
|
+ bfa_fcs_rport_fcs_online_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_LOGO_RCVD:
|
|
@@ -397,6 +413,7 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
BFA_FCS_RETRY_TIMEOUT);
|
|
|
} else {
|
|
|
bfa_stats(rport->port, rport_del_max_plogi_retry);
|
|
|
+ rport->old_pid = rport->pid;
|
|
|
rport->pid = 0;
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
|
|
|
bfa_timer_start(rport->fcs->bfa, &rport->timer,
|
|
@@ -443,13 +460,77 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
|
|
|
bfa_fcxp_discard(rport->fcxp);
|
|
|
- bfa_fcs_rport_hal_online(rport);
|
|
|
+ bfa_fcs_rport_fcs_online_action(rport);
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ bfa_sm_fault(rport->fcs, event);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/*
|
|
|
+ * PLOGI is done. Await bfa_fcs_itnim to ascertain the scsi function
|
|
|
+ */
|
|
|
+static void
|
|
|
+bfa_fcs_rport_sm_fc4_fcs_online(struct bfa_fcs_rport_s *rport,
|
|
|
+ enum rport_event event)
|
|
|
+{
|
|
|
+ bfa_trc(rport->fcs, rport->pwwn);
|
|
|
+ bfa_trc(rport->fcs, rport->pid);
|
|
|
+ bfa_trc(rport->fcs, event);
|
|
|
+
|
|
|
+ switch (event) {
|
|
|
+ case RPSM_EVENT_FC4_FCS_ONLINE:
|
|
|
+ if (rport->scsi_function == BFA_RPORT_INITIATOR) {
|
|
|
+ if (!BFA_FCS_PID_IS_WKA(rport->pid))
|
|
|
+ bfa_fcs_rpf_rport_online(rport);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_online);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!rport->bfa_rport)
|
|
|
+ rport->bfa_rport =
|
|
|
+ bfa_rport_create(rport->fcs->bfa, rport);
|
|
|
+
|
|
|
+ if (rport->bfa_rport) {
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
|
|
|
+ bfa_fcs_rport_hal_online(rport);
|
|
|
+ } else {
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RPSM_EVENT_PLOGI_RCVD:
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
+ rport->plogi_pending = BFA_TRUE;
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RPSM_EVENT_PLOGI_COMP:
|
|
|
+ case RPSM_EVENT_LOGO_IMP:
|
|
|
+ case RPSM_EVENT_ADDRESS_CHANGE:
|
|
|
+ case RPSM_EVENT_SCN:
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RPSM_EVENT_LOGO_RCVD:
|
|
|
+ case RPSM_EVENT_PRLO_RCVD:
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RPSM_EVENT_DELETE:
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
bfa_sm_fault(rport->fcs, event);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -468,41 +549,34 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport,
|
|
|
switch (event) {
|
|
|
case RPSM_EVENT_HCB_ONLINE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_online);
|
|
|
- bfa_fcs_rport_online_action(rport);
|
|
|
+ bfa_fcs_rport_hal_online_action(rport);
|
|
|
break;
|
|
|
|
|
|
- case RPSM_EVENT_PRLO_RCVD:
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
|
break;
|
|
|
|
|
|
+ case RPSM_EVENT_PRLO_RCVD:
|
|
|
case RPSM_EVENT_LOGO_RCVD:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv);
|
|
|
- bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
+ case RPSM_EVENT_SCN:
|
|
|
case RPSM_EVENT_LOGO_IMP:
|
|
|
case RPSM_EVENT_ADDRESS_CHANGE:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline);
|
|
|
- bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_RCVD:
|
|
|
rport->plogi_pending = BFA_TRUE;
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline);
|
|
|
- bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_DELETE:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend);
|
|
|
- bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
|
|
|
- break;
|
|
|
-
|
|
|
- case RPSM_EVENT_SCN:
|
|
|
- /*
|
|
|
- * @todo
|
|
|
- * Ignore SCN - PLOGI just completed, FC-4 login should detect
|
|
|
- * device failures.
|
|
|
- */
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -537,18 +611,18 @@ bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
case RPSM_EVENT_LOGO_IMP:
|
|
|
case RPSM_EVENT_ADDRESS_CHANGE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_DELETE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_LOGO_RCVD:
|
|
|
case RPSM_EVENT_PRLO_RCVD:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
@@ -579,7 +653,7 @@ bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport,
|
|
|
case RPSM_EVENT_DELETE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
|
|
|
bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_SCN:
|
|
@@ -592,24 +666,16 @@ bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport,
|
|
|
case RPSM_EVENT_PRLO_RCVD:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
|
|
|
bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_LOGO_IMP:
|
|
|
- rport->pid = 0;
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
|
|
|
- bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
- bfa_timer_start(rport->fcs->bfa, &rport->timer,
|
|
|
- bfa_fcs_rport_timeout, rport,
|
|
|
- bfa_fcs_rport_del_timeout);
|
|
|
- break;
|
|
|
-
|
|
|
case RPSM_EVENT_PLOGI_RCVD:
|
|
|
case RPSM_EVENT_ADDRESS_CHANGE:
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -642,14 +708,14 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
bfa_fcs_rport_send_nsdisc(rport, NULL);
|
|
|
} else {
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_DELETE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
|
|
|
bfa_fcxp_discard(rport->fcxp);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_SCN:
|
|
@@ -659,7 +725,7 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
case RPSM_EVENT_PRLO_RCVD:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
|
|
|
bfa_fcxp_discard(rport->fcxp);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
@@ -668,7 +734,7 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
case RPSM_EVENT_LOGO_IMP:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
bfa_fcxp_discard(rport->fcxp);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -696,21 +762,21 @@ bfa_fcs_rport_sm_adisc_sending(struct bfa_fcs_rport_s *rport,
|
|
|
case RPSM_EVENT_DELETE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
|
|
|
bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_LOGO_IMP:
|
|
|
case RPSM_EVENT_ADDRESS_CHANGE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_LOGO_RCVD:
|
|
|
case RPSM_EVENT_PRLO_RCVD:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
|
|
|
bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_SCN:
|
|
@@ -719,7 +785,7 @@ bfa_fcs_rport_sm_adisc_sending(struct bfa_fcs_rport_s *rport,
|
|
|
case RPSM_EVENT_PLOGI_RCVD:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -756,13 +822,13 @@ bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
case RPSM_EVENT_FAILED:
|
|
|
case RPSM_EVENT_ADDRESS_CHANGE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_DELETE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
|
|
|
bfa_fcxp_discard(rport->fcxp);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_SCN:
|
|
@@ -774,14 +840,14 @@ bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
case RPSM_EVENT_LOGO_IMP:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
|
|
|
bfa_fcxp_discard(rport->fcxp);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_LOGO_RCVD:
|
|
|
case RPSM_EVENT_PRLO_RCVD:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
|
|
|
bfa_fcxp_discard(rport->fcxp);
|
|
|
- bfa_fcs_rport_offline_action(rport);
|
|
|
+ bfa_fcs_rport_hal_offline_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -803,13 +869,19 @@ bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport,
|
|
|
switch (event) {
|
|
|
case RPSM_EVENT_FC4_OFFLINE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv);
|
|
|
- bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
|
|
|
+ bfa_fcs_rport_hal_offline(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_DELETE:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
|
|
|
+ if (rport->pid && (rport->prlo == BFA_TRUE))
|
|
|
+ bfa_fcs_rport_send_prlo_acc(rport);
|
|
|
+ if (rport->pid && (rport->prlo == BFA_FALSE))
|
|
|
+ bfa_fcs_rport_send_logo_acc(rport);
|
|
|
+
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_off_delete);
|
|
|
break;
|
|
|
|
|
|
+ case RPSM_EVENT_HCB_ONLINE:
|
|
|
case RPSM_EVENT_LOGO_RCVD:
|
|
|
case RPSM_EVENT_PRLO_RCVD:
|
|
|
case RPSM_EVENT_ADDRESS_CHANGE:
|
|
@@ -835,7 +907,20 @@ bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport,
|
|
|
switch (event) {
|
|
|
case RPSM_EVENT_FC4_OFFLINE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend);
|
|
|
- bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
|
|
|
+ bfa_fcs_rport_hal_offline(rport);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RPSM_EVENT_LOGO_RCVD:
|
|
|
+ bfa_fcs_rport_send_logo_acc(rport);
|
|
|
+ case RPSM_EVENT_PRLO_RCVD:
|
|
|
+ if (rport->prlo == BFA_TRUE)
|
|
|
+ bfa_fcs_rport_send_prlo_acc(rport);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_off_delete);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RPSM_EVENT_HCB_ONLINE:
|
|
|
+ case RPSM_EVENT_DELETE:
|
|
|
+ /* Rport is being deleted */
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -857,13 +942,23 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport,
|
|
|
switch (event) {
|
|
|
case RPSM_EVENT_FC4_OFFLINE:
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline);
|
|
|
- bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
|
|
|
+ bfa_fcs_rport_hal_offline(rport);
|
|
|
break;
|
|
|
|
|
|
- case RPSM_EVENT_SCN:
|
|
|
- case RPSM_EVENT_LOGO_IMP:
|
|
|
case RPSM_EVENT_LOGO_RCVD:
|
|
|
+ /*
|
|
|
+ * Rport is going offline. Just ack the logo
|
|
|
+ */
|
|
|
+ bfa_fcs_rport_send_logo_acc(rport);
|
|
|
+ break;
|
|
|
+
|
|
|
case RPSM_EVENT_PRLO_RCVD:
|
|
|
+ bfa_fcs_rport_send_prlo_acc(rport);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RPSM_EVENT_HCB_ONLINE:
|
|
|
+ case RPSM_EVENT_SCN:
|
|
|
+ case RPSM_EVENT_LOGO_IMP:
|
|
|
case RPSM_EVENT_ADDRESS_CHANGE:
|
|
|
/*
|
|
|
* rport is already going offline.
|
|
@@ -907,24 +1002,23 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport,
|
|
|
*/
|
|
|
|
|
|
case RPSM_EVENT_ADDRESS_CHANGE:
|
|
|
- if (bfa_fcs_lport_is_online(rport->port)) {
|
|
|
- if (bfa_fcs_fabric_is_switched(rport->port->fabric)) {
|
|
|
- bfa_sm_set_state(rport,
|
|
|
- bfa_fcs_rport_sm_nsdisc_sending);
|
|
|
- rport->ns_retries = 0;
|
|
|
- bfa_fcs_rport_send_nsdisc(rport, NULL);
|
|
|
- } else {
|
|
|
- bfa_sm_set_state(rport,
|
|
|
- bfa_fcs_rport_sm_plogi_sending);
|
|
|
- rport->plogi_retries = 0;
|
|
|
- bfa_fcs_rport_send_plogi(rport, NULL);
|
|
|
- }
|
|
|
- } else {
|
|
|
+ if (!bfa_fcs_lport_is_online(rport->port)) {
|
|
|
rport->pid = 0;
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
|
|
|
bfa_timer_start(rport->fcs->bfa, &rport->timer,
|
|
|
bfa_fcs_rport_timeout, rport,
|
|
|
bfa_fcs_rport_del_timeout);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (bfa_fcs_fabric_is_switched(rport->port->fabric)) {
|
|
|
+ bfa_sm_set_state(rport,
|
|
|
+ bfa_fcs_rport_sm_nsdisc_sending);
|
|
|
+ rport->ns_retries = 0;
|
|
|
+ bfa_fcs_rport_send_nsdisc(rport, NULL);
|
|
|
+ } else {
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending);
|
|
|
+ rport->plogi_retries = 0;
|
|
|
+ bfa_fcs_rport_send_plogi(rport, NULL);
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -1001,7 +1095,11 @@ bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport,
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_DELETE:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending);
|
|
|
+ if (rport->pid && (rport->prlo == BFA_TRUE))
|
|
|
+ bfa_fcs_rport_send_prlo_acc(rport);
|
|
|
+ if (rport->pid && (rport->prlo == BFA_FALSE))
|
|
|
+ bfa_fcs_rport_send_logo_acc(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_LOGO_IMP:
|
|
@@ -1040,7 +1138,14 @@ bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport,
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_LOGO_RCVD:
|
|
|
+ bfa_fcs_rport_send_logo_acc(rport);
|
|
|
case RPSM_EVENT_PRLO_RCVD:
|
|
|
+ if (rport->prlo == BFA_TRUE)
|
|
|
+ bfa_fcs_rport_send_prlo_acc(rport);
|
|
|
+
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending);
|
|
|
+ break;
|
|
|
+
|
|
|
case RPSM_EVENT_ADDRESS_CHANGE:
|
|
|
break;
|
|
|
|
|
@@ -1072,7 +1177,11 @@ bfa_fcs_rport_sm_logo_sending(struct bfa_fcs_rport_s *rport,
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_LOGO_RCVD:
|
|
|
+ bfa_fcs_rport_send_logo_acc(rport);
|
|
|
case RPSM_EVENT_PRLO_RCVD:
|
|
|
+ if (rport->prlo == BFA_TRUE)
|
|
|
+ bfa_fcs_rport_send_prlo_acc(rport);
|
|
|
+
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
|
|
|
bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
bfa_fcs_rport_free(rport);
|
|
@@ -1126,9 +1235,9 @@ bfa_fcs_rport_sm_offline(struct bfa_fcs_rport_s *rport, enum rport_event event)
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
|
|
|
bfa_timer_stop(&rport->timer);
|
|
|
- bfa_fcs_rport_hal_online(rport);
|
|
|
+ bfa_fcs_rport_fcs_online_action(rport);
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_SEND:
|
|
@@ -1190,9 +1299,9 @@ bfa_fcs_rport_sm_nsdisc_sending(struct bfa_fcs_rport_s *rport,
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
|
|
|
bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
|
|
|
- bfa_fcs_rport_hal_online(rport);
|
|
|
+ bfa_fcs_rport_fcs_online_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -1254,9 +1363,9 @@ bfa_fcs_rport_sm_nsdisc_retry(struct bfa_fcs_rport_s *rport,
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
|
|
|
bfa_timer_stop(&rport->timer);
|
|
|
- bfa_fcs_rport_hal_online(rport);
|
|
|
+ bfa_fcs_rport_fcs_online_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -1296,6 +1405,7 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
|
|
|
bfa_fcs_rport_sm_nsdisc_sending);
|
|
|
bfa_fcs_rport_send_nsdisc(rport, NULL);
|
|
|
} else {
|
|
|
+ rport->old_pid = rport->pid;
|
|
|
rport->pid = 0;
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
|
|
|
bfa_timer_start(rport->fcs->bfa, &rport->timer,
|
|
@@ -1343,9 +1453,9 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
|
|
|
break;
|
|
|
|
|
|
case RPSM_EVENT_PLOGI_COMP:
|
|
|
- bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
|
|
|
bfa_fcxp_discard(rport->fcxp);
|
|
|
- bfa_fcs_rport_hal_online(rport);
|
|
|
+ bfa_fcs_rport_fcs_online_action(rport);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -1353,7 +1463,63 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * Rport needs to be deleted
|
|
|
+ * waiting for ITNIM clean up to finish
|
|
|
+ */
|
|
|
+static void
|
|
|
+bfa_fcs_rport_sm_fc4_off_delete(struct bfa_fcs_rport_s *rport,
|
|
|
+ enum rport_event event)
|
|
|
+{
|
|
|
+ bfa_trc(rport->fcs, rport->pwwn);
|
|
|
+ bfa_trc(rport->fcs, rport->pid);
|
|
|
+ bfa_trc(rport->fcs, event);
|
|
|
|
|
|
+ switch (event) {
|
|
|
+ case RPSM_EVENT_FC4_OFFLINE:
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending);
|
|
|
+ bfa_fcs_rport_hal_offline(rport);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RPSM_EVENT_DELETE:
|
|
|
+ case RPSM_EVENT_PLOGI_RCVD:
|
|
|
+ /* Ignore these events */
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ bfa_sm_fault(rport->fcs, event);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/*
|
|
|
+ * RPort needs to be deleted
|
|
|
+ * waiting for BFA/FW to finish current processing
|
|
|
+ */
|
|
|
+static void
|
|
|
+bfa_fcs_rport_sm_delete_pending(struct bfa_fcs_rport_s *rport,
|
|
|
+ enum rport_event event)
|
|
|
+{
|
|
|
+ bfa_trc(rport->fcs, rport->pwwn);
|
|
|
+ bfa_trc(rport->fcs, rport->pid);
|
|
|
+ bfa_trc(rport->fcs, event);
|
|
|
+
|
|
|
+ switch (event) {
|
|
|
+ case RPSM_EVENT_HCB_OFFLINE:
|
|
|
+ bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
|
|
|
+ bfa_fcs_rport_free(rport);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RPSM_EVENT_DELETE:
|
|
|
+ case RPSM_EVENT_LOGO_IMP:
|
|
|
+ case RPSM_EVENT_PLOGI_RCVD:
|
|
|
+ /* Ignore these events */
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ bfa_sm_fault(rport->fcs, event);
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
/*
|
|
|
* fcs_rport_private FCS RPORT provate functions
|
|
@@ -1370,10 +1536,11 @@ bfa_fcs_rport_send_plogi(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|
|
|
|
|
bfa_trc(rport->fcs, rport->pwwn);
|
|
|
|
|
|
- fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = fcxp_alloced ? fcxp_alloced :
|
|
|
+ bfa_fcs_fcxp_alloc(port->fcs, BFA_TRUE);
|
|
|
if (!fcxp) {
|
|
|
bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
|
|
|
- bfa_fcs_rport_send_plogi, rport);
|
|
|
+ bfa_fcs_rport_send_plogi, rport, BFA_TRUE);
|
|
|
return;
|
|
|
}
|
|
|
rport->fcxp = fcxp;
|
|
@@ -1490,10 +1657,11 @@ bfa_fcs_rport_send_plogiacc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|
|
bfa_trc(rport->fcs, rport->pwwn);
|
|
|
bfa_trc(rport->fcs, rport->reply_oxid);
|
|
|
|
|
|
- fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = fcxp_alloced ? fcxp_alloced :
|
|
|
+ bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE);
|
|
|
if (!fcxp) {
|
|
|
bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
|
|
|
- bfa_fcs_rport_send_plogiacc, rport);
|
|
|
+ bfa_fcs_rport_send_plogiacc, rport, BFA_FALSE);
|
|
|
return;
|
|
|
}
|
|
|
rport->fcxp = fcxp;
|
|
@@ -1522,10 +1690,11 @@ bfa_fcs_rport_send_adisc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|
|
|
|
|
bfa_trc(rport->fcs, rport->pwwn);
|
|
|
|
|
|
- fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = fcxp_alloced ? fcxp_alloced :
|
|
|
+ bfa_fcs_fcxp_alloc(port->fcs, BFA_TRUE);
|
|
|
if (!fcxp) {
|
|
|
bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
|
|
|
- bfa_fcs_rport_send_adisc, rport);
|
|
|
+ bfa_fcs_rport_send_adisc, rport, BFA_TRUE);
|
|
|
return;
|
|
|
}
|
|
|
rport->fcxp = fcxp;
|
|
@@ -1585,10 +1754,11 @@ bfa_fcs_rport_send_nsdisc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|
|
|
|
|
bfa_trc(rport->fcs, rport->pid);
|
|
|
|
|
|
- fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = fcxp_alloced ? fcxp_alloced :
|
|
|
+ bfa_fcs_fcxp_alloc(port->fcs, BFA_TRUE);
|
|
|
if (!fcxp) {
|
|
|
bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
|
|
|
- bfa_fcs_rport_send_nsdisc, rport);
|
|
|
+ bfa_fcs_rport_send_nsdisc, rport, BFA_TRUE);
|
|
|
return;
|
|
|
}
|
|
|
rport->fcxp = fcxp;
|
|
@@ -1741,10 +1911,11 @@ bfa_fcs_rport_send_logo(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|
|
|
|
|
port = rport->port;
|
|
|
|
|
|
- fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = fcxp_alloced ? fcxp_alloced :
|
|
|
+ bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE);
|
|
|
if (!fcxp) {
|
|
|
bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
|
|
|
- bfa_fcs_rport_send_logo, rport);
|
|
|
+ bfa_fcs_rport_send_logo, rport, BFA_FALSE);
|
|
|
return;
|
|
|
}
|
|
|
rport->fcxp = fcxp;
|
|
@@ -1778,7 +1949,7 @@ bfa_fcs_rport_send_logo_acc(void *rport_cbarg)
|
|
|
|
|
|
port = rport->port;
|
|
|
|
|
|
- fcxp = bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE);
|
|
|
if (!fcxp)
|
|
|
return;
|
|
|
|
|
@@ -1849,7 +2020,7 @@ bfa_fcs_rport_process_prli(struct bfa_fcs_rport_s *rport,
|
|
|
bfa_fcs_itnim_is_initiator(rport->itnim);
|
|
|
}
|
|
|
|
|
|
- fcxp = bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE);
|
|
|
if (!fcxp)
|
|
|
return;
|
|
|
|
|
@@ -1886,7 +2057,7 @@ bfa_fcs_rport_process_rpsc(struct bfa_fcs_rport_s *rport,
|
|
|
|
|
|
speeds.port_op_speed = fc_bfa_speed_to_rpsc_operspeed(pport_attr.speed);
|
|
|
|
|
|
- fcxp = bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE);
|
|
|
if (!fcxp)
|
|
|
return;
|
|
|
|
|
@@ -1920,7 +2091,7 @@ bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport,
|
|
|
*/
|
|
|
if (bfa_fcs_itnim_get_online_state(rport->itnim) == BFA_STATUS_OK) {
|
|
|
|
|
|
- fcxp = bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE);
|
|
|
if (!fcxp)
|
|
|
return;
|
|
|
|
|
@@ -1957,6 +2128,15 @@ bfa_fcs_rport_hal_online(struct bfa_fcs_rport_s *rport)
|
|
|
bfa_rport_online(rport->bfa_rport, &rport_info);
|
|
|
}
|
|
|
|
|
|
+static void
|
|
|
+bfa_fcs_rport_hal_offline(struct bfa_fcs_rport_s *rport)
|
|
|
+{
|
|
|
+ if (rport->bfa_rport)
|
|
|
+ bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
|
|
|
+ else
|
|
|
+ bfa_cb_rport_offline(rport);
|
|
|
+}
|
|
|
+
|
|
|
static struct bfa_fcs_rport_s *
|
|
|
bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid)
|
|
|
{
|
|
@@ -1967,6 +2147,11 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid)
|
|
|
/*
|
|
|
* allocate rport
|
|
|
*/
|
|
|
+ if (fcs->num_rport_logins >= bfa_fcs_rport_max_logins) {
|
|
|
+ bfa_trc(fcs, rpid);
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+
|
|
|
if (bfa_fcb_rport_alloc(fcs->bfad, &rport, &rport_drv)
|
|
|
!= BFA_STATUS_OK) {
|
|
|
bfa_trc(fcs, rpid);
|
|
@@ -1981,16 +2166,9 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid)
|
|
|
rport->rp_drv = rport_drv;
|
|
|
rport->pid = rpid;
|
|
|
rport->pwwn = pwwn;
|
|
|
+ rport->old_pid = 0;
|
|
|
|
|
|
- /*
|
|
|
- * allocate BFA rport
|
|
|
- */
|
|
|
- rport->bfa_rport = bfa_rport_create(port->fcs->bfa, rport);
|
|
|
- if (!rport->bfa_rport) {
|
|
|
- bfa_trc(fcs, rpid);
|
|
|
- kfree(rport_drv);
|
|
|
- return NULL;
|
|
|
- }
|
|
|
+ rport->bfa_rport = NULL;
|
|
|
|
|
|
/*
|
|
|
* allocate FC-4s
|
|
@@ -2001,14 +2179,13 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid)
|
|
|
rport->itnim = bfa_fcs_itnim_create(rport);
|
|
|
if (!rport->itnim) {
|
|
|
bfa_trc(fcs, rpid);
|
|
|
- bfa_sm_send_event(rport->bfa_rport,
|
|
|
- BFA_RPORT_SM_DELETE);
|
|
|
kfree(rport_drv);
|
|
|
return NULL;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
bfa_fcs_lport_add_rport(port, rport);
|
|
|
+ fcs->num_rport_logins++;
|
|
|
|
|
|
bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
|
|
|
|
|
@@ -2024,20 +2201,28 @@ static void
|
|
|
bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport)
|
|
|
{
|
|
|
struct bfa_fcs_lport_s *port = rport->port;
|
|
|
+ struct bfa_fcs_s *fcs = port->fcs;
|
|
|
|
|
|
/*
|
|
|
* - delete FC-4s
|
|
|
* - delete BFA rport
|
|
|
* - remove from queue of rports
|
|
|
*/
|
|
|
+ rport->plogi_pending = BFA_FALSE;
|
|
|
+
|
|
|
if (bfa_fcs_lport_is_initiator(port)) {
|
|
|
bfa_fcs_itnim_delete(rport->itnim);
|
|
|
if (rport->pid != 0 && !BFA_FCS_PID_IS_WKA(rport->pid))
|
|
|
bfa_fcs_rpf_rport_offline(rport);
|
|
|
}
|
|
|
|
|
|
- bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_DELETE);
|
|
|
+ if (rport->bfa_rport) {
|
|
|
+ bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_DELETE);
|
|
|
+ rport->bfa_rport = NULL;
|
|
|
+ }
|
|
|
+
|
|
|
bfa_fcs_lport_del_rport(port, rport);
|
|
|
+ fcs->num_rport_logins--;
|
|
|
kfree(rport->rp_drv);
|
|
|
}
|
|
|
|
|
@@ -2071,7 +2256,18 @@ bfa_fcs_rport_aen_post(struct bfa_fcs_rport_s *rport,
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
-bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport)
|
|
|
+bfa_fcs_rport_fcs_online_action(struct bfa_fcs_rport_s *rport)
|
|
|
+{
|
|
|
+ if ((!rport->pid) || (!rport->pwwn)) {
|
|
|
+ bfa_trc(rport->fcs, rport->pid);
|
|
|
+ bfa_sm_fault(rport->fcs, rport->pid);
|
|
|
+ }
|
|
|
+
|
|
|
+ bfa_sm_send_event(rport->itnim, BFA_FCS_ITNIM_SM_FCS_ONLINE);
|
|
|
+}
|
|
|
+
|
|
|
+static void
|
|
|
+bfa_fcs_rport_hal_online_action(struct bfa_fcs_rport_s *rport)
|
|
|
{
|
|
|
struct bfa_fcs_lport_s *port = rport->port;
|
|
|
struct bfad_s *bfad = (struct bfad_s *)port->fcs->bfad;
|
|
@@ -2086,7 +2282,7 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport)
|
|
|
}
|
|
|
|
|
|
if (bfa_fcs_lport_is_initiator(port)) {
|
|
|
- bfa_fcs_itnim_rport_online(rport->itnim);
|
|
|
+ bfa_fcs_itnim_brp_online(rport->itnim);
|
|
|
if (!BFA_FCS_PID_IS_WKA(rport->pid))
|
|
|
bfa_fcs_rpf_rport_online(rport);
|
|
|
};
|
|
@@ -2102,15 +2298,28 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport)
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
-bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport)
|
|
|
+bfa_fcs_rport_fcs_offline_action(struct bfa_fcs_rport_s *rport)
|
|
|
+{
|
|
|
+ if (!BFA_FCS_PID_IS_WKA(rport->pid))
|
|
|
+ bfa_fcs_rpf_rport_offline(rport);
|
|
|
+
|
|
|
+ bfa_fcs_itnim_rport_offline(rport->itnim);
|
|
|
+}
|
|
|
+
|
|
|
+static void
|
|
|
+bfa_fcs_rport_hal_offline_action(struct bfa_fcs_rport_s *rport)
|
|
|
{
|
|
|
struct bfa_fcs_lport_s *port = rport->port;
|
|
|
struct bfad_s *bfad = (struct bfad_s *)port->fcs->bfad;
|
|
|
char lpwwn_buf[BFA_STRING_32];
|
|
|
char rpwwn_buf[BFA_STRING_32];
|
|
|
|
|
|
+ if (!rport->bfa_rport) {
|
|
|
+ bfa_fcs_rport_fcs_offline_action(rport);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
rport->stats.offlines++;
|
|
|
- rport->plogi_pending = BFA_FALSE;
|
|
|
|
|
|
wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port));
|
|
|
wwn2str(rpwwn_buf, rport->pwwn);
|
|
@@ -2340,7 +2549,6 @@ bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport)
|
|
|
bfa_sm_send_event(rport, RPSM_EVENT_SCN);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/*
|
|
|
* brief
|
|
|
* This routine BFA callback for bfa_rport_online() call.
|
|
@@ -2508,7 +2716,7 @@ bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport)
|
|
|
|
|
|
bfa_trc(rport->fcs, rport->pid);
|
|
|
|
|
|
- fcxp = bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE);
|
|
|
if (!fcxp)
|
|
|
return;
|
|
|
len = fc_prlo_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
|
|
@@ -2534,7 +2742,7 @@ bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
|
|
|
|
|
|
bfa_trc(rport->fcs, rx_fchs->s_id);
|
|
|
|
|
|
- fcxp = bfa_fcs_fcxp_alloc(rport->fcs);
|
|
|
+ fcxp = bfa_fcs_fcxp_alloc(rport->fcs, BFA_FALSE);
|
|
|
if (!fcxp)
|
|
|
return;
|
|
|
|
|
@@ -2582,6 +2790,17 @@ bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id)
|
|
|
bfa_sm_send_event(rport, RPSM_EVENT_PRLO_RCVD);
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * Called by BFAD to set the max limit on number of bfa_fcs_rport allocation
|
|
|
+ * which limits number of concurrent logins to remote ports
|
|
|
+ */
|
|
|
+void
|
|
|
+bfa_fcs_rport_set_max_logins(u32 max_logins)
|
|
|
+{
|
|
|
+ if (max_logins > 0)
|
|
|
+ bfa_fcs_rport_max_logins = max_logins;
|
|
|
+}
|
|
|
+
|
|
|
void
|
|
|
bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
|
|
|
struct bfa_rport_attr_s *rport_attr)
|
|
@@ -2605,9 +2824,11 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
|
|
|
rport_attr->curr_speed = rport->rpf.rpsc_speed;
|
|
|
rport_attr->assigned_speed = rport->rpf.assigned_speed;
|
|
|
|
|
|
- qos_attr.qos_priority = rport->bfa_rport->qos_attr.qos_priority;
|
|
|
- qos_attr.qos_flow_id =
|
|
|
- cpu_to_be32(rport->bfa_rport->qos_attr.qos_flow_id);
|
|
|
+ if (rport->bfa_rport) {
|
|
|
+ qos_attr.qos_priority = rport->bfa_rport->qos_attr.qos_priority;
|
|
|
+ qos_attr.qos_flow_id =
|
|
|
+ cpu_to_be32(rport->bfa_rport->qos_attr.qos_flow_id);
|
|
|
+ }
|
|
|
rport_attr->qos_attr = qos_attr;
|
|
|
|
|
|
rport_attr->trl_enforced = BFA_FALSE;
|
|
@@ -2940,10 +3161,11 @@ bfa_fcs_rpf_send_rpsc2(void *rpf_cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|
|
|
|
|
bfa_trc(rport->fcs, rport->pwwn);
|
|
|
|
|
|
- fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
|
|
|
+ fcxp = fcxp_alloced ? fcxp_alloced :
|
|
|
+ bfa_fcs_fcxp_alloc(port->fcs, BFA_TRUE);
|
|
|
if (!fcxp) {
|
|
|
bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rpf->fcxp_wqe,
|
|
|
- bfa_fcs_rpf_send_rpsc2, rpf);
|
|
|
+ bfa_fcs_rpf_send_rpsc2, rpf, BFA_TRUE);
|
|
|
return;
|
|
|
}
|
|
|
rpf->fcxp = fcxp;
|