All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2021-12-01
@ 2021-12-01 21:59 Tony Nguyen
  2021-12-01 21:59 ` [PATCH net 1/6] iavf: restore MSI state on reset Tony Nguyen
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-12-01 21:59 UTC (permalink / raw)
  To: davem, kuba; +Cc: Tony Nguyen, netdev, sassmann

This series contains updates to iavf and i40e drivers.

Mitch adds restoration of MSI state during reset for iavf.

Michal fixes checking and reporting of descriptor count changes to
communicate changes and/or issues for iavf.

Karen resolves an issue with failed handling of VF requests while a VF
reset is occurring for i40e.

Mateusz removes clearing of VF requested queue count when configuring
VF ADQ for i40e.

Norbert adds additional wait time in i40e for VF reset which could take
longer than current allotted time which causes init adminq to fail. He
also fixes a NULL pointer dereference that can occur when getting VSI
descriptors.

The following are changes since commit 3968e3cafafb72ecf12d1263f935d20bc9df9bc2:
  Merge tag 'wireless-drivers-2021-12-01' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE

Karen Sornek (1):
  i40e: Fix failed opcode appearing if handling messages from VF

Mateusz Palczewski (1):
  i40e: Fix pre-set max number of queues for VF

Michal Maloszewski (1):
  iavf: Fix reporting when setting descriptor count

Mitch Williams (1):
  iavf: restore MSI state on reset

Norbert Zulinski (2):
  i40e: Fix VF failed to init adminq: -53
  i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc

 .../net/ethernet/intel/i40e/i40e_debugfs.c    |  8 ++
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 79 ++++++++++++-------
 .../ethernet/intel/i40e/i40e_virtchnl_pf.h    |  4 +
 .../net/ethernet/intel/iavf/iavf_ethtool.c    | 43 +++++++---
 drivers/net/ethernet/intel/iavf/iavf_main.c   |  1 +
 5 files changed, 97 insertions(+), 38 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net 1/6] iavf: restore MSI state on reset
  2021-12-01 21:59 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2021-12-01 Tony Nguyen
@ 2021-12-01 21:59 ` Tony Nguyen
  2021-12-01 21:59 ` [PATCH net 2/6] iavf: Fix reporting when setting descriptor count Tony Nguyen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-12-01 21:59 UTC (permalink / raw)
  To: davem, kuba
  Cc: Mitch Williams, netdev, anthony.l.nguyen, sassmann,
	George Kuruvinakunnel

From: Mitch Williams <mitch.a.williams@intel.com>

If the PF experiences an FLR, the VF's MSI and MSI-X configuration will
be conveniently and silently removed in the process. When this happens,
reset recovery will appear to complete normally but no traffic will
pass. The netdev watchdog will helpfully notify everyone of this issue.

To prevent such public embarrassment, restore MSI configuration at every
reset. For normal resets, this will do no harm, but for VF resets
resulting from a PF FLR, this will keep the VF working.

Fixes: 5eae00c57f5e ("i40evf: main driver core")
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: George Kuruvinakunnel <george.kuruvinakunnel@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 14934a7a13ef..cfdbf8c08d18 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -2248,6 +2248,7 @@ static void iavf_reset_task(struct work_struct *work)
 	}
 
 	pci_set_master(adapter->pdev);
+	pci_restore_msi_state(adapter->pdev);
 
 	if (i == IAVF_RESET_WAIT_COMPLETE_COUNT) {
 		dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n",
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 2/6] iavf: Fix reporting when setting descriptor count
  2021-12-01 21:59 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2021-12-01 Tony Nguyen
  2021-12-01 21:59 ` [PATCH net 1/6] iavf: restore MSI state on reset Tony Nguyen
