Skip to contentSkip to conversation

ixgbe: Add boolean parameter to ixgbe_set_vmolr

PATCH Applied Jeff Kirsher 2 participants 4 messages May 5, 2010 – May 6, 2010

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

PATCH 1/2 ixgbe: Add boolean parameter to ixgbe_set_vmolr

From: Greg Rose <[email protected]>

Add a boolean parameter to ixgbe-set_vmolr so that the caller can specify whether the pool should accept untagged packets. Required for a follow on patch to enable administrative configuration of port VLAN for virtual functions.

---

 drivers/net/ixgbe/ixgbe_main.c  |    2 +-
 drivers/net/ixgbe/ixgbe_sriov.c |   11 +++++++----
 drivers/net/ixgbe/ixgbe_sriov.h |    2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +1 -1
index 2ae5a51..0a0e90e 100644
@@ -2722,7 +2722,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 		IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), (1 << vf_shift));
 		IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), (1 << vf_shift));
 		IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
-		ixgbe_set_vmolr(hw, adapter->num_vfs);
+		ixgbe_set_vmolr(hw, adapter->num_vfs, true);
 	}
 
 	/* Program MRQC for the distribution of queues */
drivers/net/ixgbe/ixgbe_sriov.c +7 -4
index d4cd20f..53f364d 100644
@@ -113,13 +113,16 @@ int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, u32 vf)
 }
 
 
-void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf)
+void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe)
 {
 	u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
-	vmolr |= (IXGBE_VMOLR_AUPE |
-		  IXGBE_VMOLR_ROMPE |
+	vmolr |= (IXGBE_VMOLR_ROMPE |
 		  IXGBE_VMOLR_ROPE |
 		  IXGBE_VMOLR_BAM);
+	if (aupe)
+		vmolr |= IXGBE_VMOLR_AUPE;
+	else
+		vmolr &= ~IXGBE_VMOLR_AUPE;
 	IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
 }
 
@@ -128,7 +131,7 @@ inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
 	struct ixgbe_hw *hw = &adapter->hw;
 
 	/* reset offloads to defaults */
-	ixgbe_set_vmolr(hw, vf);
+	ixgbe_set_vmolr(hw, vf, true);
 
 
 	/* reset multicast table array for vf */
drivers/net/ixgbe/ixgbe_sriov.h +1 -1
index 51d1106..7fb1288 100644
@@ -32,7 +32,7 @@ int ixgbe_set_vf_multicasts(struct ixgbe_adapter *adapter,
                             int entries, u16 *hash_list, u32 vf);
 void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter);
 int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, u32 vf);
-void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf);
+void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe);
 void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf);
 void ixgbe_vf_reset_msg(struct ixgbe_adapter *adapter, u32 vf);
 void ixgbe_msg_task(struct ixgbe_adapter *adapter);
#1 lore raw

PATCH 2/2 ixgbe: Add support for VF MAC and VLAN configuration

From: Greg Rose <[email protected]>

Add support for the "ip link set" and "ip link show" commands that allow configuration of the virtual functions' MAC and port VLAN via user space command line.

---

 drivers/net/ixgbe/ixgbe.h       |    3 +
 drivers/net/ixgbe/ixgbe_main.c  |    4 ++
 drivers/net/ixgbe/ixgbe_sriov.c |  104 ++++++++++++++++++++++++++++++++++++++-
 drivers/net/ixgbe/ixgbe_sriov.h |    6 ++
 drivers/net/ixgbe/ixgbe_type.h  |    5 ++
 5 files changed, 118 insertions(+), 4 deletions(-)
