Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 May 2010 23:59:51 +0000 (16:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 May 2010 23:59:51 +0000 (16:59 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (63 commits)
  drivers/net/usb/asix.c: Fix pointer cast.
  be2net: Bug fix to avoid disabling bottom half during firmware upgrade.
  proc_dointvec: write a single value
  hso: add support for new products
  Phonet: fix potential use-after-free in pep_sock_close()
  ath9k: remove VEOL support for ad-hoc
  ath9k: change beacon allocation to prefer the first beacon slot
  sock.h: fix kernel-doc warning
  cls_cgroup: Fix build error when built-in
  macvlan: do proper cleanup in macvlan_common_newlink() V2
  be2net: Bug fix in init code in probe
  net/dccp: expansion of error code size
  ath9k: Fix rx of mcast/bcast frames in PS mode with auto sleep
  wireless: fix sta_info.h kernel-doc warnings
  wireless: fix mac80211.h kernel-doc warnings
  iwlwifi: testing the wrong variable in iwl_add_bssid_station()
  ath9k_htc: rare leak in ath9k_hif_usb_alloc_tx_urbs()
  ath9k_htc: dereferencing before check in hif_usb_tx_cb()
  rt2x00: Fix rt2800usb TX descriptor writing.
  rt2x00: Fix failed SLEEP->AWAKE and AWAKE->SLEEP transitions.
  ...

1  2 
drivers/isdn/gigaset/capi.c
drivers/net/tun.c
kernel/sysctl.c
net/core/dev.c
net/core/skbuff.c

@@@ -169,6 -169,17 +169,6 @@@ static inline void ignore_cstruct_param
                         msgname, paramname);
  }
  
 -/*
 - * convert hex to binary
 - */
 -static inline u8 hex2bin(char c)
 -{
 -      int result = c & 0x0f;
 -      if (c & 0x40)
 -              result += 9;
 -      return result;
 -}
 -
  /*
   * convert an IE from Gigaset hex string to ETSI binary representation
   * including length byte
@@@ -180,7 -191,7 +180,7 @@@ static int encode_ie(char *in, u8 *out
        while (*in) {
                if (!isxdigit(in[0]) || !isxdigit(in[1]) || l >= maxlen)
                        return -1;
 -              out[++l] = (hex2bin(in[0]) << 4) + hex2bin(in[1]);
 +              out[++l] = (hex_to_bin(in[0]) << 4) + hex_to_bin(in[1]);
                in += 2;
        }
        out[0] = l;
@@@ -921,30 -932,6 +921,6 @@@ void gigaset_isdn_stop(struct cardstat
   * ============================
   */
  
- /*
-  * load firmware
-  */
- static int gigaset_load_firmware(struct capi_ctr *ctr, capiloaddata *data)
- {
-       struct cardstate *cs = ctr->driverdata;
-       /* AVM specific operation, not needed for Gigaset -- ignore */
-       dev_notice(cs->dev, "load_firmware ignored\n");
-       return 0;
- }
- /*
-  * reset (deactivate) controller
-  */
- static void gigaset_reset_ctr(struct capi_ctr *ctr)
- {
-       struct cardstate *cs = ctr->driverdata;
-       /* AVM specific operation, not needed for Gigaset -- ignore */
-       dev_notice(cs->dev, "reset_ctr ignored\n");
- }
  /*
   * register CAPI application
   */
