From: Ido Schimmel <idosch@idosch.org>
To: Roopa Prabhu <roopa@cumulusnetworks.com>
Cc: netdev@vger.kernel.org, dsa@cumulusnetworks.com,
nikolay@cumulusnetworks.com
Subject: Re: [PATCH RFC net-next 4/4] ipv6: route: dissect flow in input path if fib rules need it
Date: Mon, 12 Feb 2018 09:44:27 +0200 [thread overview]
Message-ID: <20180212074426.GA22807@splinter> (raw)
In-Reply-To: <1518387989-33735-5-git-send-email-roopa@cumulusnetworks.com>
On Sun, Feb 11, 2018 at 02:26:29PM -0800, Roopa Prabhu wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> Dissect flow in fwd path if fib rules require it. Controlled by
> a flag to avoid penatly for the common case. Flag is set when fib
> rules with sport, dport and proto match that require flow dissect
> are installed. Also passes the dissected hash keys to the multipath
> hash function when applicable to avoid dissecting the flow again.
> icmp packets will continue to use inner header for hash
> calculations.
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
> include/net/ip6_route.h | 3 ++-
> include/net/netns/ipv6.h | 1 +
> net/ipv6/fib6_rules.c | 12 +++++++++---
> net/ipv6/icmp.c | 2 +-
> net/ipv6/route.c | 45 ++++++++++++++++++++++++++++++++++++---------
> 5 files changed, 49 insertions(+), 14 deletions(-)
>
> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
> index 27d23a6..218f89c 100644
> --- a/include/net/ip6_route.h
> +++ b/include/net/ip6_route.h
> @@ -127,7 +127,8 @@ static inline int ip6_route_get_saddr(struct net *net, struct rt6_info *rt,
>
> struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
> const struct in6_addr *saddr, int oif, int flags);
> -u32 rt6_multipath_hash(const struct flowi6 *fl6, const struct sk_buff *skb);
> +u32 rt6_multipath_hash(const struct flowi6 *fl6, const struct sk_buff *skb,
> + struct flow_keys *hkeys);
>
> struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6);
>
> diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
> index 987cc45..7aca00e 100644
> --- a/include/net/netns/ipv6.h
> +++ b/include/net/netns/ipv6.h
> @@ -72,6 +72,7 @@ struct netns_ipv6 {
> unsigned long ip6_rt_last_gc;
> #ifdef CONFIG_IPV6_MULTIPLE_TABLES
> bool fib6_has_custom_rules;
> + bool fib6_rules_require_fldissect;
> struct rt6_info *ip6_prohibit_entry;
> struct rt6_info *ip6_blk_hole_entry;
> struct fib6_table *fib6_local_tbl;
[...]
> @@ -1847,12 +1858,27 @@ void ip6_route_input(struct sk_buff *skb)
> .flowi6_mark = skb->mark,
> .flowi6_proto = iph->nexthdr,
> };
> + struct flow_keys *flkeys = NULL, _flkeys;
>
> tun_info = skb_tunnel_info(skb);
> if (tun_info && !(tun_info->mode & IP_TUNNEL_INFO_TX))
> fl6.flowi6_tun_key.tun_id = tun_info->key.tun_id;
> +
> +#ifdef CONFIG_IP_MULTIPLE_TABLES
s/CONFIG_IP_MULTIPLE_TABLES/CONFIG_IPV6_MULTIPLE_TABLES/ ?
> + if (net->ipv6.fib6_rules_require_fldissect) {
> + unsigned int flag = FLOW_DISSECTOR_F_STOP_AT_ENCAP;
> +
> + memset(&_flkeys, 0, sizeof(_flkeys));
> + skb_flow_dissect_flow_keys(skb, &_flkeys, flag);
> + fl6.fl6_sport = _flkeys.ports.src;
> + fl6.fl6_dport = _flkeys.ports.dst;
> + fl6.flowi6_proto = _flkeys.basic.ip_proto;
> + flkeys = &_flkeys;
> + }
> +#endif
next prev parent reply other threads:[~2018-02-12 7:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-11 22:26 [PATCH RFC net-next 0/4] fib_rules: support sport, dport and proto match Roopa Prabhu
2018-02-11 22:26 ` [PATCH RFC net-next 1/4] ipv4: fib_rules: support match on sport, dport and ip proto Roopa Prabhu
2018-02-12 20:49 ` Eric Dumazet
2018-02-12 21:05 ` David Miller
2018-02-12 21:07 ` David Ahern
2018-02-12 21:54 ` Eric Dumazet
2018-02-12 23:03 ` David Ahern
2018-02-13 0:03 ` David Miller
2018-02-13 16:19 ` Roopa Prabhu
2018-02-13 16:34 ` David Miller
2018-02-13 16:36 ` Roopa Prabhu
2018-02-13 18:21 ` Ben Greear
2018-02-11 22:26 ` [PATCH RFC net-next 2/4] ipv6: fib6_rules: support for " Roopa Prabhu
2018-02-11 22:26 ` [PATCH RFC net-next 3/4] ipv4: route: dissect flow in input path if fib rules need it Roopa Prabhu
2018-02-11 22:26 ` [PATCH RFC net-next 4/4] ipv6: " Roopa Prabhu
2018-02-12 7:44 ` Ido Schimmel [this message]
2018-02-12 16:21 ` Roopa Prabhu
2018-02-12 20:36 ` [PATCH RFC net-next 0/4] fib_rules: support sport, dport and proto match David Miller
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=20180212074426.GA22807@splinter \
--to=idosch@idosch.org \
--cc=dsa@cumulusnetworks.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=roopa@cumulusnetworks.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).