DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhang, Qi Z" <qi.z.zhang@intel.com>
To: "Xing, Beilei" <beilei.xing@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Wu, Jingjing" <jingjing.wu@intel.com>,
	"Chilikin, Andrey" <andrey.chilikin@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/2] net/i40e: support PPPoE and L2TP ptype parser
Date: Thu, 4 Jan 2018 08:43:53 +0000	[thread overview]
Message-ID: <039ED4275CED7440929022BC67E7061153127A64@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1513758164-39610-3-git-send-email-beilei.xing@intel.com>


> -----Original Message-----
> From: Xing, Beilei
> Sent: Wednesday, December 20, 2017 4:23 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>; Chilikin, Andrey
> <andrey.chilikin@intel.com>
> Subject: [PATCH v2 2/2] net/i40e: support PPPoE and L2TP ptype parser
> 
> This patch adds support for PPPoE and L2TP packet types parser.

The code is ok for me. 
It's better to add more explanation that the naming rule for protocol type has also been changed
For example:  O|IPV4 = IPV4 + !inner_ip

Regards
Qi
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 83
> ++++++++++++++++++++++++++++++------------
>  1 file changed, 60 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 811cc9f..c6f7ce7 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -11078,7 +11078,7 @@ i40e_update_customized_ptype(struct
> rte_eth_dev *dev, uint8_t *pkg,
>  	uint8_t proto_id;
>  	char name[RTE_PMD_I40E_DDP_NAME_SIZE];
>  	uint32_t i, j, n;
> -	bool inner_ip;
> +	bool in_tunnel;
>  	int ret;
> 
>  	/* get information about new ptype num */ @@ -11123,7 +11123,7 @@
> i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
>  	for (i = 0; i < ptype_num; i++) {
>  		ptype_mapping[i].hw_ptype = ptype[i].ptype_id;
>  		ptype_mapping[i].sw_ptype = 0;
> -		inner_ip = false;
> +		in_tunnel = false;
>  		for (j = 0; j < RTE_PMD_I40E_PROTO_NUM; j++) {
>  			proto_id = ptype[i].protocols[j];
>  			if (proto_id == RTE_PMD_I40E_PROTO_UNUSED) @@ -11133,54
> +11133,91 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev,
> uint8_t *pkg,
>  					continue;
>  				memset(name, 0, sizeof(name));
>  				strcpy(name, proto[n].name);
> -				if (!strncmp(name, "IPV4", 4) && !inner_ip) {
> +				if (!strncmp(name, "PPPOE", 5))
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_L2_ETHER_PPPOE;
> +				else if (!strncmp(name, "OIPV4", 5)) {
>  					ptype_mapping[i].sw_ptype |=
>  						RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
> -					inner_ip = true;
> -				} else if (!strncmp(name, "IPV4FRAG", 8) &&
> -					   inner_ip) {
> +					in_tunnel = true;
> +				} else if (!strncmp(name, "IPV4", 4) &&
> +					   !in_tunnel)
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
> +				else if (!strncmp(name, "IPV4FRAG", 8) &&
> +					 in_tunnel) {
>  					ptype_mapping[i].sw_ptype |=
>  					    RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN;
>  					ptype_mapping[i].sw_ptype |=
>  						RTE_PTYPE_INNER_L4_FRAG;
>  				} else if (!strncmp(name, "IPV4", 4) &&
> -					   inner_ip)
> +					   in_tunnel)
>  					ptype_mapping[i].sw_ptype |=
>  					    RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN;
> -				else if (!strncmp(name, "IPV6", 4) &&
> -					 !inner_ip) {
> +				else if (!strncmp(name, "OIPV6", 5)) {
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
> +					in_tunnel = true;
> +				} else if (!strncmp(name, "IPV6", 4) &&
> +					   !in_tunnel)
>  					ptype_mapping[i].sw_ptype |=
>  						RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
> -					inner_ip = true;
> -				} else if (!strncmp(name, "IPV6FRAG", 8) &&
> -					   inner_ip) {
> +				else if (!strncmp(name, "IPV6FRAG", 8) &&
> +					 in_tunnel) {
>  					ptype_mapping[i].sw_ptype |=
>  					    RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN;
>  					ptype_mapping[i].sw_ptype |=
>  						RTE_PTYPE_INNER_L4_FRAG;
>  				} else if (!strncmp(name, "IPV6", 4) &&
> -					   inner_ip)
> +					   in_tunnel)
>  					ptype_mapping[i].sw_ptype |=
>  					    RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN;
> -				else if (!strncmp(name, "GTPC", 4))
> +				else if (!strncmp(name, "UDP", 3) && !in_tunnel)
>  					ptype_mapping[i].sw_ptype |=
> -						RTE_PTYPE_TUNNEL_GTPC;
> -				else if (!strncmp(name, "GTPU", 4))
> -					ptype_mapping[i].sw_ptype |=
> -						RTE_PTYPE_TUNNEL_GTPU;
> -				else if (!strncmp(name, "UDP", 3))
> +						RTE_PTYPE_L4_UDP;
> +				else if (!strncmp(name, "UDP", 3) && in_tunnel)
>  					ptype_mapping[i].sw_ptype |=
>  						RTE_PTYPE_INNER_L4_UDP;
> -				else if (!strncmp(name, "TCP", 3))
> +				else if (!strncmp(name, "TCP", 3) && !in_tunnel)
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_L4_TCP;
> +				else if (!strncmp(name, "TCP", 3) && in_tunnel)
>  					ptype_mapping[i].sw_ptype |=
>  						RTE_PTYPE_INNER_L4_TCP;
> -				else if (!strncmp(name, "SCTP", 4))
> +				else if (!strncmp(name, "SCTP", 4) &&
> +					 !in_tunnel)
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_L4_SCTP;
> +				else if (!strncmp(name, "SCTP", 4) && in_tunnel)
>  					ptype_mapping[i].sw_ptype |=
>  						RTE_PTYPE_INNER_L4_SCTP;
> -				else if (!strncmp(name, "ICMP", 4) ||
> -					 !strncmp(name, "ICMPV6", 6))
> +				else if ((!strncmp(name, "ICMP", 4) ||
> +					  !strncmp(name, "ICMPV6", 6)) &&
> +					 !in_tunnel)
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_L4_ICMP;
> +				else if ((!strncmp(name, "ICMP", 4) ||
> +					  !strncmp(name, "ICMPV6", 6)) &&
> +					 in_tunnel)
>  					ptype_mapping[i].sw_ptype |=
>  						RTE_PTYPE_INNER_L4_ICMP;
> +				else if (!strncmp(name, "GTPC", 4)) {
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_TUNNEL_GTPC;
> +					in_tunnel = true;
> +				} else if (!strncmp(name, "GTPU", 4)) {
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_TUNNEL_GTPU;
> +					in_tunnel = true;
> +				} else if (!strncmp(name, "GRENAT", 6)) {
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_TUNNEL_GRENAT;
> +					in_tunnel = true;
> +				} else if (!strncmp(name, "L2TPv2CTL", 9)) {
> +					ptype_mapping[i].sw_ptype |=
> +						RTE_PTYPE_TUNNEL_L2TP;
> +					in_tunnel = true;
> +				}
> 
>  				break;
>  			}
> --
> 2.5.5

  reply	other threads:[~2018-01-04  8:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 10:12 [dpdk-dev] [PATCH 0/2] support PPPoE and L2TP in SW " Beilei Xing
2017-11-28 10:12 ` [dpdk-dev] [PATCH 1/2] mbuf: support PPPoE and L2TP in software packet type parser Beilei Xing
2017-12-19 10:11   ` Olivier MATZ
2017-12-20  3:13     ` Xing, Beilei
2017-11-28 10:12 ` [dpdk-dev] [PATCH 2/2] net/i40e: support PPPoE and L2TP in SW ptype parser function Beilei Xing
2017-12-20  8:22 ` [dpdk-dev] [PATCH v2 0/2] support PPPoE and L2TP packet types Beilei Xing
2017-12-20  8:22   ` [dpdk-dev] [PATCH v2 1/2] mbuf: add " Beilei Xing
2018-01-03 10:36     ` Olivier Matz
2017-12-20  8:22   ` [dpdk-dev] [PATCH v2 2/2] net/i40e: support PPPoE and L2TP ptype parser Beilei Xing
2018-01-04  8:43     ` Zhang, Qi Z [this message]
2018-01-04 10:46   ` [dpdk-dev] [PATCH v3 0/2] support PPPoE and L2TP packet types Beilei Xing
2018-01-04 10:46     ` [dpdk-dev] [PATCH v3 1/2] mbuf: add " Beilei Xing
2018-01-04 10:46     ` [dpdk-dev] [PATCH v3 2/2] net/i40e: improve packet type parser Beilei Xing
2018-01-04 11:54       ` Zhang, Qi Z
2018-01-07  9:16     ` [dpdk-dev] [PATCH v3 0/2] support PPPoE and L2TP packet types Zhang, Helin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=039ED4275CED7440929022BC67E7061153127A64@SHSMSX103.ccr.corp.intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=andrey.chilikin@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).