Skip to contentSkip to conversation

Intel Wired LAN Driver Updates 2020-11-10

GIT PULL New Tony Nguyen 3 participants 9 messages Nov 11, 2020 – Nov 12, 2020

Subsystems (3)
lore
Share & tools
lore

Tony Nguyen

author maintainer
#0 lore raw

This series contains updates to i40e and igc drivers and the MAINTAINERS file.

Slawomir fixes updating VF MAC addresses to fix various issues related to reporting and setting of these addresses for i40e.

Dan Carpenter fixes a possible used before being initialized issue for i40e.

Vinicius fixes reporting of netdev stats for igc.

Tony updates repositories for Intel Ethernet Drivers.

The following are changes since commit 989ef49bdf100cc772b3a8737089df36b1ab1e30:
mptcp: provide rmem[0] limit
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE

Dan Carpenter (1):
i40e, xsk: uninitialized variable in i40e_clean_rx_irq_zc()

Slawomir Laba (1):
i40e: Fix MAC address setting for a VF via Host/VM

Tony Nguyen (1):
MAINTAINERS: Update repositories for Intel Ethernet Drivers

Vinicius Costa Gomes (1):
igc: Fix returning wrong statistics

 MAINTAINERS                                   |  4 +--
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 26 +++++++++++++++++--
 drivers/net/ethernet/intel/i40e/i40e_xsk.c    |  2 +-
 drivers/net/ethernet/intel/igc/igc_main.c     | 14 +++++-----
 4 files changed, 35 insertions(+), 11 deletions(-)
Signature · 1 line
2.26.2
author maintainer
#1 lore raw

PATCH 1/4 i40e: Fix MAC address setting for a VF via Host/VM

From: Slawomir Laba <[email protected]>

Fix MAC setting flow for the PF driver.

Update the unicast VF's MAC address in VF structure if it is a new setting in i40e_vc_add_mac_addr_msg.

When unicast MAC address gets deleted, record that and
set the new unicast MAC address that is already waiting in the filter list. This logic is based on the order of messages arriving to the PF driver.

Without this change the MAC address setting was interpreted incorrectly in the following use cases:
1) Print incorrect VF MAC or zero MAC
ip link show dev $pf
2) Don't preserve MAC between driver reload
rmmod iavf; modprobe iavf
3) Update VF MAC when macvlan was set
ip link add link $vf address $mac $vf.1 type macvlan
4) Failed to update mac address when VF was trusted ip link set dev $vf address $mac

This includes all other configurations including above commands.

Fixes f657a6e1313b ("i40e: Fix VF driver MAC address configuration")
---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 26 +++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +24 -2
index c96e2f2d4cba..4919d22d7b6b 100644
@@ -2713,6 +2713,10 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
 				spin_unlock_bh(&vsi->mac_filter_hash_lock);
 				goto error_param;
 			}
+			if (is_valid_ether_addr(al->list[i].addr) &&
+			    is_zero_ether_addr(vf->default_lan_addr.addr))
+				ether_addr_copy(vf->default_lan_addr.addr,
+						al->list[i].addr);
 		}
 	}
 	spin_unlock_bh(&vsi->mac_filter_hash_lock);
@@ -2740,6 +2744,7 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
 {
 	struct virtchnl_ether_addr_list *al =
 	    (struct virtchnl_ether_addr_list *)msg;
+	bool was_unimac_deleted = false;
 	struct i40e_pf *pf = vf->pf;
 	struct i40e_vsi *vsi = NULL;
 	i40e_status ret = 0;
@@ -2759,6 +2764,8 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
 			ret = I40E_ERR_INVALID_MAC_ADDR;
 			goto error_param;
 		}
+		if (ether_addr_equal(al->list[i].addr, vf->default_lan_addr.addr))
+			was_unimac_deleted = true;
 	}
 	vsi = pf->vsi[vf->lan_vsi_idx];
 
@@ -2779,10 +2786,25 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
 		dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters, error %d\n",
 			vf->vf_id, ret);
 
+	if (vf->trusted && was_unimac_deleted) {
+		struct i40e_mac_filter *f;
+		struct hlist_node *h;
+		u8 *macaddr = NULL;
+		int bkt;
+
+		/* set last unicast mac address as default */
+		spin_lock_bh(&vsi->mac_filter_hash_lock);
+		hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
+			if (is_valid_ether_addr(f->macaddr))
+				macaddr = f->macaddr;
+		}
+		if (macaddr)
+			ether_addr_copy(vf->default_lan_addr.addr, macaddr);
+		spin_unlock_bh(&vsi->mac_filter_hash_lock);
+	}
 error_param:
 	/* send the response to the VF */
