提交 d4e06701 编写于 作者: L Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (77 commits)
  [SCSI] fix crash in scsi_dispatch_cmd()
  [SCSI] sr: check_events() ignore GET_EVENT when TUR says otherwise
  [SCSI] bnx2i: Fixed kernel panic due to illegal usage of sc->request->cpu
  [SCSI] bfa: Update the driver version to 3.0.2.1
  [SCSI] bfa: Driver and BSG enhancements.
  [SCSI] bfa: Added support to query PHY.
  [SCSI] bfa: Added HBA diagnostics support.
  [SCSI] bfa: Added support for flash configuration
  [SCSI] bfa: Added support to obtain SFP info.
  [SCSI] bfa: Added support for CEE info and stats query.
  [SCSI] bfa: Extend BSG interface.
  [SCSI] bfa: FCS bug fixes.
  [SCSI] bfa: DMA memory allocation enhancement.
  [SCSI] bfa: Brocade-1860 Fabric Adapter vHBA support.
  [SCSI] bfa: Brocade-1860 Fabric Adapter PLL init fixes.
  [SCSI] bfa: Added Fabric Assigned Address(FAA) support
  [SCSI] bfa: IOC bug fixes.
  [SCSI] bfa: Enable ASIC block configuration and query.
  [SCSI] bnx2i: Updated copyright and bump version
  [SCSI] bnx2i: Modified to skip CNIC registration if iSCSI is not supported
  ...

Fix up some trivial conflicts in:
 - drivers/scsi/bnx2fc/{bnx2fc.h,bnx2fc_fcoe.c}:
	Crazy broadcom version number conflicts
 - drivers/target/tcm_fc/tfc_cmd.c
	Just trivial cleanups done on adjacent lines
