Commit 10799db60cbc4f990dd69eb49883477095c66af7

Authored by Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  net: Kill ratelimit.h dependency in linux/net.h
  net: Add linux/sysctl.h includes where needed.
  net: Kill ether_table[] declaration.
  inetpeer: fix race in unused_list manipulations
  atm: expose ATM device index in sysfs
  IPVS: bug in ip_vs_ftp, same list heaad used in all netns.
  bug.h: Move ratelimit warn interfaces to ratelimit.h
  bonding: cleanup module option descriptions
  net:8021q:vlan.c Fix pr_info to just give the vlan fullname and version.
  net: davinci_emac: fix dev_err use at probe
  can: convert to %pK for kptr_restrict support
  net: fix ETHTOOL_SFEATURES compatibility with old ethtool_ops.set_flags
  netfilter: Fix several warnings in compat_mtw_from_user().
  netfilter: ipset: fix ip_set_flush return code
  netfilter: ipset: remove unused variable from type_pf_tdel()
  netfilter: ipset: Use proper timeout value to jiffies conversion

Showing 23 changed files Side-by-side Diff

drivers/net/bonding/bond_main.c
... ... @@ -113,9 +113,11 @@
113 113 module_param(tx_queues, int, 0);
114 114 MODULE_PARM_DESC(tx_queues, "Max number of transmit queues (default = 16)");
115 115 module_param_named(num_grat_arp, num_peer_notif, int, 0644);
116   -MODULE_PARM_DESC(num_grat_arp, "Number of peer notifications to send on failover event (alias of num_unsol_na)");
  116 +MODULE_PARM_DESC(num_grat_arp, "Number of peer notifications to send on "
  117 + "failover event (alias of num_unsol_na)");
117 118 module_param_named(num_unsol_na, num_peer_notif, int, 0644);
118   -MODULE_PARM_DESC(num_unsol_na, "Number of peer notifications to send on failover event (alias of num_grat_arp)");
  119 +MODULE_PARM_DESC(num_unsol_na, "Number of peer notifications to send on "
  120 + "failover event (alias of num_grat_arp)");
119 121 module_param(miimon, int, 0);
120 122 MODULE_PARM_DESC(miimon, "Link check interval in milliseconds");
121 123 module_param(updelay, int, 0);
... ... @@ -127,7 +129,7 @@
127 129 MODULE_PARM_DESC(use_carrier, "Use netif_carrier_ok (vs MII ioctls) in miimon; "
128 130 "0 for off, 1 for on (default)");
129 131 module_param(mode, charp, 0);
130   -MODULE_PARM_DESC(mode, "Mode of operation : 0 for balance-rr, "
  132 +MODULE_PARM_DESC(mode, "Mode of operation; 0 for balance-rr, "
131 133 "1 for active-backup, 2 for balance-xor, "
132 134 "3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, "
133 135 "6 for balance-alb");
134 136  
135 137  
136 138  
137 139  
138 140  
139 141  
... ... @@ -142,27 +144,35 @@
142 144 "2 for only on active slave "
143 145 "failure");
144 146 module_param(lacp_rate, charp, 0);
145   -MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner "
146   - "(slow/fast)");
  147 +MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner; "
  148 + "0 for slow, 1 for fast");
147 149 module_param(ad_select, charp, 0);
148   -MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic: stable (0, default), bandwidth (1), count (2)");
  150 +MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic; "
  151 + "0 for stable (default), 1 for bandwidth, "
  152 + "2 for count");
149 153 module_param(xmit_hash_policy, charp, 0);
150   -MODULE_PARM_DESC(xmit_hash_policy, "XOR hashing method: 0 for layer 2 (default)"
151   - ", 1 for layer 3+4");
  154 +MODULE_PARM_DESC(xmit_hash_policy, "balance-xor and 802.3ad hashing method; "
  155 + "0 for layer 2 (default), 1 for layer 3+4, "
  156 + "2 for layer 2+3");
