Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4de067e

Browse files
Quinn Tranmartinkpetersen
authored andcommitted
scsi: qla2xxx: edif: Add N2N support for EDIF
For EDIF + N2N to work, firmware 9.8 or later is required. The driver will pause after PLOGI to allow app to authenticate. Once authentication completes, app will tell driver to do PRLI. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Quinn Tran <[email protected]> Signed-off-by: Nilesh Javali <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 310e69e commit 4de067e

File tree

11 files changed

+234
-66
lines changed

11 files changed

+234
-66
lines changed

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,6 +2633,7 @@ typedef struct fc_port {
26332633
uint64_t rx_bytes;
26342634
uint8_t non_secured_login;
26352635
uint8_t auth_state;
2636+
uint16_t authok:1;
26362637
uint16_t rekey_cnt;
26372638
struct list_head edif_indx_list;
26382639
spinlock_t indx_list_lock;
@@ -4023,6 +4024,7 @@ struct qla_hw_data {
40234024
uint32_t scm_enabled:1;
40244025
uint32_t edif_hw:1;
40254026
uint32_t edif_enabled:1;
4027+
uint32_t n2n_fw_acc_sec:1;
40264028
uint32_t plogi_template_valid:1;
40274029
uint32_t port_isolated:1;
40284030
} flags;
@@ -4720,6 +4722,7 @@ struct qla_hw_data {
47204722
struct list_head sadb_rx_index_list;
47214723
spinlock_t sadb_lock; /* protects list */
47224724
struct els_reject elsrej;
4725+
u8 edif_post_stop_cnt_down;
47234726
};
47244727

47254728
#define RX_ELS_SIZE (roundup(sizeof(struct enode) + ELS_MAX_PAYLOAD, SMP_CACHE_BYTES))

drivers/scsi/qla2xxx/qla_edif.c

Lines changed: 70 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -546,31 +546,47 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
546546
__func__);
547547
}
548548

549-
list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) {
550-
ql_dbg(ql_dbg_edif, vha, 0xf084,
551-
"%s: sess %p %8phC lid %#04x s_id %06x logout %d\n",
552-
__func__, fcport, fcport->port_name,
553-
fcport->loop_id, fcport->d_id.b24,
554-
fcport->logout_on_delete);
555-
556-
ql_dbg(ql_dbg_edif, vha, 0xf084,
557-
"keep %d els_logo %d disc state %d auth state %d stop state %d\n",
558-
fcport->keep_nport_handle,
559-
fcport->send_els_logo, fcport->disc_state,
560-
fcport->edif.auth_state, fcport->edif.app_stop);
561-
562-
if (atomic_read(&vha->loop_state) == LOOP_DOWN)
563-
break;
549+
if (N2N_TOPO(vha->hw)) {
550+
if (vha->hw->flags.n2n_fw_acc_sec)
551+
set_bit(N2N_LINK_RESET, &vha->dpc_flags);
552+
else
553+
set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
554+
qla2xxx_wake_dpc(vha);
555+
} else {
556+
list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) {
557+
ql_dbg(ql_dbg_edif, vha, 0xf084,
558+
"%s: sess %p %8phC lid %#04x s_id %06x logout %d\n",
559+
__func__, fcport, fcport->port_name,
560+
fcport->loop_id, fcport->d_id.b24,
561+
fcport->logout_on_delete);
562+
563+
ql_dbg(ql_dbg_edif, vha, 0xf084,
564+
"keep %d els_logo %d disc state %d auth state %d stop state %d\n",
565+
fcport->keep_nport_handle,
566+
fcport->send_els_logo, fcport->disc_state,
567+
fcport->edif.auth_state, fcport->edif.app_stop);
564568

565-
fcport->edif.app_started = 1;
566-
fcport->edif.app_stop = 0;
569+
if (atomic_read(&vha->loop_state) == LOOP_DOWN)
570+
break;
571+
if (!fcport->edif.secured_login)
572+
continue;
567573

568-
ql_dbg(ql_dbg_edif, vha, 0x911e,
569-
"%s wwpn %8phC calling qla_edif_reset_auth_wait\n",
570-
__func__, fcport->port_name);
571-
fcport->edif.app_sess_online = 1;
572-
qla_edif_reset_auth_wait(fcport, DSC_LOGIN_PEND, 0);
573-
qla_edif_sa_ctl_init(vha, fcport);
574+
fcport->edif.app_started = 1;
575+
if (fcport->edif.app_stop ||
576+
(fcport->disc_state != DSC_LOGIN_COMPLETE &&
577+
fcport->disc_state != DSC_LOGIN_PEND &&
578+
fcport->disc_state != DSC_DELETED)) {
579+
/* no activity */
580+
fcport->edif.app_stop = 0;
581+
582+
ql_dbg(ql_dbg_edif, vha, 0x911e,
583+
"%s wwpn %8phC calling qla_edif_reset_auth_wait\n",
584+
__func__, fcport->port_name);
585+
fcport->edif.app_sess_online = 1;
586+
qla_edif_reset_auth_wait(fcport, DSC_LOGIN_PEND, 0);
587+
}
588+
qla_edif_sa_ctl_init(vha, fcport);
589+
}
574590
}
575591

