[dpdk-dev] [PATCH 12/12] examples/l3fwd: add option to parse ptype
Ananyev, Konstantin
konstantin.ananyev at intel.com
Thu Jan 7 10:44:38 CET 2016
Hi Jianfeng,
> -----Original Message-----
> From: Tan, Jianfeng
> Sent: Thursday, January 07, 2016 1:20 AM
> To: Ananyev, Konstantin; dev at dpdk.org
> Cc: Zhang, Helin
> Subject: Re: [PATCH 12/12] examples/l3fwd: add option to parse ptype
>
>
> Hi Konstantin,
>
> On 1/6/2016 12:49 AM, Ananyev, Konstantin wrote:
> > Hi Jianfeng,
> >
> >>>> +static int
> >>>> +check_packet_type_ok(int portid)
> >>>> +{
> >>>> + int i;
> >>>> + int ret;
> >>>> + uint32_t ptypes[RTE_PTYPE_L3_MAX_NUM];
> >>>> + int ptype_l3_ipv4 = 0, ptype_l3_ipv6 = 0;
> >>>> +
> >>>> + ret = rte_eth_dev_get_ptype_info(portid, RTE_PTYPE_L3_MASK,
> >>> ptypes);
> >>>> + for (i = 0; i < ret; ++i) {
> >>>> + if (ptypes[i] & RTE_PTYPE_L3_IPV4)
> >>>> + ptype_l3_ipv4 = 1;
> >>>> + if (ptypes[i] & RTE_PTYPE_L3_IPV6)
> >>>> + ptype_l3_ipv6 = 1;
> >>>> + }
> >>>> +
> >>>> + if (ptype_l3_ipv4 == 0)
> >>>> + printf("port %d cannot parse RTE_PTYPE_L3_IPV4\n", portid);
> >>>> +
> >>>> + if (ptype_l3_ipv6 == 0)
> >>>> + printf("port %d cannot parse RTE_PTYPE_L3_IPV6\n", portid);
> >>>> +
> >>>> + if (ptype_l3_ipv4 || ptype_l3_ipv6)
> >>>> + return 1;
> >
> > Forgot one thing: I think it should be:
> >
> > if (ptype_l3_ipv4 && ptype_l3_ipv6)
> > return 1;
> > return 0;
> >
> > or just:
> >
> > return ptype_l3_ipv4 && ptype_l3_ipv6;
>
> My original thought is: PMDs, like vmxnet3, fills ptype_l3_ipv4, but not
> ptype_l3_ipv6.
> If we use "&&", then it would add rx callback to parse ptype whether
> ipv4 or ipv6 traffic is comming.
Yes, I think that's how it should be:
If HW can't recognise either IPV4 or IPV6 packets, then SW parsing needs to be done.
l3fwd relies on PMD to recognise both IPV4 and IPV6 packets properly.
If it can recognise only IPV4, then IPV6 traffic will not be forwarded correctly,
and visa-versa.
Konstantin
>
> Thanks,
> Jianfeng
>
> >
> > Konstantin
More information about the dev
mailing list