Skip to content

Commit 5d96483

Browse files
Quinn TranNicholas Bellinger
authored andcommitted
qla2xxx: Track I-T nexus as single fc_port struct
Current code merges qla_tgt_sess and fc_port structure into single fc_port structure representing same I-T nexus. Signed-off-by: Quinn Tran <[email protected]> Signed-off-by: Himanshu Madhani <[email protected]> [ bvanassche: fixed spelling of patch description ] Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 37cacc0 commit 5d96483

File tree

8 files changed

+310
-430
lines changed

8 files changed

+310
-430
lines changed

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1976,6 +1976,84 @@ struct mbx_entry {
19761976
uint8_t port_name[WWN_SIZE];
19771977
};
19781978

1979+
#ifndef IMMED_NOTIFY_TYPE
1980+
#define IMMED_NOTIFY_TYPE 0x0D /* Immediate notify entry. */
1981+
/*
1982+
* ISP queue - immediate notify entry structure definition.
1983+
* This is sent by the ISP to the Target driver.
1984+
* This IOCB would have report of events sent by the
1985+
* initiator, that needs to be handled by the target
1986+
* driver immediately.
1987+
*/
1988+
struct imm_ntfy_from_isp {
1989+
uint8_t entry_type; /* Entry type. */
1990+
uint8_t entry_count; /* Entry count. */
1991+
uint8_t sys_define; /* System defined. */
1992+
uint8_t entry_status; /* Entry Status. */
1993+
union {
1994+
struct {
1995+
uint32_t sys_define_2; /* System defined. */
1996+
target_id_t target;
1997+
uint16_t lun;
1998+
uint8_t target_id;
1999+
uint8_t reserved_1;
2000+
uint16_t status_modifier;
2001+
uint16_t status;
2002+
uint16_t task_flags;
2003+
uint16_t seq_id;
2004+
uint16_t srr_rx_id;
2005+
uint32_t srr_rel_offs;
2006+
uint16_t srr_ui;
2007+
#define SRR_IU_DATA_IN 0x1
2008+
#define SRR_IU_DATA_OUT 0x5
2009+
#define SRR_IU_STATUS 0x7
2010+
uint16_t srr_ox_id;
2011+
uint8_t reserved_2[28];
2012+
} isp2x;
2013+
struct {
2014+
uint32_t reserved;
2015+
uint16_t nport_handle;
2016+
uint16_t reserved_2;
2017+
uint16_t flags;
2018+
#define NOTIFY24XX_FLAGS_GLOBAL_TPRLO BIT_1
2019+
#define NOTIFY24XX_FLAGS_PUREX_IOCB BIT_0
2020+
uint16_t srr_rx_id;
2021+
uint16_t status;
2022+
uint8_t status_subcode;
2023+
uint8_t fw_handle;
2024+
uint32_t exchange_address;
2025+
uint32_t srr_rel_offs;
2026+
uint16_t srr_ui;
2027+
uint16_t srr_ox_id;
2028+
union {
2029+
struct {
2030+
uint8_t node_name[8];
2031+
} plogi; /* PLOGI/ADISC/PDISC */
2032+
struct {
2033+
/* PRLI word 3 bit 0-15 */
2034+
uint16_t wd3_lo;
2035+
uint8_t resv0[6];
2036+
} prli;
2037+
struct {
2038+
uint8_t port_id[3];
2039+
uint8_t resv1;
2040+
uint16_t nport_handle;
2041+
uint16_t resv2;
2042+
} req_els;
2043+
} u;
2044+
uint8_t port_name[8];
2045+
uint8_t resv3[3];
2046+
uint8_t vp_index;
2047+
uint32_t reserved_5;
2048+
uint8_t port_id[3];
2049+
uint8_t reserved_6;
2050+
} isp24;
2051+
} u;
2052+
uint16_t reserved_7;
2053+
uint16_t ox_id;
2054+
} __packed;
2055+
#endif
2056+
19792057
/*
19802058
* ISP request and response queue entry sizes
19812059
*/
@@ -2026,7 +2104,7 @@ typedef struct {
20262104
/*
20272105
* Fibre channel port type.
20282106
*/
2029-
typedef enum {
2107+
typedef enum {
20302108
FCT_UNKNOWN,
20312109
FCT_RSCN,
20322110
FCT_SWITCH,
@@ -2035,6 +2113,19 @@ typedef struct {
20352113
FCT_TARGET
20362114
} fc_port_type_t;
20372115

2116+
enum qlt_plogi_link_t {
2117+
QLT_PLOGI_LINK_SAME_WWN,
2118+
QLT_PLOGI_LINK_CONFLICT,
2119+
QLT_PLOGI_LINK_MAX
2120+
};
2121+
2122+
struct qlt_plogi_ack_t {
2123+
struct list_head list;
2124+
struct imm_ntfy_from_isp iocb;
2125+
port_id_t id;
2126+
int ref_count;
2127+
};
2128+
20382129
/*
20392130
* Fibre channel port structure.
20402131
*/
@@ -2048,6 +2139,25 @@ typedef struct fc_port {
20482139
uint16_t loop_id;
20492140
uint16_t old_loop_id;
20502141

2142+
unsigned int conf_compl_supported:1;
2143+
unsigned int deleted:2;
2144+
unsigned int local:1;
2145+
unsigned int logout_on_delete:1;
2146+
unsigned int keep_nport_handle:1;
2147+
unsigned int send_els_logo:1;
2148+
2149+
unsigned char logout_completed;
2150+
int generation;
2151+
2152+
struct se_session *se_sess;
2153+
struct kref sess_kref;
2154+
struct qla_tgt *tgt;
2155+
unsigned long expires;
2156+
struct list_head del_list_entry;
2157+
struct work_struct free_work;
2158+
2159+
struct qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX];
2160+
20512161
uint16_t tgt_id;
20522162
uint16_t old_tgt_id;
20532163

drivers/scsi/qla2xxx/qla_dfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused)
1818
scsi_qla_host_t *vha = s->private;
1919
struct qla_hw_data *ha = vha->hw;
2020
unsigned long flags;
21-
struct qla_tgt_sess *sess = NULL;
21+
struct fc_port *sess = NULL;
2222
struct qla_tgt *tgt= vha->vha_tgt.qla_tgt;
2323

2424
seq_printf(s, "%s\n",vha->host_str);
2525
if (tgt) {
2626
seq_printf(s, "Port ID Port Name Handle\n");
2727

2828
spin_lock_irqsave(&ha->tgt.sess_lock, flags);
29-
list_for_each_entry(sess, &tgt->sess_list, sess_list_entry)
29+
list_for_each_entry(sess, &vha->vp_fcports, list)
3030
seq_printf(s, "%02x:%02x:%02x %8phC %d\n",
3131
sess->d_id.b.domain, sess->d_id.b.area,
3232
sess->d_id.b.al_pa, sess->port_name,

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3352,12 +3352,6 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
33523352
"Unable to allocate fc remote port.\n");
33533353
return;
33543354
}
3355-
/*
3356-
* Create target mode FC NEXUS in qla_target.c if target mode is
3357-
* enabled..
3358-
*/
3359-
3360-
qlt_fc_port_added(vha, fcport);
33613355

33623356
spin_lock_irqsave(fcport->vha->host->host_lock, flags);
33633357
*((fc_port_t **)rport->dd_data) = fcport;
@@ -3407,12 +3401,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
34073401
reg_port:
34083402
if (qla_ini_mode_enabled(vha))
34093403
qla2x00_reg_remote_port(vha, fcport);
3410-
else {
3411-
/*
3412-
* Create target mode FC NEXUS in qla_target.c
3413-
*/
3414-
qlt_fc_port_added(vha, fcport);
3415-
}
34163404
}
34173405

34183406
/*

drivers/scsi/qla2xxx/qla_iocb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,7 @@ qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio)
22482248
logio->control_flags =
22492249
cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO);
22502250
if (!sp->fcport->tgt_session ||
2251-
!sp->fcport->tgt_session->keep_nport_handle)
2251+
!sp->fcport->keep_nport_handle)
22522252
logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT);
22532253
logio->nport_handle = cpu_to_le16(sp->fcport->loop_id);
22542254
logio->port_id[0] = sp->fcport->d_id.b.al_pa;

0 commit comments

Comments
 (0)