@ 2021-12-01 21:59 ` Tony Nguyen
  2021-12-02  3:26   ` Jakub Kicinski
  2021-12-01 21:59 ` [PATCH net 3/6] i40e: Fix failed opcode appearing if handling messages from VF Tony Nguyen
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Tony Nguyen @ 2021-12-01 21:59 UTC (permalink / raw)
  To: davem, kuba
  Cc: Michal Maloszewski, netdev, anthony.l.nguyen, sassmann,
	Anirudh Venkataramanan, Konrad Jankowski

From: Michal Maloszewski <michal.maloszewski@intel.com>

iavf_set_ringparams doesn't communicate to the user that

1. The user requested descriptor count is out of range. Instead it
   just quietly sets descriptors to the "clamped" value and calls it
   done. This makes it look an invalid value was successfully set as
   the descriptor count when this isn't actually true.

2. The user provided descriptor count needs to be inflated for alignment
   reasons.

This behavior is confusing. The ice driver has already addressed this
by rejecting invalid values for descriptor count and
messaging for alignment adjustments.
Do the same thing here by adding the error and info messages.

Fixes: fbb7ddfef253 ("i40evf: core ethtool functionality")
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Michal Maloszewski <michal.maloszewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 .../net/ethernet/intel/iavf/iavf_ethtool.c    | 43 ++++++++++++++-----
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
index 0cecaff38d04..a94b26d39594 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
@@ -615,23 +615,44 @@ static int iavf_set_ringparam(struct net_device *netdev,
 	if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
 		return -EINVAL;
 
-	new_tx_count = clamp_t(u32, ring->tx_pending,
-			       IAVF_MIN_TXD,
-			       IAVF_MAX_TXD);
-	new_tx_count = ALIGN(new_tx_count, IAVF_REQ_DESCRIPTOR_MULTIPLE);
+	if (ring->tx_pending > IAVF_MAX_TXD ||
+	    ring->tx_pending < IAVF_MIN_TXD ||
+	    ring->rx_pending > IAVF_MAX_RXD ||
+	    ring->rx_pending < IAVF_MIN_RXD) {
+		netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d] (increment %d)\n",
+			   ring->tx_pending, ring->rx_pending, IAVF_MIN_TXD,
+			   IAVF_MAX_RXD, IAVF_REQ_DESCRIPTOR_MULTIPLE);
+		return -EINVAL;
+	}
 
-	new_rx_count = clamp_t(u32, ring->rx_pending,
-			       IAVF_MIN_RXD,
-			       IAVF_MAX_RXD);
-	new_rx_count = ALIGN(new_rx_count, IAVF_REQ_DESCRIPTOR_MULTIPLE);
+	new_tx_count = ALIGN(ring->tx_pending, IAVF_REQ_DESCRIPTOR_MULTIPLE);
+	if (new_tx_count != ring->tx_pending)
+		netdev_info(netdev, "Requested Tx descriptor count rounded up to %d\n",
+			    new_tx_count);
+
+	new_rx_count = ALIGN(ring->rx_pending, IAVF_REQ_DESCRIPTOR_MULTIPLE);
+	if (new_rx_count != ring->rx_pending)
+		netdev_info(netdev, "Requested Rx descriptor count rounded up to %d\n",
+			    new_rx_count);
 
 	/* if nothing to do return success */
 	if ((new_tx_count == adapter->tx_desc_count) &&
-	    (new_rx_count == adapter->rx_desc_count))
+	    (new_rx_count == adapter->rx_desc_count)) {
+		netdev_dbg(netdev, "Nothing to change, descriptor count is same as requested\n");
 		return 0;
+	}
 
-	adapter->tx_desc_count = new_tx_count;
-	adapter->rx_desc_count = new_rx_count;
+	if (new_tx_count != adapter->tx_desc_count) {
+		netdev_info(netdev, "Changing Tx descriptor count from %d to %d\n",
+			    adapter->tx_desc_count, new_tx_count);
+		adapter->tx_desc_count = new_tx_count;
+	}
+
+	if (new_rx_count != adapter->rx_desc_count) {
+		netdev_info(netdev, "Changing Rx descriptor count from %d to %d\n",
+			    adapter->rx_desc_count, new_rx_count);
+		adapter->rx_desc_count = new_rx_count;
+	}
 
 	if (netif_running(netdev)) {
 		adapter->flags |= IAVF_FLAG_RESET_NEEDED;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 3/6] i40e: Fix failed opcode appearing if handling messages from VF
  2021-12-01 21:59 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2021-12-01 Tony Nguyen
  2021-12-01 21:59 ` [PATCH net 1/6] iavf: restore MSI state on reset Tony Nguyen
  2021-12-01 21:59 ` [PATCH net 2/6] iavf: Fix reporting when setting descriptor count Tony Nguyen
@ 2021-12-01 21:59 ` Tony Nguyen
  2021-12-01 21:59 ` [PATCH net 4/6] i40e: Fix pre-set max number of queues for VF Tony Nguyen
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-12-01 21:59 UTC (permalink / raw)
  To: davem, kuba
  Cc: Karen Sornek, netdev, anthony.l.nguyen, sassmann,
	Grzegorz Szczurek, Tony Brelinski

From: Karen Sornek <karen.sornek@intel.com>

Fix failed operation code appearing if handling messages from VF.
Implemented by waiting for VF appropriate state if request starts
handle while VF reset.
Without this patch the message handling request while VF is in
a reset state ends with error -5 (I40E_ERR_PARAM).

Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Signed-off-by: Karen Sornek <karen.sornek@intel.com>
Tested-by: Tony Brelinski <tony.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 70 +++++++++++++------
 .../ethernet/intel/i40e/i40e_virtchnl_pf.h    |  2 +
 2 files changed, 50 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 80ae264c99ba..f651861442c2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1948,6 +1948,32 @@ static int i40e_vc_send_resp_to_vf(struct i40e_vf *vf,
 	return i40e_vc_send_msg_to_vf(vf, opcode, retval, NULL, 0);
 }
 
+/**
+ * i40e_sync_vf_state
+ * @vf: pointer to the VF info
+ * @state: VF state
+ *
+ * Called from a VF message to synchronize the service with a potential
+ * VF reset state
+ **/
+static bool i40e_sync_vf_state(struct i40e_vf *vf, enum i40e_vf_states state)
+{
+	int i;
+
+	/* When handling some messages, it needs VF state to be set.
+	 * It is possible that this flag is cleared during VF reset,
+	 * so there is a need to wait until the end of the reset to
+	 * handle the request message correctly.
+	 */
+	for (i = 0; i < I40E_VF_STATE_WAIT_COUNT; i++) {
+		if (test_bit(state, &vf->vf_states))
+			return true;
+		usleep_range(10000, 20000);
+	}
+
+	return test_bit(state, &vf->vf_states);
+}
+
 /**
  * i40e_vc_get_version_msg
  * @vf: pointer to the VF info
@@ -2008,7 +2034,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
 	size_t len = 0;
 	int ret;
 
-	if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_INIT)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
@@ -2131,7 +2157,7 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, u8 *msg)
 	bool allmulti = false;
 	bool alluni = false;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err_out;
 	}
@@ -2219,7 +2245,7 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg)
 	struct i40e_vsi *vsi;
 	u16 num_qps_all = 0;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
 	}
@@ -2368,7 +2394,7 @@ static int i40e_vc_config_irq_map_msg(struct i40e_vf *vf, u8 *msg)
 	i40e_status aq_ret = 0;
 	int i;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
 	}
@@ -2540,7 +2566,7 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)
 	struct i40e_pf *pf = vf->pf;
 	i40e_status aq_ret = 0;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
 	}
@@ -2590,7 +2616,7 @@ static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg)
 	u8 cur_pairs = vf->num_queue_pairs;
 	struct i40e_pf *pf = vf->pf;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states))
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE))
 		return -EINVAL;
 
 	if (req_pairs > I40E_MAX_VF_QUEUES) {
@@ -2635,7 +2661,7 @@ static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg)
 
 	memset(&stats, 0, sizeof(struct i40e_eth_stats));
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
 	}
@@ -2752,7 +2778,7 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
 	i40e_status ret = 0;
 	int i;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) ||
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
 	    !i40e_vc_isvalid_vsi_id(vf, al->vsi_id)) {
 		ret = I40E_ERR_PARAM;
 		goto error_param;
@@ -2824,7 +2850,7 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
 	i40e_status ret = 0;
 	int i;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) ||
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
 	    !i40e_vc_isvalid_vsi_id(vf, al->vsi_id)) {
 		ret = I40E_ERR_PARAM;
 		goto error_param;
@@ -2968,7 +2994,7 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg)
 	i40e_status aq_ret = 0;
 	int i;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) ||
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
 	    !i40e_vc_isvalid_vsi_id(vf, vfl->vsi_id)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
@@ -3088,9 +3114,9 @@ static int i40e_vc_config_rss_key(struct i40e_vf *vf, u8 *msg)
 	struct i40e_vsi *vsi = NULL;
 	i40e_status aq_ret = 0;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) ||
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
 	    !i40e_vc_isvalid_vsi_id(vf, vrk->vsi_id) ||
-	    (vrk->key_len != I40E_HKEY_ARRAY_SIZE)) {
+	    vrk->key_len != I40E_HKEY_ARRAY_SIZE) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
@@ -3119,9 +3145,9 @@ static int i40e_vc_config_rss_lut(struct i40e_vf *vf, u8 *msg)
 	i40e_status aq_ret = 0;
 	u16 i;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) ||
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
 	    !i40e_vc_isvalid_vsi_id(vf, vrl->vsi_id) ||
-	    (vrl->lut_entries != I40E_VF_HLUT_ARRAY_SIZE)) {
+	    vrl->lut_entries != I40E_VF_HLUT_ARRAY_SIZE) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
@@ -3154,7 +3180,7 @@ static int i40e_vc_get_rss_hena(struct i40e_vf *vf, u8 *msg)
 	i40e_status aq_ret = 0;
 	int len = 0;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
@@ -3190,7 +3216,7 @@ static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg)
 	struct i40e_hw *hw = &pf->hw;
 	i40e_status aq_ret = 0;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
@@ -3215,7 +3241,7 @@ static int i40e_vc_enable_vlan_stripping(struct i40e_vf *vf, u8 *msg)
 	i40e_status aq_ret = 0;
 	struct i40e_vsi *vsi;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
@@ -3241,7 +3267,7 @@ static int i40e_vc_disable_vlan_stripping(struct i40e_vf *vf, u8 *msg)
 	i40e_status aq_ret = 0;
 	struct i40e_vsi *vsi;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
@@ -3468,7 +3494,7 @@ static int i40e_vc_del_cloud_filter(struct i40e_vf *vf, u8 *msg)
 	i40e_status aq_ret = 0;
 	int i, ret;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
@@ -3599,7 +3625,7 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
 	i40e_status aq_ret = 0;
 	int i, ret;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err_out;
 	}
@@ -3708,7 +3734,7 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg)
 	i40e_status aq_ret = 0;
 	u64 speed = 0;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
@@ -3824,7 +3850,7 @@ static int i40e_vc_del_qch_msg(struct i40e_vf *vf, u8 *msg)
 	struct i40e_pf *pf = vf->pf;
 	i40e_status aq_ret = 0;
 
-	if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+	if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto err;
 	}
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
index 091e32c1bb46..49575a640a84 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
@@ -18,6 +18,8 @@
 
 #define I40E_MAX_VF_PROMISC_FLAGS	3
 
+#define I40E_VF_STATE_WAIT_COUNT	20
+
 /* Various queue ctrls */
 enum i40e_queue_ctrl {
 	I40E_QUEUE_CTRL_UNKNOWN = 0,
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 4/6] i40e: Fix pre-set max number of queues for VF
  2021-12-01 21:59 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2021-12-01 Tony Nguyen
                   ` (2 preceding siblings ...)
  2021-12-01 21:59 ` [PATCH net 3/6] i40e: Fix failed opcode appearing if handling messages from VF Tony Nguyen
@ 2021-12-01 21:59 ` Tony Nguyen
  2021-12-01 21:59 ` [PATCH net 5/6] i40e: Fix VF failed to init adminq: -53 Tony Nguyen
  2021-12-01 21:59 ` [PATCH net 6/6] i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc Tony Nguyen
  5 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-12-01 21:59 UTC (permalink / raw)
  To: davem, kuba
  Cc: Mateusz Palczewski, netdev, anthony.l.nguyen, sassmann,
	Grzegorz Szczurek, Bindushree P

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

