All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net v2 0/2] Fix vf set max mtu size with port vlan and jumbo frames
@ 2022-09-13 13:38 Mateusz Palczewski
  2022-09-13 13:38 ` [Intel-wired-lan] [PATCH net v2 1/2] iavf: " Mateusz Palczewski
  2022-09-13 13:38 ` [Intel-wired-lan] [PATCH net v2 2/2] i40e: Fix vf set max mtu size Mateusz Palczewski
  0 siblings, 2 replies; 5+ messages in thread
From: Mateusz Palczewski @ 2022-09-13 13:38 UTC (permalink / raw)
  To: intel-wired-lan

Fix "PF returned error -5 (IAVF_ERR_PARAM) to our request 6" error and
possible page_frag_cache_drain crashes that is a result of this error
when port vlan and jumbo frames are set on vf .

---
 v2: Fixed one check regarding !max_frame
---

Michal Jaron (2):
  iavf: Fix vf set max mtu size with port vlan and jumbo frames
  i40e: Fix vf set max mtu size

 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 20 +++++++++++++++++++
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  7 +++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

-- 
2.25.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* [Intel-wired-lan] [PATCH net v2 1/2] iavf: Fix vf set max mtu size with port vlan and jumbo frames
  2022-09-13 13:38 [Intel-wired-lan] [PATCH net v2 0/2] Fix vf set max mtu size with port vlan and jumbo frames Mateusz Palczewski
@ 2022-09-13 13:38 ` Mateusz Palczewski
  2022-09-19  6:25   ` Jankowski, Konrad0
  2022-09-13 13:38 ` [Intel-wired-lan] [PATCH net v2 2/2] i40e: Fix vf set max mtu size Mateusz Palczewski
  1 sibling, 1 reply; 5+ messages in thread
From: Mateusz Palczewski @ 2022-09-13 13:38 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Michal Jaron

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

After setting port vlan and mtu 9000 on vf with ice driver there
was an iavf error
"PF returned error -5 (IAVF_ERR_PARAM) to our request 6".
It was caused by that during queues 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 missmatch in sizes
caused that ice rejects queues configuration with ERR_PARAM error.
Proper max_mtu is send 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>
---
 v2: Fixed one check regarding !max_frame
---
 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.25.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* [Intel-wired-lan] [PATCH net v2 2/2] i40e: Fix vf set max mtu size
  2022-09-13 13:38 [Intel-wired-lan] [PATCH net v2 0/2] Fix vf set max mtu size with port vlan and jumbo frames Mateusz Palczewski
  2022-09-13 13:38 ` [Intel-wired-lan] [PATCH net v2 1/2] iavf: " Mateusz Palczewski
@ 2022-09-13 13:38 ` Mateusz Palczewski
  2022-09-19  6:23   ` Jankowski, Konrad0
  1 sibling, 1 reply; 5+ messages in thread
From: Mateusz Palczewski @ 2022-09-13 13:38 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Michal Jaron

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>
---
 v2: Fixed one check regarding !max_frame
---
 .../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.25.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net v2 2/2] i40e: Fix vf set max mtu size
  2022-09-13 13:38 ` [Intel-wired-lan] [PATCH net v2 2/2] i40e: Fix vf set max mtu size Mateusz Palczewski
@ 2022-09-19  6:23   ` Jankowski, Konrad0
  0 siblings, 0 replies; 5+ messages in thread
From: Jankowski, Konrad0 @ 2022-09-19  6:23 UTC (permalink / raw)
  To: Palczewski, Mateusz, intel-wired-lan; +Cc: Jaron, MichalX



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Mateusz Palczewski
> Sent: Tuesday, September 13, 2022 3:39 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Jaron, MichalX <michalx.jaron@intel.com>
> Subject: [Intel-wired-lan] [PATCH net v2 2/2] i40e: Fix vf set max mtu size
> 
> 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>
> ---
>  v2: Fixed one check regarding !max_frame
> ---
>  .../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

Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net v2 1/2] iavf: Fix vf set max mtu size with port vlan and jumbo frames
  2022-09-13 13:38 ` [Intel-wired-lan] [PATCH net v2 1/2] iavf: " Mateusz Palczewski
@ 2022-09-19  6:25   ` Jankowski, Konrad0
  0 siblings, 0 replies; 5+ messages in thread
From: Jankowski, Konrad0 @ 2022-09-19  6:25 UTC (permalink / raw)
  To: Palczewski, Mateusz, intel-wired-lan; +Cc: Jaron, MichalX



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Mateusz Palczewski
> Sent: Tuesday, September 13, 2022 3:39 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Jaron, MichalX <michalx.jaron@intel.com>
> Subject: [Intel-wired-lan] [PATCH net v2 1/2] iavf: Fix vf set max mtu size
> with port vlan and jumbo frames
> 
> From: Michal Jaron <michalx.jaron@intel.com>
> 
> After setting port vlan and mtu 9000 on vf with ice driver there was an iavf
> error "PF returned error -5 (IAVF_ERR_PARAM) to our request 6".
> It was caused by that during queues 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 missmatch in sizes caused that ice rejects
> queues configuration with ERR_PARAM error.
> Proper max_mtu is send 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>
> ---
>  v2: Fixed one check regarding !max_frame
> ---
>  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)  {

Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

end of thread, other threads:[~2022-09-19  6:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 13:38 [Intel-wired-lan] [PATCH net v2 0/2] Fix vf set max mtu size with port vlan and jumbo frames Mateusz Palczewski
2022-09-13 13:38 ` [Intel-wired-lan] [PATCH net v2 1/2] iavf: " Mateusz Palczewski
2022-09-19  6:25   ` Jankowski, Konrad0
2022-09-13 13:38 ` [Intel-wired-lan] [PATCH net v2 2/2] i40e: Fix vf set max mtu size Mateusz Palczewski
2022-09-19  6:23   ` Jankowski, Konrad0

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.