All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e)
@ 2022-09-19 22:34 Tony Nguyen
  2022-09-19 22:34 ` [PATCH net 1/4] iavf: Fix bad page state Tony Nguyen
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-09-19 22:34 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet; +Cc: Tony Nguyen, netdev

This series contains updates to iavf and i40e drivers.

Norbert adds checking of buffer size for Rx buffer checks in iavf.

Michal corrects setting of max MTU in iavf to account for MTU data provided
by PF, fixes i40e to set VF max MTU, and resolves lack of rate limiting
when value was less than divisor for i40e.

The following are changes since commit 96628951869c0dedf0377adca01c8675172d8639:
  tcp: Use WARN_ON_ONCE() in tcp_read_skb()
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE

Michal Jaron (3):
  iavf: Fix set max MTU size with port VLAN and jumbo frames
  i40e: Fix VF set max MTU size
  i40e: Fix set max_tx_rate when it is lower than 1 Mbps

Norbert Zulinski (1):
  iavf: Fix bad page state

 drivers/net/ethernet/intel/i40e/i40e_main.c   | 32 +++++++++++++++----
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 20 ++++++++++++
 drivers/net/ethernet/intel/iavf/iavf_txrx.c   |  4 +--
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  7 ++--
 4 files changed, 53 insertions(+), 10 deletions(-)

-- 
2.35.1


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

* [PATCH net 1/4] iavf: Fix bad page state
  2022-09-19 22:34 [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e) Tony Nguyen
@ 2022-09-19 22:34 ` Tony Nguyen
  2022-09-19 22:34 ` [PATCH net 2/4] iavf: Fix set max MTU size with port VLAN and jumbo frames Tony Nguyen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-09-19 22:34 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Norbert Zulinski, netdev, anthony.l.nguyen, Mateusz Palczewski,
	Konrad Jankowski

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

Fix bad page state, free inappropriate page in handling dummy
descriptor. iavf_build_skb now has to check not only if rx_buffer is
NULL but also if size is zero, same thing in iavf_clean_rx_irq.
Without this patch driver would free page that will be used
by napi_build_skb.

Fixes: a9f49e006030 ("iavf: Fix handling of dummy receive descriptors")
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/iavf/iavf_txrx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
index 4c3f3f419110..18b6a702a1d6 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
@@ -1393,7 +1393,7 @@ static struct sk_buff *iavf_build_skb(struct iavf_ring *rx_ring,
 #endif
 	struct sk_buff *skb;
 
-	if (!rx_buffer)
+	if (!rx_buffer || !size)
 		return NULL;
 	/* prefetch first cache line of first page */
 	va = page_address(rx_buffer->page) + rx_buffer->page_offset;
@@ -1551,7 +1551,7 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_ring, int budget)
 		/* exit if we failed to retrieve a buffer */
 		if (!skb) {
 			rx_ring->rx_stats.alloc_buff_failed++;
-			if (rx_buffer)
+			if (rx_buffer && size)
 				rx_buffer->pagecnt_bias++;
 			break;
 		}
-- 
2.35.1


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

* [PATCH net 2/4] iavf: Fix set max MTU size with port VLAN and jumbo frames
  2022-09-19 22:34 [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e) Tony Nguyen
  2022-09-19 22:34 ` [PATCH net 1/4] iavf: Fix bad page state Tony Nguyen
@ 2022-09-19 22:34 ` Tony Nguyen
  2022-09-19 22:34 ` [PATCH net 3/4] i40e: Fix VF set max MTU size Tony Nguyen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-09-19 22:34 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Michal Jaron, netdev, anthony.l.nguyen, Mateusz Palczewski,
	Konrad Jankowski

From: Michal Jaron <michalx.jaron@intel.com>

After setting port VLAN and MTU to 9000 on VF with ice driver there
was an iavf error
"PF returned error -5 (IAVF_ERR_PARAM) to our request 6".

During queue configuration, VF's max packet size was set to
IAVF_MAX_RXBUFFER but on ice max frame size was smaller by VLAN_HLEN
due to making some space for port VLAN as VF is not aware whether it's
in a port VLAN. This mismatch in sizes caused ice to reject queue
configuration with ERR_PARAM error. Proper max_mtu is sent from ice PF
to VF with GET_VF_RESOURCES msg but VF does not look at this.

In iavf change max_frame from IAVF_MAX_RXBUFFER to max_mtu
received from pf with GET_VF_RESOURCES msg to make vf's
max_frame_size dependent from pf. Add check if received max_mtu is
not in eligible range then set it to IAVF_MAX_RXBUFFER.

