Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 27 May 2011 18:16:27 +0000 (11:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 27 May 2011 18:16:27 +0000 (11:16 -0700)
* 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

23 files changed:
drivers/net/bonding/bond_main.c
drivers/net/davinci_emac.c
include/asm-generic/bug.h
include/linux/if_ether.h
include/linux/net.h
include/linux/netfilter.h
include/linux/netfilter/ipset/ip_set_ahash.h
include/linux/netfilter/ipset/ip_set_timeout.h
include/linux/ratelimit.h
include/net/ip_vs.h
include/net/net_namespace.h
include/net/net_ratelimit.h [new file with mode: 0644]
net/8021q/vlan.c
net/atm/atm_sysfs.c
net/bridge/netfilter/ebtables.c
net/can/proc.c
net/core/ethtool.c
net/core/filter.c
net/core/sysctl_net_core.c
net/core/utils.c
net/ipv4/inetpeer.c
net/netfilter/ipset/ip_set_core.c
net/netfilter/ipvs/ip_vs_ftp.c

index 6141667..17b4dd9 100644 (file)
@@ -113,9 +113,11 @@ MODULE_PARM_DESC(max_bonds, "Max number of bonded devices");
 module_param(tx_queues, int, 0);
 MODULE_PARM_DESC(tx_queues, "Max number of transmit queues (default = 16)");
 module_param_named(num_grat_arp, num_peer_notif, int, 0644);
-MODULE_PARM_DESC(num_grat_arp, "Number of peer notifications to send on failover event (alias of num_unsol_na)");
+MODULE_PARM_DESC(num_grat_arp, "Number of peer notifications to send on "
+                              "failover event (alias of num_unsol_na)");
 module_param_named(num_unsol_na, num_peer_notif, int, 0644);
-MODULE_PARM_DESC(num_unsol_na, "Number of peer notifications to send on failover event (alias of num_grat_arp)");
+MODULE_PARM_DESC(num_unsol_na, "Number of peer notifications to send on "
+                              "failover event (alias of num_grat_arp)");
 module_param(miimon, int, 0);
 MODULE_PARM_DESC(miimon, "Link check interval in milliseconds");
 module_param(updelay, int, 0);
@@ -127,7 +129,7 @@ module_param(use_carrier, int, 0);
 MODULE_PARM_DESC(use_carrier, "Use netif_carrier_ok (vs MII ioctls) in miimon; "
                              "0 for off, 1 for on (default)");
 module_param(mode, charp, 0);
-MODULE_PARM_DESC(mode, "Mode of operation : 0 for balance-rr, "
+MODULE_PARM_DESC(mode, "Mode of operation; 0 for balance-rr, "
                       "1 for active-backup, 2 for balance-xor, "
                       "3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, "
                       "6 for balance-alb");
@@ -142,27 +144,35 @@ MODULE_PARM_DESC(primary_reselect, "Reselect primary slave "
                                   "2 for only on active slave "
                                   "failure");
 module_param(lacp_rate, charp, 0);
-MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner "
-                           "(slow/fast)");
+MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner; "
+                           "0 for slow, 1 for fast");
 module_param(ad_select, charp, 0);
-MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic: stable (0, default), bandwidth (1), count (2)");
+MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic; "
+                           "0 for stable (default), 1 for bandwidth, "
+                           "2 for count");
 module_param(xmit_hash_policy, charp, 0);
-MODULE_PARM_DESC(xmit_hash_policy, "XOR hashing method: 0 for layer 2 (default)"
-                                  ", 1 for layer 3+4");
+MODULE_PARM_DESC(xmit_hash_policy, "balance-xor and 802.3ad hashing method; "
+                                  "0 for layer 2 (default), 1 for layer 3+4, "
+                                  "2 for layer 2+3");
 module_param(arp_interval, int, 0);
 MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds");
 module_param_array(arp_ip_target, charp, NULL, 0);
 MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form");
 module_param(arp_validate, charp, 0);
-MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes: none (default), active, backup or all");
+MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes; "
+                              "0 for none (default), 1 for active, "
+                              "2 for backup, 3 for all");
 module_param(fail_over_mac, charp, 0);
-MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to the same MAC.  none (default), active or follow");
+MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to "
+                               "the same MAC; 0 for none (default), "
+                               "1 for active, 2 for follow");
 module_param(all_slaves_active, int, 0);
 MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface"
-                                    "by setting active flag for all slaves "
+                                    "by setting active flag for all slaves; "
                                     "0 for never (default), 1 for always.");
 module_param(resend_igmp, int, 0);
-MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on link failure");
+MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on "
+                             "link failure");
 
 /*----------------------------- Global variables ----------------------------*/
 
index 807b6bb..29a4f06 100644 (file)
@@ -1772,7 +1772,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
        /* obtain emac clock from kernel */
        emac_clk = clk_get(&pdev->dev, NULL);
        if (IS_ERR(emac_clk)) {
-               printk(KERN_ERR "DaVinci EMAC: Failed to get EMAC clock\n");
+               dev_err(&pdev->dev, "failed to get EMAC clock\n");
                return -EBUSY;
        }
        emac_bus_frequency = clk_get_rate(emac_clk);
@@ -1780,7 +1780,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
 
        ndev = alloc_etherdev(sizeof(struct emac_priv));
        if (!ndev) {
-               printk(KERN_ERR "DaVinci EMAC: Error allocating net_device\n");
+               dev_err(&pdev->dev, "error allocating net_device\n");
                clk_put(emac_clk);
                return -ENOMEM;
        }
@@ -1795,7 +1795,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
 
        pdata = pdev->dev.platform_data;
        if (!pdata) {
-               printk(KERN_ERR "DaVinci EMAC: No platform data\n");
+               dev_err(&pdev->dev, "no platform data\n");
                return -ENODEV;
        }
 
@@ -1814,7 +1814,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
        /* Get EMAC platform data */
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res) {
-               dev_err(emac_dev, "DaVinci EMAC: Error getting res\n");
+               dev_err(&pdev->dev,"error getting res\n");
                rc = -ENOENT;
                goto probe_quit;
        }
@@ -1822,14 +1822,14 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
        priv->emac_base_phys = res->start + pdata->ctrl_reg_offset;
        size = res->end - res->start + 1;
        if (!request_mem_region(res->start, size, ndev->name)) {
-               dev_err(emac_dev, "DaVinci EMAC: failed request_mem_region() for regs\n");
+               dev_err(&pdev->dev, "failed request_mem_region() for regs\n");
                rc = -ENXIO;
                goto probe_quit;
        }
 
        priv->remap_addr = ioremap(res->start, size);
        if (!priv->remap_addr) {
-               dev_err(emac_dev, "Unable to map IO\n");
+               dev_err(&pdev->dev, "unable to map IO\n");
                rc = -ENOMEM;
                release_mem_region(res->start, size);
                goto probe_quit;
@@ -1863,7 +1863,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
 
        priv->dma = cpdma_ctlr_create(&dma_params);
        if (!priv->dma) {
-               dev_err(emac_dev, "DaVinci EMAC: Error initializing DMA\n");
+               dev_err(&pdev->dev, "error initializing DMA\n");
                rc = -ENOMEM;
                goto no_dma;
        }
@@ -1879,7 +1879,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
 
        res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
        if (!res) {
-               dev_err(emac_dev, "DaVinci EMAC: Error getting irq res\n");
+               dev_err(&pdev->dev, "error getting irq res\n");
                rc = -ENOENT;
                goto no_irq_res;
        }
@@ -1888,8 +1888,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
        if (!is_valid_ether_addr(priv->mac_addr)) {
                /* Use random MAC if none passed */
                random_ether_addr(priv->mac_addr);
-               printk(KERN_WARNING "%s: using random MAC addr: %pM\n",
-                               __func__, priv->mac_addr);
+               dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
+                                                       priv->mac_addr);
        }
 
        ndev->netdev_ops = &emac_netdev_ops;
@@ -1902,7 +1902,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
        SET_NETDEV_DEV(ndev, &pdev->dev);
        rc = register_netdev(ndev);
        if (rc) {
-               dev_err(emac_dev, "DaVinci EMAC: Error in register_netdev\n");
+               dev_err(&pdev->dev, "error in register_netdev\n");
                rc = -ENODEV;
                goto netdev_reg_err;
        }
index 9178484..dfb0ec6 100644 (file)
@@ -162,46 +162,6 @@ extern void warn_slowpath_null(const char *file, const int line);
        unlikely(__ret_warn_once);                              \
 })
 
-#ifdef CONFIG_PRINTK
-
-#define WARN_ON_RATELIMIT(condition, state)                    \
-               WARN_ON((condition) && __ratelimit(state))
-
-#define __WARN_RATELIMIT(condition, state, format...)          \
-({                                                             \
-       int rtn = 0;                                            \
-       if (unlikely(__ratelimit(state)))                       \
-               rtn = WARN(condition, format);                  \
-       rtn;                                                    \
-})
-
-#define WARN_RATELIMIT(condition, format...)                   \
-({                                                             \
-       static DEFINE_RATELIMIT_STATE(_rs,                      \
-                                     DEFAULT_RATELIMIT_INTERVAL,       \
-                                     DEFAULT_RATELIMIT_BURST); \
-       __WARN_RATELIMIT(condition, &_rs, format);              \
-})
-
-#else
-
-#define WARN_ON_RATELIMIT(condition, state)                    \
-       WARN_ON(condition)
-
-#define __WARN_RATELIMIT(condition, state, format...)          \
-({                                                             \
-       int rtn = WARN(condition, format);                      \
-       rtn;                                                    \
-})
-
-#define WARN_RATELIMIT(condition, format...)                   \
-({                                                             \
-       int rtn = WARN(condition, format);                      \
-       rtn;                                                    \
-})
-
-#endif
-
 /*
  * WARN_ON_SMP() is for cases that the warning is either
  * meaningless for !SMP or may even cause failures.
index 0f1325d..0065ffd 100644 (file)
@@ -132,10 +132,6 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
 
 int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
 
-#ifdef CONFIG_SYSCTL
-extern struct ctl_table ether_table[];
-#endif
-
 int mac_pton(const char *s, u8 *mac);
 extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
 
index 1da55e9..b299230 100644 (file)
@@ -289,11 +289,5 @@ extern int kernel_sock_shutdown(struct socket *sock,
        MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \
                     "-type-" __stringify(type))
 
-#ifdef CONFIG_SYSCTL
-#include <linux/sysctl.h>
-#include <linux/ratelimit.h>
-extern struct ratelimit_state net_ratelimit_state;
-#endif
-
 #endif /* __KERNEL__ */
 #endif /* _LINUX_NET_H */
index 7fa95df..857f502 100644 (file)
@@ -13,6 +13,7 @@
 #endif
 #include <linux/types.h>
 #include <linux/compiler.h>
+#include <linux/sysctl.h>
 
 /* Responses from hook functions. */
 #define NF_DROP 0
index a0196ac..ac3c822 100644 (file)
@@ -839,7 +839,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
        struct htable *t = h->table;
        const struct type_pf_elem *d = value;
        struct hbucket *n;
-       int i, ret = 0;
+       int i;
        struct type_pf_elem *data;
        u32 key;
 
@@ -850,7 +850,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
                if (!type_pf_data_equal(data, d))
                        continue;
                if (type_pf_data_expired(data))
-                       ret = -IPSET_ERR_EXIST;
+                       return -IPSET_ERR_EXIST;
                if (i != n->pos - 1)
                        /* Not last one */
                        type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));
index 9f30c5f..bcdd40a 100644 (file)
@@ -45,7 +45,7 @@ ip_set_timeout_test(unsigned long timeout)
 {
        return timeout != IPSET_ELEM_UNSET &&
               (timeout == IPSET_ELEM_PERMANENT ||
-               time_after(timeout, jiffies));
+               time_is_after_jiffies(timeout));
 }
 
 static inline bool
@@ -53,7 +53,7 @@ ip_set_timeout_expired(unsigned long timeout)
 {
        return timeout != IPSET_ELEM_UNSET &&
               timeout != IPSET_ELEM_PERMANENT &&
-              time_before(timeout, jiffies);
+              time_is_before_jiffies(timeout);
 }
 
 static inline unsigned long
