X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fiavf%2Fiavf_vchnl.c;h=aae5b900bb91a4b301cb5acada92679f9e72bb82;hb=f971b7d3013d53a5d911b8c5cf51ab55946253b0;hp=8add88898727da659b9ebec6a381418f2461cd10;hpb=df96fd0d73955bdc7ca3909e772ff2ad903249c6;p=dpdk.git diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 8add888987..aae5b900bb 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -528,28 +528,26 @@ 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_offload vlan_strip; + struct virtchnl_vlan_supported_caps *stripping_caps; + struct virtchnl_vlan_setting vlan_strip; struct iavf_cmd_info args; - uint32_t stripping_caps; - uint32_t *vlan_setting; + uint32_t *ethertype; int ret; - supported_caps = &vf->vlan_v2_caps.offloads.stripping_support; - if (supported_caps->outer) { - stripping_caps = supported_caps->outer; - vlan_setting = &vlan_strip.outer_ethertype_setting; - } else { - stripping_caps = supported_caps->inner; - vlan_setting = &vlan_strip.inner_ethertype_setting; - } + stripping_caps = &vf->vlan_v2_caps.offloads.stripping_support; - if (!(stripping_caps & VIRTCHNL_VLAN_ETHERTYPE_8100)) + if ((stripping_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) && + (stripping_caps->outer & VIRTCHNL_VLAN_TOGGLE)) + ethertype = &vlan_strip.outer_ethertype_setting; + else if ((stripping_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100) && + (stripping_caps->inner & VIRTCHNL_VLAN_TOGGLE)) + ethertype = &vlan_strip.inner_ethertype_setting; + else return -ENOTSUP; memset(&vlan_strip, 0, sizeof(vlan_strip)); vlan_strip.vport_id = vf->vsi_res->vsi_id; - *vlan_setting = VIRTCHNL_VLAN_ETHERTYPE_8100; + *ethertype = VIRTCHNL_VLAN_ETHERTYPE_8100; args.ops = enable ? VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2 : VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2; @@ -570,28 +568,26 @@ 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_offload vlan_insert; + struct virtchnl_vlan_supported_caps *insertion_caps; + struct virtchnl_vlan_setting vlan_insert; struct iavf_cmd_info args; - uint32_t insertion_caps; - uint32_t *vlan_setting; + uint32_t *ethertype; int ret; - supported_caps = &vf->vlan_v2_caps.offloads.insertion_support; - if (supported_caps->outer) { - insertion_caps = supported_caps->outer; - vlan_setting = &vlan_insert.outer_ethertype_setting; - } else { - insertion_caps = supported_caps->inner; - vlan_setting = &vlan_insert.inner_ethertype_setting; - } + insertion_caps = &vf->vlan_v2_caps.offloads.insertion_support; - if (!(insertion_caps & VIRTCHNL_VLAN_ETHERTYPE_8100)) + if ((insertion_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) && + (insertion_caps->outer & VIRTCHNL_VLAN_TOGGLE)) + ethertype = &vlan_insert.outer_ethertype_setting; + else if ((insertion_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100) && + (insertion_caps->inner & VIRTCHNL_VLAN_TOGGLE)) + ethertype = &vlan_insert.inner_ethertype_setting; + else return -ENOTSUP; memset(&vlan_insert, 0, sizeof(vlan_insert)); vlan_insert.vport_id = vf->vsi_res->vsi_id; - *vlan_setting = VIRTCHNL_VLAN_ETHERTYPE_8100; + *ethertype = VIRTCHNL_VLAN_ETHERTYPE_8100; args.ops = enable ? VIRTCHNL_OP_ENABLE_VLAN_INSERTION_V2 : VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2;