* [dpdk-dev] [PATCH v1] net/iavf: fix unsupported VLAN offload requested
@ 2021-01-25 4:30 Haiyue Wang
2021-01-26 3:24 ` Zhang, Qi Z
0 siblings, 1 reply; 2+ messages in thread
From: Haiyue Wang @ 2021-01-25 4:30 UTC (permalink / raw)
To: dev; +Cc: qiming.yang, qi.z.zhang, Haiyue Wang, Jingjing Wu, Beilei Xing
If the underlying PF doesn't support a specific ethertype or the ability
to toggle VLAN insertion and/or stripping, then the VF prevents sending
an invalid message to the PF.
Fixes: 1c301e8c3cff ("net/iavf: support new VLAN capabilities")
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
drivers/net/iavf/iavf_vchnl.c | 36 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index c82925eceb..9b8c4d113a 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -528,23 +528,21 @@ int
iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
- struct virtchnl_vlan_supported_caps *supported_caps;
+ struct virtchnl_vlan_supported_caps *stripping_caps;
struct virtchnl_vlan_setting vlan_strip;
struct iavf_cmd_info args;
- uint32_t stripping_caps;
uint32_t *ethertype;
int ret;
- supported_caps = &vf->vlan_v2_caps.offloads.stripping_support;
- if (supported_caps->outer) {
- stripping_caps = supported_caps->outer;
+ stripping_caps = &vf->vlan_v2_caps.offloads.stripping_support;
+
+ if ((stripping_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) &&
+ (stripping_caps->outer & VIRTCHNL_VLAN_TOGGLE))
ethertype = &vlan_strip.outer_ethertype_setting;
- } else {
- stripping_caps = supported_caps->inner;
+ else if ((stripping_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100) &&
+ (stripping_caps->inner & VIRTCHNL_VLAN_TOGGLE))
ethertype = &vlan_strip.inner_ethertype_setting;
- }
-
- if (!(stripping_caps & VIRTCHNL_VLAN_ETHERTYPE_8100))
+ else
return -ENOTSUP;
memset(&vlan_strip, 0, sizeof(vlan_strip));
@@ -570,23 +568,21 @@ int
iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
- struct virtchnl_vlan_supported_caps *supported_caps;
+ struct virtchnl_vlan_supported_caps *insertion_caps;
struct virtchnl_vlan_setting vlan_insert;
struct iavf_cmd_info args;
- uint32_t insertion_caps;
uint32_t *ethertype;
int ret;
- supported_caps = &vf->vlan_v2_caps.offloads.insertion_support;
- if (supported_caps->outer) {
- insertion_caps = supported_caps->outer;
+ insertion_caps = &vf->vlan_v2_caps.offloads.insertion_support;
+
+ if ((insertion_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) &&
+ (insertion_caps->outer & VIRTCHNL_VLAN_TOGGLE))
ethertype = &vlan_insert.outer_ethertype_setting;
- } else {
- insertion_caps = supported_caps->inner;
+ else if ((insertion_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100) &&
+ (insertion_caps->inner & VIRTCHNL_VLAN_TOGGLE))
ethertype = &vlan_insert.inner_ethertype_setting;
- }
-
- if (!(insertion_caps & VIRTCHNL_VLAN_ETHERTYPE_8100))
+ else
return -ENOTSUP;
memset(&vlan_insert, 0, sizeof(vlan_insert));
--
2.30.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/iavf: fix unsupported VLAN offload requested
2021-01-25 4:30 [dpdk-dev] [PATCH v1] net/iavf: fix unsupported VLAN offload requested Haiyue Wang
@ 2021-01-26 3:24 ` Zhang, Qi Z
0 siblings, 0 replies; 2+ messages in thread
From: Zhang, Qi Z @ 2021-01-26 3:24 UTC (permalink / raw)
To: Wang, Haiyue, dev; +Cc: Yang, Qiming, Wu, Jingjing, Xing, Beilei
> -----Original Message-----
> From: Wang, Haiyue <haiyue.wang@intel.com>
> Sent: Monday, January 25, 2021 12:31 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>; Wu,
> Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Subject: [PATCH v1] net/iavf: fix unsupported VLAN offload requested
>
> If the underlying PF doesn't support a specific ethertype or the ability to toggle
> VLAN insertion and/or stripping, then the VF prevents sending an invalid
> message to the PF.
>
> Fixes: 1c301e8c3cff ("net/iavf: support new VLAN capabilities")
>
> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> ---
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-26 3:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 4:30 [dpdk-dev] [PATCH v1] net/iavf: fix unsupported VLAN offload requested Haiyue Wang
2021-01-26 3:24 ` Zhang, Qi Z
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).