Subject: Re: [PATCH net-next] fib: use indirect call wrappers in the most common fib_rules_ops

From: kernel test robot <[email-masked]>
Date: Sat, 25 Jul 2020 21:38:02 +0800

Hi Brian,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Brian-Vazquez/fib-use-indirect-call-wrappers-in-the-most-common-fib_rules_ops/20200725-095008
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git dfd3d5266dc1d9a2b06e5a09bbff4cee547eeb5f
config: i386-randconfig-a011-20200724 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All errors (new ones prefixed by >>):

   ld: net/core/fib_rules.o: in function `fib_rule_match':
>> net/core/fib_rules.c:275: undefined reference to `fib6_rule_match'
>> ld: net/core/fib_rules.c:275: undefined reference to `fib6_rule_match'
   ld: net/core/fib_rules.c:275: undefined reference to `fib4_rule_match'
   ld: net/core/fib_rules.c:275: undefined reference to `fib4_rule_match'
   ld: net/core/fib_rules.o: in function `fib_rules_lookup':
>> net/core/fib_rules.c:319: undefined reference to `fib6_rule_action'
>> ld: net/core/fib_rules.c:319: undefined reference to `fib6_rule_action'
   ld: net/core/fib_rules.c:319: undefined reference to `fib4_rule_action'
   ld: net/core/fib_rules.c:319: undefined reference to `fib4_rule_action'
>> ld: net/core/fib_rules.c:324: undefined reference to `fib6_rule_suppress'
>> ld: net/core/fib_rules.c:324: undefined reference to `fib6_rule_suppress'
   ld: net/core/fib_rules.c:324: undefined reference to `fib4_rule_suppress'
   ld: net/core/fib_rules.c:324: undefined reference to `fib4_rule_suppress'

vim +275 net/core/fib_rules.c

   245	
   246	INDIRECT_CALLABLE_DECLARE(int fib6_rule_match(struct fib_rule *rule,
   247						    struct flowi *fl, int flags));
   248	INDIRECT_CALLABLE_DECLARE(int fib4_rule_match(struct fib_rule *rule,
   249						    struct flowi *fl, int flags));
   250	static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
   251				  struct flowi *fl, int flags,
   252				  struct fib_lookup_arg *arg)
   253	{
   254		int ret = 0;
   255	
   256		if (rule->iifindex && (rule->iifindex != fl->flowi_iif))
   257			goto out;
   258	
   259		if (rule->oifindex && (rule->oifindex != fl->flowi_oif))
   260			goto out;
   261	
   262		if ((rule->mark ^ fl->flowi_mark) & rule->mark_mask)
   263			goto out;
   264	
   265		if (rule->tun_id && (rule->tun_id != fl->flowi_tun_key.tun_id))
   266			goto out;
   267	
   268		if (rule->l3mdev && !l3mdev_fib_rule_match(rule->fr_net, fl, arg))
   269			goto out;
   270	
   271		if (uid_lt(fl->flowi_uid, rule->uid_range.start) ||
   272		    uid_gt(fl->flowi_uid, rule->uid_range.end))
   273			goto out;
   274	
 > 275		ret = INDIRECT_CALL_INET(ops->match,
   276					 fib6_rule_match,
   277					 fib4_rule_match,
   278					 rule, fl, flags);
   279	out:
   280		return (rule->flags & FIB_RULE_INVERT) ? !ret : ret;
   281	}
   282	
   283	INDIRECT_CALLABLE_DECLARE(int fib6_rule_action(struct fib_rule *rule,
   284				    struct flowi *flp, int flags,
   285				    struct fib_lookup_arg *arg));
   286	INDIRECT_CALLABLE_DECLARE(int fib4_rule_action(struct fib_rule *rule,
   287				    struct flowi *flp, int flags,
   288				    struct fib_lookup_arg *arg));
   289	INDIRECT_CALLABLE_DECLARE(bool fib6_rule_suppress(struct fib_rule *rule,
   290							struct fib_lookup_arg *arg));
   291	INDIRECT_CALLABLE_DECLARE(bool fib4_rule_suppress(struct fib_rule *rule,
   292							struct fib_lookup_arg *arg));
   293	int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
   294			     int flags, struct fib_lookup_arg *arg)
   295	{
   296		struct fib_rule *rule;
   297		int err;
   298	
   299		rcu_read_lock();
   300	
   301		list_for_each_entry_rcu(rule, &ops->rules_list, list) {
   302	jumped:
   303			if (!fib_rule_match(rule, ops, fl, flags, arg))
   304				continue;
   305	
   306			if (rule->action == FR_ACT_GOTO) {
   307				struct fib_rule *target;
   308	
   309				target = rcu_dereference(rule->ctarget);
   310				if (target == NULL) {
   311					continue;
   312				} else {
   313					rule = target;
   314					goto jumped;
   315				}
   316			} else if (rule->action == FR_ACT_NOP)
   317				continue;
   318			else
 > 319				err = INDIRECT_CALL_INET(ops->action,
   320						       fib6_rule_action,
   321						       fib4_rule_action,
   322						       rule, fl, flags, arg);
   323	
 > 324			if (!err && ops->suppress && INDIRECT_CALL_INET(ops->suppress,
   325									fib6_rule_suppress,
   326									fib4_rule_suppress,
   327									rule, arg))
   328				continue;
   329	
   330			if (err != -EAGAIN) {
   331				if ((arg->flags & FIB_LOOKUP_NOREF) ||
   332				    likely(refcount_inc_not_zero(&rule->refcnt))) {
   333					arg->rule = rule;
   334					goto out;
   335				}
   336				break;
   337			}
   338		}
   339	
   340		err = -ESRCH;
   341	out:
   342		rcu_read_unlock();
   343	
   344		return err;
   345	}
   346	EXPORT_SYMBOL_GPL(fib_rules_lookup);
   347	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]