Skip to contentSkip to conversation

i40evf: use netdev variable in reset task

PATCH New Alice Michael 3 participants 22 messages Jul 12, 2017 – Jul 19, 2017

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

PATCH 1/11 i40evf: use netdev variable in reset task

From: Alan Brady <[email protected]>

If we're going to bother initializing a variable to reference it we might as well use it.

---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +2 -2
index 77d2835..ef55f71 100644
@@ -1879,7 +1879,7 @@ static void i40evf_reset_task(struct work_struct *work)
 	}
 
 continue_reset:
-	if (netif_running(adapter->netdev)) {
+	if (netif_running(netdev)) {
 		netif_carrier_off(netdev);
 		netif_tx_stop_all_queues(netdev);
 		adapter->link_up = false;
@@ -1947,7 +1947,7 @@ static void i40evf_reset_task(struct work_struct *work)
 	return;
 reset_err:
 	dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n");
-	i40evf_close(adapter->netdev);
+	i40evf_close(netdev);
 }
 
 /**
Signature · 1 line
2.9.3
#1 lore raw

PATCH 2/11 i40e: use cpumask_copy instead of direct assignment

From: Jacob Keller <[email protected]>

According to the header file cpumask.h, we shouldn't be directly copying a cpumask_t, since its a bitmap and might not be copied correctly. Lets use the provided cpumask_copy() function instead.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c     | 2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index 998ad96..837d434 100644
@@ -3450,7 +3450,7 @@ static void i40e_irq_affinity_notify(struct irq_affinity_notify *notify,
 	struct i40e_q_vector *q_vector =
 		container_of(notify, struct i40e_q_vector, affinity_notify);
 
-	q_vector->affinity_mask = *mask;
+	cpumask_copy(&q_vector->affinity_mask, mask);
 }
 
 /**
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -1
index ef55f71..755f60f 100644
@@ -520,7 +520,7 @@ static void i40evf_irq_affinity_notify(struct irq_affinity_notify *notify,
 	struct i40e_q_vector *q_vector =
 		container_of(notify, struct i40e_q_vector, affinity_notify);
 
-	q_vector->affinity_mask = *mask;
+	cpumask_copy(&q_vector->affinity_mask, mask);
 }
 
 /**
Signature · 1 line
2.9.3
#2 lore raw

PATCH 2/11 i40e: use cpumask_copy instead of direct assignment

Quoted 15 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, July 12, 2017 2:46 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S75-V3 02/11] i40e: use cpumask_copy instead of direct assignment

From: Jacob Keller <[email protected]>

According to the header file cpumask.h, we shouldn't be directly copying a cpumask_t, since its a bitmap and might not be copied correctly. Lets use the provided cpumask_copy() function instead.

Quoted 5 lines
---
 drivers/net/ethernet/intel/i40e/i40e_main.c     | 2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
#3 lore raw

PATCH 3/11 i40e: prevent changing ITR if adaptive-rx/tx enabled

In reply to Alice Michael

From: Alan Brady <[email protected]>

Currently the driver allows the user to change (or even disable) interrupt moderation if adaptive-rx/tx is enabled when this should not be the case.

Adaptive RX/TX will not respect the user's ITR settings so allowing the user to change it is weird. This bug would also allow the user to disable interrupt moderation with adaptive-rx/tx enabled which doesn't make much sense either.

This patch makes it such that if adaptive-rx/tx is enabled, the user cannot make any manual adjustments to interrupt moderation. It also makes it so that if ITR is disabled but adaptive-rx/tx is then enabled, ITR will be re-enabled.

---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 61 +++++++++++++++++---------
 1 file changed, 41 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +41 -20
index a868c8d..b273c24 100644
@@ -2194,14 +2194,29 @@ static int __i40e_set_coalesce(struct net_device *netdev,
 			       int queue)
 {
 	struct i40e_netdev_priv *np = netdev_priv(netdev);
+	u16 intrl_reg, cur_rx_itr, cur_tx_itr;
 	struct i40e_vsi *vsi = np->vsi;
 	struct i40e_pf *pf = vsi->back;
-	u16 intrl_reg;
 	int i;
 
 	if (ec->tx_max_coalesced_frames_irq || ec->rx_max_coalesced_frames_irq)
 		vsi->work_limit = ec->tx_max_coalesced_frames_irq;
 
+	if (queue < 0) {
+		cur_rx_itr = vsi->rx_rings[0]->rx_itr_setting;
+		cur_tx_itr = vsi->tx_rings[0]->tx_itr_setting;
+	} else if (queue < vsi->num_queue_pairs) {
+		cur_rx_itr = vsi->rx_rings[queue]->rx_itr_setting;
+		cur_tx_itr = vsi->tx_rings[queue]->tx_itr_setting;
+	} else {
+		netif_info(pf, drv, netdev, "Invalid queue value, queue range is 0 - %d\n",
+			   vsi->num_queue_pairs - 1);
+		return -EINVAL;
+	}
+
+	cur_tx_itr &= ~I40E_ITR_DYNAMIC;
+	cur_rx_itr &= ~I40E_ITR_DYNAMIC;
+
 	/* tx_coalesce_usecs_high is ignored, use rx-usecs-high instead */
 	if (ec->tx_coalesce_usecs_high != vsi->int_rate_limit) {
 		netif_info(pf, drv, netdev, "tx-usecs-high is not used, please program rx-usecs-high\n");
@@ -2214,15 +2229,34 @@ static int __i40e_set_coalesce(struct net_device *netdev,
 		return -EINVAL;
 	}
 
-	if (ec->rx_coalesce_usecs == 0) {
-		if (ec->use_adaptive_rx_coalesce)
-			netif_info(pf, drv, netdev, "rx-usecs=0, need to disable adaptive-rx for a complete disable\n");
-	} else if ((ec->rx_coalesce_usecs < (I40E_MIN_ITR << 1)) ||
-		   (ec->rx_coalesce_usecs > (I40E_MAX_ITR << 1))) {
+	if (ec->rx_coalesce_usecs != cur_rx_itr &&
+	    ec->use_adaptive_rx_coalesce) {
+		netif_info(pf, drv, netdev, "RX interrupt moderation cannot be changed if adaptive-rx is enabled.\n");
+		return -EINVAL;
+	}
+
+	if (ec->rx_coalesce_usecs > (I40E_MAX_ITR << 1)) {
 			netif_info(pf, drv, netdev, "Invalid value, rx-usecs range is 0-8160\n");
 			return -EINVAL;
 	}
 
+	if (ec->tx_coalesce_usecs != cur_tx_itr &&
+	    ec->use_adaptive_tx_coalesce) {
+		netif_info(pf, drv, netdev, "TX interrupt moderation cannot be changed if adaptive-tx is enabled.\n");
+		return -EINVAL;
+	}
+
+	if (ec->tx_coalesce_usecs > (I40E_MAX_ITR << 1)) {
+		netif_info(pf, drv, netdev, "Invalid value, tx-usecs range is 0-8160\n");
+		return -EINVAL;
+	}
+
+	if (ec->use_adaptive_rx_coalesce && !cur_rx_itr)
+		ec->rx_coalesce_usecs = I40E_MIN_ITR << 1;
+
+	if (ec->use_adaptive_tx_coalesce && !cur_tx_itr)
+		ec->tx_coalesce_usecs = I40E_MIN_ITR << 1;
+
 	intrl_reg = i40e_intrl_usec_to_reg(ec->rx_coalesce_usecs_high);
 	vsi->int_rate_limit = INTRL_REG_TO_USEC(intrl_reg);
 	if (vsi->int_rate_limit != ec->rx_coalesce_usecs_high) {
@@ -2230,27 +2264,14 @@ static int __i40e_set_coalesce(struct net_device *netdev,
 			   vsi->int_rate_limit);
 	}
 
-	if (ec->tx_coalesce_usecs == 0) {
-		if (ec->use_adaptive_tx_coalesce)
-			netif_info(pf, drv, netdev, "tx-usecs=0, need to disable adaptive-tx for a complete disable\n");
-	} else if ((ec->tx_coalesce_usecs < (I40E_MIN_ITR << 1)) ||
-		   (ec->tx_coalesce_usecs > (I40E_MAX_ITR << 1))) {
-			netif_info(pf, drv, netdev, "Invalid value, tx-usecs range is 0-8160\n");
-			return -EINVAL;
-	}
-
 	/* rx and tx usecs has per queue value. If user doesn't specify the queue,
 	 * apply to all queues.
 	 */
 	if (queue < 0) {
 		for (i = 0; i < vsi->num_queue_pairs; i++)
 			i40e_set_itr_per_queue(vsi, ec, i);
-	} else if (queue < vsi->num_queue_pairs) {
-		i40e_set_itr_per_queue(vsi, ec, queue);
 	} else {
-		netif_info(pf, drv, netdev, "Invalid queue value, queue range is 0 - %d\n",
-			   vsi->num_queue_pairs - 1);
-		return -EINVAL;
+		i40e_set_itr_per_queue(vsi, ec, queue);
 	}
 
 	return 0;
Signature · 1 line
2.9.3
#4 lore raw

PATCH 3/11 i40e: prevent changing ITR if adaptive-rx/tx enabled

Quoted 24 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, July 12, 2017 2:46 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S75-V3 03/11] i40e: prevent changing ITR if adaptive-rx/tx enabled

From: Alan Brady <[email protected]>

Currently the driver allows the user to change (or even disable) interrupt moderation if adaptive-rx/tx is enabled when this should not be the case.

Adaptive RX/TX will not respect the user's ITR settings so allowing the user to change it is weird. This bug would also allow the user to disable interrupt moderation with adaptive-rx/tx enabled which doesn't make much sense either.

This patch makes it such that if adaptive-rx/tx is enabled, the user cannot make any manual adjustments to interrupt moderation. It also makes it so that if ITR is disabled but adaptive-rx/tx is then enabled, ITR will be re- enabled.

Quoted 5 lines
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 61 +++++++++++++++++--
-------
 1 file changed, 41 insertions(+), 20 deletions(-)
#5 lore raw

PATCH 4/11 i40e: synchronize nvmupdate command and adminq subtask

In reply to Alice Michael

From: Sudheer Mogilappagari <[email protected]>

During NVM update, state machine gets into unrecoverable state because i40e_clean_adminq_subtask can get scheduled after the admin queue command but before other state variables are updated. This causes incorrect input to i40e_nvmupd_check_wait_event and state transitions don't happen.

This issue existed before but surfaced after commit 373149fc99a0 ("i40e: Decrease the scope of rtnl lock")

This fix adds locking around admin queue command and update of state variables so that adminq_subtask will have accurate information whenever it gets scheduled.

---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_nvm.c +6 -0
index 17607a2..04f2192 100644
@@ -753,6 +753,11 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,
 		hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
 	}
 
+	/* Acquire lock to prevent race condition where adminq_task
+	 * can execute after i40e_nvmupd_nvm_read/write but before state
+	 * variables (nvm_wait_opcode, nvm_release_on_done) are updated
+	 */
+	mutex_lock(&hw->aq.arq_mutex);
 	switch (hw->nvmupd_state) {
 	case I40E_NVMUPD_STATE_INIT:
 		status = i40e_nvmupd_state_init(hw, cmd, bytes, perrno);
@@ -788,6 +793,7 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,
 		*perrno = -ESRCH;
 		break;
 	}
+	mutex_unlock(&hw->aq.arq_mutex);
 	return status;
 }
 
