Commit d4e06701 authored by Linus Torvalds's avatar 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
parents e4980371 87045b03
...@@ -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,73 +215,62 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) ...@@ -215,73 +215,62 @@ 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 *)&boot_conn->negotiated_login_options.
(char *)&phba->boot_sess.conn_list[0]. auth_data.chap.target_chap_name);
negotiated_login_options.auth_data.chap.
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 *)&boot_conn->negotiated_login_options.
(char *)&phba->boot_sess.conn_list[0]. auth_data.chap.target_secret);
negotiated_login_options.auth_data.chap.
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 *)&boot_conn->negotiated_login_options.
(char *)&phba->boot_sess.conn_list[0]. auth_data.chap.intr_chap_name);
negotiated_login_options.auth_data.chap.
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 *)&boot_conn->negotiated_login_options.
(char *)&phba->boot_sess.conn_list[0]. auth_data.chap.intr_secret);
negotiated_login_options.auth_data.chap.
intr_secret);
break; break;
case ISCSI_BOOT_TGT_FLAGS: case ISCSI_BOOT_TGT_FLAGS:
rc = sprintf(str, "2\n"); rc = sprintf(str, "2\n");
break; break;
case ISCSI_BOOT_TGT_NIC_ASSOC: case ISCSI_BOOT_TGT_NIC_ASSOC:
rc = sprintf(str, "0\n"); rc = sprintf(str, "0\n");
break; break;
default: default:
rc = -ENOSYS; rc = -ENOSYS;
...@@ -315,10 +304,10 @@ static ssize_t beiscsi_show_boot_eth_info(void *data, int type, char *buf) ...@@ -315,10 +304,10 @@ static ssize_t beiscsi_show_boot_eth_info(void *data, int type, char *buf)
switch (type) { switch (type) {
case ISCSI_BOOT_ETH_FLAGS: case ISCSI_BOOT_ETH_FLAGS:
rc = sprintf(str, "2\n"); rc = sprintf(str, "2\n");
break; break;
case ISCSI_BOOT_ETH_INDEX: case ISCSI_BOOT_ETH_INDEX:
rc = sprintf(str, "0\n"); rc = sprintf(str, "0\n");
break; break;
case ISCSI_BOOT_ETH_MAC: case ISCSI_BOOT_ETH_MAC:
rc = beiscsi_get_macaddr(buf, phba); rc = beiscsi_get_macaddr(buf, phba);
...@@ -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,8 +4152,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) ...@@ -4150,8 +4152,7 @@ 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);
iscsi_host_free(phba->shost); iscsi_host_free(phba->shost);
...@@ -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);
......
This diff is collapsed.
This diff is collapsed.
...@@ -90,12 +90,14 @@ enum bfa_lport_role { ...@@ -90,12 +90,14 @@ enum bfa_lport_role {
* FCS port configuration. * FCS port configuration.
*/ */
struct bfa_lport_cfg_s { 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;
u8 tag[16]; /* opaque tag from application */ bfa_boolean_t preboot_vp; /* vport created from PBC */
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 {
...@@ -266,8 +318,8 @@ struct bfa_fw_fcoe_stats_s { ...@@ -266,8 +318,8 @@ struct bfa_fw_fcoe_stats_s {
* IOC firmware FCoE port stats * IOC firmware FCoE port stats
*/ */
struct bfa_fw_fcoe_port_stats_s { struct bfa_fw_fcoe_port_stats_s {
struct bfa_fw_fcoe_stats_s fcoe_stats; struct bfa_fw_fcoe_stats_s fcoe_stats;
struct bfa_fw_fip_stats_s fip_stats; struct bfa_fw_fip_stats_s fip_stats;
}; };
/* /*
...@@ -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,
......
This diff is collapsed.
...@@ -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,25 +92,49 @@ bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, ...@@ -92,25 +92,49 @@ 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 =
bfa_iocfc_get_pbc_vports(fcs->bfa, pbc_vports); bfa_iocfc_get_pbc_vports(fcs->bfa, pbc_vports);
for (i = 0; i < npbc_vports; i++) for (i = 0; i < npbc_vports; i++)
bfa_fcb_pbc_vport_create(fcs->bfa->bfad, pbc_vports[i]); bfa_fcb_pbc_vport_create(fcs->bfa->bfad, pbc_vports[i]);
} }
} }
/* /*
* brief * brief
* FCS driver details initialization. * FCS driver details initialization.
...@@ -168,11 +192,14 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs) ...@@ -168,11 +192,14 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs)
#define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */ #define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */
#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_NLPORT; \ (__fabric)->oper_type = BFA_PORT_TYPE_P2P; \
} else \
(__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,10 +598,21 @@ void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim); ...@@ -591,10 +598,21 @@ 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_2G | \
FDMI_TRANS_SPEED_4G | \ FDMI_TRANS_SPEED_4G)
FDMI_TRANS_SPEED_8G)
#define BFA_FCS_FDMI_SUPP_SPEEDS_8G (FDMI_TRANS_SPEED_1G | \
FDMI_TRANS_SPEED_2G | \
FDMI_TRANS_SPEED_4G | \
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
...@@ -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);
} }
} }
......
This diff is collapsed.
...@@ -262,6 +262,7 @@ bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport, ...@@ -262,6 +262,7 @@ bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport,
break; break;
case RPSM_EVENT_PLOGI_RCVD: case RPSM_EVENT_PLOGI_RCVD:
case RPSM_EVENT_PLOGI_COMP:
case RPSM_EVENT_SCN: case RPSM_EVENT_SCN:
/* /*
* Ignore, SCN is possibly online notification. * Ignore, SCN is possibly online notification.
...@@ -470,6 +471,7 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport, ...@@ -470,6 +471,7 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport,
break; break;
case RPSM_EVENT_PRLO_RCVD: case RPSM_EVENT_PRLO_RCVD:
case RPSM_EVENT_PLOGI_COMP:
break; break;
case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_LOGO_RCVD:
...@@ -484,9 +486,9 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport, ...@@ -484,9 +486,9 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport,
break; break;
case RPSM_EVENT_PLOGI_RCVD: case RPSM_EVENT_PLOGI_RCVD:
bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending); rport->plogi_pending = BFA_TRUE;
bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline);
bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
bfa_fcs_rport_send_plogiacc(rport, NULL);
break; break;
case RPSM_EVENT_DELETE: case RPSM_EVENT_DELETE:
...@@ -891,6 +893,18 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport, ...@@ -891,6 +893,18 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport,
switch (event) { switch (event) {
case RPSM_EVENT_HCB_OFFLINE: case RPSM_EVENT_HCB_OFFLINE:
if (bfa_fcs_lport_is_online(rport->port) &&
(rport->plogi_pending)) {
rport->plogi_pending = BFA_FALSE;
bfa_sm_set_state(rport,
bfa_fcs_rport_sm_plogiacc_sending);
bfa_fcs_rport_send_plogiacc(rport, NULL);
break;
}
/*
* !! fall through !!
*/
case RPSM_EVENT_ADDRESS_CHANGE: case RPSM_EVENT_ADDRESS_CHANGE:
if (bfa_fcs_lport_is_online(rport->port)) { if (bfa_fcs_lport_is_online(rport->port)) {
if (bfa_fcs_fabric_is_switched(rport->port->fabric)) { if (bfa_fcs_fabric_is_switched(rport->port->fabric)) {
...@@ -921,6 +935,8 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport, ...@@ -921,6 +935,8 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport,
case RPSM_EVENT_SCN: case RPSM_EVENT_SCN:
case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_LOGO_RCVD:
case RPSM_EVENT_PRLO_RCVD: case RPSM_EVENT_PRLO_RCVD:
case RPSM_EVENT_PLOGI_RCVD:
case RPSM_EVENT_LOGO_IMP:
/* /*
* Ignore, already offline. * Ignore, already offline.
*/ */
...@@ -957,10 +973,18 @@ bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport, ...@@ -957,10 +973,18 @@ bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport,
*/ */
if (bfa_fcs_lport_is_online(rport->port) && if (bfa_fcs_lport_is_online(rport->port) &&
(!BFA_FCS_PID_IS_WKA(rport->pid))) { (!BFA_FCS_PID_IS_WKA(rport->pid))) {
bfa_sm_set_state(rport, if (bfa_fcs_fabric_is_switched(rport->port->fabric)) {
bfa_fcs_rport_sm_nsdisc_sending); bfa_sm_set_state(rport,
rport->ns_retries = 0; bfa_fcs_rport_sm_nsdisc_sending);
bfa_fcs_rport_send_nsdisc(rport, NULL); rport->ns_retries = 0;
bfa_fcs_rport_send_nsdisc(rport, NULL);
} else {
/* For N2N Direct Attach, try to re-login */
bfa_sm_set_state(rport,
bfa_fcs_rport_sm_plogi_sending);
rport->plogi_retries = 0;
bfa_fcs_rport_send_plogi(rport, NULL);
}
} else { } else {
/* /*
* if it is not a well known address, reset the * if it is not a well known address, reset the
...@@ -1356,7 +1380,8 @@ bfa_fcs_rport_send_plogi(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced) ...@@ -1356,7 +1380,8 @@ bfa_fcs_rport_send_plogi(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid, len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid,
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, bfa_fcs_rport_plogi_response, FC_CLASS_3, len, &fchs, bfa_fcs_rport_plogi_response,
...@@ -1476,7 +1501,8 @@ bfa_fcs_rport_send_plogiacc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced) ...@@ -1476,7 +1501,8 @@ bfa_fcs_rport_send_plogiacc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
rport->pid, bfa_fcs_lport_get_fcid(port), rport->pid, bfa_fcs_lport_get_fcid(port),
rport->reply_oxid, port->port_cfg.pwwn, rport->reply_oxid, port->port_cfg.pwwn,
port->port_cfg.nwwn, 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, NULL, NULL, FC_MAX_PDUSZ, 0); FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0);
...@@ -2024,6 +2050,11 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport) ...@@ -2024,6 +2050,11 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport)
rport->stats.onlines++; rport->stats.onlines++;
if ((!rport->pid) || (!rport->pwwn)) {
bfa_trc(rport->fcs, rport->pid);
bfa_sm_fault(rport->fcs, rport->pid);
}
if (bfa_fcs_lport_is_initiator(port)) { if (bfa_fcs_lport_is_initiator(port)) {
bfa_fcs_itnim_rport_online(rport->itnim); bfa_fcs_itnim_rport_online(rport->itnim);
if (!BFA_FCS_PID_IS_WKA(rport->pid)) if (!BFA_FCS_PID_IS_WKA(rport->pid))
...@@ -2047,6 +2078,7 @@ bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport) ...@@ -2047,6 +2078,7 @@ bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport)
char rpwwn_buf[BFA_STRING_32]; char rpwwn_buf[BFA_STRING_32];
rport->stats.offlines++; rport->stats.offlines++;
rport->plogi_pending = BFA_FALSE;
wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port));
wwn2str(rpwwn_buf, rport->pwwn); wwn2str(rpwwn_buf, rport->pwwn);
...@@ -2120,7 +2152,7 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi) ...@@ -2120,7 +2152,7 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi)
port->fabric->bb_credit = be16_to_cpu(plogi->csp.bbcred); port->fabric->bb_credit = be16_to_cpu(plogi->csp.bbcred);
bfa_fcport_set_tx_bbcredit(port->fcs->bfa, bfa_fcport_set_tx_bbcredit(port->fcs->bfa,
port->fabric->bb_credit); port->fabric->bb_credit, 0);
} }
} }
...@@ -2233,22 +2265,6 @@ bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port, struct fchs_s *fchs, ...@@ -2233,22 +2265,6 @@ bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port, struct fchs_s *fchs,
bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD); bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD);
} }
static int
wwn_compare(wwn_t wwn1, wwn_t wwn2)
{
u8 *b1 = (u8 *) &wwn1;
u8 *b2 = (u8 *) &wwn2;
int i;
for (i = 0; i < sizeof(wwn_t); i++) {
if (b1[i] < b2[i])
return -1;
if (b1[i] > b2[i])
return 1;
}
return 0;
}
/* /*
* Called by bport/vport to handle PLOGI received from an existing * Called by bport/vport to handle PLOGI received from an existing
* remote port. * remote port.
...@@ -2266,19 +2282,8 @@ bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs, ...@@ -2266,19 +2282,8 @@ bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
rport->reply_oxid = rx_fchs->ox_id; rport->reply_oxid = rx_fchs->ox_id;
bfa_trc(rport->fcs, rport->reply_oxid); bfa_trc(rport->fcs, rport->reply_oxid);
/* rport->pid = rx_fchs->s_id;
* In Switched fabric topology, bfa_trc(rport->fcs, rport->pid);
* PLOGI to each other. If our pwwn is smaller, ignore it,
* if it is not a well known address.
* If the link topology is N2N,
* this Plogi should be accepted.
*/
if ((wwn_compare(rport->port->port_cfg.pwwn, rport->pwwn) == -1) &&
(bfa_fcs_fabric_is_switched(rport->port->fabric)) &&
(!BFA_FCS_PID_IS_WKA(rport->pid))) {
bfa_trc(rport->fcs, rport->pid);
return;
}
rport->stats.plogi_rcvd++; rport->stats.plogi_rcvd++;
bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD); bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD);
...@@ -2531,7 +2536,45 @@ bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id) ...@@ -2531,7 +2536,45 @@ bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id)
bfa_sm_send_event(rport, RPSM_EVENT_PRLO_RCVD); bfa_sm_send_event(rport, RPSM_EVENT_PRLO_RCVD);
} }
void
bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
struct bfa_rport_attr_s *rport_attr)
{
struct bfa_rport_qos_attr_s qos_attr;
struct bfa_fcs_lport_s *port = rport->port;
bfa_port_speed_t rport_speed = rport->rpf.rpsc_speed;
memset(rport_attr, 0, sizeof(struct bfa_rport_attr_s));
memset(&qos_attr, 0, sizeof(struct bfa_rport_qos_attr_s));
rport_attr->pid = rport->pid;
rport_attr->pwwn = rport->pwwn;
rport_attr->nwwn = rport->nwwn;
rport_attr->cos_supported = rport->fc_cos;
rport_attr->df_sz = rport->maxfrsize;
rport_attr->state = bfa_fcs_rport_get_state(rport);
rport_attr->fc_cos = rport->fc_cos;
rport_attr->cisc = rport->cisc;
rport_attr->scsi_function = rport->scsi_function;
rport_attr->curr_speed = rport->rpf.rpsc_speed;
rport_attr->assigned_speed = rport->rpf.assigned_speed;
qos_attr.qos_priority = rport->bfa_rport->qos_attr.qos_priority;
qos_attr.qos_flow_id =
cpu_to_be32(rport->bfa_rport->qos_attr.qos_flow_id);
rport_attr->qos_attr = qos_attr;
rport_attr->trl_enforced = BFA_FALSE;
if (bfa_fcport_is_ratelim(port->fcs->bfa) &&
(rport->scsi_function == BFA_RPORT_TARGET)) {
if (rport_speed == BFA_PORT_SPEED_UNKNOWN)
rport_speed =
bfa_fcport_get_ratelim_speed(rport->fcs->bfa);
if (rport_speed < bfa_fcs_lport_get_rport_max_speed(port))
rport_attr->trl_enforced = BFA_TRUE;
}
}
/* /*
* Remote port implementation. * Remote port implementation.
......
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
#include "bfad_drv.h" #include "bfad_drv.h"
#include "bfa_modules.h" #include "bfa_modules.h"
#include "bfi_cbreg.h" #include "bfi_reg.h"
void void
bfa_hwcb_reginit(struct bfa_s *bfa) bfa_hwcb_reginit(struct bfa_s *bfa)
{ {
struct bfa_iocfc_regs_s *bfa_regs = &bfa->iocfc.bfa_regs; struct bfa_iocfc_regs_s *bfa_regs = &bfa->iocfc.bfa_regs;
void __iomem *kva = bfa_ioc_bar0(&bfa->ioc); void __iomem *kva = bfa_ioc_bar0(&bfa->ioc);
int i, q, fn = bfa_ioc_pcifn(&bfa->ioc); int fn = bfa_ioc_pcifn(&bfa->ioc);
if (fn == 0) { if (fn == 0) {
bfa_regs->intr_status = (kva + HOSTFN0_INT_STATUS); bfa_regs->intr_status = (kva + HOSTFN0_INT_STATUS);
...@@ -33,29 +33,6 @@ bfa_hwcb_reginit(struct bfa_s *bfa) ...@@ -33,29 +33,6 @@ bfa_hwcb_reginit(struct bfa_s *bfa)
bfa_regs->intr_status = (kva + HOSTFN1_INT_STATUS); bfa_regs->intr_status = (kva + HOSTFN1_INT_STATUS);
bfa_regs->intr_mask = (kva + HOSTFN1_INT_MSK); bfa_regs->intr_mask = (kva + HOSTFN1_INT_MSK);
} }
for (i = 0; i < BFI_IOC_MAX_CQS; i++) {
/*
* CPE registers
*/
q = CPE_Q_NUM(fn, i);
bfa_regs->cpe_q_pi[i] = (kva + CPE_Q_PI(q));
bfa_regs->cpe_q_ci[i] = (kva + CPE_Q_CI(q));
bfa_regs->cpe_q_depth[i] = (kva + CPE_Q_DEPTH(q));
/*
* RME registers
*/
q = CPE_Q_NUM(fn, i);
bfa_regs->rme_q_pi[i] = (kva + RME_Q_PI(q));
bfa_regs->rme_q_ci[i] = (kva + RME_Q_CI(q));
bfa_regs->rme_q_depth[i] = (kva + RME_Q_DEPTH(q));
}
}
void
bfa_hwcb_reqq_ack(struct bfa_s *bfa, int reqq)
{
} }
static void static void
...@@ -65,11 +42,6 @@ bfa_hwcb_reqq_ack_msix(struct bfa_s *bfa, int reqq) ...@@ -65,11 +42,6 @@ bfa_hwcb_reqq_ack_msix(struct bfa_s *bfa, int reqq)
bfa->iocfc.bfa_regs.intr_status); bfa->iocfc.bfa_regs.intr_status);
} }
void
bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq)
{
}
static void static void
bfa_hwcb_rspq_ack_msix(struct bfa_s *bfa, int rspq) bfa_hwcb_rspq_ack_msix(struct bfa_s *bfa, int rspq)
{ {
...@@ -103,44 +75,72 @@ bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap, ...@@ -103,44 +75,72 @@ bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap,
*num_vecs = __HFN_NUMINTS; *num_vecs = __HFN_NUMINTS;
} }
/*
* Dummy interrupt handler for handling spurious interrupts.
*/
static void
bfa_hwcb_msix_dummy(struct bfa_s *bfa, int vec)
{
}
/* /*
* No special setup required for crossbow -- vector assignments are implicit. * No special setup required for crossbow -- vector assignments are implicit.
*/ */
void void
bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs) bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs)
{ {
int i;
WARN_ON((nvecs != 1) && (nvecs != __HFN_NUMINTS)); WARN_ON((nvecs != 1) && (nvecs != __HFN_NUMINTS));
bfa->msix.nvecs = nvecs; bfa->msix.nvecs = nvecs;
if (nvecs == 1) { bfa_hwcb_msix_uninstall(bfa);
for (i = 0; i < BFA_MSIX_CB_MAX; i++) }
void
bfa_hwcb_msix_ctrl_install(struct bfa_s *bfa)
{
int i;
if (bfa->msix.nvecs == 0)
return;
if (bfa->msix.nvecs == 1) {
for (i = BFI_MSIX_CPE_QMIN_CB; i < BFI_MSIX_CB_MAX; i++)
bfa->msix.handler[i] = bfa_msix_all; bfa->msix.handler[i] = bfa_msix_all;
return; return;
} }
for (i = BFA_MSIX_CPE_Q0; i <= BFA_MSIX_CPE_Q7; i++) for (i = BFI_MSIX_RME_QMAX_CB+1; i < BFI_MSIX_CB_MAX; i++)
bfa->msix.handler[i] = bfa_msix_reqq;
for (i = BFA_MSIX_RME_Q0; i <= BFA_MSIX_RME_Q7; i++)
bfa->msix.handler[i] = bfa_msix_rspq;
for (; i < BFA_MSIX_CB_MAX; i++)
bfa->msix.handler[i] = bfa_msix_lpu_err; bfa->msix.handler[i] = bfa_msix_lpu_err;
} }
/*
* Crossbow -- dummy, interrupts are masked
*/
void void
bfa_hwcb_msix_install(struct bfa_s *bfa) bfa_hwcb_msix_queue_install(struct bfa_s *bfa)
{ {
int i;
if (bfa->msix.nvecs == 0)
return;
if (bfa->msix.nvecs == 1) {
for (i = BFI_MSIX_CPE_QMIN_CB; i <= BFI_MSIX_RME_QMAX_CB; i++)
bfa->msix.handler[i] = bfa_msix_all;
return;
}
for (i = BFI_MSIX_CPE_QMIN_CB; i <= BFI_MSIX_CPE_QMAX_CB; i++)
bfa->msix.handler[i] = bfa_msix_reqq;
for (i = BFI_MSIX_RME_QMIN_CB; i <= BFI_MSIX_RME_QMAX_CB; i++)
bfa->msix.handler[i] = bfa_msix_rspq;
} }
void void
bfa_hwcb_msix_uninstall(struct bfa_s *bfa) bfa_hwcb_msix_uninstall(struct bfa_s *bfa)
{ {
int i;
for (i = 0; i < BFI_MSIX_CB_MAX; i++)
bfa->msix.handler[i] = bfa_hwcb_msix_dummy;
} }
/* /*
...@@ -156,6 +156,6 @@ bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix) ...@@ -156,6 +156,6 @@ bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix)
void void
bfa_hwcb_msix_get_rme_range(struct bfa_s *bfa, u32 *start, u32 *end) bfa_hwcb_msix_get_rme_range(struct bfa_s *bfa, u32 *start, u32 *end)
{ {
*start = BFA_MSIX_RME_Q0; *start = BFI_MSIX_RME_QMIN_CB;
*end = BFA_MSIX_RME_Q7; *end = BFI_MSIX_RME_QMAX_CB;
} }
...@@ -17,29 +17,10 @@ ...@@ -17,29 +17,10 @@
#include "bfad_drv.h" #include "bfad_drv.h"
#include "bfa_modules.h" #include "bfa_modules.h"
#include "bfi_ctreg.h" #include "bfi_reg.h"
BFA_TRC_FILE(HAL, IOCFC_CT); BFA_TRC_FILE(HAL, IOCFC_CT);
static u32 __ct_msix_err_vec_reg[] = {
HOST_MSIX_ERR_INDEX_FN0,
HOST_MSIX_ERR_INDEX_FN1,
HOST_MSIX_ERR_INDEX_FN2,
HOST_MSIX_ERR_INDEX_FN3,
};
static void
bfa_hwct_msix_lpu_err_set(struct bfa_s *bfa, bfa_boolean_t msix, int vec)
{
int fn = bfa_ioc_pcifn(&bfa->ioc);
void __iomem *kva = bfa_ioc_bar0(&bfa->ioc);
if (msix)
writel(vec, kva + __ct_msix_err_vec_reg[fn]);
else
writel(0, kva + __ct_msix_err_vec_reg[fn]);
}
/* /*
* Dummy interrupt handler for handling spurious interrupt during chip-reinit. * Dummy interrupt handler for handling spurious interrupt during chip-reinit.
*/ */
...@@ -53,7 +34,7 @@ bfa_hwct_reginit(struct bfa_s *bfa) ...@@ -53,7 +34,7 @@ bfa_hwct_reginit(struct bfa_s *bfa)
{ {
struct bfa_iocfc_regs_s *bfa_regs = &bfa->iocfc.bfa_regs; struct bfa_iocfc_regs_s *bfa_regs = &bfa->iocfc.bfa_regs;
void __iomem *kva = bfa_ioc_bar0(&bfa->ioc); void __iomem *kva = bfa_ioc_bar0(&bfa->ioc);
int i, q, fn = bfa_ioc_pcifn(&bfa->ioc); int fn = bfa_ioc_pcifn(&bfa->ioc);
if (fn == 0) { if (fn == 0) {
bfa_regs->intr_status = (kva + HOSTFN0_INT_STATUS); bfa_regs->intr_status = (kva + HOSTFN0_INT_STATUS);
...@@ -62,26 +43,16 @@ bfa_hwct_reginit(struct bfa_s *bfa) ...@@ -62,26 +43,16 @@ bfa_hwct_reginit(struct bfa_s *bfa)
bfa_regs->intr_status = (kva + HOSTFN1_INT_STATUS); bfa_regs->intr_status = (kva + HOSTFN1_INT_STATUS);
bfa_regs->intr_mask = (kva + HOSTFN1_INT_MSK); bfa_regs->intr_mask = (kva + HOSTFN1_INT_MSK);
} }
}
for (i = 0; i < BFI_IOC_MAX_CQS; i++) { void
/* bfa_hwct2_reginit(struct bfa_s *bfa)
* CPE registers {
*/ struct bfa_iocfc_regs_s *bfa_regs = &bfa->iocfc.bfa_regs;
q = CPE_Q_NUM(fn, i); void __iomem *kva = bfa_ioc_bar0(&bfa->ioc);
bfa_regs->cpe_q_pi[i] = (kva + CPE_PI_PTR_Q(q << 5));
bfa_regs->cpe_q_ci[i] = (kva + CPE_CI_PTR_Q(q << 5)); bfa_regs->intr_status = (kva + CT2_HOSTFN_INT_STATUS);
bfa_regs->cpe_q_depth[i] = (kva + CPE_DEPTH_Q(q << 5)); bfa_regs->intr_mask = (kva + CT2_HOSTFN_INTR_MASK);
bfa_regs->cpe_q_ctrl[i] = (kva + CPE_QCTRL_Q(q << 5));
/*
* RME registers
*/
q = CPE_Q_NUM(fn, i);
bfa_regs->rme_q_pi[i] = (kva + RME_PI_PTR_Q(q << 5));
bfa_regs->rme_q_ci[i] = (kva + RME_CI_PTR_Q(q << 5));
bfa_regs->rme_q_depth[i] = (kva + RME_DEPTH_Q(q << 5));
bfa_regs->rme_q_ctrl[i] = (kva + RME_QCTRL_Q(q << 5));
}
} }
void void
...@@ -106,9 +77,9 @@ void ...@@ -106,9 +77,9 @@ void
bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap, bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap,
u32 *num_vecs, u32 *max_vec_bit) u32 *num_vecs, u32 *max_vec_bit)
{ {
*msix_vecs_bmap = (1 << BFA_MSIX_CT_MAX) - 1; *msix_vecs_bmap = (1 << BFI_MSIX_CT_MAX) - 1;
*max_vec_bit = (1 << (BFA_MSIX_CT_MAX - 1)); *max_vec_bit = (1 << (BFI_MSIX_CT_MAX - 1));
*num_vecs = BFA_MSIX_CT_MAX; *num_vecs = BFI_MSIX_CT_MAX;
} }
/* /*
...@@ -117,7 +88,7 @@ bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap, ...@@ -117,7 +88,7 @@ bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap,
void void
bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs) bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs)
{ {
WARN_ON((nvecs != 1) && (nvecs != BFA_MSIX_CT_MAX)); WARN_ON((nvecs != 1) && (nvecs != BFI_MSIX_CT_MAX));
bfa_trc(bfa, nvecs); bfa_trc(bfa, nvecs);
bfa->msix.nvecs = nvecs; bfa->msix.nvecs = nvecs;
...@@ -125,7 +96,19 @@ bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs) ...@@ -125,7 +96,19 @@ bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs)
} }
void void
bfa_hwct_msix_install(struct bfa_s *bfa) bfa_hwct_msix_ctrl_install(struct bfa_s *bfa)
{
if (bfa->msix.nvecs == 0)
return;
if (bfa->msix.nvecs == 1)
bfa->msix.handler[BFI_MSIX_LPU_ERR_CT] = bfa_msix_all;
else
bfa->msix.handler[BFI_MSIX_LPU_ERR_CT] = bfa_msix_lpu_err;
}
void
bfa_hwct_msix_queue_install(struct bfa_s *bfa)
{ {
int i; int i;
...@@ -133,19 +116,16 @@ bfa_hwct_msix_install(struct bfa_s *bfa) ...@@ -133,19 +116,16 @@ bfa_hwct_msix_install(struct bfa_s *bfa)
return; return;
if (bfa->msix.nvecs == 1) { if (bfa->msix.nvecs == 1) {
for (i = 0; i < BFA_MSIX_CT_MAX; i++) for (i = BFI_MSIX_CPE_QMIN_CT; i < BFI_MSIX_CT_MAX; i++)
bfa->msix.handler[i] = bfa_msix_all; bfa->msix.handler[i] = bfa_msix_all;
return; return;
} }
for (i = BFA_MSIX_CPE_Q0; i <= BFA_MSIX_CPE_Q3; i++) for (i = BFI_MSIX_CPE_QMIN_CT; i <= BFI_MSIX_CPE_QMAX_CT; i++)
bfa->msix.handler[i] = bfa_msix_reqq; bfa->msix.handler[i] = bfa_msix_reqq;
for (; i <= BFA_MSIX_RME_Q3; i++) for (i = BFI_MSIX_RME_QMIN_CT; i <= BFI_MSIX_RME_QMAX_CT; i++)
bfa->msix.handler[i] = bfa_msix_rspq; bfa->msix.handler[i] = bfa_msix_rspq;
WARN_ON(i != BFA_MSIX_LPU_ERR);
bfa->msix.handler[BFA_MSIX_LPU_ERR] = bfa_msix_lpu_err;
} }
void void
...@@ -153,7 +133,7 @@ bfa_hwct_msix_uninstall(struct bfa_s *bfa) ...@@ -153,7 +133,7 @@ bfa_hwct_msix_uninstall(struct bfa_s *bfa)
{ {
int i; int i;
for (i = 0; i < BFA_MSIX_CT_MAX; i++) for (i = 0; i < BFI_MSIX_CT_MAX; i++)
bfa->msix.handler[i] = bfa_hwct_msix_dummy; bfa->msix.handler[i] = bfa_hwct_msix_dummy;
} }
...@@ -164,13 +144,12 @@ void ...@@ -164,13 +144,12 @@ void
bfa_hwct_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix) bfa_hwct_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix)
{ {
bfa_trc(bfa, 0); bfa_trc(bfa, 0);
bfa_hwct_msix_lpu_err_set(bfa, msix, BFA_MSIX_LPU_ERR);
bfa_ioc_isr_mode_set(&bfa->ioc, msix); bfa_ioc_isr_mode_set(&bfa->ioc, msix);
} }
void void
bfa_hwct_msix_get_rme_range(struct bfa_s *bfa, u32 *start, u32 *end) bfa_hwct_msix_get_rme_range(struct bfa_s *bfa, u32 *start, u32 *end)
{ {
*start = BFA_MSIX_RME_Q0; *start = BFI_MSIX_RME_QMIN_CT;
*end = BFA_MSIX_RME_Q3; *end = BFI_MSIX_RME_QMAX_CT;
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment