Skip to contentSkip to conversation

be2net: fix to dynamically generate MAC Address for VFs

PATCH In review Ajit Khaparde 1 participant 1 message Aug 22, 2010

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

PATCH 4/6 be2net: fix to dynamically generate MAC Address for VFs

The BE ASIC/firmware doesnot reserve and assign MAC address for VFs. This results in the VF interfaces being created with MAC Address 0. The code change proposed takes the MAC address of PF to generate a seed. MAC Address for VFs are assigned incrementally starting from the seed. These addresses are programmed in the ASIC by the PF and the VF driver queries for the MAC address during its probe.

---
 drivers/net/benet/be.h      |   14 +++++++++++
 drivers/net/benet/be_main.c |   54 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 0 deletions(-)
drivers/net/benet/be.h +14 -0
index 53306bf..4faf696 100644
@@ -414,6 +414,20 @@ static inline void be_check_sriov_fn_type(struct be_adapter *adapter)
 	adapter->is_virtfn = (data != 0xAA);
 }
 
+static inline void be_vf_eth_addr_generate(struct be_adapter *adapter, u8 *mac)
+{
+	u32 addr;
+
+	addr = jhash(adapter->netdev->dev_addr, ETH_ALEN, 0);
+
+	mac[5] = (u8)(addr & 0xFF);
+	mac[4] = (u8)((addr >> 8) & 0xFF);
+	mac[3] = (u8)((addr >> 16) & 0xFF);
+	mac[2] = 0xC9;
+	mac[1] = 0x00;
+	mac[0] = 0x00;
+}
+
 extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
 		u16 num_popped);
 extern void be_link_status_update(struct be_adapter *adapter, bool link_up);
drivers/net/benet/be_main.c +54 -0

76 lines not on this page · raw message

Signature · 1 line
1.7.0.4