Commit ba343c77 authored by Sarveshwar Bandi's avatar Sarveshwar Bandi Committed by David S. Miller

be2net: Adding PCI SRIOV support

- Patch adds support to enable PCI SRIOV in the driver and changes to handle initialization of PCI virtual functions.
- Function handler to change mac addresses for VF from its corresponding PF.
Signed-off-by: default avatarSarveshwar Bandi <sarveshwarb@serverengines.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f64e9697
...@@ -83,6 +83,8 @@ static inline char *nic_name(struct pci_dev *pdev) ...@@ -83,6 +83,8 @@ static inline char *nic_name(struct pci_dev *pdev)
#define FW_VER_LEN 32 #define FW_VER_LEN 32
#define BE_MAX_VF 32
struct be_dma_mem { struct be_dma_mem {
void *va; void *va;
dma_addr_t dma; dma_addr_t dma;
...@@ -280,8 +282,15 @@ struct be_adapter { ...@@ -280,8 +282,15 @@ struct be_adapter {
u8 port_type; u8 port_type;
u8 transceiver; u8 transceiver;
u8 generation; /* BladeEngine ASIC generation */ u8 generation; /* BladeEngine ASIC generation */
bool sriov_enabled;
u32 vf_if_handle[BE_MAX_VF];
u32 vf_pmac_id[BE_MAX_VF];
u8 base_eq_id;
}; };
#define be_physfn(adapter) (!adapter->pdev->is_virtfn)
/* BladeEngine Generation numbers */ /* BladeEngine Generation numbers */
#define BE_GEN2 2 #define BE_GEN2 2
#define BE_GEN3 3 #define BE_GEN3 3
......
...@@ -843,7 +843,8 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, ...@@ -843,7 +843,8 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
* Uses mbox * Uses mbox
*/ */
int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
u8 *mac, bool pmac_invalid, u32 *if_handle, u32 *pmac_id) u8 *mac, bool pmac_invalid, u32 *if_handle, u32 *pmac_id,
u32 domain)
{ {
struct be_mcc_wrb *wrb; struct be_mcc_wrb *wrb;
struct be_cmd_req_if_create *req; struct be_cmd_req_if_create *req;
...@@ -860,6 +861,7 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, ...@@ -860,6 +861,7 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_NTWK_INTERFACE_CREATE, sizeof(*req)); OPCODE_COMMON_NTWK_INTERFACE_CREATE, sizeof(*req));
req->hdr.domain = domain;
req->capability_flags = cpu_to_le32(cap_flags); req->capability_flags = cpu_to_le32(cap_flags);
req->enable_flags = cpu_to_le32(en_flags); req->enable_flags = cpu_to_le32(en_flags);
req->pmac_invalid = pmac_invalid; req->pmac_invalid = pmac_invalid;
......
...@@ -878,7 +878,7 @@ extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, ...@@ -878,7 +878,7 @@ extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id); extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id);
extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags,
u32 en_flags, u8 *mac, bool pmac_invalid, u32 en_flags, u8 *mac, bool pmac_invalid,
u32 *if_handle, u32 *pmac_id); u32 *if_handle, u32 *pmac_id, u32 domain);
extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle); extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle);
extern int be_cmd_eq_create(struct be_adapter *adapter, extern int be_cmd_eq_create(struct be_adapter *adapter,
struct be_queue_info *eq, int eq_delay); struct be_queue_info *eq, int eq_delay);
......
...@@ -99,6 +99,9 @@ ...@@ -99,6 +99,9 @@
/* Number of entries posted */ /* Number of entries posted */
#define DB_MCCQ_NUM_POSTED_SHIFT (16) /* bits 16 - 29 */ #define DB_MCCQ_NUM_POSTED_SHIFT (16) /* bits 16 - 29 */
/********** SRIOV VF PCICFG OFFSET ********/
#define SRIOV_VF_PCICFG_OFFSET (4096)
/* Flashrom related descriptors */ /* Flashrom related descriptors */
#define IMAGE_TYPE_FIRMWARE 160 #define IMAGE_TYPE_FIRMWARE 160
#define IMAGE_TYPE_BOOTCODE 224 #define IMAGE_TYPE_BOOTCODE 224
......
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