DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Pascal Mazon <pascal.mazon@6wind.com>, keith.wiles@intel.com
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v5 4/4] net/tap: add basic flow API patterns and actions
Date: Tue, 21 Mar 2017 17:10:22 +0000	[thread overview]
Message-ID: <75248f99-c164-9399-049c-6529d5255978@intel.com> (raw)
In-Reply-To: <ba4b4f0ee102f38a2746624d1f17b54b26afd210.1489589508.git.pascal.mazon@6wind.com>

On 3/15/2017 2:54 PM, Pascal Mazon wrote:
> Supported flow rules are now mapped to TC rules on the tap netdevice.
> The netlink message used for creating the TC rule is stored in struct
> rte_flow. That way, by simply changing a metadata in it, we can require
> for the rule deletion without further parsing.
> 
> Supported items:
> - eth: src and dst (with variable masks), and eth_type (0xffff mask).
> - vlan: vid, pcp, tpid, but not eid.
> - ipv4/6: src and dst (with variable masks), and ip_proto (0xffff mask).
> - udp/tcp: src and dst port (0xffff) mask.
> 
> Supported actions:
> - DROP
> - QUEUE
> - PASSTHRU
> 
> It is generally not possible to provide a "last" item. However, if the
> "last" item, once masked, is identical to the masked spec, then it is
> supported.
> 
> Only IPv4/6 and MAC addresses can use a variable mask. All other
> items need a full mask (exact match).
> 
> Support for VLAN requires kernel headers >= 4.9, checked using
> auto-config.sh.
> 
> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
> Acked-by: Olga Shern <olgas@mellanox.com>

<...>

> +/**
> + * Set a unique handle in a flow.
> + *
> + * The kernel supports TC rules with equal priority, as long as they use the
> + * same matching fields (e.g.: dst mac and ipv4) with different values (and
> + * full mask to ensure no collision is possible).
> + * In those rules, the handle (uint32_t) is the part that would identify
> + * specifically each rule.
> + *
> + * On 32-bit architectures, the handle can simply be the flow's pointer address.
> + * On 64-bit architectures, we rely on jhash(flow) to find a (sufficiently)
> + * unique handle.
> + *
> + * @param[in, out] flow
> + *   The flow that needs its handle set.
> + */
> +static void
> +tap_flow_set_handle(struct rte_flow *flow)
> +{
> +	uint32_t handle = 0;
> +
> +#if !defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8
> +	handle = rte_jhash(&flow, sizeof(flow), 1);
> +#else
> +	if (sizeof(flow) == 4) {
> +		/* 32-bits arch */
> +		uint64_t h = (uint64_t)flow;

This line is causing build error for i686 target:

.../drivers/net/tap/tap_flow.c: In function ‘tap_flow_set_handle’:
.../drivers/net/tap/tap_flow.c:917:16:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
   uint64_t h = (uint64_t)flow;
                ^

> +
> +		handle = (uint32_t)h;
> +	} else {
> +		handle = rte_jhash(&flow, sizeof(flow), 1);
> +	}
> +#endif
> +	/* must be at least 1 to avoid letting the kernel choose one for us */
> +	if (!handle)
> +		handle = 1;
> +	flow->msg.t.tcm_handle = handle;
>  }

<...>

  reply	other threads:[~2017-03-21 17:10 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 10:45 [dpdk-dev] [PATCH 0/4] net/tap: support flow API Pascal Mazon
2017-03-03 10:45 ` [dpdk-dev] [PATCH 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-03 15:38   ` Wiles, Keith
2017-03-06 14:18     ` Pascal Mazon
2017-03-06 14:51       ` Wiles, Keith
2017-03-03 10:45 ` [dpdk-dev] [PATCH 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-03 10:45 ` [dpdk-dev] [PATCH 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-03 10:45 ` [dpdk-dev] [PATCH 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-03 15:47   ` Wiles, Keith
2017-03-06 14:22     ` Pascal Mazon
2017-03-03 15:54 ` [dpdk-dev] [PATCH 0/4] net/tap: support flow API Wiles, Keith
2017-03-06 17:05 ` [dpdk-dev] [PATCH v2 " Pascal Mazon
2017-03-06 17:05   ` [dpdk-dev] [PATCH v2 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-06 17:05   ` [dpdk-dev] [PATCH v2 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-06 17:05   ` [dpdk-dev] [PATCH v2 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-06 17:05   ` [dpdk-dev] [PATCH v2 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-07 15:05   ` [dpdk-dev] [PATCH v2 0/4] net/tap: support flow API Pascal Mazon
2017-03-07 15:08     ` Wiles, Keith
2017-03-07 16:35   ` [dpdk-dev] [PATCH v3 " Pascal Mazon
2017-03-07 16:35     ` [dpdk-dev] [PATCH v3 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-09 15:28       ` Ferruh Yigit
2017-03-10  9:40         ` Pascal Mazon
2017-03-07 16:35     ` [dpdk-dev] [PATCH v3 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-07 16:35     ` [dpdk-dev] [PATCH v3 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-09 15:29       ` Ferruh Yigit
2017-03-10  9:39         ` Pascal Mazon
2017-03-07 16:35     ` [dpdk-dev] [PATCH v3 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-14  8:29   ` [dpdk-dev] [PATCH v4 0/4] net/tap: support flow API Pascal Mazon
2017-03-14  8:29     ` [dpdk-dev] [PATCH v4 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-14 14:05       ` Wiles, Keith
2017-03-14  8:29     ` [dpdk-dev] [PATCH v4 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-14  8:29     ` [dpdk-dev] [PATCH v4 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-14 14:03       ` Wiles, Keith
2017-03-14  8:29     ` [dpdk-dev] [PATCH v4 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-15 14:54   ` [dpdk-dev] [PATCH v5 0/4] net/tap: support flow API Pascal Mazon
2017-03-15 14:54     ` [dpdk-dev] [PATCH v5 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-21 15:32       ` Wiles, Keith
2017-03-21 16:57         ` Pascal Mazon
2017-03-15 14:54     ` [dpdk-dev] [PATCH v5 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-21 15:35       ` Wiles, Keith
2017-03-15 14:54     ` [dpdk-dev] [PATCH v5 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-15 14:54     ` [dpdk-dev] [PATCH v5 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-21 17:10       ` Ferruh Yigit [this message]
2017-03-21 15:48     ` [dpdk-dev] [PATCH v5 0/4] net/tap: support flow API Wiles, Keith
2017-03-22  9:48   ` [dpdk-dev] [PATCH v6 " Pascal Mazon
2017-03-22  9:48     ` [dpdk-dev] [PATCH v6 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-22  9:48     ` [dpdk-dev] [PATCH v6 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-22  9:48     ` [dpdk-dev] [PATCH v6 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-22  9:48     ` [dpdk-dev] [PATCH v6 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-22 13:56       ` Ferruh Yigit
2017-03-22 14:22     ` [dpdk-dev] [PATCH v6 0/4] net/tap: support flow API Wiles, Keith
2017-03-23  8:33     ` [dpdk-dev] [PATCH v7 " Pascal Mazon
2017-03-23  8:33       ` [dpdk-dev] [PATCH v7 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-23  8:33       ` [dpdk-dev] [PATCH v7 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-23  8:33       ` [dpdk-dev] [PATCH v7 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-23  8:33       ` [dpdk-dev] [PATCH v7 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-23 12:50       ` [dpdk-dev] [PATCH v7 0/4] net/tap: support flow API Ferruh Yigit

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=75248f99-c164-9399-049c-6529d5255978@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.com \
    --cc=pascal.mazon@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).