Hi wenxu,

Thank you for the patch! Perhaps something to improve:

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

url:    
https://github.com/0day-ci/linux/commits/wenxu-ucloud-cn/route-Add-multipath_hash-in-flowi_common-to-make-user-define-hash/20190224-075532
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

All warnings (new ones prefixed by >>):

   net/ipv4/route.c:771:46: sparse: warning: incorrect type in argument 2 
(different base types)
   net/ipv4/route.c:771:46: sparse:    expected unsigned int [usertype] key
   net/ipv4/route.c:771:46: sparse:    got restricted __be32 [usertype] new_gw
>> net/ipv4/route.c:1823:35: sparse: warning: incorrect type in initializer 
>> (different base types)
   net/ipv4/route.c:1823:35: sparse:    expected unsigned int [usertype] 
multipath_hash
   net/ipv4/route.c:1823:35: sparse:    got restricted __be32 const [usertype] 
flowic_multipath_hash
   net/ipv4/route.c:2746:27: sparse: warning: incorrect type in assignment 
(different base types)
   net/ipv4/route.c:2746:27: sparse:    expected restricted __be16 [usertype] 
len
   net/ipv4/route.c:2746:27: sparse:    got unsigned long
--
>> include/net/ip_tunnels.h:254:36: sparse: warning: incorrect type in 
>> assignment (different base types)
   include/net/ip_tunnels.h:254:36: sparse:    expected restricted __be32 
[usertype] flowic_multipath_hash
   include/net/ip_tunnels.h:254:36: sparse:    got unsigned int [usertype] 
tun_inner_hash
>> include/net/ip_tunnels.h:254:36: sparse: warning: incorrect type in 
>> assignment (different base types)
   include/net/ip_tunnels.h:254:36: sparse:    expected restricted __be32 
[usertype] flowic_multipath_hash
   include/net/ip_tunnels.h:254:36: sparse:    got unsigned int [usertype] 
tun_inner_hash
>> include/net/ip_tunnels.h:254:36: sparse: warning: incorrect type in 
>> assignment (different base types)
   include/net/ip_tunnels.h:254:36: sparse:    expected restricted __be32 
[usertype] flowic_multipath_hash
   include/net/ip_tunnels.h:254:36: sparse:    got unsigned int [usertype] 
tun_inner_hash
--
>> include/net/ip_tunnels.h:254:36: sparse: warning: incorrect type in 
>> assignment (different base types)
   include/net/ip_tunnels.h:254:36: sparse:    expected restricted __be32 
[usertype] flowic_multipath_hash
   include/net/ip_tunnels.h:254:36: sparse:    got unsigned int [usertype] 
tun_inner_hash

sparse warnings: (new ones prefixed by >>)

   net/ipv4/route.c:771:46: sparse: warning: incorrect type in argument 2 
(different base types)
   net/ipv4/route.c:771:46: sparse:    expected unsigned int [usertype] key
   net/ipv4/route.c:771:46: sparse:    got restricted __be32 [usertype] new_gw
   net/ipv4/route.c:1823:35: sparse: warning: incorrect type in initializer 
(different base types)
>> net/ipv4/route.c:1823:35: sparse:    expected unsigned int [usertype] 
>> multipath_hash
>> net/ipv4/route.c:1823:35: sparse:    got restricted __be32 const [usertype] 
>> flowic_multipath_hash
   net/ipv4/route.c:2746:27: sparse: warning: incorrect type in assignment 
(different base types)
   net/ipv4/route.c:2746:27: sparse:    expected restricted __be16 [usertype] 
len
   net/ipv4/route.c:2746:27: sparse:    got unsigned long
--
   include/net/ip_tunnels.h:254:36: sparse: warning: incorrect type in 
assignment (different base types)
>> include/net/ip_tunnels.h:254:36: sparse:    expected restricted __be32 
>> [usertype] flowic_multipath_hash
>> include/net/ip_tunnels.h:254:36: sparse:    got unsigned int [usertype] 
>> tun_inner_hash
   include/net/ip_tunnels.h:254:36: sparse: warning: incorrect type in 
assignment (different base types)
>> include/net/ip_tunnels.h:254:36: sparse:    expected restricted __be32 
>> [usertype] flowic_multipath_hash
>> include/net/ip_tunnels.h:254:36: sparse:    got unsigned int [usertype] 
>> tun_inner_hash
   include/net/ip_tunnels.h:254:36: sparse: warning: incorrect type in 
assignment (different base types)
>> include/net/ip_tunnels.h:254:36: sparse:    expected restricted __be32 
>> [usertype] flowic_multipath_hash
>> include/net/ip_tunnels.h:254:36: sparse:    got unsigned int [usertype] 
>> tun_inner_hash
--
   include/net/ip_tunnels.h:254:36: sparse: warning: incorrect type in 
assignment (different base types)
>> include/net/ip_tunnels.h:254:36: sparse:    expected restricted __be32 
>> [usertype] flowic_multipath_hash
>> include/net/ip_tunnels.h:254:36: sparse:    got unsigned int [usertype] 
>> tun_inner_hash

vim +1823 net/ipv4/route.c

  1818  
  1819  /* if skb is set it will be used and fl4 can be NULL */
  1820  int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4,
  1821                         const struct sk_buff *skb, struct flow_keys 
*flkeys)
  1822  {
> 1823          u32 multipath_hash = fl4->flowi4_multipath_hash;
  1824          struct flow_keys hash_keys;
  1825          u32 mhash;
  1826  
  1827          switch (net->ipv4.sysctl_fib_multipath_hash_policy) {
  1828          case 0:
  1829                  memset(&hash_keys, 0, sizeof(hash_keys));
  1830                  hash_keys.control.addr_type = 
FLOW_DISSECTOR_KEY_IPV4_ADDRS;
  1831                  if (skb) {
  1832                          ip_multipath_l3_keys(skb, &hash_keys);
  1833                  } else {
  1834                          hash_keys.addrs.v4addrs.src = fl4->saddr;
  1835                          hash_keys.addrs.v4addrs.dst = fl4->daddr;
  1836                  }
  1837                  break;
  1838          case 1:
  1839                  /* skb is currently provided only when forwarding */
  1840                  if (skb) {
  1841                          unsigned int flag = 
FLOW_DISSECTOR_F_STOP_AT_ENCAP;
  1842                          struct flow_keys keys;
  1843  
  1844                          /* short-circuit if we already have L4 hash 
present */
  1845                          if (skb->l4_hash)
  1846                                  return skb_get_hash_raw(skb) >> 1;
  1847  
  1848                          memset(&hash_keys, 0, sizeof(hash_keys));
  1849  
  1850                          if (!flkeys) {
  1851                                  skb_flow_dissect_flow_keys(skb, &keys, 
flag);
  1852                                  flkeys = &keys;
  1853                          }
  1854  
  1855                          hash_keys.control.addr_type = 
FLOW_DISSECTOR_KEY_IPV4_ADDRS;
  1856                          hash_keys.addrs.v4addrs.src = 
flkeys->addrs.v4addrs.src;
  1857                          hash_keys.addrs.v4addrs.dst = 
flkeys->addrs.v4addrs.dst;
  1858                          hash_keys.ports.src = flkeys->ports.src;
  1859                          hash_keys.ports.dst = flkeys->ports.dst;
  1860                          hash_keys.basic.ip_proto = 
flkeys->basic.ip_proto;
  1861                  } else {
  1862                          memset(&hash_keys, 0, sizeof(hash_keys));
  1863                          hash_keys.control.addr_type = 
FLOW_DISSECTOR_KEY_IPV4_ADDRS;
  1864                          hash_keys.addrs.v4addrs.src = fl4->saddr;
  1865                          hash_keys.addrs.v4addrs.dst = fl4->daddr;
  1866                          hash_keys.ports.src = fl4->fl4_sport;
  1867                          hash_keys.ports.dst = fl4->fl4_dport;
  1868                          hash_keys.basic.ip_proto = fl4->flowi4_proto;
  1869                  }
  1870                  break;
  1871          }
  1872          mhash = flow_hash_from_keys(&hash_keys);
  1873  
  1874          if (multipath_hash)
  1875                  mhash = jhash_2words(mhash, multipath_hash, 0);
  1876  
  1877          return mhash >> 1;
  1878  }
  1879  #endif /* CONFIG_IP_ROUTE_MULTIPATH */
  1880  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to