152 157 module_param(arp_interval, int, 0);
153 158 MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds");
154 159 module_param_array(arp_ip_target, charp, NULL, 0);
155 160 MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form");
156 161 module_param(arp_validate, charp, 0);
157   -MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes: none (default), active, backup or all");
  162 +MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes; "
  163 + "0 for none (default), 1 for active, "
  164 + "2 for backup, 3 for all");
158 165 module_param(fail_over_mac, charp, 0);
159   -MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to the same MAC. none (default), active or follow");
  166 +MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to "
  167 + "the same MAC; 0 for none (default), "
  168 + "1 for active, 2 for follow");
160 169 module_param(all_slaves_active, int, 0);
161 170 MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface"
162   - "by setting active flag for all slaves. "
  171 + "by setting active flag for all slaves; "
163 172 "0 for never (default), 1 for always.");
164 173 module_param(resend_igmp, int, 0);
165   -MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on link failure");
  174 +MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on "
  175 + "link failure");
166 176  
167 177 /*----------------------------- Global variables ----------------------------*/
168 178  
drivers/net/davinci_emac.c
... ... @@ -1772,7 +1772,7 @@
1772 1772 /* obtain emac clock from kernel */
1773 1773 emac_clk = clk_get(&pdev->dev, NULL);
1774 1774 if (IS_ERR(emac_clk)) {
1775   - printk(KERN_ERR "DaVinci EMAC: Failed to get EMAC clock\n");
  1775 + dev_err(&pdev->dev, "failed to get EMAC clock\n");
1776 1776 return -EBUSY;
1777 1777 }
1778 1778 emac_bus_frequency = clk_get_rate(emac_clk);
... ... @@ -1780,7 +1780,7 @@
1780 1780  
1781 1781 ndev = alloc_etherdev(sizeof(struct emac_priv));
1782 1782 if (!ndev) {
1783   - printk(KERN_ERR "DaVinci EMAC: Error allocating net_device\n");
  1783 + dev_err(&pdev->dev, "error allocating net_device\n");
1784 1784 clk_put(emac_clk);
1785 1785 return -ENOMEM;
1786 1786 }
... ... @@ -1795,7 +1795,7 @@
1795 1795  
1796 1796 pdata = pdev->dev.platform_data;
1797 1797 if (!pdata) {
1798   - printk(KERN_ERR "DaVinci EMAC: No platform data\n");
  1798 + dev_err(&pdev->dev, "no platform data\n");
1799 1799 return -ENODEV;
1800 1800 }
1801 1801  
... ... @@ -1814,7 +1814,7 @@
1814 1814 /* Get EMAC platform data */
1815 1815 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1816 1816 if (!res) {
1817   - dev_err(emac_dev, "DaVinci EMAC: Error getting res\n");
  1817 + dev_err(&pdev->dev,"error getting res\n");
1818 1818 rc = -ENOENT;
1819 1819 goto probe_quit;
1820 1820 }
1821 1821  
... ... @@ -1822,14 +1822,14 @@
1822 1822 priv->emac_base_phys = res->start + pdata->ctrl_reg_offset;
1823 1823 size = res->end - res->start + 1;
1824 1824 if (!request_mem_region(res->start, size, ndev->name)) {
1825   - dev_err(emac_dev, "DaVinci EMAC: failed request_mem_region() for regs\n");
  1825 + dev_err(&pdev->dev, "failed request_mem_region() for regs\n");
1826 1826 rc = -ENXIO;
1827 1827 goto probe_quit;
1828 1828 }
1829 1829  
1830 1830 priv->remap_addr = ioremap(res->start, size);
1831 1831 if (!priv->remap_addr) {
1832   - dev_err(emac_dev, "Unable to map IO\n");
  1832 + dev_err(&pdev->dev, "unable to map IO\n");
1833 1833 rc = -ENOMEM;
1834 1834 release_mem_region(res->start, size);
1835 1835 goto probe_quit;
... ... @@ -1863,7 +1863,7 @@
1863 1863  
1864 1864 priv->dma = cpdma_ctlr_create(&dma_params);
1865 1865 if (!priv->dma) {
1866   - dev_err(emac_dev, "DaVinci EMAC: Error initializing DMA\n");
  1866 + dev_err(&pdev->dev, "error initializing DMA\n");
1867 1867 rc = -ENOMEM;
1868 1868 goto no_dma;
1869 1869 }
... ... @@ -1879,7 +1879,7 @@
1879 1879  
1880 1880 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1881 1881 if (!res) {
1882   - dev_err(emac_dev, "DaVinci EMAC: Error getting irq res\n");
  1882 + dev_err(&pdev->dev, "error getting irq res\n");
1883 1883 rc = -ENOENT;
1884 1884 goto no_irq_res;
1885 1885 }
... ... @@ -1888,8 +1888,8 @@
1888 1888 if (!is_valid_ether_addr(priv->mac_addr)) {
1889 1889 /* Use random MAC if none passed */
1890 1890 random_ether_addr(priv->mac_addr);
1891   - printk(KERN_WARNING "%s: using random MAC addr: %pM\n",
1892   - __func__, priv->mac_addr);
  1891 + dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
  1892 + priv->mac_addr);
1893 1893 }
1894 1894  
1895 1895 ndev->netdev_ops = &emac_netdev_ops;
... ... @@ -1902,7 +1902,7 @@
1902 1902 SET_NETDEV_DEV(ndev, &pdev->dev);
1903 1903 rc = register_netdev(ndev);
1904 1904 if (rc) {
1905   - dev_err(emac_dev, "DaVinci EMAC: Error in register_netdev\n");
  1905 + dev_err(&pdev->dev, "error in register_netdev\n");
1906 1906 rc = -ENODEV;
1907 1907 goto netdev_reg_err;
1908 1908 }
include/asm-generic/bug.h
... ... @@ -162,46 +162,6 @@
162 162 unlikely(__ret_warn_once); \
163 163 })
164 164  
165   -#ifdef CONFIG_PRINTK
166   -
167   -#define WARN_ON_RATELIMIT(condition, state) \
168   - WARN_ON((condition) && __ratelimit(state))
169   -
170   -#define __WARN_RATELIMIT(condition, state, format...) \
171   -({ \
172   - int rtn = 0; \
173   - if (unlikely(__ratelimit(state))) \
174   - rtn = WARN(condition, format); \
175   - rtn; \
176   -})
177   -
178   -#define WARN_RATELIMIT(condition, format...) \
179   -({ \
180   - static DEFINE_RATELIMIT_STATE(_rs, \
181   - DEFAULT_RATELIMIT_INTERVAL, \
182   - DEFAULT_RATELIMIT_BURST); \
183   - __WARN_RATELIMIT(condition, &_rs, format); \
184   -})
185   -
186   -#else
187   -
188   -#define WARN_ON_RATELIMIT(condition, state) \
189   - WARN_ON(condition)
190   -
191   -#define __WARN_RATELIMIT(condition, state, format...) \
192   -({ \
193   - int rtn = WARN(condition, format); \
194   - rtn; \
195   -})
196   -
197   -#define WARN_RATELIMIT(condition, format...) \
198   -({ \
199   - int rtn = WARN(condition, format); \
200   - rtn; \
201   -})
202   -
203   -#endif
204   -
205 165 /*
206 166 * WARN_ON_SMP() is for cases that the warning is either
207 167 * meaningless for !SMP or may even cause failures.
include/linux/if_ether.h
... ... @@ -132,10 +132,6 @@
132 132  
133 133 int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
134 134  
135   -#ifdef CONFIG_SYSCTL
136   -extern struct ctl_table ether_table[];
137   -#endif
138   -
139 135 int mac_pton(const char *s, u8 *mac);
140 136 extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
141 137  
... ... @@ -289,12 +289,6 @@
289 289 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \
290 290 "-type-" __stringify(type))
291 291  
292   -#ifdef CONFIG_SYSCTL
293   -#include <linux/sysctl.h>
294   -#include <linux/ratelimit.h>
295   -extern struct ratelimit_state net_ratelimit_state;
296   -#endif
297   -
298 292 #endif /* __KERNEL__ */
299 293 #endif /* _LINUX_NET_H */
include/linux/netfilter.h
... ... @@ -13,6 +13,7 @@
13 13 #endif
14 14 #include <linux/types.h>
15 15 #include <linux/compiler.h>
  16 +#include <linux/sysctl.h>
