[NET] CORE: Fix whitespace errors.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
YOSHIFUJI Hideaki 2007-02-09 23:24:36 +09:00 committed by David S. Miller
parent 9d6f229fc4
commit 4ec93edb14
22 changed files with 262 additions and 262 deletions

View File

@ -430,7 +430,7 @@ EXPORT_SYMBOL(__skb_checksum_complete);
* @skb: skbuff * @skb: skbuff
* @hlen: hardware length * @hlen: hardware length
* @iov: io vector * @iov: io vector
* *
* Caller _must_ check that skb will fit to this iovec. * Caller _must_ check that skb will fit to this iovec.
* *
* Returns: 0 - success. * Returns: 0 - success.

View File

@ -255,7 +255,7 @@ static int netdev_nit;
* is linked into kernel lists and may not be freed until it has been * is linked into kernel lists and may not be freed until it has been
* removed from the kernel lists. * removed from the kernel lists.
* *
* This call does not sleep therefore it can not * This call does not sleep therefore it can not
* guarantee all CPU's that are in middle of receiving packets * guarantee all CPU's that are in middle of receiving packets
* will see the new packet type (until the next received packet). * will see the new packet type (until the next received packet).
*/ */
@ -282,7 +282,7 @@ void dev_add_pack(struct packet_type *pt)
* Remove a protocol handler that was previously added to the kernel * Remove a protocol handler that was previously added to the kernel
* protocol handlers by dev_add_pack(). The passed &packet_type is removed * protocol handlers by dev_add_pack(). The passed &packet_type is removed
* from the kernel lists and can be freed or reused once this function * from the kernel lists and can be freed or reused once this function
* returns. * returns.
* *
* The packet type might still be in use by receivers * The packet type might still be in use by receivers
* and must not be freed until after all the CPU's have gone * and must not be freed until after all the CPU's have gone
@ -327,7 +327,7 @@ out:
void dev_remove_pack(struct packet_type *pt) void dev_remove_pack(struct packet_type *pt)
{ {
__dev_remove_pack(pt); __dev_remove_pack(pt);
synchronize_net(); synchronize_net();
} }
@ -607,7 +607,7 @@ EXPORT_SYMBOL(dev_getfirstbyhwtype);
* @mask: bitmask of bits in if_flags to check * @mask: bitmask of bits in if_flags to check
* *
* Search for any interface with the given flags. Returns NULL if a device * Search for any interface with the given flags. Returns NULL if a device
* is not found or a pointer to the device. The device returned has * is not found or a pointer to the device. The device returned has
* had a reference added and the pointer is safe until the user calls * had a reference added and the pointer is safe until the user calls
* dev_put to indicate they have finished with it. * dev_put to indicate they have finished with it.
*/ */
@ -802,7 +802,7 @@ void netdev_state_change(struct net_device *dev)
void dev_load(const char *name) void dev_load(const char *name)
{ {
struct net_device *dev; struct net_device *dev;
read_lock(&dev_base_lock); read_lock(&dev_base_lock);
dev = __dev_get_by_name(name); dev = __dev_get_by_name(name);
@ -860,7 +860,7 @@ int dev_open(struct net_device *dev)
clear_bit(__LINK_STATE_START, &dev->state); clear_bit(__LINK_STATE_START, &dev->state);
} }
/* /*
* If it went open OK then: * If it went open OK then:
*/ */
@ -964,7 +964,7 @@ int dev_close(struct net_device *dev)
* is returned on a failure. * is returned on a failure.
* *
* When registered all registration and up events are replayed * When registered all registration and up events are replayed
* to the new notifier to allow device to have a race free * to the new notifier to allow device to have a race free
* view of the network device list. * view of the network device list.
*/ */
@ -979,7 +979,7 @@ int register_netdevice_notifier(struct notifier_block *nb)
for (dev = dev_base; dev; dev = dev->next) { for (dev = dev_base; dev; dev = dev->next) {
nb->notifier_call(nb, NETDEV_REGISTER, dev); nb->notifier_call(nb, NETDEV_REGISTER, dev);
if (dev->flags & IFF_UP) if (dev->flags & IFF_UP)
nb->notifier_call(nb, NETDEV_UP, dev); nb->notifier_call(nb, NETDEV_UP, dev);
} }
} }
@ -1157,7 +1157,7 @@ void netif_device_attach(struct net_device *dev)
if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
netif_running(dev)) { netif_running(dev)) {
netif_wake_queue(dev); netif_wake_queue(dev);
__netdev_watchdog_up(dev); __netdev_watchdog_up(dev);
} }
} }
EXPORT_SYMBOL(netif_device_attach); EXPORT_SYMBOL(netif_device_attach);
@ -1197,7 +1197,7 @@ int skb_checksum_help(struct sk_buff *skb)
out_set_summed: out_set_summed:
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
out: out:
return ret; return ret;
} }
@ -1258,7 +1258,7 @@ EXPORT_SYMBOL(skb_gso_segment);
void netdev_rx_csum_fault(struct net_device *dev) void netdev_rx_csum_fault(struct net_device *dev)
{ {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_ERR "%s: hw csum failure.\n", printk(KERN_ERR "%s: hw csum failure.\n",
dev ? dev->name : "<unknown>"); dev ? dev->name : "<unknown>");
dump_stack(); dump_stack();
} }
@ -1372,7 +1372,7 @@ gso:
if (unlikely(netif_queue_stopped(dev) && skb->next)) if (unlikely(netif_queue_stopped(dev) && skb->next))
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} while (skb->next); } while (skb->next);
skb->destructor = DEV_GSO_CB(skb)->destructor; skb->destructor = DEV_GSO_CB(skb)->destructor;
out_kfree_skb: out_kfree_skb:
@ -1449,25 +1449,25 @@ int dev_queue_xmit(struct sk_buff *skb)
(!(dev->features & NETIF_F_GEN_CSUM) && (!(dev->features & NETIF_F_GEN_CSUM) &&
(!(dev->features & NETIF_F_IP_CSUM) || (!(dev->features & NETIF_F_IP_CSUM) ||
skb->protocol != htons(ETH_P_IP)))) skb->protocol != htons(ETH_P_IP))))
if (skb_checksum_help(skb)) if (skb_checksum_help(skb))
goto out_kfree_skb; goto out_kfree_skb;
gso: gso:
spin_lock_prefetch(&dev->queue_lock); spin_lock_prefetch(&dev->queue_lock);
/* Disable soft irqs for various locks below. Also /* Disable soft irqs for various locks below. Also
* stops preemption for RCU. * stops preemption for RCU.
*/ */
rcu_read_lock_bh(); rcu_read_lock_bh();
/* Updates of qdisc are serialized by queue_lock. /* Updates of qdisc are serialized by queue_lock.
* The struct Qdisc which is pointed to by qdisc is now a * The struct Qdisc which is pointed to by qdisc is now a
* rcu structure - it may be accessed without acquiring * rcu structure - it may be accessed without acquiring
* a lock (but the structure may be stale.) The freeing of the * a lock (but the structure may be stale.) The freeing of the
* qdisc will be deferred until it's known that there are no * qdisc will be deferred until it's known that there are no
* more references to it. * more references to it.
* *
* If the qdisc has an enqueue function, we still need to * If the qdisc has an enqueue function, we still need to
* hold the queue_lock before calling it, since queue_lock * hold the queue_lock before calling it, since queue_lock
* also serializes access to the device queue. * also serializes access to the device queue.
*/ */
@ -1715,8 +1715,8 @@ static __inline__ int handle_bridge(struct sk_buff **pskb,
if (*pt_prev) { if (*pt_prev) {
*ret = deliver_skb(*pskb, *pt_prev, orig_dev); *ret = deliver_skb(*pskb, *pt_prev, orig_dev);
*pt_prev = NULL; *pt_prev = NULL;
} }
return br_handle_frame_hook(port, pskb); return br_handle_frame_hook(port, pskb);
} }
#else #else
@ -1728,16 +1728,16 @@ static __inline__ int handle_bridge(struct sk_buff **pskb,
* when CONFIG_NET_CLS_ACT is? otherwise some useless instructions * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions
* a compare and 2 stores extra right now if we dont have it on * a compare and 2 stores extra right now if we dont have it on
* but have CONFIG_NET_CLS_ACT * but have CONFIG_NET_CLS_ACT
* NOTE: This doesnt stop any functionality; if you dont have * NOTE: This doesnt stop any functionality; if you dont have
* the ingress scheduler, you just cant add policies on ingress. * the ingress scheduler, you just cant add policies on ingress.
* *
*/ */
static int ing_filter(struct sk_buff *skb) static int ing_filter(struct sk_buff *skb)
{ {
struct Qdisc *q; struct Qdisc *q;
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
int result = TC_ACT_OK; int result = TC_ACT_OK;
if (dev->qdisc_ingress) { if (dev->qdisc_ingress) {
__u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd);
if (MAX_RED_LOOP < ttl++) { if (MAX_RED_LOOP < ttl++) {
@ -1801,7 +1801,7 @@ int netif_receive_skb(struct sk_buff *skb)
list_for_each_entry_rcu(ptype, &ptype_all, list) { list_for_each_entry_rcu(ptype, &ptype_all, list) {
if (!ptype->dev || ptype->dev == skb->dev) { if (!ptype->dev || ptype->dev == skb->dev) {
if (pt_prev) if (pt_prev)
ret = deliver_skb(skb, pt_prev, orig_dev); ret = deliver_skb(skb, pt_prev, orig_dev);
pt_prev = ptype; pt_prev = ptype;
} }
@ -1833,7 +1833,7 @@ ncls:
list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) {
if (ptype->type == type && if (ptype->type == type &&
(!ptype->dev || ptype->dev == skb->dev)) { (!ptype->dev || ptype->dev == skb->dev)) {
if (pt_prev) if (pt_prev)
ret = deliver_skb(skb, pt_prev, orig_dev); ret = deliver_skb(skb, pt_prev, orig_dev);
pt_prev = ptype; pt_prev = ptype;
} }
@ -2061,7 +2061,7 @@ static int dev_ifconf(char __user *arg)
total += done; total += done;
} }
} }
} }
/* /*
* All done. Write the updated control block back to the caller. * All done. Write the updated control block back to the caller.
@ -2154,7 +2154,7 @@ static struct netif_rx_stats *softnet_get_online(loff_t *pos)
struct netif_rx_stats *rc = NULL; struct netif_rx_stats *rc = NULL;
while (*pos < NR_CPUS) while (*pos < NR_CPUS)
if (cpu_online(*pos)) { if (cpu_online(*pos)) {
rc = &per_cpu(netdev_rx_stat, *pos); rc = &per_cpu(netdev_rx_stat, *pos);
break; break;
} else } else
@ -2282,7 +2282,7 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
} }
slave->master = master; slave->master = master;
synchronize_net(); synchronize_net();
if (old) if (old)
@ -2319,13 +2319,13 @@ void dev_set_promiscuity(struct net_device *dev, int inc)
dev_mc_upload(dev); dev_mc_upload(dev);
printk(KERN_INFO "device %s %s promiscuous mode\n", printk(KERN_INFO "device %s %s promiscuous mode\n",
dev->name, (dev->flags & IFF_PROMISC) ? "entered" : dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
"left"); "left");
audit_log(current->audit_context, GFP_ATOMIC, audit_log(current->audit_context, GFP_ATOMIC,
AUDIT_ANOM_PROMISCUOUS, AUDIT_ANOM_PROMISCUOUS,
"dev=%s prom=%d old_prom=%d auid=%u", "dev=%s prom=%d old_prom=%d auid=%u",
dev->name, (dev->flags & IFF_PROMISC), dev->name, (dev->flags & IFF_PROMISC),
(old_flags & IFF_PROMISC), (old_flags & IFF_PROMISC),
audit_get_loginuid(current->audit_context)); audit_get_loginuid(current->audit_context));
} }
} }
@ -2816,7 +2816,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
rtnl_unlock(); rtnl_unlock();
if (IW_IS_GET(cmd) && if (IW_IS_GET(cmd) &&
copy_to_user(arg, &ifr, copy_to_user(arg, &ifr,
sizeof(struct ifreq))) sizeof(struct ifreq)))
ret = -EFAULT; ret = -EFAULT;
return ret; return ret;
} }
@ -2906,7 +2906,7 @@ int register_netdevice(struct net_device *dev)
goto out; goto out;
} }
} }
if (!dev_valid_name(dev->name)) { if (!dev_valid_name(dev->name)) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
@ -2923,9 +2923,9 @@ int register_netdevice(struct net_device *dev)
= hlist_entry(p, struct net_device, name_hlist); = hlist_entry(p, struct net_device, name_hlist);
if (!strncmp(d->name, dev->name, IFNAMSIZ)) { if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
ret = -EEXIST; ret = -EEXIST;
goto out; goto out;
} }
} }
/* Fix illegal SG+CSUM combinations. */ /* Fix illegal SG+CSUM combinations. */
if ((dev->features & NETIF_F_SG) && if ((dev->features & NETIF_F_SG) &&
@ -3024,7 +3024,7 @@ int register_netdev(struct net_device *dev)
if (err < 0) if (err < 0)
goto out; goto out;
} }
err = register_netdevice(dev); err = register_netdevice(dev);
out: out:
rtnl_unlock(); rtnl_unlock();
@ -3041,7 +3041,7 @@ EXPORT_SYMBOL(register_netdev);
* for netdevice notification, and cleanup and put back the * for netdevice notification, and cleanup and put back the
* reference if they receive an UNREGISTER event. * reference if they receive an UNREGISTER event.
* We can get stuck here if buggy protocols don't correctly * We can get stuck here if buggy protocols don't correctly
* call dev_put. * call dev_put.
*/ */
static void netdev_wait_allrefs(struct net_device *dev) static void netdev_wait_allrefs(struct net_device *dev)
{ {
@ -3205,8 +3205,8 @@ EXPORT_SYMBOL(alloc_netdev);
* free_netdev - free network device * free_netdev - free network device
* @dev: device * @dev: device
* *
* This function does the last stage of destroying an allocated device * This function does the last stage of destroying an allocated device
* interface. The reference to the device object is released. * interface. The reference to the device object is released.
* If this is the last reference then it will be freed. * If this is the last reference then it will be freed.
*/ */
void free_netdev(struct net_device *dev) void free_netdev(struct net_device *dev)
@ -3227,9 +3227,9 @@ void free_netdev(struct net_device *dev)
kfree((char *)dev - dev->padded); kfree((char *)dev - dev->padded);
#endif #endif
} }
/* Synchronize with packet receive processing. */ /* Synchronize with packet receive processing. */
void synchronize_net(void) void synchronize_net(void)
{ {
might_sleep(); might_sleep();
synchronize_rcu(); synchronize_rcu();
@ -3291,12 +3291,12 @@ void unregister_netdevice(struct net_device *dev)
/* Shutdown queueing discipline. */ /* Shutdown queueing discipline. */
dev_shutdown(dev); dev_shutdown(dev);
/* Notify protocols, that we are about to destroy /* Notify protocols, that we are about to destroy
this device. They should clean all the things. this device. They should clean all the things.
*/ */
raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev);
/* /*
* Flush the multicast chain * Flush the multicast chain
*/ */
@ -3483,7 +3483,7 @@ static int __init net_dev_init(void)
goto out; goto out;
INIT_LIST_HEAD(&ptype_all); INIT_LIST_HEAD(&ptype_all);
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
INIT_LIST_HEAD(&ptype_base[i]); INIT_LIST_HEAD(&ptype_base[i]);
for (i = 0; i < ARRAY_SIZE(dev_name_head); i++) for (i = 0; i < ARRAY_SIZE(dev_name_head); i++)

View File

@ -1,12 +1,12 @@
/* /*
* Linux NET3: Multicast List maintenance. * Linux NET3: Multicast List maintenance.
* *
* Authors: * Authors:
* Tim Kordas <tjk@nostromo.eeap.cwru.edu> * Tim Kordas <tjk@nostromo.eeap.cwru.edu>
* Richard Underwood <richard@wuzz.demon.co.uk> * Richard Underwood <richard@wuzz.demon.co.uk>
* *
* Stir fried together from the IP multicast and CAP patches above * Stir fried together from the IP multicast and CAP patches above
* Alan Cox <Alan.Cox@linux.org> * Alan Cox <Alan.Cox@linux.org>
* *
* Fixes: * Fixes:
* Alan Cox : Update the device on a real delete * Alan Cox : Update the device on a real delete
@ -50,11 +50,11 @@
/* /*
* Device multicast list maintenance. * Device multicast list maintenance.
* *
* This is used both by IP and by the user level maintenance functions. * This is used both by IP and by the user level maintenance functions.
* Unlike BSD we maintain a usage count on a given multicast address so * Unlike BSD we maintain a usage count on a given multicast address so
* that a casual user application can add/delete multicasts used by * that a casual user application can add/delete multicasts used by
* protocols without doing damage to the protocols when it deletes the * protocols without doing damage to the protocols when it deletes the
* entries. It also helps IP as it tracks overlapping maps. * entries. It also helps IP as it tracks overlapping maps.
* *
@ -67,7 +67,7 @@
/* /*
* Update the multicast list into the physical NIC controller. * Update the multicast list into the physical NIC controller.
*/ */
static void __dev_mc_upload(struct net_device *dev) static void __dev_mc_upload(struct net_device *dev)
{ {
/* Don't do anything till we up the interface /* Don't do anything till we up the interface
@ -100,7 +100,7 @@ void dev_mc_upload(struct net_device *dev)
/* /*
* Delete a device level multicast * Delete a device level multicast
*/ */
int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl) int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
{ {
int err = 0; int err = 0;
@ -137,7 +137,7 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
* loaded filter is now wrong. Fix it * loaded filter is now wrong. Fix it
*/ */
__dev_mc_upload(dev); __dev_mc_upload(dev);
netif_tx_unlock_bh(dev); netif_tx_unlock_bh(dev);
return 0; return 0;
} }
@ -151,7 +151,7 @@ done:
/* /*
* Add a device level multicast * Add a device level multicast
*/ */
int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
{ {
int err = 0; int err = 0;
@ -187,7 +187,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
dev->mc_count++; dev->mc_count++;
__dev_mc_upload(dev); __dev_mc_upload(dev);
netif_tx_unlock_bh(dev); netif_tx_unlock_bh(dev);
return 0; return 0;
@ -204,7 +204,7 @@ done:
void dev_mc_discard(struct net_device *dev) void dev_mc_discard(struct net_device *dev)
{ {
netif_tx_lock_bh(dev); netif_tx_lock_bh(dev);
while (dev->mc_list != NULL) { while (dev->mc_list != NULL) {
struct dev_mc_list *tmp = dev->mc_list; struct dev_mc_list *tmp = dev->mc_list;
dev->mc_list = tmp->next; dev->mc_list = tmp->next;
@ -225,7 +225,7 @@ static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
read_lock(&dev_base_lock); read_lock(&dev_base_lock);
for (dev = dev_base; dev; dev = dev->next) { for (dev = dev_base; dev; dev = dev->next) {
if (off++ == *pos) if (off++ == *pos)
return dev; return dev;
} }
return NULL; return NULL;

View File

@ -29,7 +29,7 @@
* 4) All operations modify state, so a spinlock is used. * 4) All operations modify state, so a spinlock is used.
*/ */
static struct dst_entry *dst_garbage_list; static struct dst_entry *dst_garbage_list;
#if RT_CACHE_DEBUG >= 2 #if RT_CACHE_DEBUG >= 2
static atomic_t dst_total = ATOMIC_INIT(0); static atomic_t dst_total = ATOMIC_INIT(0);
#endif #endif
static DEFINE_SPINLOCK(dst_lock); static DEFINE_SPINLOCK(dst_lock);
@ -142,7 +142,7 @@ void * dst_alloc(struct dst_ops * ops)
dst->path = dst; dst->path = dst;
dst->input = dst_discard_in; dst->input = dst_discard_in;
dst->output = dst_discard_out; dst->output = dst_discard_out;
#if RT_CACHE_DEBUG >= 2 #if RT_CACHE_DEBUG >= 2
atomic_inc(&dst_total); atomic_inc(&dst_total);
#endif #endif
atomic_inc(&ops->entries); atomic_inc(&ops->entries);
@ -203,7 +203,7 @@ again:
dst->ops->destroy(dst); dst->ops->destroy(dst);
if (dst->dev) if (dst->dev)
dev_put(dst->dev); dev_put(dst->dev);
#if RT_CACHE_DEBUG >= 2 #if RT_CACHE_DEBUG >= 2
atomic_dec(&dst_total); atomic_dec(&dst_total);
#endif #endif
kmem_cache_free(dst->ops->kmem_cachep, dst); kmem_cache_free(dst->ops->kmem_cachep, dst);

View File

@ -17,7 +17,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
/* /*
* Some useful ethtool_ops methods that're device independent. * Some useful ethtool_ops methods that're device independent.
* If we find that all drivers want to do the same thing here, * If we find that all drivers want to do the same thing here,
* we can turn these into dev_() function calls. * we can turn these into dev_() function calls.
@ -87,12 +87,12 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *a
unsigned char len = dev->addr_len; unsigned char len = dev->addr_len;
if ( addr->size < len ) if ( addr->size < len )
return -ETOOSMALL; return -ETOOSMALL;
addr->size = len; addr->size = len;
memcpy(data, dev->perm_addr, len); memcpy(data, dev->perm_addr, len);
return 0; return 0;
} }
u32 ethtool_op_get_ufo(struct net_device *dev) u32 ethtool_op_get_ufo(struct net_device *dev)
{ {
@ -550,7 +550,7 @@ static int ethtool_set_sg(struct net_device *dev, char __user *useraddr)
if (copy_from_user(&edata, useraddr, sizeof(edata))) if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT; return -EFAULT;
if (edata.data && if (edata.data &&
!(dev->features & NETIF_F_ALL_CSUM)) !(dev->features & NETIF_F_ALL_CSUM))
return -EINVAL; return -EINVAL;
@ -951,7 +951,7 @@ int dev_ethtool(struct ifreq *ifr)
default: default:
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
} }
if(dev->ethtool_ops->complete) if(dev->ethtool_ops->complete)
dev->ethtool_ops->complete(dev); dev->ethtool_ops->complete(dev);

View File

@ -53,7 +53,7 @@ static void *__load_pointer(struct sk_buff *skb, int k)
} }
static inline void *load_pointer(struct sk_buff *skb, int k, static inline void *load_pointer(struct sk_buff *skb, int k,
unsigned int size, void *buffer) unsigned int size, void *buffer)
{ {
if (k >= 0) if (k >= 0)
return skb_header_pointer(skb, k, size, buffer); return skb_header_pointer(skb, k, size, buffer);
@ -91,7 +91,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int
*/ */
for (pc = 0; pc < flen; pc++) { for (pc = 0; pc < flen; pc++) {
fentry = &filter[pc]; fentry = &filter[pc];
switch (fentry->code) { switch (fentry->code) {
case BPF_ALU|BPF_ADD|BPF_X: case BPF_ALU|BPF_ADD|BPF_X:
A += X; A += X;
@ -399,7 +399,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
*/ */
int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
{ {
struct sk_filter *fp; struct sk_filter *fp;
unsigned int fsize = sizeof(struct sock_filter) * fprog->len; unsigned int fsize = sizeof(struct sock_filter) * fprog->len;
int err; int err;
@ -411,7 +411,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
if (!fp) if (!fp)
return -ENOMEM; return -ENOMEM;
if (copy_from_user(fp->insns, fprog->filter, fsize)) { if (copy_from_user(fp->insns, fprog->filter, fsize)) {
sock_kfree_s(sk, fp, fsize+sizeof(*fp)); sock_kfree_s(sk, fp, fsize+sizeof(*fp));
return -EFAULT; return -EFAULT;
} }

View File

@ -144,7 +144,7 @@ static void est_timer(unsigned long arg)
* configuration TLV is created. Upon each interval, the latest statistics * configuration TLV is created. Upon each interval, the latest statistics
* will be read from &bstats and the estimated rate will be stored in * will be read from &bstats and the estimated rate will be stored in
* &rate_est with the statistics lock grabed during this period. * &rate_est with the statistics lock grabed during this period.
* *
* Returns 0 on success or a negative error code. * Returns 0 on success or a negative error code.
*/ */
int gen_new_estimator(struct gnet_stats_basic *bstats, int gen_new_estimator(struct gnet_stats_basic *bstats,
@ -231,7 +231,7 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats,
* *
* Replaces the configuration of a rate estimator by calling * Replaces the configuration of a rate estimator by calling
* gen_kill_estimator() and gen_new_estimator(). * gen_kill_estimator() and gen_new_estimator().
* *
* Returns 0 on success or a negative error code. * Returns 0 on success or a negative error code.
*/ */
int int
@ -242,7 +242,7 @@ gen_replace_estimator(struct gnet_stats_basic *bstats,
gen_kill_estimator(bstats, rate_est); gen_kill_estimator(bstats, rate_est);
return gen_new_estimator(bstats, rate_est, stats_lock, opt); return gen_new_estimator(bstats, rate_est, stats_lock, opt);
} }
EXPORT_SYMBOL(gen_kill_estimator); EXPORT_SYMBOL(gen_kill_estimator);
EXPORT_SYMBOL(gen_new_estimator); EXPORT_SYMBOL(gen_new_estimator);

View File

@ -57,7 +57,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
int xstats_type, spinlock_t *lock, struct gnet_dump *d) int xstats_type, spinlock_t *lock, struct gnet_dump *d)
{ {
memset(d, 0, sizeof(*d)); memset(d, 0, sizeof(*d));
spin_lock_bh(lock); spin_lock_bh(lock);
d->lock = lock; d->lock = lock;
if (type) if (type)

View File

@ -40,7 +40,7 @@
int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode) int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
{ {
int size, err, ct; int size, err, ct;
if (m->msg_namelen) { if (m->msg_namelen) {
if (mode == VERIFY_READ) { if (mode == VERIFY_READ) {
err = move_addr_to_kernel(m->msg_name, m->msg_namelen, err = move_addr_to_kernel(m->msg_name, m->msg_namelen,
@ -79,7 +79,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
* *
* Note: this modifies the original iovec. * Note: this modifies the original iovec.
*/ */
int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
{ {
while (len > 0) { while (len > 0) {
@ -103,7 +103,7 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
* *
* Note: this modifies the original iovec. * Note: this modifies the original iovec.
*/ */
int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len) int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len)
{ {
while (len > 0) { while (len > 0) {
@ -209,7 +209,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
if (partial_cnt) { if (partial_cnt) {
copy -= partial_cnt; copy -= partial_cnt;
if (copy_from_user(kdata + copy, base + copy, if (copy_from_user(kdata + copy, base + copy,
partial_cnt)) partial_cnt))
goto out_fault; goto out_fault;
} }
} }
@ -224,7 +224,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
kdata += copy + partial_cnt; kdata += copy + partial_cnt;
iov++; iov++;
} }
*csump = csum; *csump = csum;
out: out:
return err; return err;

View File

@ -124,7 +124,7 @@ void linkwatch_run_queue(void)
dev_put(dev); dev_put(dev);
} }
} }
static void linkwatch_event(struct work_struct *dummy) static void linkwatch_event(struct work_struct *dummy)
@ -133,7 +133,7 @@ static void linkwatch_event(struct work_struct *dummy)
* per second so that a runaway driver does not * per second so that a runaway driver does not
* cause a storm of messages on the netlink * cause a storm of messages on the netlink
* socket * socket
*/ */
linkwatch_nextevent = jiffies + HZ; linkwatch_nextevent = jiffies + HZ;
clear_bit(LW_RUNNING, &linkwatch_flags); clear_bit(LW_RUNNING, &linkwatch_flags);

View File

@ -345,7 +345,7 @@ struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey,
struct neighbour *n; struct neighbour *n;
int key_len = tbl->key_len; int key_len = tbl->key_len;
u32 hash_val = tbl->hash(pkey, dev); u32 hash_val = tbl->hash(pkey, dev);
NEIGH_CACHE_STAT_INC(tbl, lookups); NEIGH_CACHE_STAT_INC(tbl, lookups);
read_lock_bh(&tbl->lock); read_lock_bh(&tbl->lock);
@ -687,9 +687,9 @@ next_elt:
np = &n->next; np = &n->next;
} }
/* Cycle through all hash buckets every base_reachable_time/2 ticks. /* Cycle through all hash buckets every base_reachable_time/2 ticks.
* ARP entry timeouts range from 1/2 base_reachable_time to 3/2 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2
* base_reachable_time. * base_reachable_time.
*/ */
expire = tbl->parms.base_reachable_time >> 1; expire = tbl->parms.base_reachable_time >> 1;
expire /= (tbl->hash_mask + 1); expire /= (tbl->hash_mask + 1);
@ -744,7 +744,7 @@ static void neigh_timer_handler(unsigned long arg)
} }
if (state & NUD_REACHABLE) { if (state & NUD_REACHABLE) {
if (time_before_eq(now, if (time_before_eq(now,
neigh->confirmed + neigh->parms->reachable_time)) { neigh->confirmed + neigh->parms->reachable_time)) {
NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); NEIGH_PRINTK2("neigh %p is still alive.\n", neigh);
next = neigh->confirmed + neigh->parms->reachable_time; next = neigh->confirmed + neigh->parms->reachable_time;
@ -763,7 +763,7 @@ static void neigh_timer_handler(unsigned long arg)
notify = 1; notify = 1;
} }
} else if (state & NUD_DELAY) { } else if (state & NUD_DELAY) {
if (time_before_eq(now, if (time_before_eq(now,
neigh->confirmed + neigh->parms->delay_probe_time)) { neigh->confirmed + neigh->parms->delay_probe_time)) {
NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh); NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh);
neigh->nud_state = NUD_REACHABLE; neigh->nud_state = NUD_REACHABLE;
@ -849,7 +849,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
goto out_unlock_bh; goto out_unlock_bh;
now = jiffies; now = jiffies;
if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) { if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) {
if (neigh->parms->mcast_probes + neigh->parms->app_probes) { if (neigh->parms->mcast_probes + neigh->parms->app_probes) {
atomic_set(&neigh->probes, neigh->parms->ucast_probes); atomic_set(&neigh->probes, neigh->parms->ucast_probes);
@ -917,13 +917,13 @@ static void neigh_update_hhs(struct neighbour *neigh)
NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr, NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr,
if it is different. if it is different.
NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected" NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected"
lladdr instead of overriding it lladdr instead of overriding it
if it is different. if it is different.
It also allows to retain current state It also allows to retain current state
if lladdr is unchanged. if lladdr is unchanged.
NEIGH_UPDATE_F_ADMIN means that the change is administrative. NEIGH_UPDATE_F_ADMIN means that the change is administrative.
NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing
NTF_ROUTER flag. NTF_ROUTER flag.
NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as
a router. a router.
@ -946,7 +946,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
old = neigh->nud_state; old = neigh->nud_state;
err = -EPERM; err = -EPERM;
if (!(flags & NEIGH_UPDATE_F_ADMIN) && if (!(flags & NEIGH_UPDATE_F_ADMIN) &&
(old & (NUD_NOARP | NUD_PERMANENT))) (old & (NUD_NOARP | NUD_PERMANENT)))
goto out; goto out;
@ -970,7 +970,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
- compare new & old - compare new & old
- if they are different, check override flag - if they are different, check override flag
*/ */
if ((old & NUD_VALID) && if ((old & NUD_VALID) &&
!memcmp(lladdr, neigh->ha, dev->addr_len)) !memcmp(lladdr, neigh->ha, dev->addr_len))
lladdr = neigh->ha; lladdr = neigh->ha;
} else { } else {
@ -1014,8 +1014,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
neigh_del_timer(neigh); neigh_del_timer(neigh);
if (new & NUD_IN_TIMER) { if (new & NUD_IN_TIMER) {
neigh_hold(neigh); neigh_hold(neigh);
neigh_add_timer(neigh, (jiffies + neigh_add_timer(neigh, (jiffies +
((new & NUD_REACHABLE) ? ((new & NUD_REACHABLE) ?
neigh->parms->reachable_time : neigh->parms->reachable_time :
0))); 0)));
} }
@ -1077,7 +1077,7 @@ struct neighbour *neigh_event_ns(struct neigh_table *tbl,
struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev, struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev,
lladdr || !dev->addr_len); lladdr || !dev->addr_len);
if (neigh) if (neigh)
neigh_update(neigh, lladdr, NUD_STALE, neigh_update(neigh, lladdr, NUD_STALE,
NEIGH_UPDATE_F_OVERRIDE); NEIGH_UPDATE_F_OVERRIDE);
return neigh; return neigh;
} }
@ -1129,7 +1129,7 @@ int neigh_compat_output(struct sk_buff *skb)
if (dev->hard_header && if (dev->hard_header &&
dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL,
skb->len) < 0 && skb->len) < 0 &&
dev->rebuild_header(skb)) dev->rebuild_header(skb))
return 0; return 0;
@ -1349,10 +1349,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
tbl->stats = alloc_percpu(struct neigh_statistics); tbl->stats = alloc_percpu(struct neigh_statistics);
if (!tbl->stats) if (!tbl->stats)
panic("cannot create neighbour cache statistics"); panic("cannot create neighbour cache statistics");
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
tbl->pde = create_proc_entry(tbl->id, 0, proc_net_stat); tbl->pde = create_proc_entry(tbl->id, 0, proc_net_stat);
if (!tbl->pde) if (!tbl->pde)
panic("cannot create neighbour proc dir entry"); panic("cannot create neighbour proc dir entry");
tbl->pde->proc_fops = &neigh_stat_seq_fops; tbl->pde->proc_fops = &neigh_stat_seq_fops;
tbl->pde->data = tbl; tbl->pde->data = tbl;
@ -1567,7 +1567,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
err = -ENOENT; err = -ENOENT;
goto out_dev_put; goto out_dev_put;
} }
neigh = __neigh_lookup_errno(tbl, dst, dev); neigh = __neigh_lookup_errno(tbl, dst, dev);
if (IS_ERR(neigh)) { if (IS_ERR(neigh)) {
err = PTR_ERR(neigh); err = PTR_ERR(neigh);
@ -1744,12 +1744,12 @@ errout:
nlmsg_cancel(skb, nlh); nlmsg_cancel(skb, nlh);
return -EMSGSIZE; return -EMSGSIZE;
} }
static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl, static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
int ifindex) int ifindex)
{ {
struct neigh_parms *p; struct neigh_parms *p;
for (p = &tbl->parms; p; p = p->next) for (p = &tbl->parms; p; p = p->next)
if ((p->dev && p->dev->ifindex == ifindex) || if ((p->dev && p->dev->ifindex == ifindex) ||
(!p->dev && !ifindex)) (!p->dev && !ifindex))
@ -1815,7 +1815,7 @@ int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
goto errout_locked; goto errout_locked;
} }
/* /*
* We acquire tbl->lock to be nice to the periodic timers and * We acquire tbl->lock to be nice to the periodic timers and
* make sure they always see a consistent set of values. * make sure they always see a consistent set of values.
*/ */
@ -2323,7 +2323,7 @@ static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos)
if (*pos == 0) if (*pos == 0)
return SEQ_START_TOKEN; return SEQ_START_TOKEN;
for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) { for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) {
if (!cpu_possible(cpu)) if (!cpu_possible(cpu))
continue; continue;
@ -2631,7 +2631,7 @@ static struct neigh_sysctl_table {
}; };
int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
int p_id, int pdev_id, char *p_name, int p_id, int pdev_id, char *p_name,
proc_handler *handler, ctl_handler *strategy) proc_handler *handler, ctl_handler *strategy)
{ {
struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template, struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template,
@ -2663,7 +2663,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
t->neigh_vars[14].procname = NULL; t->neigh_vars[14].procname = NULL;
t->neigh_vars[15].procname = NULL; t->neigh_vars[15].procname = NULL;
} else { } else {
dev_name_source = t->neigh_dev[0].procname; dev_name_source = t->neigh_dev[0].procname;
t->neigh_vars[12].data = (int *)(p + 1); t->neigh_vars[12].data = (int *)(p + 1);
t->neigh_vars[13].data = (int *)(p + 1) + 1; t->neigh_vars[13].data = (int *)(p + 1) + 1;
t->neigh_vars[14].data = (int *)(p + 1) + 2; t->neigh_vars[14].data = (int *)(p + 1) + 2;
@ -2698,7 +2698,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
goto free; goto free;
} }
t->neigh_dev[0].procname = dev_name; t->neigh_dev[0].procname = dev_name;
t->neigh_neigh_dir[0].ctl_name = pdev_id; t->neigh_neigh_dir[0].ctl_name = pdev_id;

View File

@ -2,7 +2,7 @@
* net-sysfs.c - network device class and attributes * net-sysfs.c - network device class and attributes
* *
* Copyright (c) 2003 Stephen Hemminger <shemminger@osdl.org> * Copyright (c) 2003 Stephen Hemminger <shemminger@osdl.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
@ -23,7 +23,7 @@ static const char fmt_long_hex[] = "%#lx\n";
static const char fmt_dec[] = "%d\n"; static const char fmt_dec[] = "%d\n";
static const char fmt_ulong[] = "%lu\n"; static const char fmt_ulong[] = "%lu\n";
static inline int dev_isalive(const struct net_device *dev) static inline int dev_isalive(const struct net_device *dev)
{ {
return dev->reg_state <= NETREG_REGISTERED; return dev->reg_state <= NETREG_REGISTERED;
} }
@ -265,7 +265,7 @@ static ssize_t netstat_show(const struct device *d,
read_lock(&dev_base_lock); read_lock(&dev_base_lock);
if (dev_isalive(dev) && dev->get_stats && if (dev_isalive(dev) && dev->get_stats &&
(stats = (*dev->get_stats)(dev))) (stats = (*dev->get_stats)(dev)))
ret = sprintf(buf, fmt_ulong, ret = sprintf(buf, fmt_ulong,
*(unsigned long *)(((u8 *) stats) + offset)); *(unsigned long *)(((u8 *) stats) + offset));
@ -349,7 +349,7 @@ static ssize_t wireless_show(struct device *d, char *buf,
struct net_device *dev = to_net_dev(d); struct net_device *dev = to_net_dev(d);
const struct iw_statistics *iw = NULL; const struct iw_statistics *iw = NULL;
ssize_t ret = -EINVAL; ssize_t ret = -EINVAL;
read_lock(&dev_base_lock); read_lock(&dev_base_lock);
if (dev_isalive(dev)) { if (dev_isalive(dev)) {
if(dev->wireless_handlers && if(dev->wireless_handlers &&
@ -430,7 +430,7 @@ static int netdev_uevent(struct device *d, char **envp,
#endif #endif
/* /*
* netdev_release -- destroy and free a dead device. * netdev_release -- destroy and free a dead device.
* Called when last reference to device kobject is gone. * Called when last reference to device kobject is gone.
*/ */
static void netdev_release(struct device *d) static void netdev_release(struct device *d)

View File

@ -237,13 +237,13 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
{ {
int status = NETDEV_TX_BUSY; int status = NETDEV_TX_BUSY;
unsigned long tries; unsigned long tries;
struct net_device *dev = np->dev; struct net_device *dev = np->dev;
struct netpoll_info *npinfo = np->dev->npinfo; struct netpoll_info *npinfo = np->dev->npinfo;
if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) { if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) {
__kfree_skb(skb); __kfree_skb(skb);
return; return;
} }
/* don't get messages out of order, and no recursion */ /* don't get messages out of order, and no recursion */
if (skb_queue_len(&npinfo->txq) == 0 && if (skb_queue_len(&npinfo->txq) == 0 &&
@ -676,7 +676,7 @@ int netpoll_setup(struct netpoll *np)
} }
atleast = jiffies + HZ/10; atleast = jiffies + HZ/10;
atmost = jiffies + 4*HZ; atmost = jiffies + 4*HZ;
while (!netif_carrier_ok(ndev)) { while (!netif_carrier_ok(ndev)) {
if (time_after(jiffies, atmost)) { if (time_after(jiffies, atmost)) {
printk(KERN_NOTICE printk(KERN_NOTICE
@ -772,9 +772,9 @@ void netpoll_cleanup(struct netpoll *np)
np->dev->npinfo = NULL; np->dev->npinfo = NULL;
if (atomic_dec_and_test(&npinfo->refcnt)) { if (atomic_dec_and_test(&npinfo->refcnt)) {
skb_queue_purge(&npinfo->arp_tx); skb_queue_purge(&npinfo->arp_tx);
skb_queue_purge(&npinfo->txq); skb_queue_purge(&npinfo->txq);
cancel_rearming_delayed_work(&npinfo->tx_work); cancel_rearming_delayed_work(&npinfo->tx_work);
flush_scheduled_work(); flush_scheduled_work();
kfree(npinfo); kfree(npinfo);
} }

View File

@ -15,7 +15,7 @@
* *
* *
* A tool for loading the network with preconfigurated packets. * A tool for loading the network with preconfigurated packets.
* The tool is implemented as a linux module. Parameters are output * The tool is implemented as a linux module. Parameters are output
* device, delay (to hard_xmit), number of packets, and whether * device, delay (to hard_xmit), number of packets, and whether
* to use multiple SKBs or just the same one. * to use multiple SKBs or just the same one.
* pktgen uses the installed interface's output routine. * pktgen uses the installed interface's output routine.
@ -44,14 +44,14 @@
* * Add IOCTL interface to easily get counters & configuration. * * Add IOCTL interface to easily get counters & configuration.
* --Ben Greear <greearb@candelatech.com> * --Ben Greear <greearb@candelatech.com>
* *
* Renamed multiskb to clone_skb and cleaned up sending core for two distinct * Renamed multiskb to clone_skb and cleaned up sending core for two distinct
* skb modes. A clone_skb=0 mode for Ben "ranges" work and a clone_skb != 0 * skb modes. A clone_skb=0 mode for Ben "ranges" work and a clone_skb != 0
* as a "fastpath" with a configurable number of clones after alloc's. * as a "fastpath" with a configurable number of clones after alloc's.
* clone_skb=0 means all packets are allocated this also means ranges time * clone_skb=0 means all packets are allocated this also means ranges time
* stamps etc can be used. clone_skb=100 means 1 malloc is followed by 100 * stamps etc can be used. clone_skb=100 means 1 malloc is followed by 100
* clones. * clones.
* *
* Also moved to /proc/net/pktgen/ * Also moved to /proc/net/pktgen/
* --ro * --ro
* *
* Sept 10: Fixed threading/locking. Lots of bone-headed and more clever * Sept 10: Fixed threading/locking. Lots of bone-headed and more clever
@ -60,28 +60,28 @@
* *
* Integrated to 2.5.x 021029 --Lucio Maciel (luciomaciel@zipmail.com.br) * Integrated to 2.5.x 021029 --Lucio Maciel (luciomaciel@zipmail.com.br)
* *
* *
* 021124 Finished major redesign and rewrite for new functionality. * 021124 Finished major redesign and rewrite for new functionality.
* See Documentation/networking/pktgen.txt for how to use this. * See Documentation/networking/pktgen.txt for how to use this.
* *
* The new operation: * The new operation:
* For each CPU one thread/process is created at start. This process checks * For each CPU one thread/process is created at start. This process checks
* for running devices in the if_list and sends packets until count is 0 it * for running devices in the if_list and sends packets until count is 0 it
* also the thread checks the thread->control which is used for inter-process * also the thread checks the thread->control which is used for inter-process
* communication. controlling process "posts" operations to the threads this * communication. controlling process "posts" operations to the threads this
* way. The if_lock should be possible to remove when add/rem_device is merged * way. The if_lock should be possible to remove when add/rem_device is merged
* into this too. * into this too.
* *
* By design there should only be *one* "controlling" process. In practice * By design there should only be *one* "controlling" process. In practice
* multiple write accesses gives unpredictable result. Understood by "write" * multiple write accesses gives unpredictable result. Understood by "write"
* to /proc gives result code thats should be read be the "writer". * to /proc gives result code thats should be read be the "writer".
* For practical use this should be no problem. * For practical use this should be no problem.
* *
* Note when adding devices to a specific CPU there good idea to also assign * Note when adding devices to a specific CPU there good idea to also assign
* /proc/irq/XX/smp_affinity so TX-interrupts gets bound to the same CPU. * /proc/irq/XX/smp_affinity so TX-interrupts gets bound to the same CPU.
* --ro * --ro
* *
* Fix refcount off by one if first packet fails, potential null deref, * Fix refcount off by one if first packet fails, potential null deref,
* memleak 030710- KJP * memleak 030710- KJP
* *
* First "ranges" functionality for ipv6 030726 --ro * First "ranges" functionality for ipv6 030726 --ro
@ -89,22 +89,22 @@
* Included flow support. 030802 ANK. * Included flow support. 030802 ANK.
* *
* Fixed unaligned access on IA-64 Grant Grundler <grundler@parisc-linux.org> * Fixed unaligned access on IA-64 Grant Grundler <grundler@parisc-linux.org>
* *
* Remove if fix from added Harald Welte <laforge@netfilter.org> 040419 * Remove if fix from added Harald Welte <laforge@netfilter.org> 040419
* ia64 compilation fix from Aron Griffis <aron@hp.com> 040604 * ia64 compilation fix from Aron Griffis <aron@hp.com> 040604
* *
* New xmit() return, do_div and misc clean up by Stephen Hemminger * New xmit() return, do_div and misc clean up by Stephen Hemminger
* <shemminger@osdl.org> 040923 * <shemminger@osdl.org> 040923
* *
* Randy Dunlap fixed u64 printk compiler waring * Randy Dunlap fixed u64 printk compiler waring
* *
* Remove FCS from BW calculation. Lennert Buytenhek <buytenh@wantstofly.org> * Remove FCS from BW calculation. Lennert Buytenhek <buytenh@wantstofly.org>
* New time handling. Lennert Buytenhek <buytenh@wantstofly.org> 041213 * New time handling. Lennert Buytenhek <buytenh@wantstofly.org> 041213
* *
* Corrections from Nikolai Malykh (nmalykh@bilim.com) * Corrections from Nikolai Malykh (nmalykh@bilim.com)
* Removed unused flags F_SET_SRCMAC & F_SET_SRCIP 041230 * Removed unused flags F_SET_SRCMAC & F_SET_SRCIP 041230
* *
* interruptible_sleep_on_timeout() replaced Nishanth Aravamudan <nacc@us.ibm.com> * interruptible_sleep_on_timeout() replaced Nishanth Aravamudan <nacc@us.ibm.com>
* 050103 * 050103
* *
* MPLS support by Steven Whitehouse <steve@chygwyn.com> * MPLS support by Steven Whitehouse <steve@chygwyn.com>
@ -456,7 +456,7 @@ static inline __u64 pg_div64(__u64 n, __u64 base)
/* /*
* How do we know if the architecture we are running on * How do we know if the architecture we are running on
* supports division with 64 bit base? * supports division with 64 bit base?
* *
*/ */
#if defined(__sparc_v9__) || defined(__powerpc64__) || defined(__alpha__) || defined(__x86_64__) || defined(__ia64__) #if defined(__sparc_v9__) || defined(__powerpc64__) || defined(__alpha__) || defined(__x86_64__) || defined(__ia64__)
@ -529,7 +529,7 @@ static struct notifier_block pktgen_notifier_block = {
}; };
/* /*
* /proc handling functions * /proc handling functions
* *
*/ */
@ -1979,7 +1979,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
if (pkt_dev->flags & F_IPV6) { if (pkt_dev->flags & F_IPV6) {
/* /*
* Skip this automatic address setting until locks or functions * Skip this automatic address setting until locks or functions
* gets exported * gets exported
*/ */
@ -2477,10 +2477,10 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
} }
/* /*
* scan_ip6, fmt_ip taken from dietlibc-0.21 * scan_ip6, fmt_ip taken from dietlibc-0.21
* Author Felix von Leitner <felix-dietlibc@fefe.de> * Author Felix von Leitner <felix-dietlibc@fefe.de>
* *
* Slightly modified for kernel. * Slightly modified for kernel.
* Should be candidate for net/ipv4/utils.c * Should be candidate for net/ipv4/utils.c
* --ro * --ro
*/ */
@ -3256,7 +3256,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
out:; out:;
} }
/* /*
* Main loop of the thread goes here * Main loop of the thread goes here
*/ */
@ -3365,8 +3365,8 @@ static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t,
return pkt_dev; return pkt_dev;
} }
/* /*
* Adds a dev at front of if_list. * Adds a dev at front of if_list.
*/ */
static int add_dev_to_thread(struct pktgen_thread *t, static int add_dev_to_thread(struct pktgen_thread *t,
@ -3510,8 +3510,8 @@ static int __init pktgen_create_thread(int cpu)
return 0; return 0;
} }
/* /*
* Removes a device from the thread if_list. * Removes a device from the thread if_list.
*/ */
static void _rem_dev_from_if_list(struct pktgen_thread *t, static void _rem_dev_from_if_list(struct pktgen_thread *t,
struct pktgen_dev *pkt_dev) struct pktgen_dev *pkt_dev)

View File

@ -874,7 +874,7 @@ void __init rtnetlink_init(void)
panic("rtnetlink_init: cannot allocate rta_buf\n"); panic("rtnetlink_init: cannot allocate rta_buf\n");
rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv, rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv,
THIS_MODULE); THIS_MODULE);
if (rtnl == NULL) if (rtnl == NULL)
panic("rtnetlink_init: cannot initialize rtnetlink\n"); panic("rtnetlink_init: cannot initialize rtnetlink\n");
netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV); netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV);

View File

@ -36,7 +36,7 @@
/* /*
* Only allow a user to send credentials, that they could set with * Only allow a user to send credentials, that they could set with
* setu(g)id. * setu(g)id.
*/ */
@ -79,11 +79,11 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)
if (fpl->count + num > SCM_MAX_FD) if (fpl->count + num > SCM_MAX_FD)
return -EINVAL; return -EINVAL;
/* /*
* Verify the descriptors and increment the usage count. * Verify the descriptors and increment the usage count.
*/ */
for (i=0; i< num; i++) for (i=0; i< num; i++)
{ {
int fd = fdp[i]; int fd = fdp[i];
@ -123,7 +123,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p)
/* The first check was omitted in <= 2.2.5. The reasoning was /* The first check was omitted in <= 2.2.5. The reasoning was
that parser checks cmsg_len in any case, so that that parser checks cmsg_len in any case, so that
additional check would be work duplication. additional check would be work duplication.
But if cmsg_level is not SOL_SOCKET, we do not check But if cmsg_level is not SOL_SOCKET, we do not check
for too short ancillary data object at all! Oops. for too short ancillary data object at all! Oops.
OK, let's add it... OK, let's add it...
*/ */
@ -159,7 +159,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p)
p->fp = NULL; p->fp = NULL;
} }
return 0; return 0;
error: error:
scm_destroy(p); scm_destroy(p);
return err; return err;
@ -189,7 +189,7 @@ int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
err = -EFAULT; err = -EFAULT;
if (copy_to_user(cm, &cmhdr, sizeof cmhdr)) if (copy_to_user(cm, &cmhdr, sizeof cmhdr))
goto out; goto out;
if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr))) if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr)))
goto out; goto out;
cmlen = CMSG_SPACE(len); cmlen = CMSG_SPACE(len);

View File

@ -88,7 +88,7 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly;
void skb_over_panic(struct sk_buff *skb, int sz, void *here) void skb_over_panic(struct sk_buff *skb, int sz, void *here)
{ {
printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p "
"data:%p tail:%p end:%p dev:%s\n", "data:%p tail:%p end:%p dev:%s\n",
here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
skb->dev ? skb->dev->name : "<NULL>"); skb->dev ? skb->dev->name : "<NULL>");
BUG(); BUG();
@ -106,7 +106,7 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here)
void skb_under_panic(struct sk_buff *skb, int sz, void *here) void skb_under_panic(struct sk_buff *skb, int sz, void *here)
{ {
printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p "
"data:%p tail:%p end:%p dev:%s\n", "data:%p tail:%p end:%p dev:%s\n",
here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
skb->dev ? skb->dev->name : "<NULL>"); skb->dev ? skb->dev->name : "<NULL>");
BUG(); BUG();
@ -271,7 +271,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1;
struct sk_buff *skb; struct sk_buff *skb;
skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node);
if (likely(skb)) { if (likely(skb)) {
skb_reserve(skb, NET_SKB_PAD); skb_reserve(skb, NET_SKB_PAD);
skb->dev = dev; skb->dev = dev;
@ -819,12 +819,12 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
* *
* May return error in out of memory cases. The skb is freed on error. * May return error in out of memory cases. The skb is freed on error.
*/ */
int skb_pad(struct sk_buff *skb, int pad) int skb_pad(struct sk_buff *skb, int pad)
{ {
int err; int err;
int ntail; int ntail;
/* If the skbuff is non linear tailroom is always zero.. */ /* If the skbuff is non linear tailroom is always zero.. */
if (!skb_cloned(skb) && skb_tailroom(skb) >= pad) { if (!skb_cloned(skb) && skb_tailroom(skb) >= pad) {
memset(skb->data+skb->len, 0, pad); memset(skb->data+skb->len, 0, pad);
@ -851,8 +851,8 @@ int skb_pad(struct sk_buff *skb, int pad)
free_skb: free_skb:
kfree_skb(skb); kfree_skb(skb);
return err; return err;
} }
/* Trims skb to length len. It can change skb pointers. /* Trims skb to length len. It can change skb pointers.
*/ */

View File

@ -34,7 +34,7 @@
* Alan Cox : TCP ack handling is buggy, the DESTROY timer * Alan Cox : TCP ack handling is buggy, the DESTROY timer
* was buggy. Put a remove_sock() in the handler * was buggy. Put a remove_sock() in the handler
* for memory when we hit 0. Also altered the timer * for memory when we hit 0. Also altered the timer
* code. The ACK stuff can wait and needs major * code. The ACK stuff can wait and needs major
* TCP layer surgery. * TCP layer surgery.
* Alan Cox : Fixed TCP ack bug, removed remove sock * Alan Cox : Fixed TCP ack bug, removed remove sock
* and fixed timer/inet_bh race. * and fixed timer/inet_bh race.
@ -217,8 +217,8 @@ static void sock_warn_obsolete_bsdism(const char *name)
{ {
static int warned; static int warned;
static char warncomm[TASK_COMM_LEN]; static char warncomm[TASK_COMM_LEN];
if (strcmp(warncomm, current->comm) && warned < 5) { if (strcmp(warncomm, current->comm) && warned < 5) {
strcpy(warncomm, current->comm); strcpy(warncomm, current->comm);
printk(KERN_WARNING "process `%s' is using obsolete " printk(KERN_WARNING "process `%s' is using obsolete "
"%s SO_BSDCOMPAT\n", warncomm, name); "%s SO_BSDCOMPAT\n", warncomm, name);
warned++; warned++;
@ -226,8 +226,8 @@ static void sock_warn_obsolete_bsdism(const char *name)
} }
static void sock_disable_timestamp(struct sock *sk) static void sock_disable_timestamp(struct sock *sk)
{ {
if (sock_flag(sk, SOCK_TIMESTAMP)) { if (sock_flag(sk, SOCK_TIMESTAMP)) {
sock_reset_flag(sk, SOCK_TIMESTAMP); sock_reset_flag(sk, SOCK_TIMESTAMP);
net_disable_timestamp(); net_disable_timestamp();
} }
@ -347,7 +347,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
int valbool; int valbool;
struct linger ling; struct linger ling;
int ret = 0; int ret = 0;
/* /*
* Options without arguments * Options without arguments
*/ */
@ -360,20 +360,20 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
return 0; return 0;
} }
#endif #endif
if(optlen<sizeof(int)) if(optlen<sizeof(int))
return(-EINVAL); return(-EINVAL);
if (get_user(val, (int __user *)optval)) if (get_user(val, (int __user *)optval))
return -EFAULT; return -EFAULT;
valbool = val?1:0; valbool = val?1:0;
lock_sock(sk); lock_sock(sk);
switch(optname) switch(optname)
{ {
case SO_DEBUG: case SO_DEBUG:
if(val && !capable(CAP_NET_ADMIN)) if(val && !capable(CAP_NET_ADMIN))
{ {
ret = -EACCES; ret = -EACCES;
@ -389,7 +389,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
case SO_TYPE: case SO_TYPE:
case SO_ERROR: case SO_ERROR:
ret = -ENOPROTOOPT; ret = -ENOPROTOOPT;
break; break;
case SO_DONTROUTE: case SO_DONTROUTE:
if (valbool) if (valbool)
sock_set_flag(sk, SOCK_LOCALROUTE); sock_set_flag(sk, SOCK_LOCALROUTE);
@ -404,7 +404,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
about it this is right. Otherwise apps have to about it this is right. Otherwise apps have to
play 'guess the biggest size' games. RCVBUF/SNDBUF play 'guess the biggest size' games. RCVBUF/SNDBUF
are treated in BSD as hints */ are treated in BSD as hints */
if (val > sysctl_wmem_max) if (val > sysctl_wmem_max)
val = sysctl_wmem_max; val = sysctl_wmem_max;
set_sndbuf: set_sndbuf:
@ -433,7 +433,7 @@ set_sndbuf:
about it this is right. Otherwise apps have to about it this is right. Otherwise apps have to
play 'guess the biggest size' games. RCVBUF/SNDBUF play 'guess the biggest size' games. RCVBUF/SNDBUF
are treated in BSD as hints */ are treated in BSD as hints */
if (val > sysctl_rmem_max) if (val > sysctl_rmem_max)
val = sysctl_rmem_max; val = sysctl_rmem_max;
set_rcvbuf: set_rcvbuf:
@ -474,16 +474,16 @@ set_rcvbuf:
sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool);
break; break;
case SO_OOBINLINE: case SO_OOBINLINE:
sock_valbool_flag(sk, SOCK_URGINLINE, valbool); sock_valbool_flag(sk, SOCK_URGINLINE, valbool);
break; break;
case SO_NO_CHECK: case SO_NO_CHECK:
sk->sk_no_check = valbool; sk->sk_no_check = valbool;
break; break;
case SO_PRIORITY: case SO_PRIORITY:
if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN)) if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN))
sk->sk_priority = val; sk->sk_priority = val;
else else
ret = -EPERM; ret = -EPERM;
@ -547,9 +547,9 @@ set_rcvbuf:
#ifdef CONFIG_NETDEVICES #ifdef CONFIG_NETDEVICES
case SO_BINDTODEVICE: case SO_BINDTODEVICE:
{ {
char devname[IFNAMSIZ]; char devname[IFNAMSIZ];
/* Sorry... */ /* Sorry... */
if (!capable(CAP_NET_RAW)) { if (!capable(CAP_NET_RAW)) {
ret = -EPERM; ret = -EPERM;
break; break;
@ -557,9 +557,9 @@ set_rcvbuf:
/* Bind this socket to a particular device like "eth0", /* Bind this socket to a particular device like "eth0",
* as specified in the passed interface name. If the * as specified in the passed interface name. If the
* name is "" or the option length is zero the socket * name is "" or the option length is zero the socket
* is not bound. * is not bound.
*/ */
if (!valbool) { if (!valbool) {
sk->sk_bound_dev_if = 0; sk->sk_bound_dev_if = 0;
@ -608,7 +608,7 @@ set_rcvbuf:
case SO_DETACH_FILTER: case SO_DETACH_FILTER:
rcu_read_lock_bh(); rcu_read_lock_bh();
filter = rcu_dereference(sk->sk_filter); filter = rcu_dereference(sk->sk_filter);
if (filter) { if (filter) {
rcu_assign_pointer(sk->sk_filter, NULL); rcu_assign_pointer(sk->sk_filter, NULL);
sk_filter_release(sk, filter); sk_filter_release(sk, filter);
rcu_read_unlock_bh(); rcu_read_unlock_bh();
@ -628,9 +628,9 @@ set_rcvbuf:
/* We implement the SO_SNDLOWAT etc to /* We implement the SO_SNDLOWAT etc to
not be settable (1003.1g 5.3) */ not be settable (1003.1g 5.3) */
default: default:
ret = -ENOPROTOOPT; ret = -ENOPROTOOPT;
break; break;
} }
release_sock(sk); release_sock(sk);
return ret; return ret;
} }
@ -640,32 +640,32 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen) char __user *optval, int __user *optlen)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
union union
{ {
int val; int val;
struct linger ling; struct linger ling;
struct timeval tm; struct timeval tm;
} v; } v;
unsigned int lv = sizeof(int); unsigned int lv = sizeof(int);
int len; int len;
if(get_user(len,optlen)) if(get_user(len,optlen))
return -EFAULT; return -EFAULT;
if(len < 0) if(len < 0)
return -EINVAL; return -EINVAL;
switch(optname) switch(optname)
{ {
case SO_DEBUG: case SO_DEBUG:
v.val = sock_flag(sk, SOCK_DBG); v.val = sock_flag(sk, SOCK_DBG);
break; break;
case SO_DONTROUTE: case SO_DONTROUTE:
v.val = sock_flag(sk, SOCK_LOCALROUTE); v.val = sock_flag(sk, SOCK_LOCALROUTE);
break; break;
case SO_BROADCAST: case SO_BROADCAST:
v.val = !!sock_flag(sk, SOCK_BROADCAST); v.val = !!sock_flag(sk, SOCK_BROADCAST);
break; break;
@ -673,7 +673,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
case SO_SNDBUF: case SO_SNDBUF:
v.val = sk->sk_sndbuf; v.val = sk->sk_sndbuf;
break; break;
case SO_RCVBUF: case SO_RCVBUF:
v.val = sk->sk_rcvbuf; v.val = sk->sk_rcvbuf;
break; break;
@ -687,7 +687,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
break; break;
case SO_TYPE: case SO_TYPE:
v.val = sk->sk_type; v.val = sk->sk_type;
break; break;
case SO_ERROR: case SO_ERROR:
@ -699,7 +699,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
case SO_OOBINLINE: case SO_OOBINLINE:
v.val = !!sock_flag(sk, SOCK_URGINLINE); v.val = !!sock_flag(sk, SOCK_URGINLINE);
break; break;
case SO_NO_CHECK: case SO_NO_CHECK:
v.val = sk->sk_no_check; v.val = sk->sk_no_check;
break; break;
@ -707,13 +707,13 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
case SO_PRIORITY: case SO_PRIORITY:
v.val = sk->sk_priority; v.val = sk->sk_priority;
break; break;
case SO_LINGER: case SO_LINGER:
lv = sizeof(v.ling); lv = sizeof(v.ling);
v.ling.l_onoff = !!sock_flag(sk, SOCK_LINGER); v.ling.l_onoff = !!sock_flag(sk, SOCK_LINGER);
v.ling.l_linger = sk->sk_lingertime / HZ; v.ling.l_linger = sk->sk_lingertime / HZ;
break; break;
case SO_BSDCOMPAT: case SO_BSDCOMPAT:
sock_warn_obsolete_bsdism("getsockopt"); sock_warn_obsolete_bsdism("getsockopt");
break; break;
@ -750,7 +750,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
case SO_SNDLOWAT: case SO_SNDLOWAT:
v.val=1; v.val=1;
break; break;
case SO_PASSCRED: case SO_PASSCRED:
v.val = test_bit(SOCK_PASSCRED, &sock->flags) ? 1 : 0; v.val = test_bit(SOCK_PASSCRED, &sock->flags) ? 1 : 0;
@ -798,9 +798,9 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
if (copy_to_user(optval, &v, len)) if (copy_to_user(optval, &v, len))
return -EFAULT; return -EFAULT;
lenout: lenout:
if (put_user(len, optlen)) if (put_user(len, optlen))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
/* /*
@ -846,7 +846,7 @@ struct sock *sk_alloc(int family, gfp_t priority,
sk->sk_prot = sk->sk_prot_creator = prot; sk->sk_prot = sk->sk_prot_creator = prot;
sock_lock_init(sk); sock_lock_init(sk);
} }
if (security_sk_alloc(sk, family, priority)) if (security_sk_alloc(sk, family, priority))
goto out_free; goto out_free;
@ -988,8 +988,8 @@ void __init sk_init(void)
*/ */
/* /*
* Write buffer destructor automatically called from kfree_skb. * Write buffer destructor automatically called from kfree_skb.
*/ */
void sock_wfree(struct sk_buff *skb) void sock_wfree(struct sk_buff *skb)
{ {
@ -1002,8 +1002,8 @@ void sock_wfree(struct sk_buff *skb)
sock_put(sk); sock_put(sk);
} }
/* /*
* Read buffer destructor automatically called from kfree_skb. * Read buffer destructor automatically called from kfree_skb.
*/ */
void sock_rfree(struct sk_buff *skb) void sock_rfree(struct sk_buff *skb)
{ {
@ -1051,7 +1051,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
/* /*
* Allocate a skb from the socket's receive buffer. * Allocate a skb from the socket's receive buffer.
*/ */
struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
gfp_t priority) gfp_t priority)
{ {
@ -1065,16 +1065,16 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
return NULL; return NULL;
} }
/* /*
* Allocate a memory block from the socket's option memory buffer. * Allocate a memory block from the socket's option memory buffer.
*/ */
void *sock_kmalloc(struct sock *sk, int size, gfp_t priority) void *sock_kmalloc(struct sock *sk, int size, gfp_t priority)
{ {
if ((unsigned)size <= sysctl_optmem_max && if ((unsigned)size <= sysctl_optmem_max &&
atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) {
void *mem; void *mem;
/* First do the add, to avoid the race if kmalloc /* First do the add, to avoid the race if kmalloc
* might sleep. * might sleep.
*/ */
atomic_add(size, &sk->sk_omem_alloc); atomic_add(size, &sk->sk_omem_alloc);
mem = kmalloc(size, priority); mem = kmalloc(size, priority);
@ -1210,7 +1210,7 @@ failure:
return NULL; return NULL;
} }
struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
int noblock, int *errcode) int noblock, int *errcode)
{ {
return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); return sock_alloc_send_pskb(sk, size, 0, noblock, errcode);
@ -1298,7 +1298,7 @@ int sock_no_bind(struct socket *sock, struct sockaddr *saddr, int len)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
int sock_no_connect(struct socket *sock, struct sockaddr *saddr, int sock_no_connect(struct socket *sock, struct sockaddr *saddr,
int len, int flags) int len, int flags)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -1314,7 +1314,7 @@ int sock_no_accept(struct socket *sock, struct socket *newsock, int flags)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
int sock_no_getname(struct socket *sock, struct sockaddr *saddr, int sock_no_getname(struct socket *sock, struct sockaddr *saddr,
int *len, int peer) int *len, int peer)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -1400,7 +1400,7 @@ static void sock_def_error_report(struct sock *sk)
read_lock(&sk->sk_callback_lock); read_lock(&sk->sk_callback_lock);
if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
wake_up_interruptible(sk->sk_sleep); wake_up_interruptible(sk->sk_sleep);
sk_wake_async(sk,0,POLL_ERR); sk_wake_async(sk,0,POLL_ERR);
read_unlock(&sk->sk_callback_lock); read_unlock(&sk->sk_callback_lock);
} }
@ -1473,7 +1473,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
sk->sk_send_head = NULL; sk->sk_send_head = NULL;
init_timer(&sk->sk_timer); init_timer(&sk->sk_timer);
sk->sk_allocation = GFP_KERNEL; sk->sk_allocation = GFP_KERNEL;
sk->sk_rcvbuf = sysctl_rmem_default; sk->sk_rcvbuf = sysctl_rmem_default;
sk->sk_sndbuf = sysctl_wmem_default; sk->sk_sndbuf = sysctl_wmem_default;
@ -1553,26 +1553,26 @@ void fastcall release_sock(struct sock *sk)
EXPORT_SYMBOL(release_sock); EXPORT_SYMBOL(release_sock);
int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
{ {
if (!sock_flag(sk, SOCK_TIMESTAMP)) if (!sock_flag(sk, SOCK_TIMESTAMP))
sock_enable_timestamp(sk); sock_enable_timestamp(sk);
if (sk->sk_stamp.tv_sec == -1) if (sk->sk_stamp.tv_sec == -1)
return -ENOENT; return -ENOENT;
if (sk->sk_stamp.tv_sec == 0) if (sk->sk_stamp.tv_sec == 0)
do_gettimeofday(&sk->sk_stamp); do_gettimeofday(&sk->sk_stamp);
return copy_to_user(userstamp, &sk->sk_stamp, sizeof(struct timeval)) ? return copy_to_user(userstamp, &sk->sk_stamp, sizeof(struct timeval)) ?
-EFAULT : 0; -EFAULT : 0;
} }
EXPORT_SYMBOL(sock_get_timestamp); EXPORT_SYMBOL(sock_get_timestamp);
void sock_enable_timestamp(struct sock *sk) void sock_enable_timestamp(struct sock *sk)
{ {
if (!sock_flag(sk, SOCK_TIMESTAMP)) { if (!sock_flag(sk, SOCK_TIMESTAMP)) {
sock_set_flag(sk, SOCK_TIMESTAMP); sock_set_flag(sk, SOCK_TIMESTAMP);
net_enable_timestamp(); net_enable_timestamp();
} }
} }
EXPORT_SYMBOL(sock_enable_timestamp); EXPORT_SYMBOL(sock_enable_timestamp);
/* /*
* Get a socket option on an socket. * Get a socket option on an socket.

View File

@ -69,7 +69,7 @@ int sk_stream_wait_connect(struct sock *sk, long *timeo_p)
sk->sk_write_pending++; sk->sk_write_pending++;
done = sk_wait_event(sk, timeo_p, done = sk_wait_event(sk, timeo_p,
!sk->sk_err && !sk->sk_err &&
!((1 << sk->sk_state) & !((1 << sk->sk_state) &
~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT))); ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)));
finish_wait(sk->sk_sleep, &wait); finish_wait(sk->sk_sleep, &wait);
sk->sk_write_pending--; sk->sk_write_pending--;
@ -139,7 +139,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
sk->sk_write_pending++; sk->sk_write_pending++;
sk_wait_event(sk, &current_timeo, !sk->sk_err && sk_wait_event(sk, &current_timeo, !sk->sk_err &&
!(sk->sk_shutdown & SEND_SHUTDOWN) && !(sk->sk_shutdown & SEND_SHUTDOWN) &&
sk_stream_memory_free(sk) && sk_stream_memory_free(sk) &&
vm_wait); vm_wait);

View File

@ -58,7 +58,7 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
if (copy > len) if (copy > len)
copy = len; copy = len;
cookie = dma_memcpy_to_iovec(chan, to, pinned_list, cookie = dma_memcpy_to_iovec(chan, to, pinned_list,
skb->data + offset, copy); skb->data + offset, copy);
if (cookie < 0) if (cookie < 0)
goto fault; goto fault;
len -= copy; len -= copy;
@ -108,8 +108,8 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
if (copy > len) if (copy > len)
copy = len; copy = len;
cookie = dma_skb_copy_datagram_iovec(chan, list, cookie = dma_skb_copy_datagram_iovec(chan, list,
offset - start, to, copy, offset - start, to, copy,
pinned_list); pinned_list);
if (cookie < 0) if (cookie < 0)
goto fault; goto fault;
len -= copy; len -= copy;
@ -128,5 +128,5 @@ end:
} }
fault: fault:
return -EFAULT; return -EFAULT;
} }

View File

@ -33,9 +33,9 @@
int net_msg_cost = 5*HZ; int net_msg_cost = 5*HZ;
int net_msg_burst = 10; int net_msg_burst = 10;
/* /*
* All net warning printk()s should be guarded by this function. * All net warning printk()s should be guarded by this function.
*/ */
int net_ratelimit(void) int net_ratelimit(void)
{ {
return __printk_ratelimit(net_msg_cost, net_msg_burst); return __printk_ratelimit(net_msg_cost, net_msg_burst);

View File

@ -369,7 +369,7 @@ static const struct iw_ioctl_description standard_event[] = {
.header_type = IW_HEADER_TYPE_ADDR, .header_type = IW_HEADER_TYPE_ADDR,
}, },
[IWEVEXPIRED - IWEVFIRST] = { [IWEVEXPIRED - IWEVFIRST] = {
.header_type = IW_HEADER_TYPE_ADDR, .header_type = IW_HEADER_TYPE_ADDR,
}, },
[IWEVGENIE - IWEVFIRST] = { [IWEVGENIE - IWEVFIRST] = {
.header_type = IW_HEADER_TYPE_POINT, .header_type = IW_HEADER_TYPE_POINT,
@ -377,7 +377,7 @@ static const struct iw_ioctl_description standard_event[] = {
.max_tokens = IW_GENERIC_IE_MAX, .max_tokens = IW_GENERIC_IE_MAX,
}, },
[IWEVMICHAELMICFAILURE - IWEVFIRST] = { [IWEVMICHAELMICFAILURE - IWEVFIRST] = {
.header_type = IW_HEADER_TYPE_POINT, .header_type = IW_HEADER_TYPE_POINT,
.token_size = 1, .token_size = 1,
.max_tokens = sizeof(struct iw_michaelmicfailure), .max_tokens = sizeof(struct iw_michaelmicfailure),
}, },
@ -630,11 +630,11 @@ static __inline__ void wireless_seq_printf_stats(struct seq_file *seq,
dev->name, stats->status, stats->qual.qual, dev->name, stats->status, stats->qual.qual,
stats->qual.updated & IW_QUAL_QUAL_UPDATED stats->qual.updated & IW_QUAL_QUAL_UPDATED
? '.' : ' ', ? '.' : ' ',
((__s32) stats->qual.level) - ((__s32) stats->qual.level) -
((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0),
stats->qual.updated & IW_QUAL_LEVEL_UPDATED stats->qual.updated & IW_QUAL_LEVEL_UPDATED
? '.' : ' ', ? '.' : ' ',
((__s32) stats->qual.noise) - ((__s32) stats->qual.noise) -
((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0),
stats->qual.updated & IW_QUAL_NOISE_UPDATED stats->qual.updated & IW_QUAL_NOISE_UPDATED
? '.' : ' ', ? '.' : ' ',
@ -862,7 +862,7 @@ static int ioctl_standard_call(struct net_device * dev,
iwr->u.data.length * iwr->u.data.length *
descr->token_size); descr->token_size);
if (err) if (err)
ret = -EFAULT; ret = -EFAULT;
#ifdef WE_IOCTL_DEBUG #ifdef WE_IOCTL_DEBUG
printk(KERN_DEBUG "%s (WE) : Wrote %d bytes\n", printk(KERN_DEBUG "%s (WE) : Wrote %d bytes\n",
dev->name, dev->name,
@ -1040,7 +1040,7 @@ static inline int ioctl_private_call(struct net_device * dev,
err = copy_to_user(iwr->u.data.pointer, extra, err = copy_to_user(iwr->u.data.pointer, extra,
extra_size); extra_size);
if (err) if (err)
ret = -EFAULT; ret = -EFAULT;
#ifdef WE_IOCTL_DEBUG #ifdef WE_IOCTL_DEBUG
printk(KERN_DEBUG "%s (WE) : Wrote %d elem\n", printk(KERN_DEBUG "%s (WE) : Wrote %d elem\n",
dev->name, iwr->u.data.length); dev->name, iwr->u.data.length);
@ -1080,7 +1080,7 @@ int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd)
/* A bunch of special cases, then the generic case... /* A bunch of special cases, then the generic case...
* Note that 'cmd' is already filtered in dev_ioctl() with * Note that 'cmd' is already filtered in dev_ioctl() with
* (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */ * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */
switch(cmd) switch(cmd)
{ {
case SIOCGIWSTATS: case SIOCGIWSTATS:
/* Get Wireless Stats */ /* Get Wireless Stats */
@ -2015,7 +2015,7 @@ void wireless_send_event(struct net_device * dev,
* The best the driver could do is to log an error message. * The best the driver could do is to log an error message.
* We will do it ourselves instead... * We will do it ourselves instead...
*/ */
printk(KERN_ERR "%s (WE) : Invalid/Unknown Wireless Event (0x%04X)\n", printk(KERN_ERR "%s (WE) : Invalid/Unknown Wireless Event (0x%04X)\n",
dev->name, cmd); dev->name, cmd);
return; return;
} }
@ -2029,11 +2029,11 @@ void wireless_send_event(struct net_device * dev,
if(descr->header_type == IW_HEADER_TYPE_POINT) { if(descr->header_type == IW_HEADER_TYPE_POINT) {
/* Check if number of token fits within bounds */ /* Check if number of token fits within bounds */
if(wrqu->data.length > descr->max_tokens) { if(wrqu->data.length > descr->max_tokens) {
printk(KERN_ERR "%s (WE) : Wireless Event too big (%d)\n", dev->name, wrqu->data.length); printk(KERN_ERR "%s (WE) : Wireless Event too big (%d)\n", dev->name, wrqu->data.length);
return; return;
} }
if(wrqu->data.length < descr->min_tokens) { if(wrqu->data.length < descr->min_tokens) {
printk(KERN_ERR "%s (WE) : Wireless Event too small (%d)\n", dev->name, wrqu->data.length); printk(KERN_ERR "%s (WE) : Wireless Event too small (%d)\n", dev->name, wrqu->data.length);
return; return;
} }
/* Calculate extra_len - extra is NULL for restricted events */ /* Calculate extra_len - extra is NULL for restricted events */