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

Wang, Haiyue haiyue.wang at intel.com
Thu Nov 12 02:57:44 CET 2020


> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit at intel.com>
> Sent: Thursday, November 12, 2020 00:04
> To: Guo, Jia <jia.guo at intel.com>; Wang, Haiyue <haiyue.wang at intel.com>
> Cc: Jiawen Wu <jiawenwu at trustnetic.com>; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 06/37] net/txgbe: add ethertype parse rule
> 
> 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?

Yes, I think "mac compare is unsupported" should be kept, the "ethertype filter" should
be removed, to align to 'RTE_ETHTYPE_FLAGS_MAC' definition:

#define RTE_ETHTYPE_FLAGS_MAC    0x0001 /**< If set, compare mac */


More information about the dev mailing list