From 8aee929eda10b2502fd76c0bf2003f89f7992820 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 10 Aug 2007 15:14:18 -0700 Subject: [ATM]: fore200e_param_bs_queue() must be __devinit WARNING: drivers/built-in.o(.text+0x6203bb): Section mismatch: reference to .init.text:fore200e_param_bs_queue (between 'fore200e_initialize' and 'fore200e_monitor_putc') Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 405ee5e..8b12925 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c @@ -2435,7 +2435,7 @@ fore200e_init_cmd_queue(struct fore200e* fore200e) } -static void __init +static void __devinit fore200e_param_bs_queue(struct fore200e* fore200e, enum buffer_scheme scheme, enum buffer_magn magn, int queue_length, int pool_size, int supply_blksize) -- cgit v0.10.2 From dcbdc93c6c64daf20622d6deae774d1e740efb8d Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Fri, 10 Aug 2007 15:14:54 -0700 Subject: [IPCONFIG]: ip_auto_config fix The following commandline: root=/dev/mtdblock6 rw rootfstype=jffs2 ip=192.168.1.10:::255.255.255.0:localhost.localdomain:eth1:off console=ttyS0,115200 makes ip_auto_config fall back to DHCP and complain "IP-Config: Incomplete network configuration information." depending on if CONFIG_IP_PNP_DHCP is set or not. The only way I can make ip_auto_config accept my IP config is to add an entry for the server IP: ip=192.168.1.10:192.168.1.15::255.255.255.0:localhost.localdomain:eth1:off I think this is a bug since I am not using a NFS root FS. The following patch fixes the above problem. From: Andrew Morton Davem said (in February!): Well, first of all the change in question is not in 2.4.x either. I just checked the current 2.4.x GIT tree and the test is exactly: if (ic_myaddr == INADDR_NONE || #ifdef CONFIG_ROOT_NFS (MAJOR(ROOT_DEV) == UNNAMED_MAJOR && root_server_addr == INADDR_NONE && ic_servaddr == INADDR_NONE) || #endif ic_first_dev->next) { which matches 2.6.x I even checked 2.4.x when it was branched for 2.5.x and the test was the same at the point in time too. Looking at the proposed change a bit it appears that it is probably correct, as it's trying to check that ROOT_DEV is nfs root. But if it is correct then the UNNAMED_MAJOR comparison in the same code block should be removed as it becomes superfluous. I'm happy to apply this patch with that modification made. Signed-off-by: Joakim Tjernlund Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 342ca8d..c5b2470 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -1281,9 +1281,9 @@ static int __init ip_auto_config(void) */ if (ic_myaddr == NONE || #ifdef CONFIG_ROOT_NFS - (MAJOR(ROOT_DEV) == UNNAMED_MAJOR - && root_server_addr == NONE - && ic_servaddr == NONE) || + (root_server_addr == NONE + && ic_servaddr == NONE + && ROOT_DEV == Root_NFS) || #endif ic_first_dev->next) { #ifdef IPCONFIG_DYNAMIC -- cgit v0.10.2 From af3502184aee8a0af6da8678e84c3d5bc5cdb83f Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 10 Aug 2007 15:15:55 -0700 Subject: [ATM]: Clean up duplicate includes in drivers/atm/ This patch cleans up duplicate includes in drivers/atm/ Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c index 55fd1b4..144a49f 100644 --- a/drivers/atm/lanai.c +++ b/drivers/atm/lanai.c @@ -65,7 +65,6 @@ #include #include #include -#include /* -------------------- TUNABLE PARAMATERS: */ -- cgit v0.10.2 From 6869a35b365c027b7acf50585c5bb34e34d4c41c Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 10 Aug 2007 15:16:42 -0700 Subject: [ATM]: Clean up duplicate includes in net/atm/ This patch cleans up duplicate includes in net/atm/ Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/atm/lec.c b/net/atm/lec.c index 2770fb4..59d5aa3 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c @@ -21,7 +21,6 @@ #include #include #include -#include #include /* TokenRing if needed */ -- cgit v0.10.2 From f49f9967b263cc88b48d912172afdc621bcb0a3c Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 10 Aug 2007 15:17:24 -0700 Subject: [IPV4]: Clean up duplicate includes in net/ipv4/ This patch cleans up duplicate includes in net/ipv4/ Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index c9e2b5e..0f1d7be 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -75,7 +75,6 @@ #include #include #include -#include #include #include #include diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index e1052bc..c32781d 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index dcc12b1..69bd362 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include -- cgit v0.10.2 From 703310e645c639a84e7f4b35d8a508acde9ef360 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 10 Aug 2007 15:17:58 -0700 Subject: [IPV6]: Clean up duplicate includes in net/ipv6/ This patch cleans up duplicate includes in net/ipv6/ Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index cbdb784..0f7defb 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -56,7 +56,6 @@ #include #include #include -#include #include #include #include -- cgit v0.10.2 From 0a26f4cdc207db14a8e7192bac5a7c84d9e2390a Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 10 Aug 2007 15:18:31 -0700 Subject: [PKT_SCHED]: Clean up duplicate includes in net/sched/ This patch cleans up duplicate includes in net/sched/ Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/sched/act_police.c b/net/sched/act_police.c index bf90e60f..6085be5 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include -- cgit v0.10.2 From 08dd2e29468d55f67fa346ede07ddfc58a60536b Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 10 Aug 2007 15:19:09 -0700 Subject: [SUNRPC]: Clean up duplicate includes in net/sunrpc/ This patch cleans up duplicate includes in net/sunrpc/ Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index dc2f41e..7da7050 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -42,7 +42,6 @@ #include #include -#include #include #include #include -- cgit v0.10.2 From 897c77cab0c386103e1c51fe8f3fc7eb5d1eb37f Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 10 Aug 2007 15:19:43 -0700 Subject: [TIPC]: Clean up duplicate includes in net/tipc/ This patch cleans up duplicate includes in net/tipc/ Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/tipc/port.c b/net/tipc/port.c index 5d2b9ce..7608815 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c @@ -41,7 +41,6 @@ #include "addr.h" #include "link.h" #include "node.h" -#include "port.h" #include "name_table.h" #include "user_reg.h" #include "msg.h" -- cgit v0.10.2 From b5890d8ba47741425fe3c0d753e1b57bc0561b7b Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 10 Aug 2007 15:20:21 -0700 Subject: [XFRM]: Clean up duplicate includes in net/xfrm/ This patch cleans up duplicate includes in net/xfrm/ Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index e5a3be0..7012891 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -23,10 +23,9 @@ #include #include #include +#include #include #include -#include -#include #include "xfrm_hash.h" diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 31be405..d4356e6 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -19,9 +19,8 @@ #include #include #include -#include #include -#include +#include #include "xfrm_hash.h" -- cgit v0.10.2 From d725fdc8027a4cd961f58d92917fbb91b171abfa Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Fri, 10 Aug 2007 15:21:17 -0700 Subject: [DCCP]: fix theoretical ccids_{read,write}_lock() race Make sure that spin_unlock_wait() is properly ordered wrt atomic_inc(). (akpm: can't we convert this code to use rwlocks?) Signed-off-by: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/dccp/ccid.c b/net/dccp/ccid.c index ccbf72c..c45088b 100644 --- a/net/dccp/ccid.c +++ b/net/dccp/ccid.c @@ -40,6 +40,7 @@ static inline void ccids_write_unlock(void) static inline void ccids_read_lock(void) { atomic_inc(&ccids_lockct); + smp_mb__after_atomic_inc(); spin_unlock_wait(&ccids_lock); } -- cgit v0.10.2 From e576de82ee628f68e5a44527c7ee99eadeab2e62 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 10 Aug 2007 15:23:54 -0700 Subject: [DCCP]: fix memory leak and clean up style - dccp_feat_empty_confirm() There's a memory leak in net/dccp/feat.c::dccp_feat_empty_confirm(). If we hit the 'default:' case of the 'switch' statement, then we return without freeing 'opt', thus leaking 'struct dccp_opt_pend' bytes. The leak is fixed easily enough by adding a kfree(opt); before the return statement. The patch also changes the layout of the 'switch' to be more in line with CodingStyle. Signed-off-by: Jesper Juhl Acked-by: Ian McDonald Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/net/dccp/feat.c b/net/dccp/feat.c index cd845df..5ebdd86 100644 --- a/net/dccp/feat.c +++ b/net/dccp/feat.c @@ -327,10 +327,16 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk, } switch (type) { - case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break; - case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break; - default: DCCP_WARN("invalid type %d\n", type); return; - + case DCCPO_CHANGE_L: + opt->dccpop_type = DCCPO_CONFIRM_R; + 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_val = NULL; -- cgit v0.10.2 From 1ee325438cdbe374ebea6e3d2f19204072c15038 Mon Sep 17 00:00:00 2001 From: Mariusz Kozlowski Date: Fri, 10 Aug 2007 15:24:50 -0700 Subject: [WAN] drivers/net/wan/hdlc_fr.c: kmalloc + memset conversion to kzalloc drivers/net/wan/hdlc_fr.c | 31260 -> 31223 (-37 bytes) drivers/net/wan/hdlc_fr.o | 144872 -> 144728 (-144 bytes) Signed-off-by: Mariusz Kozlowski Acked-by: Krzysztof Halasa Signed-off-by: Andrew Morton diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 15b6e07..071a64c 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c @@ -212,14 +212,13 @@ static pvc_device* add_pvc(struct net_device *dev, u16 dlci) pvc_p = &(*pvc_p)->next; } - pvc = kmalloc(sizeof(pvc_device), GFP_ATOMIC); + pvc = kzalloc(sizeof(pvc_device), GFP_ATOMIC); #ifdef DEBUG_PVC printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); #endif if (!pvc) return NULL; - memset(pvc, 0, sizeof(pvc_device)); pvc->dlci = dlci; pvc->frad = dev; pvc->next = *pvc_p; /* Put it in the chain */ -- cgit v0.10.2 From 48e3eeb1a1a89a3ea256cf6d3c898e753787cfaa Mon Sep 17 00:00:00 2001 From: Mariusz Kozlowski Date: Fri, 10 Aug 2007 15:25:40 -0700 Subject: [IRDA] irda-usb.c: mostly kmalloc + memset conversion to k[cz]alloc drivers/net/irda/irda-usb.c | 59694 -> 59541 (-153 bytes) drivers/net/irda/irda-usb.o | 170588 -> 169256 (-1332 bytes) Signed-off-by: Mariusz Kozlowski Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 0ac240c..3b0fd83 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -1561,10 +1561,9 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf struct irda_class_desc *desc; int ret; - desc = kmalloc(sizeof (*desc), GFP_KERNEL); - if (desc == NULL) + desc = kzalloc(sizeof(*desc), GFP_KERNEL); + if (!desc) return NULL; - memset(desc, 0, sizeof(*desc)); /* USB-IrDA class spec 1.0: * 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 usb_device *dev = interface_to_usbdev(intf); - struct irda_usb_cb *self = NULL; + struct irda_usb_cb *self; struct usb_host_interface *interface; struct irda_class_desc *irda_desc; int ret = -ENOMEM; @@ -1655,7 +1654,7 @@ static int irda_usb_probe(struct usb_interface *intf, 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); 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 */ irda_desc = irda_usb_find_class_desc(intf); ret = -ENODEV; - if (irda_desc == NULL) + if (!irda_desc) goto err_out_3; 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 * some heavy and complete testing. Don't ask why :-( * Jean II */ - self->speed_buff = kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); - if (self->speed_buff == NULL) + self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); + if (!self->speed_buff) goto err_out_3; - memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU); - self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length, GFP_KERNEL); - if (self->tx_buff == NULL) + if (!self->tx_buff) goto err_out_4; 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 */ irda_desc = irda_usb_find_class_desc (self->usbintf); - if (irda_desc == NULL) { + if (!irda_desc) { ret = -ENODEV; goto err_out_6; } - if (self->irda_desc) - kfree (self->irda_desc); + kfree(self->irda_desc); self->irda_desc = irda_desc; irda_usb_init_qos(self); } -- cgit v0.10.2 From f71417614d63932cf56ed98a0947568d6259d11e Mon Sep 17 00:00:00 2001 From: Mariusz Kozlowski Date: Fri, 10 Aug 2007 15:26:18 -0700 Subject: [ATM] drivers/atm/iphase.c: mostly kmalloc + memset conversion to kzalloc drivers/atm/iphase.c | 111508 -> 111431 (-77 bytes) drivers/atm/iphase.o | 254740 -> 254260 (-480 bytes) Signed-off-by: Mariusz Kozlowski Signed-off-by: Andrew Morton Signed-off-by: David S. Miller diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index a3b605a..ef52452 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c @@ -1601,14 +1601,14 @@ static int rx_init(struct atm_dev *dev) skb_queue_head_init(&iadev->rx_dma_q); 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", dev->number); goto err_free_dle; } - memset(iadev->rx_open, 0, 4*iadev->num_vc); + iadev->rxing = 1; iadev->rx_pkt_cnt = 0; /* Mode Register */ @@ -3171,12 +3171,12 @@ static int __devinit ia_init_one(struct pci_dev *pdev, unsigned long flags; int ret; - iadev = kmalloc(sizeof(*iadev), GFP_KERNEL); + iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); if (!iadev) { ret = -ENOMEM; goto err_out; } - memset(iadev, 0, sizeof(*iadev)); + iadev->pci = pdev; IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n", -- cgit v0.10.2 From 7f353bf29e162459f2f1e2ca25e41011fae65241 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Fri, 10 Aug 2007 15:47:58 -0700 Subject: [NET]: Share correct feature code between bridging and bonding http://bugzilla.kernel.org/show_bug.cgi?id=8797 shows that the bonding driver may produce bogus combinations of the checksum flags and SG/TSO. For example, if you bond devices with NETIF_F_HW_CSUM and NETIF_F_IP_CSUM you'll end up with a bonding device that has neither flag set. If both have TSO then this produces an illegal combination. The bridge device on the other hand has the correct code to deal with this. In fact, the same code can be used for both. So this patch moves that logic into net/core/dev.c and uses it for both bonding and bridging. In the process I've made small adjustments such as only setting GSO_ROBUST if at least one constituent device supports it. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 070b78d..1afda32 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1202,43 +1202,35 @@ static int bond_sethwaddr(struct net_device *bond_dev, return 0; } -#define BOND_INTERSECT_FEATURES \ - (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO) +#define BOND_VLAN_FEATURES \ + (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 - * feature bits are managed elsewhere, so preserve feature bits set on - * master device that are not part of the examined set. + * feature bits are managed elsewhere, so preserve those feature bits + * on the master device. */ static int bond_compute_features(struct bonding *bond) { - unsigned long features = BOND_INTERSECT_FEATURES; struct slave *slave; struct net_device *bond_dev = bond->dev; + unsigned long features = bond_dev->features; unsigned short max_hard_header_len = ETH_HLEN; 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) { - 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) max_hard_header_len = slave->dev->hard_header_len; } - if ((features & NETIF_F_SG) && - !(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); + features |= (bond_dev->features & BOND_VLAN_FEATURES); bond_dev->features = features; bond_dev->hard_header_len = max_hard_header_len; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4a616d7..e679b27 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1131,6 +1131,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v); 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) { int feature = gso_type << NETIF_F_GSO_SHIFT; diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 5e1892d..0eded17 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -179,5 +179,5 @@ void br_dev_setup(struct net_device *dev) dev->priv_flags = IFF_EBRIDGE; 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; } diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index b40dada..749f0e8 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -349,43 +349,15 @@ int br_min_mtu(const struct net_bridge *br) void br_features_recompute(struct net_bridge *br) { 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 & ~NETIF_F_ALL_CSUM; + features = br->feature_mask; list_for_each_entry(p, &br->port_list, list) { - unsigned long feature = 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; + features = netdev_compute_features(features, p->dev->features); } - if (!(checksum & NETIF_F_ALL_CSUM)) - 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; + br->dev->features = features; } /* called with RTNL */ diff --git a/net/core/dev.c b/net/core/dev.c index 6cc8a70..a76021c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3993,6 +3993,45 @@ static int __init netdev_dma_register(void) static int __init netdev_dma_register(void) { return -ENODEV; } #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 * unhooks any devices that fail to initialise (normally hardware not -- cgit v0.10.2 From cae7ca3d3de48851e929de9469397749638df779 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Fri, 10 Aug 2007 15:50:30 -0700 Subject: [IPVS]: Use IP_VS_WAIT_WHILE when encessary. For architectures that don't have a volatile atomic_ts constructs like while (atomic_read(&something)); might result in endless loops since a barrier() is missing which forces the compiler to generate code that actually reads memory contents. Fix this in ipvs by using the IP_VS_WAIT_WHILE macro which resolves to while (expr) { cpu_relax(); } (why isn't this open coded btw?) Signed-off-by: Heiko Carstens Signed-off-by: Simon Horman Signed-off-by: David S. Miller diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index c32781d..902fd57 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c @@ -908,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); /* 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 */ svc->scheduler->update_service(svc); -- cgit v0.10.2