-	return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DEL_ETH_ADDR,
-				       ret);
+	return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DEL_ETH_ADDR, ret);
 }
 
 /**
Signature · 1 line
2.26.2
author maintainer
#2 lore raw

PATCH 2/4 i40e, xsk: uninitialized variable in i40e_clean_rx_irq_zc()

In reply to Tony Nguyen

From: Dan Carpenter <[email protected]>

The "failure" variable is used without being initialized. It should be set to false.

Fixes 8cbf74149903 ("i40e, xsk: move buffer allocation out of the Rx processing loop")
---
 drivers/net/ethernet/intel/i40e/i40e_xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_xsk.c +1 -1
index 6acede0acdca..567fd67e900e 100644
@@ -281,8 +281,8 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
 	unsigned int total_rx_bytes = 0, total_rx_packets = 0;
 	u16 cleaned_count = I40E_DESC_UNUSED(rx_ring);
 	unsigned int xdp_res, xdp_xmit = 0;
+	bool failure = false;
 	struct sk_buff *skb;
-	bool failure;
 
 	while (likely(total_rx_packets < (unsigned int)budget)) {
 		union i40e_rx_desc *rx_desc;
Signature · 1 line
2.26.2
author maintainer
#3 lore raw

PATCH 3/4 igc: Fix returning wrong statistics

In reply to Tony Nguyen

From: Vinicius Costa Gomes <[email protected]>

'igc_update_stats()' was not updating 'netdev->stats', so the returned statistics, for example, requested by:

$ ip -s link show dev enp3s0

were not being updated and were always zero.

Fix by returning a set of statistics that are actually being updated (adapter->stats64).

Fixes c9a11c23ceb6 ("igc: Add netdev")
---
 drivers/net/ethernet/intel/igc/igc_main.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +8 -6
index 9112dff075cf..b673ac1199bb 100644
@@ -3891,21 +3891,23 @@ static int igc_change_mtu(struct net_device *netdev, int new_mtu)
 }
 
 /**
- * igc_get_stats - Get System Network Statistics
+ * igc_get_stats64 - Get System Network Statistics
  * @netdev: network interface device structure
+ * @stats: rtnl_link_stats64 pointer
  *
  * Returns the address of the device statistics structure.
  * The statistics are updated here and also from the timer callback.
  */
-static struct net_device_stats *igc_get_stats(struct net_device *netdev)
+static void igc_get_stats64(struct net_device *netdev,
+			    struct rtnl_link_stats64 *stats)
 {
 	struct igc_adapter *adapter = netdev_priv(netdev);
 
+	spin_lock(&adapter->stats64_lock);
 	if (!test_bit(__IGC_RESETTING, &adapter->state))
 		igc_update_stats(adapter);
-
-	/* only return the current stats */
-	return &netdev->stats;
+	memcpy(stats, &adapter->stats64, sizeof(*stats));
+	spin_unlock(&adapter->stats64_lock);
 }
 
 static netdev_features_t igc_fix_features(struct net_device *netdev,
@@ -4855,7 +4857,7 @@ static const struct net_device_ops igc_netdev_ops = {
 	.ndo_set_rx_mode	= igc_set_rx_mode,
 	.ndo_set_mac_address	= igc_set_mac,
 	.ndo_change_mtu		= igc_change_mtu,
-	.ndo_get_stats		= igc_get_stats,
+	.ndo_get_stats64	= igc_get_stats64,
 	.ndo_fix_features	= igc_fix_features,
 	.ndo_set_features	= igc_set_features,
 	.ndo_features_check	= igc_features_check,
Signature · 1 line
2.26.2
author maintainer
#4 lore raw

PATCH 4/4 MAINTAINERS: Update repositories for Intel Ethernet Drivers

In reply to Tony Nguyen

Update Intel Ethernet Drivers repositories to new locations.

---
 MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
index cd123d0a6a2d..9e826b55fcd9 100644
@@ -8829,8 +8829,8 @@ S:	Supported
 W:	http://www.intel.com/support/feedback.htm
 W:	http://e1000.sourceforge.net/
 Q:	http://patchwork.ozlabs.org/project/intel-wired-lan/list/
-T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue.git
-T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue.git
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git
 F:	Documentation/networking/device_drivers/ethernet/intel/
 F:	drivers/net/ethernet/intel/
 F:	drivers/net/ethernet/intel/*/
Signature · 1 line
2.26.2
maintainer
#5 lore raw
In reply to Tony Nguyen
Quoted 6 lines · On Tue, 10 Nov 2020 16:19:51 -0800 Tony Nguyen wrote:

This series contains updates to i40e and igc drivers and the MAINTAINERS file.

Slawomir fixes updating VF MAC addresses to fix various issues related to reporting and setting of these addresses for i40e.

Quoted 6 lines

Dan Carpenter fixes a possible used before being initialized issue for i40e.

Vinicius fixes reporting of netdev stats for igc.

Tony updates repositories for Intel Ethernet Drivers.

Pulled, thanks!

Please double check the use of the spin lock in patch 3. Stats are updated in an atomic context when read from /proc, you probably need to convert that spin lock to _bh.

author maintainer
#6 lore raw
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Tue, 10 Nov 2020 16:19:51 -0800 Tony Nguyen wrote:

This series contains updates to i40e and igc drivers and the MAINTAINERS
file.

Slawomir fixes updating VF MAC addresses to fix various issues related
to reporting and setting of these addresses for i40e.

Dan Carpenter fixes a possible used before being initialized issue for
i40e.

Vinicius fixes reporting of netdev stats for igc.

Quoted 7 lines
Quoted 1 line

Tony updates repositories for Intel Ethernet Drivers.

Pulled, thanks!

Please double check the use of the spin lock in patch 3. Stats are updated in an atomic context when read from /proc, you probably need to convert that spin lock to _bh.

Thanks Jakub. I'll look into it.

#7 lore raw
In reply to Jakub Kicinski
Quoted 6 lines · Jakub Kicinski

Pulled, thanks!

Please double check the use of the spin lock in patch 3. Stats are updated in an atomic context when read from /proc, you probably need to convert that spin lock to _bh.

I just did some tests with lockdep enabled, reading from /proc/net/dev in a loop, and everything seems fine. Am I missing something?

Cheers,

Signature · 1 line
Vinicius
maintainer
#8 lore raw
Quoted 10 lines · On Thu, 12 Nov 2020 11:55:24 -0800 Vinicius Costa Gomes wrote:
Quoted 6 lines · Jakub Kicinski

Pulled, thanks!

Please double check the use of the spin lock in patch 3. Stats are updated in an atomic context when read from /proc, you probably need to convert that spin lock to _bh.

I just did some tests with lockdep enabled, reading from /proc/net/dev in a loop, and everything seems fine. Am I missing something?

Indeed /proc only takes the RCU lock so you should be fine, thanks for checking.