After setting pre-set combined to 16 queues and reserving 16 queues by
tc qdisc, pre-set maximum combined queues returned to default value
after VF reset being 4 and this generated errors during removing tc.
Fixed by removing clear num_req_queues before reset VF.

Fixes: e284fc280473 (i40e: Add and delete cloud filter)
Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Bindushree P <Bindushree.p@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index f651861442c2..2ea4deb8fc44 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -3823,11 +3823,6 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg)
 
 	/* set this flag only after making sure all inputs are sane */
 	vf->adq_enabled = true;
-	/* num_req_queues is set when user changes number of queues via ethtool
-	 * and this causes issue for default VSI(which depends on this variable)
-	 * when ADq is enabled, hence reset it.
-	 */
-	vf->num_req_queues = 0;
 
 	/* reset the VF in order to allocate resources */
 	i40e_vc_reset_vf(vf, true);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 5/6] i40e: Fix VF failed to init adminq: -53
  2021-12-01 21:59 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2021-12-01 Tony Nguyen
                   ` (3 preceding siblings ...)
  2021-12-01 21:59 ` [PATCH net 4/6] i40e: Fix pre-set max number of queues for VF Tony Nguyen
@ 2021-12-01 21:59 ` Tony Nguyen
  2021-12-02  3:27   ` Jakub Kicinski
  2021-12-01 21:59 ` [PATCH net 6/6] i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc Tony Nguyen
  5 siblings, 1 reply; 10+ messages in thread
From: Tony Nguyen @ 2021-12-01 21:59 UTC (permalink / raw)
  To: davem, kuba
  Cc: Norbert Zulinski, netdev, anthony.l.nguyen, sassmann,
	Grzegorz Szczurek, Mateusz Palczewski, Konrad Jankowski

From: Norbert Zulinski <norbertx.zulinski@intel.com>

Fix the problem with init adminq in VF reset handler.
When the PF finished reinitialize VF resource set VFR_VFACTIVE bit
in VF Reset Status register. It is sign for VF driver among others
to shut down and reinitialize the admin queue. VF handle reset procedure
is sampling this register to check every 10ms. PF driver give up to 20ms
to VF reset procedure. For a single VF reset it is enough time to do it
but in case request VF reset twice, the first VF reset can be not
completely finished when PF requests it one more time.
Fixed by adding additional time for VF to finish reset procedure
before sending next VF reset request by PF.

Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Signed-off-by: Norbert Zulinski <norbertx.zulinski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++++
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 2ea4deb8fc44..8e224b9c1cf3 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -172,6 +172,9 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf)
 	    !test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states))
 		return;
 
+	if (ktime_get_ns() - vf->reset_timestamp < I40E_VF_RESET_TIME_MIN)
+		usleep_range(30000, 60000);
+
 	abs_vf_id = vf->vf_id + (int)vf->pf->hw.func_caps.vf_base_id;
 
 	pfe.event = VIRTCHNL_EVENT_RESET_IMPENDING;
@@ -1536,6 +1539,7 @@ bool i40e_reset_vf(struct i40e_vf *vf, bool flr)
 	i40e_cleanup_reset_vf(vf);
 
 	i40e_flush(hw);
+	vf->reset_timestamp = ktime_get_ns();
 	clear_bit(__I40E_VF_DISABLE, pf->state);
 
 	return true;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
index 49575a640a84..6aa35c8c9091 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
@@ -19,6 +19,7 @@
 #define I40E_MAX_VF_PROMISC_FLAGS	3
 
 #define I40E_VF_STATE_WAIT_COUNT	20
+#define I40E_VF_RESET_TIME_MIN		30000000	/* time in nsec */
 
 /* Various queue ctrls */
 enum i40e_queue_ctrl {
@@ -80,6 +81,7 @@ struct i40e_vf {
 	u16 port_vlan_id;
 	bool pf_set_mac;	/* The VMM admin set the VF MAC address */
 	bool trusted;
+	u64 reset_timestamp;
 
 	/* VSI indices - actual VSI pointers are maintained in the PF structure
 	 * When assigned, these will be non-zero, because VSI 0 is always
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 6/6] i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc
  2021-12-01 21:59 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2021-12-01 Tony Nguyen
                   ` (4 preceding siblings ...)
  2021-12-01 21:59 ` [PATCH net 5/6] i40e: Fix VF failed to init adminq: -53 Tony Nguyen
@ 2021-12-01 21:59 ` Tony Nguyen
  5 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-12-01 21:59 UTC (permalink / raw)
  To: davem, kuba
  Cc: Norbert Zulinski, netdev, anthony.l.nguyen, sassmann,
	Sylwester Dziedziuch, Mateusz Palczewski, Gurucharan G