Signature · 1 line
2.9.3
#6 lore raw

PATCH 5/11 i40e: Store the requested FEC information

In reply to Alice Michael

From: Mariusz Stachura <[email protected]>

Store information about FEC modes, that were requested. It will be used in printing link status information function and this way there is no need to call admin queue there.

---
 drivers/net/ethernet/intel/i40e/i40e_common.c | 4 ++++
 drivers/net/ethernet/intel/i40e/i40e_type.h   | 1 +
 drivers/net/ethernet/intel/i40evf/i40e_type.h | 1 +
 3 files changed, 6 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_common.c +4 -0
index 8e082a9..5c36a18 100644
@@ -2529,6 +2529,10 @@ i40e_status i40e_update_link_info(struct i40e_hw *hw)
 		if (status)
 			return status;
 
+		hw->phy.link_info.req_fec_info =
+			abilities.fec_cfg_curr_mod_ext_info &
+			(I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS);
+
 		memcpy(hw->phy.link_info.module_type, &abilities.module_type,
 		       sizeof(hw->phy.link_info.module_type));
 	}
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -0
index 3a18ed1..fd4bbdd 100644
@@ -185,6 +185,7 @@ struct i40e_link_status {
 	enum i40e_aq_link_speed link_speed;
 	u8 link_info;
 	u8 an_info;
+	u8 req_fec_info;
 	u8 fec_info;
 	u8 ext_info;
 	u8 loopback;
drivers/net/ethernet/intel/i40evf/i40e_type.h +1 -0
index bde7f24..2ea919d 100644
@@ -159,6 +159,7 @@ struct i40e_link_status {
 	enum i40e_aq_link_speed link_speed;
 	u8 link_info;
 	u8 an_info;
+	u8 req_fec_info;
 	u8 fec_info;
 	u8 ext_info;
 	u8 loopback;
Signature · 1 line
2.9.3
#7 lore raw

PATCH 5/11 i40e: Store the requested FEC information

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, July 12, 2017 2:46 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Stachura, Mariusz <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S75-V3 05/11] i40e: Store the requested FEC information

From: Mariusz Stachura <[email protected]>

Store information about FEC modes, that were requested. It will be used in printing link status information function and this way there is no need to call admin queue there.

Quoted 6 lines
---
 drivers/net/ethernet/intel/i40e/i40e_common.c | 4 ++++
 drivers/net/ethernet/intel/i40e/i40e_type.h   | 1 +
 drivers/net/ethernet/intel/i40evf/i40e_type.h | 1 +
 3 files changed, 6 insertions(+)
#8 lore raw

PATCH 6/11 i40e: prevent snprintf format specifier truncation

In reply to Alice Michael

From: Jacob Keller <[email protected]>

Increase the size of the prefix buffer so that it can hold enough characters for every possible input. Although 20 is enough for all expected inputs, it is possible for the values to be larger than expected, resulting in a possibly truncated string. Additionally, lets use sizeof(prefix) in order to ensure we use the correct size if we need to change the array length in the future.

New versions of GCC starting at 7 now include warnings to prevent truncation unless you handle the return code. At most 27 bytes can be written here, so lets just increase the buffer size even if for all expected hw->bus.* values we only needed 20.

---
 drivers/net/ethernet/intel/i40e/i40e_common.c   | 4 ++--
 drivers/net/ethernet/intel/i40evf/i40e_common.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +2 -2
index 5c36a18..111426b 100644
@@ -328,9 +328,9 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
 			len = buf_len;
 		/* write the full 16-byte chunks */
 		if (hw->debug_mask & mask) {
-			char prefix[20];
+			char prefix[27];
 
-			snprintf(prefix, 20,
+			snprintf(prefix, sizeof(prefix),
 				 "i40e %02x:%02x.%x: \t0x",
 				 hw->bus.bus_id,
 				 hw->bus.device,
drivers/net/ethernet/intel/i40evf/i40e_common.c +2 -2
index 1dd1938..bfe9b516 100644
@@ -333,9 +333,9 @@ void i40evf_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
 			len = buf_len;
 		/* write the full 16-byte chunks */
 		if (hw->debug_mask & mask) {
-			char prefix[20];
+			char prefix[27];
 
-			snprintf(prefix, 20,
+			snprintf(prefix, sizeof(prefix),
 				 "i40evf %02x:%02x.%x: \t0x",
 				 hw->bus.bus_id,
 				 hw->bus.device,
Signature · 1 line
2.9.3
#9 lore raw

PATCH 6/11 i40e: prevent snprintf format specifier truncation

Quoted 20 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, July 12, 2017 2:46 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S75-V3 06/11] i40e: prevent snprintf format specifier truncation

From: Jacob Keller <[email protected]>

Increase the size of the prefix buffer so that it can hold enough characters for every possible input. Although 20 is enough for all expected inputs, it is possible for the values to be larger than expected, resulting in a possibly truncated string. Additionally, lets use sizeof(prefix) in order to ensure we use the correct size if we need to change the array length in the future.

New versions of GCC starting at 7 now include warnings to prevent truncation unless you handle the return code. At most 27 bytes can be written here, so lets just increase the buffer size even if for all expected hw-

Quoted 7 lines
Quoted 1 line

bus.* values we only needed 20.

---
 drivers/net/ethernet/intel/i40e/i40e_common.c   | 4 ++--
 drivers/net/ethernet/intel/i40evf/i40e_common.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
#10 lore raw

PATCH 7/11 i40e: Use correct flag to enable egress traffic for unicast promisc

In reply to Alice Michael

From: Akeem G Abodunrin <[email protected]>

Albeit, we usually set true promiscuous mode for both multicast and unicast at the same time - however, it is possible to set it individually, so using allmulti flag which is only for allmulticast might caused unwanted behavior in mirroring egress traffic promiscuous for unicast in VF.

---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -1
index 3ef67dc..aa8d30b 100644
@@ -1758,7 +1758,7 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf,
 		}
 	} else {
 		aq_ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
-							     allmulti, NULL,
+							     alluni, NULL,
 							     true);
 		aq_err = pf->hw.aq.asq_last_status;
 		if (aq_ret) {
Signature · 1 line
2.9.3
#11 lore raw

PATCH 7/11 i40e: Use correct flag to enable egress traffic for unicast promisc

Quoted 17 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, July 12, 2017 2:46 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Abodunrin, Akeem G <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S75-V3 07/11] i40e: Use correct flag to enable egress traffic for unicast promisc

From: Akeem G Abodunrin <[email protected]>

Albeit, we usually set true promiscuous mode for both multicast and unicast at the same time - however, it is possible to set it individually, so using allmulti flag which is only for allmulticast might caused unwanted behavior in mirroring egress traffic promiscuous for unicast in VF.

Quoted 4 lines
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#12 lore raw

PATCH 8/11 i40evf: fix possible snprintf truncation of q_vector->name

In reply to Alice Michael

From: Jacob Keller <[email protected]>

The q_vector names are based on the interface name with a driver prefix, the type of q_vector setup, and the queue number. We previously set the size of this variable to IFNAMSIZ + 9, which is incorrect, because we actually include a minimum of 14 characters extra beyond the interface name size.

New versions of GCC since 7 include a new warning that detects this possible truncation and complains. We can fix this by increasing the size incase our interface name is too large to avoid truncation. We don't need to go beyond 14 because the compiler is smart enough to realize our values can never exceed size of 1. We do go up to 15 here because possible future changes may increase the number of queues beyond one digit.

While we are here, also change some variables to be unsigned (since they are never negative) and stop using an extra unnecessary %s format specifier.

---
 drivers/net/ethernet/intel/i40evf/i40evf.h      |  2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 21 +++++++++------------
 2 files changed, 10 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -1
index c89767e..f028c09 100644
@@ -121,7 +121,7 @@ struct i40e_q_vector {
 #define ITR_COUNTDOWN_START 100
 	u8 itr_countdown;	/* when 0 or 1 update ITR */
 	int v_idx;	/* vector index in list */
-	char name[IFNAMSIZ + 9];
+	char name[IFNAMSIZ + 15];
 	bool arm_wb_state;
 	cpumask_t affinity_mask;
 	struct irq_affinity_notify affinity_notify;
drivers/net/ethernet/intel/i40evf/i40evf_main.c +9 -12
index 755f60f..a8bc1ed 100644
@@ -543,9 +543,9 @@ static void i40evf_irq_affinity_release(struct kref *ref) {}
 static int
 i40evf_request_traffic_irqs(struct i40evf_adapter *adapter, char *basename)
 {
-	int vector, err, q_vectors;
-	int rx_int_idx = 0, tx_int_idx = 0;
-	int irq_num;
+	unsigned int vector, q_vectors;
+	unsigned int rx_int_idx = 0, tx_int_idx = 0;
+	int irq_num, err;
 
 	i40evf_irq_disable(adapter);
 	/* Decrement for Other and TCP Timer vectors */
@@ -556,18 +556,15 @@ i40evf_request_traffic_irqs(struct i40evf_adapter *adapter, char *basename)
 		irq_num = adapter->msix_entries[vector + NONQ_VECS].vector;
 
 		if (q_vector->tx.ring && q_vector->rx.ring) {
-			snprintf(q_vector->name, sizeof(q_vector->name) - 1,
-				 "i40evf-%s-%s-%d", basename,
-				 "TxRx", rx_int_idx++);
+			snprintf(q_vector->name, sizeof(q_vector->name),
+				 "i40evf-%s-TxRx-%d", basename, rx_int_idx++);
 			tx_int_idx++;
 		} else if (q_vector->rx.ring) {
-			snprintf(q_vector->name, sizeof(q_vector->name) - 1,
-				 "i40evf-%s-%s-%d", basename,
-				 "rx", rx_int_idx++);
+			snprintf(q_vector->name, sizeof(q_vector->name),
+				 "i40evf-%s-rx-%d", basename, rx_int_idx++);
 		} else if (q_vector->tx.ring) {
-			snprintf(q_vector->name, sizeof(q_vector->name) - 1,
-				 "i40evf-%s-%s-%d", basename,
-				 "tx", tx_int_idx++);
+			snprintf(q_vector->name, sizeof(q_vector->name),
+				 "i40evf-%s-tx-%d", basename, tx_int_idx++);
 		} else {
 			/* skip this unused q_vector */
 			continue;
Signature · 1 line
2.9.3
#13 lore raw

PATCH 8/11 i40evf: fix possible snprintf truncation of q_vector->name

Quoted 23 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, July 12, 2017 2:46 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S75-V3 08/11] i40evf: fix possible snprintf truncation of q_vector->name

From: Jacob Keller <[email protected]>

The q_vector names are based on the interface name with a driver prefix, the type of q_vector setup, and the queue number. We previously set the size of this variable to IFNAMSIZ + 9, which is incorrect, because we actually include a minimum of 14 characters extra beyond the interface name size.

New versions of GCC since 7 include a new warning that detects this possible truncation and complains. We can fix this by increasing the size incase our interface name is too large to avoid truncation. We don't need to go beyond 14 because the compiler is smart enough to realize our values can never exceed size of 1. We do go up to 15 here because possible future changes may increase the number of queues beyond one digit.

Quoted 8 lines

While we are here, also change some variables to be unsigned (since they are never negative) and stop using an extra unnecessary %s format specifier.

---
 drivers/net/ethernet/intel/i40evf/i40evf.h      |  2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 21 +++++++++------------
 2 files changed, 10 insertions(+), 13 deletions(-)
#14 lore raw

PATCH 9/11 i40e: force VMDQ device name truncation

In reply to Alice Michael

From: Jacob Keller <[email protected]>

In new versions of GCC since 7.x a new warning exists which warns when a string is truncated before all of the format can be completed.

When we setup VMDQ netdev names we are copying a pre-existing interface name which could be up to 15 characters in length. Since we also add 4 bytes, v, the literal %, the d and a \0 null, we would overrun the available size unless snprintf truncated for us.

The snprintf call will ofcourse truncate on the end, so lets instead modify the code to force truncation of the copied netdev name by 4 characters, to create enough space for the 4 bytes we're adding.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +7 -2
index 837d434..0c8c07d 100644
@@ -9690,8 +9690,13 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
 		i40e_add_mac_filter(vsi, mac_addr);
 		spin_unlock_bh(&vsi->mac_filter_hash_lock);
 	} else {
-		/* relate the VSI_VMDQ name to the VSI_MAIN name */
-		snprintf(netdev->name, IFNAMSIZ, "%sv%%d",
+		/* Relate the VSI_VMDQ name to the VSI_MAIN name. Note that we
+		 * are still limited by IFNAMSIZ, but we're adding 'v%d\0' to
+		 * the end, which is 4 bytes long, so force truncation of the
+		 * original name by IFNAMSIZ - 4
+		 */
+		snprintf(netdev->name, IFNAMSIZ, "%.*sv%%d",
+			 IFNAMSIZ - 4,
 			 pf->vsi[pf->lan_vsi]->netdev->name);
 		random_ether_addr(mac_addr);
 
Signature · 1 line
2.9.3
#15 lore raw

PATCH 9/11 i40e: force VMDQ device name truncation

Quoted 20 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, July 12, 2017 2:46 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S75-V3 09/11] i40e: force VMDQ device name truncation

From: Jacob Keller <[email protected]>

In new versions of GCC since 7.x a new warning exists which warns when a string is truncated before all of the format can be completed.

When we setup VMDQ netdev names we are copying a pre-existing interface name which could be up to 15 characters in length. Since we also add
4 bytes, v, the literal %, the d and a \0 null, we would overrun the available size unless snprintf truncated for us.

Quoted 8 lines

The snprintf call will ofcourse truncate on the end, so lets instead modify the code to force truncation of the copied netdev name by
4 characters, to create enough space for the 4 bytes we're adding.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
#16 lore raw

PATCH 10/11 i40e/i40evf: support for VF VLAN tag stripping control

In reply to Alice Michael

From: Mariusz Stachura <[email protected]>

This patch gives VF capability to control VLAN tag stripping via ethtool. As rx-vlan-offload was fixed before, now the VF is able to change it using "ethtool --offload <IF> rxvlan on/off" settings.

---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 60 ++++++++++++++++++++++
 drivers/net/ethernet/intel/i40evf/i40evf.h         |  4 ++
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    | 33 ++++++++++++
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    | 40 +++++++++++++++
 4 files changed, 137 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +60 -0
index aa8d30b..d551f84 100644
@@ -2530,6 +2530,60 @@ static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg, u16 msglen)
 }
 
 /**
+ * i40e_vc_enable_vlan_stripping
+ * @vf: pointer to the VF info
+ * @msg: pointer to the msg buffer
+ * @msglen: msg length
+ *
+ * Enable vlan header stripping for the VF
+ **/
+static int i40e_vc_enable_vlan_stripping(struct i40e_vf *vf, u8 *msg,
+					 u16 msglen)
+{
+	struct i40e_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];
+	i40e_status aq_ret = 0;
+
+	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+		aq_ret = I40E_ERR_PARAM;
+		goto err;
+	}
+
+	i40e_vlan_stripping_enable(vsi);
+
+	/* send the response to the VF */
+err:
+	return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
+				       aq_ret);
+}
+
+/**
+ * i40e_vc_disable_vlan_stripping
+ * @vf: pointer to the VF info
+ * @msg: pointer to the msg buffer
+ * @msglen: msg length
+ *
+ * Disable vlan header stripping for the VF
+ **/
+static int i40e_vc_disable_vlan_stripping(struct i40e_vf *vf, u8 *msg,
+					  u16 msglen)
+{
+	struct i40e_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];
+	i40e_status aq_ret = 0;
+
+	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+		aq_ret = I40E_ERR_PARAM;
+		goto err;
+	}
+
+	i40e_vlan_stripping_disable(vsi);
+
+	/* send the response to the VF */
+err:
+	return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,
+				       aq_ret);
+}
+
+/**
  * i40e_vc_process_vf_msg
  * @pf: pointer to the PF structure
  * @vf_id: source VF id
@@ -2648,6 +2702,12 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,
 	case VIRTCHNL_OP_SET_RSS_HENA:
 		ret = i40e_vc_set_rss_hena(vf, msg, msglen);
 		break;
+	case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
+		ret = i40e_vc_enable_vlan_stripping(vf, msg, msglen);
+		break;
+	case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
+		ret = i40e_vc_disable_vlan_stripping(vf, msg, msglen);
+		break;
 
 	case VIRTCHNL_OP_UNKNOWN:
 	default:
drivers/net/ethernet/intel/i40evf/i40evf.h +4 -0
index f028c09..b659358 100644
@@ -261,6 +261,8 @@ struct i40evf_adapter {
 #define I40EVF_FLAG_AQ_RELEASE_PROMISC		BIT(16)
 #define I40EVF_FLAG_AQ_REQUEST_ALLMULTI		BIT(17)
 #define I40EVF_FLAG_AQ_RELEASE_ALLMULTI		BIT(18)
+#define I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING	BIT(19)
+#define I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING   BIT(20)
 
 	/* OS defined structs */
 	struct net_device *netdev;
