Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: resolve symbol conflicts with generic hashtable.h

This is a preparatory patch for converting qdisc linked list into a
hashtable. As we'll need to include hashtable.h in netdevice.h, we first
have to make sure that this will not introduce symbol conflicts for any of
the netdevice.h users.

Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Kosina and committed by
David S. Miller
e87a8f24 b89b815c

+28 -28
+7 -7
drivers/net/ethernet/ti/davinci_emac.c
··· 597 597 } 598 598 599 599 /** 600 - * hash_add - Hash function to add mac addr from hash table 600 + * emac_hash_add - Hash function to add mac addr from hash table 601 601 * @priv: The DaVinci EMAC private adapter structure 602 602 * @mac_addr: mac address to delete from hash table 603 603 * 604 604 * Adds mac address to the internal hash table 605 605 * 606 606 */ 607 - static int hash_add(struct emac_priv *priv, u8 *mac_addr) 607 + static int emac_hash_add(struct emac_priv *priv, u8 *mac_addr) 608 608 { 609 609 struct device *emac_dev = &priv->ndev->dev; 610 610 u32 rc = 0; ··· 613 613 614 614 if (hash_value >= EMAC_NUM_MULTICAST_BITS) { 615 615 if (netif_msg_drv(priv)) { 616 - dev_err(emac_dev, "DaVinci EMAC: hash_add(): Invalid "\ 616 + dev_err(emac_dev, "DaVinci EMAC: emac_hash_add(): Invalid "\ 617 617 "Hash %08x, should not be greater than %08x", 618 618 hash_value, (EMAC_NUM_MULTICAST_BITS - 1)); 619 619 } ··· 639 639 } 640 640 641 641 /** 642 - * hash_del - Hash function to delete mac addr from hash table 642 + * emac_hash_del - Hash function to delete mac addr from hash table 643 643 * @priv: The DaVinci EMAC private adapter structure 644 644 * @mac_addr: mac address to delete from hash table 645 645 * 646 646 * Removes mac address from the internal hash table 647 647 * 648 648 */ 649 - static int hash_del(struct emac_priv *priv, u8 *mac_addr) 649 + static int emac_hash_del(struct emac_priv *priv, u8 *mac_addr) 650 650 { 651 651 u32 hash_value; 652 652 u32 hash_bit; ··· 696 696 697 697 switch (action) { 698 698 case EMAC_MULTICAST_ADD: 699 - update = hash_add(priv, mac_addr); 699 + update = emac_hash_add(priv, mac_addr); 700 700 break; 701 701 case EMAC_MULTICAST_DEL: 702 - update = hash_del(priv, mac_addr); 702 + update = emac_hash_del(priv, mac_addr); 703 703 break; 704 704 case EMAC_ALL_MULTI_SET: 705 705 update = 1;
+6 -6
net/ipv6/ip6_gre.c
··· 61 61 module_param(log_ecn_error, bool, 0644); 62 62 MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); 63 63 64 - #define HASH_SIZE_SHIFT 5 65 - #define HASH_SIZE (1 << HASH_SIZE_SHIFT) 64 + #define IP6_GRE_HASH_SIZE_SHIFT 5 65 + #define IP6_GRE_HASH_SIZE (1 << IP6_GRE_HASH_SIZE_SHIFT) 66 66 67 67 static int ip6gre_net_id __read_mostly; 68 68 struct ip6gre_net { 69 - struct ip6_tnl __rcu *tunnels[4][HASH_SIZE]; 69 + struct ip6_tnl __rcu *tunnels[4][IP6_GRE_HASH_SIZE]; 70 70 71 71 struct net_device *fb_tunnel_dev; 72 72 }; ··· 96 96 will match fallback tunnel. 97 97 */ 98 98 99 - #define HASH_KEY(key) (((__force u32)key^((__force u32)key>>4))&(HASH_SIZE - 1)) 99 + #define HASH_KEY(key) (((__force u32)key^((__force u32)key>>4))&(IP6_GRE_HASH_SIZE - 1)) 100 100 static u32 HASH_ADDR(const struct in6_addr *addr) 101 101 { 102 102 u32 hash = ipv6_addr_hash(addr); 103 103 104 - return hash_32(hash, HASH_SIZE_SHIFT); 104 + return hash_32(hash, IP6_GRE_HASH_SIZE_SHIFT); 105 105 } 106 106 107 107 #define tunnels_r_l tunnels[3] ··· 1089 1089 1090 1090 for (prio = 0; prio < 4; prio++) { 1091 1091 int h; 1092 - for (h = 0; h < HASH_SIZE; h++) { 1092 + for (h = 0; h < IP6_GRE_HASH_SIZE; h++) { 1093 1093 struct ip6_tnl *t; 1094 1094 1095 1095 t = rtnl_dereference(ign->tunnels[prio][h]);
+5 -5
net/ipv6/ip6_tunnel.c
··· 64 64 MODULE_ALIAS_RTNL_LINK("ip6tnl"); 65 65 MODULE_ALIAS_NETDEV("ip6tnl0"); 66 66 67 - #define HASH_SIZE_SHIFT 5 68 - #define HASH_SIZE (1 << HASH_SIZE_SHIFT) 67 + #define IP6_TUNNEL_HASH_SIZE_SHIFT 5 68 + #define IP6_TUNNEL_HASH_SIZE (1 << IP6_TUNNEL_HASH_SIZE_SHIFT) 69 69 70 70 static bool log_ecn_error = true; 71 71 module_param(log_ecn_error, bool, 0644); ··· 75 75 { 76 76 u32 hash = ipv6_addr_hash(addr1) ^ ipv6_addr_hash(addr2); 77 77 78 - return hash_32(hash, HASH_SIZE_SHIFT); 78 + return hash_32(hash, IP6_TUNNEL_HASH_SIZE_SHIFT); 79 79 } 80 80 81 81 static int ip6_tnl_dev_init(struct net_device *dev); ··· 87 87 /* the IPv6 tunnel fallback device */ 88 88 struct net_device *fb_tnl_dev; 89 89 /* lists for storing tunnels in use */ 90 - struct ip6_tnl __rcu *tnls_r_l[HASH_SIZE]; 90 + struct ip6_tnl __rcu *tnls_r_l[IP6_TUNNEL_HASH_SIZE]; 91 91 struct ip6_tnl __rcu *tnls_wc[1]; 92 92 struct ip6_tnl __rcu **tnls[2]; 93 93 }; ··· 2031 2031 if (dev->rtnl_link_ops == &ip6_link_ops) 2032 2032 unregister_netdevice_queue(dev, &list); 2033 2033 2034 - for (h = 0; h < HASH_SIZE; h++) { 2034 + for (h = 0; h < IP6_TUNNEL_HASH_SIZE; h++) { 2035 2035 t = rtnl_dereference(ip6n->tnls_r_l[h]); 2036 2036 while (t) { 2037 2037 /* If dev is in the same netns, it has already
+5 -5
net/ipv6/ip6_vti.c
··· 50 50 #include <net/net_namespace.h> 51 51 #include <net/netns/generic.h> 52 52 53 - #define HASH_SIZE_SHIFT 5 54 - #define HASH_SIZE (1 << HASH_SIZE_SHIFT) 53 + #define IP6_VTI_HASH_SIZE_SHIFT 5 54 + #define IP6_VTI_HASH_SIZE (1 << IP6_VTI_HASH_SIZE_SHIFT) 55 55 56 56 static u32 HASH(const struct in6_addr *addr1, const struct in6_addr *addr2) 57 57 { 58 58 u32 hash = ipv6_addr_hash(addr1) ^ ipv6_addr_hash(addr2); 59 59 60 - return hash_32(hash, HASH_SIZE_SHIFT); 60 + return hash_32(hash, IP6_VTI_HASH_SIZE_SHIFT); 61 61 } 62 62 63 63 static int vti6_dev_init(struct net_device *dev); ··· 69 69 /* the vti6 tunnel fallback device */ 70 70 struct net_device *fb_tnl_dev; 71 71 /* lists for storing tunnels in use */ 72 - struct ip6_tnl __rcu *tnls_r_l[HASH_SIZE]; 72 + struct ip6_tnl __rcu *tnls_r_l[IP6_VTI_HASH_SIZE]; 73 73 struct ip6_tnl __rcu *tnls_wc[1]; 74 74 struct ip6_tnl __rcu **tnls[2]; 75 75 }; ··· 1040 1040 struct ip6_tnl *t; 1041 1041 LIST_HEAD(list); 1042 1042 1043 - for (h = 0; h < HASH_SIZE; h++) { 1043 + for (h = 0; h < IP6_VTI_HASH_SIZE; h++) { 1044 1044 t = rtnl_dereference(ip6n->tnls_r_l[h]); 1045 1045 while (t) { 1046 1046 unregister_netdevice_queue(t->dev, &list);
+5 -5
net/ipv6/sit.c
··· 62 62 For comments look at net/ipv4/ip_gre.c --ANK 63 63 */ 64 64 65 - #define HASH_SIZE 16 65 + #define IP6_SIT_HASH_SIZE 16 66 66 #define HASH(addr) (((__force u32)addr^((__force u32)addr>>4))&0xF) 67 67 68 68 static bool log_ecn_error = true; ··· 78 78 79 79 static int sit_net_id __read_mostly; 80 80 struct sit_net { 81 - struct ip_tunnel __rcu *tunnels_r_l[HASH_SIZE]; 82 - struct ip_tunnel __rcu *tunnels_r[HASH_SIZE]; 83 - struct ip_tunnel __rcu *tunnels_l[HASH_SIZE]; 81 + struct ip_tunnel __rcu *tunnels_r_l[IP6_SIT_HASH_SIZE]; 82 + struct ip_tunnel __rcu *tunnels_r[IP6_SIT_HASH_SIZE]; 83 + struct ip_tunnel __rcu *tunnels_l[IP6_SIT_HASH_SIZE]; 84 84 struct ip_tunnel __rcu *tunnels_wc[1]; 85 85 struct ip_tunnel __rcu **tunnels[4]; 86 86 ··· 1783 1783 1784 1784 for (prio = 1; prio < 4; prio++) { 1785 1785 int h; 1786 - for (h = 0; h < HASH_SIZE; h++) { 1786 + for (h = 0; h < IP6_SIT_HASH_SIZE; h++) { 1787 1787 struct ip_tunnel *t; 1788 1788 1789 1789 t = rtnl_dereference(sitn->tunnels[prio][h]);