Netdev List
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Tom Herbert <tom@herbertland.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jamal Hadi Salim <jhs@mojatatu.com>, Thomas Graf <tgraf@suug.ch>,
	jesse@nicira.com, kaber@trash.net,
	Tom Herbert <therbert@google.com>,
	edumazet@google.com, alexander.h.duyck@redhat.com,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	ast@plumgrid.com, daniel@iogearbox.net,
	herbert@gondor.apana.org.au, cwang@twopensource.com,
	john.fastabend@gmail.com
Subject: Re: [patch net-next v4 RFC 12/15] flow_dissector: introduce support for ipv6 addressses
Date: Sat, 25 Apr 2015 21:17:02 +0200	[thread overview]
Message-ID: <20150425191702.GA2004@nanopsycho.orion> (raw)
In-Reply-To: <CALx6S37xpnWTOQw3vivY5Ugn0BTkvxhNMhWnYABHD88cuZJ7Eg@mail.gmail.com>

Fri, Apr 24, 2015 at 07:28:05PM CEST, tom@herbertland.com wrote:
>Hi Jiri,
>
>Thanks for this work, I think it's a good direction! Some comments below...
>
>On Fri, Apr 24, 2015 at 8:51 AM, Jiri Pirko <jiri@resnulli.us> wrote:

...

>>  enum flow_dissector_key_id {
>>         FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */
>>         FLOW_DISSECTOR_KEY_IPV4_ADDRS, /* struct flow_dissector_key_addrs */
>>         FLOW_DISSECTOR_KEY_IPV6_HASH_ADDRS, /* struct flow_dissector_key_addrs */
>>         FLOW_DISSECTOR_KEY_PORTS, /* struct flow_dissector_key_ports */
>> +       FLOW_DISSECTOR_KEY_IPV6_ADDRS, /* struct flow_dissector_key_ipv6_addrs */
>>
>And we'll want to add VLAN ID, (GRE) key-id, IPv6 flow label, maybe a
>couple more.

Definitely. I plan to extend keys for those you mentioned and more in
future. Easy extendability is the goal of this patchset.
 

>
>>         FLOW_DISSECTOR_KEY_MAX,
>>  };
>> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
>> index 564288e..95e9a21 100644
>> --- a/net/core/flow_dissector.c
>> +++ b/net/core/flow_dissector.c
>> @@ -175,16 +175,29 @@ ipv6:
>>                 ip_proto = iph->nexthdr;
>>                 nhoff += sizeof(struct ipv6hdr);
>>
>> -               if (!skb_flow_dissector_uses_key(flow_dissector,
>> -                                                FLOW_DISSECTOR_KEY_IPV6_HASH_ADDRS))
>> -                       break;
>> -               key_addrs = skb_flow_dissector_target(flow_dissector,
>> -                                                     FLOW_DISSECTOR_KEY_IPV6_HASH_ADDRS,
>> -                                                     target_container);
>> +               if (skb_flow_dissector_uses_key(flow_dissector,
>> +                                               FLOW_DISSECTOR_KEY_IPV6_HASH_ADDRS)) {
>> +                       key_addrs = skb_flow_dissector_target(flow_dissector,
>> +                                                             FLOW_DISSECTOR_KEY_IPV6_HASH_ADDRS,
>> +                                                             target_container);
>>
>> -               key_addrs->src = (__force __be32)ipv6_addr_hash(&iph->saddr);
>> -               key_addrs->dst = (__force __be32)ipv6_addr_hash(&iph->daddr);
>> +                       key_addrs->src = (__force __be32)ipv6_addr_hash(&iph->saddr);
>> +                       key_addrs->dst = (__force __be32)ipv6_addr_hash(&iph->daddr);
>> +                       goto flow_label;
>> +               }
>
>So this is still folding the IPv6 addresses so that that we can fit
>into jhash_3words? Can we address this now and include the full IPv6
>address in the hash? I would propose that we extend the flow_keys
>structure (which I think you may already be doing) for full IPv6
>address, VLAN, flow label, etc., and then produce a hash across that
>whole structure. jhash2 can be used on a structure.  jhash is actually
>a very efficient hash performance wise-- the rest of flow dissection
>is likely the dominant cost anyway. We should also minimize calls to
>flow_dissector, I would propose it should be called at most once per
>packet-- I'll be reposting patches to fix that in the various qdiscs.

This hash computation is currently present in kernel. I just ported that
to new programable dissector framework.

I'm not sure how possible is the flow_keys structure extension. In this
patchset, I just maintain the current size and usage. But the thing is
that every individual caller of flow_dissect can use their own struct
which includes exactly what he needs.

Regarding the flow_dissect call reduction, I agree that it is something
we need. The question is how to pass the dissect results through the
code. For example, sch_choke uses qdisc_cb_private for passing flow_keys
struct. However qdisc_skb_cb can by only 20 bytes long (QDISC_CB_PRIV_LEN)
This can be however resolver independently of this patchset.

  reply	other threads:[~2015-04-25 19:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 15:51 [patch net-next v4 RFC 00/15] introduce programable flow dissector and cls_flower Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 01/15] net: change name of flow_dissector header to match the .c file name Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 02/15] flow_dissector: remove unused function flow_get_hlen declaration Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 03/15] net: move *skb_get_poff declarations into correct header Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 04/15] flow_dissector: fix doc for __skb_get_hash and remove couple of empty lines Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 05/15] net: move __skb_get_hash function declaration to flow_dissector.h Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 06/15] net: move __skb_tx_hash to skbuff.c Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 07/15] net: move netdev_pick_tx and dependencies to net/core/dev.c Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 08/15] flow_dissector: fix doc for skb_get_poff Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 09/15] flow_dissector: introduce programable flow_dissector Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 10/15] flow_dissect: use programable dissector in skb_flow_dissect and friends Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 11/15] flow_dissector: add missing header includes Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 12/15] flow_dissector: introduce support for ipv6 addressses Jiri Pirko
2015-04-24 17:28   ` Tom Herbert
2015-04-25 19:17     ` Jiri Pirko [this message]
2015-04-24 15:51 ` [patch net-next v4 RFC 13/15] flow_dissector: introduce support for Ethernet addresses Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 14/15] flow_dissector: change port array into src,dst tuple Jiri Pirko
2015-04-24 15:51 ` [patch net-next v4 RFC 15/15] tc: introduce Flower classifier Jiri Pirko
2015-04-26 19:55 ` [patch net-next v4 RFC 00/15] introduce programable flow dissector and cls_flower Or Gerlitz
2015-04-26 19:57   ` Or Gerlitz
2015-04-26 23:33 ` Tom Herbert

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=20150425191702.GA2004@nanopsycho.orion \
    --to=jiri@resnulli.us \
    --cc=alexander.h.duyck@redhat.com \
    --cc=ast@plumgrid.com \
    --cc=cwang@twopensource.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hannes@stressinduktion.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jesse@nicira.com \
    --cc=jhs@mojatatu.com \
    --cc=john.fastabend@gmail.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    --cc=therbert@google.com \
    --cc=tom@herbertland.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