From: Norbert Zulinski <norbertx.zulinski@intel.com>

When trying to dump VFs VSI RX/TX descriptors
using debugfs there was a crash
due to NULL pointer dereference in i40e_dbg_dump_desc.
Added a check to i40e_dbg_dump_desc that checks if
VSI type is correct for dumping RX/TX descriptors.

Fixes: 02e9c290814c ("i40e: debugfs interface")
Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Signed-off-by: Norbert Zulinski <norbertx.zulinski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index 291e61ac3e44..2c1b1da1220e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -553,6 +553,14 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
 		dev_info(&pf->pdev->dev, "vsi %d not found\n", vsi_seid);
 		return;
 	}
+	if (vsi->type != I40E_VSI_MAIN &&
+	    vsi->type != I40E_VSI_FDIR &&
+	    vsi->type != I40E_VSI_VMDQ2) {
+		dev_info(&pf->pdev->dev,
+			 "vsi %d type %d descriptor rings not available\n",
+			 vsi_seid, vsi->type);
+		return;
+	}
 	if (type == RING_TYPE_XDP && !i40e_enabled_xdp_vsi(vsi)) {
 		dev_info(&pf->pdev->dev, "XDP not enabled on VSI %d\n", vsi_seid);
 		return;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net 2/6] iavf: Fix reporting when setting descriptor count
  2021-12-01 21:59 ` [PATCH net 2/6] iavf: Fix reporting when setting descriptor count Tony Nguyen
@ 2021-12-02  3:26   ` Jakub Kicinski
  2021-12-02 21:54     ` Nguyen, Anthony L
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2021-12-02  3:26 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, Michal Maloszewski, netdev, sassmann,
	Anirudh Venkataramanan, Konrad Jankowski

On Wed,  1 Dec 2021 13:59:10 -0800 Tony Nguyen wrote:
> +	if (new_tx_count != adapter->tx_desc_count) {
> +		netdev_info(netdev, "Changing Tx descriptor count from %d to %d\n",
> +			    adapter->tx_desc_count, new_tx_count);
> +		adapter->tx_desc_count = new_tx_count;
> +	}
> +
> +	if (new_rx_count != adapter->rx_desc_count) {
> +		netdev_info(netdev, "Changing Rx descriptor count from %d to %d\n",
> +			    adapter->rx_desc_count, new_rx_count);
> +		adapter->rx_desc_count = new_rx_count;
> +	}

How is this different than the MTU change msg I _just_ complained about?
Please downgrade to dbg().

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net 5/6] i40e: Fix VF failed to init adminq: -53
  2021-12-01 21:59 ` [PATCH net 5/6] i40e: Fix VF failed to init adminq: -53 Tony Nguyen