@@ -358,6 +360,8 @@ void i40evf_get_hena(struct i40evf_adapter *adapter);
 void i40evf_set_hena(struct i40evf_adapter *adapter);
 void i40evf_set_rss_key(struct i40evf_adapter *adapter);
 void i40evf_set_rss_lut(struct i40evf_adapter *adapter);
+void i40evf_enable_vlan_stripping(struct i40evf_adapter *adapter);
+void i40evf_disable_vlan_stripping(struct i40evf_adapter *adapter);
 void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
 				enum virtchnl_ops v_opcode,
 				i40e_status v_retval, u8 *msg, u16 msglen);
drivers/net/ethernet/intel/i40evf/i40evf_main.c +33 -0
index a8bc1ed..ad4c833 100644
@@ -1676,6 +1676,16 @@ static void i40evf_watchdog_task(struct work_struct *work)
 		goto watchdog_done;
 	}
 
+	if (adapter->aq_required & I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING) {
+		i40evf_enable_vlan_stripping(adapter);
+		goto watchdog_done;
+	}
+
+	if (adapter->aq_required & I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING) {
+		i40evf_disable_vlan_stripping(adapter);
+		goto watchdog_done;
+	}
+
 	if (adapter->aq_required & I40EVF_FLAG_AQ_CONFIGURE_QUEUES) {
 		i40evf_configure_queues(adapter);
 		goto watchdog_done;
@@ -2295,6 +2305,28 @@ static int i40evf_change_mtu(struct net_device *netdev, int new_mtu)
 }
 
 /**
+ * i40e_set_features - set the netdev feature flags
+ * @netdev: ptr to the netdev being adjusted
+ * @features: the feature set that the stack is suggesting
+ * Note: expects to be called while under rtnl_lock()
+ **/
+static int i40evf_set_features(struct net_device *netdev,
+			       netdev_features_t features)
+{
+	struct i40evf_adapter *adapter = netdev_priv(netdev);
+
+	if (!VLAN_ALLOWED(adapter))
+		return -EINVAL;
+
+	if (features & NETIF_F_HW_VLAN_CTAG_RX)
+		adapter->aq_required |= I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING;
+	else
+		adapter->aq_required |= I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING;
+
+	return 0;
+}
+
+/**
  * i40evf_features_check - Validate encapsulated packet conforms to limits
  * @skb: skb buff
  * @netdev: This physical port's netdev
@@ -2387,6 +2419,7 @@ static const struct net_device_ops i40evf_netdev_ops = {
 	.ndo_vlan_rx_kill_vid	= i40evf_vlan_rx_kill_vid,
 	.ndo_features_check	= i40evf_features_check,
 	.ndo_fix_features	= i40evf_fix_features,
+	.ndo_set_features	= i40evf_set_features,
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	.ndo_poll_controller	= i40evf_netpoll,
 #endif
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +40 -0
index 6c403bf..85876f4 100644
@@ -821,6 +821,46 @@ void i40evf_set_rss_lut(struct i40evf_adapter *adapter)
 }
 
 /**
+ * i40evf_enable_vlan_stripping
+ * @adapter: adapter structure
+ *
+ * Request VLAN header stripping to be enabled
+ **/
+void i40evf_enable_vlan_stripping(struct i40evf_adapter *adapter)
+{
+	if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
+		/* bail because we already have a command pending */
+		dev_err(&adapter->pdev->dev, "Cannot enable stripping, command %d pending\n",
+			adapter->current_op);
+		return;
+	}
+	adapter->current_op = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING;
+	adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING;
+	i40evf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
+			   NULL, 0);
+}
+
+/**
+ * i40evf_disable_vlan_stripping
+ * @adapter: adapter structure
+ *
+ * Request VLAN header stripping to be disabled
+ **/
+void i40evf_disable_vlan_stripping(struct i40evf_adapter *adapter)
+{
+	if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
+		/* bail because we already have a command pending */
+		dev_err(&adapter->pdev->dev, "Cannot disable stripping, command %d pending\n",
+			adapter->current_op);
+		return;
+	}
+	adapter->current_op = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING;
+	adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING;
+	i40evf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,
+			   NULL, 0);
+}
+
+/**
  * i40evf_print_link_message - print link up or down
  * @adapter: adapter structure
  *
Signature · 1 line
2.9.3
#17 lore raw

[Intel-wired-lan] [next PATCH S75-V3 10/11] i40e/i40evf: support for VF VLAN tag stripping control

reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…

Hi Mariusz,

[auto build test ERROR on jkirsher-next-queue/dev-queue]
[also build test ERROR on v4.12 next-20170712]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Alice-Michael/i40evf-use-netdev-variable-in-reset-task/20170713-123145
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0

reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa

All errors (new ones prefixed by >>):

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_enable_vlan_stripping':

>> drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2555:37: error: 'VIRTCHNL_OP_ENABLE_VLAN_STRIPPING' undeclared (first use in this function)
     return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
                                        ^
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2555:37: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_disable_vlan_stripping':
>> drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2582:37: error: 'VIRTCHNL_OP_DISABLE_VLAN_STRIPPING' undeclared (first use in this function)
     return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,
                                        ^
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_process_vf_msg':
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2705:7: error: 'VIRTCHNL_OP_ENABLE_VLAN_STRIPPING' undeclared (first use in this function)
     case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
          ^
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2708:7: error: 'VIRTCHNL_OP_DISABLE_VLAN_STRIPPING' undeclared (first use in this function)
     case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
          ^
--
   drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c: In function 'i40evf_enable_vlan_stripping':
>> drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c:837:24: error: 'VIRTCHNL_OP_ENABLE_VLAN_STRIPPING' undeclared (first use in this function)
     adapter->current_op = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING;
                           ^
   drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c:837:24: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c: In function 'i40evf_disable_vlan_stripping':
>> drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c:857:24: error: 'VIRTCHNL_OP_DISABLE_VLAN_STRIPPING' undeclared (first use in this function)
     adapter->current_op = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING;
                           ^

vim +/VIRTCHNL_OP_ENABLE_VLAN_STRIPPING +2555 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

2531
2532 /**
2533 * i40e_vc_enable_vlan_stripping
2534 * @vf: pointer to the VF info
2535 * @msg: pointer to the msg buffer
2536 * @msglen: msg length
2537 *
2538 * Enable vlan header stripping for the VF
2539 **/
2540 static int i40e_vc_enable_vlan_stripping(struct i40e_vf *vf, u8 *msg,
2541 u16 msglen)
2542 {
2543 struct i40e_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];
2544 i40e_status aq_ret = 0;
2545
2546 if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
2547 aq_ret = I40E_ERR_PARAM;
2548 goto err;
2549 }
2550
2551 i40e_vlan_stripping_enable(vsi);
2552
2553 /* send the response to the VF */
2554 err:

