Skip to contentSkip to conversation

i40e/i40evf updates

PATCH New Catherine Sullivan 2 participants 3 messages Sep 30, 2015 – Oct 1, 2015

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

v2 cover i40e/i40evf updates

Catherine adds code that recognizes 1000Base_T_Optical phy type when link is up.

Greg B. adds support for non-willing Apps.

Greg R. removed unused defines.

Jesse adds code to moderate interrupts differently.

Jingjing fixes compile issue related to const string, and resets the invalid msg counter in vf when a valid msg is received.

Kiran adds a spinlock to synchronize access to the VSI's mac filter list.

Mitch correctly populates vlan_features, relaxs and staggers init timing a bit, and increases AQ work limit.

Shannon generates fewer startup messages, removes read/write failed messages from nvmupdate, adds priv flag for controlling VEB stats, and grabs the AQ spinlocks before clearing registers.

 drivers/net/ethernet/intel/i40e/i40e.h             |  8 ++--
 drivers/net/ethernet/intel/i40e/i40e_adminq.c      | 45 ++++++++++----------
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h  |  7 ++++
 drivers/net/ethernet/intel/i40e/i40e_common.c      |  4 +-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     | 49 ++++++++++++++++++----
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 34 +++++++++------
 drivers/net/ethernet/intel/i40e/i40e_nvm.c         |  2 +-
 drivers/net/ethernet/intel/i40e/i40e_prototype.h   |  4 +-
 drivers/net/ethernet/intel/i40e/i40e_ptp.c         |  4 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.h        | 10 +++++
 drivers/net/ethernet/intel/i40e/i40e_type.h        |  2 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  2 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |  5 +--
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c    | 45 ++++++++++----------
 drivers/net/ethernet/intel/i40evf/i40e_common.c    |  4 +-
 drivers/net/ethernet/intel/i40evf/i40e_prototype.h |  4 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h      | 10 +++++
 drivers/net/ethernet/intel/i40evf/i40evf.h         |  2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    | 11 +++--
 19 files changed, 166 insertions(+), 86 deletions(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH v2 7/15 i40e: Lock for VSI's MAC filter list

From: Kiran Patil <[email protected]>

This patch introduces a spinlock which is to be used for synchronizing access to VSI's MAC filter list.

This patch also synchronizes execution of other codepaths which are accessing VSI's MAC filter list with execution of service_task:sync_vsi_filters.

In function i40e_add_vsi, copied out LAA MAC address instead of cloning MAC filter entry because only MAC address is needed to remove MAC VLAN filter from FW/HW.

Change-ID I0e10ac7c715d44aa994239642aa4d57c998573a2

---
v2: Pull in patch 04/15 from S15 to squash the fix with the patch causing the problem.

 drivers/net/ethernet/intel/i40e/i40e.h             |   2 +
 drivers/net/ethernet/intel/i40e/i40e_fcoe.c        |   2 +
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 328 +++++++++++++++++----
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  26 +-
 4 files changed, 302 insertions(+), 56 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +2 -0
index a4440ce..446d6a8 100644
@@ -468,6 +468,8 @@ struct i40e_vsi {
 #define I40E_VSI_FLAG_VEB_OWNER		BIT(1)
 	unsigned long flags;
 
+	/* Per VSI lock to protect elements/list (MAC filter) */
+	spinlock_t mac_filter_list_lock;
 	struct list_head mac_filter_list;
 
 	/* VSI stats */
drivers/net/ethernet/intel/i40e/i40e_fcoe.c +2 -0
index 2ec2411..fe5d9bf 100644
@@ -1516,10 +1516,12 @@ void i40e_fcoe_config_netdev(struct net_device *netdev, struct i40e_vsi *vsi)
 	 * same PCI function.
 	 */
 	netdev->dev_port = 1;
+	spin_lock_bh(&vsi->mac_filter_list_lock);
 	i40e_add_filter(vsi, hw->mac.san_addr, 0, false, false);
 	i40e_add_filter(vsi, (u8[6]) FC_FCOE_FLOGI_MAC, 0, false, false);
 	i40e_add_filter(vsi, FIP_ALL_FCOE_MACS, 0, false, false);
 	i40e_add_filter(vsi, FIP_ALL_ENODE_MACS, 0, false, false);
+	spin_unlock_bh(&vsi->mac_filter_list_lock);
 
 	/* use san mac */
 	ether_addr_copy(netdev->dev_addr, hw->mac.san_addr);
drivers/net/ethernet/intel/i40e/i40e_main.c +273 -55

590 lines not on this page · raw message

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +25 -1
index 3f6126c..3ed8b98 100644
@@ -547,6 +547,8 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
 		 */
 		if (vf->port_vlan_id)
 			i40e_vsi_add_pvid(vsi, vf->port_vlan_id);
+
+		spin_lock_bh(&vsi->mac_filter_list_lock);
 		f = i40e_add_filter(vsi, vf->default_lan_addr.addr,
 				    vf->port_vlan_id ? vf->port_vlan_id : -1,
 				    true, false);
@@ -559,6 +561,7 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
 		if (!f)
 			dev_info(&pf->pdev->dev,
 				 "Could not allocate VF broadcast filter\n");
+		spin_unlock_bh(&vsi->mac_filter_list_lock);
 	}
 
 	/* program mac filter */
@@ -1596,6 +1599,11 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 	}
 	vsi = pf->vsi[vf->lan_vsi_idx];
 
