[SCSI] bnx2fc: Introduce interface structure for each vlan interface
Currently, bnx2fc has a hba structure that can work with only a single vlan interface. When there is a change in vlan id, it does not have the capability to switch to different vlan interface. To solve this problem, a new structure called 'interface' has been introduced, and each hba can now have multiple interfaces, one per vlan id. Most of the patch is a moving the interface specific fields from hba to the interface structure, and appropriately modifying the dereferences. A list of interfaces (if_list) is maintained along with adapter list. During a create call, the interface structure is allocated and added to if_list and deleted & freed on a destroy call. Link events are propagated to all interfaces belonging to the hba. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
parent
f6e76055ba
commit
aea71a0249
6 changed files with 475 additions and 503 deletions
|
@ -153,18 +153,13 @@ struct bnx2fc_percpu_s {
|
|||
};
|
||||
|
||||
struct bnx2fc_hba {
|
||||
struct list_head link;
|
||||
struct list_head list;
|
||||
struct cnic_dev *cnic;
|
||||
struct pci_dev *pcidev;
|
||||
struct net_device *netdev;
|
||||
struct net_device *phys_dev;
|
||||
unsigned long reg_with_cnic;
|
||||
#define BNX2FC_CNIC_REGISTERED 1
|
||||
struct packet_type fcoe_packet_type;
|
||||
struct packet_type fip_packet_type;
|
||||
struct bnx2fc_cmd_mgr *cmd_mgr;
|
||||
struct workqueue_struct *timer_work_queue;
|
||||
struct kref kref;
|
||||
spinlock_t hba_lock;
|
||||
struct mutex hba_mutex;
|
||||
unsigned long adapter_state;
|
||||
|
@ -172,15 +167,9 @@ struct bnx2fc_hba {
|
|||
#define ADAPTER_STATE_GOING_DOWN 1
|
||||
#define ADAPTER_STATE_LINK_DOWN 2
|
||||
#define ADAPTER_STATE_READY 3
|
||||
u32 flags;
|
||||
unsigned long init_done;
|
||||
#define BNX2FC_FW_INIT_DONE 0
|
||||
#define BNX2FC_CTLR_INIT_DONE 1
|
||||
#define BNX2FC_CREATE_DONE 2
|
||||
struct fcoe_ctlr ctlr;
|
||||
struct list_head vports;
|
||||
u8 vlan_enabled;
|
||||
int vlan_id;
|
||||
unsigned long flags;
|
||||
#define BNX2FC_FLAG_FW_INIT_DONE 0
|
||||
#define BNX2FC_FLAG_DESTROY_CMPL 1
|
||||
u32 next_conn_id;
|
||||
struct fcoe_task_ctx_entry **task_ctx;
|
||||
dma_addr_t *task_ctx_dma;
|
||||
|
@ -199,38 +188,41 @@ struct bnx2fc_hba {
|
|||
char *dummy_buffer;
|
||||
dma_addr_t dummy_buf_dma;
|
||||
|
||||
/* Active list of offloaded sessions */
|
||||
struct bnx2fc_rport **tgt_ofld_list;
|
||||
|
||||
/* statistics */
|
||||
struct fcoe_statistics_params *stats_buffer;
|
||||
dma_addr_t stats_buf_dma;
|
||||
|
||||
/*
|
||||
* PCI related info.
|
||||
*/
|
||||
u16 pci_did;
|
||||
u16 pci_vid;
|
||||
u16 pci_sdid;
|
||||
u16 pci_svid;
|
||||
u16 pci_func;
|
||||
u16 pci_devno;
|
||||
|
||||
struct task_struct *l2_thread;
|
||||
|
||||
/* linkdown handling */
|
||||
wait_queue_head_t shutdown_wait;
|
||||
int wait_for_link_down;
|
||||
struct completion stat_req_done;
|
||||
|
||||
/*destroy handling */
|
||||
struct timer_list destroy_timer;
|
||||
wait_queue_head_t destroy_wait;
|
||||
|
||||
/* Active list of offloaded sessions */
|
||||
struct bnx2fc_rport *tgt_ofld_list[BNX2FC_NUM_MAX_SESS];
|
||||
/* linkdown handling */
|
||||
wait_queue_head_t shutdown_wait;
|
||||
int wait_for_link_down;
|
||||
int num_ofld_sess;
|
||||
|
||||
/* statistics */
|
||||
struct completion stat_req_done;
|
||||
struct list_head vports;
|
||||
};
|
||||
|
||||
#define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_hba, ctlr)
|
||||
struct bnx2fc_interface {
|
||||
struct list_head list;
|
||||
unsigned long if_flags;
|
||||
#define BNX2FC_CTLR_INIT_DONE 0
|
||||
struct bnx2fc_hba *hba;
|
||||
struct net_device *netdev;
|
||||
struct packet_type fcoe_packet_type;
|
||||
struct packet_type fip_packet_type;
|
||||
struct workqueue_struct *timer_work_queue;
|
||||
struct kref kref;
|
||||
struct fcoe_ctlr ctlr;
|
||||
u8 vlan_enabled;
|
||||
int vlan_id;
|
||||
};
|
||||
|
||||
#define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_interface, ctlr)
|
||||
|
||||
struct bnx2fc_lport {
|
||||
struct list_head list;
|
||||
|
@ -262,10 +254,9 @@ struct bnx2fc_rport {
|
|||
#define BNX2FC_FLAG_DISABLED 0x3
|
||||
#define BNX2FC_FLAG_DESTROYED 0x4
|
||||
#define BNX2FC_FLAG_OFLD_REQ_CMPL 0x5
|
||||
#define BNX2FC_FLAG_DESTROY_CMPL 0x6
|
||||
#define BNX2FC_FLAG_CTX_ALLOC_FAILURE 0x7
|
||||
#define BNX2FC_FLAG_UPLD_REQ_COMPL 0x8
|
||||
#define BNX2FC_FLAG_EXPL_LOGO 0x9
|
||||
#define BNX2FC_FLAG_CTX_ALLOC_FAILURE 0x6
|
||||
#define BNX2FC_FLAG_UPLD_REQ_COMPL 0x7
|
||||
#define BNX2FC_FLAG_EXPL_LOGO 0x8
|
||||
|
||||
u8 src_addr[ETH_ALEN];
|
||||
u32 max_sqes;
|
||||
|
@ -327,12 +318,9 @@ struct bnx2fc_rport {
|
|||
spinlock_t cq_lock;
|
||||
atomic_t num_active_ios;
|
||||
u32 flush_in_prog;
|
||||
unsigned long work_time_slice;
|
||||
unsigned long timestamp;
|
||||
struct list_head free_task_list;
|
||||
struct bnx2fc_cmd *pending_queue[BNX2FC_SQ_WQES_MAX+1];
|
||||
atomic_t pi;
|
||||
atomic_t ci;
|
||||
struct list_head active_cmd_queue;
|
||||
struct list_head els_queue;
|
||||
struct list_head io_retire_queue;
|
||||
|
|
|
@ -259,7 +259,7 @@ static int bnx2fc_initiate_els(struct bnx2fc_rport *tgt, unsigned int op,
|
|||
struct bnx2fc_els_cb_arg *cb_arg, u32 timer_msec)
|
||||
{
|
||||
struct fcoe_port *port = tgt->port;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct fc_rport *rport = tgt->rport;
|
||||
struct fc_lport *lport = port->lport;
|
||||
struct bnx2fc_cmd *els_req;
|
||||
|
@ -352,7 +352,8 @@ static int bnx2fc_initiate_els(struct bnx2fc_rport *tgt, unsigned int op,
|
|||
index = xid % BNX2FC_TASKS_PER_PAGE;
|
||||
|
||||
/* Initialize task context for this IO request */
|
||||
task_page = (struct fcoe_task_ctx_entry *) hba->task_ctx[task_idx];
|
||||
task_page = (struct fcoe_task_ctx_entry *)
|
||||
interface->hba->task_ctx[task_idx];
|
||||
task = &(task_page[index]);
|
||||
bnx2fc_init_mp_task(els_req, task);
|
||||
|
||||
|
@ -496,8 +497,8 @@ struct fc_seq *bnx2fc_elsct_send(struct fc_lport *lport, u32 did,
|
|||
void *arg, u32 timeout)
|
||||
{
|
||||
struct fcoe_port *port = lport_priv(lport);
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct fcoe_ctlr *fip = &hba->ctlr;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct fcoe_ctlr *fip = &interface->ctlr;
|
||||
struct fc_frame_header *fh = fc_frame_header_get(fp);
|
||||
|
||||
switch (op) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -23,7 +23,7 @@ static void bnx2fc_process_enable_conn_cmpl(struct bnx2fc_hba *hba,
|
|||
struct fcoe_kcqe *ofld_kcqe);
|
||||
static void bnx2fc_init_failure(struct bnx2fc_hba *hba, u32 err_code);
|
||||
static void bnx2fc_process_conn_destroy_cmpl(struct bnx2fc_hba *hba,
|
||||
struct fcoe_kcqe *conn_destroy);
|
||||
struct fcoe_kcqe *destroy_kcqe);
|
||||
|
||||
int bnx2fc_send_stat_req(struct bnx2fc_hba *hba)
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ int bnx2fc_send_fw_fcoe_init_msg(struct bnx2fc_hba *hba)
|
|||
int rc = 0;
|
||||
|
||||
if (!hba->cnic) {
|
||||
printk(KERN_ALERT PFX "hba->cnic NULL during fcoe fw init\n");
|
||||
printk(KERN_ERR PFX "hba->cnic NULL during fcoe fw init\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,7 @@ int bnx2fc_send_fw_fcoe_init_msg(struct bnx2fc_hba *hba)
|
|||
fcoe_init2.hsi_major_version = FCOE_HSI_MAJOR_VERSION;
|
||||
fcoe_init2.hsi_minor_version = FCOE_HSI_MINOR_VERSION;
|
||||
|
||||
|
||||
fcoe_init2.hash_tbl_pbl_addr_lo = (u32) hba->hash_tbl_pbl_dma;
|
||||
fcoe_init2.hash_tbl_pbl_addr_hi = (u32)
|
||||
((u64) hba->hash_tbl_pbl_dma >> 32);
|
||||
|
@ -165,7 +166,8 @@ int bnx2fc_send_session_ofld_req(struct fcoe_port *port,
|
|||
struct bnx2fc_rport *tgt)
|
||||
{
|
||||
struct fc_lport *lport = port->lport;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
struct kwqe *kwqe_arr[4];
|
||||
struct fcoe_kwqe_conn_offload1 ofld_req1;
|
||||
struct fcoe_kwqe_conn_offload2 ofld_req2;
|
||||
|
@ -227,7 +229,7 @@ int bnx2fc_send_session_ofld_req(struct fcoe_port *port,
|
|||
ofld_req3.hdr.flags =
|
||||
(FCOE_KWQE_LAYER_CODE << FCOE_KWQE_HEADER_LAYER_CODE_SHIFT);
|
||||
|
||||
ofld_req3.vlan_tag = hba->vlan_id <<
|
||||
ofld_req3.vlan_tag = interface->vlan_id <<
|
||||
FCOE_KWQE_CONN_OFFLOAD3_VLAN_ID_SHIFT;
|
||||
ofld_req3.vlan_tag |= 3 << FCOE_KWQE_CONN_OFFLOAD3_PRIORITY_SHIFT;
|
||||
|
||||
|
@ -278,7 +280,7 @@ int bnx2fc_send_session_ofld_req(struct fcoe_port *port,
|
|||
FCOE_KWQE_CONN_OFFLOAD3_B_CONT_INCR_SEQ_CNT_SHIFT);
|
||||
|
||||
/* vlan flag */
|
||||
ofld_req3.flags |= (hba->vlan_enabled <<
|
||||
ofld_req3.flags |= (interface->vlan_enabled <<
|
||||
FCOE_KWQE_CONN_OFFLOAD3_B_VLAN_FLAG_SHIFT);
|
||||
|
||||
/* C2_VALID and ACK flags are not set as they are not suppported */
|
||||
|
@ -300,12 +302,13 @@ int bnx2fc_send_session_ofld_req(struct fcoe_port *port,
|
|||
ofld_req4.src_mac_addr_mid[1] = port->data_src_addr[2];
|
||||
ofld_req4.src_mac_addr_hi[0] = port->data_src_addr[1];
|
||||
ofld_req4.src_mac_addr_hi[1] = port->data_src_addr[0];
|
||||
ofld_req4.dst_mac_addr_lo[0] = hba->ctlr.dest_addr[5];/* fcf mac */
|
||||
ofld_req4.dst_mac_addr_lo[1] = hba->ctlr.dest_addr[4];
|
||||
ofld_req4.dst_mac_addr_mid[0] = hba->ctlr.dest_addr[3];
|
||||
ofld_req4.dst_mac_addr_mid[1] = hba->ctlr.dest_addr[2];
|
||||
ofld_req4.dst_mac_addr_hi[0] = hba->ctlr.dest_addr[1];
|
||||
ofld_req4.dst_mac_addr_hi[1] = hba->ctlr.dest_addr[0];
|
||||
ofld_req4.dst_mac_addr_lo[0] = interface->ctlr.dest_addr[5];
|
||||
/* fcf mac */
|
||||
ofld_req4.dst_mac_addr_lo[1] = interface->ctlr.dest_addr[4];
|
||||
ofld_req4.dst_mac_addr_mid[0] = interface->ctlr.dest_addr[3];
|
||||
ofld_req4.dst_mac_addr_mid[1] = interface->ctlr.dest_addr[2];
|
||||
ofld_req4.dst_mac_addr_hi[0] = interface->ctlr.dest_addr[1];
|
||||
ofld_req4.dst_mac_addr_hi[1] = interface->ctlr.dest_addr[0];
|
||||
|
||||
ofld_req4.lcq_addr_lo = (u32) tgt->lcq_dma;
|
||||
ofld_req4.lcq_addr_hi = (u32)((u64) tgt->lcq_dma >> 32);
|
||||
|
@ -335,7 +338,8 @@ static int bnx2fc_send_session_enable_req(struct fcoe_port *port,
|
|||
struct bnx2fc_rport *tgt)
|
||||
{
|
||||
struct kwqe *kwqe_arr[2];
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
struct fcoe_kwqe_conn_enable_disable enbl_req;
|
||||
struct fc_lport *lport = port->lport;
|
||||
struct fc_rport *rport = tgt->rport;
|
||||
|
@ -358,12 +362,12 @@ static int bnx2fc_send_session_enable_req(struct fcoe_port *port,
|
|||
enbl_req.src_mac_addr_hi[1] = port->data_src_addr[0];
|
||||
memcpy(tgt->src_addr, port->data_src_addr, ETH_ALEN);
|
||||
|
||||
enbl_req.dst_mac_addr_lo[0] = hba->ctlr.dest_addr[5];/* fcf mac */
|
||||
enbl_req.dst_mac_addr_lo[1] = hba->ctlr.dest_addr[4];
|
||||
enbl_req.dst_mac_addr_mid[0] = hba->ctlr.dest_addr[3];
|
||||
enbl_req.dst_mac_addr_mid[1] = hba->ctlr.dest_addr[2];
|
||||
enbl_req.dst_mac_addr_hi[0] = hba->ctlr.dest_addr[1];
|
||||
enbl_req.dst_mac_addr_hi[1] = hba->ctlr.dest_addr[0];
|
||||
enbl_req.dst_mac_addr_lo[0] = interface->ctlr.dest_addr[5];
|
||||
enbl_req.dst_mac_addr_lo[1] = interface->ctlr.dest_addr[4];
|
||||
enbl_req.dst_mac_addr_mid[0] = interface->ctlr.dest_addr[3];
|
||||
enbl_req.dst_mac_addr_mid[1] = interface->ctlr.dest_addr[2];
|
||||
enbl_req.dst_mac_addr_hi[0] = interface->ctlr.dest_addr[1];
|
||||
enbl_req.dst_mac_addr_hi[1] = interface->ctlr.dest_addr[0];
|
||||
|
||||
port_id = fc_host_port_id(lport->host);
|
||||
if (port_id != tgt->sid) {
|
||||
|
@ -379,10 +383,10 @@ static int bnx2fc_send_session_enable_req(struct fcoe_port *port,
|
|||
enbl_req.d_id[0] = (port_id & 0x000000FF);
|
||||
enbl_req.d_id[1] = (port_id & 0x0000FF00) >> 8;
|
||||
enbl_req.d_id[2] = (port_id & 0x00FF0000) >> 16;
|
||||
enbl_req.vlan_tag = hba->vlan_id <<
|
||||
enbl_req.vlan_tag = interface->vlan_id <<
|
||||
FCOE_KWQE_CONN_ENABLE_DISABLE_VLAN_ID_SHIFT;
|
||||
enbl_req.vlan_tag |= 3 << FCOE_KWQE_CONN_ENABLE_DISABLE_PRIORITY_SHIFT;
|
||||
enbl_req.vlan_flag = hba->vlan_enabled;
|
||||
enbl_req.vlan_flag = interface->vlan_enabled;
|
||||
enbl_req.context_id = tgt->context_id;
|
||||
enbl_req.conn_id = tgt->fcoe_conn_id;
|
||||
|
||||
|
@ -402,7 +406,8 @@ static int bnx2fc_send_session_enable_req(struct fcoe_port *port,
|
|||
int bnx2fc_send_session_disable_req(struct fcoe_port *port,
|
||||
struct bnx2fc_rport *tgt)
|
||||
{
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
struct fcoe_kwqe_conn_enable_disable disable_req;
|
||||
struct kwqe *kwqe_arr[2];
|
||||
struct fc_rport *rport = tgt->rport;
|
||||
|
@ -423,12 +428,12 @@ int bnx2fc_send_session_disable_req(struct fcoe_port *port,
|
|||
disable_req.src_mac_addr_hi[0] = tgt->src_addr[1];
|
||||
disable_req.src_mac_addr_hi[1] = tgt->src_addr[0];
|
||||
|
||||
disable_req.dst_mac_addr_lo[0] = hba->ctlr.dest_addr[5];/* fcf mac */
|
||||
disable_req.dst_mac_addr_lo[1] = hba->ctlr.dest_addr[4];
|
||||
disable_req.dst_mac_addr_mid[0] = hba->ctlr.dest_addr[3];
|
||||
disable_req.dst_mac_addr_mid[1] = hba->ctlr.dest_addr[2];
|
||||
disable_req.dst_mac_addr_hi[0] = hba->ctlr.dest_addr[1];
|
||||
disable_req.dst_mac_addr_hi[1] = hba->ctlr.dest_addr[0];
|
||||
disable_req.dst_mac_addr_lo[0] = interface->ctlr.dest_addr[5];
|
||||
disable_req.dst_mac_addr_lo[1] = interface->ctlr.dest_addr[4];
|
||||
disable_req.dst_mac_addr_mid[0] = interface->ctlr.dest_addr[3];
|
||||
disable_req.dst_mac_addr_mid[1] = interface->ctlr.dest_addr[2];
|
||||
disable_req.dst_mac_addr_hi[0] = interface->ctlr.dest_addr[1];
|
||||
disable_req.dst_mac_addr_hi[1] = interface->ctlr.dest_addr[0];
|
||||
|
||||
port_id = tgt->sid;
|
||||
disable_req.s_id[0] = (port_id & 0x000000FF);
|
||||
|
@ -442,11 +447,11 @@ int bnx2fc_send_session_disable_req(struct fcoe_port *port,
|
|||
disable_req.d_id[2] = (port_id & 0x00FF0000) >> 16;
|
||||
disable_req.context_id = tgt->context_id;
|
||||
disable_req.conn_id = tgt->fcoe_conn_id;
|
||||
disable_req.vlan_tag = hba->vlan_id <<
|
||||
disable_req.vlan_tag = interface->vlan_id <<
|
||||
FCOE_KWQE_CONN_ENABLE_DISABLE_VLAN_ID_SHIFT;
|
||||
disable_req.vlan_tag |=
|
||||
3 << FCOE_KWQE_CONN_ENABLE_DISABLE_PRIORITY_SHIFT;
|
||||
disable_req.vlan_flag = hba->vlan_enabled;
|
||||
disable_req.vlan_flag = interface->vlan_enabled;
|
||||
|
||||
kwqe_arr[0] = (struct kwqe *) &disable_req;
|
||||
|
||||
|
@ -525,7 +530,7 @@ void bnx2fc_process_l2_frame_compl(struct bnx2fc_rport *tgt,
|
|||
{
|
||||
struct fcoe_port *port = tgt->port;
|
||||
struct fc_lport *lport = port->lport;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_unsol_els *unsol_els;
|
||||
struct fc_frame_header *fh;
|
||||
struct fc_frame *fp;
|
||||
|
@ -586,7 +591,7 @@ void bnx2fc_process_l2_frame_compl(struct bnx2fc_rport *tgt,
|
|||
fr_eof(fp) = FC_EOF_T;
|
||||
fr_crc(fp) = cpu_to_le32(~crc);
|
||||
unsol_els->lport = lport;
|
||||
unsol_els->hba = hba;
|
||||
unsol_els->hba = interface->hba;
|
||||
unsol_els->fp = fp;
|
||||
INIT_WORK(&unsol_els->unsol_els_work, bnx2fc_unsol_els_work);
|
||||
queue_work(bnx2fc_wq, &unsol_els->unsol_els_work);
|
||||
|
@ -608,7 +613,8 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
|
|||
u32 frame_len, len;
|
||||
struct bnx2fc_cmd *io_req = NULL;
|
||||
struct fcoe_task_ctx_entry *task, *task_page;
|
||||
struct bnx2fc_hba *hba = tgt->port->priv;
|
||||
struct bnx2fc_interface *interface = tgt->port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
int task_idx, index;
|
||||
int rc = 0;
|
||||
|
||||
|
@ -685,7 +691,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
|
|||
task_idx = xid / BNX2FC_TASKS_PER_PAGE;
|
||||
index = xid % BNX2FC_TASKS_PER_PAGE;
|
||||
task_page = (struct fcoe_task_ctx_entry *)
|
||||
hba->task_ctx[task_idx];
|
||||
hba->task_ctx[task_idx];
|
||||
task = &(task_page[index]);
|
||||
|
||||
io_req = (struct bnx2fc_cmd *)hba->cmd_mgr->cmds[xid];
|
||||
|
@ -770,7 +776,8 @@ void bnx2fc_process_cq_compl(struct bnx2fc_rport *tgt, u16 wqe)
|
|||
struct fcoe_task_ctx_entry *task;
|
||||
struct fcoe_task_ctx_entry *task_page;
|
||||
struct fcoe_port *port = tgt->port;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
struct bnx2fc_cmd *io_req;
|
||||
int task_idx, index;
|
||||
u16 xid;
|
||||
|
@ -1004,6 +1011,7 @@ static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba *hba,
|
|||
{
|
||||
struct bnx2fc_rport *tgt;
|
||||
struct fcoe_port *port;
|
||||
struct bnx2fc_interface *interface;
|
||||
u32 conn_id;
|
||||
u32 context_id;
|
||||
int rc;
|
||||
|
@ -1012,14 +1020,15 @@ static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba *hba,
|
|||
context_id = ofld_kcqe->fcoe_conn_context_id;
|
||||
tgt = hba->tgt_ofld_list[conn_id];
|
||||
if (!tgt) {
|
||||
printk(KERN_ERR PFX "ERROR:ofld_cmpl: No pending ofld req\n");
|
||||
printk(KERN_ALERT PFX "ERROR:ofld_cmpl: No pending ofld req\n");
|
||||
return;
|
||||
}
|
||||
BNX2FC_TGT_DBG(tgt, "Entered ofld compl - context_id = 0x%x\n",
|
||||
ofld_kcqe->fcoe_conn_context_id);
|
||||
port = tgt->port;
|
||||
if (hba != tgt->port->priv) {
|
||||
printk(KERN_ALERT PFX "ERROR:ofld_cmpl: HBA mis-match\n");
|
||||
interface = tgt->port->priv;
|
||||
if (hba != interface->hba) {
|
||||
printk(KERN_ERR PFX "ERROR:ofld_cmpl: HBA mis-match\n");
|
||||
goto ofld_cmpl_err;
|
||||
}
|
||||
/*
|
||||
|
@ -1063,6 +1072,7 @@ static void bnx2fc_process_enable_conn_cmpl(struct bnx2fc_hba *hba,
|
|||
struct fcoe_kcqe *ofld_kcqe)
|
||||
{
|
||||
struct bnx2fc_rport *tgt;
|
||||
struct bnx2fc_interface *interface;
|
||||
u32 conn_id;
|
||||
u32 context_id;
|
||||
|
||||
|
@ -1085,13 +1095,14 @@ static void bnx2fc_process_enable_conn_cmpl(struct bnx2fc_hba *hba,
|
|||
printk(KERN_ERR PFX "context id mis-match\n");
|
||||
return;
|
||||
}
|
||||
if (hba != tgt->port->priv) {
|
||||
printk(KERN_ALERT PFX "bnx2fc-enbl_cmpl: HBA mis-match\n");
|
||||
interface = tgt->port->priv;
|
||||
if (hba != interface->hba) {
|
||||
printk(KERN_ERR PFX "bnx2fc-enbl_cmpl: HBA mis-match\n");
|
||||
goto enbl_cmpl_err;
|
||||
}
|
||||
if (ofld_kcqe->completion_status) {
|
||||
if (ofld_kcqe->completion_status)
|
||||
goto enbl_cmpl_err;
|
||||
} else {
|
||||
else {
|
||||
/* enable successful - rport ready for issuing IOs */
|
||||
set_bit(BNX2FC_FLAG_OFFLOADED, &tgt->flags);
|
||||
set_bit(BNX2FC_FLAG_OFLD_REQ_CMPL, &tgt->flags);
|
||||
|
@ -1241,7 +1252,7 @@ void bnx2fc_indicate_kcqe(void *context, struct kcqe *kcq[],
|
|||
} else {
|
||||
printk(KERN_ERR PFX "DESTROY success\n");
|
||||
}
|
||||
hba->flags |= BNX2FC_FLAG_DESTROY_CMPL;
|
||||
set_bit(BNX2FC_FLAG_DESTROY_CMPL, &hba->flags);
|
||||
wake_up_interruptible(&hba->destroy_wait);
|
||||
break;
|
||||
|
||||
|
@ -1306,7 +1317,8 @@ int bnx2fc_map_doorbell(struct bnx2fc_rport *tgt)
|
|||
struct fcoe_port *port = tgt->port;
|
||||
u32 reg_off;
|
||||
resource_size_t reg_base;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
|
||||
reg_base = pci_resource_start(hba->pcidev,
|
||||
BNX2X_DOORBELL_PCI_BAR);
|
||||
|
|
|
@ -29,10 +29,11 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
|
|||
void bnx2fc_cmd_timer_set(struct bnx2fc_cmd *io_req,
|
||||
unsigned int timer_msec)
|
||||
{
|
||||
struct bnx2fc_hba *hba = io_req->port->priv;
|
||||
struct bnx2fc_interface *interface = io_req->port->priv;
|
||||
|
||||
if (queue_delayed_work(hba->timer_work_queue, &io_req->timeout_work,
|
||||
msecs_to_jiffies(timer_msec)))
|
||||
if (queue_delayed_work(interface->timer_work_queue,
|
||||
&io_req->timeout_work,
|
||||
msecs_to_jiffies(timer_msec)))
|
||||
kref_get(&io_req->refcount);
|
||||
}
|
||||
|
||||
|
@ -419,8 +420,8 @@ void bnx2fc_cmd_mgr_free(struct bnx2fc_cmd_mgr *cmgr)
|
|||
struct bnx2fc_cmd *bnx2fc_elstm_alloc(struct bnx2fc_rport *tgt, int type)
|
||||
{
|
||||
struct fcoe_port *port = tgt->port;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_cmd_mgr *cmd_mgr = hba->cmd_mgr;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_cmd_mgr *cmd_mgr = interface->hba->cmd_mgr;
|
||||
struct bnx2fc_cmd *io_req;
|
||||
struct list_head *listp;
|
||||
struct io_bdt *bd_tbl;
|
||||
|
@ -485,11 +486,12 @@ struct bnx2fc_cmd *bnx2fc_elstm_alloc(struct bnx2fc_rport *tgt, int type)
|
|||
kref_init(&io_req->refcount);
|
||||
return io_req;
|
||||
}
|
||||
static struct bnx2fc_cmd *bnx2fc_cmd_alloc(struct bnx2fc_rport *tgt)
|
||||
|
||||
struct bnx2fc_cmd *bnx2fc_cmd_alloc(struct bnx2fc_rport *tgt)
|
||||
{
|
||||
struct fcoe_port *port = tgt->port;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_cmd_mgr *cmd_mgr = hba->cmd_mgr;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_cmd_mgr *cmd_mgr = interface->hba->cmd_mgr;
|
||||
struct bnx2fc_cmd *io_req;
|
||||
struct list_head *listp;
|
||||
struct io_bdt *bd_tbl;
|
||||
|
@ -570,7 +572,8 @@ void bnx2fc_cmd_release(struct kref *ref)
|
|||
static void bnx2fc_free_mp_resc(struct bnx2fc_cmd *io_req)
|
||||
{
|
||||
struct bnx2fc_mp_req *mp_req = &(io_req->mp_req);
|
||||
struct bnx2fc_hba *hba = io_req->port->priv;
|
||||
struct bnx2fc_interface *interface = io_req->port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
size_t sz = sizeof(struct fcoe_bd_ctx);
|
||||
|
||||
/* clear tm flags */
|
||||
|
@ -606,7 +609,8 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req)
|
|||
struct bnx2fc_mp_req *mp_req;
|
||||
struct fcoe_bd_ctx *mp_req_bd;
|
||||
struct fcoe_bd_ctx *mp_resp_bd;
|
||||
struct bnx2fc_hba *hba = io_req->port->priv;
|
||||
struct bnx2fc_interface *interface = io_req->port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
dma_addr_t addr;
|
||||
size_t sz;
|
||||
|
||||
|
@ -682,7 +686,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
|
|||
struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
|
||||
struct fc_rport_libfc_priv *rp = rport->dd_data;
|
||||
struct fcoe_port *port;
|
||||
struct bnx2fc_hba *hba;
|
||||
struct bnx2fc_interface *interface;
|
||||
struct bnx2fc_rport *tgt;
|
||||
struct bnx2fc_cmd *io_req;
|
||||
struct bnx2fc_mp_req *tm_req;
|
||||
|
@ -699,7 +703,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
|
|||
|
||||
lport = shost_priv(host);
|
||||
port = lport_priv(lport);
|
||||
hba = port->priv;
|
||||
interface = port->priv;
|
||||
|
||||
if (rport == NULL) {
|
||||
printk(KERN_ERR PFX "device_reset: rport is NULL\n");
|
||||
|
@ -774,7 +778,8 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
|
|||
index = xid % BNX2FC_TASKS_PER_PAGE;
|
||||
|
||||
/* Initialize task context for this IO request */
|
||||
task_page = (struct fcoe_task_ctx_entry *) hba->task_ctx[task_idx];
|
||||
task_page = (struct fcoe_task_ctx_entry *)
|
||||
interface->hba->task_ctx[task_idx];
|
||||
task = &(task_page[index]);
|
||||
bnx2fc_init_mp_task(io_req, task);
|
||||
|
||||
|
@ -822,7 +827,7 @@ int bnx2fc_initiate_abts(struct bnx2fc_cmd *io_req)
|
|||
struct bnx2fc_rport *tgt = io_req->tgt;
|
||||
struct fc_rport *rport = tgt->rport;
|
||||
struct fc_rport_priv *rdata = tgt->rdata;
|
||||
struct bnx2fc_hba *hba;
|
||||
struct bnx2fc_interface *interface;
|
||||
struct fcoe_port *port;
|
||||
struct bnx2fc_cmd *abts_io_req;
|
||||
struct fcoe_task_ctx_entry *task;
|
||||
|
@ -839,7 +844,7 @@ int bnx2fc_initiate_abts(struct bnx2fc_cmd *io_req)
|
|||
BNX2FC_IO_DBG(io_req, "Entered bnx2fc_initiate_abts\n");
|
||||
|
||||
port = io_req->port;
|
||||
hba = port->priv;
|
||||
interface = port->priv;
|
||||
lport = port->lport;
|
||||
|
||||
if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) {
|
||||
|
@ -896,7 +901,8 @@ int bnx2fc_initiate_abts(struct bnx2fc_cmd *io_req)
|
|||
index = xid % BNX2FC_TASKS_PER_PAGE;
|
||||
|
||||
/* Initialize task context for this IO request */
|
||||
task_page = (struct fcoe_task_ctx_entry *) hba->task_ctx[task_idx];
|
||||
task_page = (struct fcoe_task_ctx_entry *)
|
||||
interface->hba->task_ctx[task_idx];
|
||||
task = &(task_page[index]);
|
||||
bnx2fc_init_mp_task(abts_io_req, task);
|
||||
|
||||
|
@ -928,7 +934,7 @@ int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req)
|
|||
{
|
||||
struct fc_lport *lport;
|
||||
struct bnx2fc_rport *tgt = io_req->tgt;
|
||||
struct bnx2fc_hba *hba;
|
||||
struct bnx2fc_interface *interface;
|
||||
struct fcoe_port *port;
|
||||
struct bnx2fc_cmd *cleanup_io_req;
|
||||
struct fcoe_task_ctx_entry *task;
|
||||
|
@ -941,7 +947,7 @@ int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req)
|
|||
BNX2FC_IO_DBG(io_req, "Entered bnx2fc_initiate_cleanup\n");
|
||||
|
||||
port = io_req->port;
|
||||
hba = port->priv;
|
||||
interface = port->priv;
|
||||
lport = port->lport;
|
||||
|
||||
cleanup_io_req = bnx2fc_elstm_alloc(tgt, BNX2FC_CLEANUP);
|
||||
|
@ -963,7 +969,8 @@ int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req)
|
|||
index = xid % BNX2FC_TASKS_PER_PAGE;
|
||||
|
||||
/* Initialize task context for this IO request */
|
||||
task_page = (struct fcoe_task_ctx_entry *) hba->task_ctx[task_idx];
|
||||
task_page = (struct fcoe_task_ctx_entry *)
|
||||
interface->hba->task_ctx[task_idx];
|
||||
task = &(task_page[index]);
|
||||
orig_xid = io_req->xid;
|
||||
|
||||
|
@ -1796,7 +1803,8 @@ static int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
|
|||
struct fcoe_task_ctx_entry *task_page;
|
||||
struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
|
||||
struct fcoe_port *port = tgt->port;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
struct fc_lport *lport = port->lport;
|
||||
struct fcoe_dev_stats *stats;
|
||||
int task_idx, index;
|
||||
|
|
|
@ -65,7 +65,8 @@ static void bnx2fc_offload_session(struct fcoe_port *port,
|
|||
{
|
||||
struct fc_lport *lport = rdata->local_port;
|
||||
struct fc_rport *rport = rdata->rport;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
int rval;
|
||||
int i = 0;
|
||||
|
||||
|
@ -237,7 +238,8 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt)
|
|||
static void bnx2fc_upload_session(struct fcoe_port *port,
|
||||
struct bnx2fc_rport *tgt)
|
||||
{
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
|
||||
BNX2FC_TGT_DBG(tgt, "upload_session: active_ios = %d\n",
|
||||
tgt->num_active_ios.counter);
|
||||
|
@ -316,7 +318,8 @@ static int bnx2fc_init_tgt(struct bnx2fc_rport *tgt,
|
|||
{
|
||||
|
||||
struct fc_rport *rport = rdata->rport;
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
struct b577xx_doorbell_set_prod *sq_db = &tgt->sq_db;
|
||||
struct b577xx_fcoe_rx_doorbell *rx_db = &tgt->rx_db;
|
||||
|
||||
|
@ -392,7 +395,8 @@ void bnx2fc_rport_event_handler(struct fc_lport *lport,
|
|||
enum fc_rport_event event)
|
||||
{
|
||||
struct fcoe_port *port = lport_priv(lport);
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
struct fc_rport *rport = rdata->rport;
|
||||
struct fc_rport_libfc_priv *rp;
|
||||
struct bnx2fc_rport *tgt;
|
||||
|
@ -537,7 +541,8 @@ void bnx2fc_rport_event_handler(struct fc_lport *lport,
|
|||
struct bnx2fc_rport *bnx2fc_tgt_lookup(struct fcoe_port *port,
|
||||
u32 port_id)
|
||||
{
|
||||
struct bnx2fc_hba *hba = port->priv;
|
||||
struct bnx2fc_interface *interface = port->priv;
|
||||
struct bnx2fc_hba *hba = interface->hba;
|
||||
struct bnx2fc_rport *tgt;
|
||||
struct fc_rport_priv *rdata;
|
||||
int i;
|
||||
|
@ -552,7 +557,7 @@ struct bnx2fc_rport *bnx2fc_tgt_lookup(struct fcoe_port *port,
|
|||
"obtained\n");
|
||||
return tgt;
|
||||
} else {
|
||||
printk(KERN_ERR PFX "rport 0x%x "
|
||||
BNX2FC_TGT_DBG(tgt, "rport 0x%x "
|
||||
"is in DELETED state\n",
|
||||
rdata->ids.port_id);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue