Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [IPVS]: Use IP_VS_WAIT_WHILE when encessary.
  [NET]: Share correct feature code between bridging and bonding
  [ATM] drivers/atm/iphase.c: mostly kmalloc + memset conversion to kzalloc
  [IRDA] irda-usb.c: mostly kmalloc + memset conversion to k[cz]alloc
  [WAN] drivers/net/wan/hdlc_fr.c: kmalloc + memset conversion to kzalloc
  [DCCP]: fix memory leak and clean up style - dccp_feat_empty_confirm()
  [DCCP]: fix theoretical ccids_{read,write}_lock() race
  [XFRM]: Clean up duplicate includes in net/xfrm/
  [TIPC]: Clean up duplicate includes in net/tipc/
  [SUNRPC]: Clean up duplicate includes in net/sunrpc/
  [PKT_SCHED]: Clean up duplicate includes in net/sched/
  [IPV6]: Clean up duplicate includes in net/ipv6/
  [IPV4]: Clean up duplicate includes in net/ipv4/
  [ATM]: Clean up duplicate includes in net/atm/
  [ATM]: Clean up duplicate includes in drivers/atm/
  [IPCONFIG]: ip_auto_config fix
  [ATM]: fore200e_param_bs_queue() must be __devinit
This commit is contained in:
Linus Torvalds 2007-08-14 09:31:19 -07:00
commit ab3c556de1
23 changed files with 94 additions and 98 deletions

View File

@ -2435,7 +2435,7 @@ fore200e_init_cmd_queue(struct fore200e* fore200e)
} }
static void __init static void __devinit
fore200e_param_bs_queue(struct fore200e* fore200e, fore200e_param_bs_queue(struct fore200e* fore200e,
enum buffer_scheme scheme, enum buffer_magn magn, enum buffer_scheme scheme, enum buffer_magn magn,
int queue_length, int pool_size, int supply_blksize) int queue_length, int pool_size, int supply_blksize)

View File

@ -1601,14 +1601,14 @@ static int rx_init(struct atm_dev *dev)
skb_queue_head_init(&iadev->rx_dma_q); skb_queue_head_init(&iadev->rx_dma_q);
iadev->rx_free_desc_qhead = NULL; iadev->rx_free_desc_qhead = NULL;
iadev->rx_open = kmalloc(4*iadev->num_vc,GFP_KERNEL);
if (!iadev->rx_open) iadev->rx_open = kzalloc(4 * iadev->num_vc, GFP_KERNEL);
{ if (!iadev->rx_open) {
printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n", printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n",
dev->number); dev->number);
goto err_free_dle; goto err_free_dle;
} }
memset(iadev->rx_open, 0, 4*iadev->num_vc);
iadev->rxing = 1; iadev->rxing = 1;
iadev->rx_pkt_cnt = 0; iadev->rx_pkt_cnt = 0;
/* Mode Register */ /* Mode Register */
@ -3171,12 +3171,12 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
unsigned long flags; unsigned long flags;
int ret; int ret;
iadev = kmalloc(sizeof(*iadev), GFP_KERNEL); iadev = kzalloc(sizeof(*iadev), GFP_KERNEL);
if (!iadev) { if (!iadev) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_out; goto err_out;
} }
memset(iadev, 0, sizeof(*iadev));
iadev->pci = pdev; iadev->pci = pdev;
IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n", IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n",

View File

@ -65,7 +65,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/dma-mapping.h>
/* -------------------- TUNABLE PARAMATERS: */ /* -------------------- TUNABLE PARAMATERS: */

View File

@ -1202,43 +1202,35 @@ static int bond_sethwaddr(struct net_device *bond_dev,
return 0; return 0;
} }
#define BOND_INTERSECT_FEATURES \ #define BOND_VLAN_FEATURES \
(NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO) (NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | \
NETIF_F_HW_VLAN_FILTER)
/* /*
* Compute the common dev->feature set available to all slaves. Some * Compute the common dev->feature set available to all slaves. Some
* feature bits are managed elsewhere, so preserve feature bits set on * feature bits are managed elsewhere, so preserve those feature bits
* master device that are not part of the examined set. * on the master device.
*/ */
static int bond_compute_features(struct bonding *bond) static int bond_compute_features(struct bonding *bond)
{ {
unsigned long features = BOND_INTERSECT_FEATURES;
struct slave *slave; struct slave *slave;
struct net_device *bond_dev = bond->dev; struct net_device *bond_dev = bond->dev;
unsigned long features = bond_dev->features;
unsigned short max_hard_header_len = ETH_HLEN; unsigned short max_hard_header_len = ETH_HLEN;
int i; int i;
features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES);
features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
NETIF_F_GSO_MASK | NETIF_F_NO_CSUM;
bond_for_each_slave(bond, slave, i) { bond_for_each_slave(bond, slave, i) {
features &= (slave->dev->features & BOND_INTERSECT_FEATURES); features = netdev_compute_features(features,
slave->dev->features);
if (slave->dev->hard_header_len > max_hard_header_len) if (slave->dev->hard_header_len > max_hard_header_len)
max_hard_header_len = slave->dev->hard_header_len; max_hard_header_len = slave->dev->hard_header_len;
} }
if ((features & NETIF_F_SG) && features |= (bond_dev->features & BOND_VLAN_FEATURES);
!(features & NETIF_F_ALL_CSUM))
features &= ~NETIF_F_SG;
/*
* features will include NETIF_F_TSO (NETIF_F_UFO) iff all
* slave devices support NETIF_F_TSO (NETIF_F_UFO), which
* implies that all slaves also support scatter-gather
* (NETIF_F_SG), which implies that features also includes
* NETIF_F_SG. So no need to check whether we have an
* illegal combination of NETIF_F_{TSO,UFO} and
* !NETIF_F_SG
*/
features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES);
bond_dev->features = features; bond_dev->features = features;
bond_dev->hard_header_len = max_hard_header_len; bond_dev->hard_header_len = max_hard_header_len;

View File

@ -1561,10 +1561,9 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf
struct irda_class_desc *desc; struct irda_class_desc *desc;
int ret; int ret;
desc = kmalloc(sizeof (*desc), GFP_KERNEL); desc = kzalloc(sizeof(*desc), GFP_KERNEL);
if (desc == NULL) if (!desc)
return NULL; return NULL;
memset(desc, 0, sizeof(*desc));
/* USB-IrDA class spec 1.0: /* USB-IrDA class spec 1.0:
* 6.1.3: Standard "Get Descriptor" Device Request is not * 6.1.3: Standard "Get Descriptor" Device Request is not
@ -1617,7 +1616,7 @@ static int irda_usb_probe(struct usb_interface *intf,
{ {
struct net_device *net; struct net_device *net;
struct usb_device *dev = interface_to_usbdev(intf); struct usb_device *dev = interface_to_usbdev(intf);
struct irda_usb_cb *self = NULL; struct irda_usb_cb *self;
struct usb_host_interface *interface; struct usb_host_interface *interface;
struct irda_class_desc *irda_desc; struct irda_class_desc *irda_desc;
int ret = -ENOMEM; int ret = -ENOMEM;
@ -1655,7 +1654,7 @@ static int irda_usb_probe(struct usb_interface *intf,
self->header_length = USB_IRDA_HEADER; self->header_length = USB_IRDA_HEADER;
} }
self->rx_urb = kzalloc(self->max_rx_urb * sizeof(struct urb *), self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *),
GFP_KERNEL); GFP_KERNEL);
for (i = 0; i < self->max_rx_urb; i++) { for (i = 0; i < self->max_rx_urb; i++) {
@ -1715,7 +1714,7 @@ static int irda_usb_probe(struct usb_interface *intf,
/* Find IrDA class descriptor */ /* Find IrDA class descriptor */
irda_desc = irda_usb_find_class_desc(intf); irda_desc = irda_usb_find_class_desc(intf);
ret = -ENODEV; ret = -ENODEV;
if (irda_desc == NULL) if (!irda_desc)
goto err_out_3; goto err_out_3;
if (self->needspatch) { if (self->needspatch) {
@ -1738,15 +1737,13 @@ static int irda_usb_probe(struct usb_interface *intf,
/* Don't change this buffer size and allocation without doing /* Don't change this buffer size and allocation without doing
* some heavy and complete testing. Don't ask why :-( * some heavy and complete testing. Don't ask why :-(
* Jean II */ * Jean II */
self->speed_buff = kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
if (self->speed_buff == NULL) if (!self->speed_buff)
goto err_out_3; goto err_out_3;
memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU);
self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length, self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length,
GFP_KERNEL); GFP_KERNEL);
if (self->tx_buff == NULL) if (!self->tx_buff)
goto err_out_4; goto err_out_4;
ret = irda_usb_open(self); ret = irda_usb_open(self);
@ -1767,12 +1764,11 @@ static int irda_usb_probe(struct usb_interface *intf,
/* replace IrDA class descriptor with what patched device is now reporting */ /* replace IrDA class descriptor with what patched device is now reporting */
irda_desc = irda_usb_find_class_desc (self->usbintf); irda_desc = irda_usb_find_class_desc (self->usbintf);
if (irda_desc == NULL) { if (!irda_desc) {
ret = -ENODEV; ret = -ENODEV;
goto err_out_6; goto err_out_6;
} }
if (self->irda_desc) kfree(self->irda_desc);
kfree (self->irda_desc);
self->irda_desc = irda_desc; self->irda_desc = irda_desc;
irda_usb_init_qos(self); irda_usb_init_qos(self);
} }

View File

@ -212,14 +212,13 @@ static pvc_device* add_pvc(struct net_device *dev, u16 dlci)
pvc_p = &(*pvc_p)->next; pvc_p = &(*pvc_p)->next;
} }
pvc = kmalloc(sizeof(pvc_device), GFP_ATOMIC); pvc = kzalloc(sizeof(pvc_device), GFP_ATOMIC);
#ifdef DEBUG_PVC #ifdef DEBUG_PVC
printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev);
#endif #endif
if (!pvc) if (!pvc)
return NULL; return NULL;
memset(pvc, 0, sizeof(pvc_device));
pvc->dlci = dlci; pvc->dlci = dlci;
pvc->frad = dev; pvc->frad = dev;
pvc->next = *pvc_p; /* Put it in the chain */ pvc->next = *pvc_p; /* Put it in the chain */

View File

@ -1131,6 +1131,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
extern void linkwatch_run_queue(void); extern void linkwatch_run_queue(void);
extern int netdev_compute_features(unsigned long all, unsigned long one);
static inline int net_gso_ok(int features, int gso_type) static inline int net_gso_ok(int features, int gso_type)
{ {
int feature = gso_type << NETIF_F_GSO_SHIFT; int feature = gso_type << NETIF_F_GSO_SHIFT;

View File

@ -21,7 +21,6 @@
#include <net/dst.h> #include <net/dst.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
/* TokenRing if needed */ /* TokenRing if needed */

View File

@ -179,5 +179,5 @@ void br_dev_setup(struct net_device *dev)
dev->priv_flags = IFF_EBRIDGE; dev->priv_flags = IFF_EBRIDGE;
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST; NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX;
} }

View File

@ -349,43 +349,15 @@ int br_min_mtu(const struct net_bridge *br)
void br_features_recompute(struct net_bridge *br) void br_features_recompute(struct net_bridge *br)
{ {
struct net_bridge_port *p; struct net_bridge_port *p;
unsigned long features, checksum; unsigned long features;
checksum = br->feature_mask & NETIF_F_ALL_CSUM ? NETIF_F_NO_CSUM : 0; features = br->feature_mask;
features = br->feature_mask & ~NETIF_F_ALL_CSUM;
list_for_each_entry(p, &br->port_list, list) { list_for_each_entry(p, &br->port_list, list) {
unsigned long feature = p->dev->features; features = netdev_compute_features(features, p->dev->features);
/* if device needs checksumming, downgrade to hw checksumming */
if (checksum & NETIF_F_NO_CSUM && !(feature & NETIF_F_NO_CSUM))
checksum ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
/* if device can't do all checksum, downgrade to ipv4/ipv6 */
if (checksum & NETIF_F_HW_CSUM && !(feature & NETIF_F_HW_CSUM))
checksum ^= NETIF_F_HW_CSUM
| NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
if (checksum & NETIF_F_IPV6_CSUM && !(feature & NETIF_F_IPV6_CSUM))
checksum &= ~NETIF_F_IPV6_CSUM;
if (!(feature & NETIF_F_IP_CSUM))
checksum = 0;
if (feature & NETIF_F_GSO)
feature |= NETIF_F_GSO_SOFTWARE;
feature |= NETIF_F_GSO;
features &= feature;
} }
if (!(checksum & NETIF_F_ALL_CSUM)) br->dev->features = features;
features &= ~NETIF_F_SG;
if (!(features & NETIF_F_SG))
features &= ~NETIF_F_GSO_MASK;
br->dev->features = features | checksum | NETIF_F_LLTX |
NETIF_F_GSO_ROBUST;
} }
/* called with RTNL */ /* called with RTNL */

View File