@@@ -2202,8 -2189,8 +2178,8 @@@ int gigaset_isdn_regdev(struct cardstat
        iif->ctr.driverdata    = cs;
        strncpy(iif->ctr.name, isdnid, sizeof(iif->ctr.name));
        iif->ctr.driver_name   = "gigaset";
-       iif->ctr.load_firmware = gigaset_load_firmware;
-       iif->ctr.reset_ctr     = gigaset_reset_ctr;
+       iif->ctr.load_firmware = NULL;
+       iif->ctr.reset_ctr     = NULL;
        iif->ctr.register_appl = gigaset_register_appl;
        iif->ctr.release_appl  = gigaset_release_appl;
        iif->ctr.send_message  = gigaset_send_message;
diff --combined drivers/net/tun.c
@@@ -526,6 -526,8 +526,8 @@@ static inline struct sk_buff *tun_alloc
        struct sk_buff *skb;
        int err;
  
+       sock_update_classid(sk);
        /* Under a page?  Don't bother with paged skb. */
        if (prepad + len < PAGE_SIZE || !linear)
                linear = len;
@@@ -1649,4 -1651,3 +1651,4 @@@ MODULE_DESCRIPTION(DRV_DESCRIPTION)
  MODULE_AUTHOR(DRV_COPYRIGHT);
  MODULE_LICENSE("GPL");
  MODULE_ALIAS_MISCDEV(TUN_MINOR);
 +MODULE_ALIAS("devname:net/tun");
diff --combined kernel/sysctl.c
@@@ -37,7 -37,6 +37,7 @@@
  #include <linux/highuid.h>
  #include <linux/writeback.h>
  #include <linux/ratelimit.h>
 +#include <linux/compaction.h>
  #include <linux/hugetlb.h>
  #include <linux/initrd.h>
  #include <linux/key.h>
@@@ -53,7 -52,6 +53,7 @@@
  #include <linux/slow-work.h>
  #include <linux/perf_event.h>
  #include <linux/kprobes.h>
 +#include <linux/pipe_fs_i.h>
  
  #include <asm/uaccess.h>
  #include <asm/processor.h>
@@@ -263,11 -261,6 +263,11 @@@ static int min_sched_shares_ratelimit 
  static int max_sched_shares_ratelimit = NSEC_PER_SEC; /* 1 second */
  #endif
  
 +#ifdef CONFIG_COMPACTION
 +static int min_extfrag_threshold;
 +static int max_extfrag_threshold = 1000;
 +#endif
 +
  static struct ctl_table kern_table[] = {
        {
                .procname       = "sched_child_runs_first",
@@@ -1127,25 -1120,6 +1127,25 @@@ static struct ctl_table vm_table[] = 
                .mode           = 0644,
                .proc_handler   = drop_caches_sysctl_handler,
        },
 +#ifdef CONFIG_COMPACTION
 +      {
 +              .procname       = "compact_memory",
 +              .data           = &sysctl_compact_memory,
 +              .maxlen         = sizeof(int),
 +              .mode           = 0200,
 +              .proc_handler   = sysctl_compaction_handler,
 +      },
 +      {
 +              .procname       = "extfrag_threshold",
 +              .data           = &sysctl_extfrag_threshold,
 +              .maxlen         = sizeof(int),
 +              .mode           = 0644,
 +              .proc_handler   = sysctl_extfrag_handler,
 +              .extra1         = &min_extfrag_threshold,
 +              .extra2         = &max_extfrag_threshold,
 +      },
 +
 +#endif /* CONFIG_COMPACTION */
        {
                .procname       = "min_free_kbytes",
                .data           = &min_free_kbytes,
@@@ -1470,14 -1444,6 +1470,14 @@@ static struct ctl_table fs_table[] = 
                .child          = binfmt_misc_table,
        },
  #endif
 +      {
 +              .procname       = "pipe-max-pages",
 +              .data           = &pipe_max_pages,
 +              .maxlen         = sizeof(int),
 +              .mode           = 0644,
 +              .proc_handler   = &proc_dointvec_minmax,
 +              .extra1         = &two,
 +      },
  /*
   * NOTE: do not add new entries to this table unless you have read
   * Documentation/sysctl/ctl_unnumbered.txt
@@@ -2117,20 -2083,20 +2117,20 @@@ static void proc_skip_char(char **buf, 
  
  #define TMPBUFLEN 22
  /**
 - * proc_get_long - reads an ASCII formated integer from a user buffer
 + * proc_get_long - reads an ASCII formatted integer from a user buffer
   *
 - * @buf - a kernel buffer
 - * @size - size of the kernel buffer
 - * @val - this is where the number will be stored
 - * @neg - set to %TRUE if number is negative
 - * @perm_tr - a vector which contains the allowed trailers
 - * @perm_tr_len - size of the perm_tr vector
 - * @tr - pointer to store the trailer character
 + * @buf: a kernel buffer
 + * @size: size of the kernel buffer
 + * @val: this is where the number will be stored
 + * @neg: set to %TRUE if number is negative
 + * @perm_tr: a vector which contains the allowed trailers
 + * @perm_tr_len: size of the perm_tr vector
 + * @tr: pointer to store the trailer character
   *
 - * In case of success 0 is returned and buf and size are updated with
 - * the amount of bytes read. If tr is non NULL and a trailing
 - * character exist (size is non zero after returning from this
 - * function) tr is updated with the trailing character.
 + * In case of success %0 is returned and @buf and @size are updated with
 + * the amount of bytes read. If @tr is non-NULL and a trailing
 + * character exists (size is non-zero after returning from this
 + * function), @tr is updated with the trailing character.
   */
  static int proc_get_long(char **buf, size_t *size,
                          unsigned long *val, bool *neg,
  }
  
  /**
 - * proc_put_long - coverts an integer to a decimal ASCII formated string
 + * proc_put_long - converts an integer to a decimal ASCII formatted string
   *
 - * @buf - the user buffer
 - * @size - the size of the user buffer
 - * @val - the integer to be converted
 - * @neg - sign of the number, %TRUE for negative
 + * @buf: the user buffer
 + * @size: the size of the user buffer
 + * @val: the integer to be converted
 + * @neg: sign of the number, %TRUE for negative
   *
 - * In case of success 0 is returned and buf and size are updated with
 - * the amount of bytes read.
 + * In case of success %0 is returned and @buf and @size are updated with
 + * the amount of bytes written.
   */
  static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
                          bool neg)
@@@ -2287,6 -2253,8 +2287,8 @@@ static int __do_proc_dointvec(void *tbl
                if (write) {
                        left -= proc_skip_spaces(&kbuf);
  
+                       if (!left)
+                               break;
                        err = proc_get_long(&kbuf, &left, &lval, &neg,
                                             proc_wspace_sep,
                                             sizeof(proc_wspace_sep), NULL);
  
        if (!write && !first && left && !err)
                err = proc_put_char(&buffer, &left, '\n');
-       if (write && !err)
+       if (write && !err && left)
                left -= proc_skip_spaces(&kbuf);
  free:
        if (write) {
diff --combined net/core/dev.c
@@@ -954,18 -954,22 +954,22 @@@ int dev_alloc_name(struct net_device *d
  }
  EXPORT_SYMBOL(dev_alloc_name);
  
- static int dev_get_valid_name(struct net *net, const char *name, char *buf,
-                             bool fmt)
+ static int dev_get_valid_name(struct net_device *dev, const char *name, bool fmt)
  {
+       struct net *net;
+       BUG_ON(!dev_net(dev));
+       net = dev_net(dev);
        if (!dev_valid_name(name))
                return -EINVAL;
  
        if (fmt && strchr(name, '%'))
-               return __dev_alloc_name(net, name, buf);
+               return dev_alloc_name(dev, name);
        else if (__dev_get_by_name(net, name))
                return -EEXIST;
-       else if (buf != name)
-               strlcpy(buf, name, IFNAMSIZ);
+       else if (dev->name != name)
+               strlcpy(dev->name, name, IFNAMSIZ);
  
        return 0;
  }
@@@ -997,15 -1001,20 +1001,15 @@@ int dev_change_name(struct net_device *
  
        memcpy(oldname, dev->name, IFNAMSIZ);
  
-       err = dev_get_valid_name(net, newname, dev->name, 1);
+       err = dev_get_valid_name(dev, newname, 1);
        if (err < 0)
                return err;
  
  rollback:
 -      /* For now only devices in the initial network namespace
 -       * are in sysfs.
 -       */
 -      if (net_eq(net, &init_net)) {
 -              ret = device_rename(&dev->dev, dev->name);
 -              if (ret) {
 -                      memcpy(dev->name, oldname, IFNAMSIZ);
 -                      return ret;
 -              }
 +      ret = device_rename(&dev->dev, dev->name);
 +      if (ret) {
 +              memcpy(dev->name, oldname, IFNAMSIZ);
 +              return ret;
        }
  
        write_lock_bh(&dev_base_lock);
@@@ -2421,10 -2430,7 +2425,7 @@@ static int enqueue_to_backlog(struct sk
                if (skb_queue_len(&sd->input_pkt_queue)) {
  enqueue:
                        __skb_queue_tail(&sd->input_pkt_queue, skb);
- #ifdef CONFIG_RPS
-                       *qtail = sd->input_queue_head +
-                                       skb_queue_len(&sd->input_pkt_queue);
- #endif
+                       input_queue_tail_incr_save(sd, qtail);
                        rps_unlock(sd);
                        local_irq_restore(flags);
                        return NET_RX_SUCCESS;
@@@ -2959,7 -2965,7 +2960,7 @@@ static void flush_backlog(void *arg
                if (skb->dev == dev) {
                        __skb_unlink(skb, &sd->input_pkt_queue);
                        kfree_skb(skb);
-                       input_queue_head_add(sd, 1);
+                       input_queue_head_incr(sd);
                }
        }
        rps_unlock(sd);
                if (skb->dev == dev) {
                        __skb_unlink(skb, &sd->process_queue);
                        kfree_skb(skb);
+                       input_queue_head_incr(sd);
                }
        }
  }
@@@ -3323,18 -3330,20 +3325,20 @@@ static int process_backlog(struct napi_
                while ((skb = __skb_dequeue(&sd->process_queue))) {
                        local_irq_enable();
                        __netif_receive_skb(skb);
-                       if (++work >= quota)
-                               return work;
                        local_irq_disable();
+                       input_queue_head_incr(sd);
+                       if (++work >= quota) {
+                               local_irq_enable();
+                               return work;
+                       }
                }
  
                rps_lock(sd);
                qlen = skb_queue_len(&sd->input_pkt_queue);
-               if (qlen) {
-                       input_queue_head_add(sd, qlen);
+               if (qlen)
                        skb_queue_splice_tail_init(&sd->input_pkt_queue,
                                                   &sd->process_queue);
-               }
                if (qlen < quota - work) {
                        /*
                         * Inline a custom version of __napi_complete().
@@@ -4960,7 -4969,7 +4964,7 @@@ int register_netdevice(struct net_devic
                }
        }
  
-       ret = dev_get_valid_name(net, dev->name, dev->name, 0);
+       ret = dev_get_valid_name(dev, dev->name, 0);
        if (ret)
                goto err_uninit;
  
        if (dev->features & NETIF_F_SG)
                dev->features |= NETIF_F_GSO;
  
 -      netdev_initialize_kobject(dev);
 -
        ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
        ret = notifier_to_errno(ret);
        if (ret)
@@@ -5540,6 -5551,15 +5544,6 @@@ int dev_change_net_namespace(struct net
        if (dev->features & NETIF_F_NETNS_LOCAL)
                goto out;
  
 -#ifdef CONFIG_SYSFS
 -      /* Don't allow real devices to be moved when sysfs
 -       * is enabled.
 -       */
 -      err = -EINVAL;
 -      if (dev->dev.parent)
 -              goto out;
 -#endif
 -
        /* Ensure the device has been registrered */
        err = -EINVAL;
        if (dev->reg_state != NETREG_REGISTERED)
                /* We get here if we can't use the current device name */
                if (!pat)
                        goto out;
-               if (dev_get_valid_name(net, pat, dev->name, 1))
+               if (dev_get_valid_name(dev, pat, 1))
                        goto out;
        }
  
        dev_uc_flush(dev);
        dev_mc_flush(dev);
  
 -      netdev_unregister_kobject(dev);
 -
        /* Actually switch the network namespace */
        dev_net_set(dev, net);
  
        }
  
        /* Fixup kobjects */
 -      err = netdev_register_kobject(dev);
 +      err = device_rename(&dev->dev, dev->name);
        WARN_ON(err);
  
        /* Add the device back in the hashes */
@@@ -5661,12 -5683,14 +5665,14 @@@ static int dev_cpu_callback(struct noti
        local_irq_enable();
  
        /* Process offline CPU's input_pkt_queue */
-       while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) {
+       while ((skb = __skb_dequeue(&oldsd->process_queue))) {
                netif_rx(skb);
-               input_queue_head_add(oldsd, 1);
+               input_queue_head_incr(oldsd);
        }
-       while ((skb = __skb_dequeue(&oldsd->process_queue)))
+       while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) {
                netif_rx(skb);
+               input_queue_head_incr(oldsd);
+       }
  
        return NOTIFY_OK;
  }
diff --combined net/core/skbuff.c
@@@ -1406,13 -1406,12 +1406,13 @@@ new_page
  /*
   * Fill page/offset/length into spd, if it can hold more pages.
   */
 -static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page,
 +static inline int spd_fill_page(struct splice_pipe_desc *spd,
 +                              struct pipe_inode_info *pipe, struct page *page,
                                unsigned int *len, unsigned int offset,
                                struct sk_buff *skb, int linear,
                                struct sock *sk)
  {
 -      if (unlikely(spd->nr_pages == PIPE_BUFFERS))
 +      if (unlikely(spd->nr_pages == pipe->buffers))
                return 1;
  
        if (linear) {
@@@ -1448,8 -1447,7 +1448,8 @@@ static inline int __splice_segment(stru
                                   unsigned int plen, unsigned int *off,
                                   unsigned int *len, struct sk_buff *skb,
                                   struct splice_pipe_desc *spd, int linear,
 -                                 struct sock *sk)
 +                                 struct sock *sk,
 +                                 struct pipe_inode_info *pipe)
  {
        if (!*len)
                return 1;
                /* the linear region may spread across several pages  */
                flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
  
 -              if (spd_fill_page(spd, page, &flen, poff, skb, linear, sk))
 +              if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
                        return 1;
  
                __segment_seek(&page, &poff, &plen, flen);
   * Map linear and fragment data from the skb to spd. It reports failure if the
   * pipe is full or if we already spliced the requested length.
   */
 -static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
 -                           unsigned int *len, struct splice_pipe_desc *spd,
 -                           struct sock *sk)
 +static int __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
 +                           unsigned int *offset, unsigned int *len,
 +                           struct splice_pipe_desc *spd, struct sock *sk)
  {
        int seg;
  
        if (__splice_segment(virt_to_page(skb->data),
                             (unsigned long) skb->data & (PAGE_SIZE - 1),
                             skb_headlen(skb),
 -                           offset, len, skb, spd, 1, sk))
 +                           offset, len, skb, spd, 1, sk, pipe))
                return 1;
  
        /*
                const skb_frag_t *f = &skb_shinfo(skb)->frags[seg];
  
                if (__splice_segment(f->page, f->page_offset, f->size,
 -                                   offset, len, skb, spd, 0, sk))
 +                                   offset, len, skb, spd, 0, sk, pipe))
                        return 1;
        }
  
@@@ -1526,8 -1524,8 +1526,8 @@@ int skb_splice_bits(struct sk_buff *skb
                    struct pipe_inode_info *pipe, unsigned int tlen,
                    unsigned int flags)
  {
 -      struct partial_page partial[PIPE_BUFFERS];
 -      struct page *pages[PIPE_BUFFERS];
 +      struct partial_page partial[PIPE_DEF_BUFFERS];
 +      struct page *pages[PIPE_DEF_BUFFERS];
        struct splice_pipe_desc spd = {
                .pages = pages,
                .partial = partial,
        };
        struct sk_buff *frag_iter;
        struct sock *sk = skb->sk;
 +      int ret = 0;
 +
 +      if (splice_grow_spd(pipe, &spd))
 +              return -ENOMEM;
  
        /*
         * __skb_splice_bits() only fails if the output has no room left,
         * so no point in going over the frag_list for the error case.
         */
 -      if (__skb_splice_bits(skb, &offset, &tlen, &spd, sk))
 +      if (__skb_splice_bits(skb, pipe, &offset, &tlen, &spd, sk))
                goto done;
        else if (!tlen)
                goto done;
        skb_walk_frags(skb, frag_iter) {
                if (!tlen)
                        break;
 -              if (__skb_splice_bits(frag_iter, &offset, &tlen, &spd, sk))
 +              if (__skb_splice_bits(frag_iter, pipe, &offset, &tlen, &spd, sk))
                        break;
        }
  
  done:
        if (spd.nr_pages) {
 -              int ret;
 -
                /*
                 * Drop the socket lock, otherwise we have reverse
                 * locking dependencies between sk_lock and i_mutex
                release_sock(sk);
                ret = splice_to_pipe(pipe, &spd);
                lock_sock(sk);
 -              return ret;
        }
  
 -      return 0;
 +      splice_shrink_spd(pipe, &spd);
 +      return ret;
  }
  
  /**
@@@ -2722,6 -2718,7 +2722,7 @@@ int skb_gro_receive(struct sk_buff **he
        *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p);
        skb_shinfo(nskb)->frag_list = p;
        skb_shinfo(nskb)->gso_size = pinfo->gso_size;
+       pinfo->gso_size = 0;
        skb_header_release(p);
        nskb->prev = p;