+	/* Lock once, because all function inside for loop accesses VSI's
+	 * MAC filter list which needs to be protected using same lock.
+	 */
+	spin_lock_bh(&vsi->mac_filter_list_lock);
+
 	/* add new addresses to the list */
 	for (i = 0; i < al->num_elements; i++) {
 		struct i40e_mac_filter *f;
@@ -1614,9 +1622,11 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 			dev_err(&pf->pdev->dev,
 				"Unable to add VF MAC filter\n");
 			ret = I40E_ERR_PARAM;
+			spin_unlock_bh(&vsi->mac_filter_list_lock);
 			goto error_param;
 		}
 	}
+	spin_unlock_bh(&vsi->mac_filter_list_lock);
 
 	/* program the updated filter list */
 	if (i40e_sync_vsi_filters(vsi))
@@ -1664,10 +1674,12 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 	}
 	vsi = pf->vsi[vf->lan_vsi_idx];
 
+	spin_lock_bh(&vsi->mac_filter_list_lock);
 	/* delete addresses from the list */
 	for (i = 0; i < al->num_elements; i++)
 		i40e_del_filter(vsi, al->list[i].addr,
 				I40E_VLAN_ANY, true, false);
+	spin_unlock_bh(&vsi->mac_filter_list_lock);
 
 	/* program the updated filter list */
 	if (i40e_sync_vsi_filters(vsi))
@@ -2064,6 +2076,11 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 		goto error_param;
 	}
 
+	/* Lock once because below invoked function add/del_filter requires
+	 * mac_filter_list_lock to be held
+	 */
+	spin_lock_bh(&vsi->mac_filter_list_lock);
+
 	/* delete the temporary mac address */
 	i40e_del_filter(vsi, vf->default_lan_addr.addr,
 			vf->port_vlan_id ? vf->port_vlan_id : -1,
@@ -2075,6 +2092,8 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 	list_for_each_entry(f, &vsi->mac_filter_list, list)
 		i40e_del_filter(vsi, f->macaddr, f->vlan, true, false);
 
+	spin_unlock_bh(&vsi->mac_filter_list_lock);
+
 	dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", mac, vf_id);
 	/* program mac filter */
 	if (i40e_sync_vsi_filters(vsi)) {
@@ -2107,6 +2126,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
 	u16 vlanprio = vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT);
 	struct i40e_netdev_priv *np = netdev_priv(netdev);
 	struct i40e_pf *pf = np->vsi->back;
+	bool is_vsi_in_vlan = false;
 	struct i40e_vsi *vsi;
 	struct i40e_vf *vf;
 	int ret = 0;
@@ -2136,7 +2156,11 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
 		/* duplicate request, so just return success */
 		goto error_pvid;
 
-	if (le16_to_cpu(vsi->info.pvid) == 0 && i40e_is_vsi_in_vlan(vsi)) {
+	spin_lock_bh(&vsi->mac_filter_list_lock);
+	is_vsi_in_vlan = i40e_is_vsi_in_vlan(vsi);
+	spin_unlock_bh(&vsi->mac_filter_list_lock);
+
+	if (le16_to_cpu(vsi->info.pvid) == 0 && is_vsi_in_vlan) {
 		dev_err(&pf->pdev->dev,
 			"VF %d has already configured VLAN filters and the administrator is requesting a port VLAN override.\nPlease unload and reload the VF driver for this change to take effect.\n",
 			vf_id);
Signature · 1 line
1.9.3
#2 lore raw

PATCH v2 7/15 i40e: Lock for VSI's MAC filter list

Quoted 26 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, September 30, 2015 11:09 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S16 v2 07/15] i40e: Lock for VSI's MAC filter list

From: Kiran Patil <[email protected]>

This patch introduces a spinlock which is to be used for synchronizing access to VSI's MAC filter list.

This patch also synchronizes execution of other codepaths which are accessing VSI's MAC filter list with execution of service_task:sync_vsi_filters.

In function i40e_add_vsi, copied out LAA MAC address instead of cloning MAC filter entry because only MAC address is needed to remove MAC VLAN filter from FW/HW.

Change-ID I0e10ac7c715d44aa994239642aa4d57c998573a2

---
v2: Pull in patch 04/15 from S15 to squash the fix with the patch causing the problem.

Quoted 6 lines
 drivers/net/ethernet/intel/i40e/i40e.h             |   2 +
 drivers/net/ethernet/intel/i40e/i40e_fcoe.c        |   2 +
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 328
+++++++++++++++++----
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  26 +-
 4 files changed, 302 insertions(+), 56 deletions(-)

Code changes present in tree