@ -3993,6 +3993,45 @@ static int __init netdev_dma_register(void)
static int __init netdev_dma_register(void) { return -ENODEV; } static int __init netdev_dma_register(void) { return -ENODEV; }
#endif /* CONFIG_NET_DMA */ #endif /* CONFIG_NET_DMA */
/**
* netdev_compute_feature - compute conjunction of two feature sets
* @all: first feature set
* @one: second feature set
*
* Computes a new feature set after adding a device with feature set
* @one to the master device with current feature set @all. Returns
* the new feature set.
*/
int netdev_compute_features(unsigned long all, unsigned long one)
{
/* if device needs checksumming, downgrade to hw checksumming */
if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM))
all ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
/* if device can't do all checksum, downgrade to ipv4/ipv6 */
if (all & NETIF_F_HW_CSUM && !(one & NETIF_F_HW_CSUM))
all ^= NETIF_F_HW_CSUM
| NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
if (one & NETIF_F_GSO)
one |= NETIF_F_GSO_SOFTWARE;
one |= NETIF_F_GSO;
/* If even one device supports robust GSO, enable it for all. */
if (one & NETIF_F_GSO_ROBUST)
all |= NETIF_F_GSO_ROBUST;
all &= one | NETIF_F_LLTX;
if (!(all & NETIF_F_ALL_CSUM))
all &= ~NETIF_F_SG;
if (!(all & NETIF_F_SG))
all &= ~NETIF_F_GSO_MASK;
return all;
}
EXPORT_SYMBOL(netdev_compute_features);
/* /*
* Initialize the DEV module. At boot time this walks the device list and * Initialize the DEV module. At boot time this walks the device list and
* unhooks any devices that fail to initialise (normally hardware not * unhooks any devices that fail to initialise (normally hardware not

View File

@ -40,6 +40,7 @@ static inline void ccids_write_unlock(void)
static inline void ccids_read_lock(void) static inline void ccids_read_lock(void)
{ {
atomic_inc(&ccids_lockct); atomic_inc(&ccids_lockct);
smp_mb__after_atomic_inc();
spin_unlock_wait(&ccids_lock); spin_unlock_wait(&ccids_lock);
} }

View File

@ -327,10 +327,16 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk,
} }
switch (type) { switch (type) {
case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break; case DCCPO_CHANGE_L:
case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break; opt->dccpop_type = DCCPO_CONFIRM_R;
default: DCCP_WARN("invalid type %d\n", type); return; break;
case DCCPO_CHANGE_R:
opt->dccpop_type = DCCPO_CONFIRM_L;
break;
default:
DCCP_WARN("invalid type %d\n", type);
kfree(opt);
return;
} }
opt->dccpop_feat = feature; opt->dccpop_feat = feature;
opt->dccpop_val = NULL; opt->dccpop_val = NULL;

View File

@ -75,7 +75,6 @@
#include <net/icmp.h> #include <net/icmp.h>
#include <net/checksum.h> #include <net/checksum.h>
#include <net/inetpeer.h> #include <net/inetpeer.h>
#include <net/checksum.h>
#include <linux/igmp.h> #include <linux/igmp.h>
#include <linux/netfilter_ipv4.h> #include <linux/netfilter_ipv4.h>
#include <linux/netfilter_bridge.h> #include <linux/netfilter_bridge.h>

View File

@ -1281,9 +1281,9 @@ static int __init ip_auto_config(void)
*/ */
if (ic_myaddr == NONE || if (ic_myaddr == NONE ||
#ifdef CONFIG_ROOT_NFS #ifdef CONFIG_ROOT_NFS
(MAJOR(ROOT_DEV) == UNNAMED_MAJOR (root_server_addr == NONE
&& root_server_addr == NONE && ic_servaddr == NONE
&& ic_servaddr == NONE) || && ROOT_DEV == Root_NFS) ||
#endif #endif
ic_first_dev->next) { ic_first_dev->next) {
#ifdef IPCONFIG_DYNAMIC #ifdef IPCONFIG_DYNAMIC

View File

@ -29,7 +29,6 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/swap.h> #include <linux/swap.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/netfilter.h> #include <linux/netfilter.h>
@ -909,7 +908,7 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
write_lock_bh(&__ip_vs_svc_lock); write_lock_bh(&__ip_vs_svc_lock);
/* Wait until all other svc users go away */ /* Wait until all other svc users go away */
while (atomic_read(&svc->usecnt) > 1) {}; IP_VS_WAIT_WHILE(atomic_read(&svc->usecnt) > 1);
/* call the update_service, because server weight may be changed */ /* call the update_service, because server weight may be changed */
svc->scheduler->update_service(svc); svc->scheduler->update_service(svc);

View File

@ -19,7 +19,6 @@
#include <linux/udp.h> #include <linux/udp.h>
#include <linux/icmp.h> #include <linux/icmp.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/netfilter_arp.h> #include <linux/netfilter_arp.h>
#include <linux/netfilter/x_tables.h> #include <linux/netfilter/x_tables.h>

View File

@ -56,7 +56,6 @@
#include <net/inet_ecn.h> #include <net/inet_ecn.h>
#include <net/protocol.h> #include <net/protocol.h>
#include <net/xfrm.h> #include <net/xfrm.h>
#include <net/addrconf.h>
#include <net/snmp.h> #include <net/snmp.h>
#include <net/dsfield.h> #include <net/dsfield.h>
#include <net/timewait_sock.h> #include <net/timewait_sock.h>

View File

@ -16,7 +16,6 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/module.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/init.h> #include <linux/init.h>
#include <net/act_api.h> #include <net/act_api.h>

View File

@ -42,7 +42,6 @@
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/sunrpc/auth_gss.h> #include <linux/sunrpc/auth_gss.h>
#include <linux/sunrpc/svcauth.h>
#include <linux/sunrpc/gss_err.h> #include <linux/sunrpc/gss_err.h>
#include <linux/sunrpc/svcauth.h> #include <linux/sunrpc/svcauth.h>
#include <linux/sunrpc/svcauth_gss.h> #include <linux/sunrpc/svcauth_gss.h>

View File

@ -41,7 +41,6 @@
#include "addr.h" #include "addr.h"
#include "link.h" #include "link.h"
#include "node.h" #include "node.h"
#include "port.h"
#include "name_table.h" #include "name_table.h"
#include "user_reg.h" #include "user_reg.h"
#include "msg.h" #include "msg.h"

View File

@ -23,10 +23,9 @@
#include <linux/netfilter.h> #include <linux/netfilter.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/audit.h>
#include <net/xfrm.h> #include <net/xfrm.h>
#include <net/ip.h> #include <net/ip.h>
#include <linux/audit.h>
#include <linux/cache.h>
#include "xfrm_hash.h" #include "xfrm_hash.h"

View File

@ -19,9 +19,8 @@
#include <linux/ipsec.h> #include <linux/ipsec.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/cache.h> #include <linux/cache.h>
#include <asm/uaccess.h>
#include <linux/audit.h> #include <linux/audit.h>
#include <linux/cache.h> #include <asm/uaccess.h>
#include "xfrm_hash.h" #include "xfrm_hash.h"