Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1220266ybt; Sun, 14 Jun 2020 15:00:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyG0R1RHCJWJ6+NHWHED87koyj9kQl36YlhbOmlokPGdtBjg+QX4k4f2gfChiYieXCnXfO9 X-Received: by 2002:aa7:d388:: with SMTP id x8mr21778146edq.380.1592172003563; Sun, 14 Jun 2020 15:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592172003; cv=none; d=google.com; s=arc-20160816; b=dZb9YC2gu6c7tBO3Z92MtvntPzmS9f6cKJcftCximP1XtQmlH2ZvdKRhBW/6J8mwOD ASLBk+JSNHAW8Ge5LDCtatT7/SqkIqbSZW81FBCJH3lK732zzBczpdPwDT1eMpSZQixB G6WXMdF2N2FnX96pGJmtquf3aVzAaXeGW4YtlxkOjQtXQhrrMlMoMxd84GUx9Wc8Cupp 3lpxFM/gcvfaQ/5vkQuRbriYvB4h+tgdft97IXGqqc+m4maNoGvCtr0EmO5r2NAxDunv InxsxE8gBRhpaBVnFIn9Iqxb20zBQLDlqS7DcM1+ilxQGYYHOEKtEgRkymqgu/Eg4Iqn LbNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=1JFmA7zQmwjamZvBBzBcAWOqtcPJgeXHYUvuSuVxnic=; b=PNPEVOUCoFaSAYIRtNLabPnXFFu2CD2seWgzLJsHr46L4kCI9pxTdfo6IZ71HyFIpR C/lTf6YSlPQcYB88Gkxzafv74QRtqEcPVXPR0H/l/PmPes2nAiPiHDxy9c/dTWhwrHRm j5Q6jYWSWIIF4B5DE1AG4bYsmSueNmM+h/zz8hGMe2h+JXRPWWwoJZJ0R5E1tQOdBe5M pn/847K9YmSI7sOqVTfe+QLMA1ftlJZkNpDEDrqLhM2wYyn5CA90bTPkhzh2ToGqCLdp oAyX79rGejo2mKRL/c6SjrWh6c/JgtGNly2otFEutpH+t/++1aprxvxoSzcAgWUtSEM2 kI0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@uniroma2.it header.b="T/g7DF0h"; dkim=fail header.i=@uniroma2.it header.s=rsa201904 header.b=tnha29J3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nl7si7802584ejb.199.2020.06.14.14.59.23; Sun, 14 Jun 2020 15:00:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=neutral (no key) header.i=@uniroma2.it header.b="T/g7DF0h"; dkim=fail header.i=@uniroma2.it header.s=rsa201904 header.b=tnha29J3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727962AbgFNV4i (ORCPT + 99 others); Sun, 14 Jun 2020 17:56:38 -0400 Received: from smtp.uniroma2.it ([160.80.6.16]:46730 "EHLO smtp.uniroma2.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727918AbgFNV4i (ORCPT ); Sun, 14 Jun 2020 17:56:38 -0400 Received: from smtpauth-2019-1.uniroma2.it (smtpauth.uniroma2.it [160.80.5.46]) by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id 05ELuIDW016346; Sun, 14 Jun 2020 23:56:23 +0200 Received: from lubuntu-18.04 (unknown [160.80.103.126]) by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id EE0A8120925; Sun, 14 Jun 2020 23:56:13 +0200 (CEST) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it; s=ed201904; t=1592171774; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1JFmA7zQmwjamZvBBzBcAWOqtcPJgeXHYUvuSuVxnic=; b=T/g7DF0hX49XAr/jZkQc4sR1ST6F6ytA011Dlcs4i+2Nj/z5Kj3w66bLVVfqGKX59SF1ap hjTQUWEXGC07lDAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904; t=1592171774; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1JFmA7zQmwjamZvBBzBcAWOqtcPJgeXHYUvuSuVxnic=; b=tnha29J3cd5QfC0yMck+H910Xz4i3OVWnzUBgMDCnLmn/q2eo2B1EevHVnmUoK4S+nBijZ 40fvMolW3egtHBcKZXInfcV+zAduwF6a0IW4IDuk4tS8gHIUS1VNctbjYOSCp6+wFRx6g1 uvghRvCLGWVymAxDw9OK75NCkxx0+IkNKHABKCxnhV6Thcm206BYr0qDALwtWEYhD75HIJ +kSg7xcHFzAqgr5dyQ4ukE6FSww32Pp74BfTGMIraq5nCqPctIDV9ZlhdEK7OWxmCBZU0e AOuLT9w2oMn3adAHWhQSrC3r9znEwxHZZEXuCXcv6PwwRYN4L8ydgFFP5lt7Xw== Date: Sun, 14 Jun 2020 23:56:13 +0200 From: Andrea Mayer To: David Ahern Cc: David Ahern , "David S. Miller" , Shrijeet Mukherjee , Jakub Kicinski , Shuah Khan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Donald Sharp , Roopa Prabhu , Dinesh Dutt , Stefano Salsano , Paolo Lungaroni , Ahmed Abdelsalam , Andrea Mayer Subject: Re: [RFC,net-next, 1/5] l3mdev: add infrastructure for table to VRF mapping Message-Id: <20200614235613.b16ef9bad3e93b8727a80abe@uniroma2.it> In-Reply-To: <983c5d6b-5366-dfd3-eab2-2727e056d5c5@gmail.com> References: <20200612164937.5468-1-andrea.mayer@uniroma2.it> <20200612164937.5468-2-andrea.mayer@uniroma2.it> <983c5d6b-5366-dfd3-eab2-2727e056d5c5@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015 X-Virus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 13 Jun 2020 18:37:09 -0600 David Ahern wrote: > 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 > > #include > > > > +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 > Hi David, Ok, I will do it! Thank you, Andrea