Skip to content

Commit

Permalink
be2net: Adding PCI SRIOV support
Browse files Browse the repository at this point in the history
- 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: Sarveshwar Bandi <sarveshwarb@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sarveshwar Bandi authored and David S. Miller committed Apr 2, 2010
1 parent f64e969 commit ba343c7
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 49 deletions.
9 changes: 9 additions & 0 deletions drivers/net/benet/be.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ static inline char *nic_name(struct pci_dev *pdev)

#define FW_VER_LEN 32

#define BE_MAX_VF 32

struct be_dma_mem {
void *va;
dma_addr_t dma;
Expand Down Expand Up @@ -280,8 +282,15 @@ struct be_adapter {
u8 port_type;
u8 transceiver;
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 */
#define BE_GEN2 2
#define BE_GEN3 3
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,8 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
* Uses mbox
*/
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_cmd_req_if_create *req;
Expand All @@ -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,
OPCODE_COMMON_NTWK_INTERFACE_CREATE, sizeof(*req));

req->hdr.domain = domain;
req->capability_flags = cpu_to_le32(cap_flags);
req->enable_flags = cpu_to_le32(en_flags);
req->pmac_invalid = pmac_invalid;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/benet/be_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_if_create(struct be_adapter *adapter, u32 cap_flags,
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_eq_create(struct be_adapter *adapter,
struct be_queue_info *eq, int eq_delay);
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/benet/be_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
/* Number of entries posted */
#define DB_MCCQ_NUM_POSTED_SHIFT (16) /* bits 16 - 29 */

/********** SRIOV VF PCICFG OFFSET ********/
#define SRIOV_VF_PCICFG_OFFSET (4096)

/* Flashrom related descriptors */
#define IMAGE_TYPE_FIRMWARE 160
#define IMAGE_TYPE_BOOTCODE 224
Expand Down
Loading

0 comments on commit ba343c7

Please sign in to comment.