@@ -64,7 +64,7 @@ ip_set_timeout_set(u32 timeout)
        if (!timeout)
                return IPSET_ELEM_PERMANENT;
 
-       t = timeout * HZ + jiffies;
+       t = msecs_to_jiffies(timeout * 1000) + jiffies;
        if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
                /* Bingo! */
                t++;
@@ -75,7 +75,8 @@ ip_set_timeout_set(u32 timeout)
 static inline u32
 ip_set_timeout_get(unsigned long timeout)
 {
-       return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
+       return timeout == IPSET_ELEM_PERMANENT ? 0 : 
+               jiffies_to_msecs(timeout - jiffies)/1000;
 }
 
 #else
@@ -89,14 +90,14 @@ static inline bool
 ip_set_timeout_test(unsigned long timeout)
 {
        return timeout == IPSET_ELEM_PERMANENT ||
-              time_after(timeout, jiffies);
+              time_is_after_jiffies(timeout);
 }
 
 static inline bool
 ip_set_timeout_expired(unsigned long timeout)
 {
        return timeout != IPSET_ELEM_PERMANENT &&
-              time_before(timeout, jiffies);
+              time_is_before_jiffies(timeout);
 }
 
 static inline unsigned long
@@ -107,7 +108,7 @@ ip_set_timeout_set(u32 timeout)
        if (!timeout)
                return IPSET_ELEM_PERMANENT;
 
-       t = timeout * HZ + jiffies;
+       t = msecs_to_jiffies(timeout * 1000) + jiffies;
        if (t == IPSET_ELEM_PERMANENT)
                /* Bingo! :-) */
                t++;
@@ -118,7 +119,8 @@ ip_set_timeout_set(u32 timeout)
 static inline u32
 ip_set_timeout_get(unsigned long timeout)
 {
-       return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
+       return timeout == IPSET_ELEM_PERMANENT ? 0 :
+               jiffies_to_msecs(timeout - jiffies)/1000;
 }
 #endif /* ! IP_SET_BITMAP_TIMEOUT */
 
index 03ff67b..2f00715 100644 (file)
@@ -41,4 +41,44 @@ extern struct ratelimit_state printk_ratelimit_state;
 extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
 #define __ratelimit(state) ___ratelimit(state, __func__)
 
+#ifdef CONFIG_PRINTK
+
+#define WARN_ON_RATELIMIT(condition, state)                    \
+               WARN_ON((condition) && __ratelimit(state))
+
+#define __WARN_RATELIMIT(condition, state, format...)          \
+({                                                             \
+       int rtn = 0;                                            \
+       if (unlikely(__ratelimit(state)))                       \
+               rtn = WARN(condition, format);                  \
+       rtn;                                                    \
+})
+
+#define WARN_RATELIMIT(condition, format...)                   \
+({                                                             \
+       static DEFINE_RATELIMIT_STATE(_rs,                      \
+                                     DEFAULT_RATELIMIT_INTERVAL,       \
+                                     DEFAULT_RATELIMIT_BURST); \
+       __WARN_RATELIMIT(condition, &_rs, format);              \
+})
+
+#else
+
+#define WARN_ON_RATELIMIT(condition, state)                    \
+       WARN_ON(condition)
+
+#define __WARN_RATELIMIT(condition, state, format...)          \
+({                                                             \
+       int rtn = WARN(condition, format);                      \
+       rtn;                                                    \
+})
+
+#define WARN_RATELIMIT(condition, format...)                   \
+({                                                             \
+       int rtn = WARN(condition, format);                      \
+       rtn;                                                    \
+})
+
+#endif
+
 #endif /* _LINUX_RATELIMIT_H */