16 17  
17 18 /* Responses from hook functions. */
18 19 #define NF_DROP 0
include/linux/netfilter/ipset/ip_set_ahash.h
... ... @@ -839,7 +839,7 @@
839 839 struct htable *t = h->table;
840 840 const struct type_pf_elem *d = value;
841 841 struct hbucket *n;
842   - int i, ret = 0;
  842 + int i;
843 843 struct type_pf_elem *data;
844 844 u32 key;
845 845  
... ... @@ -850,7 +850,7 @@
850 850 if (!type_pf_data_equal(data, d))
851 851 continue;
852 852 if (type_pf_data_expired(data))
853   - ret = -IPSET_ERR_EXIST;
  853 + return -IPSET_ERR_EXIST;
854 854 if (i != n->pos - 1)
855 855 /* Not last one */
856 856 type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));
include/linux/netfilter/ipset/ip_set_timeout.h
... ... @@ -45,7 +45,7 @@
45 45 {
46 46 return timeout != IPSET_ELEM_UNSET &&
47 47 (timeout == IPSET_ELEM_PERMANENT ||
48   - time_after(timeout, jiffies));
  48 + time_is_after_jiffies(timeout));
49 49 }
50 50  
51 51 static inline bool
... ... @@ -53,7 +53,7 @@
53 53 {
54 54 return timeout != IPSET_ELEM_UNSET &&
55 55 timeout != IPSET_ELEM_PERMANENT &&
56   - time_before(timeout, jiffies);
  56 + time_is_before_jiffies(timeout);
57 57 }
58 58  
59 59 static inline unsigned long
... ... @@ -64,7 +64,7 @@
64 64 if (!timeout)
65 65 return IPSET_ELEM_PERMANENT;
66 66  
67   - t = timeout * HZ + jiffies;
  67 + t = msecs_to_jiffies(timeout * 1000) + jiffies;
68 68 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
69 69 /* Bingo! */
70 70 t++;
... ... @@ -75,7 +75,8 @@
75 75 static inline u32
76 76 ip_set_timeout_get(unsigned long timeout)
77 77 {
78   - return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
  78 + return timeout == IPSET_ELEM_PERMANENT ? 0 :
  79 + jiffies_to_msecs(timeout - jiffies)/1000;
79 80 }
80 81  
81 82 #else
82 83  
... ... @@ -89,14 +90,14 @@
89 90 ip_set_timeout_test(unsigned long timeout)
90 91 {
91 92 return timeout == IPSET_ELEM_PERMANENT ||
92   - time_after(timeout, jiffies);
  93 + time_is_after_jiffies(timeout);
93 94 }
94 95  
95 96 static inline bool
96 97 ip_set_timeout_expired(unsigned long timeout)
97 98 {
98 99 return timeout != IPSET_ELEM_PERMANENT &&
99   - time_before(timeout, jiffies);
  100 + time_is_before_jiffies(timeout);
100 101 }
101 102  
102 103 static inline unsigned long
... ... @@ -107,7 +108,7 @@
107 108 if (!timeout)
108 109 return IPSET_ELEM_PERMANENT;
109 110  
110   - t = timeout * HZ + jiffies;
  111 + t = msecs_to_jiffies(timeout * 1000) + jiffies;
