Skip to contentSkip to conversation

be2net: Adding PCI SRIOV support

PATCH Applied Sarveshwar Bandi 2 participants 2 messages Mar 31, 2010 – Apr 2, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/net/benet/be.h      |    9 ++
 drivers/net/benet/be_cmds.c |    4 +
 drivers/net/benet/be_cmds.h |    2 
 drivers/net/benet/be_hw.h   |    3 +
 drivers/net/benet/be_main.c |  222 ++++++++++++++++++++++++++++++++++---------
 5 files changed, 191 insertions(+), 49 deletions(-)
drivers/net/benet/be.h +9 -0
index 8f07525..20842c5 100644
@@ -83,6 +83,8 @@ #define RX_FRAGS_REFILL_WM	(RX_Q_LEN - M
 
 #define FW_VER_LEN		32
 
+#define BE_MAX_VF		32
+
 struct be_dma_mem {
 	void *va;
 	dma_addr_t dma;
@@ -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
drivers/net/benet/be_cmds.c +3 -1
index 50e6259..9f53d9e 100644
@@ -843,7 +843,8 @@ int be_cmd_q_destroy(struct be_adapter *
  * 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;
@@ -860,6 +861,7 @@ int be_cmd_if_create(struct be_adapter *
 	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;
drivers/net/benet/be_cmds.h +1 -1
index cce61f9..763dc19 100644
@@ -878,7 +878,7 @@ extern int be_cmd_pmac_add(struct be_ada
 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);
drivers/net/benet/be_hw.h +3 -0
index 2d4a4b8..063026d 100644
@@ -99,6 +99,9 @@ #define DB_MCCQ_RING_ID_MASK		0x7FF	/* b
 /* 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
drivers/net/benet/be_main.c +175 -47

387 lines not on this page · raw message

Signature · 1 line
1.4.0
maintainer Applied
#1 lore raw

From: Sarveshwar Bandi <[email protected]>
Date: Wed, 31 Mar 2010 18:26:12 +0530

Quoted 4 lines

- 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.

Applied, thanks.