> 2555		return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
  2556					       aq_ret);
  2557	}
  2558	
  2559	/**
  2560	 * i40e_vc_disable_vlan_stripping
  2561	 * @vf: pointer to the VF info
  2562	 * @msg: pointer to the msg buffer
  2563	 * @msglen: msg length
  2564	 *
  2565	 * Disable vlan header stripping for the VF
  2566	 **/
  2567	static int i40e_vc_disable_vlan_stripping(struct i40e_vf *vf, u8 *msg,
  2568						  u16 msglen)
  2569	{
  2570		struct i40e_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];
  2571		i40e_status aq_ret = 0;
  2572	
  2573		if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
  2574			aq_ret = I40E_ERR_PARAM;
  2575			goto err;
  2576		}
  2577	
  2578		i40e_vlan_stripping_disable(vsi);
  2579	
  2580		/* send the response to the VF */
  2581	err:
> 2582		return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,

2583 aq_ret);
2584 }
2585

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 50562 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20170713/3b171cb6/attachment-0001.bin>

#18 lore raw

[Intel-wired-lan] [next PATCH S75-V3 10/11] i40e/i40evf: support for VF VLAN tag stripping control

In reply to Alice Michael
reproduce:

Hi Mariusz,

[auto build test WARNING on jkirsher-next-queue/dev-queue]
[also build test WARNING on v4.12 next-20170712]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Alice-Michael/i40evf-use-netdev-variable-in-reset-task/20170713-123145
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

include/linux/compiler.h:260:8: sparse: attribute 'no_sanitize_address': unknown attribute drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2555:44: sparse: undefined identifier 'VIRTCHNL_OP_ENABLE_VLAN_STRIPPING' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2582:44: sparse: undefined identifier 'VIRTCHNL_OP_DISABLE_VLAN_STRIPPING' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2705:14: sparse: undefined identifier 'VIRTCHNL_OP_ENABLE_VLAN_STRIPPING' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2708:14: sparse: undefined identifier 'VIRTCHNL_OP_DISABLE_VLAN_STRIPPING'

>> drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2705:14: sparse: incompatible types for 'case' statement
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2708:14: sparse: incompatible types for 'case' statement
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2705:14: sparse: Expected constant expression in case statement
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2708:14: sparse: Expected constant expression in case statement
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_enable_vlan_stripping':
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2555:37: error: 'VIRTCHNL_OP_ENABLE_VLAN_STRIPPING' undeclared (first use in this function)
     return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2555:37: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_disable_vlan_stripping':
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2582:37: error: 'VIRTCHNL_OP_DISABLE_VLAN_STRIPPING' undeclared (first use in this function)
     return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_process_vf_msg':
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2705:7: error: 'VIRTCHNL_OP_ENABLE_VLAN_STRIPPING' undeclared (first use in this function)
     case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2708:7: error: 'VIRTCHNL_OP_DISABLE_VLAN_STRIPPING' undeclared (first use in this function)
     case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/case +2705 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