drivers/net/ixgbe/ixgbe.h +3 -0
index 79c35ae..d0ea3d6 100644
@@ -111,7 +111,10 @@ struct vf_data_storage {
 	u16 default_vf_vlan_id;
 	u16 vlans_enabled;
 	bool clear_to_send;
+	bool pf_set_mac;
 	int rar;
+	u16 pf_vlan; /* When set, guest VLAN config not allowed. */
+	u16 pf_qos;
 };
 
 /* wrapper around a pointer to a socket buffer,
drivers/net/ixgbe/ixgbe_main.c +4 -0
index 0a0e90e..d1a1868 100644
@@ -6311,6 +6311,10 @@ static const struct net_device_ops ixgbe_netdev_ops = {
 	.ndo_vlan_rx_add_vid	= ixgbe_vlan_rx_add_vid,
 	.ndo_vlan_rx_kill_vid	= ixgbe_vlan_rx_kill_vid,
 	.ndo_do_ioctl		= ixgbe_ioctl,
+	.ndo_set_vf_mac		= ixgbe_ndo_set_vf_mac,
+	.ndo_set_vf_vlan	= ixgbe_ndo_set_vf_vlan,
+	.ndo_set_vf_tx_rate	= ixgbe_ndo_set_vf_bw,
+	.ndo_get_vf_config	= ixgbe_ndo_get_vf_config,
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	.ndo_poll_controller	= ixgbe_netpoll,
 #endif
drivers/net/ixgbe/ixgbe_sriov.c +100 -4

126 lines not on this page · raw message

drivers/net/ixgbe/ixgbe_sriov.h +6 -0
index 7fb1288..184730e 100644
@@ -42,6 +42,12 @@ int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask);
 void ixgbe_disable_tx_rx(struct ixgbe_adapter *adapter);
 void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter);
 void ixgbe_dump_registers(struct ixgbe_adapter *adapter);
+int ixgbe_ndo_set_vf_mac(struct net_device *netdev, int queue, u8 *mac);
+int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int queue, u16 vlan,
+			   u8 qos);
+int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate);
+int ixgbe_ndo_get_vf_config(struct net_device *netdev,
+			    int vf, struct ifla_vf_info *ivi);
 
 #endif /* _IXGBE_SRIOV_H_ */
 
drivers/net/ixgbe/ixgbe_type.h +5 -0
index a0f9084..4277cbb 100644
@@ -219,6 +219,7 @@
 #define IXGBE_MTQC      0x08120
 #define IXGBE_VLVF(_i)  (0x0F100 + ((_i) * 4))  /* 64 of these (0-63) */
 #define IXGBE_VLVFB(_i) (0x0F200 + ((_i) * 4))  /* 128 of these (0-127) */
+#define IXGBE_VMVIR(_i) (0x08000 + ((_i) * 4))  /* 64 of these (0-63) */
 #define IXGBE_VT_CTL    0x051B0
 #define IXGBE_VFRE(_i)  (0x051E0 + ((_i) * 4))
 #define IXGBE_VFTE(_i)  (0x08110 + ((_i) * 4))
@@ -1311,6 +1312,10 @@
 #define IXGBE_VLVF_ENTRIES      64
 #define IXGBE_VLVF_VLANID_MASK  0x00000FFF
 
+/* Per VF Port VLAN insertion rules */
+#define IXGBE_VMVIR_VLANA_DEFAULT 0x40000000 /* Always use default VLAN */
+#define IXGBE_VMVIR_VLANA_NEVER   0x80000000 /* Never insert VLAN tag */
+
 #define IXGBE_ETHERNET_IEEE_VLAN_TYPE 0x8100  /* 802.1q protocol */
 
 /* STATUS Bit Masks */
maintainer Applied
#3 lore raw
In reply to Jeff Kirsher

From: Jeff Kirsher <[email protected]>
Date: Wed, 05 May 2010 01:11:46 -0700

Quoted 9 lines

From: Greg Rose <[email protected]>

Add a boolean parameter to ixgbe-set_vmolr so that the caller can specify whether the pool should accept untagged packets. Required for a follow on patch to enable administrative configuration of port VLAN for virtual functions.

Applied.

maintainer Applied
#2 lore raw

Re: [net-next-2.6 PATCH 2/2] ixgbe: Add support for VF MAC and VLAN configuration

In reply to Jeff Kirsher

From: Jeff Kirsher <[email protected]>
Date: Wed, 05 May 2010 01:12:06 -0700

Quoted 8 lines

From: Greg Rose <[email protected]>

Add support for the "ip link set" and "ip link show" commands that allow configuration of the virtual functions' MAC and port VLAN via user space command line.

Applied.