diff mbox

[net-next,3/5] net: Refactor path selection in __ip_route_output_key

Message ID 1443713247-11230-4-git-send-email-dsa@cumulusnetworks.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

David Ahern Oct. 1, 2015, 3:27 p.m. UTC
VRF device needs same path selection following lookup to set source
address. Rather than duplicating code, move existing code into a
function that is exported to modules.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
 include/net/ip_fib.h     |  2 ++
 net/ipv4/fib_semantics.c | 18 ++++++++++++++++++
 net/ipv4/route.c         | 13 +------------
 3 files changed, 21 insertions(+), 12 deletions(-)

Comments

kernel test robot Oct. 2, 2015, 6:20 a.m. UTC | #1
Hi David,

[auto build test results on next-20151001 -- if it's inappropriate base, please ignore]

config: mips-nlm_xlp_defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All warnings (new ones prefixed by >>):

>> mips-linux-gnu-ld: net/ipv4/.tmp_fib_semantics.o: warning: Inconsistent ISA between e_flags and .MIPS.abiflags

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
David Miller Oct. 5, 2015, 1:38 p.m. UTC | #2
From: kbuild test robot <lkp@intel.com>
Date: Fri, 2 Oct 2015 14:20:30 +0800

> Hi David,
> 
> [auto build test results on next-20151001 -- if it's inappropriate base, please ignore]
> 
> config: mips-nlm_xlp_defconfig (attached as .config)
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=mips 
> 
> All warnings (new ones prefixed by >>):
> 
>>> mips-linux-gnu-ld: net/ipv4/.tmp_fib_semantics.o: warning: Inconsistent ISA between e_flags and .MIPS.abiflags

Frankly this looks like a build infrastructure or tools bug to me.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Ahern Oct. 5, 2015, 2:08 p.m. UTC | #3
On 10/5/15 7:38 AM, David Miller wrote:
> From: kbuild test robot <lkp@intel.com>
> Date: Fri, 2 Oct 2015 14:20:30 +0800
>
>> Hi David,
>>
>> [auto build test results on next-20151001 -- if it's inappropriate base, please ignore]
>>
>> config: mips-nlm_xlp_defconfig (attached as .config)
>> reproduce:
>>          wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>>          chmod +x ~/bin/make.cross
>>          # save the attached .config to linux build tree
>>          make.cross ARCH=mips
>>
>> All warnings (new ones prefixed by >>):
>>
>>>> mips-linux-gnu-ld: net/ipv4/.tmp_fib_semantics.o: warning: Inconsistent ISA between e_flags and .MIPS.abiflags
>
> Frankly this looks like a build infrastructure or tools bug to me.
>

That's pretty much what I got back from Joshua on the linux-mips mailing 
list when I inquired about why a code move generates the warning:

"Dunno if your patch generated the message per-say, but it seems some 
platforms in the MIPS tree cause this message to appear. I.e., IP27 or 
IP32 builds (or IP30 out-of-tree) don't emit this error, but building 
IP28 systems in-tree will cause it to appear quite a bit.

The message itself, I believe is complaining that the stated CPU ISA 
(mips1 ... mips4, mips32r2, r10000, etc) in one of the sections 
(e.g.,.MIPS.abiflags) doesn't match the equivalent ISA value in the 
other section (e.g., e_flags). I haven't seen any harmful side effects 
of it myself. Seems to be more of a warning than anything else, and as 
long as the ISA matches a supported CPU (e.g., r10000 is compatible with 
mips4), it can be ignored. It does clutter up the build, though."
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 727d6e9a9685..30469855edf5 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -321,6 +321,8 @@  int fib_sync_down_dev(struct net_device *dev, unsigned long event);
 int fib_sync_down_addr(struct net *net, __be32 local);
 int fib_sync_up(struct net_device *dev, unsigned int nh_flags);
 void fib_select_multipath(struct fib_result *res);
+void fib_select_path(struct net *net, struct fib_result *res,
+		     struct flowi4 *fl4);
 
 /* Exported by fib_trie.c */
 void fib_trie_init(void);
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 064bd3caaa4f..facba7ed27de 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1547,3 +1547,21 @@  void fib_select_multipath(struct fib_result *res)
 	spin_unlock_bh(&fib_multipath_lock);
 }
 #endif
+
+void fib_select_path(struct net *net, struct fib_result *res,
+		     struct flowi4 *fl4)
+{
+#ifdef CONFIG_IP_ROUTE_MULTIPATH
+	if (res->fi->fib_nhs > 1 && fl4->flowi4_oif == 0)
+		fib_select_multipath(res);
+	else
+#endif
+	if (!res->prefixlen &&
+	    res->table->tb_num_default > 1 &&
+	    res->type == RTN_UNICAST && !fl4->flowi4_oif)
+		fib_select_default(fl4, res);
+
+	if (!fl4->saddr)
+		fl4->saddr = FIB_RES_PREFSRC(net, *res);
+}
+EXPORT_SYMBOL_GPL(fib_select_path);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1441de1550e6..747042504967 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2187,18 +2187,7 @@  struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
 		goto make_route;
 	}
 
-#ifdef CONFIG_IP_ROUTE_MULTIPATH
-	if (res.fi->fib_nhs > 1 && fl4->flowi4_oif == 0)
-		fib_select_multipath(&res);
-	else
-#endif
-	if (!res.prefixlen &&
-	    res.table->tb_num_default > 1 &&
-	    res.type == RTN_UNICAST && !fl4->flowi4_oif)
-		fib_select_default(fl4, &res);
-
-	if (!fl4->saddr)
-		fl4->saddr = FIB_RES_PREFSRC(net, res);
+	fib_select_path(net, &res, fl4);
 
 	dev_out = FIB_RES_DEV(res);
 	fl4->flowi4_oif = dev_out->ifindex;