2531
2532 /**
2533 * i40e_vc_enable_vlan_stripping
2534 * @vf: pointer to the VF info
2535 * @msg: pointer to the msg buffer
2536 * @msglen: msg length
2537 *
2538 * Enable vlan header stripping for the VF
2539 **/
2540 static int i40e_vc_enable_vlan_stripping(struct i40e_vf *vf, u8 *msg,
2541 u16 msglen)
2542 {
2543 struct i40e_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];
2544 i40e_status aq_ret = 0;
2545
2546 if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
2547 aq_ret = I40E_ERR_PARAM;
2548 goto err;
2549 }
2550
2551 i40e_vlan_stripping_enable(vsi);
2552
2553 /* send the response to the VF */
2554 err:

> 2555		return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
  2556					       aq_ret);
  2557	}
  2558	
  2559	/**
  2560	 * i40e_vc_disable_vlan_stripping
  2561	 * @vf: pointer to the VF info
  2562	 * @msg: pointer to the msg buffer
  2563	 * @msglen: msg length
  2564	 *
  2565	 * Disable vlan header stripping for the VF
  2566	 **/
  2567	static int i40e_vc_disable_vlan_stripping(struct i40e_vf *vf, u8 *msg,
  2568						  u16 msglen)
  2569	{
  2570		struct i40e_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];
  2571		i40e_status aq_ret = 0;
  2572	
  2573		if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
  2574			aq_ret = I40E_ERR_PARAM;
  2575			goto err;
  2576		}
  2577	
  2578		i40e_vlan_stripping_disable(vsi);
  2579	
  2580		/* send the response to the VF */
  2581	err:
  2582		return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,
  2583					       aq_ret);
  2584	}
  2585	
  2586	/**
  2587	 * i40e_vc_process_vf_msg
  2588	 * @pf: pointer to the PF structure
  2589	 * @vf_id: source VF id
  2590	 * @msg: pointer to the msg buffer
  2591	 * @msglen: msg length
  2592	 * @msghndl: msg handle
  2593	 *
  2594	 * called from the common aeq/arq handler to
  2595	 * process request from VF
  2596	 **/
  2597	int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,
  2598				   u32 v_retval, u8 *msg, u16 msglen)
  2599	{
  2600		struct i40e_hw *hw = &pf->hw;
  2601		int local_vf_id = vf_id - (s16)hw->func_caps.vf_base_id;
  2602		struct i40e_vf *vf;
  2603		int ret;
  2604	
  2605		pf->vf_aq_requests++;
  2606		if (local_vf_id >= pf->num_alloc_vfs)
  2607			return -EINVAL;
  2608		vf = &(pf->vf[local_vf_id]);
  2609	
  2610		/* Check if VF is disabled. */
  2611		if (test_bit(I40E_VF_STATE_DISABLED, &vf->vf_states))
  2612			return I40E_ERR_PARAM;
  2613	
  2614		/* perform basic checks on the msg */
  2615		ret = virtchnl_vc_validate_vf_msg(&vf->vf_ver, v_opcode, msg, msglen);
  2616	
  2617		/* perform additional checks specific to this driver */
  2618		if (v_opcode == VIRTCHNL_OP_CONFIG_RSS_KEY) {
  2619			struct virtchnl_rss_key *vrk = (struct virtchnl_rss_key *)msg;
  2620	
  2621			if (vrk->key_len != I40E_HKEY_ARRAY_SIZE)
  2622				ret = -EINVAL;
  2623		} else if (v_opcode == VIRTCHNL_OP_CONFIG_RSS_LUT) {
  2624			struct virtchnl_rss_lut *vrl = (struct virtchnl_rss_lut *)msg;
  2625	
  2626			if (vrl->lut_entries != I40E_VF_HLUT_ARRAY_SIZE)
  2627				ret = -EINVAL;
  2628		}
  2629	
  2630		if (ret) {
  2631			i40e_vc_send_resp_to_vf(vf, v_opcode, I40E_ERR_PARAM);
  2632			dev_err(&pf->pdev->dev, "Invalid message from VF %d, opcode %d, len %d\n",
  2633				local_vf_id, v_opcode, msglen);
  2634			switch (ret) {
  2635			case VIRTCHNL_ERR_PARAM:
  2636				return -EPERM;
  2637			default:
  2638				return -EINVAL;
  2639			}
  2640		}
  2641	
  2642		switch (v_opcode) {
  2643		case VIRTCHNL_OP_VERSION:
  2644			ret = i40e_vc_get_version_msg(vf, msg);
  2645			break;
  2646		case VIRTCHNL_OP_GET_VF_RESOURCES:
  2647			ret = i40e_vc_get_vf_resources_msg(vf, msg);
  2648			break;
  2649		case VIRTCHNL_OP_RESET_VF:
  2650			i40e_vc_reset_vf_msg(vf);
  2651			ret = 0;
  2652			break;
  2653		case VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
  2654			ret = i40e_vc_config_promiscuous_mode_msg(vf, msg, msglen);
  2655			break;
  2656		case VIRTCHNL_OP_CONFIG_VSI_QUEUES:
  2657			ret = i40e_vc_config_queues_msg(vf, msg, msglen);
  2658			break;
  2659		case VIRTCHNL_OP_CONFIG_IRQ_MAP:
  2660			ret = i40e_vc_config_irq_map_msg(vf, msg, msglen);
  2661			break;
  2662		case VIRTCHNL_OP_ENABLE_QUEUES:
  2663			ret = i40e_vc_enable_queues_msg(vf, msg, msglen);
  2664			i40e_vc_notify_vf_link_state(vf);
  2665			break;
  2666		case VIRTCHNL_OP_DISABLE_QUEUES:
  2667			ret = i40e_vc_disable_queues_msg(vf, msg, msglen);
  2668			break;
  2669		case VIRTCHNL_OP_ADD_ETH_ADDR:
  2670			ret = i40e_vc_add_mac_addr_msg(vf, msg, msglen);
  2671			break;
  2672		case VIRTCHNL_OP_DEL_ETH_ADDR:
  2673			ret = i40e_vc_del_mac_addr_msg(vf, msg, msglen);
  2674			break;
  2675		case VIRTCHNL_OP_ADD_VLAN:
  2676			ret = i40e_vc_add_vlan_msg(vf, msg, msglen);
  2677			break;
  2678		case VIRTCHNL_OP_DEL_VLAN:
  2679			ret = i40e_vc_remove_vlan_msg(vf, msg, msglen);
  2680			break;
  2681		case VIRTCHNL_OP_GET_STATS:
  2682			ret = i40e_vc_get_stats_msg(vf, msg, msglen);
  2683			break;
  2684		case VIRTCHNL_OP_IWARP:
  2685			ret = i40e_vc_iwarp_msg(vf, msg, msglen);
  2686			break;
  2687		case VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP:
  2688			ret = i40e_vc_iwarp_qvmap_msg(vf, msg, msglen, true);
  2689			break;
  2690		case VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP:
  2691			ret = i40e_vc_iwarp_qvmap_msg(vf, msg, msglen, false);
  2692			break;
  2693		case VIRTCHNL_OP_CONFIG_RSS_KEY:
  2694			ret = i40e_vc_config_rss_key(vf, msg, msglen);
  2695			break;
  2696		case VIRTCHNL_OP_CONFIG_RSS_LUT:
  2697			ret = i40e_vc_config_rss_lut(vf, msg, msglen);
  2698			break;
  2699		case VIRTCHNL_OP_GET_RSS_HENA_CAPS:
  2700			ret = i40e_vc_get_rss_hena(vf, msg, msglen);
  2701			break;
  2702		case VIRTCHNL_OP_SET_RSS_HENA:
  2703			ret = i40e_vc_set_rss_hena(vf, msg, msglen);
  2704			break;
> 2705		case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:

2706 ret = i40e_vc_enable_vlan_stripping(vf, msg, msglen);
2707 break;
2708 case VIRTCHNL_OP_DISABLE_VLAN_STRIPPING:
2709 ret = i40e_vc_disable_vlan_stripping(vf, msg, msglen);
2710 break;
2711
2712 case VIRTCHNL_OP_UNKNOWN:
2713 default:
2714 dev_err(&pf->pdev->dev, "Unsupported opcode %d from VF %d\n",
2715 v_opcode, local_vf_id);
2716 ret = i40e_vc_send_resp_to_vf(vf, v_opcode,
2717 I40E_ERR_NOT_IMPLEMENTED);
2718 break;
2719 }
2720
2721 return ret;
2722 }
2723

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#19 lore raw