@ 2021-12-02  3:27   ` Jakub Kicinski
  0 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2021-12-02  3:27 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, Norbert Zulinski, netdev, sassmann, Grzegorz Szczurek,
	Mateusz Palczewski, Konrad Jankowski

On Wed,  1 Dec 2021 13:59:13 -0800 Tony Nguyen wrote:
> +	if (ktime_get_ns() - vf->reset_timestamp < I40E_VF_RESET_TIME_MIN)
> +		usleep_range(30000, 60000);

		msleep(30);

Seems pretty strange to usleep_range() once the length is in 10s of
msecs.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net 2/6] iavf: Fix reporting when setting descriptor count
  2021-12-02  3:26   ` Jakub Kicinski
@ 2021-12-02 21:54     ` Nguyen, Anthony L
  0 siblings, 0 replies; 10+ messages in thread
From: Nguyen, Anthony L @ 2021-12-02 21:54 UTC (permalink / raw)
  To: kuba
  Cc: Maloszewski, Michal, sassmann, davem, netdev, Venkataramanan,
	Anirudh, Jankowski, Konrad0

On Wed, 2021-12-01 at 19:26 -0800, Jakub Kicinski wrote:
> On Wed,  1 Dec 2021 13:59:10 -0800 Tony Nguyen wrote:
> > +       if (new_tx_count != adapter->tx_desc_count) {
> > +               netdev_info(netdev, "Changing Tx descriptor count
> > from %d to %d\n",
> > +                           adapter->tx_desc_count, new_tx_count);
> > +               adapter->tx_desc_count = new_tx_count;
> > +       }
> > +
> > +       if (new_rx_count != adapter->rx_desc_count) {
> > +               netdev_info(netdev, "Changing Rx descriptor count
> > from %d to %d\n",
> > +                           adapter->rx_desc_count, new_rx_count);
> > +               adapter->rx_desc_count = new_rx_count;
> > +       }
> 
> How is this different than the MTU change msg I _just_ complained
> about?
> Please downgrade to dbg().

Will do.

Thanks,
Tony

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-12-02 21:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 21:59 [PATCH net 0/6][pull request] Intel Wired LAN Driver Updates 2021-12-01 Tony Nguyen
2021-12-01 21:59 ` [PATCH net 1/6] iavf: restore MSI state on reset Tony Nguyen
2021-12-01 21:59 ` [PATCH net 2/6] iavf: Fix reporting when setting descriptor count Tony Nguyen
2021-12-02  3:26   ` Jakub Kicinski
2021-12-02 21:54     ` Nguyen, Anthony L
2021-12-01 21:59 ` [PATCH net 3/6] i40e: Fix failed opcode appearing if handling messages from VF Tony Nguyen
2021-12-01 21:59 ` [PATCH net 4/6] i40e: Fix pre-set max number of queues for VF Tony Nguyen
2021-12-01 21:59 ` [PATCH net 5/6] i40e: Fix VF failed to init adminq: -53 Tony Nguyen
2021-12-02  3:27   ` Jakub Kicinski
2021-12-01 21:59 ` [PATCH net 6/6] i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc Tony Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.