Skip to content

Commit

Permalink
[SCSI] bfa: Enable ASIC block configuration and query.
Browse files Browse the repository at this point in the history
- Added ASIC block configuration APIs:
	- to create/delete/update the physical functions
	- to do adapter/port mode configuration
	- to query the current ASIC block configuration.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
  • Loading branch information
Krishna Gudipati authored and James Bottomley committed Jun 29, 2011
1 parent ea9582d commit 1a4d8e1
Show file tree
Hide file tree
Showing 10 changed files with 863 additions and 9 deletions.
25 changes: 25 additions & 0 deletions drivers/scsi/bfa/bfa_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,29 @@ bfa_com_port_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi)
bfa_meminfo_dma_phys(mi) = dm_pa + dm_len;
}

/*
* ablk module attach
*/
static void
bfa_com_ablk_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi)
{
struct bfa_ablk_s *ablk = &bfa->modules.ablk;
u32 dm_len;
u8 *dm_kva;
u64 dm_pa;

dm_len = bfa_ablk_meminfo();
dm_kva = bfa_meminfo_dma_virt(mi);
dm_pa = bfa_meminfo_dma_phys(mi);

memset(ablk, 0, sizeof(struct bfa_ablk_s));
bfa_ablk_attach(ablk, &bfa->ioc);
bfa_ablk_memclaim(ablk, dm_kva, dm_pa);

bfa_meminfo_dma_virt(mi) = dm_kva + dm_len;
bfa_meminfo_dma_phys(mi) = dm_pa + dm_len;
}

/*
* BFA IOC FC related definitions
*/
Expand Down Expand Up @@ -1117,6 +1140,7 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo)
hal_mods[i]->meminfo(cfg, &km_len, &dm_len);

dm_len += bfa_port_meminfo();
dm_len += bfa_ablk_meminfo();

meminfo->meminfo[BFA_MEM_TYPE_KVA - 1].mem_len = km_len;
meminfo->meminfo[BFA_MEM_TYPE_DMA - 1].mem_len = dm_len;
Expand Down Expand Up @@ -1174,6 +1198,7 @@ bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
hal_mods[i]->attach(bfa, bfad, cfg, meminfo, pcidev);

bfa_com_port_attach(bfa, meminfo);
bfa_com_ablk_attach(bfa, meminfo);
}

/*
Expand Down
71 changes: 70 additions & 1 deletion drivers/scsi/bfa/bfa_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,10 @@ struct bfa_ioc_attr_s {
struct bfa_ioc_driver_attr_s driver_attr; /* driver attr */
struct bfa_ioc_pci_attr_s pci_attr;
u8 port_id; /* port number */
u8 rsvd[7]; /* 64bit align */
u8 port_mode; /* bfa_mode_s */
u8 cap_bm; /* capability */
u8 port_mode_cfg; /* bfa_mode_s */
u8 rsvd[4]; /* 64bit align */
};

/*
Expand All @@ -352,6 +355,16 @@ struct bfa_ioc_attr_s {
#define BFA_MFG_IC_FC 0x01
#define BFA_MFG_IC_ETH 0x02

/*
* Adapter capability mask definition
*/
#define BFA_CM_HBA 0x01
#define BFA_CM_CNA 0x02
#define BFA_CM_NIC 0x04
#define BFA_CM_FC16G 0x08
#define BFA_CM_SRIOV 0x10
#define BFA_CM_MEZZ 0x20

#pragma pack(1)

/*
Expand Down Expand Up @@ -418,6 +431,9 @@ enum {
*/
enum {
BFA_PCI_FCOE_SSDEVICE_ID = 0x14,
BFA_PCI_CT2_SSID_FCoE = 0x22,
BFA_PCI_CT2_SSID_ETH = 0x23,
BFA_PCI_CT2_SSID_FC = 0x24,
};

/*
Expand Down Expand Up @@ -485,4 +501,57 @@ struct bfa_boot_pbc_s {
struct bfa_boot_bootlun_s pblun[BFA_PREBOOT_BOOTLUN_MAX];
};

/*
* ASIC block configuration related structures
*/
#define BFA_ABLK_MAX_PORTS 2
#define BFA_ABLK_MAX_PFS 16
#define BFA_ABLK_MAX 2

#pragma pack(1)
enum bfa_mode_s {
BFA_MODE_HBA = 1,
BFA_MODE_CNA = 2,
BFA_MODE_NIC = 3
};

struct bfa_adapter_cfg_mode_s {
u16 max_pf;
u16 max_vf;
enum bfa_mode_s mode;
};

struct bfa_ablk_cfg_pf_s {
u16 pers;
u8 port_id;
u8 optrom;
u8 valid;
u8 sriov;
u8 max_vfs;
u8 rsvd[1];
u16 num_qpairs;
u16 num_vectors;
u32 bw;
};

struct bfa_ablk_cfg_port_s {
u8 mode;
u8 type;
u8 max_pfs;
u8 rsvd[5];
};

struct bfa_ablk_cfg_inst_s {
u8 nports;
u8 max_pfs;
u8 rsvd[6];
struct bfa_ablk_cfg_pf_s pf_cfg[BFA_ABLK_MAX_PFS];
struct bfa_ablk_cfg_port_s port_cfg[BFA_ABLK_MAX_PORTS];
};

struct bfa_ablk_cfg_s {
struct bfa_ablk_cfg_inst_s inst[BFA_ABLK_MAX];
};
#pragma pack()

#endif /* __BFA_DEFS_H__ */
10 changes: 8 additions & 2 deletions drivers/scsi/bfa/bfa_defs_svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ struct bfa_fw_fcoe_stats_s {
* IOC firmware FCoE port stats
*/
struct bfa_fw_fcoe_port_stats_s {
struct bfa_fw_fcoe_stats_s fcoe_stats;
struct bfa_fw_fip_stats_s fip_stats;
struct bfa_fw_fcoe_stats_s fcoe_stats;
struct bfa_fw_fip_stats_s fip_stats;
};

/*
Expand Down Expand Up @@ -1083,4 +1083,10 @@ union bfa_port_stats_u {
struct bfa_port_eth_stats_s eth;
};

struct bfa_port_cfg_mode_s {
u16 max_pf;
u16 max_vf;
enum bfa_mode_s mode;
};

#endif /* __BFA_DEFS_SVC_H__ */
Loading

0 comments on commit 1a4d8e1

Please sign in to comment.