diff mbox series

net: ___neigh_lookup_noref(): remove redundant parameters

Message ID 20231204185943.68-1-yx.0xffff@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: ___neigh_lookup_noref(): remove redundant parameters | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 3679 this patch: 1075
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang fail Errors and warnings before: 1294 this patch: 370
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 3919 this patch: 996
netdev/checkpatch warning WARNING: line length of 81 exceeds 80 columns WARNING: line length of 84 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

YangXin Dec. 4, 2023, 6:59 p.m. UTC
key_eq() and hash() are functions of struct neigh_table, so we just need to call tbl->key_eq() and tbl->hash(), instead of passing them in as parameters.

Signed-off-by: YangXin <yx.0xffff@gmail.com>

Comments

Eric Dumazet Dec. 4, 2023, 7:54 p.m. UTC | #1
On Mon, Dec 4, 2023 at 7:59 PM YangXin <yx.0xffff@gmail.com> wrote:
>
> key_eq() and hash() are functions of struct neigh_table, so we just need to call tbl->key_eq() and tbl->hash(), instead of passing them in as parameters.
>
> Signed-off-by: YangXin <yx.0xffff@gmail.com>

Not sure, this might defeat inlining.
kernel test robot Dec. 5, 2023, 8:23 a.m. UTC | #2
Hi YangXin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v6.7-rc4 next-20231205]
[cannot apply to horms-ipvs/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/YangXin/net-___neigh_lookup_noref-remove-redundant-parameters/20231205-030205
base:   net-next/main
patch link:    https://lore.kernel.org/r/20231204185943.68-1-yx.0xffff%40gmail.com
patch subject: [PATCH] net: ___neigh_lookup_noref(): remove redundant parameters
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20231205/202312051637.EOZ86jSh-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231205/202312051637.EOZ86jSh-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312051637.EOZ86jSh-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/net/route.h:28,
                    from include/net/ip.h:30,
                    from include/net/busy_poll.h:18,
                    from drivers/net/ethernet/sfc/falcon/net_driver.h:29,
                    from drivers/net/ethernet/sfc/falcon/efx.c:21:
   include/net/arp.h: In function '__ipv4_neigh_lookup_noref':
   include/net/arp.h:27:64: error: passing argument 3 of '___neigh_lookup_noref' from incompatible pointer type [-Werror=incompatible-pointer-types]
      27 |         return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
         |                                                                ^~~~
         |                                                                |
         |                                                                u32 * {aka unsigned int *}
   In file included from include/net/dst.h:20,
                    from include/net/sock.h:66,
                    from include/linux/tcp.h:19,
                    from drivers/net/ethernet/sfc/falcon/efx.c:15:
   include/net/neighbour.h:296:28: note: expected 'struct net_device *' but argument is of type 'u32 *' {aka 'unsigned int *'}
     296 |         struct net_device *dev)
         |         ~~~~~~~~~~~~~~~~~~~^~~
   include/net/arp.h:27:16: error: too many arguments to function '___neigh_lookup_noref'
      27 |         return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
         |                ^~~~~~~~~~~~~~~~~~~~~
   include/net/neighbour.h:293:33: note: declared here
     293 | static inline struct neighbour *___neigh_lookup_noref(
         |                                 ^~~~~~~~~~~~~~~~~~~~~
   In file included from include/net/route.h:29:
   include/net/ndisc.h: In function '__ipv6_neigh_lookup_noref':
>> include/net/ndisc.h:383:64: warning: passing argument 3 of '___neigh_lookup_noref' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     383 |         return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
         |                                                                ^~~~
   include/net/neighbour.h:296:28: note: expected 'struct net_device *' but argument is of type 'const void *'
     296 |         struct net_device *dev)
         |         ~~~~~~~~~~~~~~~~~~~^~~
   include/net/ndisc.h:383:16: error: too many arguments to function '___neigh_lookup_noref'
     383 |         return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
         |                ^~~~~~~~~~~~~~~~~~~~~
   include/net/neighbour.h:293:33: note: declared here
     293 | static inline struct neighbour *___neigh_lookup_noref(
         |                                 ^~~~~~~~~~~~~~~~~~~~~
   include/net/ndisc.h: In function '__ipv6_neigh_lookup_noref_stub':
   include/net/ndisc.h:390:74: warning: passing argument 3 of '___neigh_lookup_noref' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     390 |         return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
         |                                                                          ^~~~
   include/net/neighbour.h:296:28: note: expected 'struct net_device *' but argument is of type 'const void *'
     296 |         struct net_device *dev)
         |         ~~~~~~~~~~~~~~~~~~~^~~
   include/net/ndisc.h:390:16: error: too many arguments to function '___neigh_lookup_noref'
     390 |         return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
         |                ^~~~~~~~~~~~~~~~~~~~~
   include/net/neighbour.h:293:33: note: declared here
     293 | static inline struct neighbour *___neigh_lookup_noref(
         |                                 ^~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +383 include/net/ndisc.h

   380	
   381	static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
   382	{
 > 383		return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
   384	}
   385
kernel test robot Dec. 5, 2023, 12:40 p.m. UTC | #3
Hi YangXin,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]
[also build test ERROR on net/main linus/master v6.7-rc4 next-20231205]
[cannot apply to horms-ipvs/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/YangXin/net-___neigh_lookup_noref-remove-redundant-parameters/20231205-030205
base:   net-next/main
patch link:    https://lore.kernel.org/r/20231204185943.68-1-yx.0xffff%40gmail.com
patch subject: [PATCH] net: ___neigh_lookup_noref(): remove redundant parameters
config: arm-defconfig (https://download.01.org/0day-ci/archive/20231205/202312052000.xiZkoBI4-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231205/202312052000.xiZkoBI4-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312052000.xiZkoBI4-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from net/socket.c:108:
   In file included from include/net/busy_poll.h:18:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:28:
>> include/net/arp.h:27:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/socket.c:108:
   In file included from include/net/busy_poll.h:18:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:29:
>> include/net/ndisc.h:383:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/socket.c:108:
   In file included from include/net/busy_poll.h:18:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:29:
   include/net/ndisc.h:390:73: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                           ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   3 errors generated.
--
   In file included from net/core/neighbour.c:30:
>> include/net/arp.h:27:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   1 error generated.
--
   In file included from net/ipv4/route.c:86:
   In file included from include/net/dst_metadata.h:6:
   In file included from include/net/ip_tunnels.h:18:
   In file included from include/net/lwtunnel.h:9:
   In file included from include/net/route.h:28:
>> include/net/arp.h:27:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/ipv4/route.c:86:
   In file included from include/net/dst_metadata.h:6:
   In file included from include/net/ip_tunnels.h:18:
   In file included from include/net/lwtunnel.h:9:
   In file included from include/net/route.h:29:
>> include/net/ndisc.h:383:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/ipv4/route.c:86:
   In file included from include/net/dst_metadata.h:6:
   In file included from include/net/ip_tunnels.h:18:
   In file included from include/net/lwtunnel.h:9:
   In file included from include/net/route.h:29:
   include/net/ndisc.h:390:73: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                           ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   net/ipv4/route.c:880:6: warning: variable 'log_martians' set but not used [-Wunused-but-set-variable]
           int log_martians;
               ^
   1 warning and 3 errors generated.
--
   In file included from net/ipv4/igmp.c:91:
>> include/net/arp.h:27:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/ipv4/igmp.c:92:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:29:
>> include/net/ndisc.h:383:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/ipv4/igmp.c:92:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:29:
   include/net/ndisc.h:390:73: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                           ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   net/ipv4/igmp.c:1915:6: warning: variable 'changerec' set but not used [-Wunused-but-set-variable]
           int     changerec = 0;
                   ^
   1 warning and 3 errors generated.
--
   In file included from net/ipv6/anycast.c:37:
>> include/net/ndisc.h:383:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/ipv6/anycast.c:37:
   include/net/ndisc.h:390:73: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                           ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/ipv6/anycast.c:39:
   In file included from include/net/ip6_route.h:9:
   In file included from include/net/lwtunnel.h:9:
   In file included from include/net/route.h:28:
>> include/net/arp.h:27:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   3 errors generated.
--
   In file included from net/ipv6/ip6_fib.c:29:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:28:
>> include/net/arp.h:27:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/ipv6/ip6_fib.c:29:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:29:
>> include/net/ndisc.h:383:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/ipv6/ip6_fib.c:29:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:29:
   include/net/ndisc.h:390:73: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                           ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   net/ipv6/ip6_fib.c:1384:25: warning: variable 'pn' set but not used [-Wunused-but-set-variable]
           struct fib6_node *fn, *pn = NULL;
                                  ^
   1 warning and 3 errors generated.
--
   In file included from net/ipv6/sysctl_net_ipv6.c:15:
>> include/net/ndisc.h:383:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from net/ipv6/sysctl_net_ipv6.c:15:
   include/net/ndisc.h:390:73: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                           ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   2 errors generated.


vim +27 include/net/arp.h

    20	
    21	#ifdef CONFIG_INET
    22	static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev, u32 key)
    23	{
    24		if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT))
    25			key = INADDR_ANY;
    26	
  > 27		return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
    28	}
    29	#else
    30	static inline
    31	struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev, u32 key)
    32	{
    33		return NULL;
    34	}
    35	#endif
    36
