aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-31 18:51:00 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-31 18:51:00 -0400
commit0d6caa1795090bd22ede96b84daa4600b63eee37 (patch)
tree7b69aa68f7f812bd1a13b0c5e73573a01e671ef8
parent88c8199b9d2f5ec0a8468a0495ba4c9656846500 (diff)
parent8072f085d79a0a73cc5a0333ffa7f0c5d35f76e0 (diff)
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: (41 commits) [RTNETLINK]: Fix warning for !CONFIG_KMOD [IPV4] ip_options.c: kmalloc + memset conversion to kzalloc [DECNET]: kmalloc + memset conversion to kzalloc [NET]: ethtool_perm_addr only has one implementation [NET]: ethtool ops are the only way [PPPOE]: Improve hashing function in hash_item(). [XFRM]: State selection update to use inner addresses. [IPSEC]: Ensure that state inner family is set [TCP]: Bidir flow must not disregard SACK blocks for lost marking [TCP]: Fix ratehalving with bidirectional flows [PPPOL2TP]: Add CONFIG_INET Kconfig dependency. [NET]: Page offsets and lengths need to be __u32. [AF_UNIX]: Make code static. [NETFILTER]: Make nf_ct_ipv6_skip_exthdr() static. [PKTGEN]: make get_ipsec_sa() static and non-inline [PPPoE]: move lock_sock() in pppoe_sendmsg() to the right location [PPPoX/E]: return ENOTTY on unknown ioctl requests [IPV6]: ipv6_addr_type() doesn't know about RFC4193 addresses. [NET]: Fix prio_tune() handling of root qdisc. [NET]: Fix sch_api to properly set sch->parent on the root. ...
-rw-r--r--drivers/dma/iovlock.c27
-rw-r--r--drivers/net/3c59x.c1
-rw-r--r--drivers/net/8139cp.c1
-rw-r--r--drivers/net/8139too.c1
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/ax88796.c1
-rw-r--r--drivers/net/b44.c1
-rw-r--r--drivers/net/bnx2.c1
-rw-r--r--drivers/net/bonding/bond_main.c52
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c1
-rw-r--r--drivers/net/e100.c1
-rw-r--r--drivers/net/e1000/e1000_ethtool.c1
-rw-r--r--drivers/net/forcedeth.c1
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c1
-rw-r--r--drivers/net/loopback.c7
-rw-r--r--drivers/net/ne2k-pci.c1
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c1
-rw-r--r--drivers/net/pcnet32.c1
-rw-r--r--drivers/net/pppoe.c37
-rw-r--r--drivers/net/pppox.c11
-rwxr-xr-xdrivers/net/qla3xxx.c1
-rw-r--r--drivers/net/r8169.c1
-rw-r--r--drivers/net/sc92031.c1
-rw-r--r--drivers/net/skge.c1
-rw-r--r--drivers/net/sky2.c1
-rw-r--r--drivers/net/sundance.c1
-rw-r--r--drivers/net/sunvnet.c1
-rw-r--r--drivers/net/tc35815.c1
-rw-r--r--drivers/net/tg3.c1
-rw-r--r--drivers/net/via-rhine.c1
-rw-r--r--include/linux/ethtool.h4
-rw-r--r--include/linux/ipv6.h5
-rw-r--r--include/linux/notifier.h13
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/net/af_unix.h29
-rw-r--r--include/net/bluetooth/l2cap.h50
-rw-r--r--include/net/ipv6.h1
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_ipv6.h3
-rw-r--r--include/net/tcp.h2
-rw-r--r--net/8021q/vlan_dev.c3
-rw-r--r--net/bluetooth/l2cap.c48
-rw-r--r--net/bluetooth/rfcomm/tty.c5
-rw-r--r--net/bridge/br_if.c41
-rw-r--r--net/core/dev.c93
-rw-r--r--net/core/ethtool.c64
-rw-r--r--net/core/pktgen.c106
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/decnet/dn_route.c4
-rw-r--r--net/ipv4/devinet.c5
-rw-r--r--net/ipv4/ip_options.c7
-rw-r--r--net/ipv4/ipvs/ip_vs_xmit.c2
-rw-r--r--net/ipv4/tcp_bic.c2
-rw-r--r--net/ipv4/tcp_cubic.c48
-rw-r--r--net/ipv4/tcp_htcp.c10
-rw-r--r--net/ipv4/tcp_illinois.c8
-rw-r--r--net/ipv4/tcp_input.c47
-rw-r--r--net/ipv4/tcp_lp.c6
-rw-r--r--net/ipv4/tcp_vegas.c6
-rw-r--r--net/ipv4/tcp_vegas.h2
-rw-r--r--net/ipv4/tcp_veno.c6
-rw-r--r--net/ipv4/tcp_westwood.c7
-rw-r--r--net/ipv4/tcp_yeah.c4
-rw-r--r--net/ipv6/addrconf.c8
-rw-r--r--net/ipv6/addrconf_core.c3
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c4
-rw-r--r--net/ipv6/route.c5
-rw-r--r--net/sched/sch_api.c17
-rw-r--r--net/sched/sch_ingress.c3
-rw-r--r--net/sched/sch_prio.c13
-rw-r--r--net/tipc/link.c28
-rw-r--r--net/unix/af_unix.c30
-rw-r--r--net/xfrm/xfrm_policy.c3
-rw-r--r--net/xfrm/xfrm_state.c4
-rw-r--r--net/xfrm/xfrm_user.c7
74 files changed, 451 insertions, 471 deletions
diff --git a/drivers/dma/iovlock.c b/drivers/dma/iovlock.c
index d637555a833b..e763d723e4cf 100644
--- a/drivers/dma/iovlock.c
+++ b/drivers/dma/iovlock.c
@@ -143,29 +143,6 @@ void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list)
143 kfree(pinned_list); 143 kfree(pinned_list);
144} 144}
145 145
146static dma_cookie_t dma_memcpy_to_kernel_iovec(struct dma_chan *chan, struct
147 iovec *iov, unsigned char *kdata, size_t len)
148{
149 dma_cookie_t dma_cookie = 0;
150
151 while (len > 0) {
152 if (iov->iov_len) {
153 int copy = min_t(unsigned int, iov->iov_len, len);
154 dma_cookie = dma_async_memcpy_buf_to_buf(
155 chan,
156 iov->iov_base,
157 kdata,
158 copy);
159 kdata += copy;
160 len -= copy;
161 iov->iov_len -= copy;
162 iov->iov_base += copy;
163 }
164 iov++;
165 }
166
167 return dma_cookie;
168}
169 146
170/* 147/*
171 * We have already pinned down the pages we will be using in the iovecs. 148 * We have already pinned down the pages we will be using in the iovecs.
@@ -187,10 +164,6 @@ dma_cookie_t dma_memcpy_to_iovec(struct dma_chan *chan, struct iovec *iov,
187 if (!chan) 164 if (!chan)
188 return memcpy_toiovec(iov, kdata, len); 165 return memcpy_toiovec(iov, kdata, len);
189 166
190 /* -> kernel copies (e.g. smbfs) */
191 if (!pinned_list)
192 return dma_memcpy_to_kernel_iovec(chan, iov, kdata, len);
193
194 iovec_idx = 0; 167 iovec_idx = 0;
195 while (iovec_idx < pinned_list->nr_iovecs) { 168 while (iovec_idx < pinned_list->nr_iovecs) {
196 struct dma_page_list *page_list; 169 struct dma_page_list *page_list;
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 6deb20fc7a08..001c66dd3a94 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -2886,7 +2886,6 @@ static const struct ethtool_ops vortex_ethtool_ops = {
2886 .set_settings = vortex_set_settings, 2886 .set_settings = vortex_set_settings,
2887 .get_link = ethtool_op_get_link, 2887 .get_link = ethtool_op_get_link,
2888 .nway_reset = vortex_nway_reset, 2888 .nway_reset = vortex_nway_reset,
2889 .get_perm_addr = ethtool_op_get_perm_addr,
2890}; 2889};
2891 2890
2892#ifdef CONFIG_PCI 2891#ifdef CONFIG_PCI
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index e970e64bf966..a79f28c7a100 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1578,7 +1578,6 @@ static const struct ethtool_ops cp_ethtool_ops = {
1578 .set_wol = cp_set_wol, 1578 .set_wol = cp_set_wol,
1579 .get_strings = cp_get_strings, 1579 .get_strings = cp_get_strings,
1580 .get_ethtool_stats = cp_get_ethtool_stats, 1580 .get_ethtool_stats = cp_get_ethtool_stats,
1581 .get_perm_addr = ethtool_op_get_perm_addr,
1582 .get_eeprom_len = cp_get_eeprom_len, 1581 .get_eeprom_len = cp_get_eeprom_len,
1583 .get_eeprom = cp_get_eeprom, 1582 .get_eeprom = cp_get_eeprom,
1584 .set_eeprom = cp_set_eeprom, 1583 .set_eeprom = cp_set_eeprom,
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 327eaa7b4999..f4e4298d24b9 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -2452,7 +2452,6 @@ static const struct ethtool_ops rtl8139_ethtool_ops = {
2452 .get_strings = rtl8139_get_strings, 2452 .get_strings = rtl8139_get_strings,
2453 .get_stats_count = rtl8139_get_stats_count, 2453 .get_stats_count = rtl8139_get_stats_count,
2454 .get_ethtool_stats = rtl8139_get_ethtool_stats, 2454 .get_ethtool_stats = rtl8139_get_ethtool_stats,
2455 .get_perm_addr = ethtool_op_get_perm_addr,
2456}; 2455};
2457 2456
2458static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 2457static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index f8a602caabcb..81ef81c9a584 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2851,7 +2851,7 @@ config PPPOATM
2851 2851
2852config PPPOL2TP 2852config PPPOL2TP
2853 tristate "PPP over L2TP (EXPERIMENTAL)" 2853 tristate "PPP over L2TP (EXPERIMENTAL)"
2854 depends on EXPERIMENTAL && PPP 2854 depends on EXPERIMENTAL && PPP && INET
2855 help 2855 help
2856 Support for PPP-over-L2TP socket family. L2TP is a protocol 2856 Support for PPP-over-L2TP socket family. L2TP is a protocol
2857 used by ISPs and enterprises to tunnel PPP traffic over UDP 2857 used by ISPs and enterprises to tunnel PPP traffic over UDP
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index e43e8047b90e..83da1770bafb 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -580,7 +580,6 @@ static const struct ethtool_ops ax_ethtool_ops = {
580 .set_settings = ax_set_settings, 580 .set_settings = ax_set_settings,
581 .nway_reset = ax_nway_reset, 581 .nway_reset = ax_nway_reset,
582 .get_link = ax_get_link, 582 .get_link = ax_get_link,
583 .get_perm_addr = ethtool_op_get_perm_addr,
584}; 583};
585 584
586/* setup code */ 585/* setup code */
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 37f1b6ff5c12..0795df235492 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -2033,7 +2033,6 @@ static const struct ethtool_ops b44_ethtool_ops = {
2033 .get_strings = b44_get_strings, 2033 .get_strings = b44_get_strings,
2034 .get_stats_count = b44_get_stats_count, 2034 .get_stats_count = b44_get_stats_count,
2035 .get_ethtool_stats = b44_get_ethtool_stats, 2035 .get_ethtool_stats = b44_get_ethtool_stats,
2036 .get_perm_addr = ethtool_op_get_perm_addr,
2037}; 2036};
2038 2037
2039static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 2038static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index a729da061bbb..d53dfc5bbae0 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6269,7 +6269,6 @@ static const struct ethtool_ops bnx2_ethtool_ops = {
6269 .phys_id = bnx2_phys_id, 6269 .phys_id = bnx2_phys_id,
6270 .get_stats_count = bnx2_get_stats_count, 6270 .get_stats_count = bnx2_get_stats_count,
6271 .get_ethtool_stats = bnx2_get_ethtool_stats, 6271 .get_ethtool_stats = bnx2_get_ethtool_stats,
6272 .get_perm_addr = ethtool_op_get_perm_addr,
6273}; 6272};
6274 6273
6275/* Called with rtnl_lock */ 6274/* Called with rtnl_lock */
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index cb9cb3013f42..070b78d959cc 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -613,38 +613,20 @@ down:
613static int bond_update_speed_duplex(struct slave *slave) 613static int bond_update_speed_duplex(struct slave *slave)
614{ 614{
615 struct net_device *slave_dev = slave->dev; 615 struct net_device *slave_dev = slave->dev;
616 static int (* ioctl)(struct net_device *, struct ifreq *, int);
617 struct ifreq ifr;
618 struct ethtool_cmd etool; 616 struct ethtool_cmd etool;
617 int res;
619 618
620 /* Fake speed and duplex */ 619 /* Fake speed and duplex */
621 slave->speed = SPEED_100; 620 slave->speed = SPEED_100;
622 slave->duplex = DUPLEX_FULL; 621 slave->duplex = DUPLEX_FULL;
623 622
624 if (slave_dev->ethtool_ops) { 623 if (!slave_dev->ethtool_ops || !slave_dev->ethtool_ops->get_settings)
625 int res; 624 return -1;
626
627 if (!slave_dev->ethtool_ops->get_settings) {
628 return -1;
629 }
630
631 res = slave_dev->ethtool_ops->get_settings(slave_dev, &etool);
632 if (res < 0) {
633 return -1;
634 }
635
636 goto verify;
637 }
638 625
639 ioctl = slave_dev->do_ioctl; 626 res = slave_dev->ethtool_ops->get_settings(slave_dev, &etool);
640 strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ); 627 if (res < 0)
641 etool.cmd = ETHTOOL_GSET;
642 ifr.ifr_data = (char*)&etool;
643 if (!ioctl || (IOCTL(slave_dev, &ifr, SIOCETHTOOL) < 0)) {
644 return -1; 628 return -1;
645 }
646 629
647verify:
648 switch (etool.speed) { 630 switch (etool.speed) {
649 case SPEED_10: 631 case SPEED_10:
650 case SPEED_100: 632 case SPEED_100:
@@ -690,7 +672,6 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de
690 static int (* ioctl)(struct net_device *, struct ifreq *, int); 672 static int (* ioctl)(struct net_device *, struct ifreq *, int);
691 struct ifreq ifr; 673 struct ifreq ifr;
692 struct mii_ioctl_data *mii; 674 struct mii_ioctl_data *mii;
693 struct ethtool_value etool;
694 675
695 if (bond->params.use_carrier) { 676 if (bond->params.use_carrier) {
696 return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0; 677 return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0;
@@ -721,9 +702,10 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de
721 } 702 }
722 } 703 }
723 704
724 /* try SIOCETHTOOL ioctl, some drivers cache ETHTOOL_GLINK */ 705 /*
725 /* for a period of time so we attempt to get link status */ 706 * Some drivers cache ETHTOOL_GLINK for a period of time so we only
726 /* from it last if the above MII ioctls fail... */ 707 * attempt to get link status from it if the above MII ioctls fail.
708 */
727 if (slave_dev->ethtool_ops) { 709 if (slave_dev->ethtool_ops) {
728 if (slave_dev->ethtool_ops->get_link) { 710 if (slave_dev->ethtool_ops->get_link) {
729 u32 link; 711 u32 link;
@@ -734,23 +716,9 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de
734 } 716 }
735 } 717 }
736 718
737 if (ioctl) {
738 strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ);
739 etool.cmd = ETHTOOL_GLINK;
740 ifr.ifr_data = (char*)&etool;
741 if (IOCTL(slave_dev, &ifr, SIOCETHTOOL) == 0) {
742 if (etool.data == 1) {
743 return BMSR_LSTATUS;
744 } else {
745 dprintk("SIOCETHTOOL shows link down\n");
746 return 0;
747 }
748 }
749 }
750
751 /* 719 /*
752 * If reporting, report that either there's no dev->do_ioctl, 720 * If reporting, report that either there's no dev->do_ioctl,
753 * or both SIOCGMIIREG and SIOCETHTOOL failed (meaning that we 721 * or both SIOCGMIIREG and get_link failed (meaning that we
754 * cannot report link status). If not reporting, pretend 722 * cannot report link status). If not reporting, pretend
755 * we're ok. 723 * we're ok.
756 */ 724 */
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 6fd1e5241833..dc5d26988bb3 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1583,7 +1583,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
1583 .get_wol = get_wol, 1583 .get_wol = get_wol,
1584 .get_tso = ethtool_op_get_tso, 1584 .get_tso = ethtool_op_get_tso,
1585 .set_tso = ethtool_op_set_tso, 1585 .set_tso = ethtool_op_set_tso,
1586 .get_perm_addr = ethtool_op_get_perm_addr
1587}; 1586};
1588 1587
1589static int in_range(int val, int lo, int hi) 1588static int in_range(int val, int lo, int hi)
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 6b6401e9304e..280313b9b069 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2506,7 +2506,6 @@ static const struct ethtool_ops e100_ethtool_ops = {
2506 .phys_id = e100_phys_id, 2506 .phys_id = e100_phys_id,
2507 .get_stats_count = e100_get_stats_count, 2507 .get_stats_count = e100_get_stats_count,
2508 .get_ethtool_stats = e100_get_ethtool_stats, 2508 .get_ethtool_stats = e100_get_ethtool_stats,
2509 .get_perm_addr = ethtool_op_get_perm_addr,
2510}; 2509};
2511 2510
2512static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) 2511static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index bb08375b5f13..c90c92e72d2a 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1973,7 +1973,6 @@ static const struct ethtool_ops e1000_ethtool_ops = {
1973 .phys_id = e1000_phys_id, 1973 .phys_id = e1000_phys_id,
1974 .get_stats_count = e1000_get_stats_count, 1974 .get_stats_count = e1000_get_stats_count,
1975 .get_ethtool_stats = e1000_get_ethtool_stats, 1975 .get_ethtool_stats = e1000_get_ethtool_stats,
1976 .get_perm_addr = ethtool_op_get_perm_addr,
1977}; 1976};
1978 1977
1979void e1000_set_ethtool_ops(struct net_device *netdev) 1978void e1000_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 51e1cb472738..69f5f365239a 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -4707,7 +4707,6 @@ static const struct ethtool_ops ops = {
4707 .get_regs_len = nv_get_regs_len, 4707 .get_regs_len = nv_get_regs_len,
4708 .get_regs = nv_get_regs, 4708 .get_regs = nv_get_regs,
4709 .nway_reset = nv_nway_reset, 4709 .nway_reset = nv_nway_reset,
4710 .get_perm_addr = ethtool_op_get_perm_addr,
4711 .get_tso = ethtool_op_get_tso, 4710 .get_tso = ethtool_op_get_tso,
4712 .set_tso = nv_set_tso, 4711 .set_tso = nv_set_tso,
4713 .get_ringparam = nv_get_ringparam, 4712 .get_ringparam = nv_get_ringparam,
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index afde84868bea..0413cd95eda7 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -724,7 +724,6 @@ static const struct ethtool_ops ixgb_ethtool_ops = {
724 .phys_id = ixgb_phys_id, 724 .phys_id = ixgb_phys_id,
725 .get_stats_count = ixgb_get_stats_count, 725 .get_stats_count = ixgb_get_stats_count,
726 .get_ethtool_stats = ixgb_get_ethtool_stats, 726 .get_ethtool_stats = ixgb_get_ethtool_stats,
727 .get_perm_addr = ethtool_op_get_perm_addr,
728}; 727};
729 728
730void ixgb_set_ethtool_ops(struct net_device *netdev) 729void ixgb_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 6ba6ed2b480a..5106c2328d12 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -229,7 +229,12 @@ struct net_device loopback_dev = {
229/* Setup and register the loopback device. */ 229/* Setup and register the loopback device. */
230static int __init loopback_init(void) 230static int __init loopback_init(void)
231{ 231{
232 return register_netdev(&loopback_dev); 232 int err = register_netdev(&loopback_dev);
233
234 if (err)
235 panic("loopback: Failed to register netdevice: %d\n", err);
236
237 return err;
233}; 238};
234 239
235module_init(loopback_init); 240module_init(loopback_init);
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index cfdeaf7aa163..f81d9398d605 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -638,7 +638,6 @@ static const struct ethtool_ops ne2k_pci_ethtool_ops = {
638 .get_drvinfo = ne2k_pci_get_drvinfo, 638 .get_drvinfo = ne2k_pci_get_drvinfo,
639 .get_tx_csum = ethtool_op_get_tx_csum, 639 .get_tx_csum = ethtool_op_get_tx_csum,
640 .get_sg = ethtool_op_get_sg, 640 .get_sg = ethtool_op_get_sg,
641 .get_perm_addr = ethtool_op_get_perm_addr,
642}; 641};
643 642
644static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev) 643static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev)
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 0175f6c353f6..a6138b474b4a 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -755,5 +755,4 @@ struct ethtool_ops netxen_nic_ethtool_ops = {
755 .get_strings = netxen_nic_get_strings, 755 .get_strings = netxen_nic_get_strings,
756 .get_stats_count = netxen_nic_get_stats_count, 756 .get_stats_count = netxen_nic_get_stats_count,
757 .get_ethtool_stats = netxen_nic_get_ethtool_stats, 757 .get_ethtool_stats = netxen_nic_get_ethtool_stats,
758 .get_perm_addr = ethtool_op_get_perm_addr,
759}; 758};
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 465485a3fbc6..e6a67531de99 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -1515,7 +1515,6 @@ static const struct ethtool_ops pcnet32_ethtool_ops = {
1515 .phys_id = pcnet32_phys_id, 1515 .phys_id = pcnet32_phys_id,
1516 .get_regs_len = pcnet32_get_regs_len, 1516 .get_regs_len = pcnet32_get_regs_len,
1517 .get_regs = pcnet32_get_regs, 1517 .get_regs = pcnet32_get_regs,
1518 .get_perm_addr = ethtool_op_get_perm_addr,
1519}; 1518};
1520 1519
1521/* only probes for non-PCI devices, the rest are handled by 1520/* only probes for non-PCI devices, the rest are handled by
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 6f98834e6ace..68631a5721ac 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -108,19 +108,24 @@ static inline int cmp_addr(struct pppoe_addr *a, unsigned long sid, char *addr)
108 (memcmp(a->remote,addr,ETH_ALEN) == 0)); 108 (memcmp(a->remote,addr,ETH_ALEN) == 0));
109} 109}
110 110
111static int hash_item(unsigned long sid, unsigned char *addr) 111#if 8%PPPOE_HASH_BITS
112#error 8 must be a multiple of PPPOE_HASH_BITS
113#endif
114
115static int hash_item(unsigned int sid, unsigned char *addr)
112{ 116{
113 char hash = 0; 117 unsigned char hash = 0;
114 int i, j; 118 unsigned int i;
115 119
116 for (i = 0; i < ETH_ALEN ; ++i) { 120 for (i = 0 ; i < ETH_ALEN ; i++) {
117 for (j = 0; j < 8/PPPOE_HASH_BITS ; ++j) { 121 hash ^= addr[i];
118 hash ^= addr[i] >> ( j * PPPOE_HASH_BITS ); 122 }
119 } 123 for (i = 0 ; i < sizeof(sid_t)*8 ; i += 8 ){
124 hash ^= sid>>i;
125 }
126 for (i = 8 ; (i>>=1) >= PPPOE_HASH_BITS ; ) {
127 hash ^= hash>>i;
120 } 128 }
121
122 for (i = 0; i < (sizeof(unsigned long)*8) / PPPOE_HASH_BITS ; ++i)
123 hash ^= sid >> (i*PPPOE_HASH_BITS);
124 129
125 return hash & ( PPPOE_HASH_SIZE - 1 ); 130 return hash & ( PPPOE_HASH_SIZE - 1 );
126} 131}
@@ -664,8 +669,8 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
664{ 669{
665 struct sock *sk = sock->sk; 670 struct sock *sk = sock->sk;
666 struct pppox_sock *po = pppox_sk(sk); 671 struct pppox_sock *po = pppox_sk(sk);
667 int val = 0; 672 int val;
668 int err = 0; 673 int err;
669 674
670 switch (cmd) { 675 switch (cmd) {
671 case PPPIOCGMRU: 676 case PPPIOCGMRU:
@@ -754,8 +759,9 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
754 err = 0; 759 err = 0;
755 break; 760 break;
756 761
757 default:; 762 default:
758 }; 763 err = -ENOTTY;
764 }
759 765
760 return err; 766 return err;
761} 767}
@@ -773,6 +779,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
773 struct net_device *dev; 779 struct net_device *dev;
774 char *start; 780 char *start;
775 781
782 lock_sock(sk);
776 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) { 783 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) {
777 error = -ENOTCONN; 784 error = -ENOTCONN;
778 goto end; 785 goto end;
@@ -783,8 +790,6 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
783 hdr.code = 0; 790 hdr.code = 0;
784 hdr.sid = po->num; 791 hdr.sid = po->num;
785 792
786 lock_sock(sk);
787
788 dev = po->pppoe_dev; 793 dev = po->pppoe_dev;
789 794
790 error = -EMSGSIZE; 795 error = -EMSGSIZE;
diff --git a/drivers/net/pppox.c b/drivers/net/pppox.c
index f3e47d0c2b3c..25c52b55c38f 100644
--- a/drivers/net/pppox.c
+++ b/drivers/net/pppox.c
@@ -73,7 +73,7 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
73{ 73{
74 struct sock *sk = sock->sk; 74 struct sock *sk = sock->sk;
75 struct pppox_sock *po = pppox_sk(sk); 75 struct pppox_sock *po = pppox_sk(sk);
76 int rc = 0; 76 int rc;
77 77
78 lock_sock(sk); 78 lock_sock(sk);
79 79
@@ -94,12 +94,9 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
94 break; 94 break;
95 } 95 }
96 default: 96 default:
97 if (pppox_protos[sk->sk_protocol]->ioctl) 97 rc = pppox_protos[sk->sk_protocol]->ioctl ?
98 rc = pppox_protos[sk->sk_protocol]->ioctl(sock, cmd, 98 pppox_protos[sk->sk_protocol]->ioctl(sock, cmd, arg) : -ENOTTY;
99 arg); 99 }
100
101 break;
102 };
103 100
104 release_sock(sk); 101 release_sock(sk);
105 return rc; 102 return rc;
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 8be8be451ada..69da95b5ad0c 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -1904,7 +1904,6 @@ static void ql_get_pauseparam(struct net_device *ndev,
1904static const struct ethtool_ops ql3xxx_ethtool_ops = { 1904static const struct ethtool_ops ql3xxx_ethtool_ops = {
1905 .get_settings = ql_get_settings, 1905 .get_settings = ql_get_settings,
1906 .get_drvinfo = ql_get_drvinfo, 1906 .get_drvinfo = ql_get_drvinfo,
1907 .get_perm_addr = ethtool_op_get_perm_addr,
1908 .get_link = ethtool_op_get_link, 1907 .get_link = ethtool_op_get_link,
1909 .get_msglevel = ql_get_msglevel, 1908 .get_msglevel = ql_get_msglevel,
1910 .set_msglevel = ql_set_msglevel, 1909 .set_msglevel = ql_set_msglevel,
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index bb6896ae3151..c9333b9dd51a 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1066,7 +1066,6 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
1066 .get_strings = rtl8169_get_strings, 1066 .get_strings = rtl8169_get_strings,
1067 .get_stats_count = rtl8169_get_stats_count, 1067 .get_stats_count = rtl8169_get_stats_count,
1068 .get_ethtool_stats = rtl8169_get_ethtool_stats, 1068 .get_ethtool_stats = rtl8169_get_ethtool_stats,
1069 .get_perm_addr = ethtool_op_get_perm_addr,
1070}; 1069};
1071 1070
1072static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg, 1071static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg,
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 5b7284c955dc..872cb1cc9c41 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -1402,7 +1402,6 @@ static struct ethtool_ops sc92031_ethtool_ops = {
1402 .get_strings = sc92031_ethtool_get_strings, 1402 .get_strings = sc92031_ethtool_get_strings,
1403 .get_stats_count = sc92031_ethtool_get_stats_count, 1403 .get_stats_count = sc92031_ethtool_get_stats_count,
1404 .get_ethtool_stats = sc92031_ethtool_get_ethtool_stats, 1404 .get_ethtool_stats = sc92031_ethtool_get_ethtool_stats,
1405 .get_perm_addr = ethtool_op_get_perm_addr,
1406 .get_ufo = ethtool_op_get_ufo, 1405 .get_ufo = ethtool_op_get_ufo,
1407}; 1406};
1408 1407
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 776692946562..e3d8520209b8 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -821,7 +821,6 @@ static const struct ethtool_ops skge_ethtool_ops = {
821 .phys_id = skge_phys_id, 821 .phys_id = skge_phys_id,
822 .get_stats_count = skge_get_stats_count, 822 .get_stats_count = skge_get_stats_count,
823 .get_ethtool_stats = skge_get_ethtool_stats, 823 .get_ethtool_stats = skge_get_ethtool_stats,
824 .get_perm_addr = ethtool_op_get_perm_addr,
825}; 824};
826 825
827/* 826/*
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 13f08a390e1f..e7a2eadcc3b0 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3548,7 +3548,6 @@ static const struct ethtool_ops sky2_ethtool_ops = {
3548 .phys_id = sky2_phys_id, 3548 .phys_id = sky2_phys_id,
3549 .get_stats_count = sky2_get_stats_count, 3549 .get_stats_count = sky2_get_stats_count,
3550 .get_ethtool_stats = sky2_get_ethtool_stats, 3550 .get_ethtool_stats = sky2_get_ethtool_stats,
3551 .get_perm_addr = ethtool_op_get_perm_addr,
3552}; 3551};
3553 3552
3554#ifdef CONFIG_SKY2_DEBUG 3553#ifdef CONFIG_SKY2_DEBUG
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index af0c9831074c..a8f2af8f778a 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -1586,7 +1586,6 @@ static const struct ethtool_ops ethtool_ops = {
1586 .get_link = get_link, 1586 .get_link = get_link,
1587 .get_msglevel = get_msglevel, 1587 .get_msglevel = get_msglevel,
1588 .set_msglevel = set_msglevel, 1588 .set_msglevel = set_msglevel,
1589 .get_perm_addr = ethtool_op_get_perm_addr,
1590}; 1589};
1591 1590
1592static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1591static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c
index 61f98251feab..ff1028a597df 100644
--- a/drivers/net/sunvnet.c
+++ b/drivers/net/sunvnet.c
@@ -906,7 +906,6 @@ static const struct ethtool_ops vnet_ethtool_ops = {
906 .get_msglevel = vnet_get_msglevel, 906 .get_msglevel = vnet_get_msglevel,
907 .set_msglevel = vnet_set_msglevel, 907 .set_msglevel = vnet_set_msglevel,
908 .get_link = ethtool_op_get_link, 908 .get_link = ethtool_op_get_link,
909 .get_perm_addr = ethtool_op_get_perm_addr,
910}; 909};
911 910
912static void vnet_port_free_tx_bufs(struct vnet_port *port) 911static void vnet_port_free_tx_bufs(struct vnet_port *port)
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 7f94ca930988..ec41469eee82 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -2198,7 +2198,6 @@ static const struct ethtool_ops tc35815_ethtool_ops = {
2198 .get_strings = tc35815_get_strings, 2198 .get_strings = tc35815_get_strings,
2199 .get_stats_count = tc35815_get_stats_count, 2199 .get_stats_count = tc35815_get_stats_count,
2200 .get_ethtool_stats = tc35815_get_ethtool_stats, 2200 .get_ethtool_stats = tc35815_get_ethtool_stats,
2201 .get_perm_addr = ethtool_op_get_perm_addr,
2202}; 2201};
2203 2202
2204static int tc35815_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 2203static int tc35815_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 887b9a5cfe48..dc41c055ebb5 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -9294,7 +9294,6 @@ static const struct ethtool_ops tg3_ethtool_ops = {
9294 .get_ethtool_stats = tg3_get_ethtool_stats, 9294 .get_ethtool_stats = tg3_get_ethtool_stats,
9295 .get_coalesce = tg3_get_coalesce, 9295 .get_coalesce = tg3_get_coalesce,
9296 .set_coalesce = tg3_set_coalesce, 9296 .set_coalesce = tg3_set_coalesce,
9297 .get_perm_addr = ethtool_op_get_perm_addr,
9298}; 9297};
9299 9298
9300static void __devinit tg3_get_eeprom_size(struct tg3 *tp) 9299static void __devinit tg3_get_eeprom_size(struct tg3 *tp)
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index f51c2c138f10..c3fe230695a0 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -1805,7 +1805,6 @@ static const struct ethtool_ops netdev_ethtool_ops = {
1805 .set_wol = rhine_set_wol, 1805 .set_wol = rhine_set_wol,
1806 .get_sg = ethtool_op_get_sg, 1806 .get_sg = ethtool_op_get_sg,
1807 .get_tx_csum = ethtool_op_get_tx_csum, 1807 .get_tx_csum = ethtool_op_get_tx_csum,
1808 .get_perm_addr = ethtool_op_get_perm_addr,
1809}; 1808};
1810 1809
1811static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1810static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 3a632244f31b..23ccea811297 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -270,8 +270,6 @@ u32 ethtool_op_get_sg(struct net_device *dev);
270int ethtool_op_set_sg(struct net_device *dev, u32 data); 270int ethtool_op_set_sg(struct net_device *dev, u32 data);
271u32 ethtool_op_get_tso(struct net_device *dev); 271u32 ethtool_op_get_tso(struct net_device *dev);
272int ethtool_op_set_tso(struct net_device *dev, u32 data); 272int ethtool_op_set_tso(struct net_device *dev, u32 data);
273int ethtool_op_get_perm_addr(struct net_device *dev,
274 struct ethtool_perm_addr *addr, u8 *data);
275u32 ethtool_op_get_ufo(struct net_device *dev); 273u32 ethtool_op_get_ufo(struct net_device *dev);
276int ethtool_op_set_ufo(struct net_device *dev, u32 data); 274int ethtool_op_set_ufo(struct net_device *dev, u32 data);
277 275
@@ -309,7 +307,6 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
309 * get_strings: Return a set of strings that describe the requested objects 307 * get_strings: Return a set of strings that describe the requested objects
310 * phys_id: Identify the device 308 * phys_id: Identify the device
311 * get_stats: Return statistics about the device 309 * get_stats: Return statistics about the device
312 * get_perm_addr: Gets the permanent hardware address
313 * 310 *
314 * Description: 311 * Description:
315 * 312 *
@@ -368,7 +365,6 @@ struct ethtool_ops {
368 int (*phys_id)(struct net_device *, u32); 365 int (*phys_id)(struct net_device *, u32);
369 int (*get_stats_count)(struct net_device *); 366 int (*get_stats_count)(struct net_device *);
370 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); 367 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
371 int (*get_perm_addr)(struct net_device *, struct ethtool_perm_addr *, u8 *);
372 int (*begin)(struct net_device *); 368 int (*begin)(struct net_device *);
373 void (*complete)(struct net_device *); 369 void (*complete)(struct net_device *);
374 u32 (*get_ufo)(struct net_device *); 370 u32 (*get_ufo)(struct net_device *);
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 97983dc9df13..4ca60c3320fb 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -219,7 +219,6 @@ enum {
219#include <linux/tcp.h> 219#include <linux/tcp.h>
220#include <linux/udp.h> 220#include <linux/udp.h>
221 221
222#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
223#include <net/inet_sock.h> 222#include <net/inet_sock.h>
224 223
225static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb) 224static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
@@ -273,6 +272,10 @@ struct tcp6_request_sock {
273 struct inet6_request_sock tcp6rsk_inet6; 272 struct inet6_request_sock tcp6rsk_inet6;
274}; 273};
275 274
275struct ipv6_mc_socklist;
276struct ipv6_ac_socklist;
277struct ipv6_fl_socklist;
278
276/** 279/**
277 * struct ipv6_pinfo - ipv6 private area 280 * struct ipv6_pinfo - ipv6 private area
278 * 281 *
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index be3f2bb6fcf3..fad7ff17e468 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -157,6 +157,19 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
157 */ 157 */
158#define NOTIFY_STOP (NOTIFY_OK|NOTIFY_STOP_MASK) 158#define NOTIFY_STOP (NOTIFY_OK|NOTIFY_STOP_MASK)
159 159
160/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */
161static inline int notifier_from_errno(int err)
162{
163 return NOTIFY_STOP_MASK | (NOTIFY_OK - err);
164}
165
166/* Restore (negative) errno value from notify return value. */
167static inline int notifier_to_errno(int ret)
168{
169 ret &= ~NOTIFY_STOP_MASK;
170 return ret > NOTIFY_OK ? NOTIFY_OK - ret : 0;
171}
172
160/* 173/*
161 * Declared notifiers so far. I can imagine quite a few more chains 174 * Declared notifiers so far. I can imagine quite a few more chains
162 * over time (eg laptop power reset chains, reboot chain (to clean 175 * over time (eg laptop power reset chains, reboot chain (to clean
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ce256438e619..93c27f71122a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -134,8 +134,8 @@ typedef struct skb_frag_struct skb_frag_t;
134 134
135struct skb_frag_struct { 135struct skb_frag_struct {
136 struct page *page; 136 struct page *page;
137 __u16 page_offset; 137 __u32 page_offset;
138 __u16 size; 138 __u32 size;
139}; 139};
140 140
141/* This data is invariant across clones and lives at 141/* This data is invariant across clones and lives at
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 6de1e9e35c73..0864a775de24 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -12,37 +12,8 @@ extern void unix_gc(void);
12 12
13#define UNIX_HASH_SIZE 256 13#define UNIX_HASH_SIZE 256
14 14
15extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
16extern spinlock_t unix_table_lock;
17
18extern atomic_t unix_tot_inflight; 15extern atomic_t unix_tot_inflight;
19 16
20static inline struct sock *first_unix_socket(int *i)
21{
22 for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) {
23 if (!hlist_empty(&unix_socket_table[*i]))
24 return __sk_head(&unix_socket_table[*i]);
25 }
26 return NULL;
27}
28
29static inline struct sock *next_unix_socket(int *i, struct sock *s)
30{
31 struct sock *next = sk_next(s);
32 /* More in this chain? */
33 if (next)
34 return next;
35 /* Look for next non-empty chain. */
36 for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
37 if (!hlist_empty(&unix_socket_table[*i]))
38 return __sk_head(&unix_socket_table[*i]);
39 }
40 return NULL;
41}
42
43#define forall_unix_sockets(i, s) \
44 for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s)))
45
46struct unix_address { 17struct unix_address {
47 atomic_t refcnt; 18 atomic_t refcnt;
48 int len; 19 int len;
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 87df4e87622d..70e70f5d3dd6 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -34,7 +34,7 @@
34/* L2CAP socket address */ 34/* L2CAP socket address */
35struct sockaddr_l2 { 35struct sockaddr_l2 {
36 sa_family_t l2_family; 36 sa_family_t l2_family;
37 unsigned short l2_psm; 37 __le16 l2_psm;
38 bdaddr_t l2_bdaddr; 38 bdaddr_t l2_bdaddr;
39}; 39};
40 40
@@ -76,32 +76,32 @@ struct l2cap_conninfo {
76 76
77/* L2CAP structures */ 77/* L2CAP structures */
78struct l2cap_hdr { 78struct l2cap_hdr {
79 __u16 len; 79 __le16 len;
80 __u16 cid; 80 __le16 cid;
81} __attribute__ ((packed)); 81} __attribute__ ((packed));
82#define L2CAP_HDR_SIZE 4 82#define L2CAP_HDR_SIZE 4
83 83
84struct l2cap_cmd_hdr { 84struct l2cap_cmd_hdr {
85 __u8 code; 85 __u8 code;
86 __u8 ident; 86 __u8 ident;
87 __u16 len; 87 __le16 len;
88} __attribute__ ((packed)); 88} __attribute__ ((packed));
89#define L2CAP_CMD_HDR_SIZE 4 89#define L2CAP_CMD_HDR_SIZE 4
90 90
91struct l2cap_cmd_rej { 91struct l2cap_cmd_rej {
92 __u16 reason; 92 __le16 reason;
93} __attribute__ ((packed)); 93} __attribute__ ((packed));
94 94
95struct l2cap_conn_req { 95struct l2cap_conn_req {
96 __u16 psm; 96 __le16 psm;
97 __u16 scid; 97 __le16 scid;
98} __attribute__ ((packed)); 98} __attribute__ ((packed));
99 99
100struct l2cap_conn_rsp { 100struct l2cap_conn_rsp {
101 __u16 dcid; 101 __le16 dcid;
102 __u16 scid; 102 __le16 scid;
103 __u16 result; 103 __le16 result;
104 __u16 status; 104 __le16 status;
105} __attribute__ ((packed)); 105} __attribute__ ((packed));
106 106
107/* connect result */ 107/* connect result */
@@ -117,15 +117,15 @@ struct l2cap_conn_rsp {
117#define L2CAP_CS_AUTHOR_PEND 0x0002 117#define L2CAP_CS_AUTHOR_PEND 0x0002
118 118
119struct l2cap_conf_req { 119struct l2cap_conf_req {
120 __u16 dcid; 120 __le16 dcid;
121 __u16 flags; 121 __le16 flags;
122 __u8 data[0]; 122 __u8 data[0];
123} __attribute__ ((packed)); 123} __attribute__ ((packed));
124 124
125struct l2cap_conf_rsp { 125struct l2cap_conf_rsp {
126 __u16 scid; 126 __le16 scid;
127 __u16 flags; 127 __le16 flags;
128 __u16 result; 128 __le16 result;
129 __u8 data[0]; 129 __u8 data[0];
130} __attribute__ ((packed)); 130} __attribute__ ((packed));
131 131
@@ -149,23 +149,23 @@ struct l2cap_conf_opt {
149#define L2CAP_CONF_MAX_SIZE 22 149#define L2CAP_CONF_MAX_SIZE 22
150 150
151struct l2cap_disconn_req { 151struct l2cap_disconn_req {
152 __u16 dcid; 152 __le16 dcid;
153 __u16 scid; 153 __le16 scid;
154} __attribute__ ((packed)); 154} __attribute__ ((packed));
155 155
156struct l2cap_disconn_rsp { 156struct l2cap_disconn_rsp {
157 __u16 dcid; 157 __le16 dcid;
158 __u16 scid; 158 __le16 scid;
159} __attribute__ ((packed)); 159} __attribute__ ((packed));
160 160
161struct l2cap_info_req { 161struct l2cap_info_req {
162 __u16 type; 162 __le16 type;
163 __u8 data[0]; 163 __u8 data[0];
164} __attribute__ ((packed)); 164} __attribute__ ((packed));
165 165
166struct l2cap_info_rsp { 166struct l2cap_info_rsp {
167 __u16 type; 167 __le16 type;
168 __u16 result; 168 __le16 result;
169 __u8 data[0]; 169 __u8 data[0];
170} __attribute__ ((packed)); 170} __attribute__ ((packed));
171 171
@@ -207,7 +207,7 @@ struct l2cap_conn {
207 207
208struct l2cap_pinfo { 208struct l2cap_pinfo {
209 struct bt_sock bt; 209 struct bt_sock bt;
210 __u16 psm; 210 __le16 psm;
211 __u16 dcid; 211 __u16 dcid;
212 __u16 scid; 212 __u16 scid;
213 213
@@ -225,7 +225,7 @@ struct l2cap_pinfo {
225 225
226 __u8 ident; 226 __u8 ident;
227 227
228 __u16 sport; 228 __le16 sport;
229 229
230 struct l2cap_conn *conn; 230 struct l2cap_conn *conn;
231 struct sock *next_c; 231 struct sock *next_c;
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 46b9dce82f6e..9059e0ed7fe3 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -17,6 +17,7 @@
17 17
18#include <linux/ipv6.h> 18#include <linux/ipv6.h>
19#include <linux/hardirq.h> 19#include <linux/hardirq.h>
20#include <net/if_inet6.h>
20#include <net/ndisc.h> 21#include <net/ndisc.h>
21#include <net/flow.h> 22#include <net/flow.h>
22#include <net/snmp.h> 23#include <net/snmp.h>
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
index 5a8965904377..070d12cb4634 100644
--- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
@@ -7,9 +7,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
7extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6; 7extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
8extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6; 8extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
9 9
10extern int nf_ct_ipv6_skip_exthdr(const struct sk_buff *skb, int start,
11 u8 *nexthdrp, int len);
12
13extern int nf_ct_frag6_init(void); 10extern int nf_ct_frag6_init(void);
14extern void nf_ct_frag6_cleanup(void); 11extern void nf_ct_frag6_cleanup(void);
15extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb); 12extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 8b404b1ef7c8..c209361ab74a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -660,7 +660,7 @@ struct tcp_congestion_ops {
660 /* new value of cwnd after loss (optional) */ 660 /* new value of cwnd after loss (optional) */
661 u32 (*undo_cwnd)(struct sock *sk); 661 u32 (*undo_cwnd)(struct sock *sk);
662 /* hook for packet ack accounting (optional) */ 662 /* hook for packet ack accounting (optional) */
663 void (*pkts_acked)(struct sock *sk, u32 num_acked, ktime_t last); 663 void (*pkts_acked)(struct sock *sk, u32 num_acked, s32 rtt_us);
664 /* get info for inet_diag (optional) */ 664 /* get info for inet_diag (optional) */
665 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); 665 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);
666 666
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 4d2aa4dd42ac..4bab322c9f8f 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -668,9 +668,6 @@ int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
668 if (real_dev->do_ioctl && netif_device_present(real_dev)) 668 if (real_dev->do_ioctl && netif_device_present(real_dev))
669 err = real_dev->do_ioctl(real_dev, &ifrr, cmd); 669 err = real_dev->do_ioctl(real_dev, &ifrr, cmd);
670 break; 670 break;
671
672 case SIOCETHTOOL:
673 err = dev_ethtool(&ifrr);
674 } 671 }
675 672
676 if (!err) 673 if (!err)
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 670ff95ca64b..c4e4ce4ebb2b 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -353,7 +353,7 @@ static inline int l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16
353} 353}
354 354
355/* ---- Socket interface ---- */ 355/* ---- Socket interface ---- */
356static struct sock *__l2cap_get_sock_by_addr(u16 psm, bdaddr_t *src) 356static struct sock *__l2cap_get_sock_by_addr(__le16 psm, bdaddr_t *src)
357{ 357{
358 struct sock *sk; 358 struct sock *sk;
359 struct hlist_node *node; 359 struct hlist_node *node;
@@ -368,7 +368,7 @@ found:
368/* Find socket with psm and source bdaddr. 368/* Find socket with psm and source bdaddr.
369 * Returns closest match. 369 * Returns closest match.
370 */ 370 */
371static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src) 371static struct sock *__l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
372{ 372{
373 struct sock *sk = NULL, *sk1 = NULL; 373 struct sock *sk = NULL, *sk1 = NULL;
374 struct hlist_node *node; 374 struct hlist_node *node;
@@ -392,7 +392,7 @@ static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src)
392 392
393/* Find socket with given address (psm, src). 393/* Find socket with given address (psm, src).
394 * Returns locked socket */ 394 * Returns locked socket */
395static inline struct sock *l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src) 395static inline struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
396{ 396{
397 struct sock *s; 397 struct sock *s;
398 read_lock(&l2cap_sk_list.lock); 398 read_lock(&l2cap_sk_list.lock);
@@ -586,7 +586,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_
586 goto done; 586 goto done;
587 } 587 }
588 588
589 if (la->l2_psm > 0 && btohs(la->l2_psm) < 0x1001 && 589 if (la->l2_psm && btohs(la->l2_psm) < 0x1001 &&
590 !capable(CAP_NET_BIND_SERVICE)) { 590 !capable(CAP_NET_BIND_SERVICE)) {
591 err = -EACCES; 591 err = -EACCES;
592 goto done; 592 goto done;
@@ -748,7 +748,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
748 write_lock_bh(&l2cap_sk_list.lock); 748 write_lock_bh(&l2cap_sk_list.lock);
749 749
750 for (psm = 0x1001; psm < 0x1100; psm += 2) 750 for (psm = 0x1001; psm < 0x1100; psm += 2)
751 if (!__l2cap_get_sock_by_addr(psm, src)) { 751 if (!__l2cap_get_sock_by_addr(htobs(psm), src)) {
752 l2cap_pi(sk)->psm = htobs(psm); 752 l2cap_pi(sk)->psm = htobs(psm);
753 l2cap_pi(sk)->sport = htobs(psm); 753 l2cap_pi(sk)->sport = htobs(psm);
754 err = 0; 754 err = 0;
@@ -873,7 +873,7 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len)
873 lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); 873 lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE));
874 874
875 if (sk->sk_type == SOCK_DGRAM) 875 if (sk->sk_type == SOCK_DGRAM)
876 put_unaligned(l2cap_pi(sk)->psm, (u16 *) skb_put(skb, 2)); 876 put_unaligned(l2cap_pi(sk)->psm, (__le16 *) skb_put(skb, 2));
877 877
878 if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) { 878 if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) {
879 err = -EFAULT; 879 err = -EFAULT;
@@ -1256,11 +1256,11 @@ static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned
1256 break; 1256 break;
1257 1257
1258 case 2: 1258 case 2:
1259 *val = __le16_to_cpu(*((u16 *)opt->val)); 1259 *val = __le16_to_cpu(*((__le16 *)opt->val));
1260 break; 1260 break;
1261 1261
1262 case 4: 1262 case 4:
1263 *val = __le32_to_cpu(*((u32 *)opt->val)); 1263 *val = __le32_to_cpu(*((__le32 *)opt->val));
1264 break; 1264 break;
1265 1265
1266 default: 1266 default:
@@ -1287,11 +1287,11 @@ static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val)
1287 break; 1287 break;
1288 1288
1289 case 2: 1289 case 2:
1290 *((u16 *) opt->val) = cpu_to_le16(val); 1290 *((__le16 *) opt->val) = cpu_to_le16(val);
1291 break; 1291 break;
1292 1292
1293 case 4: 1293 case 4:
1294 *((u32 *) opt->val) = cpu_to_le32(val); 1294 *((__le32 *) opt->val) = cpu_to_le32(val);
1295 break; 1295 break;
1296 1296
1297 default: 1297 default:
@@ -1406,7 +1406,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
1406 int result = 0, status = 0; 1406 int result = 0, status = 0;
1407 1407
1408 u16 dcid = 0, scid = __le16_to_cpu(req->scid); 1408 u16 dcid = 0, scid = __le16_to_cpu(req->scid);
1409 u16 psm = req->psm; 1409 __le16 psm = req->psm;
1410 1410
1411 BT_DBG("psm 0x%2.2x scid 0x%4.4x", psm, scid); 1411 BT_DBG("psm 0x%2.2x scid 0x%4.4x", psm, scid);
1412 1412
@@ -1530,7 +1530,7 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
1530 return 0; 1530 return 0;
1531} 1531}
1532 1532
1533static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) 1533static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data)
1534{ 1534{
1535 struct l2cap_conf_req *req = (struct l2cap_conf_req *) data; 1535 struct l2cap_conf_req *req = (struct l2cap_conf_req *) data;
1536 u16 dcid, flags; 1536 u16 dcid, flags;
@@ -1550,7 +1550,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
1550 goto unlock; 1550 goto unlock;
1551 1551
1552 /* Reject if config buffer is too small. */ 1552 /* Reject if config buffer is too small. */
1553 len = cmd->len - sizeof(*req); 1553 len = cmd_len - sizeof(*req);
1554 if (l2cap_pi(sk)->conf_len + len > sizeof(l2cap_pi(sk)->conf_req)) { 1554 if (l2cap_pi(sk)->conf_len + len > sizeof(l2cap_pi(sk)->conf_req)) {
1555 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, 1555 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
1556 l2cap_build_conf_rsp(sk, rsp, 1556 l2cap_build_conf_rsp(sk, rsp,
@@ -1748,15 +1748,16 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
1748 l2cap_raw_recv(conn, skb); 1748 l2cap_raw_recv(conn, skb);
1749 1749
1750 while (len >= L2CAP_CMD_HDR_SIZE) { 1750 while (len >= L2CAP_CMD_HDR_SIZE) {
1751 u16 cmd_len;
1751 memcpy(&cmd, data, L2CAP_CMD_HDR_SIZE); 1752 memcpy(&cmd, data, L2CAP_CMD_HDR_SIZE);
1752 data += L2CAP_CMD_HDR_SIZE; 1753 data += L2CAP_CMD_HDR_SIZE;
1753 len -= L2CAP_CMD_HDR_SIZE; 1754 len -= L2CAP_CMD_HDR_SIZE;
1754 1755
1755 cmd.len = __le16_to_cpu(cmd.len); 1756 cmd_len = le16_to_cpu(cmd.len);
1756 1757
1757 BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd.code, cmd.len, cmd.ident); 1758 BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd.code, cmd_len, cmd.ident);
1758 1759
1759 if (cmd.len > len || !cmd.ident) { 1760 if (cmd_len > len || !cmd.ident) {
1760 BT_DBG("corrupted command"); 1761 BT_DBG("corrupted command");
1761 break; 1762 break;
1762 } 1763 }
@@ -1775,7 +1776,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
1775 break; 1776 break;
1776 1777
1777 case L2CAP_CONF_REQ: 1778 case L2CAP_CONF_REQ:
1778 err = l2cap_config_req(conn, &cmd, data); 1779 err = l2cap_config_req(conn, &cmd, cmd_len, data);
1779 break; 1780 break;
1780 1781
1781 case L2CAP_CONF_RSP: 1782 case L2CAP_CONF_RSP:
@@ -1791,7 +1792,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
1791 break; 1792 break;
1792 1793
1793 case L2CAP_ECHO_REQ: 1794 case L2CAP_ECHO_REQ:
1794 l2cap_send_cmd(conn, cmd.ident, L2CAP_ECHO_RSP, cmd.len, data); 1795 l2cap_send_cmd(conn, cmd.ident, L2CAP_ECHO_RSP, cmd_len, data);
1795 break; 1796 break;
1796 1797
1797 case L2CAP_ECHO_RSP: 1798 case L2CAP_ECHO_RSP:
@@ -1820,8 +1821,8 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
1820 l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej); 1821 l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej);
1821 } 1822 }
1822 1823
1823 data += cmd.len; 1824 data += cmd_len;
1824 len -= cmd.len; 1825 len -= cmd_len;
1825 } 1826 }
1826 1827
1827 kfree_skb(skb); 1828 kfree_skb(skb);
@@ -1863,7 +1864,7 @@ done:
1863 return 0; 1864 return 0;
1864} 1865}
1865 1866
1866static inline int l2cap_conless_channel(struct l2cap_conn *conn, u16 psm, struct sk_buff *skb) 1867static inline int l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, struct sk_buff *skb)
1867{ 1868{
1868 struct sock *sk; 1869 struct sock *sk;
1869 1870
@@ -1893,7 +1894,8 @@ done:
1893static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb) 1894static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
1894{ 1895{
1895 struct l2cap_hdr *lh = (void *) skb->data; 1896 struct l2cap_hdr *lh = (void *) skb->data;
1896 u16 cid, psm, len; 1897 u16 cid, len;
1898 __le16 psm;
1897 1899
1898 skb_pull(skb, L2CAP_HDR_SIZE); 1900 skb_pull(skb, L2CAP_HDR_SIZE);
1899 cid = __le16_to_cpu(lh->cid); 1901 cid = __le16_to_cpu(lh->cid);
@@ -1907,7 +1909,7 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
1907 break; 1909 break;
1908 1910
1909 case 0x0002: 1911 case 0x0002:
1910 psm = get_unaligned((u16 *) skb->data); 1912 psm = get_unaligned((__le16 *) skb->data);
1911 skb_pull(skb, 2); 1913 skb_pull(skb, 2);
1912 l2cap_conless_channel(conn, psm, skb); 1914 l2cap_conless_channel(conn, psm, skb);
1913 break; 1915 break;
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 23ba61a13bdd..22a832098d44 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -267,7 +267,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
267out: 267out:
268 write_unlock_bh(&rfcomm_dev_lock); 268 write_unlock_bh(&rfcomm_dev_lock);
269 269
270 if (err) { 270 if (err < 0) {
271 kfree(dev); 271 kfree(dev);
272 return err; 272 return err;
273 } 273 }
@@ -275,9 +275,10 @@ out:
275 dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL); 275 dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL);
276 276
277 if (IS_ERR(dev->tty_dev)) { 277 if (IS_ERR(dev->tty_dev)) {
278 err = PTR_ERR(dev->tty_dev);
278 list_del(&dev->list); 279 list_del(&dev->list);
279 kfree(dev); 280 kfree(dev);
280 return PTR_ERR(dev->tty_dev); 281 return err;
281 } 282 }
282 283
283 return dev->id; 284 return dev->id;
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 7b4ce9113be2..b40dada002bf 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -29,35 +29,24 @@
29 * Determine initial path cost based on speed. 29 * Determine initial path cost based on speed.
30 * using recommendations from 802.1d standard 30 * using recommendations from 802.1d standard
31 * 31 *
32 * Need to simulate user ioctl because not all device's that support 32 * Since driver might sleep need to not be holding any locks.
33 * ethtool, use ethtool_ops. Also, since driver might sleep need to
34 * not be holding any locks.
35 */ 33 */
36static int port_cost(struct net_device *dev) 34static int port_cost(struct net_device *dev)
37{ 35{
38 struct ethtool_cmd ecmd = { ETHTOOL_GSET }; 36 if (dev->ethtool_ops->get_settings) {
39 struct ifreq ifr; 37 struct ethtool_cmd ecmd = { ETHTOOL_GSET };
40 mm_segment_t old_fs; 38 int err = dev->ethtool_ops->get_settings(dev, &ecmd);
41 int err; 39 if (!err) {
42 40 switch(ecmd.speed) {
43 strncpy(ifr.ifr_name, dev->name, IFNAMSIZ); 41 case SPEED_100:
44 ifr.ifr_data = (void __user *) &ecmd; 42 return 19;
45 43 case SPEED_1000:
46 old_fs = get_fs(); 44 return 4;
47 set_fs(KERNEL_DS); 45 case SPEED_10000:
48 err = dev_ethtool(&ifr); 46 return 2;
49 set_fs(old_fs); 47 case SPEED_10:
50 48 return 100;
51 if (!err) { 49 }
52 switch(ecmd.speed) {
53 case SPEED_100:
54 return 19;
55 case SPEED_1000:
56 return 4;
57 case SPEED_10000:
58 return 2;
59 case SPEED_10:
60 return 100;
61 } 50 }
62 } 51 }
63 52
diff --git a/net/core/dev.c b/net/core/dev.c
index ee4035571c21..6cc8a70350ac 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -817,7 +817,9 @@ int dev_alloc_name(struct net_device *dev, const char *name)
817 */ 817 */
818int dev_change_name(struct net_device *dev, char *newname) 818int dev_change_name(struct net_device *dev, char *newname)
819{ 819{
820 char oldname[IFNAMSIZ];
820 int err = 0; 821 int err = 0;
822 int ret;
821 823
822 ASSERT_RTNL(); 824 ASSERT_RTNL();
823 825
@@ -827,6 +829,8 @@ int dev_change_name(struct net_device *dev, char *newname)
827 if (!dev_valid_name(newname)) 829 if (!dev_valid_name(newname))
828 return -EINVAL; 830 return -EINVAL;
829 831
832 memcpy(oldname, dev->name, IFNAMSIZ);
833
830 if (strchr(newname, '%')) { 834 if (strchr(newname, '%')) {
831 err = dev_alloc_name(dev, newname); 835 err = dev_alloc_name(dev, newname);
832 if (err < 0) 836 if (err < 0)
@@ -838,10 +842,28 @@ int dev_change_name(struct net_device *dev, char *newname)
838 else 842 else
839 strlcpy(dev->name, newname, IFNAMSIZ); 843 strlcpy(dev->name, newname, IFNAMSIZ);
840 844
845rollback:
841 device_rename(&dev->dev, dev->name); 846 device_rename(&dev->dev, dev->name);
847
848 write_lock_bh(&dev_base_lock);
842 hlist_del(&dev->name_hlist); 849 hlist_del(&dev->name_hlist);
843 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); 850 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
844 raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); 851 write_unlock_bh(&dev_base_lock);
852
853 ret = raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
854 ret = notifier_to_errno(ret);
855
856 if (ret) {
857 if (err) {
858 printk(KERN_ERR
859 "%s: name change rollback failed: %d.\n",
860 dev->name, ret);
861 } else {
862 err = ret;
863 memcpy(dev->name, oldname, IFNAMSIZ);
864 goto rollback;
865 }
866 }
845 867
846 return err; 868 return err;
847} 869}
@@ -1054,20 +1076,43 @@ int dev_close(struct net_device *dev)
1054int register_netdevice_notifier(struct notifier_block *nb) 1076int register_netdevice_notifier(struct notifier_block *nb)
1055{ 1077{
1056 struct net_device *dev; 1078 struct net_device *dev;
1079 struct net_device *last;
1057 int err; 1080 int err;
1058 1081
1059 rtnl_lock(); 1082 rtnl_lock();
1060 err = raw_notifier_chain_register(&netdev_chain, nb); 1083 err = raw_notifier_chain_register(&netdev_chain, nb);
1061 if (!err) { 1084 if (err)
1062 for_each_netdev(dev) { 1085 goto unlock;
1063 nb->notifier_call(nb, NETDEV_REGISTER, dev);
1064 1086
1065 if (dev->flags & IFF_UP) 1087 for_each_netdev(dev) {
1066 nb->notifier_call(nb, NETDEV_UP, dev); 1088 err = nb->notifier_call(nb, NETDEV_REGISTER, dev);
1067 } 1089 err = notifier_to_errno(err);
1090 if (err)
1091 goto rollback;
1092
1093 if (!(dev->flags & IFF_UP))
1094 continue;
1095
1096 nb->notifier_call(nb, NETDEV_UP, dev);
1068 } 1097 }
1098
1099unlock:
1069 rtnl_unlock(); 1100 rtnl_unlock();
1070 return err; 1101 return err;
1102
1103rollback:
1104 last = dev;
1105 for_each_netdev(dev) {
1106 if (dev == last)
1107 break;
1108
1109 if (dev->flags & IFF_UP) {
1110 nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
1111 nb->notifier_call(nb, NETDEV_DOWN, dev);
1112 }
1113 nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
1114 }
1115 goto unlock;
1071} 1116}
1072 1117
1073/** 1118/**
@@ -2718,9 +2763,11 @@ int __dev_addr_add(struct dev_addr_list **list, int *count,
2718/** 2763/**
2719 * dev_unicast_delete - Release secondary unicast address. 2764 * dev_unicast_delete - Release secondary unicast address.
2720 * @dev: device 2765 * @dev: device
2766 * @addr: address to delete
2767 * @alen: length of @addr
2721 * 2768 *
2722 * Release reference to a secondary unicast address and remove it 2769 * Release reference to a secondary unicast address and remove it
2723 * from the device if the reference count drop to zero. 2770 * from the device if the reference count drops to zero.
2724 * 2771 *
2725 * The caller must hold the rtnl_mutex. 2772 * The caller must hold the rtnl_mutex.
2726 */ 2773 */
@@ -2742,6 +2789,8 @@ EXPORT_SYMBOL(dev_unicast_delete);
2742/** 2789/**
2743 * dev_unicast_add - add a secondary unicast address 2790 * dev_unicast_add - add a secondary unicast address
2744 * @dev: device 2791 * @dev: device
2792 * @addr: address to delete
2793 * @alen: length of @addr
2745 * 2794 *
2746 * Add a secondary unicast address to the device or increase 2795 * Add a secondary unicast address to the device or increase
2747 * the reference count if it already exists. 2796 * the reference count if it already exists.
@@ -3333,7 +3382,7 @@ int register_netdevice(struct net_device *dev)
3333 3382
3334 if (!dev_valid_name(dev->name)) { 3383 if (!dev_valid_name(dev->name)) {
3335 ret = -EINVAL; 3384 ret = -EINVAL;
3336 goto out; 3385 goto err_uninit;
3337 } 3386 }
3338 3387
3339 dev->ifindex = dev_new_index(); 3388 dev->ifindex = dev_new_index();
@@ -3347,7 +3396,7 @@ int register_netdevice(struct net_device *dev)
3347 = hlist_entry(p, struct net_device, name_hlist); 3396 = hlist_entry(p, struct net_device, name_hlist);
3348 if (!strncmp(d->name, dev->name, IFNAMSIZ)) { 3397 if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
3349 ret = -EEXIST; 3398 ret = -EEXIST;
3350 goto out; 3399 goto err_uninit;
3351 } 3400 }
3352 } 3401 }
3353 3402
@@ -3407,7 +3456,7 @@ int register_netdevice(struct net_device *dev)
3407 3456
3408 ret = netdev_register_sysfs(dev); 3457 ret = netdev_register_sysfs(dev);
3409 if (ret) 3458 if (ret)
3410 goto out; 3459 goto err_uninit;
3411 dev->reg_state = NETREG_REGISTERED; 3460 dev->reg_state = NETREG_REGISTERED;
3412 3461
3413 /* 3462 /*
@@ -3426,12 +3475,18 @@ int register_netdevice(struct net_device *dev)
3426 write_unlock_bh(&dev_base_lock); 3475 write_unlock_bh(&dev_base_lock);
3427 3476
3428 /* Notify protocols, that a new device appeared. */ 3477 /* Notify protocols, that a new device appeared. */
3429 raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev); 3478 ret = raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev);
3430 3479 ret = notifier_to_errno(ret);
3431 ret = 0; 3480 if (ret)
3481 unregister_netdevice(dev);
3432 3482
3433out: 3483out:
3434 return ret; 3484 return ret;
3485
3486err_uninit:
3487 if (dev->uninit)
3488 dev->uninit(dev);
3489 goto out;
3435} 3490}
3436 3491
3437/** 3492/**
@@ -3830,9 +3885,11 @@ static int dev_cpu_callback(struct notifier_block *nfb,
3830 3885
3831#ifdef CONFIG_NET_DMA 3886#ifdef CONFIG_NET_DMA
3832/** 3887/**
3833 * net_dma_rebalance - 3888 * net_dma_rebalance - try to maintain one DMA channel per CPU
3834 * This is called when the number of channels allocated to the net_dma_client 3889 * @net_dma: DMA client and associated data (lock, channels, channel_mask)
3835 * changes. The net_dma_client tries to have one DMA channel per CPU. 3890 *
3891 * This is called when the number of channels allocated to the net_dma client
3892 * changes. The net_dma client tries to have one DMA channel per CPU.
3836 */ 3893 */
3837 3894
3838static void net_dma_rebalance(struct net_dma *net_dma) 3895static void net_dma_rebalance(struct net_dma *net_dma)
@@ -3869,7 +3926,7 @@ static void net_dma_rebalance(struct net_dma *net_dma)
3869 * netdev_dma_event - event callback for the net_dma_client 3926 * netdev_dma_event - event callback for the net_dma_client
3870 * @client: should always be net_dma_client 3927 * @client: should always be net_dma_client
3871 * @chan: DMA channel for the event 3928 * @chan: DMA channel for the event
3872 * @event: event type 3929 * @state: DMA state to be handled
3873 */ 3930 */
3874static enum dma_state_client 3931static enum dma_state_client
3875netdev_dma_event(struct dma_client *client, struct dma_chan *chan, 3932netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 0b531e98ec33..2ab0a60046a5 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -3,10 +3,12 @@
3 * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx> 3 * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
4 * 4 *
5 * This file is where we call all the ethtool_ops commands to get 5 * This file is where we call all the ethtool_ops commands to get
6 * the information ethtool needs. We fall back to calling do_ioctl() 6 * the information ethtool needs.
7 * for drivers which haven't been converted to ethtool_ops yet.
8 * 7 *
9 * It's GPL, stupid. 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
10 */ 12 */
11 13
12#include <linux/module.h> 14#include <linux/module.h>
@@ -93,18 +95,6 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data)
93 return 0; 95 return 0;
94} 96}
95 97
96int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *addr, u8 *data)
97{
98 unsigned char len = dev->addr_len;
99 if ( addr->size < len )
100 return -ETOOSMALL;
101
102 addr->size = len;
103 memcpy(data, dev->perm_addr, len);
104 return 0;
105}
106
107
108u32 ethtool_op_get_ufo(struct net_device *dev) 98u32 ethtool_op_get_ufo(struct net_device *dev)
109{ 99{
110 return (dev->features & NETIF_F_UFO) != 0; 100 return (dev->features & NETIF_F_UFO) != 0;
@@ -777,34 +767,20 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr)
777static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr) 767static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr)
778{ 768{
779 struct ethtool_perm_addr epaddr; 769 struct ethtool_perm_addr epaddr;
780 u8 *data;
781 int ret;
782
783 if (!dev->ethtool_ops->get_perm_addr)
784 return -EOPNOTSUPP;
785 770
786 if (copy_from_user(&epaddr,useraddr,sizeof(epaddr))) 771 if (copy_from_user(&epaddr, useraddr, sizeof(epaddr)))
787 return -EFAULT; 772 return -EFAULT;
788 773
789 data = kmalloc(epaddr.size, GFP_USER); 774 if (epaddr.size < dev->addr_len)
790 if (!data) 775 return -ETOOSMALL;
791 return -ENOMEM; 776 epaddr.size = dev->addr_len;
792
793 ret = dev->ethtool_ops->get_perm_addr(dev,&epaddr,data);
794 if (ret)
795 return ret;
796 777
797 ret = -EFAULT;
798 if (copy_to_user(useraddr, &epaddr, sizeof(epaddr))) 778 if (copy_to_user(useraddr, &epaddr, sizeof(epaddr)))
799 goto out; 779 return -EFAULT;
800 useraddr += sizeof(epaddr); 780 useraddr += sizeof(epaddr);
801 if (copy_to_user(useraddr, data, epaddr.size)) 781 if (copy_to_user(useraddr, dev->perm_addr, epaddr.size))
802 goto out; 782 return -EFAULT;
803 ret = 0; 783 return 0;
804
805 out:
806 kfree(data);
807 return ret;
808} 784}
809 785
810/* The main entry point in this file. Called from net/core/dev.c */ 786/* The main entry point in this file. Called from net/core/dev.c */
@@ -821,7 +797,7 @@ int dev_ethtool(struct ifreq *ifr)
821 return -ENODEV; 797 return -ENODEV;
822 798
823 if (!dev->ethtool_ops) 799 if (!dev->ethtool_ops)
824 goto ioctl; 800 return -EOPNOTSUPP;
825 801
826 if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd))) 802 if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
827 return -EFAULT; 803 return -EFAULT;
@@ -960,7 +936,7 @@ int dev_ethtool(struct ifreq *ifr)
960 rc = ethtool_set_gso(dev, useraddr); 936 rc = ethtool_set_gso(dev, useraddr);
961 break; 937 break;
962 default: 938 default:
963 rc = -EOPNOTSUPP; 939 rc = -EOPNOTSUPP;
964 } 940 }
965 941
966 if (dev->ethtool_ops->complete) 942 if (dev->ethtool_ops->complete)
@@ -970,20 +946,10 @@ int dev_ethtool(struct ifreq *ifr)
970 netdev_features_change(dev); 946 netdev_features_change(dev);
971 947
972 return rc; 948 return rc;
973
974 ioctl:
975 /* Keep existing behaviour for the moment. */
976 if (!capable(CAP_NET_ADMIN))
977 return -EPERM;
978
979 if (dev->do_ioctl)
980 return dev->do_ioctl(dev, ifr, SIOCETHTOOL);
981 return -EOPNOTSUPP;
982} 949}
983 950
984EXPORT_SYMBOL(dev_ethtool); 951EXPORT_SYMBOL(dev_ethtool);
985EXPORT_SYMBOL(ethtool_op_get_link); 952EXPORT_SYMBOL(ethtool_op_get_link);
986EXPORT_SYMBOL_GPL(ethtool_op_get_perm_addr);
987EXPORT_SYMBOL(ethtool_op_get_sg); 953EXPORT_SYMBOL(ethtool_op_get_sg);
988EXPORT_SYMBOL(ethtool_op_get_tso); 954EXPORT_SYMBOL(ethtool_op_get_tso);
989EXPORT_SYMBOL(ethtool_op_get_tx_csum); 955EXPORT_SYMBOL(ethtool_op_get_tx_csum);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index bca787fdbc51..7bae576ac115 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -567,7 +567,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user * buf,
567 pktgen_run_all_threads(); 567 pktgen_run_all_threads();
568 568
569 else 569 else
570 printk("pktgen: Unknown command: %s\n", data); 570 printk(KERN_WARNING "pktgen: Unknown command: %s\n", data);
571 571
572 err = count; 572 err = count;
573 573
@@ -908,14 +908,14 @@ static ssize_t pktgen_if_write(struct file *file,
908 pg_result = &(pkt_dev->result[0]); 908 pg_result = &(pkt_dev->result[0]);
909 909
910 if (count < 1) { 910 if (count < 1) {
911 printk("pktgen: wrong command format\n"); 911 printk(KERN_WARNING "pktgen: wrong command format\n");
912 return -EINVAL; 912 return -EINVAL;
913 } 913 }
914 914
915 max = count - i; 915 max = count - i;
916 tmp = count_trail_chars(&user_buffer[i], max); 916 tmp = count_trail_chars(&user_buffer[i], max);
917 if (tmp < 0) { 917 if (tmp < 0) {
918 printk("pktgen: illegal format\n"); 918 printk(KERN_WARNING "pktgen: illegal format\n");
919 return tmp; 919 return tmp;
920 } 920 }
921 i += tmp; 921 i += tmp;
@@ -943,7 +943,7 @@ static ssize_t pktgen_if_write(struct file *file,
943 if (copy_from_user(tb, user_buffer, count)) 943 if (copy_from_user(tb, user_buffer, count))
944 return -EFAULT; 944 return -EFAULT;
945 tb[count] = 0; 945 tb[count] = 0;
946 printk("pktgen: %s,%lu buffer -:%s:-\n", name, 946 printk(KERN_DEBUG "pktgen: %s,%lu buffer -:%s:-\n", name,
947 (unsigned long)count, tb); 947 (unsigned long)count, tb);
948 } 948 }
949 949
@@ -1248,7 +1248,7 @@ static ssize_t pktgen_if_write(struct file *file,
1248 pkt_dev->cur_daddr = pkt_dev->daddr_min; 1248 pkt_dev->cur_daddr = pkt_dev->daddr_min;
1249 } 1249 }
1250 if (debug) 1250 if (debug)
1251 printk("pktgen: dst_min set to: %s\n", 1251 printk(KERN_DEBUG "pktgen: dst_min set to: %s\n",
1252 pkt_dev->dst_min); 1252 pkt_dev->dst_min);
1253 i += len; 1253 i += len;
1254 sprintf(pg_result, "OK: dst_min=%s", pkt_dev->dst_min); 1254 sprintf(pg_result, "OK: dst_min=%s", pkt_dev->dst_min);
@@ -1271,7 +1271,7 @@ static ssize_t pktgen_if_write(struct file *file,
1271 pkt_dev->cur_daddr = pkt_dev->daddr_max; 1271 pkt_dev->cur_daddr = pkt_dev->daddr_max;
1272 } 1272 }
1273 if (debug) 1273 if (debug)
1274 printk("pktgen: dst_max set to: %s\n", 1274 printk(KERN_DEBUG "pktgen: dst_max set to: %s\n",
1275 pkt_dev->dst_max); 1275 pkt_dev->dst_max);
1276 i += len; 1276 i += len;
1277 sprintf(pg_result, "OK: dst_max=%s", pkt_dev->dst_max); 1277 sprintf(pg_result, "OK: dst_max=%s", pkt_dev->dst_max);
@@ -1294,7 +1294,7 @@ static ssize_t pktgen_if_write(struct file *file,
1294 ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr); 1294 ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr);
1295 1295
1296 if (debug) 1296 if (debug)
1297 printk("pktgen: dst6 set to: %s\n", buf); 1297 printk(KERN_DEBUG "pktgen: dst6 set to: %s\n", buf);
1298 1298
1299 i += len; 1299 i += len;
1300 sprintf(pg_result, "OK: dst6=%s", buf); 1300 sprintf(pg_result, "OK: dst6=%s", buf);
@@ -1317,7 +1317,7 @@ static ssize_t pktgen_if_write(struct file *file,
1317 ipv6_addr_copy(&pkt_dev->cur_in6_daddr, 1317 ipv6_addr_copy(&pkt_dev->cur_in6_daddr,
1318 &pkt_dev->min_in6_daddr); 1318 &pkt_dev->min_in6_daddr);
1319 if (debug) 1319 if (debug)
1320 printk("pktgen: dst6_min set to: %s\n", buf); 1320 printk(KERN_DEBUG "pktgen: dst6_min set to: %s\n", buf);
1321 1321
1322 i += len; 1322 i += len;
1323 sprintf(pg_result, "OK: dst6_min=%s", buf); 1323 sprintf(pg_result, "OK: dst6_min=%s", buf);
@@ -1338,7 +1338,7 @@ static ssize_t pktgen_if_write(struct file *file,
1338 fmt_ip6(buf, pkt_dev->max_in6_daddr.s6_addr); 1338 fmt_ip6(buf, pkt_dev->max_in6_daddr.s6_addr);
1339 1339
1340 if (debug) 1340 if (debug)
1341 printk("pktgen: dst6_max set to: %s\n", buf); 1341 printk(KERN_DEBUG "pktgen: dst6_max set to: %s\n", buf);
1342 1342
1343 i += len; 1343 i += len;
1344 sprintf(pg_result, "OK: dst6_max=%s", buf); 1344 sprintf(pg_result, "OK: dst6_max=%s", buf);
@@ -1361,7 +1361,7 @@ static ssize_t pktgen_if_write(struct file *file,
1361 ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr); 1361 ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr);
1362 1362
1363 if (debug) 1363 if (debug)
1364 printk("pktgen: src6 set to: %s\n", buf); 1364 printk(KERN_DEBUG "pktgen: src6 set to: %s\n", buf);
1365 1365
1366 i += len; 1366 i += len;
1367 sprintf(pg_result, "OK: src6=%s", buf); 1367 sprintf(pg_result, "OK: src6=%s", buf);
@@ -1382,7 +1382,7 @@ static ssize_t pktgen_if_write(struct file *file,
1382 pkt_dev->cur_saddr = pkt_dev->saddr_min; 1382 pkt_dev->cur_saddr = pkt_dev->saddr_min;
1383 } 1383 }
1384 if (debug) 1384 if (debug)
1385 printk("pktgen: src_min set to: %s\n", 1385 printk(KERN_DEBUG "pktgen: src_min set to: %s\n",
1386 pkt_dev->src_min); 1386 pkt_dev->src_min);
1387 i += len; 1387 i += len;
1388 sprintf(pg_result, "OK: src_min=%s", pkt_dev->src_min); 1388 sprintf(pg_result, "OK: src_min=%s", pkt_dev->src_min);
@@ -1403,7 +1403,7 @@ static ssize_t pktgen_if_write(struct file *file,
1403 pkt_dev->cur_saddr = pkt_dev->saddr_max; 1403 pkt_dev->cur_saddr = pkt_dev->saddr_max;
1404 } 1404 }
1405 if (debug) 1405 if (debug)
1406 printk("pktgen: src_max set to: %s\n", 1406 printk(KERN_DEBUG "pktgen: src_max set to: %s\n",
1407 pkt_dev->src_max); 1407 pkt_dev->src_max);
1408 i += len; 1408 i += len;
1409 sprintf(pg_result, "OK: src_max=%s", pkt_dev->src_max); 1409 sprintf(pg_result, "OK: src_max=%s", pkt_dev->src_max);
@@ -1533,7 +1533,7 @@ static ssize_t pktgen_if_write(struct file *file,
1533 pkt_dev->svlan_id = 0xffff; 1533 pkt_dev->svlan_id = 0xffff;
1534 1534
1535 if (debug) 1535 if (debug)
1536 printk("pktgen: VLAN/SVLAN auto turned off\n"); 1536 printk(KERN_DEBUG "pktgen: VLAN/SVLAN auto turned off\n");
1537 } 1537 }
1538 return count; 1538 return count;
1539 } 1539 }
@@ -1548,10 +1548,10 @@ static ssize_t pktgen_if_write(struct file *file,
1548 pkt_dev->vlan_id = value; /* turn on VLAN */ 1548 pkt_dev->vlan_id = value; /* turn on VLAN */
1549 1549
1550 if (debug) 1550 if (debug)
1551 printk("pktgen: VLAN turned on\n"); 1551 printk(KERN_DEBUG "pktgen: VLAN turned on\n");
1552 1552
1553 if (debug && pkt_dev->nr_labels) 1553 if (debug && pkt_dev->nr_labels)
1554 printk("pktgen: MPLS auto turned off\n"); 1554 printk(KERN_DEBUG "pktgen: MPLS auto turned off\n");
1555 1555
1556 pkt_dev->nr_labels = 0; /* turn off MPLS */ 1556 pkt_dev->nr_labels = 0; /* turn off MPLS */
1557 sprintf(pg_result, "OK: vlan_id=%u", pkt_dev->vlan_id); 1557 sprintf(pg_result, "OK: vlan_id=%u", pkt_dev->vlan_id);
@@ -1560,7 +1560,7 @@ static ssize_t pktgen_if_write(struct file *file,
1560 pkt_dev->svlan_id = 0xffff; 1560 pkt_dev->svlan_id = 0xffff;
1561 1561
1562 if (debug) 1562 if (debug)
1563 printk("pktgen: VLAN/SVLAN turned off\n"); 1563 printk(KERN_DEBUG "pktgen: VLAN/SVLAN turned off\n");
1564 } 1564 }
1565 return count; 1565 return count;
1566 } 1566 }
@@ -1605,10 +1605,10 @@ static ssize_t pktgen_if_write(struct file *file,
1605 pkt_dev->svlan_id = value; /* turn on SVLAN */ 1605 pkt_dev->svlan_id = value; /* turn on SVLAN */
1606 1606
1607 if (debug) 1607 if (debug)
1608 printk("pktgen: SVLAN turned on\n"); 1608 printk(KERN_DEBUG "pktgen: SVLAN turned on\n");
1609 1609
1610 if (debug && pkt_dev->nr_labels) 1610 if (debug && pkt_dev->nr_labels)
1611 printk("pktgen: MPLS auto turned off\n"); 1611 printk(KERN_DEBUG "pktgen: MPLS auto turned off\n");
1612 1612
1613 pkt_dev->nr_labels = 0; /* turn off MPLS */ 1613 pkt_dev->nr_labels = 0; /* turn off MPLS */
1614 sprintf(pg_result, "OK: svlan_id=%u", pkt_dev->svlan_id); 1614 sprintf(pg_result, "OK: svlan_id=%u", pkt_dev->svlan_id);
@@ -1617,7 +1617,7 @@ static ssize_t pktgen_if_write(struct file *file,
1617 pkt_dev->svlan_id = 0xffff; 1617 pkt_dev->svlan_id = 0xffff;
1618 1618
1619 if (debug) 1619 if (debug)
1620 printk("pktgen: VLAN/SVLAN turned off\n"); 1620 printk(KERN_DEBUG "pktgen: VLAN/SVLAN turned off\n");
1621 } 1621 }
1622 return count; 1622 return count;
1623 } 1623 }
@@ -1777,10 +1777,11 @@ static ssize_t pktgen_thread_write(struct file *file,
1777 i += len; 1777 i += len;
1778 1778
1779 if (debug) 1779 if (debug)
1780 printk("pktgen: t=%s, count=%lu\n", name, (unsigned long)count); 1780 printk(KERN_DEBUG "pktgen: t=%s, count=%lu\n",
1781 name, (unsigned long)count);
1781 1782
1782 if (!t) { 1783 if (!t) {
1783 printk("pktgen: ERROR: No thread\n"); 1784 printk(KERN_ERR "pktgen: ERROR: No thread\n");
1784 ret = -EINVAL; 1785 ret = -EINVAL;
1785 goto out; 1786 goto out;
1786 } 1787 }
@@ -1891,8 +1892,8 @@ static void pktgen_mark_device(const char *ifname)
1891 mutex_lock(&pktgen_thread_lock); 1892 mutex_lock(&pktgen_thread_lock);
1892 1893
1893 if (++i >= max_tries) { 1894 if (++i >= max_tries) {
1894 printk("pktgen_mark_device: timed out after waiting " 1895 printk(KERN_ERR "pktgen_mark_device: timed out after "
1895 "%d msec for device %s to be removed\n", 1896 "waiting %d msec for device %s to be removed\n",
1896 msec_per_try * i, ifname); 1897 msec_per_try * i, ifname);
1897 break; 1898 break;
1898 } 1899 }
@@ -1962,15 +1963,15 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname)
1962 1963
1963 odev = dev_get_by_name(ifname); 1964 odev = dev_get_by_name(ifname);
1964 if (!odev) { 1965 if (!odev) {
1965 printk("pktgen: no such netdevice: \"%s\"\n", ifname); 1966 printk(KERN_ERR "pktgen: no such netdevice: \"%s\"\n", ifname);
1966 return -ENODEV; 1967 return -ENODEV;
1967 } 1968 }
1968 1969
1969 if (odev->type != ARPHRD_ETHER) { 1970 if (odev->type != ARPHRD_ETHER) {
1970 printk("pktgen: not an ethernet device: \"%s\"\n", ifname); 1971 printk(KERN_ERR "pktgen: not an ethernet device: \"%s\"\n", ifname);
1971 err = -EINVAL; 1972 err = -EINVAL;
1972 } else if (!netif_running(odev)) { 1973 } else if (!netif_running(odev)) {
1973 printk("pktgen: device is down: \"%s\"\n", ifname); 1974 printk(KERN_ERR "pktgen: device is down: \"%s\"\n", ifname);
1974 err = -ENETDOWN; 1975 err = -ENETDOWN;
1975 } else { 1976 } else {
1976 pkt_dev->odev = odev; 1977 pkt_dev->odev = odev;
@@ -1987,7 +1988,8 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname)
1987static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) 1988static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
1988{ 1989{
1989 if (!pkt_dev->odev) { 1990 if (!pkt_dev->odev) {
1990 printk("pktgen: ERROR: pkt_dev->odev == NULL in setup_inject.\n"); 1991 printk(KERN_ERR "pktgen: ERROR: pkt_dev->odev == NULL in "
1992 "setup_inject.\n");
1991 sprintf(pkt_dev->result, 1993 sprintf(pkt_dev->result,
1992 "ERROR: pkt_dev->odev == NULL in setup_inject.\n"); 1994 "ERROR: pkt_dev->odev == NULL in setup_inject.\n");
1993 return; 1995 return;
@@ -2049,7 +2051,8 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2049 } 2051 }
2050 rcu_read_unlock(); 2052 rcu_read_unlock();
2051 if (err) 2053 if (err)
2052 printk("pktgen: ERROR: IPv6 link address not availble.\n"); 2054 printk(KERN_ERR "pktgen: ERROR: IPv6 link "
2055 "address not availble.\n");
2053 } 2056 }
2054#endif 2057#endif
2055 } else { 2058 } else {
@@ -2156,8 +2159,7 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
2156/* If there was already an IPSEC SA, we keep it as is, else 2159/* If there was already an IPSEC SA, we keep it as is, else
2157 * we go look for it ... 2160 * we go look for it ...
2158*/ 2161*/
2159inline 2162static void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow)
2160void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow)
2161{ 2163{
2162 struct xfrm_state *x = pkt_dev->flows[flow].x; 2164 struct xfrm_state *x = pkt_dev->flows[flow].x;
2163 if (!x) { 2165 if (!x) {
@@ -2441,7 +2443,8 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
2441 if (nhead >0) { 2443 if (nhead >0) {
2442 ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); 2444 ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC);
2443 if (ret < 0) { 2445 if (ret < 0) {
2444 printk("Error expanding ipsec packet %d\n",ret); 2446 printk(KERN_ERR "Error expanding "
2447 "ipsec packet %d\n",ret);
2445 return 0; 2448 return 0;
2446 } 2449 }
2447 } 2450 }
@@ -2450,7 +2453,8 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
2450 skb_pull(skb, ETH_HLEN); 2453 skb_pull(skb, ETH_HLEN);
2451 ret = pktgen_output_ipsec(skb, pkt_dev); 2454 ret = pktgen_output_ipsec(skb, pkt_dev);
2452 if (ret) { 2455 if (ret) {
2453 printk("Error creating ipsec packet %d\n",ret); 2456 printk(KERN_ERR "Error creating ipsec "
2457 "packet %d\n",ret);
2454 kfree_skb(skb); 2458 kfree_skb(skb);
2455 return 0; 2459 return 0;
2456 } 2460 }
@@ -3184,8 +3188,8 @@ static int pktgen_stop_device(struct pktgen_dev *pkt_dev)
3184 int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1; 3188 int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1;
3185 3189
3186 if (!pkt_dev->running) { 3190 if (!pkt_dev->running) {
3187 printk("pktgen: interface: %s is already stopped\n", 3191 printk(KERN_WARNING "pktgen: interface: %s is already "
3188 pkt_dev->odev->name); 3192 "stopped\n", pkt_dev->odev->name);
3189 return -EINVAL; 3193 return -EINVAL;
3190 } 3194 }
3191 3195
@@ -3360,7 +3364,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
3360 3364
3361 pkt_dev->skb = fill_packet(odev, pkt_dev); 3365 pkt_dev->skb = fill_packet(odev, pkt_dev);
3362 if (pkt_dev->skb == NULL) { 3366 if (pkt_dev->skb == NULL) {
3363 printk("pktgen: ERROR: couldn't allocate skb in fill_packet.\n"); 3367 printk(KERN_ERR "pktgen: ERROR: couldn't "
3368 "allocate skb in fill_packet.\n");
3364 schedule(); 3369 schedule();
3365 pkt_dev->clone_count--; /* back out increment, OOM */ 3370 pkt_dev->clone_count--; /* back out increment, OOM */
3366 goto out; 3371 goto out;
@@ -3565,7 +3570,8 @@ static int add_dev_to_thread(struct pktgen_thread *t,
3565 if_lock(t); 3570 if_lock(t);
3566 3571
3567 if (pkt_dev->pg_thread) { 3572 if (pkt_dev->pg_thread) {
3568 printk("pktgen: ERROR: already assigned to a thread.\n"); 3573 printk(KERN_ERR "pktgen: ERROR: already assigned "
3574 "to a thread.\n");
3569 rv = -EBUSY; 3575 rv = -EBUSY;
3570 goto out; 3576 goto out;
3571 } 3577 }
@@ -3590,7 +3596,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3590 3596
3591 pkt_dev = __pktgen_NN_threads(ifname, FIND); 3597 pkt_dev = __pktgen_NN_threads(ifname, FIND);
3592 if (pkt_dev) { 3598 if (pkt_dev) {
3593 printk("pktgen: ERROR: interface already used.\n"); 3599 printk(KERN_ERR "pktgen: ERROR: interface already used.\n");
3594 return -EBUSY; 3600 return -EBUSY;
3595 } 3601 }
3596 3602
@@ -3632,7 +3638,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3632 3638
3633 pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir); 3639 pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir);
3634 if (!pkt_dev->entry) { 3640 if (!pkt_dev->entry) {
3635 printk("pktgen: cannot create %s/%s procfs entry.\n", 3641 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
3636 PG_PROC_DIR, ifname); 3642 PG_PROC_DIR, ifname);
3637 err = -EINVAL; 3643 err = -EINVAL;
3638 goto out2; 3644 goto out2;
@@ -3665,7 +3671,8 @@ static int __init pktgen_create_thread(int cpu)
3665 3671
3666 t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL); 3672 t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL);
3667 if (!t) { 3673 if (!t) {
3668 printk("pktgen: ERROR: out of memory, can't create new thread.\n"); 3674 printk(KERN_ERR "pktgen: ERROR: out of memory, can't "
3675 "create new thread.\n");
3669 return -ENOMEM; 3676 return -ENOMEM;
3670 } 3677 }
3671 3678
@@ -3678,7 +3685,8 @@ static int __init pktgen_create_thread(int cpu)
3678 3685
3679 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); 3686 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu);
3680 if (IS_ERR(p)) { 3687 if (IS_ERR(p)) {
3681 printk("pktgen: kernel_thread() failed for cpu %d\n", t->cpu); 3688 printk(KERN_ERR "pktgen: kernel_thread() failed "
3689 "for cpu %d\n", t->cpu);
3682 list_del(&t->th_list); 3690 list_del(&t->th_list);
3683 kfree(t); 3691 kfree(t);
3684 return PTR_ERR(p); 3692 return PTR_ERR(p);
@@ -3688,7 +3696,7 @@ static int __init pktgen_create_thread(int cpu)
3688 3696
3689 pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir); 3697 pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir);
3690 if (!pe) { 3698 if (!pe) {
3691 printk("pktgen: cannot create %s/%s procfs entry.\n", 3699 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
3692 PG_PROC_DIR, t->tsk->comm); 3700 PG_PROC_DIR, t->tsk->comm);
3693 kthread_stop(p); 3701 kthread_stop(p);
3694 list_del(&t->th_list); 3702 list_del(&t->th_list);
@@ -3727,7 +3735,8 @@ static int pktgen_remove_device(struct pktgen_thread *t,
3727 pr_debug("pktgen: remove_device pkt_dev=%p\n", pkt_dev); 3735 pr_debug("pktgen: remove_device pkt_dev=%p\n", pkt_dev);
3728 3736
3729 if (pkt_dev->running) { 3737 if (pkt_dev->running) {
3730 printk("pktgen:WARNING: trying to remove a running interface, stopping it now.\n"); 3738 printk(KERN_WARNING "pktgen: WARNING: trying to remove a "
3739 "running interface, stopping it now.\n");
3731 pktgen_stop_device(pkt_dev); 3740 pktgen_stop_device(pkt_dev);
3732 } 3741 }
3733 3742
@@ -3759,7 +3768,7 @@ static int __init pg_init(void)
3759 int cpu; 3768 int cpu;
3760 struct proc_dir_entry *pe; 3769 struct proc_dir_entry *pe;
3761 3770
3762 printk(version); 3771 printk(KERN_INFO "%s", version);
3763 3772
3764 pg_proc_dir = proc_mkdir(PG_PROC_DIR, proc_net); 3773 pg_proc_dir = proc_mkdir(PG_PROC_DIR, proc_net);
3765 if (!pg_proc_dir) 3774 if (!pg_proc_dir)
@@ -3768,8 +3777,8 @@ static int __init pg_init(void)
3768 3777
3769 pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir); 3778 pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir);
3770 if (pe == NULL) { 3779 if (pe == NULL) {
3771 printk("pktgen: ERROR: cannot create %s procfs entry.\n", 3780 printk(KERN_ERR "pktgen: ERROR: cannot create %s "
3772 PGCTRL); 3781 "procfs entry.\n", PGCTRL);
3773 proc_net_remove(PG_PROC_DIR); 3782 proc_net_remove(PG_PROC_DIR);
3774 return -EINVAL; 3783 return -EINVAL;
3775 } 3784 }
@@ -3785,12 +3794,13 @@ static int __init pg_init(void)
3785 3794
3786 err = pktgen_create_thread(cpu); 3795 err = pktgen_create_thread(cpu);
3787 if (err) 3796 if (err)
3788 printk("pktgen: WARNING: Cannot create thread for cpu %d (%d)\n", 3797 printk(KERN_WARNING "pktgen: WARNING: Cannot create "
3789 cpu, err); 3798 "thread for cpu %d (%d)\n", cpu, err);
3790 } 3799 }
3791 3800
3792 if (list_empty(&pktgen_threads)) { 3801 if (list_empty(&pktgen_threads)) {
3793 printk("pktgen: ERROR: Initialization failed for all threads\n"); 3802 printk(KERN_ERR "pktgen: ERROR: Initialization failed for "
3803 "all threads\n");
3794 unregister_netdevice_notifier(&pktgen_notifier_block); 3804 unregister_netdevice_notifier(&pktgen_notifier_block);
3795 remove_proc_entry(PGCTRL, pg_proc_dir); 3805 remove_proc_entry(PGCTRL, pg_proc_dir);
3796 proc_net_remove(PG_PROC_DIR); 3806 proc_net_remove(PG_PROC_DIR);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 06eccca8cb5d..4756d5857abf 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -952,7 +952,9 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
952 struct nlattr *linkinfo[IFLA_INFO_MAX+1]; 952 struct nlattr *linkinfo[IFLA_INFO_MAX+1];
953 int err; 953 int err;
954 954
955#ifdef CONFIG_KMOD
955replay: 956replay:
957#endif
956 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); 958 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
957 if (err < 0) 959 if (err < 0)
958 return err; 960 return err;
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index f2a61ef2af9c..a4a620971ef0 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1737,8 +1737,9 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file)
1737{ 1737{
1738 struct seq_file *seq; 1738 struct seq_file *seq;
1739 int rc = -ENOMEM; 1739 int rc = -ENOMEM;
1740 struct dn_rt_cache_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); 1740 struct dn_rt_cache_iter_state *s;
1741 1741
1742 s = kzalloc(sizeof(*s), GFP_KERNEL);
1742 if (!s) 1743 if (!s)
1743 goto out; 1744 goto out;
1744 rc = seq_open(file, &dn_rt_cache_seq_ops); 1745 rc = seq_open(file, &dn_rt_cache_seq_ops);
@@ -1746,7 +1747,6 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file)
1746 goto out_kfree; 1747 goto out_kfree;
1747 seq = file->private_data; 1748 seq = file->private_data;
1748 seq->private = s; 1749 seq->private = s;
1749 memset(s, 0, sizeof(*s));
1750out: 1750out:
1751 return rc; 1751 return rc;
1752out_kfree: 1752out_kfree:
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index abf6352f990f..5b77bdaa57dd 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1056,10 +1056,9 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
1056 if (!in_dev) { 1056 if (!in_dev) {
1057 if (event == NETDEV_REGISTER) { 1057 if (event == NETDEV_REGISTER) {
1058 in_dev = inetdev_init(dev); 1058 in_dev = inetdev_init(dev);
1059 if (!in_dev)
1060 return notifier_from_errno(-ENOMEM);
1059 if (dev == &loopback_dev) { 1061 if (dev == &loopback_dev) {
1060 if (!in_dev)
1061 panic("devinet: "
1062 "Failed to create loopback\n");
1063 IN_DEV_CONF_SET(in_dev, NOXFRM, 1); 1062 IN_DEV_CONF_SET(in_dev, NOXFRM, 1);
1064 IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); 1063 IN_DEV_CONF_SET(in_dev, NOPOLICY, 1);
1065 } 1064 }
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index 251346828cb4..2f14745a9e1f 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -513,11 +513,8 @@ void ip_options_undo(struct ip_options * opt)
513 513
514static struct ip_options *ip_options_get_alloc(const int optlen) 514static struct ip_options *ip_options_get_alloc(const int optlen)
515{ 515{
516 struct ip_options *opt = kmalloc(sizeof(*opt) + ((optlen + 3) & ~3), 516 return kzalloc(sizeof(struct ip_options) + ((optlen + 3) & ~3),
517 GFP_KERNEL); 517 GFP_KERNEL);
518 if (opt)
519 memset(opt, 0, sizeof(*opt));
520 return opt;
521} 518}
522 519
523static int ip_options_get_finish(struct ip_options **optp, 520static int ip_options_get_finish(struct ip_options **optp,
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c
index 900ce29db382..666e080a74a3 100644
--- a/net/ipv4/ipvs/ip_vs_xmit.c
+++ b/net/ipv4/ipvs/ip_vs_xmit.c
@@ -128,7 +128,7 @@ ip_vs_dst_reset(struct ip_vs_dest *dest)
128#define IP_VS_XMIT(skb, rt) \ 128#define IP_VS_XMIT(skb, rt) \
129do { \ 129do { \
130 (skb)->ipvs_property = 1; \ 130 (skb)->ipvs_property = 1; \
131 (skb)->ip_summed = CHECKSUM_NONE; \ 131 skb_forward_csum(skb); \
132 NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL, \ 132 NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL, \
133 (rt)->u.dst.dev, dst_output); \ 133 (rt)->u.dst.dev, dst_output); \
134} while (0) 134} while (0)
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c
index 519de091a94d..4586211e3757 100644
--- a/net/ipv4/tcp_bic.c
+++ b/net/ipv4/tcp_bic.c
@@ -206,7 +206,7 @@ static void bictcp_state(struct sock *sk, u8 new_state)
206/* Track delayed acknowledgment ratio using sliding window 206/* Track delayed acknowledgment ratio using sliding window
207 * ratio = (15*ratio + sample) / 16 207 * ratio = (15*ratio + sample) / 16
208 */ 208 */
209static void bictcp_acked(struct sock *sk, u32 cnt, ktime_t last) 209static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt)
210{ 210{
211 const struct inet_connection_sock *icsk = inet_csk(sk); 211 const struct inet_connection_sock *icsk = inet_csk(sk);
212 212
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
index d17da30d82d6..485d7ea35f75 100644
--- a/net/ipv4/tcp_cubic.c
+++ b/net/ipv4/tcp_cubic.c
@@ -246,38 +246,12 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
246 ca->cnt = 1; 246 ca->cnt = 1;
247} 247}
248 248
249
250/* Keep track of minimum rtt */
251static inline void measure_delay(struct sock *sk)
252{
253 const struct tcp_sock *tp = tcp_sk(sk);
254 struct bictcp *ca = inet_csk_ca(sk);
255 u32 delay;
256
257 /* No time stamp */
258 if (!(tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) ||
259 /* Discard delay samples right after fast recovery */
260 (s32)(tcp_time_stamp - ca->epoch_start) < HZ)
261 return;
262
263 delay = (tcp_time_stamp - tp->rx_opt.rcv_tsecr)<<3;
264 if (delay == 0)
265 delay = 1;
266
267 /* first time call or link delay decreases */
268 if (ca->delay_min == 0 || ca->delay_min > delay)
269 ca->delay_min = delay;
270}
271
272static void bictcp_cong_avoid(struct sock *sk, u32 ack, 249static void bictcp_cong_avoid(struct sock *sk, u32 ack,
273 u32 in_flight, int data_acked) 250 u32 in_flight, int data_acked)
274{ 251{
275 struct tcp_sock *tp = tcp_sk(sk); 252 struct tcp_sock *tp = tcp_sk(sk);
276 struct bictcp *ca = inet_csk_ca(sk); 253 struct bictcp *ca = inet_csk_ca(sk);
277 254
278 if (data_acked)
279 measure_delay(sk);
280
281 if (!tcp_is_cwnd_limited(sk, in_flight)) 255 if (!tcp_is_cwnd_limited(sk, in_flight))
282 return; 256 return;
283 257
@@ -334,17 +308,33 @@ static void bictcp_state(struct sock *sk, u8 new_state)
334/* Track delayed acknowledgment ratio using sliding window 308/* Track delayed acknowledgment ratio using sliding window
335 * ratio = (15*ratio + sample) / 16 309 * ratio = (15*ratio + sample) / 16
336 */ 310 */
337static void bictcp_acked(struct sock *sk, u32 cnt, ktime_t last) 311static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us)
338{ 312{
339 const struct inet_connection_sock *icsk = inet_csk(sk); 313 const struct inet_connection_sock *icsk = inet_csk(sk);
314 struct bictcp *ca = inet_csk_ca(sk);
315 u32 delay;
340 316
341 if (cnt > 0 && icsk->icsk_ca_state == TCP_CA_Open) { 317 if (cnt > 0 && icsk->icsk_ca_state == TCP_CA_Open) {
342 struct bictcp *ca = inet_csk_ca(sk);
343 cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT; 318 cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT;
344 ca->delayed_ack += cnt; 319 ca->delayed_ack += cnt;
345 } 320 }
346}
347 321
322 /* Some calls are for duplicates without timetamps */
323 if (rtt_us < 0)
324 return;
325
326 /* Discard delay samples right after fast recovery */
327 if ((s32)(tcp_time_stamp - ca->epoch_start) < HZ)
328 return;
329
330 delay = usecs_to_jiffies(rtt_us) << 3;
331 if (delay == 0)
332 delay = 1;
333
334 /* first time call or link delay decreases */
335 if (ca->delay_min == 0 || ca->delay_min > delay)
336 ca->delay_min = delay;
337}
348 338
349static struct tcp_congestion_ops cubictcp = { 339static struct tcp_congestion_ops cubictcp = {
350 .init = bictcp_init, 340 .init = bictcp_init,
diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c
index 08a02e6045c9..b66556c0a5bd 100644
--- a/net/ipv4/tcp_htcp.c
+++ b/net/ipv4/tcp_htcp.c
@@ -76,12 +76,11 @@ static u32 htcp_cwnd_undo(struct sock *sk)
76 return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta); 76 return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta);
77} 77}
78 78
79static inline void measure_rtt(struct sock *sk) 79static inline void measure_rtt(struct sock *sk, u32 srtt)
80{ 80{
81 const struct inet_connection_sock *icsk = inet_csk(sk); 81 const struct inet_connection_sock *icsk = inet_csk(sk);
82 const struct tcp_sock *tp = tcp_sk(sk); 82 const struct tcp_sock *tp = tcp_sk(sk);
83 struct htcp *ca = inet_csk_ca(sk); 83 struct htcp *ca = inet_csk_ca(sk);
84 u32 srtt = tp->srtt >> 3;
85 84
86 /* keep track of minimum RTT seen so far, minRTT is zero at first */ 85 /* keep track of minimum RTT seen so far, minRTT is zero at first */
87 if (ca->minRTT > srtt || !ca->minRTT) 86 if (ca->minRTT > srtt || !ca->minRTT)
@@ -98,7 +97,7 @@ static inline void measure_rtt(struct sock *sk)
98 } 97 }
99} 98}
100 99
101static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, ktime_t last) 100static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, s32 rtt)
102{ 101{
103 const struct inet_connection_sock *icsk = inet_csk(sk); 102 const struct inet_connection_sock *icsk = inet_csk(sk);
104 const struct tcp_sock *tp = tcp_sk(sk); 103 const struct tcp_sock *tp = tcp_sk(sk);
@@ -108,6 +107,9 @@ static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, ktime_t
108 if (icsk->icsk_ca_state == TCP_CA_Open) 107 if (icsk->icsk_ca_state == TCP_CA_Open)
109 ca->pkts_acked = pkts_acked; 108 ca->pkts_acked = pkts_acked;
110 109
110 if (rtt > 0)
111 measure_rtt(sk, usecs_to_jiffies(rtt));
112
111 if (!use_bandwidth_switch) 113 if (!use_bandwidth_switch)
112 return; 114 return;
113 115
@@ -237,8 +239,6 @@ static void htcp_cong_avoid(struct sock *sk, u32 ack,
237 if (tp->snd_cwnd <= tp->snd_ssthresh) 239 if (tp->snd_cwnd <= tp->snd_ssthresh)
238 tcp_slow_start(tp); 240 tcp_slow_start(tp);
239 else { 241 else {
240 measure_rtt(sk);
241
242 /* In dangerous area, increase slowly. 242 /* In dangerous area, increase slowly.
243 * In theory this is tp->snd_cwnd += alpha / tp->snd_cwnd 243 * In theory this is tp->snd_cwnd += alpha / tp->snd_cwnd
244 */ 244 */
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index cc5de6f69d46..64f1cbaf96e8 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -83,18 +83,16 @@ static void tcp_illinois_init(struct sock *sk)
83} 83}
84 84
85/* Measure RTT for each ack. */ 85/* Measure RTT for each ack. */
86static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last) 86static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, s32 rtt)
87{ 87{
88 struct illinois *ca = inet_csk_ca(sk); 88 struct illinois *ca = inet_csk_ca(sk);
89 u32 rtt;
90 89
91 ca->acked = pkts_acked; 90 ca->acked = pkts_acked;
92 91
93 if (ktime_equal(last, net_invalid_timestamp())) 92 /* dup ack, no rtt sample */
93 if (rtt < 0)
94 return; 94 return;
95 95
96 rtt = ktime_to_us(net_timedelta(last));
97
98 /* ignore bogus values, this prevents wraparound in alpha math */ 96 /* ignore bogus values, this prevents wraparound in alpha math */
99 if (rtt > RTT_MAX) 97 if (rtt > RTT_MAX)
100 rtt = RTT_MAX; 98 rtt = RTT_MAX;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index fec8a7a4dbaf..378ca8a086a3 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1851,19 +1851,22 @@ static inline u32 tcp_cwnd_min(const struct sock *sk)
1851} 1851}
1852 1852
1853/* Decrease cwnd each second ack. */ 1853/* Decrease cwnd each second ack. */
1854static void tcp_cwnd_down(struct sock *sk) 1854static void tcp_cwnd_down(struct sock *sk, int flag)
1855{ 1855{
1856 struct tcp_sock *tp = tcp_sk(sk); 1856 struct tcp_sock *tp = tcp_sk(sk);
1857 int decr = tp->snd_cwnd_cnt + 1; 1857 int decr = tp->snd_cwnd_cnt + 1;
1858 1858
1859 tp->snd_cwnd_cnt = decr&1; 1859 if ((flag&FLAG_FORWARD_PROGRESS) ||
1860 decr >>= 1; 1860 (IsReno(tp) && !(flag&FLAG_NOT_DUP))) {
1861 tp->snd_cwnd_cnt = decr&1;
1862 decr >>= 1;
1861 1863
1862 if (decr && tp->snd_cwnd > tcp_cwnd_min(sk)) 1864 if (decr && tp->snd_cwnd > tcp_cwnd_min(sk))
1863 tp->snd_cwnd -= decr; 1865 tp->snd_cwnd -= decr;
1864 1866
1865 tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1); 1867 tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
1866 tp->snd_cwnd_stamp = tcp_time_stamp; 1868 tp->snd_cwnd_stamp = tcp_time_stamp;
1869 }
1867} 1870}
1868 1871
1869/* Nothing was retransmitted or returned timestamp is less 1872/* Nothing was retransmitted or returned timestamp is less
@@ -2060,7 +2063,7 @@ static void tcp_try_to_open(struct sock *sk, int flag)
2060 } 2063 }
2061 tcp_moderate_cwnd(tp); 2064 tcp_moderate_cwnd(tp);
2062 } else { 2065 } else {
2063 tcp_cwnd_down(sk); 2066 tcp_cwnd_down(sk, flag);
2064 } 2067 }
2065} 2068}
2066 2069
@@ -2109,7 +2112,10 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
2109{ 2112{
2110 struct inet_connection_sock *icsk = inet_csk(sk); 2113 struct inet_connection_sock *icsk = inet_csk(sk);
2111 struct tcp_sock *tp = tcp_sk(sk); 2114 struct tcp_sock *tp = tcp_sk(sk);
2112 int is_dupack = (tp->snd_una == prior_snd_una && !(flag&FLAG_NOT_DUP)); 2115 int is_dupack = (tp->snd_una == prior_snd_una &&
2116 (!(flag&FLAG_NOT_DUP) ||
2117 ((flag&FLAG_DATA_SACKED) &&
2118 (tp->fackets_out > tp->reordering))));
2113 2119
2114 /* Some technical things: 2120 /* Some technical things:
2115 * 1. Reno does not count dupacks (sacked_out) automatically. */ 2121 * 1. Reno does not count dupacks (sacked_out) automatically. */
@@ -2260,7 +2266,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
2260 2266
2261 if (is_dupack || tcp_head_timedout(sk)) 2267 if (is_dupack || tcp_head_timedout(sk))
2262 tcp_update_scoreboard(sk); 2268 tcp_update_scoreboard(sk);
2263 tcp_cwnd_down(sk); 2269 tcp_cwnd_down(sk, flag);
2264 tcp_xmit_retransmit_queue(sk); 2270 tcp_xmit_retransmit_queue(sk);
2265} 2271}
2266 2272
@@ -2490,12 +2496,23 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
2490 tcp_ack_update_rtt(sk, acked, seq_rtt); 2496 tcp_ack_update_rtt(sk, acked, seq_rtt);
2491 tcp_ack_packets_out(sk); 2497 tcp_ack_packets_out(sk);
2492 2498
2493 /* Is the ACK triggering packet unambiguous? */ 2499 if (ca_ops->pkts_acked) {
2494 if (acked & FLAG_RETRANS_DATA_ACKED) 2500 s32 rtt_us = -1;
2495 last_ackt = net_invalid_timestamp(); 2501
2502 /* Is the ACK triggering packet unambiguous? */
2503 if (!(acked & FLAG_RETRANS_DATA_ACKED)) {
2504 /* High resolution needed and available? */
2505 if (ca_ops->flags & TCP_CONG_RTT_STAMP &&
2506 !ktime_equal(last_ackt,
2507 net_invalid_timestamp()))
2508 rtt_us = ktime_us_delta(ktime_get_real(),
2509 last_ackt);
2510 else if (seq_rtt > 0)
2511 rtt_us = jiffies_to_usecs(seq_rtt);
2512 }
2496 2513
2497 if (ca_ops->pkts_acked) 2514 ca_ops->pkts_acked(sk, pkts_acked, rtt_us);
2498 ca_ops->pkts_acked(sk, pkts_acked, last_ackt); 2515 }
2499 } 2516 }
2500 2517
2501#if FASTRETRANS_DEBUG > 0 2518#if FASTRETRANS_DEBUG > 0
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
index 80e140e3ec2d..e7f5ef92cbd8 100644
--- a/net/ipv4/tcp_lp.c
+++ b/net/ipv4/tcp_lp.c
@@ -260,13 +260,13 @@ static void tcp_lp_rtt_sample(struct sock *sk, u32 rtt)
260 * newReno in increase case. 260 * newReno in increase case.
261 * We work it out by following the idea from TCP-LP's paper directly 261 * We work it out by following the idea from TCP-LP's paper directly
262 */ 262 */
263static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, ktime_t last) 263static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, s32 rtt_us)
264{ 264{
265 struct tcp_sock *tp = tcp_sk(sk); 265 struct tcp_sock *tp = tcp_sk(sk);
266 struct lp *lp = inet_csk_ca(sk); 266 struct lp *lp = inet_csk_ca(sk);
267 267
268 if (!ktime_equal(last, net_invalid_timestamp())) 268 if (rtt_us > 0)
269 tcp_lp_rtt_sample(sk, ktime_to_us(net_timedelta(last))); 269 tcp_lp_rtt_sample(sk, rtt_us);
270 270
271 /* calc inference */ 271 /* calc inference */
272 if (tcp_time_stamp > tp->rx_opt.rcv_tsecr) 272 if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index 914e0307f7af..b49dedcda52d 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -112,16 +112,16 @@ EXPORT_SYMBOL_GPL(tcp_vegas_init);
112 * o min-filter RTT samples from a much longer window (forever for now) 112 * o min-filter RTT samples from a much longer window (forever for now)
113 * to find the propagation delay (baseRTT) 113 * to find the propagation delay (baseRTT)
114 */ 114 */
115void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) 115void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us)
116{ 116{
117 struct vegas *vegas = inet_csk_ca(sk); 117 struct vegas *vegas = inet_csk_ca(sk);
118 u32 vrtt; 118 u32 vrtt;
119 119
120 if (ktime_equal(last, net_invalid_timestamp())) 120 if (rtt_us < 0)
121 return; 121 return;
122 122
123 /* Never allow zero rtt or baseRTT */ 123 /* Never allow zero rtt or baseRTT */
124 vrtt = ktime_to_us(net_timedelta(last)) + 1; 124 vrtt = rtt_us + 1;
125 125
126 /* Filter to find propagation delay: */ 126 /* Filter to find propagation delay: */
127 if (vrtt < vegas->baseRTT) 127 if (vrtt < vegas->baseRTT)
diff --git a/net/ipv4/tcp_vegas.h b/net/ipv4/tcp_vegas.h
index 502fa8183634..6c0eea2f8249 100644
--- a/net/ipv4/tcp_vegas.h
+++ b/net/ipv4/tcp_vegas.h
@@ -17,7 +17,7 @@ struct vegas {
17 17
18extern void tcp_vegas_init(struct sock *sk); 18extern void tcp_vegas_init(struct sock *sk);
19extern void tcp_vegas_state(struct sock *sk, u8 ca_state); 19extern void tcp_vegas_state(struct sock *sk, u8 ca_state);
20extern void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last); 20extern void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us);
21extern void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event); 21extern void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event);
22extern void tcp_vegas_get_info(struct sock *sk, u32 ext, struct sk_buff *skb); 22extern void tcp_vegas_get_info(struct sock *sk, u32 ext, struct sk_buff *skb);
23 23
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
index 7a55ddf86032..8fb2aee0b1a4 100644
--- a/net/ipv4/tcp_veno.c
+++ b/net/ipv4/tcp_veno.c
@@ -69,16 +69,16 @@ static void tcp_veno_init(struct sock *sk)
69} 69}
70 70
71/* Do rtt sampling needed for Veno. */ 71/* Do rtt sampling needed for Veno. */
72static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) 72static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us)
73{ 73{
74 struct veno *veno = inet_csk_ca(sk); 74 struct veno *veno = inet_csk_ca(sk);
75 u32 vrtt; 75 u32 vrtt;
76 76
77 if (ktime_equal(last, net_invalid_timestamp())) 77 if (rtt_us < 0)
78 return; 78 return;
79 79
80 /* Never allow zero rtt or baseRTT */ 80 /* Never allow zero rtt or baseRTT */
81 vrtt = ktime_to_us(net_timedelta(last)) + 1; 81 vrtt = rtt_us + 1;
82 82
83 /* Filter to find propagation delay: */ 83 /* Filter to find propagation delay: */
84 if (vrtt < veno->basertt) 84 if (vrtt < veno->basertt)
diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c
index e61e09dd513e..20151d6a6241 100644
--- a/net/ipv4/tcp_westwood.c
+++ b/net/ipv4/tcp_westwood.c
@@ -100,11 +100,12 @@ static void westwood_filter(struct westwood *w, u32 delta)
100 * Called after processing group of packets. 100 * Called after processing group of packets.
101 * but all westwood needs is the last sample of srtt. 101 * but all westwood needs is the last sample of srtt.
102 */ 102 */
103static void tcp_westwood_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) 103static void tcp_westwood_pkts_acked(struct sock *sk, u32 cnt, s32 rtt)
104{ 104{
105 struct westwood *w = inet_csk_ca(sk); 105 struct westwood *w = inet_csk_ca(sk);
106 if (cnt > 0) 106
107 w->rtt = tcp_sk(sk)->srtt >> 3; 107 if (rtt > 0)
108 w->rtt = usecs_to_jiffies(rtt);
108} 109}
109 110
110/* 111/*
diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c
index c04b7c6ec702..c107fba7430e 100644
--- a/net/ipv4/tcp_yeah.c
+++ b/net/ipv4/tcp_yeah.c
@@ -58,7 +58,7 @@ static void tcp_yeah_init(struct sock *sk)
58} 58}
59 59
60 60
61static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, ktime_t last) 61static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, s32 rtt_us)
62{ 62{
63 const struct inet_connection_sock *icsk = inet_csk(sk); 63 const struct inet_connection_sock *icsk = inet_csk(sk);
64 struct yeah *yeah = inet_csk_ca(sk); 64 struct yeah *yeah = inet_csk_ca(sk);
@@ -66,7 +66,7 @@ static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, ktime_t last)
66 if (icsk->icsk_ca_state == TCP_CA_Open) 66 if (icsk->icsk_ca_state == TCP_CA_Open)
67 yeah->pkts_acked = pkts_acked; 67 yeah->pkts_acked = pkts_acked;
68 68
69 tcp_vegas_pkts_acked(sk, pkts_acked, last); 69 tcp_vegas_pkts_acked(sk, pkts_acked, rtt_us);
70} 70}
71 71
72static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, 72static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack,
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 06012920912a..91ef3be5abad 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2256,14 +2256,14 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2256 struct net_device *dev = (struct net_device *) data; 2256 struct net_device *dev = (struct net_device *) data;
2257 struct inet6_dev *idev = __in6_dev_get(dev); 2257 struct inet6_dev *idev = __in6_dev_get(dev);
2258 int run_pending = 0; 2258 int run_pending = 0;
2259 int err;
2259 2260
2260 switch(event) { 2261 switch(event) {
2261 case NETDEV_REGISTER: 2262 case NETDEV_REGISTER:
2262 if (!idev && dev->mtu >= IPV6_MIN_MTU) { 2263 if (!idev && dev->mtu >= IPV6_MIN_MTU) {
2263 idev = ipv6_add_dev(dev); 2264 idev = ipv6_add_dev(dev);
2264 if (!idev) 2265 if (!idev)
2265 printk(KERN_WARNING "IPv6: add_dev failed for %s\n", 2266 return notifier_from_errno(-ENOMEM);
2266 dev->name);
2267 } 2267 }
2268 break; 2268 break;
2269 case NETDEV_UP: 2269 case NETDEV_UP:
@@ -2373,7 +2373,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2373 NULL); 2373 NULL);
2374 addrconf_sysctl_register(idev, &idev->cnf); 2374 addrconf_sysctl_register(idev, &idev->cnf);
2375#endif 2375#endif
2376 snmp6_register_dev(idev); 2376 err = snmp6_register_dev(idev);
2377 if (err)
2378 return notifier_from_errno(err);
2377 } 2379 }
2378 break; 2380 break;
2379 } 2381 }
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c
index faaefb692298..3f82e9542eda 100644
--- a/net/ipv6/addrconf_core.c
+++ b/net/ipv6/addrconf_core.c
@@ -50,6 +50,9 @@ int __ipv6_addr_type(const struct in6_addr *addr)
50 if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000)) 50 if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000))
51 return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST | 51 return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST |
52 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_SITELOCAL)); /* addr-select 3.1 */ 52 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_SITELOCAL)); /* addr-select 3.1 */
53 if ((st & htonl(0xFE000000)) == htonl(0xFC000000))
54 return (IPV6_ADDR_UNICAST |
55 IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* RFC 4193 */
53 56
54 if ((addr->s6_addr32[0] | addr->s6_addr32[1]) == 0) { 57 if ((addr->s6_addr32[0] | addr->s6_addr32[1]) == 0) {
55 if (addr->s6_addr32[2] == 0) { 58 if (addr->s6_addr32[2] == 0) {
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 36df2218b669..3153e15e0f7c 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -86,8 +86,8 @@ static int ipv6_print_conntrack(struct seq_file *s,
86 * - Note also special handling of AUTH header. Thanks to IPsec wizards. 86 * - Note also special handling of AUTH header. Thanks to IPsec wizards.
87 */ 87 */
88 88
89int nf_ct_ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp, 89static int nf_ct_ipv6_skip_exthdr(const struct sk_buff *skb, int start,
90 int len) 90 u8 *nexthdrp, int len)
91{ 91{
92 u8 nexthdr = *nexthdrp; 92 u8 nexthdr = *nexthdrp;
93 93
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 919de682b331..55ea80fac601 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1983,9 +1983,10 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg)
1983 !dst_metric_locked(&rt->u.dst, RTAX_MTU) && 1983 !dst_metric_locked(&rt->u.dst, RTAX_MTU) &&
1984 (dst_mtu(&rt->u.dst) > arg->mtu || 1984 (dst_mtu(&rt->u.dst) > arg->mtu ||
1985 (dst_mtu(&rt->u.dst) < arg->mtu && 1985 (dst_mtu(&rt->u.dst) < arg->mtu &&
1986 dst_mtu(&rt->u.dst) == idev->cnf.mtu6))) 1986 dst_mtu(&rt->u.dst) == idev->cnf.mtu6))) {
1987 rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu; 1987 rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu;
1988 rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(arg->mtu); 1988 rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(arg->mtu);
1989 }
1989 return 0; 1990 return 0;
1990} 1991}
1991 1992
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 13c09bc32aa3..dee0d5fb39c5 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -380,6 +380,10 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
380 return; 380 return;
381 while ((parentid = sch->parent)) { 381 while ((parentid = sch->parent)) {
382 sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid)); 382 sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid));
383 if (sch == NULL) {
384 WARN_ON(parentid != TC_H_ROOT);
385 return;
386 }
383 cops = sch->ops->cl_ops; 387 cops = sch->ops->cl_ops;
384 if (cops->qlen_notify) { 388 if (cops->qlen_notify) {
385 cl = cops->get(sch, parentid); 389 cl = cops->get(sch, parentid);
@@ -420,8 +424,6 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
420 unsigned long cl = cops->get(parent, classid); 424 unsigned long cl = cops->get(parent, classid);
421 if (cl) { 425 if (cl) {
422 err = cops->graft(parent, cl, new, old); 426 err = cops->graft(parent, cl, new, old);
423 if (new)
424 new->parent = classid;
425 cops->put(parent, cl); 427 cops->put(parent, cl);
426 } 428 }
427 } 429 }
@@ -436,7 +438,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
436 */ 438 */
437 439
438static struct Qdisc * 440static struct Qdisc *
439qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) 441qdisc_create(struct net_device *dev, u32 parent, u32 handle,
442 struct rtattr **tca, int *errp)
440{ 443{
441 int err; 444 int err;
442 struct rtattr *kind = tca[TCA_KIND-1]; 445 struct rtattr *kind = tca[TCA_KIND-1];
@@ -482,6 +485,8 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
482 goto err_out2; 485 goto err_out2;
483 } 486 }
484 487
488 sch->parent = parent;
489
485 if (handle == TC_H_INGRESS) { 490 if (handle == TC_H_INGRESS) {
486 sch->flags |= TCQ_F_INGRESS; 491 sch->flags |= TCQ_F_INGRESS;
487 sch->stats_lock = &dev->ingress_lock; 492 sch->stats_lock = &dev->ingress_lock;
@@ -758,9 +763,11 @@ create_n_graft:
758 if (!(n->nlmsg_flags&NLM_F_CREATE)) 763 if (!(n->nlmsg_flags&NLM_F_CREATE))
759 return -ENOENT; 764 return -ENOENT;
760 if (clid == TC_H_INGRESS) 765 if (clid == TC_H_INGRESS)
761 q = qdisc_create(dev, tcm->tcm_parent, tca, &err); 766 q = qdisc_create(dev, tcm->tcm_parent, tcm->tcm_parent,
767 tca, &err);
762 else 768 else
763 q = qdisc_create(dev, tcm->tcm_handle, tca, &err); 769 q = qdisc_create(dev, tcm->tcm_parent, tcm->tcm_handle,
770 tca, &err);
764 if (q == NULL) { 771 if (q == NULL) {
765 if (err == -EAGAIN) 772 if (err == -EAGAIN)
766 goto replay; 773 goto replay;
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 51f16b0af198..2d32fd27496e 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -158,9 +158,8 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch)
158 break; 158 break;
159 case TC_ACT_RECLASSIFY: 159 case TC_ACT_RECLASSIFY:
160 case TC_ACT_OK: 160 case TC_ACT_OK:
161 case TC_ACT_UNSPEC:
162 default:
163 skb->tc_index = TC_H_MIN(res.classid); 161 skb->tc_index = TC_H_MIN(res.classid);
162 default:
164 result = TC_ACT_OK; 163 result = TC_ACT_OK;
165 break; 164 break;
166 } 165 }
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 2d8c08493d6e..4a49db65772e 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -38,9 +38,11 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
38 struct prio_sched_data *q = qdisc_priv(sch); 38 struct prio_sched_data *q = qdisc_priv(sch);
39 u32 band = skb->priority; 39 u32 band = skb->priority;
40 struct tcf_result res; 40 struct tcf_result res;
41 int err;
41 42
42 *qerr = NET_XMIT_BYPASS; 43 *qerr = NET_XMIT_BYPASS;
43 if (TC_H_MAJ(skb->priority) != sch->handle) { 44 if (TC_H_MAJ(skb->priority) != sch->handle) {
45 err = tc_classify(skb, q->filter_list, &res);
44#ifdef CONFIG_NET_CLS_ACT 46#ifdef CONFIG_NET_CLS_ACT
45 switch (tc_classify(skb, q->filter_list, &res)) { 47 switch (tc_classify(skb, q->filter_list, &res)) {
46 case TC_ACT_STOLEN: 48 case TC_ACT_STOLEN:
@@ -49,11 +51,8 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
49 case TC_ACT_SHOT: 51 case TC_ACT_SHOT:
50 return NULL; 52 return NULL;
51 } 53 }
52
53 if (!q->filter_list ) {
54#else
55 if (!q->filter_list || tc_classify(skb, q->filter_list, &res)) {
56#endif 54#endif
55 if (!q->filter_list || err < 0) {
57 if (TC_H_MAJ(band)) 56 if (TC_H_MAJ(band))
58 band = 0; 57 band = 0;
59 band = q->prio2band[band&TC_PRIO_MAX]; 58 band = q->prio2band[band&TC_PRIO_MAX];
@@ -239,11 +238,13 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
239 /* If we're multiqueue, make sure the number of incoming bands 238 /* If we're multiqueue, make sure the number of incoming bands
240 * matches the number of queues on the device we're associating with. 239 * matches the number of queues on the device we're associating with.
241 * If the number of bands requested is zero, then set q->bands to 240 * If the number of bands requested is zero, then set q->bands to
242 * dev->egress_subqueue_count. 241 * dev->egress_subqueue_count. Also, the root qdisc must be the
242 * only one that is enabled for multiqueue, since it's the only one
243 * that interacts with the underlying device.
243 */ 244 */
244 q->mq = RTA_GET_FLAG(tb[TCA_PRIO_MQ - 1]); 245 q->mq = RTA_GET_FLAG(tb[TCA_PRIO_MQ - 1]);
245 if (q->mq) { 246 if (q->mq) {
246 if (sch->handle != TC_H_ROOT) 247 if (sch->parent != TC_H_ROOT)
247 return -EINVAL; 248 return -EINVAL;
248 if (netif_is_multiqueue(sch->dev)) { 249 if (netif_is_multiqueue(sch->dev)) {
249 if (q->bands == 0) 250 if (q->bands == 0)
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 5adfdfd49d61..1d674e0848fa 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -423,6 +423,17 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
423 return NULL; 423 return NULL;
424 } 424 }
425 425
426 if (LINK_LOG_BUF_SIZE) {
427 char *pb = kmalloc(LINK_LOG_BUF_SIZE, GFP_ATOMIC);
428
429 if (!pb) {
430 kfree(l_ptr);
431 warn("Link creation failed, no memory for print buffer\n");
432 return NULL;
433 }
434 tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
435 }
436
426 l_ptr->addr = peer; 437 l_ptr->addr = peer;
427 if_name = strchr(b_ptr->publ.name, ':') + 1; 438 if_name = strchr(b_ptr->publ.name, ':') + 1;
428 sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:", 439 sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:",
@@ -432,8 +443,6 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
432 tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); 443 tipc_zone(peer), tipc_cluster(peer), tipc_node(peer));
433 /* note: peer i/f is appended to link name by reset/activate */ 444 /* note: peer i/f is appended to link name by reset/activate */
434 memcpy(&l_ptr->media_addr, media_addr, sizeof(*media_addr)); 445 memcpy(&l_ptr->media_addr, media_addr, sizeof(*media_addr));
435 k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
436 list_add_tail(&l_ptr->link_list, &b_ptr->links);
437 l_ptr->checkpoint = 1; 446 l_ptr->checkpoint = 1;
438 l_ptr->b_ptr = b_ptr; 447 l_ptr->b_ptr = b_ptr;
439 link_set_supervision_props(l_ptr, b_ptr->media->tolerance); 448 link_set_supervision_props(l_ptr, b_ptr->media->tolerance);
@@ -459,21 +468,14 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
459 468
460 l_ptr->owner = tipc_node_attach_link(l_ptr); 469 l_ptr->owner = tipc_node_attach_link(l_ptr);
461 if (!l_ptr->owner) { 470 if (!l_ptr->owner) {
471 if (LINK_LOG_BUF_SIZE)
472 kfree(l_ptr->print_buf.buf);
462 kfree(l_ptr); 473 kfree(l_ptr);
463 return NULL; 474 return NULL;
464 } 475 }
465 476
466 if (LINK_LOG_BUF_SIZE) { 477 k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
467 char *pb = kmalloc(LINK_LOG_BUF_SIZE, GFP_ATOMIC); 478 list_add_tail(&l_ptr->link_list, &b_ptr->links);
468
469 if (!pb) {
470 kfree(l_ptr);
471 warn("Link creation failed, no memory for print buffer\n");
472 return NULL;
473 }
474 tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
475 }
476
477 tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr); 479 tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr);
478 480
479 dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", 481 dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 65ebccc0a698..a05c34260e70 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -118,14 +118,40 @@
118 118
119int sysctl_unix_max_dgram_qlen __read_mostly = 10; 119int sysctl_unix_max_dgram_qlen __read_mostly = 10;
120 120
121struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; 121static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
122DEFINE_SPINLOCK(unix_table_lock); 122static DEFINE_SPINLOCK(unix_table_lock);
123static atomic_t unix_nr_socks = ATOMIC_INIT(0); 123static atomic_t unix_nr_socks = ATOMIC_INIT(0);
124 124
125#define unix_sockets_unbound (&unix_socket_table[UNIX_HASH_SIZE]) 125#define unix_sockets_unbound (&unix_socket_table[UNIX_HASH_SIZE])
126 126
127#define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) 127#define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE)
128 128
129static struct sock *first_unix_socket(int *i)
130{
131 for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) {
132 if (!hlist_empty(&unix_socket_table[*i]))
133 return __sk_head(&unix_socket_table[*i]);
134 }
135 return NULL;
136}
137
138static struct sock *next_unix_socket(int *i, struct sock *s)
139{
140 struct sock *next = sk_next(s);
141 /* More in this chain? */
142 if (next)
143 return next;
144 /* Look for next non-empty chain. */
145 for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
146 if (!hlist_empty(&unix_socket_table[*i]))
147 return __sk_head(&unix_socket_table[*i]);
148 }
149 return NULL;
150}
151
152#define forall_unix_sockets(i, s) \
153 for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s)))
154
129#ifdef CONFIG_SECURITY_NETWORK 155#ifdef CONFIG_SECURITY_NETWORK
130static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) 156static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
131{ 157{
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index c3a4b0a18687..95a47304336d 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1299,7 +1299,8 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, struct flowi *fl,
1299 xfrm_address_t *local = saddr; 1299 xfrm_address_t *local = saddr;
1300 struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i]; 1300 struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i];
1301 1301
1302 if (tmpl->mode == XFRM_MODE_TUNNEL) { 1302 if (tmpl->mode == XFRM_MODE_TUNNEL ||
1303 tmpl->mode == XFRM_MODE_BEET) {
1303 remote = &tmpl->id.daddr; 1304 remote = &tmpl->id.daddr;
1304 local = &tmpl->saddr; 1305 local = &tmpl->saddr;
1305 family = tmpl->encap_family; 1306 family = tmpl->encap_family;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 38f90ca75b1e..31be405efb55 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -611,7 +611,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
611 selector. 611 selector.
612 */ 612 */
613 if (x->km.state == XFRM_STATE_VALID) { 613 if (x->km.state == XFRM_STATE_VALID) {
614 if (!xfrm_selector_match(&x->sel, fl, family) || 614 if (!xfrm_selector_match(&x->sel, fl, x->sel.family) ||
615 !security_xfrm_state_pol_flow_match(x, pol, fl)) 615 !security_xfrm_state_pol_flow_match(x, pol, fl))
616 continue; 616 continue;
617 if (!best || 617 if (!best ||
@@ -623,7 +623,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
623 acquire_in_progress = 1; 623 acquire_in_progress = 1;
624 } else if (x->km.state == XFRM_STATE_ERROR || 624 } else if (x->km.state == XFRM_STATE_ERROR ||
625 x->km.state == XFRM_STATE_EXPIRED) { 625 x->km.state == XFRM_STATE_EXPIRED) {
626 if (xfrm_selector_match(&x->sel, fl, family) && 626 if (xfrm_selector_match(&x->sel, fl, x->sel.family) &&
627 security_xfrm_state_pol_flow_match(x, pol, fl)) 627 security_xfrm_state_pol_flow_match(x, pol, fl))
628 error = -ESRCH; 628 error = -ESRCH;
629 } 629 }
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index c06883bf620e..61339e17a0f5 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -322,6 +322,13 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *
322 x->props.family = p->family; 322 x->props.family = p->family;
323 memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr)); 323 memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr));
324 x->props.flags = p->flags; 324 x->props.flags = p->flags;
325
326 /*
327 * Set inner address family if the KM left it as zero.
328 * See comment in validate_tmpl.
329 */
330 if (!x->sel.family)
331 x->sel.family = p->family;
325} 332}
326 333
327/* 334/*