111 112 if (t == IPSET_ELEM_PERMANENT)
112 113 /* Bingo! :-) */
113 114 t++;
... ... @@ -118,7 +119,8 @@
118 119 static inline u32
119 120 ip_set_timeout_get(unsigned long timeout)
120 121 {
121   - return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
  122 + return timeout == IPSET_ELEM_PERMANENT ? 0 :
  123 + jiffies_to_msecs(timeout - jiffies)/1000;
122 124 }
123 125 #endif /* ! IP_SET_BITMAP_TIMEOUT */
124 126  
include/linux/ratelimit.h
... ... @@ -41,5 +41,45 @@
41 41 extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
42 42 #define __ratelimit(state) ___ratelimit(state, __func__)
43 43  
  44 +#ifdef CONFIG_PRINTK
  45 +
  46 +#define WARN_ON_RATELIMIT(condition, state) \
  47 + WARN_ON((condition) && __ratelimit(state))
  48 +
  49 +#define __WARN_RATELIMIT(condition, state, format...) \
  50 +({ \
  51 + int rtn = 0; \
  52 + if (unlikely(__ratelimit(state))) \
  53 + rtn = WARN(condition, format); \
  54 + rtn; \
  55 +})
  56 +
  57 +#define WARN_RATELIMIT(condition, format...) \
  58 +({ \
  59 + static DEFINE_RATELIMIT_STATE(_rs, \
  60 + DEFAULT_RATELIMIT_INTERVAL, \
  61 + DEFAULT_RATELIMIT_BURST); \
  62 + __WARN_RATELIMIT(condition, &_rs, format); \
  63 +})
  64 +
  65 +#else
  66 +
  67 +#define WARN_ON_RATELIMIT(condition, state) \
  68 + WARN_ON(condition)
  69 +
  70 +#define __WARN_RATELIMIT(condition, state, format...) \
  71 +({ \
  72 + int rtn = WARN(condition, format); \
  73 + rtn; \
  74 +})
  75 +
  76 +#define WARN_RATELIMIT(condition, format...) \
  77 +({ \
  78 + int rtn = WARN(condition, format); \
  79 + rtn; \
  80 +})
  81 +
  82 +#endif
  83 +
44 84 #endif /* _LINUX_RATELIMIT_H */
... ... @@ -797,7 +797,8 @@
797 797 struct list_head rs_table[IP_VS_RTAB_SIZE];
798 798 /* ip_vs_app */
799 799 struct list_head app_list;
800   -
  800 + /* ip_vs_ftp */
  801 + struct ip_vs_app *ftp_app;
801 802 /* ip_vs_proto */
802 803 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
803 804 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
include/net/net_namespace.h
... ... @@ -7,6 +7,7 @@
7 7 #include <asm/atomic.h>
8 8 #include <linux/workqueue.h>
9 9 #include <linux/list.h>
  10 +#include <linux/sysctl.h>
10 11  
11 12 #include <net/netns/core.h>
12 13 #include <net/netns/mib.h>
include/net/net_ratelimit.h
  1 +#ifndef _LINUX_NET_RATELIMIT_H
  2 +#define _LINUX_NET_RATELIMIT_H
  3 +
  4 +#include <linux/ratelimit.h>
  5 +
  6 +extern struct ratelimit_state net_ratelimit_state;
  7 +
  8 +#endif /* _LINUX_NET_RATELIMIT_H */
... ... @@ -46,8 +46,6 @@
46 46  
47 47 const char vlan_fullname[] = "802.1Q VLAN Support";
48 48 const char vlan_version[] = DRV_VERSION;
49   -static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>";
50   -static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
51 49  
52 50 /* End of global variables definitions. */
53 51  
... ... @@ -673,8 +671,7 @@
673 671 {
674 672 int err;
675 673  
676   - pr_info("%s v%s %s\n", vlan_fullname, vlan_version, vlan_copyright);
677   - pr_info("All bugs added by %s\n", vlan_buggyright);
  674 + pr_info("%s v%s\n", vlan_fullname, vlan_version);
678 675  
679 676 err = register_pernet_subsys(&vlan_net_ops);
680 677 if (err < 0)
... ... @@ -59,6 +59,14 @@
59 59 return pos - buf;
60 60 }
61 61  
  62 +static ssize_t show_atmindex(struct device *cdev,
  63 + struct device_attribute *attr, char *buf)
  64 +{
  65 + struct atm_dev *adev = to_atm_dev(cdev);
  66 +
  67 + return sprintf(buf, "%d\n", adev->number);
  68 +}
  69 +