...@@ -1553,6 +1553,12 @@ L: linux-wireless@vger.kernel.org ...@@ -1553,6 +1553,12 @@ L: linux-wireless@vger.kernel.org
S: Supported S: Supported
F: drivers/staging/brcm80211/ F: drivers/staging/brcm80211/
BROADCOM BNX2FC 10 GIGABIT FCOE DRIVER
M: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
L: linux-scsi@vger.kernel.org
S: Supported
F: drivers/scsi/bnx2fc/
BROCADE BFA FC SCSI DRIVER BROCADE BFA FC SCSI DRIVER
M: Jing Huang <huangj@brocade.com> M: Jing Huang <huangj@brocade.com>
L: linux-scsi@vger.kernel.org L: linux-scsi@vger.kernel.org
...@@ -1775,7 +1781,8 @@ F: include/linux/clk.h ...@@ -1775,7 +1781,8 @@ F: include/linux/clk.h
CISCO FCOE HBA DRIVER CISCO FCOE HBA DRIVER
M: Abhijeet Joglekar <abjoglek@cisco.com> M: Abhijeet Joglekar <abjoglek@cisco.com>
M: Joe Eykholt <jeykholt@cisco.com> M: Venkata Siva Vijayendra Bhamidipati <vbhamidi@cisco.com>
M: Brian Uchino <buchino@cisco.com>
L: linux-scsi@vger.kernel.org L: linux-scsi@vger.kernel.org
S: Supported S: Supported
F: drivers/scsi/fnic/ F: drivers/scsi/fnic/
......
...@@ -839,6 +839,9 @@ struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask) ...@@ -839,6 +839,9 @@ struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask)
{ {
struct request *rq; struct request *rq;
if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
return NULL;
BUG_ON(rw != READ && rw != WRITE); BUG_ON(rw != READ && rw != WRITE);
spin_lock_irq(q->queue_lock); spin_lock_irq(q->queue_lock);
......
...@@ -50,6 +50,13 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, ...@@ -50,6 +50,13 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
{ {
int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK;
if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) {
rq->errors = -ENXIO;
if (rq->end_io)
rq->end_io(rq, rq->errors);
return;
}
rq->rq_disk = bd_disk; rq->rq_disk = bd_disk;
rq->end_io = done; rq->end_io = done;
WARN_ON(irqs_disabled()); WARN_ON(irqs_disabled());
......
...@@ -566,6 +566,11 @@ static mode_t __init ibft_check_initiator_for(void *data, int type) ...@@ -566,6 +566,11 @@ static mode_t __init ibft_check_initiator_for(void *data, int type)
return rc; return rc;
} }
static void ibft_kobj_release(void *data)
{
kfree(data);
}
/* /*
* Helper function for ibft_register_kobjects. * Helper function for ibft_register_kobjects.
*/ */
...@@ -595,7 +600,8 @@ static int __init ibft_create_kobject(struct acpi_table_ibft *header, ...@@ -595,7 +600,8 @@ static int __init ibft_create_kobject(struct acpi_table_ibft *header,
boot_kobj = iscsi_boot_create_initiator(boot_kset, hdr->index, boot_kobj = iscsi_boot_create_initiator(boot_kset, hdr->index,
ibft_kobj, ibft_kobj,
ibft_attr_show_initiator, ibft_attr_show_initiator,
ibft_check_initiator_for); ibft_check_initiator_for,
ibft_kobj_release);
if (!boot_kobj) { if (!boot_kobj) {
rc = -ENOMEM; rc = -ENOMEM;
goto free_ibft_obj; goto free_ibft_obj;
...@@ -610,7 +616,8 @@ static int __init ibft_create_kobject(struct acpi_table_ibft *header, ...@@ -610,7 +616,8 @@ static int __init ibft_create_kobject(struct acpi_table_ibft *header,
boot_kobj = iscsi_boot_create_ethernet(boot_kset, hdr->index, boot_kobj = iscsi_boot_create_ethernet(boot_kset, hdr->index,
ibft_kobj, ibft_kobj,
ibft_attr_show_nic, ibft_attr_show_nic,
ibft_check_nic_for); ibft_check_nic_for,
ibft_kobj_release);
if (!boot_kobj) { if (!boot_kobj) {
rc = -ENOMEM; rc = -ENOMEM;
goto free_ibft_obj; goto free_ibft_obj;
...@@ -625,7 +632,8 @@ static int __init ibft_create_kobject(struct acpi_table_ibft *header, ...@@ -625,7 +632,8 @@ static int __init ibft_create_kobject(struct acpi_table_ibft *header,
boot_kobj = iscsi_boot_create_target(boot_kset, hdr->index, boot_kobj = iscsi_boot_create_target(boot_kset, hdr->index,
ibft_kobj, ibft_kobj,
ibft_attr_show_target, ibft_attr_show_target,
ibft_check_tgt_for); ibft_check_tgt_for,
ibft_kobj_release);
if (!boot_kobj) { if (!boot_kobj) {
rc = -ENOMEM; rc = -ENOMEM;
goto free_ibft_obj; goto free_ibft_obj;
......
...@@ -422,10 +422,19 @@ MODULE_PARM_DESC(aha152x1, "parameters for second controller"); ...@@ -422,10 +422,19 @@ MODULE_PARM_DESC(aha152x1, "parameters for second controller");
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id id_table[] __devinitdata = { static struct isapnp_device_id id_table[] __devinitdata = {
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1502), 0 },
ISAPNP_VENDOR('A','D','P'), ISAPNP_FUNCTION(0x1505), 0 }, { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1505), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1510), 0 },
ISAPNP_VENDOR('A','D','P'), ISAPNP_FUNCTION(0x1530), 0 }, { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1515), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1520), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x2015), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1522), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x2215), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1530), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x3015), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1532), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x3215), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x6360), 0 },
{ ISAPNP_DEVICE_SINGLE_END, } { ISAPNP_DEVICE_SINGLE_END, }
}; };
MODULE_DEVICE_TABLE(isapnp, id_table); MODULE_DEVICE_TABLE(isapnp, id_table);
......
...@@ -892,6 +892,11 @@ static int __init NCR5380_init(struct Scsi_Host *instance, int flags) ...@@ -892,6 +892,11 @@ static int __init NCR5380_init(struct Scsi_Host *instance, int flags)
return 0; return 0;
} }
static void NCR5380_exit(struct Scsi_Host *instance)
{
/* Empty, as we didn't schedule any delayed work */
}
/* /*
* Function : int NCR5380_queue_command (Scsi_Cmnd *cmd, * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd,
* void (*done)(Scsi_Cmnd *)) * void (*done)(Scsi_Cmnd *))
...@@ -914,7 +919,6 @@ static int NCR5380_queue_command_lck(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -914,7 +919,6 @@ static int NCR5380_queue_command_lck(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
{ {
SETUP_HOSTDATA(cmd->device->host); SETUP_HOSTDATA(cmd->device->host);
Scsi_Cmnd *tmp; Scsi_Cmnd *tmp;
int oldto;
unsigned long flags; unsigned long flags;
#if (NDEBUG & NDEBUG_NO_WRITE) #if (NDEBUG & NDEBUG_NO_WRITE)
......
...@@ -730,6 +730,7 @@ int atari_scsi_release(struct Scsi_Host *sh) ...@@ -730,6 +730,7 @@ int atari_scsi_release(struct Scsi_Host *sh)
free_irq(IRQ_TT_MFP_SCSI, sh); free_irq(IRQ_TT_MFP_SCSI, sh);
if (atari_dma_buffer) if (atari_dma_buffer)
atari_stram_free(atari_dma_buffer); atari_stram_free(atari_dma_buffer);
NCR5380_exit(sh);
return 1; return 1;
} }
......
...@@ -215,67 +215,56 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) ...@@ -215,67 +215,56 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)
static ssize_t beiscsi_show_boot_tgt_info(void *data, int type, char *buf) static ssize_t beiscsi_show_boot_tgt_info(void *data, int type, char *buf)
{ {
struct beiscsi_hba *phba = data; struct beiscsi_hba *phba = data;
struct mgmt_session_info *boot_sess = &phba->boot_sess;
struct mgmt_conn_info *boot_conn = &boot_sess->conn_list[0];
char *str = buf; char *str = buf;
int rc; int rc;
switch (type) { switch (type) {
case ISCSI_BOOT_TGT_NAME: case ISCSI_BOOT_TGT_NAME:
rc = sprintf(buf, "%.*s\n", rc = sprintf(buf, "%.*s\n",
(int)strlen(phba->boot_sess.target_name), (int)strlen(boot_sess->target_name),
(char *)&phba->boot_sess.target_name); (char *)&boot_sess->target_name);
break; break;
case ISCSI_BOOT_TGT_IP_ADDR: case ISCSI_BOOT_TGT_IP_ADDR:
if (phba->boot_sess.conn_list[0].dest_ipaddr.ip_type == 0x1) if (boot_conn->dest_ipaddr.ip_type == 0x1)
rc = sprintf(buf, "%pI4\n", rc = sprintf(buf, "%pI4\n",
(char *)&phba->boot_sess.conn_list[0]. (char *)&boot_conn->dest_ipaddr.ip_address);
dest_ipaddr.ip_address);
else else
rc = sprintf(str, "%pI6\n", rc = sprintf(str, "%pI6\n",
(char *)&phba->boot_sess.conn_list[0]. (char *)&boot_conn->dest_ipaddr.ip_address);
dest_ipaddr.ip_address);
break; break;
case ISCSI_BOOT_TGT_PORT: case ISCSI_BOOT_TGT_PORT:
rc = sprintf(str, "%d\n", phba->boot_sess.conn_list[0]. rc = sprintf(str, "%d\n", boot_conn->dest_port);
dest_port);
break; break;
case ISCSI_BOOT_TGT_CHAP_NAME: case ISCSI_BOOT_TGT_CHAP_NAME:
rc = sprintf(str, "%.*s\n", rc = sprintf(str, "%.*s\n",
phba->boot_sess.conn_list[0]. boot_conn->negotiated_login_options.auth_data.chap.
negotiated_login_options.auth_data.chap.
target_chap_name_length, target_chap_name_length,
(char *)&phba->boot_sess.conn_list[0]. (char *)&boot_conn->negotiated_login_options.
negotiated_login_options.auth_data.chap. auth_data.chap.target_chap_name);
target_chap_name);
break; break;
case ISCSI_BOOT_TGT_CHAP_SECRET: case ISCSI_BOOT_TGT_CHAP_SECRET:
rc = sprintf(str, "%.*s\n", rc = sprintf(str, "%.*s\n",
phba->boot_sess.conn_list[0]. boot_conn->negotiated_login_options.auth_data.chap.
negotiated_login_options.auth_data.chap.
target_secret_length, target_secret_length,
(char *)&phba->boot_sess.conn_list[0]. (char *)&boot_conn->negotiated_login_options.
negotiated_login_options.auth_data.chap. auth_data.chap.target_secret);
target_secret);
break; break;
case ISCSI_BOOT_TGT_REV_CHAP_NAME: case ISCSI_BOOT_TGT_REV_CHAP_NAME:
rc = sprintf(str, "%.*s\n", rc = sprintf(str, "%.*s\n",
phba->boot_sess.conn_list[0]. boot_conn->negotiated_login_options.auth_data.chap.
negotiated_login_options.auth_data.chap.
intr_chap_name_length, intr_chap_name_length,
(char *)&phba->boot_sess.conn_list[0]. (char *)&boot_conn->negotiated_login_options.
negotiated_login_options.auth_data.chap. auth_data.chap.intr_chap_name);
intr_chap_name);
break; break;
case ISCSI_BOOT_TGT_REV_CHAP_SECRET: case ISCSI_BOOT_TGT_REV_CHAP_SECRET:
rc = sprintf(str, "%.*s\n", rc = sprintf(str, "%.*s\n",
phba->boot_sess.conn_list[0]. boot_conn->negotiated_login_options.auth_data.chap.
negotiated_login_options.auth_data.chap.
intr_secret_length, intr_secret_length,
(char *)&phba->boot_sess.conn_list[0]. (char *)&boot_conn->negotiated_login_options.
negotiated_login_options.auth_data.chap. auth_data.chap.intr_secret);
intr_secret);
break; break;
case ISCSI_BOOT_TGT_FLAGS: case ISCSI_BOOT_TGT_FLAGS:
rc = sprintf(str, "2\n"); rc = sprintf(str, "2\n");
...@@ -391,40 +380,6 @@ static mode_t beiscsi_eth_get_attr_visibility(void *data, int type) ...@@ -391,40 +380,6 @@ static mode_t beiscsi_eth_get_attr_visibility(void *data, int type)
return rc; return rc;
} }
static int beiscsi_setup_boot_info(struct beiscsi_hba *phba)
{
struct iscsi_boot_kobj *boot_kobj;
phba->boot_kset = iscsi_boot_create_host_kset(phba->shost->host_no);
if (!phba->boot_kset)
return -ENOMEM;
/* get boot info using mgmt cmd */
boot_kobj = iscsi_boot_create_target(phba->boot_kset, 0, phba,
beiscsi_show_boot_tgt_info,
beiscsi_tgt_get_attr_visibility);
if (!boot_kobj)
goto free_kset;
boot_kobj = iscsi_boot_create_initiator(phba->boot_kset, 0, phba,
beiscsi_show_boot_ini_info,
beiscsi_ini_get_attr_visibility);
if (!boot_kobj)
goto free_kset;
boot_kobj = iscsi_boot_create_ethernet(phba->boot_kset, 0, phba,
beiscsi_show_boot_eth_info,
beiscsi_eth_get_attr_visibility);
if (!boot_kobj)
goto free_kset;
return 0;
free_kset:
if (phba->boot_kset)
iscsi_boot_destroy_kset(phba->boot_kset);
return -ENOMEM;
}
/*------------------- PCI Driver operations and data ----------------- */ /*------------------- PCI Driver operations and data ----------------- */
static DEFINE_PCI_DEVICE_TABLE(beiscsi_pci_id_table) = { static DEFINE_PCI_DEVICE_TABLE(beiscsi_pci_id_table) = {
{ PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID1) }, { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID1) },
...@@ -483,14 +438,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) ...@@ -483,14 +438,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)
if (iscsi_host_add(shost, &phba->pcidev->dev)) if (iscsi_host_add(shost, &phba->pcidev->dev))
goto free_devices; goto free_devices;
if (beiscsi_setup_boot_info(phba))
/*
* log error but continue, because we may not be using
* iscsi boot.
*/
shost_printk(KERN_ERR, phba->shost, "Could not set up "
"iSCSI boot info.");
return phba; return phba;
free_devices: free_devices:
...@@ -3511,6 +3458,7 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba) ...@@ -3511,6 +3458,7 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
unsigned int tag, wrb_num; unsigned int tag, wrb_num;
unsigned short status, extd_status; unsigned short status, extd_status;
struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
int ret = -ENOMEM;
tag = beiscsi_get_boot_target(phba); tag = beiscsi_get_boot_target(phba);
if (!tag) { if (!tag) {
...@@ -3535,8 +3483,7 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba) ...@@ -3535,8 +3483,7 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
boot_resp = embedded_payload(wrb); boot_resp = embedded_payload(wrb);
if (boot_resp->boot_session_handle < 0) { if (boot_resp->boot_session_handle < 0) {
printk(KERN_ERR "No Boot Session for this pci_func," shost_printk(KERN_INFO, phba->shost, "No Boot Session.\n");
"session Hndl = %d\n", boot_resp->boot_session_handle);
return -ENXIO; return -ENXIO;
} }
...@@ -3574,14 +3521,70 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba) ...@@ -3574,14 +3521,70 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
wrb = queue_get_wrb(mccq, wrb_num); wrb = queue_get_wrb(mccq, wrb_num);
free_mcc_tag(&phba->ctrl, tag); free_mcc_tag(&phba->ctrl, tag);
session_resp = nonemb_cmd.va ; session_resp = nonemb_cmd.va ;
memcpy(&phba->boot_sess, &session_resp->session_info, memcpy(&phba->boot_sess, &session_resp->session_info,
sizeof(struct mgmt_session_info)); sizeof(struct mgmt_session_info));
pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, ret = 0;
nonemb_cmd.va, nonemb_cmd.dma);
return 0;
boot_freemem: boot_freemem:
pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
nonemb_cmd.va, nonemb_cmd.dma); nonemb_cmd.va, nonemb_cmd.dma);
return ret;
}
static void beiscsi_boot_release(void *data)
{
struct beiscsi_hba *phba = data;
scsi_host_put(phba->shost);
}
static int beiscsi_setup_boot_info(struct beiscsi_hba *phba)
{
struct iscsi_boot_kobj *boot_kobj;
/* get boot info using mgmt cmd */
if (beiscsi_get_boot_info(phba))
/* Try to see if we can carry on without this */
return 0;
phba->boot_kset = iscsi_boot_create_host_kset(phba->shost->host_no);
if (!phba->boot_kset)
return -ENOMEM;
/* get a ref because the show function will ref the phba */
if (!scsi_host_get(phba->shost))
goto free_kset;
boot_kobj = iscsi_boot_create_target(phba->boot_kset, 0, phba,
beiscsi_show_boot_tgt_info,
beiscsi_tgt_get_attr_visibility,
beiscsi_boot_release);
if (!boot_kobj)
goto put_shost;
if (!scsi_host_get(phba->shost))
goto free_kset;
boot_kobj = iscsi_boot_create_initiator(phba->boot_kset, 0, phba,
beiscsi_show_boot_ini_info,
beiscsi_ini_get_attr_visibility,
beiscsi_boot_release);
if (!boot_kobj)
goto put_shost;
if (!scsi_host_get(phba->shost))
goto free_kset;
boot_kobj = iscsi_boot_create_ethernet(phba->boot_kset, 0, phba,
beiscsi_show_boot_eth_info,
beiscsi_eth_get_attr_visibility,
beiscsi_boot_release);
if (!boot_kobj)
goto put_shost;
return 0;
put_shost:
scsi_host_put(phba->shost);
free_kset:
iscsi_boot_destroy_kset(phba->boot_kset);
return -ENOMEM; return -ENOMEM;
} }
...@@ -3963,11 +3966,10 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg, ...@@ -3963,11 +3966,10 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
} }
memcpy(&io_task->cmd_bhs->iscsi_data_pdu. memcpy(&io_task->cmd_bhs->iscsi_data_pdu.
dw[offsetof(struct amap_pdu_data_out, lun) / 32], dw[offsetof(struct amap_pdu_data_out, lun) / 32],
io_task->cmd_bhs->iscsi_hdr.lun, sizeof(struct scsi_lun)); &io_task->cmd_bhs->iscsi_hdr.lun, sizeof(struct scsi_lun));
AMAP_SET_BITS(struct amap_iscsi_wrb, lun, pwrb, AMAP_SET_BITS(struct amap_iscsi_wrb, lun, pwrb,
cpu_to_be16((unsigned short)io_task->cmd_bhs->iscsi_hdr. cpu_to_be16(*(unsigned short *)&io_task->cmd_bhs->iscsi_hdr.lun));
lun[0]));
AMAP_SET_BITS(struct amap_iscsi_wrb, r2t_exp_dtl, pwrb, xferlen); AMAP_SET_BITS(struct amap_iscsi_wrb, r2t_exp_dtl, pwrb, xferlen);
AMAP_SET_BITS(struct amap_iscsi_wrb, wrb_idx, pwrb, AMAP_SET_BITS(struct amap_iscsi_wrb, wrb_idx, pwrb,
io_task->pwrb_handle->wrb_index); io_task->pwrb_handle->wrb_index);
...@@ -4150,7 +4152,6 @@ static void beiscsi_remove(struct pci_dev *pcidev) ...@@ -4150,7 +4152,6 @@ static void beiscsi_remove(struct pci_dev *pcidev)
phba->ctrl.mbox_mem_alloced.size, phba->ctrl.mbox_mem_alloced.size,
phba->ctrl.mbox_mem_alloced.va, phba->ctrl.mbox_mem_alloced.va,
phba->ctrl.mbox_mem_alloced.dma); phba->ctrl.mbox_mem_alloced.dma);
if (phba->boot_kset)
iscsi_boot_destroy_kset(phba->boot_kset); iscsi_boot_destroy_kset(phba->boot_kset);
iscsi_host_remove(phba->shost); iscsi_host_remove(phba->shost);
pci_dev_put(phba->pcidev); pci_dev_put(phba->pcidev);
...@@ -4310,11 +4311,15 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, ...@@ -4310,11 +4311,15 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
goto free_blkenbld; goto free_blkenbld;
} }
hwi_enable_intr(phba); hwi_enable_intr(phba);
ret = beiscsi_get_boot_info(phba);
if (ret < 0) { if (beiscsi_setup_boot_info(phba))
shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-" /*
"No Boot Devices !!!!!\n"); * log error but continue, because we may not be using
} * iscsi boot.
*/
shost_printk(KERN_ERR, phba->shost, "Could not set up "
"iSCSI boot info.");
SE_DEBUG(DBG_LVL_8, "\n\n\n SUCCESS - DRIVER LOADED\n\n\n"); SE_DEBUG(DBG_LVL_8, "\n\n\n SUCCESS - DRIVER LOADED\n\n\n");
return 0; return 0;
......
obj-$(CONFIG_SCSI_BFA_FC) := bfa.o obj-$(CONFIG_SCSI_BFA_FC) := bfa.o
bfa-y := bfad.o bfad_im.o bfad_attr.o bfad_debugfs.o bfa-y := bfad.o bfad_im.o bfad_attr.o bfad_debugfs.o bfad_bsg.o
bfa-y += bfa_ioc.o bfa_ioc_cb.o bfa_ioc_ct.o bfa_hw_cb.o bfa_hw_ct.o bfa-y += bfa_ioc.o bfa_ioc_cb.o bfa_ioc_ct.o bfa_hw_cb.o bfa_hw_ct.o
bfa-y += bfa_fcs.o bfa_fcs_lport.o bfa_fcs_rport.o bfa_fcs_fcpim.o bfa_fcbuild.o bfa-y += bfa_fcs.o bfa_fcs_lport.o bfa_fcs_rport.o bfa_fcs_fcpim.o bfa_fcbuild.o
bfa-y += bfa_port.o bfa_fcpim.o bfa_core.o bfa_svc.o bfa-y += bfa_port.o bfa_fcpim.o bfa_core.o bfa_svc.o
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
struct bfa_s; struct bfa_s;
typedef void (*bfa_isr_func_t) (struct bfa_s *bfa, struct bfi_msg_s *m); typedef void (*bfa_isr_func_t) (struct bfa_s *bfa, struct bfi_msg_s *m);
typedef void (*bfa_cb_cbfn_t) (void *cbarg, bfa_boolean_t complete);
/* /*
* Interrupt message handlers * Interrupt message handlers
...@@ -54,7 +53,8 @@ void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m); ...@@ -54,7 +53,8 @@ void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m);
((void *)((struct bfi_msg_s *)((__bfa)->iocfc.req_cq_ba[__reqq].kva) \ ((void *)((struct bfi_msg_s *)((__bfa)->iocfc.req_cq_ba[__reqq].kva) \
+ bfa_reqq_pi((__bfa), (__reqq))))) + bfa_reqq_pi((__bfa), (__reqq)))))
#define bfa_reqq_produce(__bfa, __reqq) do { \ #define bfa_reqq_produce(__bfa, __reqq, __mh) do { \
(__mh).mtag.h2i.qid = (__bfa)->iocfc.hw_qid[__reqq];\
(__bfa)->iocfc.req_cq_pi[__reqq]++; \ (__bfa)->iocfc.req_cq_pi[__reqq]++; \
(__bfa)->iocfc.req_cq_pi[__reqq] &= \ (__bfa)->iocfc.req_cq_pi[__reqq] &= \
((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1); \ ((__bfa)->iocfc.cfg.drvcfg.num_reqq_elems - 1); \
...@@ -75,16 +75,6 @@ void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m); ...@@ -75,16 +75,6 @@ void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m);
(__index) &= ((__size) - 1); \ (__index) &= ((__size) - 1); \
} while (0) } while (0)
/*
* Queue element to wait for room in request queue. FIFO order is
* maintained when fullfilling requests.
*/
struct bfa_reqq_wait_s {
struct list_head qe;
void (*qresume) (void *cbarg);
void *cbarg;
};
/* /*
* Circular queue usage assignments * Circular queue usage assignments
*/ */
...@@ -128,18 +118,6 @@ bfa_reqq_winit(struct bfa_reqq_wait_s *wqe, void (*qresume) (void *cbarg), ...@@ -128,18 +118,6 @@ bfa_reqq_winit(struct bfa_reqq_wait_s *wqe, void (*qresume) (void *cbarg),
#define bfa_reqq_wcancel(__wqe) list_del(&(__wqe)->qe) #define bfa_reqq_wcancel(__wqe) list_del(&(__wqe)->qe)
/*
* Generic BFA callback element.
*/
struct bfa_cb_qe_s {
struct list_head qe;
bfa_cb_cbfn_t cbfn;
bfa_boolean_t once;
u32 rsvd;
void *cbarg;
};
#define bfa_cb_queue(__bfa, __hcb_qe, __cbfn, __cbarg) do { \ #define bfa_cb_queue(__bfa, __hcb_qe, __cbfn, __cbarg) do { \
(__hcb_qe)->cbfn = (__cbfn); \ (__hcb_qe)->cbfn = (__cbfn); \
(__hcb_qe)->cbarg = (__cbarg); \ (__hcb_qe)->cbarg = (__cbarg); \
...@@ -172,44 +150,14 @@ struct bfa_pciid_s { ...@@ -172,44 +150,14 @@ struct bfa_pciid_s {
extern char bfa_version[]; extern char bfa_version[];
/*
* BFA memory resources
*/
enum bfa_mem_type {
BFA_MEM_TYPE_KVA = 1, /* Kernel Virtual Memory *(non-dma-able) */
BFA_MEM_TYPE_DMA = 2, /* DMA-able memory */
BFA_MEM_TYPE_MAX = BFA_MEM_TYPE_DMA,
};
struct bfa_mem_elem_s {
enum bfa_mem_type mem_type; /* see enum bfa_mem_type */
u32 mem_len; /* Total Length in Bytes */
u8 *kva; /* kernel virtual address */
u64 dma; /* dma address if DMA memory */
u8 *kva_curp; /* kva allocation cursor */
u64 dma_curp; /* dma allocation cursor */
};
struct bfa_meminfo_s {
struct bfa_mem_elem_s meminfo[BFA_MEM_TYPE_MAX];
};
#define bfa_meminfo_kva(_m) \
((_m)->meminfo[BFA_MEM_TYPE_KVA - 1].kva_curp)
#define bfa_meminfo_dma_virt(_m) \
((_m)->meminfo[BFA_MEM_TYPE_DMA - 1].kva_curp)
#define bfa_meminfo_dma_phys(_m) \
((_m)->meminfo[BFA_MEM_TYPE_DMA - 1].dma_curp)
struct bfa_iocfc_regs_s { struct bfa_iocfc_regs_s {
void __iomem *intr_status; void __iomem *intr_status;
void __iomem *intr_mask; void __iomem *intr_mask;
void __iomem *cpe_q_pi[BFI_IOC_MAX_CQS]; void __iomem *cpe_q_pi[BFI_IOC_MAX_CQS];
void __iomem *cpe_q_ci[BFI_IOC_MAX_CQS]; void __iomem *cpe_q_ci[BFI_IOC_MAX_CQS];
void __iomem *cpe_q_depth[BFI_IOC_MAX_CQS];
void __iomem *cpe_q_ctrl[BFI_IOC_MAX_CQS]; void __iomem *cpe_q_ctrl[BFI_IOC_MAX_CQS];
void __iomem *rme_q_ci[BFI_IOC_MAX_CQS]; void __iomem *rme_q_ci[BFI_IOC_MAX_CQS];
void __iomem *rme_q_pi[BFI_IOC_MAX_CQS]; void __iomem *rme_q_pi[BFI_IOC_MAX_CQS];
void __iomem *rme_q_depth[BFI_IOC_MAX_CQS];
void __iomem *rme_q_ctrl[BFI_IOC_MAX_CQS]; void __iomem *rme_q_ctrl[BFI_IOC_MAX_CQS];
}; };
...@@ -231,25 +179,55 @@ struct bfa_hwif_s { ...@@ -231,25 +179,55 @@ struct bfa_hwif_s {
void (*hw_reqq_ack)(struct bfa_s *bfa, int reqq); void (*hw_reqq_ack)(struct bfa_s *bfa, int reqq);
void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq); void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq);
void (*hw_msix_init)(struct bfa_s *bfa, int nvecs); void (*hw_msix_init)(struct bfa_s *bfa, int nvecs);
void (*hw_msix_install)(struct bfa_s *bfa); void (*hw_msix_ctrl_install)(struct bfa_s *bfa);
void (*hw_msix_queue_install)(struct bfa_s *bfa);
void (*hw_msix_uninstall)(struct bfa_s *bfa); void (*hw_msix_uninstall)(struct bfa_s *bfa);
void (*hw_isr_mode_set)(struct bfa_s *bfa, bfa_boolean_t msix); void (*hw_isr_mode_set)(struct bfa_s *bfa, bfa_boolean_t msix);
void (*hw_msix_getvecs)(struct bfa_s *bfa, u32 *vecmap, void (*hw_msix_getvecs)(struct bfa_s *bfa, u32 *vecmap,
u32 *nvecs, u32 *maxvec); u32 *nvecs, u32 *maxvec);
void (*hw_msix_get_rme_range) (struct bfa_s *bfa, u32 *start, void (*hw_msix_get_rme_range) (struct bfa_s *bfa, u32 *start,
u32 *end); u32 *end);
int cpe_vec_q0;
int rme_vec_q0;
}; };
typedef void (*bfa_cb_iocfc_t) (void *cbarg, enum bfa_status status); typedef void (*bfa_cb_iocfc_t) (void *cbarg, enum bfa_status status);
struct bfa_faa_cbfn_s {
bfa_cb_iocfc_t faa_cbfn;
void *faa_cbarg;
};
#define BFA_FAA_ENABLED 1
#define BFA_FAA_DISABLED 2
/*
* FAA attributes
*/
struct bfa_faa_attr_s {
wwn_t faa;
u8 faa_state;
u8 pwwn_source;
u8 rsvd[6];
};
struct bfa_faa_args_s {
struct bfa_faa_attr_s *faa_attr;
struct bfa_faa_cbfn_s faa_cb;
u8 faa_state;
bfa_boolean_t busy;
};
struct bfa_iocfc_s { struct bfa_iocfc_s {
struct bfa_s *bfa; struct bfa_s *bfa;
struct bfa_iocfc_cfg_s cfg; struct bfa_iocfc_cfg_s cfg;
int action; int action;
u32 req_cq_pi[BFI_IOC_MAX_CQS]; u32 req_cq_pi[BFI_IOC_MAX_CQS];
u32 rsp_cq_ci[BFI_IOC_MAX_CQS]; u32 rsp_cq_ci[BFI_IOC_MAX_CQS];
u8 hw_qid[BFI_IOC_MAX_CQS];
struct bfa_cb_qe_s init_hcb_qe; struct bfa_cb_qe_s init_hcb_qe;
struct bfa_cb_qe_s stop_hcb_qe; struct bfa_cb_qe_s stop_hcb_qe;
struct bfa_cb_qe_s dis_hcb_qe; struct bfa_cb_qe_s dis_hcb_qe;
struct bfa_cb_qe_s en_hcb_qe;
struct bfa_cb_qe_s stats_hcb_qe; struct bfa_cb_qe_s stats_hcb_qe;
bfa_boolean_t cfgdone; bfa_boolean_t cfgdone;
...@@ -257,7 +235,6 @@ struct bfa_iocfc_s { ...@@ -257,7 +235,6 @@ struct bfa_iocfc_s {
struct bfi_iocfc_cfg_s *cfginfo; struct bfi_iocfc_cfg_s *cfginfo;
struct bfa_dma_s cfgrsp_dma; struct bfa_dma_s cfgrsp_dma;
struct bfi_iocfc_cfgrsp_s *cfgrsp; struct bfi_iocfc_cfgrsp_s *cfgrsp;
struct bfi_iocfc_cfg_reply_s *cfg_reply;
struct bfa_dma_s req_cq_ba[BFI_IOC_MAX_CQS]; struct bfa_dma_s req_cq_ba[BFI_IOC_MAX_CQS];
struct bfa_dma_s req_cq_shadow_ci[BFI_IOC_MAX_CQS]; struct bfa_dma_s req_cq_shadow_ci[BFI_IOC_MAX_CQS];
struct bfa_dma_s rsp_cq_ba[BFI_IOC_MAX_CQS]; struct bfa_dma_s rsp_cq_ba[BFI_IOC_MAX_CQS];
...@@ -267,18 +244,42 @@ struct bfa_iocfc_s { ...@@ -267,18 +244,42 @@ struct bfa_iocfc_s {
bfa_cb_iocfc_t updateq_cbfn; /* bios callback function */ bfa_cb_iocfc_t updateq_cbfn; /* bios callback function */
void *updateq_cbarg; /* bios callback arg */ void *updateq_cbarg; /* bios callback arg */
u32 intr_mask; u32 intr_mask;
struct bfa_faa_args_s faa_args;
struct bfa_mem_dma_s ioc_dma;
struct bfa_mem_dma_s iocfc_dma;
struct bfa_mem_dma_s reqq_dma[BFI_IOC_MAX_CQS];
struct bfa_mem_dma_s rspq_dma[BFI_IOC_MAX_CQS];
struct bfa_mem_kva_s kva_seg;
}; };
#define bfa_lpuid(__bfa) \ #define BFA_MEM_IOC_DMA(_bfa) (&((_bfa)->iocfc.ioc_dma))
bfa_ioc_portid(&(__bfa)->ioc) #define BFA_MEM_IOCFC_DMA(_bfa) (&((_bfa)->iocfc.iocfc_dma))
#define BFA_MEM_REQQ_DMA(_bfa, _qno) (&((_bfa)->iocfc.reqq_dma[(_qno)]))
#define BFA_MEM_RSPQ_DMA(_bfa, _qno) (&((_bfa)->iocfc.rspq_dma[(_qno)]))
#define BFA_MEM_IOCFC_KVA(_bfa) (&((_bfa)->iocfc.kva_seg))
#define bfa_fn_lpu(__bfa) \
bfi_fn_lpu(bfa_ioc_pcifn(&(__bfa)->ioc), bfa_ioc_portid(&(__bfa)->ioc))
#define bfa_msix_init(__bfa, __nvecs) \ #define bfa_msix_init(__bfa, __nvecs) \
((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs)) ((__bfa)->iocfc.hwif.hw_msix_init(__bfa, __nvecs))
#define bfa_msix_install(__bfa) \ #define bfa_msix_ctrl_install(__bfa) \
((__bfa)->iocfc.hwif.hw_msix_install(__bfa)) ((__bfa)->iocfc.hwif.hw_msix_ctrl_install(__bfa))
#define bfa_msix_queue_install(__bfa) \
((__bfa)->iocfc.hwif.hw_msix_queue_install(__bfa))
#define bfa_msix_uninstall(__bfa) \ #define bfa_msix_uninstall(__bfa) \
((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa)) ((__bfa)->iocfc.hwif.hw_msix_uninstall(__bfa))
#define bfa_isr_mode_set(__bfa, __msix) \ #define bfa_isr_rspq_ack(__bfa, __queue) do { \
((__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix)) if ((__bfa)->iocfc.hwif.hw_rspq_ack) \
(__bfa)->iocfc.hwif.hw_rspq_ack(__bfa, __queue); \
} while (0)
#define bfa_isr_reqq_ack(__bfa, __queue) do { \
if ((__bfa)->iocfc.hwif.hw_reqq_ack) \
(__bfa)->iocfc.hwif.hw_reqq_ack(__bfa, __queue); \
} while (0)
#define bfa_isr_mode_set(__bfa, __msix) do { \
if ((__bfa)->iocfc.hwif.hw_isr_mode_set) \
(__bfa)->iocfc.hwif.hw_isr_mode_set(__bfa, __msix); \
} while (0)
#define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) \ #define bfa_msix_getvecs(__bfa, __vecmap, __nvecs, __maxvec) \
((__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap, \ ((__bfa)->iocfc.hwif.hw_msix_getvecs(__bfa, __vecmap, \
__nvecs, __maxvec)) __nvecs, __maxvec))
...@@ -290,17 +291,17 @@ struct bfa_iocfc_s { ...@@ -290,17 +291,17 @@ struct bfa_iocfc_s {
/* /*
* FC specific IOC functions. * FC specific IOC functions.
*/ */
void bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, void bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg,
u32 *dm_len); struct bfa_meminfo_s *meminfo,
struct bfa_s *bfa);
void bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, void bfa_iocfc_attach(struct bfa_s *bfa, void *bfad,
struct bfa_iocfc_cfg_s *cfg, struct bfa_iocfc_cfg_s *cfg,
struct bfa_meminfo_s *meminfo,
struct bfa_pcidev_s *pcidev); struct bfa_pcidev_s *pcidev);
void bfa_iocfc_init(struct bfa_s *bfa); void bfa_iocfc_init(struct bfa_s *bfa);
void bfa_iocfc_start(struct bfa_s *bfa); void bfa_iocfc_start(struct bfa_s *bfa);
void bfa_iocfc_stop(struct bfa_s *bfa); void bfa_iocfc_stop(struct bfa_s *bfa);
void bfa_iocfc_isr(void *bfa, struct bfi_mbmsg_s *msg); void bfa_iocfc_isr(void *bfa, struct bfi_mbmsg_s *msg);
void bfa_iocfc_set_snsbase(struct bfa_s *bfa, u64 snsbase_pa); void bfa_iocfc_set_snsbase(struct bfa_s *bfa, int seg_no, u64 snsbase_pa);
bfa_boolean_t bfa_iocfc_is_operational(struct bfa_s *bfa); bfa_boolean_t bfa_iocfc_is_operational(struct bfa_s *bfa);
void bfa_iocfc_reset_queues(struct bfa_s *bfa); void bfa_iocfc_reset_queues(struct bfa_s *bfa);
...@@ -310,10 +311,10 @@ void bfa_msix_rspq(struct bfa_s *bfa, int vec); ...@@ -310,10 +311,10 @@ void bfa_msix_rspq(struct bfa_s *bfa, int vec);
void bfa_msix_lpu_err(struct bfa_s *bfa, int vec); void bfa_msix_lpu_err(struct bfa_s *bfa, int vec);
void bfa_hwcb_reginit(struct bfa_s *bfa); void bfa_hwcb_reginit(struct bfa_s *bfa);
void bfa_hwcb_reqq_ack(struct bfa_s *bfa, int rspq);
void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq); void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq);
void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs); void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs);
void bfa_hwcb_msix_install(struct bfa_s *bfa); void bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa);
void bfa_hwcb_msix_queue_install(struct bfa_s *bfa);
void bfa_hwcb_msix_uninstall(struct bfa_s *bfa); void bfa_hwcb_msix_uninstall(struct bfa_s *bfa);
void bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix); void bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix);
void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs, void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs,
...@@ -321,10 +322,12 @@ void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs, ...@@ -321,10 +322,12 @@ void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs,
void bfa_hwcb_msix_get_rme_range(struct bfa_s *bfa, u32 *start, void bfa_hwcb_msix_get_rme_range(struct bfa_s *bfa, u32 *start,
u32 *end); u32 *end);
void bfa_hwct_reginit(struct bfa_s *bfa); void bfa_hwct_reginit(struct bfa_s *bfa);
void bfa_hwct2_reginit(struct bfa_s *bfa);
void bfa_hwct_reqq_ack(struct bfa_s *bfa, int rspq); void bfa_hwct_reqq_ack(struct bfa_s *bfa, int rspq);
void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq); void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq);
void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs); void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs);
void bfa_hwct_msix_install(struct bfa_s *bfa); void bfa_hwct_msix_ctrl_install(struct bfa_s *bfa);
void bfa_hwct_msix_queue_install(struct bfa_s *bfa);
void bfa_hwct_msix_uninstall(struct bfa_s *bfa); void bfa_hwct_msix_uninstall(struct bfa_s *bfa);
void bfa_hwct_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix); void bfa_hwct_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix);
void bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs, void bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs,
...@@ -377,7 +380,8 @@ void bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids); ...@@ -377,7 +380,8 @@ void bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids);
void bfa_cfg_get_default(struct bfa_iocfc_cfg_s *cfg); void bfa_cfg_get_default(struct bfa_iocfc_cfg_s *cfg);
void bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg); void bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg);
void bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, void bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg,
struct bfa_meminfo_s *meminfo); struct bfa_meminfo_s *meminfo,
struct bfa_s *bfa);
void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
struct bfa_meminfo_s *meminfo, struct bfa_meminfo_s *meminfo,
struct bfa_pcidev_s *pcidev); struct bfa_pcidev_s *pcidev);
......
此差异已折叠。
此差异已折叠。
...@@ -93,9 +93,11 @@ struct bfa_lport_cfg_s { ...@@ -93,9 +93,11 @@ struct bfa_lport_cfg_s {
wwn_t pwwn; /* port wwn */ wwn_t pwwn; /* port wwn */
wwn_t nwwn; /* node wwn */ wwn_t nwwn; /* node wwn */
struct bfa_lport_symname_s sym_name; /* vm port symbolic name */ struct bfa_lport_symname_s sym_name; /* vm port symbolic name */
bfa_boolean_t preboot_vp; /* vport created from PBC */
enum bfa_lport_role roles; /* FCS port roles */ enum bfa_lport_role roles; /* FCS port roles */
u32 rsvd;
bfa_boolean_t preboot_vp; /* vport created from PBC */
u8 tag[16]; /* opaque tag from application */ u8 tag[16]; /* opaque tag from application */
u8 padding[4];
}; };
/* /*
...@@ -249,12 +251,13 @@ enum bfa_vport_state { ...@@ -249,12 +251,13 @@ enum bfa_vport_state {
BFA_FCS_VPORT_FDISC_SEND = 2, BFA_FCS_VPORT_FDISC_SEND = 2,
BFA_FCS_VPORT_FDISC = 3, BFA_FCS_VPORT_FDISC = 3,
BFA_FCS_VPORT_FDISC_RETRY = 4, BFA_FCS_VPORT_FDISC_RETRY = 4,
BFA_FCS_VPORT_ONLINE = 5, BFA_FCS_VPORT_FDISC_RSP_WAIT = 5,
BFA_FCS_VPORT_DELETING = 6, BFA_FCS_VPORT_ONLINE = 6,
BFA_FCS_VPORT_CLEANUP = 6, BFA_FCS_VPORT_DELETING = 7,
BFA_FCS_VPORT_LOGO_SEND = 7, BFA_FCS_VPORT_CLEANUP = 8,
BFA_FCS_VPORT_LOGO = 8, BFA_FCS_VPORT_LOGO_SEND = 9,
BFA_FCS_VPORT_ERROR = 9, BFA_FCS_VPORT_LOGO = 10,
BFA_FCS_VPORT_ERROR = 11,
BFA_FCS_VPORT_MAX_STATE, BFA_FCS_VPORT_MAX_STATE,
}; };
......
...@@ -47,13 +47,12 @@ struct bfa_iocfc_fwcfg_s { ...@@ -47,13 +47,12 @@ struct bfa_iocfc_fwcfg_s {
u16 num_rports; /* number of remote ports */ u16 num_rports; /* number of remote ports */
u16 num_ioim_reqs; /* number of IO reqs */ u16 num_ioim_reqs; /* number of IO reqs */
u16 num_tskim_reqs; /* task management requests */ u16 num_tskim_reqs; /* task management requests */
u16 num_iotm_reqs; /* number of TM IO reqs */ u16 num_fwtio_reqs; /* number of TM IO reqs in FW */
u16 num_tsktm_reqs; /* TM task management requests*/
u16 num_fcxp_reqs; /* unassisted FC exchanges */ u16 num_fcxp_reqs; /* unassisted FC exchanges */
u16 num_uf_bufs; /* unsolicited recv buffers */ u16 num_uf_bufs; /* unsolicited recv buffers */
u8 num_cqs; u8 num_cqs;
u8 fw_tick_res; /* FW clock resolution in ms */ u8 fw_tick_res; /* FW clock resolution in ms */
u8 rsvd[4]; u8 rsvd[2];
}; };
#pragma pack() #pragma pack()
...@@ -66,8 +65,12 @@ struct bfa_iocfc_drvcfg_s { ...@@ -66,8 +65,12 @@ struct bfa_iocfc_drvcfg_s {
u16 ioc_recover; /* IOC recovery mode */ u16 ioc_recover; /* IOC recovery mode */
u16 min_cfg; /* minimum configuration */ u16 min_cfg; /* minimum configuration */
u16 path_tov; /* device path timeout */ u16 path_tov; /* device path timeout */
u16 num_tio_reqs; /*!< number of TM IO reqs */
u8 port_mode;
u8 rsvd_a;
bfa_boolean_t delay_comp; /* delay completion of bfa_boolean_t delay_comp; /* delay completion of
failed inflight IOs */ failed inflight IOs */
u16 num_ttsk_reqs; /* TM task management requests */
u32 rsvd; u32 rsvd;
}; };
...@@ -82,7 +85,7 @@ struct bfa_iocfc_cfg_s { ...@@ -82,7 +85,7 @@ struct bfa_iocfc_cfg_s {
/* /*
* IOC firmware IO stats * IOC firmware IO stats
*/ */
struct bfa_fw_io_stats_s { struct bfa_fw_ioim_stats_s {
u32 host_abort; /* IO aborted by host driver*/ u32 host_abort; /* IO aborted by host driver*/
u32 host_cleanup; /* IO clean up by host driver */ u32 host_cleanup; /* IO clean up by host driver */
...@@ -152,6 +155,54 @@ struct bfa_fw_io_stats_s { ...@@ -152,6 +155,54 @@ struct bfa_fw_io_stats_s {
*/ */
}; };
struct bfa_fw_tio_stats_s {
u32 tio_conf_proc; /* TIO CONF processed */
u32 tio_conf_drop; /* TIO CONF dropped */
u32 tio_cleanup_req; /* TIO cleanup requested */
u32 tio_cleanup_comp; /* TIO cleanup completed */
u32 tio_abort_rsp; /* TIO abort response */
u32 tio_abort_rsp_comp; /* TIO abort rsp completed */
u32 tio_abts_req; /* TIO ABTS requested */
u32 tio_abts_ack; /* TIO ABTS ack-ed */
u32 tio_abts_ack_nocomp; /* TIO ABTS ack-ed but not completed */
u32 tio_abts_tmo; /* TIO ABTS timeout */
u32 tio_snsdata_dma; /* TIO sense data DMA */
u32 tio_rxwchan_wait; /* TIO waiting for RX wait channel */
u32 tio_rxwchan_avail; /* TIO RX wait channel available */
u32 tio_hit_bls; /* TIO IOH BLS event */
u32 tio_uf_recv; /* TIO received UF */
u32 tio_rd_invalid_sm; /* TIO read reqst in wrong state machine */
u32 tio_wr_invalid_sm;/* TIO write reqst in wrong state machine */
u32 ds_rxwchan_wait; /* DS waiting for RX wait channel */
u32 ds_rxwchan_avail; /* DS RX wait channel available */
u32 ds_unaligned_rd; /* DS unaligned read */
u32 ds_rdcomp_invalid_sm; /* DS read completed in wrong state machine */
u32 ds_wrcomp_invalid_sm; /* DS write completed in wrong state machine */
u32 ds_flush_req; /* DS flush requested */
u32 ds_flush_comp; /* DS flush completed */
u32 ds_xfrdy_exp; /* DS XFER_RDY expired */
u32 ds_seq_cnt_err; /* DS seq cnt error */
u32 ds_seq_len_err; /* DS seq len error */
u32 ds_data_oor; /* DS data out of order */
u32 ds_hit_bls; /* DS hit BLS */
u32 ds_edtov_timer_exp; /* DS edtov expired */
u32 ds_cpu_owned; /* DS cpu owned */
u32 ds_hit_class2; /* DS hit class2 */
u32 ds_length_err; /* DS length error */
u32 ds_ro_ooo_err; /* DS relative offset out-of-order error */
u32 ds_rectov_timer_exp; /* DS rectov expired */
u32 ds_unexp_fr_err; /* DS unexp frame error */
};
/*
* IOC firmware IO stats
*/
struct bfa_fw_io_stats_s {
struct bfa_fw_ioim_stats_s ioim_stats;
struct bfa_fw_tio_stats_s tio_stats;
};
/* /*
* IOC port firmware stats * IOC port firmware stats
*/ */
...@@ -205,6 +256,7 @@ struct bfa_fw_port_lksm_stats_s { ...@@ -205,6 +256,7 @@ struct bfa_fw_port_lksm_stats_s {
u32 nos_tx; /* No. of times NOS tx started */ u32 nos_tx; /* No. of times NOS tx started */
u32 hwsm_lrr_rx; /* No. of times LRR rx-ed by HWSM */ u32 hwsm_lrr_rx; /* No. of times LRR rx-ed by HWSM */
u32 hwsm_lr_rx; /* No. of times LR rx-ed by HWSM */ u32 hwsm_lr_rx; /* No. of times LR rx-ed by HWSM */
u32 bbsc_lr; /* LKSM LR tx for credit recovery */
}; };
struct bfa_fw_port_snsm_stats_s { struct bfa_fw_port_snsm_stats_s {
...@@ -636,6 +688,7 @@ enum bfa_port_states { ...@@ -636,6 +688,7 @@ enum bfa_port_states {
BFA_PORT_ST_FWMISMATCH = 12, BFA_PORT_ST_FWMISMATCH = 12,
BFA_PORT_ST_PREBOOT_DISABLED = 13, BFA_PORT_ST_PREBOOT_DISABLED = 13,
BFA_PORT_ST_TOGGLING_QWAIT = 14, BFA_PORT_ST_TOGGLING_QWAIT = 14,
BFA_PORT_ST_ACQ_ADDR = 15,
BFA_PORT_ST_MAX_STATE, BFA_PORT_ST_MAX_STATE,
}; };
...@@ -748,6 +801,10 @@ struct bfa_port_cfg_s { ...@@ -748,6 +801,10 @@ struct bfa_port_cfg_s {
u8 tx_bbcredit; /* transmit buffer credits */ u8 tx_bbcredit; /* transmit buffer credits */
u8 ratelimit; /* ratelimit enabled or not */ u8 ratelimit; /* ratelimit enabled or not */
u8 trl_def_speed; /* ratelimit default speed */ u8 trl_def_speed; /* ratelimit default speed */
u8 bb_scn; /* BB_SCN value from FLOGI Exchg */
u8 bb_scn_state; /* Config state of BB_SCN */
u8 faa_state; /* FAA enabled/disabled */
u8 rsvd[1];
u16 path_tov; /* device path timeout */ u16 path_tov; /* device path timeout */
u16 q_depth; /* SCSI Queue depth */ u16 q_depth; /* SCSI Queue depth */
}; };
...@@ -783,7 +840,7 @@ struct bfa_port_attr_s { ...@@ -783,7 +840,7 @@ struct bfa_port_attr_s {
enum bfa_port_topology topology; /* current topology */ enum bfa_port_topology topology; /* current topology */
bfa_boolean_t beacon; /* current beacon status */ bfa_boolean_t beacon; /* current beacon status */
bfa_boolean_t link_e2e_beacon; /* link beacon is on */ bfa_boolean_t link_e2e_beacon; /* link beacon is on */
bfa_boolean_t plog_enabled; /* portlog is enabled */ bfa_boolean_t bbsc_op_status; /* fc credit recovery oper state */
/* /*
* Dynamic field - info from FCS * Dynamic field - info from FCS
...@@ -792,12 +849,10 @@ struct bfa_port_attr_s { ...@@ -792,12 +849,10 @@ struct bfa_port_attr_s {
enum bfa_port_type port_type; /* current topology */ enum bfa_port_type port_type; /* current topology */
u32 loopback; /* external loopback */ u32 loopback; /* external loopback */
u32 authfail; /* auth fail state */ u32 authfail; /* auth fail state */
bfa_boolean_t io_profile; /* get it from fcpim mod */
u8 pad[4]; /* for 64-bit alignement */
/* FCoE specific */ /* FCoE specific */
u16 fcoe_vlan; u16 fcoe_vlan;
u8 rsvd1[6]; u8 rsvd1[2];
}; };
/* /*
...@@ -987,6 +1042,19 @@ struct bfa_itnim_ioprofile_s { ...@@ -987,6 +1042,19 @@ struct bfa_itnim_ioprofile_s {
struct bfa_itnim_latency_s io_latency; struct bfa_itnim_latency_s io_latency;
}; };
/*
* vHBA port attribute values.
*/
struct bfa_vhba_attr_s {
wwn_t nwwn; /* node wwn */
wwn_t pwwn; /* port wwn */
u32 pid; /* port ID */
bfa_boolean_t io_profile; /* get it from fcpim mod */
bfa_boolean_t plog_enabled; /* portlog is enabled */
u16 path_tov;
u8 rsvd[2];
};
/* /*
* FC physical port statistics. * FC physical port statistics.
*/ */
...@@ -1020,6 +1088,9 @@ struct bfa_port_fc_stats_s { ...@@ -1020,6 +1088,9 @@ struct bfa_port_fc_stats_s {
u64 bad_os_count; /* Invalid ordered sets */ u64 bad_os_count; /* Invalid ordered sets */
u64 err_enc_out; /* Encoding err nonframe_8b10b */ u64 err_enc_out; /* Encoding err nonframe_8b10b */
u64 err_enc; /* Encoding err frame_8b10b */ u64 err_enc; /* Encoding err frame_8b10b */
u64 bbsc_frames_lost; /* Credit Recovery-Frames Lost */
u64 bbsc_credits_lost; /* Credit Recovery-Credits Lost */
u64 bbsc_link_resets; /* Credit Recovery-Link Resets */
}; };
/* /*
...@@ -1078,4 +1149,83 @@ union bfa_port_stats_u { ...@@ -1078,4 +1149,83 @@ union bfa_port_stats_u {
struct bfa_port_eth_stats_s eth; struct bfa_port_eth_stats_s eth;
}; };
struct bfa_port_cfg_mode_s {
u16 max_pf;
u16 max_vf;
enum bfa_mode_s mode;
};
#pragma pack(1)
#define BFA_CEE_LLDP_MAX_STRING_LEN (128)
#define BFA_CEE_DCBX_MAX_PRIORITY (8)
#define BFA_CEE_DCBX_MAX_PGID (8)
struct bfa_cee_lldp_str_s {
u8 sub_type;
u8 len;
u8 rsvd[2];
u8 value[BFA_CEE_LLDP_MAX_STRING_LEN];
};
struct bfa_cee_lldp_cfg_s {
struct bfa_cee_lldp_str_s chassis_id;
struct bfa_cee_lldp_str_s port_id;
struct bfa_cee_lldp_str_s port_desc;
struct bfa_cee_lldp_str_s sys_name;
struct bfa_cee_lldp_str_s sys_desc;
struct bfa_cee_lldp_str_s mgmt_addr;
u16 time_to_live;
u16 enabled_system_cap;
};
/* CEE/DCBX parameters */
struct bfa_cee_dcbx_cfg_s {
u8 pgid[BFA_CEE_DCBX_MAX_PRIORITY];
u8 pg_percentage[BFA_CEE_DCBX_MAX_PGID];
u8 pfc_primap; /* bitmap of priorties with PFC enabled */
u8 fcoe_primap; /* bitmap of priorities used for FcoE traffic */
u8 iscsi_primap; /* bitmap of priorities used for iSCSI traffic */
u8 dcbx_version; /* operating version:CEE or preCEE */
u8 lls_fcoe; /* FCoE Logical Link Status */
u8 lls_lan; /* LAN Logical Link Status */
u8 rsvd[2];
};
/* CEE Query */
struct bfa_cee_attr_s {
u8 cee_status;
u8 error_reason;
struct bfa_cee_lldp_cfg_s lldp_remote;
struct bfa_cee_dcbx_cfg_s dcbx_remote;
mac_t src_mac;
u8 link_speed;
u8 nw_priority;
u8 filler[2];
};
/* LLDP/DCBX/CEE Statistics */
struct bfa_cee_stats_s {
u32 lldp_tx_frames; /* LLDP Tx Frames */
u32 lldp_rx_frames; /* LLDP Rx Frames */
u32 lldp_rx_frames_invalid; /* LLDP Rx Frames invalid */
u32 lldp_rx_frames_new; /* LLDP Rx Frames new */
u32 lldp_tlvs_unrecognized; /* LLDP Rx unrecog. TLVs */
u32 lldp_rx_shutdown_tlvs; /* LLDP Rx shutdown TLVs */
u32 lldp_info_aged_out; /* LLDP remote info aged */
u32 dcbx_phylink_ups; /* DCBX phy link ups */
u32 dcbx_phylink_downs; /* DCBX phy link downs */
u32 dcbx_rx_tlvs; /* DCBX Rx TLVs */
u32 dcbx_rx_tlvs_invalid; /* DCBX Rx TLVs invalid */
u32 dcbx_control_tlv_error; /* DCBX control TLV errors */
u32 dcbx_feature_tlv_error; /* DCBX feature TLV errors */
u32 dcbx_cee_cfg_new; /* DCBX new CEE cfg rcvd */
u32 cee_status_down; /* DCB status down */
u32 cee_status_up; /* DCB status up */
u32 cee_hw_cfg_changed; /* DCB hw cfg changed */
u32 cee_rx_invalid_cfg; /* DCB invalid cfg */
};
#pragma pack()
#endif /* __BFA_DEFS_SVC_H__ */ #endif /* __BFA_DEFS_SVC_H__ */
...@@ -1021,7 +1021,7 @@ struct fc_symname_s { ...@@ -1021,7 +1021,7 @@ struct fc_symname_s {
#define FC_ED_TOV 2 #define FC_ED_TOV 2
#define FC_REC_TOV (FC_ED_TOV + 1) #define FC_REC_TOV (FC_ED_TOV + 1)
#define FC_RA_TOV 10 #define FC_RA_TOV 10
#define FC_ELS_TOV (2 * FC_RA_TOV) #define FC_ELS_TOV ((2 * FC_RA_TOV) + 1)
#define FC_FCCT_TOV (3 * FC_RA_TOV) #define FC_FCCT_TOV (3 * FC_RA_TOV)
/* /*
...@@ -1048,15 +1048,6 @@ struct fc_vft_s { ...@@ -1048,15 +1048,6 @@ struct fc_vft_s {
u32 res_c:24; u32 res_c:24;
}; };
/*
* FCP
*/
enum {
FCP_RJT = 0x01000000, /* SRR reject */
FCP_SRR_ACCEPT = 0x02000000, /* SRR accept */
FCP_SRR = 0x14000000, /* Sequence Retransmission Request */
};
/* /*
* FCP_CMND definitions * FCP_CMND definitions
*/ */
......
...@@ -94,7 +94,6 @@ fcbuild_init(void) ...@@ -94,7 +94,6 @@ fcbuild_init(void)
*/ */
plogi_tmpl.csp.verhi = FC_PH_VER_PH_3; plogi_tmpl.csp.verhi = FC_PH_VER_PH_3;
plogi_tmpl.csp.verlo = FC_PH_VER_4_3; plogi_tmpl.csp.verlo = FC_PH_VER_4_3;
plogi_tmpl.csp.bbcred = cpu_to_be16(0x0004);
plogi_tmpl.csp.ciro = 0x1; plogi_tmpl.csp.ciro = 0x1;
plogi_tmpl.csp.cisc = 0x0; plogi_tmpl.csp.cisc = 0x0;
plogi_tmpl.csp.altbbcred = 0x0; plogi_tmpl.csp.altbbcred = 0x0;
...@@ -156,6 +155,22 @@ fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id) ...@@ -156,6 +155,22 @@ fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id)
*/ */
} }
static void
fc_gsresp_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id)
{
memset(fchs, 0, sizeof(struct fchs_s));
fchs->routing = FC_RTG_FC4_DEV_DATA;
fchs->cat_info = FC_CAT_SOLICIT_CTRL;
fchs->type = FC_TYPE_SERVICES;
fchs->f_ctl =
bfa_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH |
FCTL_END_SEQ | FCTL_SI_XFER);
fchs->d_id = d_id;
fchs->s_id = s_id;
fchs->ox_id = ox_id;
}
void void
fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id) fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id)
{ {
...@@ -207,7 +222,7 @@ fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id) ...@@ -207,7 +222,7 @@ fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id)
static u16 static u16
fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
__be16 ox_id, wwn_t port_name, wwn_t node_name, __be16 ox_id, wwn_t port_name, wwn_t node_name,
u16 pdu_size, u8 els_code) u16 pdu_size, u16 bb_cr, u8 els_code)
{ {
struct fc_logi_s *plogi = (struct fc_logi_s *) (pld); struct fc_logi_s *plogi = (struct fc_logi_s *) (pld);
...@@ -220,6 +235,7 @@ fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, ...@@ -220,6 +235,7 @@ fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
fc_els_rsp_build(fchs, d_id, s_id, ox_id); fc_els_rsp_build(fchs, d_id, s_id, ox_id);
plogi->csp.rxsz = plogi->class3.rxsz = cpu_to_be16(pdu_size); plogi->csp.rxsz = plogi->class3.rxsz = cpu_to_be16(pdu_size);
plogi->csp.bbcred = cpu_to_be16(bb_cr);
memcpy(&plogi->port_name, &port_name, sizeof(wwn_t)); memcpy(&plogi->port_name, &port_name, sizeof(wwn_t));
memcpy(&plogi->node_name, &node_name, sizeof(wwn_t)); memcpy(&plogi->node_name, &node_name, sizeof(wwn_t));
...@@ -268,15 +284,17 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, ...@@ -268,15 +284,17 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
u16 u16
fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
__be16 ox_id, wwn_t port_name, wwn_t node_name, __be16 ox_id, wwn_t port_name, wwn_t node_name,
u16 pdu_size, u16 local_bb_credits) u16 pdu_size, u16 local_bb_credits, u8 bb_scn)
{ {
u32 d_id = 0; u32 d_id = 0;
u16 bbscn_rxsz = (bb_scn << 12) | pdu_size;
memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s));
fc_els_rsp_build(fchs, d_id, s_id, ox_id); fc_els_rsp_build(fchs, d_id, s_id, ox_id);
flogi->els_cmd.els_code = FC_ELS_ACC; flogi->els_cmd.els_code = FC_ELS_ACC;
flogi->csp.rxsz = flogi->class3.rxsz = cpu_to_be16(pdu_size); flogi->class3.rxsz = cpu_to_be16(pdu_size);
flogi->csp.rxsz = cpu_to_be16(bbscn_rxsz); /* bb_scn/rxsz */
flogi->port_name = port_name; flogi->port_name = port_name;
flogi->node_name = node_name; flogi->node_name = node_name;
...@@ -306,19 +324,19 @@ fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, ...@@ -306,19 +324,19 @@ fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
u16 u16
fc_plogi_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, fc_plogi_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
u16 ox_id, wwn_t port_name, wwn_t node_name, u16 ox_id, wwn_t port_name, wwn_t node_name,
u16 pdu_size) u16 pdu_size, u16 bb_cr)
{ {
return fc_plogi_x_build(fchs, pld, d_id, s_id, ox_id, port_name, return fc_plogi_x_build(fchs, pld, d_id, s_id, ox_id, port_name,
node_name, pdu_size, FC_ELS_PLOGI); node_name, pdu_size, bb_cr, FC_ELS_PLOGI);
} }
u16 u16
fc_plogi_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, fc_plogi_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
u16 ox_id, wwn_t port_name, wwn_t node_name, u16 ox_id, wwn_t port_name, wwn_t node_name,
u16 pdu_size) u16 pdu_size, u16 bb_cr)
{ {
return fc_plogi_x_build(fchs, pld, d_id, s_id, ox_id, port_name, return fc_plogi_x_build(fchs, pld, d_id, s_id, ox_id, port_name,
node_name, pdu_size, FC_ELS_ACC); node_name, pdu_size, bb_cr, FC_ELS_ACC);
} }
enum fc_parse_status enum fc_parse_status
...@@ -1095,6 +1113,21 @@ fc_ct_rsp_parse(struct ct_hdr_s *cthdr) ...@@ -1095,6 +1113,21 @@ fc_ct_rsp_parse(struct ct_hdr_s *cthdr)
return FC_PARSE_OK; return FC_PARSE_OK;
} }
u16
fc_gs_rjt_build(struct fchs_s *fchs, struct ct_hdr_s *cthdr,
u32 d_id, u32 s_id, u16 ox_id, u8 reason_code,
u8 reason_code_expl)
{
fc_gsresp_fchdr_build(fchs, d_id, s_id, ox_id);
cthdr->cmd_rsp_code = cpu_to_be16(CT_RSP_REJECT);
cthdr->rev_id = CT_GS3_REVISION;
cthdr->reason_code = reason_code;
cthdr->exp_code = reason_code_expl;
return sizeof(struct ct_hdr_s);
}
u16 u16
fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr, fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr,
u8 set_br_reg, u32 s_id, u16 ox_id) u8 set_br_reg, u32 s_id, u16 ox_id)
......
...@@ -66,6 +66,9 @@ fc_rpsc_operspeed_to_bfa_speed(enum fc_rpsc_op_speed speed) ...@@ -66,6 +66,9 @@ fc_rpsc_operspeed_to_bfa_speed(enum fc_rpsc_op_speed speed)
case RPSC_OP_SPEED_8G: case RPSC_OP_SPEED_8G:
return BFA_PORT_SPEED_8GBPS; return BFA_PORT_SPEED_8GBPS;
case RPSC_OP_SPEED_16G:
return BFA_PORT_SPEED_16GBPS;
case RPSC_OP_SPEED_10G: case RPSC_OP_SPEED_10G:
return BFA_PORT_SPEED_10GBPS; return BFA_PORT_SPEED_10GBPS;
...@@ -94,6 +97,9 @@ fc_bfa_speed_to_rpsc_operspeed(enum bfa_port_speed op_speed) ...@@ -94,6 +97,9 @@ fc_bfa_speed_to_rpsc_operspeed(enum bfa_port_speed op_speed)
case BFA_PORT_SPEED_8GBPS: case BFA_PORT_SPEED_8GBPS:
return RPSC_OP_SPEED_8G; return RPSC_OP_SPEED_8G;
case BFA_PORT_SPEED_16GBPS:
return RPSC_OP_SPEED_16G;
case BFA_PORT_SPEED_10GBPS: case BFA_PORT_SPEED_10GBPS:
return RPSC_OP_SPEED_10G; return RPSC_OP_SPEED_10G;
...@@ -141,11 +147,11 @@ u16 fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, ...@@ -141,11 +147,11 @@ u16 fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi,
u32 s_id, __be16 ox_id, u32 s_id, __be16 ox_id,
wwn_t port_name, wwn_t node_name, wwn_t port_name, wwn_t node_name,
u16 pdu_size, u16 pdu_size,
u16 local_bb_credits); u16 local_bb_credits, u8 bb_scn);
u16 fc_plogi_build(struct fchs_s *fchs, void *pld, u32 d_id, u16 fc_plogi_build(struct fchs_s *fchs, void *pld, u32 d_id,
u32 s_id, u16 ox_id, wwn_t port_name, u32 s_id, u16 ox_id, wwn_t port_name,
wwn_t node_name, u16 pdu_size); wwn_t node_name, u16 pdu_size, u16 bb_cr);
enum fc_parse_status fc_plogi_parse(struct fchs_s *fchs); enum fc_parse_status fc_plogi_parse(struct fchs_s *fchs);
...@@ -177,13 +183,17 @@ u16 fc_gidpn_build(struct fchs_s *fchs, void *pyld, u32 s_id, ...@@ -177,13 +183,17 @@ u16 fc_gidpn_build(struct fchs_s *fchs, void *pyld, u32 s_id,
u16 fc_gpnid_build(struct fchs_s *fchs, void *pld, u32 s_id, u16 fc_gpnid_build(struct fchs_s *fchs, void *pld, u32 s_id,
u16 ox_id, u32 port_id); u16 ox_id, u32 port_id);
u16 fc_gs_rjt_build(struct fchs_s *fchs, struct ct_hdr_s *cthdr,
u32 d_id, u32 s_id, u16 ox_id,
u8 reason_code, u8 reason_code_expl);
u16 fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr, u16 fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr,
u8 set_br_reg, u32 s_id, u16 ox_id); u8 set_br_reg, u32 s_id, u16 ox_id);
u16 fc_plogi_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u16 fc_plogi_acc_build(struct fchs_s *fchs, void *pld, u32 d_id,
u32 s_id, u16 ox_id, u32 s_id, u16 ox_id,
wwn_t port_name, wwn_t node_name, wwn_t port_name, wwn_t node_name,
u16 pdu_size); u16 pdu_size, u16 bb_cr);
u16 fc_adisc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u16 fc_adisc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc,
u32 d_id, u32 s_id, __be16 ox_id, wwn_t port_name, u32 d_id, u32 s_id, __be16 ox_id, wwn_t port_name,
......
此差异已折叠。
...@@ -24,6 +24,34 @@ ...@@ -24,6 +24,34 @@
#include "bfa_defs_svc.h" #include "bfa_defs_svc.h"
#include "bfa_cs.h" #include "bfa_cs.h"
/* FCP module related definitions */
#define BFA_IO_MAX BFI_IO_MAX
#define BFA_FWTIO_MAX 2000
struct bfa_fcp_mod_s;
struct bfa_iotag_s {
struct list_head qe; /* queue element */
u16 tag; /* FW IO tag */
};
struct bfa_itn_s {
bfa_isr_func_t isr;
};
void bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport,
void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m));
void bfa_itn_isr(struct bfa_s *bfa, struct bfi_msg_s *m);
void bfa_iotag_attach(struct bfa_fcp_mod_s *fcp);
void bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw);
#define BFA_FCP_MOD(_hal) (&(_hal)->modules.fcp_mod)
#define BFA_MEM_FCP_KVA(__bfa) (&(BFA_FCP_MOD(__bfa)->kva_seg))
#define BFA_IOTAG_FROM_TAG(_fcp, _tag) \
(&(_fcp)->iotag_arr[(_tag & BFA_IOIM_IOTAG_MASK)])
#define BFA_ITN_FROM_TAG(_fcp, _tag) \
((_fcp)->itn_arr + ((_tag) & ((_fcp)->num_itns - 1)))
#define BFA_SNSINFO_FROM_TAG(_fcp, _tag) \
bfa_mem_get_dmabuf_kva(_fcp, _tag, BFI_IOIM_SNSLEN)
#define BFA_ITNIM_MIN 32 #define BFA_ITNIM_MIN 32
#define BFA_ITNIM_MAX 1024 #define BFA_ITNIM_MAX 1024
...@@ -75,25 +103,24 @@ struct bfad_tskim_s; ...@@ -75,25 +103,24 @@ struct bfad_tskim_s;
typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim); typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim);
struct bfa_fcpim_mod_s { struct bfa_fcpim_s {
struct bfa_s *bfa; struct bfa_s *bfa;
struct bfa_fcp_mod_s *fcp;
struct bfa_itnim_s *itnim_arr; struct bfa_itnim_s *itnim_arr;
struct bfa_ioim_s *ioim_arr; struct bfa_ioim_s *ioim_arr;
struct bfa_ioim_sp_s *ioim_sp_arr; struct bfa_ioim_sp_s *ioim_sp_arr;
struct bfa_tskim_s *tskim_arr; struct bfa_tskim_s *tskim_arr;
struct bfa_dma_s snsbase;
int num_itnims; int num_itnims;
int num_ioim_reqs;
int num_tskim_reqs; int num_tskim_reqs;
u32 path_tov; u32 path_tov;
u16 q_depth; u16 q_depth;
u8 reqq; /* Request queue to be used */ u8 reqq; /* Request queue to be used */
u8 rsvd; u8 rsvd;
struct list_head itnim_q; /* queue of active itnim */ struct list_head itnim_q; /* queue of active itnim */
struct list_head ioim_free_q; /* free IO resources */
struct list_head ioim_resfree_q; /* IOs waiting for f/w */ struct list_head ioim_resfree_q; /* IOs waiting for f/w */
struct list_head ioim_comp_q; /* IO global comp Q */ struct list_head ioim_comp_q; /* IO global comp Q */
struct list_head tskim_free_q; struct list_head tskim_free_q;
struct list_head tskim_unused_q; /* Unused tskim Q */
u32 ios_active; /* current active IOs */ u32 ios_active; /* current active IOs */
u32 delay_comp; u32 delay_comp;
struct bfa_fcpim_del_itn_stats_s del_itn_stats; struct bfa_fcpim_del_itn_stats_s del_itn_stats;
...@@ -104,6 +131,25 @@ struct bfa_fcpim_mod_s { ...@@ -104,6 +131,25 @@ struct bfa_fcpim_mod_s {
bfa_fcpim_profile_t profile_start; bfa_fcpim_profile_t profile_start;
}; };
/* Max FCP dma segs required */
#define BFA_FCP_DMA_SEGS BFI_IOIM_SNSBUF_SEGS
struct bfa_fcp_mod_s {
struct bfa_s *bfa;
struct list_head iotag_ioim_free_q; /* free IO resources */
struct list_head iotag_tio_free_q; /* free IO resources */
struct list_head iotag_unused_q; /* unused IO resources*/
struct bfa_iotag_s *iotag_arr;
struct bfa_itn_s *itn_arr;
int num_ioim_reqs;
int num_fwtio_reqs;
int num_itns;
struct bfa_dma_s snsbase[BFA_FCP_DMA_SEGS];
struct bfa_fcpim_s fcpim;
struct bfa_mem_dma_s dma_seg[BFA_FCP_DMA_SEGS];
struct bfa_mem_kva_s kva_seg;
};
/* /*
* BFA IO (initiator mode) * BFA IO (initiator mode)
*/ */
...@@ -111,7 +157,7 @@ struct bfa_ioim_s { ...@@ -111,7 +157,7 @@ struct bfa_ioim_s {
struct list_head qe; /* queue elememt */ struct list_head qe; /* queue elememt */
bfa_sm_t sm; /* BFA ioim state machine */ bfa_sm_t sm; /* BFA ioim state machine */
struct bfa_s *bfa; /* BFA module */ struct bfa_s *bfa; /* BFA module */
struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ struct bfa_fcpim_s *fcpim; /* parent fcpim module */
struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
struct bfad_ioim_s *dio; /* driver IO handle */ struct bfad_ioim_s *dio; /* driver IO handle */
u16 iotag; /* FWI IO tag */ u16 iotag; /* FWI IO tag */
...@@ -129,7 +175,6 @@ struct bfa_ioim_s { ...@@ -129,7 +175,6 @@ struct bfa_ioim_s {
struct bfa_ioim_sp_s { struct bfa_ioim_sp_s {
struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */ struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */
u8 *snsinfo; /* sense info for this IO */
struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */ struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */
struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
bfa_boolean_t abort_explicit; /* aborted by OS */ bfa_boolean_t abort_explicit; /* aborted by OS */
...@@ -143,7 +188,7 @@ struct bfa_tskim_s { ...@@ -143,7 +188,7 @@ struct bfa_tskim_s {
struct list_head qe; struct list_head qe;
bfa_sm_t sm; bfa_sm_t sm;
struct bfa_s *bfa; /* BFA module */ struct bfa_s *bfa; /* BFA module */
struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ struct bfa_fcpim_s *fcpim; /* parent fcpim module */
struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */
bfa_boolean_t notify; /* notify itnim on TM comp */ bfa_boolean_t notify; /* notify itnim on TM comp */
...@@ -182,13 +227,13 @@ struct bfa_itnim_s { ...@@ -182,13 +227,13 @@ struct bfa_itnim_s {
struct bfa_wc_s wc; /* waiting counter */ struct bfa_wc_s wc; /* waiting counter */
struct bfa_timer_s timer; /* pending IO TOV */ struct bfa_timer_s timer; /* pending IO TOV */
struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
struct bfa_fcpim_mod_s *fcpim; /* fcpim module */ struct bfa_fcpim_s *fcpim; /* fcpim module */
struct bfa_itnim_iostats_s stats; struct bfa_itnim_iostats_s stats;
struct bfa_itnim_ioprofile_s ioprofile; struct bfa_itnim_ioprofile_s ioprofile;
}; };
#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online) #define bfa_itnim_is_online(_itnim) ((_itnim)->is_online)
#define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod) #define BFA_FCPIM(_hal) (&(_hal)->modules.fcp_mod.fcpim)
#define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK) #define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK)
#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ #define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \
(&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)]) (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)])
...@@ -196,9 +241,9 @@ struct bfa_itnim_s { ...@@ -196,9 +241,9 @@ struct bfa_itnim_s {
(&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)])
#define bfa_io_profile_start_time(_bfa) \ #define bfa_io_profile_start_time(_bfa) \
(_bfa->modules.fcpim_mod.io_profile_start_time) ((_bfa)->modules.fcp_mod.fcpim.io_profile_start_time)
#define bfa_fcpim_get_io_profile(_bfa) \ #define bfa_fcpim_get_io_profile(_bfa) \
(_bfa->modules.fcpim_mod.io_profile) ((_bfa)->modules.fcp_mod.fcpim.io_profile)
#define bfa_ioim_update_iotag(__ioim) do { \ #define bfa_ioim_update_iotag(__ioim) do { \
uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \ uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \
k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \ k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \
...@@ -217,8 +262,7 @@ bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim) ...@@ -217,8 +262,7 @@ bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim)
/* /*
* function prototypes * function prototypes
*/ */
void bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim, void bfa_ioim_attach(struct bfa_fcpim_s *fcpim);
struct bfa_meminfo_s *minfo);
void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
void bfa_ioim_good_comp_isr(struct bfa_s *bfa, void bfa_ioim_good_comp_isr(struct bfa_s *bfa,
struct bfi_msg_s *msg); struct bfi_msg_s *msg);
...@@ -228,18 +272,15 @@ void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim, ...@@ -228,18 +272,15 @@ void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim,
void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim); void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim);
void bfa_ioim_tov(struct bfa_ioim_s *ioim); void bfa_ioim_tov(struct bfa_ioim_s *ioim);
void bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, void bfa_tskim_attach(struct bfa_fcpim_s *fcpim);
struct bfa_meminfo_s *minfo);
void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
void bfa_tskim_iodone(struct bfa_tskim_s *tskim); void bfa_tskim_iodone(struct bfa_tskim_s *tskim);
void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim); void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim);
void bfa_tskim_cleanup(struct bfa_tskim_s *tskim); void bfa_tskim_cleanup(struct bfa_tskim_s *tskim);
void bfa_tskim_res_recfg(struct bfa_s *bfa, u16 num_tskim_fw);
void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len);
u32 *dm_len); void bfa_itnim_attach(struct bfa_fcpim_s *fcpim);
void bfa_itnim_attach(struct bfa_fcpim_mod_s *fcpim,
struct bfa_meminfo_s *minfo);
void bfa_itnim_detach(struct bfa_fcpim_mod_s *fcpim);
void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim); void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim);
void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
void bfa_itnim_iodone(struct bfa_itnim_s *itnim); void bfa_itnim_iodone(struct bfa_itnim_s *itnim);
...@@ -252,13 +293,17 @@ bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim); ...@@ -252,13 +293,17 @@ bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim);
void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov); void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov);
u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa); u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa);
u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa); u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa);
bfa_status_t bfa_fcpim_port_iostats(struct bfa_s *bfa,
struct bfa_itnim_iostats_s *stats, u8 lp_tag);
void bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *fcpim_stats,
struct bfa_itnim_iostats_s *itnim_stats);
#define bfa_fcpim_ioredirect_enabled(__bfa) \ #define bfa_fcpim_ioredirect_enabled(__bfa) \
(((struct bfa_fcpim_mod_s *)(BFA_FCPIM_MOD(__bfa)))->ioredirect) (((struct bfa_fcpim_s *)(BFA_FCPIM(__bfa)))->ioredirect)
#define bfa_fcpim_get_next_reqq(__bfa, __qid) \ #define bfa_fcpim_get_next_reqq(__bfa, __qid) \
{ \ { \
struct bfa_fcpim_mod_s *__fcpim = BFA_FCPIM_MOD(__bfa); \ struct bfa_fcpim_s *__fcpim = BFA_FCPIM(__bfa); \
__fcpim->reqq++; \ __fcpim->reqq++; \
__fcpim->reqq &= (BFI_IOC_MAX_CQS - 1); \ __fcpim->reqq &= (BFI_IOC_MAX_CQS - 1); \
*(__qid) = __fcpim->reqq; \ *(__qid) = __fcpim->reqq; \
......
...@@ -92,15 +92,40 @@ bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, ...@@ -92,15 +92,40 @@ bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
void void
bfa_fcs_init(struct bfa_fcs_s *fcs) bfa_fcs_init(struct bfa_fcs_s *fcs)
{ {
int i, npbc_vports; int i;
struct bfa_fcs_mod_s *mod; struct bfa_fcs_mod_s *mod;
struct bfi_pbc_vport_s pbc_vports[BFI_PBC_MAX_VPORTS];
for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
mod = &fcs_modules[i]; mod = &fcs_modules[i];
if (mod->modinit) if (mod->modinit)
mod->modinit(fcs); mod->modinit(fcs);
} }
}
/*
* FCS update cfg - reset the pwwn/nwwn of fabric base logical port
* with values learned during bfa_init firmware GETATTR REQ.
*/
void
bfa_fcs_update_cfg(struct bfa_fcs_s *fcs)
{
struct bfa_fcs_fabric_s *fabric = &fcs->fabric;
struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
struct bfa_ioc_s *ioc = &fabric->fcs->bfa->ioc;
port_cfg->nwwn = ioc->attr->nwwn;
port_cfg->pwwn = ioc->attr->pwwn;
}
/*
* fcs pbc vport initialization
*/
void
bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs)
{
int i, npbc_vports;
struct bfi_pbc_vport_s pbc_vports[BFI_PBC_MAX_VPORTS];
/* Initialize pbc vports */ /* Initialize pbc vports */
if (!fcs->min_cfg) { if (!fcs->min_cfg) {
npbc_vports = npbc_vports =
...@@ -110,7 +135,6 @@ bfa_fcs_init(struct bfa_fcs_s *fcs) ...@@ -110,7 +135,6 @@ bfa_fcs_init(struct bfa_fcs_s *fcs)
} }
} }
/* /*
* brief * brief
* FCS driver details initialization. * FCS driver details initialization.
...@@ -169,9 +193,12 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs) ...@@ -169,9 +193,12 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs)
#define bfa_fcs_fabric_set_opertype(__fabric) do { \ #define bfa_fcs_fabric_set_opertype(__fabric) do { \
if (bfa_fcport_get_topology((__fabric)->fcs->bfa) \ if (bfa_fcport_get_topology((__fabric)->fcs->bfa) \
== BFA_PORT_TOPOLOGY_P2P) \ == BFA_PORT_TOPOLOGY_P2P) { \
if (fabric->fab_type == BFA_FCS_FABRIC_SWITCHED) \
(__fabric)->oper_type = BFA_PORT_TYPE_NPORT; \ (__fabric)->oper_type = BFA_PORT_TYPE_NPORT; \
else \ else \
(__fabric)->oper_type = BFA_PORT_TYPE_P2P; \
} else \
(__fabric)->oper_type = BFA_PORT_TYPE_NLPORT; \ (__fabric)->oper_type = BFA_PORT_TYPE_NLPORT; \
} while (0) } while (0)
...@@ -196,6 +223,9 @@ static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg, ...@@ -196,6 +223,9 @@ static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg,
u32 rsp_len, u32 rsp_len,
u32 resid_len, u32 resid_len,
struct fchs_s *rspfchs); struct fchs_s *rspfchs);
static u8 bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric);
static bfa_boolean_t bfa_fcs_fabric_is_bbscn_enabled(
struct bfa_fcs_fabric_s *fabric);
static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric,
enum bfa_fcs_fabric_event event); enum bfa_fcs_fabric_event event);
...@@ -269,8 +299,8 @@ bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric, ...@@ -269,8 +299,8 @@ bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric,
break; break;
case BFA_FCS_FABRIC_SM_DELETE: case BFA_FCS_FABRIC_SM_DELETE:
bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
bfa_wc_down(&fabric->fcs->wc); bfa_fcs_fabric_delete(fabric);
break; break;
default: default:
...@@ -322,7 +352,8 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, ...@@ -322,7 +352,8 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
case BFA_FCS_FABRIC_SM_CONT_OP: case BFA_FCS_FABRIC_SM_CONT_OP:
bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
fabric->bb_credit); fabric->bb_credit,
bfa_fcs_fabric_oper_bbscn(fabric));
fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; fabric->fab_type = BFA_FCS_FABRIC_SWITCHED;
if (fabric->auth_reqd && fabric->is_auth) { if (fabric->auth_reqd && fabric->is_auth) {
...@@ -350,7 +381,8 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, ...@@ -350,7 +381,8 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
case BFA_FCS_FABRIC_SM_NO_FABRIC: case BFA_FCS_FABRIC_SM_NO_FABRIC:
fabric->fab_type = BFA_FCS_FABRIC_N2N; fabric->fab_type = BFA_FCS_FABRIC_N2N;
bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
fabric->bb_credit); fabric->bb_credit,
bfa_fcs_fabric_oper_bbscn(fabric));
bfa_fcs_fabric_notify_online(fabric); bfa_fcs_fabric_notify_online(fabric);
bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric);
break; break;
...@@ -518,7 +550,11 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, ...@@ -518,7 +550,11 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
case BFA_FCS_FABRIC_SM_NO_FABRIC: case BFA_FCS_FABRIC_SM_NO_FABRIC:
bfa_trc(fabric->fcs, fabric->bb_credit); bfa_trc(fabric->fcs, fabric->bb_credit);
bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
fabric->bb_credit); fabric->bb_credit,
bfa_fcs_fabric_oper_bbscn(fabric));
break;
case BFA_FCS_FABRIC_SM_RETRY_OP:
break; break;
default: default:
...@@ -764,6 +800,10 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status) ...@@ -764,6 +800,10 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status)
case BFA_STATUS_FABRIC_RJT: case BFA_STATUS_FABRIC_RJT:
fabric->stats.flogi_rejects++; fabric->stats.flogi_rejects++;
if (fabric->lps->lsrjt_rsn == FC_LS_RJT_RSN_LOGICAL_ERROR &&
fabric->lps->lsrjt_expl == FC_LS_RJT_EXP_NO_ADDL_INFO)
fabric->fcs->bbscn_flogi_rjt = BFA_TRUE;
bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP); bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
return; return;
...@@ -793,6 +833,7 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status) ...@@ -793,6 +833,7 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status)
*/ */
fabric->bport.port_topo.pn2n.rem_port_wwn = fabric->bport.port_topo.pn2n.rem_port_wwn =
fabric->lps->pr_pwwn; fabric->lps->pr_pwwn;
fabric->fab_type = BFA_FCS_FABRIC_N2N;
bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC); bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC);
} }
...@@ -808,13 +849,17 @@ bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric) ...@@ -808,13 +849,17 @@ bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric)
{ {
struct bfa_s *bfa = fabric->fcs->bfa; struct bfa_s *bfa = fabric->fcs->bfa;
struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg; struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg;
u8 alpa = 0; u8 alpa = 0, bb_scn = 0;
if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP) if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP)
alpa = bfa_fcport_get_myalpa(bfa); alpa = bfa_fcport_get_myalpa(bfa);
if (bfa_fcs_fabric_is_bbscn_enabled(fabric) &&
(!fabric->fcs->bbscn_flogi_rjt))
bb_scn = BFA_FCS_PORT_DEF_BB_SCN;
bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa), bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa),
pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd); pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd, bb_scn);
fabric->stats.flogi_sent++; fabric->stats.flogi_sent++;
} }
...@@ -872,6 +917,40 @@ bfa_fcs_fabric_delay(void *cbarg) ...@@ -872,6 +917,40 @@ bfa_fcs_fabric_delay(void *cbarg)
bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELAYED); bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELAYED);
} }
/*
* Computes operating BB_SCN value
*/
static u8
bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric)
{
u8 pr_bbscn = fabric->lps->pr_bbscn;
struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa);
if (!(fcport->cfg.bb_scn_state && pr_bbscn))
return 0;
/* return max of local/remote bb_scn values */
return ((pr_bbscn > BFA_FCS_PORT_DEF_BB_SCN) ?
pr_bbscn : BFA_FCS_PORT_DEF_BB_SCN);
}
/*
* Check if BB_SCN can be enabled.
*/
static bfa_boolean_t
bfa_fcs_fabric_is_bbscn_enabled(struct bfa_fcs_fabric_s *fabric)
{
struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa);
if (bfa_ioc_get_fcmode(&fabric->fcs->bfa->ioc) &&
fcport->cfg.bb_scn_state &&
!bfa_fcport_is_qos_enabled(fabric->fcs->bfa) &&
!bfa_fcport_is_trunk_enabled(fabric->fcs->bfa))
return BFA_TRUE;
else
return BFA_FALSE;
}
/* /*
* Delete all vports and wait for vport delete completions. * Delete all vports and wait for vport delete completions.
*/ */
...@@ -989,6 +1068,7 @@ void ...@@ -989,6 +1068,7 @@ void
bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric) bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric)
{ {
bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
fabric->fcs->bbscn_flogi_rjt = BFA_FALSE;
bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN); bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN);
} }
...@@ -1192,6 +1272,7 @@ bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric, ...@@ -1192,6 +1272,7 @@ bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric,
} }
fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred); fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred);
fabric->lps->pr_bbscn = (be16_to_cpu(flogi->csp.rxsz) >> 12);
bport->port_topo.pn2n.rem_port_wwn = flogi->port_name; bport->port_topo.pn2n.rem_port_wwn = flogi->port_name;
bport->port_topo.pn2n.reply_oxid = fchs->ox_id; bport->port_topo.pn2n.reply_oxid = fchs->ox_id;
...@@ -1224,9 +1305,10 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric) ...@@ -1224,9 +1305,10 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
n2n_port->reply_oxid, pcfg->pwwn, n2n_port->reply_oxid, pcfg->pwwn,
pcfg->nwwn, pcfg->nwwn,
bfa_fcport_get_maxfrsize(bfa), bfa_fcport_get_maxfrsize(bfa),
bfa_fcport_get_rx_bbcredit(bfa)); bfa_fcport_get_rx_bbcredit(bfa),
bfa_fcs_fabric_oper_bbscn(fabric));
bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->lp_tag, bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->bfa_tag,
BFA_FALSE, FC_CLASS_3, BFA_FALSE, FC_CLASS_3,
reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric, reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric,
FC_MAX_PDUSZ, 0); FC_MAX_PDUSZ, 0);
...@@ -1297,6 +1379,45 @@ bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id) ...@@ -1297,6 +1379,45 @@ bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id)
return NULL; return NULL;
} }
/*
* Return the list of local logical ports present in the given VF.
*
* @param[in] vf vf for which logical ports are returned
* @param[out] lpwwn returned logical port wwn list
* @param[in,out] nlports in:size of lpwwn list;
* out:total elements present,
* actual elements returned is limited by the size
*/
void
bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t lpwwn[], int *nlports)
{
struct list_head *qe;
struct bfa_fcs_vport_s *vport;
int i = 0;
struct bfa_fcs_s *fcs;
if (vf == NULL || lpwwn == NULL || *nlports == 0)
return;
fcs = vf->fcs;
bfa_trc(fcs, vf->vf_id);
bfa_trc(fcs, (uint32_t) *nlports);
lpwwn[i++] = vf->bport.port_cfg.pwwn;
list_for_each(qe, &vf->vport_q) {
if (i >= *nlports)
break;
vport = (struct bfa_fcs_vport_s *) qe;
lpwwn[i++] = vport->lport.port_cfg.pwwn;
}
bfa_trc(fcs, i);
*nlports = i;
}
/* /*
* BFA FCS PPORT ( physical port) * BFA FCS PPORT ( physical port)
*/ */
......
...@@ -254,6 +254,9 @@ struct bfa_fcs_fabric_s; ...@@ -254,6 +254,9 @@ struct bfa_fcs_fabric_s;
#define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 48 #define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 48
#define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16 #define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16
/* bb_scn value in 2^bb_scn */
#define BFA_FCS_PORT_DEF_BB_SCN 3
/* /*
* Get FC port ID for a logical port. * Get FC port ID for a logical port.
*/ */
...@@ -379,6 +382,7 @@ void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport); ...@@ -379,6 +382,7 @@ void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport);
void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport); void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport);
void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport); void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport);
void bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport); void bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport);
void bfa_fcs_vport_stop_comp(struct bfa_fcs_vport_s *vport);
#define BFA_FCS_RPORT_DEF_DEL_TIMEOUT 90 /* in secs */ #define BFA_FCS_RPORT_DEF_DEL_TIMEOUT 90 /* in secs */
#define BFA_FCS_RPORT_MAX_RETRIES (5) #define BFA_FCS_RPORT_MAX_RETRIES (5)
...@@ -420,6 +424,7 @@ struct bfa_fcs_rport_s { ...@@ -420,6 +424,7 @@ struct bfa_fcs_rport_s {
enum fc_cos fc_cos; /* FC classes of service supp */ enum fc_cos fc_cos; /* FC classes of service supp */
bfa_boolean_t cisc; /* CISC capable device */ bfa_boolean_t cisc; /* CISC capable device */
bfa_boolean_t prlo; /* processing prlo or LOGO */ bfa_boolean_t prlo; /* processing prlo or LOGO */
bfa_boolean_t plogi_pending; /* Rx Plogi Pending */
wwn_t pwwn; /* port wwn of rport */ wwn_t pwwn; /* port wwn of rport */
wwn_t nwwn; /* node wwn of rport */ wwn_t nwwn; /* node wwn of rport */
struct bfa_rport_symname_s psym_name; /* port symbolic name */ struct bfa_rport_symname_s psym_name; /* port symbolic name */
...@@ -447,6 +452,8 @@ bfa_fcs_rport_get_halrport(struct bfa_fcs_rport_s *rport) ...@@ -447,6 +452,8 @@ bfa_fcs_rport_get_halrport(struct bfa_fcs_rport_s *rport)
/* /*
* bfa fcs rport API functions * bfa fcs rport API functions
*/ */
void bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
struct bfa_rport_attr_s *attr);
struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port, struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port,
wwn_t rpwwn); wwn_t rpwwn);
struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn( struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn(
...@@ -591,11 +598,22 @@ void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim); ...@@ -591,11 +598,22 @@ void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim);
void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim,
struct fchs_s *fchs, u16 len); struct fchs_s *fchs, u16 len);
#define BFA_FCS_FDMI_SUPORTED_SPEEDS (FDMI_TRANS_SPEED_1G | \ #define BFA_FCS_FDMI_SUPP_SPEEDS_4G (FDMI_TRANS_SPEED_1G | \
FDMI_TRANS_SPEED_2G | \
FDMI_TRANS_SPEED_4G)
#define BFA_FCS_FDMI_SUPP_SPEEDS_8G (FDMI_TRANS_SPEED_1G | \
FDMI_TRANS_SPEED_2G | \ FDMI_TRANS_SPEED_2G | \
FDMI_TRANS_SPEED_4G | \ FDMI_TRANS_SPEED_4G | \
FDMI_TRANS_SPEED_8G) FDMI_TRANS_SPEED_8G)
#define BFA_FCS_FDMI_SUPP_SPEEDS_16G (FDMI_TRANS_SPEED_2G | \
FDMI_TRANS_SPEED_4G | \
FDMI_TRANS_SPEED_8G | \
FDMI_TRANS_SPEED_16G)
#define BFA_FCS_FDMI_SUPP_SPEEDS_10G FDMI_TRANS_SPEED_10G
/* /*
* HBA Attribute Block : BFA internal representation. Note : Some variable * HBA Attribute Block : BFA internal representation. Note : Some variable
* sizes have been trimmed to suit BFA For Ex : Model will be "Brocade". Based * sizes have been trimmed to suit BFA For Ex : Model will be "Brocade". Based
...@@ -649,6 +667,8 @@ struct bfa_fcs_s { ...@@ -649,6 +667,8 @@ struct bfa_fcs_s {
struct bfa_trc_mod_s *trcmod; /* tracing module */ struct bfa_trc_mod_s *trcmod; /* tracing module */
bfa_boolean_t vf_enabled; /* VF mode is enabled */ bfa_boolean_t vf_enabled; /* VF mode is enabled */
bfa_boolean_t fdmi_enabled; /* FDMI is enabled */ bfa_boolean_t fdmi_enabled; /* FDMI is enabled */
bfa_boolean_t bbscn_enabled; /* Driver Config Parameter */
bfa_boolean_t bbscn_flogi_rjt;/* FLOGI reject due to BB_SCN */
bfa_boolean_t min_cfg; /* min cfg enabled/disabled */ bfa_boolean_t min_cfg; /* min cfg enabled/disabled */
u16 port_vfid; /* port default VF ID */ u16 port_vfid; /* port default VF ID */
struct bfa_fcs_driver_info_s driver_info; struct bfa_fcs_driver_info_s driver_info;
...@@ -715,6 +735,8 @@ void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, ...@@ -715,6 +735,8 @@ void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa,
struct bfad_s *bfad, struct bfad_s *bfad,
bfa_boolean_t min_cfg); bfa_boolean_t min_cfg);
void bfa_fcs_init(struct bfa_fcs_s *fcs); void bfa_fcs_init(struct bfa_fcs_s *fcs);
void bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs);
void bfa_fcs_update_cfg(struct bfa_fcs_s *fcs);
void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
struct bfa_fcs_driver_info_s *driver_info); struct bfa_fcs_driver_info_s *driver_info);
void bfa_fcs_exit(struct bfa_fcs_s *fcs); void bfa_fcs_exit(struct bfa_fcs_s *fcs);
...@@ -723,6 +745,7 @@ void bfa_fcs_exit(struct bfa_fcs_s *fcs); ...@@ -723,6 +745,7 @@ void bfa_fcs_exit(struct bfa_fcs_s *fcs);
* bfa fcs vf public functions * bfa fcs vf public functions
*/ */
bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id); bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id);
void bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t vpwwn[], int *nports);
/* /*
* fabric protected interface functions * fabric protected interface functions
......
...@@ -54,6 +54,7 @@ enum bfa_fcs_itnim_event { ...@@ -54,6 +54,7 @@ enum bfa_fcs_itnim_event {
BFA_FCS_ITNIM_SM_INITIATOR = 9, /* rport is initiator */ BFA_FCS_ITNIM_SM_INITIATOR = 9, /* rport is initiator */
BFA_FCS_ITNIM_SM_DELETE = 10, /* delete event from rport */ BFA_FCS_ITNIM_SM_DELETE = 10, /* delete event from rport */
BFA_FCS_ITNIM_SM_PRLO = 11, /* delete event from rport */ BFA_FCS_ITNIM_SM_PRLO = 11, /* delete event from rport */
BFA_FCS_ITNIM_SM_RSP_NOT_SUPP = 12, /* cmd not supported rsp */
}; };
static void bfa_fcs_itnim_sm_offline(struct bfa_fcs_itnim_s *itnim, static void bfa_fcs_itnim_sm_offline(struct bfa_fcs_itnim_s *itnim,
...@@ -178,6 +179,10 @@ bfa_fcs_itnim_sm_prli(struct bfa_fcs_itnim_s *itnim, ...@@ -178,6 +179,10 @@ bfa_fcs_itnim_sm_prli(struct bfa_fcs_itnim_s *itnim,
BFA_FCS_RETRY_TIMEOUT); BFA_FCS_RETRY_TIMEOUT);
break; break;
case BFA_FCS_ITNIM_SM_RSP_NOT_SUPP:
bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
break;
case BFA_FCS_ITNIM_SM_OFFLINE: case BFA_FCS_ITNIM_SM_OFFLINE:
bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
bfa_fcxp_discard(itnim->fcxp); bfa_fcxp_discard(itnim->fcxp);
...@@ -447,6 +452,7 @@ bfa_fcs_itnim_prli_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg, ...@@ -447,6 +452,7 @@ bfa_fcs_itnim_prli_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
itnim->rport->scsi_function = itnim->rport->scsi_function =
BFA_RPORT_INITIATOR; BFA_RPORT_INITIATOR;
itnim->stats.prli_rsp_acc++; itnim->stats.prli_rsp_acc++;
itnim->stats.initiator++;
bfa_sm_send_event(itnim, bfa_sm_send_event(itnim,
BFA_FCS_ITNIM_SM_RSP_OK); BFA_FCS_ITNIM_SM_RSP_OK);
return; return;
...@@ -472,6 +478,10 @@ bfa_fcs_itnim_prli_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg, ...@@ -472,6 +478,10 @@ bfa_fcs_itnim_prli_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
bfa_trc(itnim->fcs, ls_rjt->reason_code_expl); bfa_trc(itnim->fcs, ls_rjt->reason_code_expl);
itnim->stats.prli_rsp_rjt++; itnim->stats.prli_rsp_rjt++;
if (ls_rjt->reason_code == FC_LS_RJT_RSN_CMD_NOT_SUPP) {
bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_NOT_SUPP);
return;
}
bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_ERROR); bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_ERROR);
} }
} }
......
...@@ -74,6 +74,7 @@ enum bfa_fcs_lport_event { ...@@ -74,6 +74,7 @@ enum bfa_fcs_lport_event {
BFA_FCS_PORT_SM_OFFLINE = 3, BFA_FCS_PORT_SM_OFFLINE = 3,
BFA_FCS_PORT_SM_DELETE = 4, BFA_FCS_PORT_SM_DELETE = 4,
BFA_FCS_PORT_SM_DELRPORT = 5, BFA_FCS_PORT_SM_DELRPORT = 5,
BFA_FCS_PORT_SM_STOP = 6,
}; };
static void bfa_fcs_lport_sm_uninit(struct bfa_fcs_lport_s *port, static void bfa_fcs_lport_sm_uninit(struct bfa_fcs_lport_s *port,
...@@ -86,6 +87,8 @@ static void bfa_fcs_lport_sm_offline(struct bfa_fcs_lport_s *port, ...@@ -86,6 +87,8 @@ static void bfa_fcs_lport_sm_offline(struct bfa_fcs_lport_s *port,
enum bfa_fcs_lport_event event); enum bfa_fcs_lport_event event);
static void bfa_fcs_lport_sm_deleting(struct bfa_fcs_lport_s *port, static void bfa_fcs_lport_sm_deleting(struct bfa_fcs_lport_s *port,
enum bfa_fcs_lport_event event); enum bfa_fcs_lport_event event);
static void bfa_fcs_lport_sm_stopping(struct bfa_fcs_lport_s *port,
enum bfa_fcs_lport_event event);
static void static void
bfa_fcs_lport_sm_uninit( bfa_fcs_lport_sm_uninit(
...@@ -123,6 +126,12 @@ bfa_fcs_lport_sm_init(struct bfa_fcs_lport_s *port, ...@@ -123,6 +126,12 @@ bfa_fcs_lport_sm_init(struct bfa_fcs_lport_s *port,
bfa_fcs_lport_deleted(port); bfa_fcs_lport_deleted(port);
break; break;
case BFA_FCS_PORT_SM_STOP:
/* If vport - send completion call back */
if (port->vport)
bfa_fcs_vport_stop_comp(port->vport);
break;
case BFA_FCS_PORT_SM_OFFLINE: case BFA_FCS_PORT_SM_OFFLINE:
break; break;
...@@ -148,6 +157,23 @@ bfa_fcs_lport_sm_online( ...@@ -148,6 +157,23 @@ bfa_fcs_lport_sm_online(
bfa_fcs_lport_offline_actions(port); bfa_fcs_lport_offline_actions(port);
break; break;
case BFA_FCS_PORT_SM_STOP:
__port_action[port->fabric->fab_type].offline(port);
if (port->num_rports == 0) {
bfa_sm_set_state(port, bfa_fcs_lport_sm_init);
/* If vport - send completion call back */
if (port->vport)
bfa_fcs_vport_stop_comp(port->vport);
} else {
bfa_sm_set_state(port, bfa_fcs_lport_sm_stopping);
list_for_each_safe(qe, qen, &port->rport_q) {
rport = (struct bfa_fcs_rport_s *) qe;
bfa_sm_send_event(rport, RPSM_EVENT_DELETE);
}
}
break;
case BFA_FCS_PORT_SM_DELETE: case BFA_FCS_PORT_SM_DELETE:
__port_action[port->fabric->fab_type].offline(port); __port_action[port->fabric->fab_type].offline(port);
...@@ -189,6 +215,21 @@ bfa_fcs_lport_sm_offline( ...@@ -189,6 +215,21 @@ bfa_fcs_lport_sm_offline(
bfa_fcs_lport_online_actions(port); bfa_fcs_lport_online_actions(port);
break; break;
case BFA_FCS_PORT_SM_STOP:
if (port->num_rports == 0) {
bfa_sm_set_state(port, bfa_fcs_lport_sm_init);
/* If vport - send completion call back */
if (port->vport)
bfa_fcs_vport_stop_comp(port->vport);
} else {
bfa_sm_set_state(port, bfa_fcs_lport_sm_stopping);
list_for_each_safe(qe, qen, &port->rport_q) {
rport = (struct bfa_fcs_rport_s *) qe;
bfa_sm_send_event(rport, RPSM_EVENT_DELETE);
}
}
break;
case BFA_FCS_PORT_SM_DELETE: case BFA_FCS_PORT_SM_DELETE:
if (port->num_rports == 0) { if (port->num_rports == 0) {
bfa_sm_set_state(port, bfa_fcs_lport_sm_uninit); bfa_sm_set_state(port, bfa_fcs_lport_sm_uninit);
...@@ -211,6 +252,28 @@ bfa_fcs_lport_sm_offline( ...@@ -211,6 +252,28 @@ bfa_fcs_lport_sm_offline(
} }
} }
static void
bfa_fcs_lport_sm_stopping(struct bfa_fcs_lport_s *port,
enum bfa_fcs_lport_event event)
{
bfa_trc(port->fcs, port->port_cfg.pwwn);
bfa_trc(port->fcs, event);
switch (event) {
case BFA_FCS_PORT_SM_DELRPORT:
if (port->num_rports == 0) {
bfa_sm_set_state(port, bfa_fcs_lport_sm_init);
/* If vport - send completion call back */
if (port->vport)
bfa_fcs_vport_stop_comp(port->vport);
}
break;
default:
bfa_sm_fault(port->fcs, event);
}
}
static void static void
bfa_fcs_lport_sm_deleting( bfa_fcs_lport_sm_deleting(
struct bfa_fcs_lport_s *port, struct bfa_fcs_lport_s *port,
...@@ -264,6 +327,40 @@ bfa_fcs_lport_send_ls_rjt(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs, ...@@ -264,6 +327,40 @@ bfa_fcs_lport_send_ls_rjt(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs,
FC_MAX_PDUSZ, 0); FC_MAX_PDUSZ, 0);
} }
/*
* Send a FCCT Reject
*/
static void
bfa_fcs_lport_send_fcgs_rjt(struct bfa_fcs_lport_s *port,
struct fchs_s *rx_fchs, u8 reason_code, u8 reason_code_expl)
{
struct fchs_s fchs;
struct bfa_fcxp_s *fcxp;
struct bfa_rport_s *bfa_rport = NULL;
int len;
struct ct_hdr_s *rx_cthdr = (struct ct_hdr_s *)(rx_fchs + 1);
struct ct_hdr_s *ct_hdr;
bfa_trc(port->fcs, rx_fchs->d_id);
bfa_trc(port->fcs, rx_fchs->s_id);
fcxp = bfa_fcs_fcxp_alloc(port->fcs);
if (!fcxp)
return;
ct_hdr = bfa_fcxp_get_reqbuf(fcxp);
ct_hdr->gs_type = rx_cthdr->gs_type;
ct_hdr->gs_sub_type = rx_cthdr->gs_sub_type;
len = fc_gs_rjt_build(&fchs, ct_hdr, rx_fchs->s_id,
bfa_fcs_lport_get_fcid(port),
rx_fchs->ox_id, reason_code, reason_code_expl);
bfa_fcxp_send(fcxp, bfa_rport, port->fabric->vf_id, port->lp_tag,
BFA_FALSE, FC_CLASS_3, len, &fchs, NULL, NULL,
FC_MAX_PDUSZ, 0);
}
/* /*
* Process incoming plogi from a remote port. * Process incoming plogi from a remote port.
*/ */
...@@ -647,6 +744,16 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, ...@@ -647,6 +744,16 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport,
bfa_fcs_lport_abts_acc(lport, fchs); bfa_fcs_lport_abts_acc(lport, fchs);
return; return;
} }
if (fchs->type == FC_TYPE_SERVICES) {
/*
* Unhandled FC-GS frames. Send a FC-CT Reject
*/
bfa_fcs_lport_send_fcgs_rjt(lport, fchs, CT_RSN_NOT_SUPP,
CT_NS_EXP_NOADDITIONAL);
return;
}
/* /*
* look for a matching remote port ID * look for a matching remote port ID
*/ */
...@@ -835,8 +942,8 @@ bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs, ...@@ -835,8 +942,8 @@ bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs,
lport->fcs = fcs; lport->fcs = fcs;
lport->fabric = bfa_fcs_vf_lookup(fcs, vf_id); lport->fabric = bfa_fcs_vf_lookup(fcs, vf_id);
lport->vport = vport; lport->vport = vport;
lport->lp_tag = (vport) ? vport->lps->lp_tag : lport->lp_tag = (vport) ? vport->lps->bfa_tag :
lport->fabric->lps->lp_tag; lport->fabric->lps->bfa_tag;
INIT_LIST_HEAD(&lport->rport_q); INIT_LIST_HEAD(&lport->rport_q);
lport->num_rports = 0; lport->num_rports = 0;
...@@ -1074,6 +1181,8 @@ static void bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, ...@@ -1074,6 +1181,8 @@ static void bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi,
struct bfa_fcs_fdmi_hba_attr_s *hba_attr); struct bfa_fcs_fdmi_hba_attr_s *hba_attr);
static void bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, static void bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi,
struct bfa_fcs_fdmi_port_attr_s *port_attr); struct bfa_fcs_fdmi_port_attr_s *port_attr);
u32 bfa_fcs_fdmi_convert_speed(enum bfa_port_speed pport_speed);
/* /*
* fcs_fdmi_sm FCS FDMI state machine * fcs_fdmi_sm FCS FDMI state machine
*/ */
...@@ -1672,7 +1781,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) ...@@ -1672,7 +1781,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
memcpy(attr->value, fcs_hba_attr->driver_version, templen); memcpy(attr->value, fcs_hba_attr->driver_version, templen);
templen = fc_roundup(templen, sizeof(u32)); templen = fc_roundup(templen, sizeof(u32));
curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
len += templen;; len += templen;
count++; count++;
attr->len = cpu_to_be16(templen + sizeof(attr->type) + attr->len = cpu_to_be16(templen + sizeof(attr->type) +
sizeof(templen)); sizeof(templen));
...@@ -2160,12 +2269,36 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, ...@@ -2160,12 +2269,36 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi,
/* /*
* Supported Speeds * Supported Speeds
*/ */
port_attr->supp_speed = cpu_to_be32(BFA_FCS_FDMI_SUPORTED_SPEEDS); switch (pport_attr.speed_supported) {
case BFA_PORT_SPEED_16GBPS:
port_attr->supp_speed =
cpu_to_be32(BFA_FCS_FDMI_SUPP_SPEEDS_16G);
break;
case BFA_PORT_SPEED_10GBPS:
port_attr->supp_speed =
cpu_to_be32(BFA_FCS_FDMI_SUPP_SPEEDS_10G);
break;
case BFA_PORT_SPEED_8GBPS:
port_attr->supp_speed =
cpu_to_be32(BFA_FCS_FDMI_SUPP_SPEEDS_8G);
break;
case BFA_PORT_SPEED_4GBPS:
port_attr->supp_speed =
cpu_to_be32(BFA_FCS_FDMI_SUPP_SPEEDS_4G);
break;
default:
bfa_sm_fault(port->fcs, pport_attr.speed_supported);
}
/* /*
* Current Speed * Current Speed
*/ */
port_attr->curr_speed = cpu_to_be32(pport_attr.speed); port_attr->curr_speed = cpu_to_be32(
bfa_fcs_fdmi_convert_speed(pport_attr.speed));
/* /*
* Max PDU Size. * Max PDU Size.
...@@ -2186,6 +2319,41 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, ...@@ -2186,6 +2319,41 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi,
} }
/*
* Convert BFA speed to FDMI format.
*/
u32
bfa_fcs_fdmi_convert_speed(bfa_port_speed_t pport_speed)
{
u32 ret;
switch (pport_speed) {
case BFA_PORT_SPEED_1GBPS:
case BFA_PORT_SPEED_2GBPS:
ret = pport_speed;
break;
case BFA_PORT_SPEED_4GBPS:
ret = FDMI_TRANS_SPEED_4G;
break;
case BFA_PORT_SPEED_8GBPS:
ret = FDMI_TRANS_SPEED_8G;
break;
case BFA_PORT_SPEED_10GBPS:
ret = FDMI_TRANS_SPEED_10G;
break;
case BFA_PORT_SPEED_16GBPS:
ret = FDMI_TRANS_SPEED_16G;
break;
default:
ret = FDMI_TRANS_SPEED_UNKNOWN;
}
return ret;
}
void void
bfa_fcs_lport_fdmi_init(struct bfa_fcs_lport_ms_s *ms) bfa_fcs_lport_fdmi_init(struct bfa_fcs_lport_ms_s *ms)
...@@ -2829,7 +2997,8 @@ bfa_fcs_lport_ms_send_plogi(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced) ...@@ -2829,7 +2997,8 @@ bfa_fcs_lport_ms_send_plogi(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced)
bfa_hton3b(FC_MGMT_SERVER), bfa_hton3b(FC_MGMT_SERVER),
bfa_fcs_lport_get_fcid(port), 0, bfa_fcs_lport_get_fcid(port), 0,
port->port_cfg.pwwn, port->port_cfg.nwwn, port->port_cfg.pwwn, port->port_cfg.nwwn,
bfa_fcport_get_maxfrsize(port->fcs->bfa)); bfa_fcport_get_maxfrsize(port->fcs->bfa),
bfa_fcport_get_rx_bbcredit(port->fcs->bfa));
bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
FC_CLASS_3, len, &fchs, FC_CLASS_3, len, &fchs,
...@@ -3573,7 +3742,7 @@ bfa_fcs_lport_ns_send_plogi(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced) ...@@ -3573,7 +3742,7 @@ bfa_fcs_lport_ns_send_plogi(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced)
bfa_trc(port->fcs, port->pid); bfa_trc(port->fcs, port->pid);
fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
if (!fcxp) { if (!fcxp) {
port->stats.ns_plogi_alloc_wait++; port->stats.ns_plogi_alloc_wait++;
bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &ns->fcxp_wqe, bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &ns->fcxp_wqe,
...@@ -3586,7 +3755,8 @@ fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); ...@@ -3586,7 +3755,8 @@ fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
bfa_hton3b(FC_NAME_SERVER), bfa_hton3b(FC_NAME_SERVER),
bfa_fcs_lport_get_fcid(port), 0, bfa_fcs_lport_get_fcid(port), 0,
port->port_cfg.pwwn, port->port_cfg.nwwn, port->port_cfg.pwwn, port->port_cfg.nwwn,
bfa_fcport_get_maxfrsize(port->fcs->bfa)); bfa_fcport_get_maxfrsize(port->fcs->bfa),
bfa_fcport_get_rx_bbcredit(port->fcs->bfa));
bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
FC_CLASS_3, len, &fchs, FC_CLASS_3, len, &fchs,
...@@ -4762,8 +4932,8 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port) ...@@ -4762,8 +4932,8 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port)
while (qe != qh) { while (qe != qh) {
rport = (struct bfa_fcs_rport_s *) qe; rport = (struct bfa_fcs_rport_s *) qe;
if ((bfa_ntoh3b(rport->pid) > 0xFFF000) || if ((bfa_ntoh3b(rport->pid) > 0xFFF000) ||
(bfa_fcs_rport_get_state(rport) == (bfa_fcs_rport_get_state(rport) == BFA_RPORT_OFFLINE) ||
BFA_RPORT_OFFLINE)) { (rport->scsi_function != BFA_RPORT_TARGET)) {
qe = bfa_q_next(qe); qe = bfa_q_next(qe);
continue; continue;
} }
...@@ -4776,17 +4946,15 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port) ...@@ -4776,17 +4946,15 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port)
bfa_fcport_get_ratelim_speed(port->fcs->bfa); bfa_fcport_get_ratelim_speed(port->fcs->bfa);
} }
if ((rport_speed == BFA_PORT_SPEED_8GBPS) || if (rport_speed > max_speed)
(rport_speed > port_speed)) {
max_speed = rport_speed; max_speed = rport_speed;
break;
} else if (rport_speed > max_speed) {
max_speed = rport_speed;
}
qe = bfa_q_next(qe); qe = bfa_q_next(qe);
} }
if (max_speed > port_speed)
max_speed = port_speed;
bfa_trc(fcs, max_speed); bfa_trc(fcs, max_speed);
return max_speed; return max_speed;
} }
...@@ -4918,6 +5086,7 @@ enum bfa_fcs_vport_event { ...@@ -4918,6 +5086,7 @@ enum bfa_fcs_vport_event {
BFA_FCS_VPORT_SM_DELCOMP = 11, /* lport delete completion */ BFA_FCS_VPORT_SM_DELCOMP = 11, /* lport delete completion */
BFA_FCS_VPORT_SM_RSP_DUP_WWN = 12, /* Dup wnn error*/ BFA_FCS_VPORT_SM_RSP_DUP_WWN = 12, /* Dup wnn error*/
BFA_FCS_VPORT_SM_RSP_FAILED = 13, /* non-retryable failure */ BFA_FCS_VPORT_SM_RSP_FAILED = 13, /* non-retryable failure */
BFA_FCS_VPORT_SM_STOPCOMP = 14, /* vport delete completion */
}; };
static void bfa_fcs_vport_sm_uninit(struct bfa_fcs_vport_s *vport, static void bfa_fcs_vport_sm_uninit(struct bfa_fcs_vport_s *vport,
...@@ -4930,6 +5099,8 @@ static void bfa_fcs_vport_sm_fdisc(struct bfa_fcs_vport_s *vport, ...@@ -4930,6 +5099,8 @@ static void bfa_fcs_vport_sm_fdisc(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event); enum bfa_fcs_vport_event event);
static void bfa_fcs_vport_sm_fdisc_retry(struct bfa_fcs_vport_s *vport, static void bfa_fcs_vport_sm_fdisc_retry(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event); enum bfa_fcs_vport_event event);
static void bfa_fcs_vport_sm_fdisc_rsp_wait(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event);
static void bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport, static void bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event); enum bfa_fcs_vport_event event);
static void bfa_fcs_vport_sm_deleting(struct bfa_fcs_vport_s *vport, static void bfa_fcs_vport_sm_deleting(struct bfa_fcs_vport_s *vport,
...@@ -4940,6 +5111,10 @@ static void bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport, ...@@ -4940,6 +5111,10 @@ static void bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event); enum bfa_fcs_vport_event event);
static void bfa_fcs_vport_sm_error(struct bfa_fcs_vport_s *vport, static void bfa_fcs_vport_sm_error(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event); enum bfa_fcs_vport_event event);
static void bfa_fcs_vport_sm_stopping(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event);
static void bfa_fcs_vport_sm_logo_for_stop(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event);
static struct bfa_sm_table_s vport_sm_table[] = { static struct bfa_sm_table_s vport_sm_table[] = {
{BFA_SM(bfa_fcs_vport_sm_uninit), BFA_FCS_VPORT_UNINIT}, {BFA_SM(bfa_fcs_vport_sm_uninit), BFA_FCS_VPORT_UNINIT},
...@@ -4947,6 +5122,7 @@ static struct bfa_sm_table_s vport_sm_table[] = { ...@@ -4947,6 +5122,7 @@ static struct bfa_sm_table_s vport_sm_table[] = {
{BFA_SM(bfa_fcs_vport_sm_offline), BFA_FCS_VPORT_OFFLINE}, {BFA_SM(bfa_fcs_vport_sm_offline), BFA_FCS_VPORT_OFFLINE},
{BFA_SM(bfa_fcs_vport_sm_fdisc), BFA_FCS_VPORT_FDISC}, {BFA_SM(bfa_fcs_vport_sm_fdisc), BFA_FCS_VPORT_FDISC},
{BFA_SM(bfa_fcs_vport_sm_fdisc_retry), BFA_FCS_VPORT_FDISC_RETRY}, {BFA_SM(bfa_fcs_vport_sm_fdisc_retry), BFA_FCS_VPORT_FDISC_RETRY},
{BFA_SM(bfa_fcs_vport_sm_fdisc_rsp_wait), BFA_FCS_VPORT_FDISC_RSP_WAIT},
{BFA_SM(bfa_fcs_vport_sm_online), BFA_FCS_VPORT_ONLINE}, {BFA_SM(bfa_fcs_vport_sm_online), BFA_FCS_VPORT_ONLINE},
{BFA_SM(bfa_fcs_vport_sm_deleting), BFA_FCS_VPORT_DELETING}, {BFA_SM(bfa_fcs_vport_sm_deleting), BFA_FCS_VPORT_DELETING},
{BFA_SM(bfa_fcs_vport_sm_cleanup), BFA_FCS_VPORT_CLEANUP}, {BFA_SM(bfa_fcs_vport_sm_cleanup), BFA_FCS_VPORT_CLEANUP},
...@@ -5042,6 +5218,11 @@ bfa_fcs_vport_sm_offline(struct bfa_fcs_vport_s *vport, ...@@ -5042,6 +5218,11 @@ bfa_fcs_vport_sm_offline(struct bfa_fcs_vport_s *vport,
bfa_fcs_vport_do_fdisc(vport); bfa_fcs_vport_do_fdisc(vport);
break; break;
case BFA_FCS_VPORT_SM_STOP:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup);
bfa_sm_send_event(&vport->lport, BFA_FCS_PORT_SM_STOP);
break;
case BFA_FCS_VPORT_SM_OFFLINE: case BFA_FCS_VPORT_SM_OFFLINE:
/* /*
* This can happen if the vport couldn't be initialzied * This can happen if the vport couldn't be initialzied
...@@ -5070,9 +5251,7 @@ bfa_fcs_vport_sm_fdisc(struct bfa_fcs_vport_s *vport, ...@@ -5070,9 +5251,7 @@ bfa_fcs_vport_sm_fdisc(struct bfa_fcs_vport_s *vport,
switch (event) { switch (event) {
case BFA_FCS_VPORT_SM_DELETE: case BFA_FCS_VPORT_SM_DELETE:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup); bfa_sm_set_state(vport, bfa_fcs_vport_sm_fdisc_rsp_wait);
bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE);
bfa_fcs_lport_delete(&vport->lport);
break; break;
case BFA_FCS_VPORT_SM_OFFLINE: case BFA_FCS_VPORT_SM_OFFLINE:
...@@ -5139,6 +5318,41 @@ bfa_fcs_vport_sm_fdisc_retry(struct bfa_fcs_vport_s *vport, ...@@ -5139,6 +5318,41 @@ bfa_fcs_vport_sm_fdisc_retry(struct bfa_fcs_vport_s *vport,
} }
} }
/*
* FDISC is in progress and we got a vport delete request -
* this is a wait state while we wait for fdisc response and
* we will transition to the appropriate state - on rsp status.
*/
static void
bfa_fcs_vport_sm_fdisc_rsp_wait(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event)
{
bfa_trc(__vport_fcs(vport), __vport_pwwn(vport));
bfa_trc(__vport_fcs(vport), event);
switch (event) {
case BFA_FCS_VPORT_SM_RSP_OK:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_deleting);
bfa_fcs_lport_delete(&vport->lport);
break;
case BFA_FCS_VPORT_SM_DELETE:
break;
case BFA_FCS_VPORT_SM_OFFLINE:
case BFA_FCS_VPORT_SM_RSP_ERROR:
case BFA_FCS_VPORT_SM_RSP_FAILED:
case BFA_FCS_VPORT_SM_RSP_DUP_WWN:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup);
bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE);
bfa_fcs_lport_delete(&vport->lport);
break;
default:
bfa_sm_fault(__vport_fcs(vport), event);
}
}
/* /*
* Vport is online (FDISC is complete). * Vport is online (FDISC is complete).
*/ */
...@@ -5155,6 +5369,11 @@ bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport, ...@@ -5155,6 +5369,11 @@ bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport,
bfa_fcs_lport_delete(&vport->lport); bfa_fcs_lport_delete(&vport->lport);
break; break;
case BFA_FCS_VPORT_SM_STOP:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_stopping);
bfa_sm_send_event(&vport->lport, BFA_FCS_PORT_SM_STOP);
break;
case BFA_FCS_VPORT_SM_OFFLINE: case BFA_FCS_VPORT_SM_OFFLINE:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline); bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline);
bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE);
...@@ -5166,6 +5385,32 @@ bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport, ...@@ -5166,6 +5385,32 @@ bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport,
} }
} }
/*
* Vport is being stopped - awaiting lport stop completion to send
* LOGO to fabric.
*/
static void
bfa_fcs_vport_sm_stopping(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event)
{
bfa_trc(__vport_fcs(vport), __vport_pwwn(vport));
bfa_trc(__vport_fcs(vport), event);
switch (event) {
case BFA_FCS_VPORT_SM_STOPCOMP:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_logo_for_stop);
bfa_fcs_vport_do_logo(vport);
break;
case BFA_FCS_VPORT_SM_OFFLINE:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup);
break;
default:
bfa_sm_fault(__vport_fcs(vport), event);
}
}
/* /*
* Vport is being deleted - awaiting lport delete completion to send * Vport is being deleted - awaiting lport delete completion to send
* LOGO to fabric. * LOGO to fabric.
...@@ -5236,6 +5481,10 @@ bfa_fcs_vport_sm_cleanup(struct bfa_fcs_vport_s *vport, ...@@ -5236,6 +5481,10 @@ bfa_fcs_vport_sm_cleanup(struct bfa_fcs_vport_s *vport,
bfa_fcs_vport_free(vport); bfa_fcs_vport_free(vport);
break; break;
case BFA_FCS_VPORT_SM_STOPCOMP:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_created);
break;
case BFA_FCS_VPORT_SM_DELETE: case BFA_FCS_VPORT_SM_DELETE:
break; break;
...@@ -5244,6 +5493,34 @@ bfa_fcs_vport_sm_cleanup(struct bfa_fcs_vport_s *vport, ...@@ -5244,6 +5493,34 @@ bfa_fcs_vport_sm_cleanup(struct bfa_fcs_vport_s *vport,
} }
} }
/*
* LOGO is sent to fabric. Vport stop is in progress. Lport stop cleanup
* is done.
*/
static void
bfa_fcs_vport_sm_logo_for_stop(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event)
{
bfa_trc(__vport_fcs(vport), __vport_pwwn(vport));
bfa_trc(__vport_fcs(vport), event);
switch (event) {
case BFA_FCS_VPORT_SM_OFFLINE:
bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE);
/*
* !!! fall through !!!
*/
case BFA_FCS_VPORT_SM_RSP_OK:
case BFA_FCS_VPORT_SM_RSP_ERROR:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_created);
break;
default:
bfa_sm_fault(__vport_fcs(vport), event);
}
}
/* /*
* LOGO is sent to fabric. Vport delete is in progress. Lport delete cleanup * LOGO is sent to fabric. Vport delete is in progress. Lport delete cleanup
* is done. * is done.
...@@ -5391,7 +5668,10 @@ void ...@@ -5391,7 +5668,10 @@ void
bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport) bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport)
{ {
vport->vport_stats.fab_online++; vport->vport_stats.fab_online++;
if (bfa_fcs_fabric_npiv_capable(__vport_fabric(vport)))
bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_ONLINE); bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_ONLINE);
else
vport->vport_stats.fab_no_npiv++;
} }
/* /*
...@@ -5421,6 +5701,15 @@ bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport) ...@@ -5421,6 +5701,15 @@ bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport)
bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_DELETE); bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_DELETE);
} }
/*
* Stop completion callback from associated lport
*/
void
bfa_fcs_vport_stop_comp(struct bfa_fcs_vport_s *vport)
{
bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_STOPCOMP);
}
/* /*
* Delete completion callback from associated lport * Delete completion callback from associated lport
*/ */
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -214,10 +214,10 @@ bfad_debugfs_read(struct file *file, char __user *buf, ...@@ -214,10 +214,10 @@ bfad_debugfs_read(struct file *file, char __user *buf,
#define BFA_REG_CT_ADDRSZ (0x40000) #define BFA_REG_CT_ADDRSZ (0x40000)
#define BFA_REG_CB_ADDRSZ (0x20000) #define BFA_REG_CB_ADDRSZ (0x20000)
#define BFA_REG_ADDRSZ(__bfa) \ #define BFA_REG_ADDRSZ(__ioc) \
((bfa_ioc_devid(&(__bfa)->ioc) == BFA_PCI_DEVICE_ID_CT) ? \ ((u32)(bfa_asic_id_ctc(bfa_ioc_devid(__ioc)) ? \
BFA_REG_CT_ADDRSZ : BFA_REG_CB_ADDRSZ) BFA_REG_CT_ADDRSZ : BFA_REG_CB_ADDRSZ))
#define BFA_REG_ADDRMSK(__bfa) ((u32)(BFA_REG_ADDRSZ(__bfa) - 1)) #define BFA_REG_ADDRMSK(__ioc) (BFA_REG_ADDRSZ(__ioc) - 1)
static bfa_status_t static bfa_status_t
bfad_reg_offset_check(struct bfa_s *bfa, u32 offset, u32 len) bfad_reg_offset_check(struct bfa_s *bfa, u32 offset, u32 len)
...@@ -236,7 +236,7 @@ bfad_reg_offset_check(struct bfa_s *bfa, u32 offset, u32 len) ...@@ -236,7 +236,7 @@ bfad_reg_offset_check(struct bfa_s *bfa, u32 offset, u32 len)
return BFA_STATUS_EINVAL; return BFA_STATUS_EINVAL;
} else { } else {
/* CB register space 64KB */ /* CB register space 64KB */
if ((offset + (len<<2)) > BFA_REG_ADDRMSK(bfa)) if ((offset + (len<<2)) > BFA_REG_ADDRMSK(&bfa->ioc))
return BFA_STATUS_EINVAL; return BFA_STATUS_EINVAL;
} }
return BFA_STATUS_OK; return BFA_STATUS_OK;
...@@ -317,7 +317,7 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf, ...@@ -317,7 +317,7 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf,
bfad->reglen = len << 2; bfad->reglen = len << 2;
rb = bfa_ioc_bar0(ioc); rb = bfa_ioc_bar0(ioc);
addr &= BFA_REG_ADDRMSK(bfa); addr &= BFA_REG_ADDRMSK(ioc);
/* offset and len sanity check */ /* offset and len sanity check */
rc = bfad_reg_offset_check(bfa, addr, len); rc = bfad_reg_offset_check(bfa, addr, len);
...@@ -380,7 +380,7 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf, ...@@ -380,7 +380,7 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf,
} }
kfree(kern_buf); kfree(kern_buf);
addr &= BFA_REG_ADDRMSK(bfa); /* offset only 17 bit and word align */ addr &= BFA_REG_ADDRMSK(ioc); /* offset only 17 bit and word align */
/* offset and len sanity check */ /* offset and len sanity check */
rc = bfad_reg_offset_check(bfa, addr, 1); rc = bfad_reg_offset_check(bfa, addr, 1);
......
此差异已折叠。
此差异已折叠。
...@@ -141,4 +141,7 @@ extern struct device_attribute *bfad_im_vport_attrs[]; ...@@ -141,4 +141,7 @@ extern struct device_attribute *bfad_im_vport_attrs[];
irqreturn_t bfad_intx(int irq, void *dev_id); irqreturn_t bfad_intx(int irq, void *dev_id);
int bfad_im_bsg_request(struct fc_bsg_job *job);
int bfad_im_bsg_timeout(struct fc_bsg_job *job);
#endif #endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -1743,7 +1743,6 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, ...@@ -1743,7 +1743,6 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
printk(KERN_ERR PFX "SCp.ptr is NULL\n"); printk(KERN_ERR PFX "SCp.ptr is NULL\n");
return; return;
} }
io_req->sc_cmd = NULL;
if (io_req->on_active_queue) { if (io_req->on_active_queue) {
list_del_init(&io_req->link); list_del_init(&io_req->link);
...@@ -1763,6 +1762,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, ...@@ -1763,6 +1762,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
} }
bnx2fc_unmap_sg_list(io_req); bnx2fc_unmap_sg_list(io_req);
io_req->sc_cmd = NULL;
switch (io_req->fcp_status) { switch (io_req->fcp_status) {
case FC_GOOD: case FC_GOOD:
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册