DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Liu, Jijiang" <jijiang.liu@intel.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v5 4/8]librte_ether:add a common filter API
Date: Fri, 17 Oct 2014 06:53:13 +0000	[thread overview]
Message-ID: <1ED644BD7E0A5F4091CF203DAFB8E4CC01D776DD@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1584946.LFzgr7T2Dy@xps13>



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, October 17, 2014 4:10 AM
> To: Liu, Jijiang
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 4/8]librte_ether:add a common filter API
> 
> I don't review the common API as it should be done in an unique place and
> there are many copies in different patchsets. Let's focus on tunnels.
> 
> 2014-10-11 13:55, Jijiang Liu:
> > +/**** TUNNEL FILTER DATA DEFINATION *** */
> 
> We cannot miss this comment :)
> 
> > +#define ETH_TUNNEL_FILTER_OMAC  0x01
> > +#define ETH_TUNNEL_FILTER_OIP   0x02
> > +#define ETH_TUNNEL_FILTER_TENID 0x04
> > +#define ETH_TUNNEL_FILTER_IMAC  0x08
> > +#define ETH_TUNNEL_FILTER_IVLAN 0x10
> > +#define ETH_TUNNEL_FILTER_IIP   0x20
> > +
> > +#define RTE_TUNNEL_FLAGS_TO_QUEUE 1
> 
> These values requires some comments.
OK, add comments for these MACROs
> > +/*
> > + * Tunneled filter type
> > + */
> > +enum rte_tunnel_filter_type {
> > +	RTE_TUNNEL_FILTER_TYPE_NONE = 0,
> > +	RTE_TUNNEL_FILTER_OIP = ETH_TUNNEL_FILTER_OIP,
> > +	RTE_TUNNEL_FILTER_IMAC_IVLAN =
> > +		ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_IVLAN,
> > +	RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID =
> > +		ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_IVLAN |
> > +		ETH_TUNNEL_FILTER_TENID,
> > +	RTE_TUNNEL_FILTER_IMAC_TENID =
> > +		ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_TENID,
> > +	RTE_TUNNEL_FILTER_IMAC = ETH_TUNNEL_FILTER_IMAC,
> > +	RTE_TUNNEL_FILTER_OMAC_TENID_IMAC =
> > +		ETH_TUNNEL_FILTER_OMAC | ETH_TUNNEL_FILTER_TENID |
> > +		ETH_TUNNEL_FILTER_IMAC,
> > +	RTE_TUNNEL_FILTER_IIP = ETH_TUNNEL_FILTER_IIP,
> > +	RTE_TUNNEL_FILTER_TYPE_MAX,
> > +};
> 
> It's absolutely impossible to understand. Keep in mind the first goal of an
> API: be used (which imply to be understood by users).
> And I really don't understand why you define values for combination of
> previous flags. Please, keep it simple.

The goal of defining values for combination of filter type in order to easily distinguish/check if the mandatory parameters are valid for a specific filter type,
for example, if the filter type is RTE_TUNNEL_FILTER_IMAC_IVLAN,  we just need to check if the inner MAC address and inner VLAN ID are valid.
To limit sanity checks to valid parameters the rte_tunnel_filter_type enumeration can be replaced/initialized by bit mask.

Furthermore, please look at i40e_tunnel_filter_param_check () function in "[PATCH v5 5/8]i40e:implement API of VxLAN packet filter in librte_pmd_i40e" patch.
static int
+i40e_tunnel_filter_param_check(struct i40e_pf *pf,
+			struct rte_eth_tunnel_filter_conf *filter) {
+    ...

+	if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) &&
+		(is_zero_ether_addr(filter->outer_mac))) {
+		PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address\n");
+		return -EINVAL;
+	}
+
+	if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) &&
+		(is_zero_ether_addr(filter->inner_mac))) {
+		PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}

Actually, If you really don't like rte_tunnel_filter_type definition style, and I can change it.

 
> --
> Thomas

  reply	other threads:[~2014-10-17  6:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-11  5:55 [dpdk-dev] [PATCH v5 0/8]Support VxLAN on Fortville Jijiang Liu
2014-10-11  5:55 ` [dpdk-dev] [PATCH v5 1/8]i40e:support VxLAN packet identification in librte_ether Jijiang Liu
2014-10-16 17:07   ` Thomas Monjalon
2014-10-11  5:55 ` [dpdk-dev] [PATCH v5 2/8]i40e:support VxLAN packet identification in librte_pmd_i40e Jijiang Liu
2014-10-13 16:12   ` De Lara Guarch, Pablo
2014-10-16 10:19     ` De Lara Guarch, Pablo
2014-10-16 19:56   ` Thomas Monjalon
2014-10-17  5:58     ` Liu, Jijiang
2014-10-17  7:39       ` Thomas Monjalon
2014-10-20  1:25         ` Liu, Jijiang
2014-10-11  5:55 ` [dpdk-dev] [PATCH v5 3/8]app/test-pmd:test VxLAN packet identification Jijiang Liu
2014-10-16 20:01   ` Thomas Monjalon
2014-10-17  5:23     ` Liu, Jijiang
2014-10-17  7:41       ` Thomas Monjalon
2014-10-11  5:55 ` [dpdk-dev] [PATCH v5 4/8]librte_ether:add a common filter API Jijiang Liu
2014-10-15 16:01   ` De Lara Guarch, Pablo
2014-10-16  1:24     ` Liu, Jijiang
2014-10-16 12:41   ` De Lara Guarch, Pablo
2014-10-16 20:09   ` Thomas Monjalon
2014-10-17  6:53     ` Liu, Jijiang [this message]
2014-10-17  7:47       ` Thomas Monjalon
2014-10-20  1:22         ` Liu, Jijiang
2014-10-11  5:55 ` [dpdk-dev] [PATCH v5 5/8]i40e:implement API of VxLAN packet filter in librte_pmd_i40e Jijiang Liu
2014-10-11  5:55 ` [dpdk-dev] [PATCH v5 6/8]app/testpmd:test VxLAN packet filter API Jijiang Liu
2014-10-11  5:55 ` [dpdk-dev] [PATCH v5 7/8]i40e:support VxLAN Tx checksum offload Jijiang Liu
2014-10-16 20:34   ` Thomas Monjalon
2014-10-17  5:20     ` Liu, Jijiang
2014-10-11  5:55 ` [dpdk-dev] [PATCH v5 8/8]app/testpmd:test " Jijiang Liu
2014-10-11  7:28 ` [dpdk-dev] [PATCH v5 0/8]Support VxLAN on Fortville Liu, Yong
2014-10-11  7:56   ` Liu, Yong
2014-10-16 20:18     ` Thomas Monjalon

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=1ED644BD7E0A5F4091CF203DAFB8E4CC01D776DD@SHSMSX101.ccr.corp.intel.com \
    --to=jijiang.liu@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.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).