62 70 static ssize_t show_carrier(struct device *cdev,
63 71 struct device_attribute *attr, char *buf)
64 72 {
... ... @@ -99,6 +107,7 @@
99 107  
100 108 static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
101 109 static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
  110 +static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL);
102 111 static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
103 112 static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
104 113 static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
... ... @@ -106,6 +115,7 @@
106 115 static struct device_attribute *atm_attrs[] = {
107 116 &dev_attr_atmaddress,
108 117 &dev_attr_address,
  118 + &dev_attr_atmindex,
109 119 &dev_attr_carrier,
110 120 &dev_attr_type,
111 121 &dev_attr_link_rate,
net/bridge/netfilter/ebtables.c
... ... @@ -1883,14 +1883,13 @@
1883 1883 struct xt_target *wt;
1884 1884 void *dst = NULL;
1885 1885 int off, pad = 0;
1886   - unsigned int size_kern, entry_offset, match_size = mwt->match_size;
  1886 + unsigned int size_kern, match_size = mwt->match_size;
1887 1887  
1888 1888 strlcpy(name, mwt->u.name, sizeof(name));
1889 1889  
1890 1890 if (state->buf_kern_start)
1891 1891 dst = state->buf_kern_start + state->buf_kern_offset;
1892 1892  
1893   - entry_offset = (unsigned char *) mwt - base;
1894 1893 switch (compat_mwt) {
1895 1894 case EBT_COMPAT_MATCH:
1896 1895 match = try_then_request_module(xt_find_match(NFPROTO_BRIDGE,
... ... @@ -1933,6 +1932,9 @@
1933 1932 size_kern = wt->targetsize;
1934 1933 module_put(wt->me);
1935 1934 break;
  1935 +
  1936 + default:
  1937 + return -EINVAL;
1936 1938 }
1937 1939  
1938 1940 state->buf_kern_offset += match_size + off;
... ... @@ -204,12 +204,11 @@
204 204  
205 205 hlist_for_each_entry_rcu(r, n, rx_list, list) {
206 206 char *fmt = (r->can_id & CAN_EFF_FLAG)?
207   - " %-5s %08X %08x %08x %08x %8ld %s\n" :
208   - " %-5s %03X %08x %08lx %08lx %8ld %s\n";
  207 + " %-5s %08x %08x %pK %pK %8ld %s\n" :
  208 + " %-5s %03x %08x %pK %pK %8ld %s\n";
209 209  
210 210 seq_printf(m, fmt, DNAME(dev), r->can_id, r->mask,
211   - (unsigned long)r->func, (unsigned long)r->data,
212   - r->matches, r->ident);
  211 + r->func, r->data, r->matches, r->ident);
213 212 }
214 213 }
215 214  
... ... @@ -233,6 +233,29 @@
233 233 return 1;
234 234 }
235 235  
  236 +static int ethtool_set_flags_compat(struct net_device *dev,
  237 + int (*legacy_set)(struct net_device *, u32),
  238 + struct ethtool_set_features_block *features, u32 mask)
  239 +{
  240 + u32 value;
  241 +
  242 + if (!legacy_set)
  243 + return 0;
  244 +
  245 + if (!(features[0].valid & mask))
  246 + return 0;
  247 +
  248 + value = dev->features & ~features[0].valid;
  249 + value |= features[0].requested;
  250 +
  251 + features[0].valid &= ~mask;
  252 +
  253 + if (legacy_set(dev, value & mask) < 0)
  254 + netdev_info(dev, "Legacy flags change failed\n");
  255 +
  256 + return 1;
  257 +}
  258 +