576592
if (vha->pur_cinfo.enode_flags != ENODE_ACTIVE) {
@@ -763,6 +779,7 @@ qla_edif_app_authok(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
763779

764780
SET_DID_STATUS(bsg_reply->result, DID_OK);
765781
appplogireply.prli_status = 1;
782+
fcport->edif.authok = 1;
766783
if (!(fcport->edif.rx_sa_set && fcport->edif.tx_sa_set)) {
767784
ql_dbg(ql_dbg_edif, vha, 0x911e,
768785
"%s: wwpn %8phC Both SA indexes has not been SET TX %d, RX %d.\n",
@@ -929,8 +946,9 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
929946
app_reply->ports[pcnt].remote_pid = fcport->d_id;
930947

931948
ql_dbg(ql_dbg_edif, vha, 0x2058,
932-
"Found FC_SP fcport - nn %8phN pn %8phN pcnt %d portid=%06x\n",
933-
fcport->node_name, fcport->port_name, pcnt, fcport->d_id.b24);
949+
"Found FC_SP fcport - nn %8phN pn %8phN pcnt %d portid=%06x secure %d.\n",
950+
fcport->node_name, fcport->port_name, pcnt,
951+
fcport->d_id.b24, fcport->edif.secured_login);
934952

935953
switch (fcport->edif.auth_state) {
936954
case VND_CMD_AUTH_STATE_ELS_RCVD:
@@ -2012,6 +2030,33 @@ qla_edb_getnext(scsi_qla_host_t *vha)
20122030
return edbnode;
20132031
}
20142032

2033+
void
2034+
qla_edif_timer(scsi_qla_host_t *vha)
2035+
{
2036+
struct qla_hw_data *ha = vha->hw;
2037+
2038+
if (!vha->vp_idx && N2N_TOPO(ha) && ha->flags.n2n_fw_acc_sec) {
2039+
if (vha->e_dbell.db_flags != EDB_ACTIVE &&
2040+
ha->edif_post_stop_cnt_down) {
2041+
ha->edif_post_stop_cnt_down--;
2042+
2043+
/*
2044+
* turn off auto 'Plogi Acc + secure=1' feature
2045+
* Set Add FW option[3]
2046+
* BIT_15, if.
2047+
*/
2048+
if (ha->edif_post_stop_cnt_down == 0) {
2049+
ql_dbg(ql_dbg_async, vha, 0x911d,
2050+
"%s chip reset to turn off PLOGI ACC + secure\n",
2051+
__func__);
2052+
set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
2053+
}
2054+
} else {
2055+
ha->edif_post_stop_cnt_down = 60;
2056+
}
2057+
}
2058+
}
2059+
20152060
/*
20162061
* app uses separate thread to read this. It'll wait until the doorbell
20172062
* is rung by the driver or the max wait time has expired

drivers/scsi/qla2xxx/qla_edif.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ struct enode {
129129
};
130130

131131
#define EDIF_SESSION_DOWN(_s) \
132-
(_s->disc_state == DSC_DELETE_PEND || \
132+
(qla_ini_mode_enabled(_s->vha) && (_s->disc_state == DSC_DELETE_PEND || \
133133
_s->disc_state == DSC_DELETED || \
134-
!_s->edif.app_sess_online)
134+
!_s->edif.app_sess_online))
135135

136136
#endif /* __QLA_EDIF_H */

drivers/scsi/qla2xxx/qla_fw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ struct els_entry_24xx {
810810
#define EPD_RX_XCHG (3 << 13)
811811
#define ECF_CLR_PASSTHRU_PEND BIT_12
812812
#define ECF_INCL_FRAME_HDR BIT_11
813+
#define ECF_SEC_LOGIN BIT_3
813814

814815
union {
815816
struct {

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,7 @@ void qla_enode_init(scsi_qla_host_t *vha);
990990
void qla_enode_stop(scsi_qla_host_t *vha);
991991
void qla_edif_flush_sa_ctl_lists(fc_port_t *fcport);
992992
void qla_edb_init(scsi_qla_host_t *vha);
993+
void qla_edif_timer(scsi_qla_host_t *vha);
993994
int qla28xx_start_scsi_edif(srb_t *sp);
994995
void qla24xx_sa_update_iocb(srb_t *sp, struct sa_update_28xx *sa_update_iocb);
995996
void qla24xx_sa_replace_iocb(srb_t *sp, struct sa_update_28xx *sa_update_iocb);

0 commit comments

Comments
 (0)