kernel test robot Dec. 5, 2023, 1:11 p.m. UTC | #4
Hi YangXin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v6.7-rc4 next-20231205]
[cannot apply to horms-ipvs/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/YangXin/net-___neigh_lookup_noref-remove-redundant-parameters/20231205-030205
base:   net-next/main
patch link:    https://lore.kernel.org/r/20231204185943.68-1-yx.0xffff%40gmail.com
patch subject: [PATCH] net: ___neigh_lookup_noref(): remove redundant parameters
config: i386-randconfig-015-20231205 (https://download.01.org/0day-ci/archive/20231205/202312052031.mECkx7WX-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231205/202312052031.mECkx7WX-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312052031.mECkx7WX-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/net/ethernet/sfc/ef100_rx.c:11:
   In file included from drivers/net/ethernet/sfc/net_driver.h:28:
   In file included from include/net/busy_poll.h:18:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:28:
   include/net/arp.h:27:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from drivers/net/ethernet/sfc/ef100_rx.c:11:
   In file included from drivers/net/ethernet/sfc/net_driver.h:28:
   In file included from include/net/busy_poll.h:18:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:29:
   include/net/ndisc.h:383:63: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                 ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   In file included from drivers/net/ethernet/sfc/ef100_rx.c:11:
   In file included from drivers/net/ethernet/sfc/net_driver.h:28:
   In file included from include/net/busy_poll.h:18:
   In file included from include/net/ip.h:30:
   In file included from include/net/route.h:29:
   include/net/ndisc.h:390:73: error: too many arguments to function call, expected 3, have 4
           return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
                  ~~~~~~~~~~~~~~~~~~~~~                                           ^~~
   include/net/neighbour.h:293:33: note: '___neigh_lookup_noref' declared here
   static inline struct neighbour *___neigh_lookup_noref(
                                   ^
   drivers/net/ethernet/sfc/ef100_rx.c:175:3: warning: shift count is negative [-Wshift-count-negative]
                   EFX_QWORD_FIELD(*p_event, ESF_GZ_EV_RXPKTS_NUM_PKT);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:231:26: note: expanded from macro 'EFX_QWORD_FIELD'
   #define EFX_QWORD_FIELD         EFX_QWORD_FIELD32
                                   ^
   drivers/net/ethernet/sfc/bitfield.h:183:2: note: expanded from macro 'EFX_QWORD_FIELD32'
           EFX_EXTRACT_QWORD32(qword, EFX_LOW_BIT(field),          \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:163:4: note: expanded from macro 'EFX_EXTRACT_QWORD32'
             EFX_EXTRACT32((qword).u32[1], 32, 63, low, high)) &           \
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:143:2: note: expanded from macro 'EFX_EXTRACT32'
           EFX_EXTRACT_NATIVE(le32_to_cpu(element), min, max, low, high)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:128:20: note: expanded from macro 'EFX_EXTRACT_NATIVE'
            (native_element) >> ((low) - (min)) :                          \
                             ^  ~~~~~~~~~~~~~~~
>> drivers/net/ethernet/sfc/ef100_rx.c:175:3: warning: shift count >= width of type [-Wshift-count-overflow]
                   EFX_QWORD_FIELD(*p_event, ESF_GZ_EV_RXPKTS_NUM_PKT);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:231:26: note: expanded from macro 'EFX_QWORD_FIELD'
   #define EFX_QWORD_FIELD         EFX_QWORD_FIELD32
                                   ^
   drivers/net/ethernet/sfc/bitfield.h:183:2: note: expanded from macro 'EFX_QWORD_FIELD32'
           EFX_EXTRACT_QWORD32(qword, EFX_LOW_BIT(field),          \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:163:4: note: expanded from macro 'EFX_EXTRACT_QWORD32'
             EFX_EXTRACT32((qword).u32[1], 32, 63, low, high)) &           \
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:143:2: note: expanded from macro 'EFX_EXTRACT32'
           EFX_EXTRACT_NATIVE(le32_to_cpu(element), min, max, low, high)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:129:20: note: expanded from macro 'EFX_EXTRACT_NATIVE'
            (native_element) << ((min) - (low)))
                             ^  ~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/ef100_rx.c:204:3: warning: shift count is negative [-Wshift-count-negative]
                   EFX_POPULATE_QWORD_1(*rxd, ESF_GZ_RX_BUF_ADDR, rx_buf->dma_addr);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:440:2: note: expanded from macro 'EFX_POPULATE_QWORD_1'
           EFX_POPULATE_QWORD_2(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:438:2: note: expanded from macro 'EFX_POPULATE_QWORD_2'
           EFX_POPULATE_QWORD_3(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:436:2: note: expanded from macro 'EFX_POPULATE_QWORD_3'
           EFX_POPULATE_QWORD_4(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   note: (skipping 21 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   drivers/net/ethernet/sfc/bitfield.h:258:3: note: expanded from macro 'EFX_INSERT_NATIVE'
            EFX_INSERT_NATIVE64(min, max, low, high, value) :      \
            ^
   drivers/net/ethernet/sfc/bitfield.h:247:21: note: expanded from macro 'EFX_INSERT_NATIVE64'
             (((u64) (value)) << (low - min)) :            \
                              ^
   include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__cpu_to_le32'
   #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
                                                     ^
   drivers/net/ethernet/sfc/ef100_rx.c:204:3: warning: shift count is negative [-Wshift-count-negative]
                   EFX_POPULATE_QWORD_1(*rxd, ESF_GZ_RX_BUF_ADDR, rx_buf->dma_addr);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:440:2: note: expanded from macro 'EFX_POPULATE_QWORD_1'
           EFX_POPULATE_QWORD_2(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:438:2: note: expanded from macro 'EFX_POPULATE_QWORD_2'
           EFX_POPULATE_QWORD_3(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:436:2: note: expanded from macro 'EFX_POPULATE_QWORD_3'
           EFX_POPULATE_QWORD_4(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   note: (skipping 21 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   drivers/net/ethernet/sfc/bitfield.h:259:3: note: expanded from macro 'EFX_INSERT_NATIVE'
            EFX_INSERT_NATIVE32(min, max, low, high, value))
            ^
   drivers/net/ethernet/sfc/bitfield.h:253:21: note: expanded from macro 'EFX_INSERT_NATIVE32'
             (((u32) (value)) << (low - min)) :            \
                              ^
   include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__cpu_to_le32'
   #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
                                                     ^
   drivers/net/ethernet/sfc/ef100_rx.c:204:3: warning: shift count >= width of type [-Wshift-count-overflow]
                   EFX_POPULATE_QWORD_1(*rxd, ESF_GZ_RX_BUF_ADDR, rx_buf->dma_addr);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:440:2: note: expanded from macro 'EFX_POPULATE_QWORD_1'
           EFX_POPULATE_QWORD_2(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:438:2: note: expanded from macro 'EFX_POPULATE_QWORD_2'
           EFX_POPULATE_QWORD_3(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:436:2: note: expanded from macro 'EFX_POPULATE_QWORD_3'
           EFX_POPULATE_QWORD_4(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   note: (skipping 21 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   drivers/net/ethernet/sfc/bitfield.h:259:3: note: expanded from macro 'EFX_INSERT_NATIVE'
            EFX_INSERT_NATIVE32(min, max, low, high, value))
            ^
   drivers/net/ethernet/sfc/bitfield.h:254:21: note: expanded from macro 'EFX_INSERT_NATIVE32'
             (((u32) (value)) >> (min - low))))
                              ^
   include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__cpu_to_le32'
   #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
                                                     ^
   drivers/net/ethernet/sfc/ef100_rx.c:204:3: warning: shift count is negative [-Wshift-count-negative]
                   EFX_POPULATE_QWORD_1(*rxd, ESF_GZ_RX_BUF_ADDR, rx_buf->dma_addr);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:440:2: note: expanded from macro 'EFX_POPULATE_QWORD_1'
           EFX_POPULATE_QWORD_2(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:438:2: note: expanded from macro 'EFX_POPULATE_QWORD_2'
           EFX_POPULATE_QWORD_3(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/sfc/bitfield.h:436:2: note: expanded from macro 'EFX_POPULATE_QWORD_3'
           EFX_POPULATE_QWORD_4(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   note: (skipping 21 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   drivers/net/ethernet/sfc/bitfield.h:258:3: note: expanded from macro 'EFX_INSERT_NATIVE'
            EFX_INSERT_NATIVE64(min, max, low, high, value) :      \
            ^
   drivers/net/ethernet/sfc/bitfield.h:247:21: note: expanded from macro 'EFX_INSERT_NATIVE64'


vim +175 drivers/net/ethernet/sfc/ef100_rx.c

8e57daf70671e4 Edward Cree 2020-08-03  170  
8e57daf70671e4 Edward Cree 2020-08-03  171  void efx_ef100_ev_rx(struct efx_channel *channel, const efx_qword_t *p_event)
8e57daf70671e4 Edward Cree 2020-08-03  172  {
8e57daf70671e4 Edward Cree 2020-08-03  173  	struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel);
8e57daf70671e4 Edward Cree 2020-08-03  174  	unsigned int n_packets =
8e57daf70671e4 Edward Cree 2020-08-03 @175  		EFX_QWORD_FIELD(*p_event, ESF_GZ_EV_RXPKTS_NUM_PKT);
8e57daf70671e4 Edward Cree 2020-08-03  176  	int i;
8e57daf70671e4 Edward Cree 2020-08-03  177  
8e57daf70671e4 Edward Cree 2020-08-03  178  	WARN_ON_ONCE(!n_packets);
8e57daf70671e4 Edward Cree 2020-08-03  179  	if (n_packets > 1)
8e57daf70671e4 Edward Cree 2020-08-03  180  		++channel->n_rx_merge_events;
8e57daf70671e4 Edward Cree 2020-08-03  181  
8e57daf70671e4 Edward Cree 2020-08-03  182  	channel->irq_mod_score += 2 * n_packets;
8e57daf70671e4 Edward Cree 2020-08-03  183  
8e57daf70671e4 Edward Cree 2020-08-03  184  	for (i = 0; i < n_packets; ++i) {
8e57daf70671e4 Edward Cree 2020-08-03  185  		ef100_rx_packet(rx_queue,
8e57daf70671e4 Edward Cree 2020-08-03  186  				rx_queue->removed_count & rx_queue->ptr_mask);
8e57daf70671e4 Edward Cree 2020-08-03  187  		++rx_queue->removed_count;
8e57daf70671e4 Edward Cree 2020-08-03  188  	}
8e57daf70671e4 Edward Cree 2020-08-03  189  }
8e57daf70671e4 Edward Cree 2020-08-03  190
diff mbox series

Patch

diff --git a/include/net/arp.h b/include/net/arp.h
index e8747e0713c7..c3a329f759af 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -24,7 +24,7 @@  static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev
 	if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT))
 		key = INADDR_ANY;
 
-	return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, arp_hashfn, &key, dev);
+	return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
 }
 #else
 static inline
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 9bbdf6eaa942..023fb7ebb63c 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -380,15 +380,14 @@  static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _
 
 static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
 {
-	return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, ndisc_hashfn, pkey, dev);
+	return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
 }
 
 static inline
 struct neighbour *__ipv6_neigh_lookup_noref_stub(struct net_device *dev,
 						 const void *pkey)
 {
-	return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128,
-				     ndisc_hashfn, pkey, dev);
+	return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
 }
 
 static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 0d28172193fa..e21dbfc612b4 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -292,10 +292,6 @@  static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey)
 
 static inline struct neighbour *___neigh_lookup_noref(
 	struct neigh_table *tbl,
-	bool (*key_eq)(const struct neighbour *n, const void *pkey),
-	__u32 (*hash)(const void *pkey,
-		      const struct net_device *dev,
-		      __u32 *hash_rnd),
 	const void *pkey,
 	struct net_device *dev)
 {
@@ -303,11 +299,11 @@  static inline struct neighbour *___neigh_lookup_noref(
 	struct neighbour *n;
 	u32 hash_val;
 
-	hash_val = hash(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
+	hash_val = tbl->hash(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
 	for (n = rcu_dereference(nht->hash_buckets[hash_val]);
 	     n != NULL;
 	     n = rcu_dereference(n->next)) {
-		if (n->dev == dev && key_eq(n, pkey))
+		if (n->dev == dev && tbl->key_eq(n, pkey))
 			return n;
 	}
 
@@ -318,7 +314,7 @@  static inline struct neighbour *__neigh_lookup_noref(struct neigh_table *tbl,
 						     const void *pkey,
 						     struct net_device *dev)
 {
-	return ___neigh_lookup_noref(tbl, tbl->key_eq, tbl->hash, pkey, dev);
+	return ___neigh_lookup_noref(tbl, pkey, dev);
 }
 
 static inline void neigh_confirm(struct neighbour *n)