[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <983c5d6b-5366-dfd3-eab2-2727e056d5c5@gmail.com>
Date: Sat, 13 Jun 2020 18:37:09 -0600
From: David Ahern <dsahern@...il.com>
To: Andrea Mayer <andrea.mayer@...roma2.it>,
David Ahern <dsahern@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Shrijeet Mukherjee <shrijeet@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Shuah Khan <shuah@...nel.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Cc: Donald Sharp <sharpd@...ulusnetworks.com>,
Roopa Prabhu <roopa@...ulusnetworks.com>,
Dinesh Dutt <didutt@...il.com>,
Stefano Salsano <stefano.salsano@...roma2.it>,
Paolo Lungaroni <paolo.lungaroni@...t.it>,
Ahmed Abdelsalam <ahabdels@...il.com>
Subject: Re: [RFC,net-next, 1/5] l3mdev: add infrastructure for table to VRF
mapping
On 6/12/20 10:49 AM, Andrea Mayer wrote:
> @@ -37,6 +45,15 @@ struct l3mdev_ops {
>
> #ifdef CONFIG_NET_L3_MASTER_DEV
>
> +int l3mdev_table_lookup_register(enum l3mdev_type l3type,
> + int (*fn)(struct net *net, u32 table_id));
> +
> +void l3mdev_table_lookup_unregister(enum l3mdev_type l3type,
> + int (*fn)(struct net *net, u32 table_id));
> +
> +int l3mdev_ifindex_lookup_by_table_id(enum l3mdev_type l3type, struct net *net,
> + u32 table_id);
> +
> int l3mdev_fib_rule_match(struct net *net, struct flowi *fl,
> struct fib_lookup_arg *arg);
>
> @@ -280,6 +297,26 @@ struct sk_buff *l3mdev_ip6_out(struct sock *sk, struct sk_buff *skb)
> return skb;
> }
>
> +static inline
> +int l3mdev_table_lookup_register(enum l3mdev_type l3type,
> + int (*fn)(struct net *net, u32 table_id))
> +{
> + return -EOPNOTSUPP;
> +}
> +
> +static inline
> +void l3mdev_table_lookup_unregister(enum l3mdev_type l3type,
> + int (*fn)(struct net *net, u32 table_id))
> +{
> +}
> +
> +static inline
> +int l3mdev_ifindex_lookup_by_table_id(enum l3mdev_type l3type, struct net *net,
> + u32 table_id)
> +{
> + return -ENODEV;
> +}
> +
> static inline
> int l3mdev_fib_rule_match(struct net *net, struct flowi *fl,
> struct fib_lookup_arg *arg)
> diff --git a/net/l3mdev/l3mdev.c b/net/l3mdev/l3mdev.c
> index f35899d45a9a..6cc1fe7eb039 100644
> --- a/net/l3mdev/l3mdev.c
> +++ b/net/l3mdev/l3mdev.c
> @@ -9,6 +9,101 @@
> #include <net/fib_rules.h>
> #include <net/l3mdev.h>
>
> +DEFINE_SPINLOCK(l3mdev_lock);
> +
> +typedef int (*lookup_by_table_id_t)(struct net *net, u32 table_d);
> +
I should have caught this earlier. Move lookup_by_table_id_t to l3mdev.h
and use above for 'fn' in l3mdev_table_lookup_{un,}register
Powered by blists - more mailing lists