Fixes: dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximum frame size for Rx")
Signed-off-by: Michal Jaron <michalx.jaron@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/iavf/iavf_virtchnl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
index 15ee85dc33bd..5a9e6563923e 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
@@ -269,11 +269,14 @@ int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter)
 void iavf_configure_queues(struct iavf_adapter *adapter)
 {
 	struct virtchnl_vsi_queue_config_info *vqci;
-	struct virtchnl_queue_pair_info *vqpi;
+	int i, max_frame = adapter->vf_res->max_mtu;
 	int pairs = adapter->num_active_queues;
-	int i, max_frame = IAVF_MAX_RXBUFFER;
+	struct virtchnl_queue_pair_info *vqpi;
 	size_t len;
 
+	if (max_frame > IAVF_MAX_RXBUFFER || !max_frame)
+		max_frame = IAVF_MAX_RXBUFFER;
+
 	if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
 		dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n",
-- 
2.35.1


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

* [PATCH net 3/4] i40e: Fix VF set max MTU size
  2022-09-19 22:34 [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e) Tony Nguyen
  2022-09-19 22:34 ` [PATCH net 1/4] iavf: Fix bad page state Tony Nguyen
  2022-09-19 22:34 ` [PATCH net 2/4] iavf: Fix set max MTU size with port VLAN and jumbo frames Tony Nguyen
@ 2022-09-19 22:34 ` Tony Nguyen
  2022-09-19 22:34 ` [PATCH net 4/4] i40e: Fix set max_tx_rate when it is lower than 1 Mbps Tony Nguyen
  2022-09-22  0:40 ` [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e) patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-09-19 22:34 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Michal Jaron, netdev, anthony.l.nguyen, Mateusz Palczewski,
	Konrad Jankowski

From: Michal Jaron <michalx.jaron@intel.com>

Max MTU sent to VF is set to 0 during memory allocation. It cause
that max MTU on VF is changed to IAVF_MAX_RXBUFFER and does not
depend on data from HW.

Set max_mtu field in virtchnl_vf_resource struct to inform
VF in GET_VF_RESOURCES msg what size should be max frame.

Fixes: dab86afdbbd1 ("i40e/i40evf: Change the way we limit the maximum frame size for Rx")
Signed-off-by: Michal Jaron <michalx.jaron@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>
---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 4f184c50f6e8..7e9f6a69eb10 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2038,6 +2038,25 @@ static void i40e_del_qch(struct i40e_vf *vf)
 	}
 }
 
+/**
+ * i40e_vc_get_max_frame_size
+ * @vf: pointer to the VF
+ *
+ * Max frame size is determined based on the current port's max frame size and
+ * whether a port VLAN is configured on this VF. The VF is not aware whether
+ * it's in a port VLAN so the PF needs to account for this in max frame size
+ * checks and sending the max frame size to the VF.
+ **/
+static u16 i40e_vc_get_max_frame_size(struct i40e_vf *vf)
+{
+	u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size;
+
+	if (vf->port_vlan_id)
+		max_frame_size -= VLAN_HLEN;
+
+	return max_frame_size;
+}
+
 /**
  * i40e_vc_get_vf_resources_msg
  * @vf: pointer to the VF info
@@ -2139,6 +2158,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
 	vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf;
 	vfres->rss_key_size = I40E_HKEY_ARRAY_SIZE;
 	vfres->rss_lut_size = I40E_VF_HLUT_ARRAY_SIZE;
+	vfres->max_mtu = i40e_vc_get_max_frame_size(vf);
 
 	if (vf->lan_vsi_idx) {
 		vfres->vsi_res[0].vsi_id = vf->lan_vsi_id;
-- 
2.35.1


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

* [PATCH net 4/4] i40e: Fix set max_tx_rate when it is lower than 1 Mbps
  2022-09-19 22:34 [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e) Tony Nguyen
                   ` (2 preceding siblings ...)
  2022-09-19 22:34 ` [PATCH net 3/4] i40e: Fix VF set max MTU size Tony Nguyen
@ 2022-09-19 22:34 ` Tony Nguyen
  2022-09-22  0:40 ` [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e) patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-09-19 22:34 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Michal Jaron, netdev, anthony.l.nguyen, Andrii Staikov,
	Bharathi Sreenivas

From: Michal Jaron <michalx.jaron@intel.com>

While converting max_tx_rate from bytes to Mbps, this value was set to 0,
if the original value was lower than 125000 bytes (1 Mbps). This would
cause no transmission rate limiting to occur. This happened due to lack of
check of max_tx_rate against the 1 Mbps value for max_tx_rate and the
following division by 125000. Fix this issue by adding a helper
i40e_bw_bytes_to_mbits() which sets max_tx_rate to minimum usable value of
50 Mbps, if its value is less than 1 Mbps, otherwise do the required
conversion by dividing by 125000.

Fixes: 5ecae4120a6b ("i40e: Refactor VF BW rate limiting")
Signed-off-by: Michal Jaron <michalx.jaron@intel.com>
Signed-off-by: Andrii Staikov <andrii.staikov@intel.com>
Tested-by: Bharathi Sreenivas <bharathi.sreenivas@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 32 +++++++++++++++++----
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 10c1e1ea83a1..e3d9804aeb25 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5908,6 +5908,26 @@ static int i40e_get_link_speed(struct i40e_vsi *vsi)
 	}
 }
 
+/**
+ * i40e_bw_bytes_to_mbits - Convert max_tx_rate from bytes to mbits
+ * @vsi: Pointer to vsi structure
+ * @max_tx_rate: max TX rate in bytes to be converted into Mbits
+ *
+ * Helper function to convert units before send to set BW limit
+ **/
+static u64 i40e_bw_bytes_to_mbits(struct i40e_vsi *vsi, u64 max_tx_rate)
+{
+	if (max_tx_rate < I40E_BW_MBPS_DIVISOR) {
+		dev_warn(&vsi->back->pdev->dev,
+			 "Setting max tx rate to minimum usable value of 50Mbps.\n");
+		max_tx_rate = I40E_BW_CREDIT_DIVISOR;
+	} else {
+		do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR);
+	}
+
+	return max_tx_rate;
+}
+
 /**
  * i40e_set_bw_limit - setup BW limit for Tx traffic based on max_tx_rate
  * @vsi: VSI to be configured
@@ -5930,10 +5950,10 @@ int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate)
 			max_tx_rate, seid);
 		return -EINVAL;
 	}
-	if (max_tx_rate && max_tx_rate < 50) {
+	if (max_tx_rate && max_tx_rate < I40E_BW_CREDIT_DIVISOR) {
 		dev_warn(&pf->pdev->dev,
 			 "Setting max tx rate to minimum usable value of 50Mbps.\n");
-		max_tx_rate = 50;
+		max_tx_rate = I40E_BW_CREDIT_DIVISOR;
 	}
 
 	/* Tx rate credits are in values of 50Mbps, 0 is disabled */
@@ -8224,9 +8244,9 @@ static int i40e_setup_tc(struct net_device *netdev, void *type_data)
 
 	if (i40e_is_tc_mqprio_enabled(pf)) {
 		if (vsi->mqprio_qopt.max_rate[0]) {
-			u64 max_tx_rate = vsi->mqprio_qopt.max_rate[0];
+			u64 max_tx_rate = i40e_bw_bytes_to_mbits(vsi,
+						  vsi->mqprio_qopt.max_rate[0]);
 
-			do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR);
 			ret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate);
 			if (!ret) {
 				u64 credits = max_tx_rate;
@@ -10971,10 +10991,10 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)
 	}
 
 	if (vsi->mqprio_qopt.max_rate[0]) {
-		u64 max_tx_rate = vsi->mqprio_qopt.max_rate[0];
+		u64 max_tx_rate = i40e_bw_bytes_to_mbits(vsi,
+						  vsi->mqprio_qopt.max_rate[0]);
 		u64 credits = 0;
 
-		do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR);
 		ret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate);
 		if (ret)
 			goto end_unlock;
-- 
2.35.1


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

* Re: [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e)
  2022-09-19 22:34 [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e) Tony Nguyen
                   ` (3 preceding siblings ...)
  2022-09-19 22:34 ` [PATCH net 4/4] i40e: Fix set max_tx_rate when it is lower than 1 Mbps Tony Nguyen
@ 2022-09-22  0:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-22  0:40 UTC (permalink / raw)
  To: Tony Nguyen; +Cc: davem, kuba, pabeni, edumazet, netdev

Hello:

This series was applied to netdev/net.git (master)
by Tony Nguyen <anthony.l.nguyen@intel.com>:

On Mon, 19 Sep 2022 15:34:24 -0700 you wrote:
> This series contains updates to iavf and i40e drivers.
> 
> Norbert adds checking of buffer size for Rx buffer checks in iavf.
> 
> Michal corrects setting of max MTU in iavf to account for MTU data provided
> by PF, fixes i40e to set VF max MTU, and resolves lack of rate limiting
> when value was less than divisor for i40e.
> 
> [...]

Here is the summary with links:
  - [net,1/4] iavf: Fix bad page state
    https://git.kernel.org/netdev/net/c/66039eb9015e
  - [net,2/4] iavf: Fix set max MTU size with port VLAN and jumbo frames
    https://git.kernel.org/netdev/net/c/399c98c4dc50
  - [net,3/4] i40e: Fix VF set max MTU size
    https://git.kernel.org/netdev/net/c/372539def282
  - [net,4/4] i40e: Fix set max_tx_rate when it is lower than 1 Mbps
    https://git.kernel.org/netdev/net/c/198eb7e1b81d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-09-22  0:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 22:34 [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e) Tony Nguyen
2022-09-19 22:34 ` [PATCH net 1/4] iavf: Fix bad page state Tony Nguyen
2022-09-19 22:34 ` [PATCH net 2/4] iavf: Fix set max MTU size with port VLAN and jumbo frames Tony Nguyen
2022-09-19 22:34 ` [PATCH net 3/4] i40e: Fix VF set max MTU size Tony Nguyen
2022-09-19 22:34 ` [PATCH net 4/4] i40e: Fix set max_tx_rate when it is lower than 1 Mbps Tony Nguyen
2022-09-22  0:40 ` [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-09-19 (iavf, i40e) patchwork-bot+netdevbpf

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.