PATCH 11/11 i40e: 25G FEC status improvements

In reply to Alice Michael

From: Mariusz Stachura <[email protected]>

This patch improves the system log message. The log message will be expanded to include the FEC mode the FW requested before link was established.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +16 -2
index 0c8c07d..fa93c63 100644
@@ -5355,6 +5355,7 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
 	char *speed = "Unknown";
 	char *fc = "Unknown";
 	char *fec = "";
+	char *req_fec = "";
 	char *an = "";
 
 	new_speed = vsi->back->hw.phy.link_info.link_speed;
@@ -5416,6 +5417,7 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
 	}
 
 	if (vsi->back->hw.phy.link_info.link_speed == I40E_LINK_SPEED_25GB) {
+		req_fec = ", Requested FEC: None";
 		fec = ", FEC: None";
 		an = ", Autoneg: False";
 
@@ -5428,10 +5430,22 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
 		else if (vsi->back->hw.phy.link_info.fec_info &
 			 I40E_AQ_CONFIG_FEC_RS_ENA)
 			fec = ", FEC: CL108 RS-FEC";
+
+		/* 'CL108 RS-FEC' should be displayed when RS is requested, or
+		 * both RS and FC are requested
+		 */
+		if (vsi->back->hw.phy.link_info.req_fec_info &
+		    (I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS)) {
+			if (vsi->back->hw.phy.link_info.req_fec_info &
+			    I40E_AQ_REQUEST_FEC_RS)
+				req_fec = ", Requested FEC: CL108 RS-FEC";
+			else
+				req_fec = ", Requested FEC: CL74 FC-FEC/BASE-R";
+		}
 	}
 
-	netdev_info(vsi->netdev, "NIC Link is Up, %sbps Full Duplex%s%s, Flow Control: %s\n",
-		    speed, fec, an, fc);
+	netdev_info(vsi->netdev, "NIC Link is Up, %sbps Full Duplex%s%s%s, Flow Control: %s\n",
+		    speed, req_fec, fec, an, fc);
 }
 
 /**
Signature · 1 line
2.9.3
#20 lore raw

PATCH 11/11 i40e: 25G FEC status improvements

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, July 12, 2017 2:46 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Stachura, Mariusz <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S75-V3 11/11] i40e: 25G FEC status improvements

From: Mariusz Stachura <[email protected]>

Quoted 8 lines

This patch improves the system log message. The log message will be expanded to include the FEC mode the FW requested before link was established.

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
#21 lore raw

PATCH 1/11 i40evf: use netdev variable in reset task

In reply to Alice Michael
Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Wednesday, July 12, 2017 2:46 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S75-V3 01/11] i40evf: use netdev variable in reset task

From: Alan Brady <[email protected]>

Quoted 7 lines

If we're going to bother initializing a variable to reference it we might as well use it.

---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)