index 4fff432..481f856 100644 (file)
@@ -797,7 +797,8 @@ struct netns_ipvs {
        struct list_head        rs_table[IP_VS_RTAB_SIZE];
        /* ip_vs_app */
        struct list_head        app_list;
-
+       /* ip_vs_ftp */
+       struct ip_vs_app        *ftp_app;
        /* ip_vs_proto */
        #define IP_VS_PROTO_TAB_SIZE    32      /* must be power of 2 */
        struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
index dcc8f57..2bf9ed9 100644 (file)
@@ -7,6 +7,7 @@
 #include <asm/atomic.h>
 #include <linux/workqueue.h>
 #include <linux/list.h>
+#include <linux/sysctl.h>
 
 #include <net/netns/core.h>
 #include <net/netns/mib.h>
diff --git a/include/net/net_ratelimit.h b/include/net/net_ratelimit.h
new file mode 100644 (file)
index 0000000..7727b42
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef _LINUX_NET_RATELIMIT_H
+#define _LINUX_NET_RATELIMIT_H
+
+#include <linux/ratelimit.h>
+
+extern struct ratelimit_state net_ratelimit_state;
+
+#endif /* _LINUX_NET_RATELIMIT_H */
index b2274d1..c7a581a 100644 (file)
@@ -46,8 +46,6 @@ int vlan_net_id __read_mostly;
 
 const char vlan_fullname[] = "802.1Q VLAN Support";
 const char vlan_version[] = DRV_VERSION;
-static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>";
-static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
 
 /* End of global variables definitions. */
 
@@ -673,8 +671,7 @@ static int __init vlan_proto_init(void)
 {
        int err;
 
-       pr_info("%s v%s %s\n", vlan_fullname, vlan_version, vlan_copyright);
-       pr_info("All bugs added by %s\n", vlan_buggyright);
+       pr_info("%s v%s\n", vlan_fullname, vlan_version);
 
        err = register_pernet_subsys(&vlan_net_ops);
        if (err < 0)
index f7fa67c..f49da58 100644 (file)
@@ -59,6 +59,14 @@ static ssize_t show_atmaddress(struct device *cdev,
        return pos - buf;
 }
 
+static ssize_t show_atmindex(struct device *cdev,
+                            struct device_attribute *attr, char *buf)
+{
+       struct atm_dev *adev = to_atm_dev(cdev);
+
+       return sprintf(buf, "%d\n", adev->number);
+}
+
 static ssize_t show_carrier(struct device *cdev,
                            struct device_attribute *attr, char *buf)
 {
@@ -99,6 +107,7 @@ static ssize_t show_link_rate(struct device *cdev,
 
 static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
 static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
+static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL);
 static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
 static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
 static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
@@ -106,6 +115,7 @@ static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
 static struct device_attribute *atm_attrs[] = {
        &dev_attr_atmaddress,
        &dev_attr_address,
+       &dev_attr_atmindex,
        &dev_attr_carrier,
        &dev_attr_type,
        &dev_attr_link_rate,
index 1a92b36..2b5ca1a 100644 (file)
@@ -1883,14 +1883,13 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt,
        struct xt_target *wt;
        void *dst = NULL;
        int off, pad = 0;
-       unsigned int size_kern, entry_offset, match_size = mwt->match_size;
+       unsigned int size_kern, match_size = mwt->match_size;
 
        strlcpy(name, mwt->u.name, sizeof(name));
 
        if (state->buf_kern_start)
                dst = state->buf_kern_start + state->buf_kern_offset;
 
-       entry_offset = (unsigned char *) mwt - base;
        switch (compat_mwt) {
        case EBT_COMPAT_MATCH:
                match = try_then_request_module(xt_find_match(NFPROTO_BRIDGE,
@@ -1933,6 +1932,9 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt,
                size_kern = wt->targetsize;
                module_put(wt->me);
                break;
+
+       default:
+               return -EINVAL;
        }
 
        state->buf_kern_offset += match_size + off;
index f4265cc..0016f73 100644 (file)
@@ -204,12 +204,11 @@ static void can_print_rcvlist(struct seq_file *m, struct hlist_head *rx_list,
 
        hlist_for_each_entry_rcu(r, n, rx_list, list) {
                char *fmt = (r->can_id & CAN_EFF_FLAG)?
-                       "   %-5s  %08X  %08x  %08x  %08x  %8ld  %s\n" :
-                       "   %-5s     %03X    %08x  %08lx  %08lx  %8ld  %s\n";
+                       "   %-5s  %08x  %08x  %pK  %pK  %8ld  %s\n" :
+                       "   %-5s     %03x    %08x  %pK  %pK  %8ld  %s\n";
 
                seq_printf(m, fmt, DNAME(dev), r->can_id, r->mask,
-                               (unsigned long)r->func, (unsigned long)r->data,
-                               r->matches, r->ident);
+                               r->func, r->data, r->matches, r->ident);
        }
 }
 
index 84e7304..fd14116 100644 (file)
@@ -233,6 +233,29 @@ static int ethtool_set_feature_compat(struct net_device *dev,
        return 1;
 }
 
+static int ethtool_set_flags_compat(struct net_device *dev,
+       int (*legacy_set)(struct net_device *, u32),
+       struct ethtool_set_features_block *features, u32 mask)
+{
+       u32 value;
+
+       if (!legacy_set)
+               return 0;
+
+       if (!(features[0].valid & mask))
+               return 0;
+
+       value = dev->features & ~features[0].valid;
+       value |= features[0].requested;
+
+       features[0].valid &= ~mask;
+
+       if (legacy_set(dev, value & mask) < 0)
+               netdev_info(dev, "Legacy flags change failed\n");
+
+       return 1;
+}
+
 static int ethtool_set_features_compat(struct net_device *dev,
        struct ethtool_set_features_block *features)
 {
@@ -249,7 +272,7 @@ static int ethtool_set_features_compat(struct net_device *dev,
                features, NETIF_F_ALL_TSO);
        compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_rx_csum,
                features, NETIF_F_RXCSUM);
-       compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_flags,
+       compat |= ethtool_set_flags_compat(dev, dev->ethtool_ops->set_flags,
                features, flags_dup_features);
 
        return compat;
index 0e3622f..36f975f 100644 (file)
@@ -38,6 +38,7 @@
 #include <asm/unaligned.h>
 #include <linux/filter.h>
 #include <linux/reciprocal_div.h>
+#include <linux/ratelimit.h>
 
 /* No hurry in this branch */
 static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size)
index a829e3f..77a65f0 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <net/ip.h>
 #include <net/sock.h>
+#include <net/net_ratelimit.h>
 
 #ifdef CONFIG_RPS
 static int rps_sock_flow_sysctl(ctl_table *table, int write,
index 2012bc7..386e263 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/ratelimit.h>
 
 #include <net/sock.h>
+#include <net/net_ratelimit.h>
 
 #include <asm/byteorder.h>
 #include <asm/system.h>
index 9df4e63..ce616d9 100644 (file)
@@ -154,11 +154,9 @@ void __init inet_initpeers(void)
 /* Called with or without local BH being disabled. */
 static void unlink_from_unused(struct inet_peer *p)
 {
-       if (!list_empty(&p->unused)) {
-               spin_lock_bh(&unused_peers.lock);
-               list_del_init(&p->unused);
-               spin_unlock_bh(&unused_peers.lock);
-       }
+       spin_lock_bh(&unused_peers.lock);
+       list_del_init(&p->unused);
+       spin_unlock_bh(&unused_peers.lock);
 }
 
 static int addr_compare(const struct inetpeer_addr *a,
@@ -205,6 +203,20 @@ static int addr_compare(const struct inetpeer_addr *a,
        u;                                                      \
 })
 
+static bool atomic_add_unless_return(atomic_t *ptr, int a, int u, int *newv)
+{
+       int cur, old = atomic_read(ptr);
+
+       while (old != u) {
+               *newv = old + a;
+               cur = atomic_cmpxchg(ptr, old, *newv);
+               if (cur == old)
+                       return true;
+               old = cur;
+       }
+       return false;
+}
+
 /*
  * Called with rcu_read_lock()
  * Because we hold no lock against a writer, its quite possible we fall
@@ -213,7 +225,8 @@ static int addr_compare(const struct inetpeer_addr *a,
  * We exit from this function if number of links exceeds PEER_MAXDEPTH
  */
 static struct inet_peer *lookup_rcu(const struct inetpeer_addr *daddr,
-                                   struct inet_peer_base *base)
+                                   struct inet_peer_base *base,
+                                   int *newrefcnt)
 {
        struct inet_peer *u = rcu_dereference(base->root);
        int count = 0;
@@ -226,7 +239,7 @@ static struct inet_peer *lookup_rcu(const struct inetpeer_addr *daddr,
                         * distinction between an unused entry (refcnt=0) and
                         * a freed one.
                         */
-                       if (unlikely(!atomic_add_unless(&u->refcnt, 1, -1)))
+                       if (!atomic_add_unless_return(&u->refcnt, 1, -1, newrefcnt))
                                u = NULL;
                        return u;
                }
@@ -465,22 +478,23 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
        struct inet_peer_base *base = family_to_base(daddr->family);
        struct inet_peer *p;
        unsigned int sequence;
-       int invalidated;
+       int invalidated, newrefcnt = 0;
 
        /* Look up for the address quickly, lockless.
         * Because of a concurrent writer, we might not find an existing entry.
         */
        rcu_read_lock();
        sequence = read_seqbegin(&base->lock);
-       p = lookup_rcu(daddr, base);
+       p = lookup_rcu(daddr, base, &newrefcnt);
        invalidated = read_seqretry(&base->lock, sequence);
        rcu_read_unlock();
 
        if (p) {
-               /* The existing node has been found.
+found:         /* The existing node has been found.
                 * Remove the entry from unused list if it was there.
                 */
-               unlink_from_unused(p);
+               if (newrefcnt == 1)
+                       unlink_from_unused(p);
                return p;
        }
 
@@ -494,11 +508,9 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
        write_seqlock_bh(&base->lock);
        p = lookup(daddr, stack, base);
        if (p != peer_avl_empty) {
-               atomic_inc(&p->refcnt);
+               newrefcnt = atomic_inc_return(&p->refcnt);
                write_sequnlock_bh(&base->lock);
-               /* Remove the entry from unused list if it was there. */
-               unlink_from_unused(p);
-               return p;
+               goto found;
        }
        p = create ? kmem_cache_alloc(peer_cachep, GFP_ATOMIC) : NULL;
        if (p) {
index 72d1ac6..8041bef 100644 (file)
@@ -815,7 +815,7 @@ ip_set_flush(struct sock *ctnl, struct sk_buff *skb,
        ip_set_id_t i;
 
        if (unlikely(protocol_failed(attr)))
-               return -EPROTO;
+               return -IPSET_ERR_PROTOCOL;
 
        if (!attr[IPSET_ATTR_SETNAME]) {
                for (i = 0; i < ip_set_max; i++)
index 6b5dd6d..af63553 100644 (file)
@@ -411,25 +411,35 @@ static struct ip_vs_app ip_vs_ftp = {
 static int __net_init __ip_vs_ftp_init(struct net *net)
 {
        int i, ret;
-       struct ip_vs_app *app = &ip_vs_ftp;
+       struct ip_vs_app *app;
+       struct netns_ipvs *ipvs = net_ipvs(net);
+
+       app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL);
+       if (!app)
+               return -ENOMEM;
+       INIT_LIST_HEAD(&app->a_list);
+       INIT_LIST_HEAD(&app->incs_list);
+       ipvs->ftp_app = app;
 
        ret = register_ip_vs_app(net, app);
        if (ret)
-               return ret;
+               goto err_exit;
 
        for (i=0; i<IP_VS_APP_MAX_PORTS; i++) {
                if (!ports[i])
                        continue;
                ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]);
                if (ret)
-                       break;
+                       goto err_unreg;
                pr_info("%s: loaded support on port[%d] = %d\n",
                        app->name, i, ports[i]);
        }
+       return 0;
 
-       if (ret)
-               unregister_ip_vs_app(net, app);
-
+err_unreg:
+       unregister_ip_vs_app(net, app);
+err_exit:
+       kfree(ipvs->ftp_app);
        return ret;
 }
 /*
@@ -437,9 +447,10 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
  */
 static void __ip_vs_ftp_exit(struct net *net)
 {
-       struct ip_vs_app *app = &ip_vs_ftp;
+       struct netns_ipvs *ipvs = net_ipvs(net);
 
-       unregister_ip_vs_app(net, app);
+       unregister_ip_vs_app(net, ipvs->ftp_app);
+       kfree(ipvs->ftp_app);
 }
 
 static struct pernet_operations ip_vs_ftp_ops = {