net/iavf: support to config VLAN filter
PATCH 1/1 net/iavf: support to config VLAN filter
Add the VLAN filtering enable/disable configuration according to the VF successfully negotiated that capability with PF.
Signed-off-by Haiyue Wang <[email protected]>
--- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_ethdev.c | 7 ++++++ drivers/net/iavf/iavf_vchnl.c | 40 ++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+)
drivers/net/iavf/iavf.h +1 -0
@@ -314,6 +314,7 @@ int iavf_configure_queues(struct iavf_adapter *adapter,int iavf_get_supported_rxdid (struct iavf_adapter *adapter);int iavf_config_vlan_strip_v2 (struct iavf_adapter *adapter,bool enable);int iavf_config_vlan_insert_v2 (struct iavf_adapter *adapter,bool enable); +int iavf_config_vlan_filter_v2 (struct iavf_adapter *adapter,bool enable);int iavf_add_del_vlan_v2 (struct iavf_adapter *adapter,uint16_t vlanid,bool add);int iavf_get_vlan_offload_caps_v2 (struct iavf_adapter *adapter);
drivers/net/iavf/iavf_ethdev.c +7 -0
@@ -1086,6 +1086,13 @@ iavf_dev_vlan_offload_set_v2(struct rte_eth_dev *dev, int mask) enable = !!(rxmode->offloads &DEV_RX_OFFLOAD_VLAN_FILTER );iavf_iterate_vlan_filters_v2 (dev, enable); + + err =iavf_config_vlan_filter_v2 (adapter, enable); +/* If not support, the filtering is already disabled by PF */ +if (err == -ENOTSUP && !enable) + err =0 ; +if (err) +return -EIO ; }if (mask Ð_VLAN_STRIP_MASK ) {
drivers/net/iavf/iavf_vchnl.c +40 -0
@@ -604,6 +604,46 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)return ret; } +int +iavf_config_vlan_filter_v2 (struct iavf_adapter *adapter,bool enable) +{ +struct iavf_info *vf =IAVF_DEV_PRIVATE_TO_VF (adapter); +struct virtchnl_vlan_supported_caps *filtering_caps; +struct virtchnl_vlan_setting vlan_filter; +struct iavf_cmd_info args; +uint32_t *ethertype; +int ret; + + filtering_caps = &vf->vlan_v2_caps.filtering.filtering_support; + +if ((filtering_caps->outer &VIRTCHNL_VLAN_ETHERTYPE_8100 ) && + (filtering_caps->outer &VIRTCHNL_VLAN_TOGGLE )) + ethertype = &vlan_filter.outer_ethertype_setting; +else if ((filtering_caps->inner &VIRTCHNL_VLAN_ETHERTYPE_8100 ) && + (filtering_caps->inner &VIRTCHNL_VLAN_TOGGLE )) + ethertype = &vlan_filter.inner_ethertype_setting; +else +return -ENOTSUP ; + +memset (&vlan_filter,0 ,sizeof (vlan_filter)); + vlan_filter.vport_id = vf->vsi_res->vsi_id; + *ethertype =VIRTCHNL_VLAN_ETHERTYPE_8100 ; + + args.ops = enable ?VIRTCHNL_OP_ENABLE_VLAN_FILTERING_V2 : +VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2 ; + args.in_args = (uint8_t *)&vlan_filter; + args.in_args_size =sizeof (vlan_filter); + args.out_buffer = vf->aq_resp; + args.out_size =IAVF_AQ_BUF_SZ ; + ret =iavf_execute_vf_cmd (adapter, &args); +if (ret) +PMD_DRV_LOG (ERR ,"fail to execute command %s" , + enable ?"VIRTCHNL_OP_ENABLE_VLAN_FILTERING_V2" : +"VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2" ); + +return ret; +} +int iavf_add_del_vlan_v2 (struct iavf_adapter *adapter,uint16_t vlanid,bool add) {
Signature · 1 line
2.30.0