236 259 static int ethtool_set_features_compat(struct net_device *dev,
237 260 struct ethtool_set_features_block *features)
238 261 {
... ... @@ -249,7 +272,7 @@
249 272 features, NETIF_F_ALL_TSO);
250 273 compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_rx_csum,
251 274 features, NETIF_F_RXCSUM);
252   - compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_flags,
  275 + compat |= ethtool_set_flags_compat(dev, dev->ethtool_ops->set_flags,
253 276 features, flags_dup_features);
254 277  
255 278 return compat;
... ... @@ -38,6 +38,7 @@
38 38 #include <asm/unaligned.h>
39 39 #include <linux/filter.h>
40 40 #include <linux/reciprocal_div.h>
  41 +#include <linux/ratelimit.h>
41 42  
42 43 /* No hurry in this branch */
43 44 static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size)
net/core/sysctl_net_core.c
... ... @@ -17,6 +17,7 @@
17 17  
18 18 #include <net/ip.h>
19 19 #include <net/sock.h>
  20 +#include <net/net_ratelimit.h>
20 21  
21 22 #ifdef CONFIG_RPS
22 23 static int rps_sock_flow_sysctl(ctl_table *table, int write,
... ... @@ -27,6 +27,7 @@
27 27 #include <linux/ratelimit.h>
28 28  
29 29 #include <net/sock.h>
  30 +#include <net/net_ratelimit.h>
30 31  
31 32 #include <asm/byteorder.h>
32 33 #include <asm/system.h>
... ... @@ -154,11 +154,9 @@
154 154 /* Called with or without local BH being disabled. */
155 155 static void unlink_from_unused(struct inet_peer *p)
156 156 {
157   - if (!list_empty(&p->unused)) {
158   - spin_lock_bh(&unused_peers.lock);
159   - list_del_init(&p->unused);
160   - spin_unlock_bh(&unused_peers.lock);
161   - }
  157 + spin_lock_bh(&unused_peers.lock);
  158 + list_del_init(&p->unused);
  159 + spin_unlock_bh(&unused_peers.lock);
162 160 }
163 161  
164 162 static int addr_compare(const struct inetpeer_addr *a,
... ... @@ -205,6 +203,20 @@
205 203 u; \
206 204 })
207 205  
  206 +static bool atomic_add_unless_return(atomic_t *ptr, int a, int u, int *newv)
  207 +{
  208 + int cur, old = atomic_read(ptr);
  209 +
  210 + while (old != u) {
  211 + *newv = old + a;
  212 + cur = atomic_cmpxchg(ptr, old, *newv);
  213 + if (cur == old)
  214 + return true;
  215 + old = cur;
  216 + }
  217 + return false;
  218 +}
  219 +
208 220 /*
209 221 * Called with rcu_read_lock()
210 222 * Because we hold no lock against a writer, its quite possible we fall
... ... @@ -213,7 +225,8 @@
213 225 * We exit from this function if number of links exceeds PEER_MAXDEPTH
214 226 */
215 227 static struct inet_peer *lookup_rcu(const struct inetpeer_addr *daddr,
216   - struct inet_peer_base *base)
  228 + struct inet_peer_base *base,
  229 + int *newrefcnt)
217 230 {
218 231 struct inet_peer *u = rcu_dereference(base->root);
219 232 int count = 0;
... ... @@ -226,7 +239,7 @@
226 239 * distinction between an unused entry (refcnt=0) and
227 240 * a freed one.
228 241 */
229   - if (unlikely(!atomic_add_unless(&u->refcnt, 1, -1)))
  242 + if (!atomic_add_unless_return(&u->refcnt, 1, -1, newrefcnt))
230 243 u = NULL;
231 244 return u;
232 245 }
233 246  
234 247  
235 248  
... ... @@ -465,22 +478,23 @@
465 478 struct inet_peer_base *base = family_to_base(daddr->family);
466 479 struct inet_peer *p;
467 480 unsigned int sequence;
468   - int invalidated;
  481 + int invalidated, newrefcnt = 0;
