[dpdk-dev] [PATCH v2 06/37] net/txgbe: add ethertype parse rule

Ferruh Yigit ferruh.yigit at intel.com
Wed Nov 11 17:04:25 CET 2020


On 11/11/2020 4:02 PM, Ferruh Yigit wrote:
> On 11/11/2020 6:49 AM, Jiawen Wu wrote:
>> Add support to parse flow for ethertype filter.
>>
>> Signed-off-by: Jiawen Wu <jiawenwu at trustnetic.com>
> 
> <...>
> 
>> +static int
>> +txgbe_parse_ethertype_filter(struct rte_eth_dev *dev,
>> +                 const struct rte_flow_attr *attr,
>> +                 const struct rte_flow_item pattern[],
>> +                 const struct rte_flow_action actions[],
>> +                 struct rte_eth_ethertype_filter *filter,
>> +                 struct rte_flow_error *error)
>> +{
>> +    int ret;
>> +
>> +    ret = cons_parse_ethertype_filter(attr, pattern,
>> +                    actions, filter, error);
>> +
>> +    if (ret)
>> +        return ret;
>> +
>> +    /* txgbe doesn't support MAC address. */
>> +    if (filter->flags & RTE_ETHTYPE_FLAGS_MAC) {
>> +        memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
>> +        rte_flow_error_set(error, EINVAL,
>> +            RTE_FLOW_ERROR_TYPE_ITEM,
>> +            NULL, "Not supported by ethertype filter");
>> +        return -rte_errno;
>> +    }
>> +
>> +    if (filter->queue >= dev->data->nb_rx_queues) {
>> +        memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
>> +        rte_flow_error_set(error, EINVAL,
>> +            RTE_FLOW_ERROR_TYPE_ITEM,
>> +            NULL, "queue index much too big");
>> +        return -rte_errno;
>> +    }
>> +
>> +    if (filter->ether_type == RTE_ETHER_TYPE_IPV4 ||
>> +        filter->ether_type == RTE_ETHER_TYPE_IPV6) {
>> +        memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
>> +        rte_flow_error_set(error, EINVAL,
>> +            RTE_FLOW_ERROR_TYPE_ITEM,
>> +            NULL, "IPv4/IPv6 not supported by ethertype filter");
>> +        return -rte_errno;
>> +    }
>> +
>> +    if (filter->flags & RTE_ETHTYPE_FLAGS_MAC) {
>> +        memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
>> +        rte_flow_error_set(error, EINVAL,
>> +            RTE_FLOW_ERROR_TYPE_ITEM,
>> +            NULL, "mac compare is unsupported");
>> +        return -rte_errno;
>> +    }
> 
> Isn't 'RTE_ETHTYPE_FLAGS_MAC' already checked a few blocks above, that time 
> error message was ""Not supported by ethertype filter"
> 

Hi Jia, Haiyue,

Same exists in the ixgbe driver, this how end up in the txgbe, can you please check?



More information about the dev mailing list