469 482  
470 483 /* Look up for the address quickly, lockless.
471 484 * Because of a concurrent writer, we might not find an existing entry.
472 485 */
473 486 rcu_read_lock();
474 487 sequence = read_seqbegin(&base->lock);
475   - p = lookup_rcu(daddr, base);
  488 + p = lookup_rcu(daddr, base, &newrefcnt);
476 489 invalidated = read_seqretry(&base->lock, sequence);
477 490 rcu_read_unlock();
478 491  
479 492 if (p) {
480   - /* The existing node has been found.
  493 +found: /* The existing node has been found.
481 494 * Remove the entry from unused list if it was there.
482 495 */
483   - unlink_from_unused(p);
  496 + if (newrefcnt == 1)
  497 + unlink_from_unused(p);
484 498 return p;
485 499 }
486 500  
487 501  
... ... @@ -494,11 +508,9 @@
494 508 write_seqlock_bh(&base->lock);
495 509 p = lookup(daddr, stack, base);
496 510 if (p != peer_avl_empty) {
497   - atomic_inc(&p->refcnt);
  511 + newrefcnt = atomic_inc_return(&p->refcnt);
498 512 write_sequnlock_bh(&base->lock);
499   - /* Remove the entry from unused list if it was there. */
500   - unlink_from_unused(p);
501   - return p;
  513 + goto found;
502 514 }
503 515 p = create ? kmem_cache_alloc(peer_cachep, GFP_ATOMIC) : NULL;
504 516 if (p) {
net/netfilter/ipset/ip_set_core.c
... ... @@ -815,7 +815,7 @@
815 815 ip_set_id_t i;
816 816  
817 817 if (unlikely(protocol_failed(attr)))
818   - return -EPROTO;
  818 + return -IPSET_ERR_PROTOCOL;
819 819  
820 820 if (!attr[IPSET_ATTR_SETNAME]) {
821 821 for (i = 0; i < ip_set_max; i++)
net/netfilter/ipvs/ip_vs_ftp.c
... ... @@ -411,25 +411,35 @@
411 411 static int __net_init __ip_vs_ftp_init(struct net *net)
412 412 {
413 413 int i, ret;
414   - struct ip_vs_app *app = &ip_vs_ftp;
  414 + struct ip_vs_app *app;
  415 + struct netns_ipvs *ipvs = net_ipvs(net);
415 416  
  417 + app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL);
  418 + if (!app)
  419 + return -ENOMEM;
  420 + INIT_LIST_HEAD(&app->a_list);
  421 + INIT_LIST_HEAD(&app->incs_list);
  422 + ipvs->ftp_app = app;
  423 +
416 424 ret = register_ip_vs_app(net, app);
417 425 if (ret)
418   - return ret;
  426 + goto err_exit;
419 427  
420 428 for (i=0; i<IP_VS_APP_MAX_PORTS; i++) {
421 429 if (!ports[i])
422 430 continue;
423 431 ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]);
424 432 if (ret)
425   - break;
  433 + goto err_unreg;
426 434 pr_info("%s: loaded support on port[%d] = %d\n",
427 435 app->name, i, ports[i]);
428 436 }
  437 + return 0;
429 438  
430   - if (ret)
431   - unregister_ip_vs_app(net, app);
432   -
  439 +err_unreg:
  440 + unregister_ip_vs_app(net, app);
  441 +err_exit:
  442 + kfree(ipvs->ftp_app);
433 443 return ret;
434 444 }
435 445 /*
436 446  
... ... @@ -437,9 +447,10 @@
437 447 */
438 448 static void __ip_vs_ftp_exit(struct net *net)
439 449 {
440   - struct ip_vs_app *app = &ip_vs_ftp;
  450 + struct netns_ipvs *ipvs = net_ipvs(net);
441 451  
442   - unregister_ip_vs_app(net, app);
  452 + unregister_ip_vs_app(net, ipvs->ftp_app);
  453 + kfree(ipvs->ftp_app);
443 454 }
444 455  
445 456 static struct pernet_operations ip_vs_ftp_ops = {