aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/kernel-hacking.tmpl4
-rw-r--r--Documentation/networking/00-INDEX2
-rw-r--r--Documentation/networking/ieee802154.txt2
-rw-r--r--drivers/atm/solos-pci.c2
-rw-r--r--drivers/ieee802154/fakehard.c130
-rw-r--r--drivers/isdn/hardware/mISDN/iohelper.h10
-rw-r--r--drivers/isdn/hardware/mISDN/ipac.h16
-rw-r--r--drivers/isdn/hardware/mISDN/isar.h8
-rw-r--r--drivers/net/3c515.c4
-rw-r--r--drivers/net/at1700.c2
-rw-r--r--drivers/net/bnx2x_main.c34
-rw-r--r--drivers/net/bnx2x_reg.h5
-rw-r--r--drivers/net/cnic.c23
-rw-r--r--drivers/net/eepro.c2
-rw-r--r--drivers/net/eexpress.c6
-rw-r--r--drivers/net/ethoc.c2
-rw-r--r--drivers/net/fealnx.c3
-rw-r--r--drivers/net/gianfar_ethtool.c10
-rw-r--r--drivers/net/ixgbe/ixgbe.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c11
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c42
-rw-r--r--drivers/net/netxen/netxen_nic.h177
-rw-r--r--drivers/net/netxen/netxen_nic_ctx.c6
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c81
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h2
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c28
-rw-r--r--drivers/net/netxen/netxen_nic_init.c137
-rw-r--r--drivers/net/netxen/netxen_nic_main.c588
-rw-r--r--drivers/net/pppoe.c1
-rw-r--r--drivers/net/r8169.c13
-rw-r--r--drivers/net/smc91x.h3
-rw-r--r--drivers/net/tokenring/ibmtr.c2
-rw-r--r--drivers/net/wireless/airo.c13
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c14
-rw-r--r--drivers/net/wireless/iwmc3200wifi/netdev.c6
-rw-r--r--drivers/net/wireless/libertas/assoc.c18
-rw-r--r--drivers/net/wireless/libertas/scan.c3
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c4
-rw-r--r--include/linux/ethtool.h1
-rw-r--r--include/linux/inetdevice.h2
-rw-r--r--include/net/af_ieee802154.h (renamed from include/net/ieee802154/af_ieee802154.h)0
-rw-r--r--include/net/ieee802154.h (renamed from include/net/ieee802154/mac_def.h)4
-rw-r--r--include/net/ieee802154/nl802154.h41
-rw-r--r--include/net/ieee802154_netdev.h (renamed from include/net/ieee802154/netdevice.h)0
-rw-r--r--include/net/ip6_fib.h6
-rw-r--r--include/net/ip_vs.h119
-rw-r--r--include/net/nl802154.h117
-rw-r--r--include/net/rose.h2
-rw-r--r--include/net/xfrm.h2
-rw-r--r--net/8021q/vlan.c6
-rw-r--r--net/bridge/br_if.c2
-rw-r--r--net/core/ethtool.c3
-rw-r--r--net/ieee802154/af_ieee802154.c4
-rw-r--r--net/ieee802154/dgram.c6
-rw-r--r--net/ieee802154/netlink.c6
-rw-r--r--net/ieee802154/raw.c2
-rw-r--r--net/ipv4/arp.c4
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv4/xfrm4_policy.c31
-rw-r--r--net/ipv6/ip6_fib.c16
-rw-r--r--net/ipv6/xfrm6_policy.c33
-rw-r--r--net/irda/irttp.c1
-rw-r--r--net/mac80211/mlme.c2
-rw-r--r--net/mac80211/pm.c24
-rw-r--r--net/mac80211/rx.c12
-rw-r--r--net/netfilter/ipvs/ip_vs_app.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_conn.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_dh.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_est.c4
-rw-r--r--net/netfilter/ipvs/ip_vs_ftp.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_lblc.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_lblcr.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_lc.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_nq.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_proto.c7
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_ah_esp.c7
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_tcp.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_udp.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_rr.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_sched.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_sed.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_sh.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_sync.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_wlc.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_wrr.c3
-rw-r--r--net/netfilter/ipvs/ip_vs_xmit.c3
-rw-r--r--net/netlabel/netlabel_kapi.c8
-rw-r--r--net/rose/af_rose.c18
-rw-r--r--net/rose/rose_route.c23
92 files changed, 1333 insertions, 662 deletions
diff --git a/Documentation/DocBook/kernel-hacking.tmpl b/Documentation/DocBook/kernel-hacking.tmpl
index a50d6cd58573..992e67e6be7f 100644
--- a/Documentation/DocBook/kernel-hacking.tmpl
+++ b/Documentation/DocBook/kernel-hacking.tmpl
@@ -449,8 +449,8 @@ printk(KERN_INFO "i = %u\n", i);
449 </para> 449 </para>
450 450
451 <programlisting> 451 <programlisting>
452__u32 ipaddress; 452__be32 ipaddress;
453printk(KERN_INFO "my ip: %d.%d.%d.%d\n", NIPQUAD(ipaddress)); 453printk(KERN_INFO "my ip: %pI4\n", &amp;ipaddress);
454 </programlisting> 454 </programlisting>
455 455
456 <para> 456 <para>
diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX
index 1634c6dcecae..50189bf07d53 100644
--- a/Documentation/networking/00-INDEX
+++ b/Documentation/networking/00-INDEX
@@ -60,6 +60,8 @@ framerelay.txt
60 - info on using Frame Relay/Data Link Connection Identifier (DLCI). 60 - info on using Frame Relay/Data Link Connection Identifier (DLCI).
61generic_netlink.txt 61generic_netlink.txt
62 - info on Generic Netlink 62 - info on Generic Netlink
63ieee802154.txt
64 - Linux IEEE 802.15.4 implementation, API and drivers
63ip-sysctl.txt 65ip-sysctl.txt
64 - /proc/sys/net/ipv4/* variables 66 - /proc/sys/net/ipv4/* variables
65ip_dynaddr.txt 67ip_dynaddr.txt
diff --git a/Documentation/networking/ieee802154.txt b/Documentation/networking/ieee802154.txt
index a0280ad2edc9..1d4ed66b1b1c 100644
--- a/Documentation/networking/ieee802154.txt
+++ b/Documentation/networking/ieee802154.txt
@@ -69,7 +69,7 @@ We provide an example of simple HardMAC driver at drivers/ieee802154/fakehard.c
69SoftMAC 69SoftMAC
70======= 70=======
71 71
72We are going to provide intermediate layer impelementing IEEE 802.15.4 MAC 72We are going to provide intermediate layer implementing IEEE 802.15.4 MAC
73in software. This is currently WIP. 73in software. This is currently WIP.
74 74
75See header include/net/ieee802154/mac802154.h and several drivers in 75See header include/net/ieee802154/mac802154.h and several drivers in
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 9359613addc5..307321b32cb3 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -372,7 +372,7 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
372 } 372 }
373 373
374 snr = next_string(skb); 374 snr = next_string(skb);
375 if (!str) 375 if (!snr)
376 return -EIO; 376 return -EIO;
377 attn = next_string(skb); 377 attn = next_string(skb);
378 if (!attn) 378 if (!attn)
diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c
index 14045a7ba388..c94d2c24c352 100644
--- a/drivers/ieee802154/fakehard.c
+++ b/drivers/ieee802154/fakehard.c
@@ -26,11 +26,17 @@
26#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27#include <linux/if_arp.h> 27#include <linux/if_arp.h>
28 28
29#include <net/ieee802154/af_ieee802154.h> 29#include <net/af_ieee802154.h>
30#include <net/ieee802154/netdevice.h> 30#include <net/ieee802154_netdev.h>
31#include <net/ieee802154/mac_def.h> 31#include <net/ieee802154.h>
32#include <net/ieee802154/nl802154.h> 32#include <net/nl802154.h>
33 33
34/**
35 * fake_get_pan_id - Retrieve the PAN ID of the device.
36 * @dev: The network device to retrieve the PAN of.
37 *
38 * Return the ID of the PAN from the PIB.
39 */
34static u16 fake_get_pan_id(struct net_device *dev) 40static u16 fake_get_pan_id(struct net_device *dev)
35{ 41{
36 BUG_ON(dev->type != ARPHRD_IEEE802154); 42 BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -38,6 +44,14 @@ static u16 fake_get_pan_id(struct net_device *dev)
38 return 0xeba1; 44 return 0xeba1;
39} 45}
40 46
47/**
48 * fake_get_short_addr - Retrieve the short address of the device.
49 * @dev: The network device to retrieve the short address of.
50 *
51 * Returns the IEEE 802.15.4 short-form address cached for this
52 * device. If the device has not yet had a short address assigned
53 * then this should return 0xFFFF to indicate a lack of association.
54 */
41static u16 fake_get_short_addr(struct net_device *dev) 55static u16 fake_get_short_addr(struct net_device *dev)
42{ 56{
43 BUG_ON(dev->type != ARPHRD_IEEE802154); 57 BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -45,6 +59,19 @@ static u16 fake_get_short_addr(struct net_device *dev)
45 return 0x1; 59 return 0x1;
46} 60}
47 61
62/**
63 * fake_get_dsn - Retrieve the DSN of the device.
64 * @dev: The network device to retrieve the DSN for.
65 *
66 * Returns the IEEE 802.15.4 DSN for the network device.
67 * The DSN is the sequence number which will be added to each
68 * packet or MAC command frame by the MAC during transmission.
69 *
70 * DSN means 'Data Sequence Number'.
71 *
72 * Note: This is in section 7.2.1.2 of the IEEE 802.15.4-2006
73 * document.
74 */
48static u8 fake_get_dsn(struct net_device *dev) 75static u8 fake_get_dsn(struct net_device *dev)
49{ 76{
50 BUG_ON(dev->type != ARPHRD_IEEE802154); 77 BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -52,6 +79,19 @@ static u8 fake_get_dsn(struct net_device *dev)
52 return 0x00; /* DSN are implemented in HW, so return just 0 */ 79 return 0x00; /* DSN are implemented in HW, so return just 0 */
53} 80}
54 81
82/**
83 * fake_get_bsn - Retrieve the BSN of the device.
84 * @dev: The network device to retrieve the BSN for.
85 *
86 * Returns the IEEE 802.15.4 BSN for the network device.
87 * The BSN is the sequence number which will be added to each
88 * beacon frame sent by the MAC.
89 *
90 * BSN means 'Beacon Sequence Number'.
91 *
92 * Note: This is in section 7.2.1.2 of the IEEE 802.15.4-2006
93 * document.
94 */
55static u8 fake_get_bsn(struct net_device *dev) 95static u8 fake_get_bsn(struct net_device *dev)
56{ 96{
57 BUG_ON(dev->type != ARPHRD_IEEE802154); 97 BUG_ON(dev->type != ARPHRD_IEEE802154);
@@ -59,6 +99,19 @@ static u8 fake_get_bsn(struct net_device *dev)
59 return 0x00; /* BSN are implemented in HW, so return just 0 */ 99 return 0x00; /* BSN are implemented in HW, so return just 0 */
60} 100}
61 101
102/**
103 * fake_assoc_req - Make an association request to the HW.
104 * @dev: The network device which we are associating to a network.
105 * @addr: The coordinator with which we wish to associate.
106 * @channel: The channel on which to associate.
107 * @cap: The capability information field to use in the association.
108 *
109 * Start an association with a coordinator. The coordinator's address
110 * and PAN ID can be found in @addr.
111 *
112 * Note: This is in section 7.3.1 and 7.5.3.1 of the IEEE
113 * 802.15.4-2006 document.
114 */
62static int fake_assoc_req(struct net_device *dev, 115static int fake_assoc_req(struct net_device *dev,
63 struct ieee802154_addr *addr, u8 channel, u8 cap) 116 struct ieee802154_addr *addr, u8 channel, u8 cap)
64{ 117{
@@ -67,18 +120,70 @@ static int fake_assoc_req(struct net_device *dev,
67 IEEE802154_SUCCESS); 120 IEEE802154_SUCCESS);
68} 121}
69 122
123/**
124 * fake_assoc_resp - Send an association response to a device.
125 * @dev: The network device on which to send the response.
126 * @addr: The address of the device to respond to.
127 * @short_addr: The assigned short address for the device (if any).
128 * @status: The result of the association request.
129 *
130 * Queue the association response of the coordinator to another
131 * device's attempt to associate with the network which we
132 * coordinate. This is then added to the indirect-send queue to be
133 * transmitted to the end device when it polls for data.
134 *
135 * Note: This is in section 7.3.2 and 7.5.3.1 of the IEEE
136 * 802.15.4-2006 document.
137 */
70static int fake_assoc_resp(struct net_device *dev, 138static int fake_assoc_resp(struct net_device *dev,
71 struct ieee802154_addr *addr, u16 short_addr, u8 status) 139 struct ieee802154_addr *addr, u16 short_addr, u8 status)
72{ 140{
73 return 0; 141 return 0;
74} 142}
75 143
144/**
145 * fake_disassoc_req - Disassociate a device from a network.
146 * @dev: The network device on which we're disassociating a device.
147 * @addr: The device to disassociate from the network.
148 * @reason: The reason to give to the device for being disassociated.
149 *
150 * This sends a disassociation notification to the device being
151 * disassociated from the network.
152 *
153 * Note: This is in section 7.5.3.2 of the IEEE 802.15.4-2006
154 * document, with the reason described in 7.3.3.2.
155 */
76static int fake_disassoc_req(struct net_device *dev, 156static int fake_disassoc_req(struct net_device *dev,
77 struct ieee802154_addr *addr, u8 reason) 157 struct ieee802154_addr *addr, u8 reason)
78{ 158{
79 return ieee802154_nl_disassoc_confirm(dev, IEEE802154_SUCCESS); 159 return ieee802154_nl_disassoc_confirm(dev, IEEE802154_SUCCESS);
80} 160}
81 161
162/**
163 * fake_start_req - Start an IEEE 802.15.4 PAN.
164 * @dev: The network device on which to start the PAN.
165 * @addr: The coordinator address to use when starting the PAN.
166 * @channel: The channel on which to start the PAN.
167 * @bcn_ord: Beacon order.
168 * @sf_ord: Superframe order.
169 * @pan_coord: Whether or not we are the PAN coordinator or just
170 * requesting a realignment perhaps?
171 * @blx: Battery Life Extension feature bitfield.
172 * @coord_realign: Something to realign something else.
173 *
174 * If pan_coord is non-zero then this starts a network with the
175 * provided parameters, otherwise it attempts a coordinator
176 * realignment of the stated network instead.
177 *
178 * Note: This is in section 7.5.2.3 of the IEEE 802.15.4-2006
179 * document, with 7.3.8 describing coordinator realignment.
180 *
181 * Note: There is currently no way to notify the coordinator userland
182 * program of whether or not the PAN has started successfully. As
183 * such, the coordinator program cannot know when the MAC has
184 * completed starting the network and will simply have to assume
185 * completeness based on some form of time delay.
186 */
82static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr, 187static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr,
83 u8 channel, 188 u8 channel,
84 u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx, 189 u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx,
@@ -87,6 +192,21 @@ static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr,
87 return 0; 192 return 0;
88} 193}
89 194
195/**
196 * fake_scan_req - Start a channel scan.
197 * @dev: The network device on which to perform a channel scan.
198 * @type: The type of scan to perform.
199 * @channels: The channel bitmask to scan.
200 * @duration: How long to spend on each channel.
201 *
202 * This starts either a passive (energy) scan or an active (PAN) scan
203 * on the channels indicated in the @channels bitmask. The duration of
204 * the scan is measured in terms of superframe duration. Specifically,
205 * the scan will spend aBaseSuperFrameDuration * ((2^n) + 1) on each
206 * channel.
207 *
208 * Note: This is in section 7.5.2.1 of the IEEE 802.15.4-2006 document.
209 */
90static int fake_scan_req(struct net_device *dev, u8 type, u32 channels, 210static int fake_scan_req(struct net_device *dev, u8 type, u32 channels,
91 u8 duration) 211 u8 duration)
92{ 212{
diff --git a/drivers/isdn/hardware/mISDN/iohelper.h b/drivers/isdn/hardware/mISDN/iohelper.h
index c16a217301e8..b438981107ae 100644
--- a/drivers/isdn/hardware/mISDN/iohelper.h
+++ b/drivers/isdn/hardware/mISDN/iohelper.h
@@ -26,9 +26,9 @@
26#ifndef _IOHELPER_H 26#ifndef _IOHELPER_H
27#define _IOHELPER_H 27#define _IOHELPER_H
28 28
29typedef u8 (read_reg_t)(void *, u8); 29typedef u8 (read_reg_func)(void *hwp, u8 offset);
30typedef void (write_reg_t)(void *, u8, u8); 30typedef void (write_reg_func)(void *hwp, u8 offset, u8 value);
31typedef void (fifo_func_t)(void *, u8, u8 *, int); 31typedef void (fifo_func)(void *hwp, u8 offset, u8 *datap, int size);
32 32
33struct _ioport { 33struct _ioport {
34 u32 port; 34 u32 port;
@@ -90,7 +90,7 @@ struct _ioport {
90 *dp++ = readb(((typ *)hw->adr) + off);\ 90 *dp++ = readb(((typ *)hw->adr) + off);\
91 } \ 91 } \
92 static void WriteFiFo##name##_MIO(void *p, u8 off, u8 *dp, int size) {\ 92 static void WriteFiFo##name##_MIO(void *p, u8 off, u8 *dp, int size) {\
93 struct inf_hw *hw = p;\ 93 struct hws *hw = p;\
94 while (size--)\ 94 while (size--)\
95 writeb(*dp++, ((typ *)hw->adr) + off);\ 95 writeb(*dp++, ((typ *)hw->adr) + off);\
96 } 96 }
@@ -106,4 +106,4 @@ struct _ioport {
106 ASSIGN_FUNC(typ, IPAC, target);\ 106 ASSIGN_FUNC(typ, IPAC, target);\
107 } while (0) 107 } while (0)
108 108
109#endif \ No newline at end of file 109#endif
diff --git a/drivers/isdn/hardware/mISDN/ipac.h b/drivers/isdn/hardware/mISDN/ipac.h
index f9601d55dbca..74a6ccf9065c 100644
--- a/drivers/isdn/hardware/mISDN/ipac.h
+++ b/drivers/isdn/hardware/mISDN/ipac.h
@@ -30,10 +30,10 @@ struct isac_hw {
30 u32 off; /* offset to isac regs */ 30 u32 off; /* offset to isac regs */
31 char *name; 31 char *name;
32 spinlock_t *hwlock; /* lock HW acccess */ 32 spinlock_t *hwlock; /* lock HW acccess */
33 read_reg_t *read_reg; 33 read_reg_func *read_reg;
34 write_reg_t *write_reg; 34 write_reg_func *write_reg;
35 fifo_func_t *read_fifo; 35 fifo_func *read_fifo;
36 fifo_func_t *write_fifo; 36 fifo_func *write_fifo;
37 int (*monitor)(void *, u32, u8 *, int); 37 int (*monitor)(void *, u32, u8 *, int);
38 void (*release)(struct isac_hw *); 38 void (*release)(struct isac_hw *);
39 int (*init)(struct isac_hw *); 39 int (*init)(struct isac_hw *);
@@ -73,10 +73,10 @@ struct ipac_hw {
73 spinlock_t *hwlock; /* lock HW acccess */ 73 spinlock_t *hwlock; /* lock HW acccess */
74 struct module *owner; 74 struct module *owner;
75 u32 type; 75 u32 type;
76 read_reg_t *read_reg; 76 read_reg_func *read_reg;
77 write_reg_t *write_reg; 77 write_reg_func *write_reg;
78 fifo_func_t *read_fifo; 78 fifo_func *read_fifo;
79 fifo_func_t *write_fifo; 79 fifo_func *write_fifo;
80 void (*release)(struct ipac_hw *); 80 void (*release)(struct ipac_hw *);
81 int (*init)(struct ipac_hw *); 81 int (*init)(struct ipac_hw *);
82 int (*ctrl)(struct ipac_hw *, u32, u_long); 82 int (*ctrl)(struct ipac_hw *, u32, u_long);
diff --git a/drivers/isdn/hardware/mISDN/isar.h b/drivers/isdn/hardware/mISDN/isar.h
index 092351acd2ab..4a134acd44d0 100644
--- a/drivers/isdn/hardware/mISDN/isar.h
+++ b/drivers/isdn/hardware/mISDN/isar.h
@@ -47,10 +47,10 @@ struct isar_hw {
47 spinlock_t *hwlock; /* lock HW acccess */ 47 spinlock_t *hwlock; /* lock HW acccess */
48 char *name; 48 char *name;
49 struct module *owner; 49 struct module *owner;
50 read_reg_t *read_reg; 50 read_reg_func *read_reg;
51 write_reg_t *write_reg; 51 write_reg_func *write_reg;
52 fifo_func_t *read_fifo; 52 fifo_func *read_fifo;
53 fifo_func_t *write_fifo; 53 fifo_func *write_fifo;
54 int (*ctrl)(void *, u32, u_long); 54 int (*ctrl)(void *, u32, u_long);
55 void (*release)(struct isar_hw *); 55 void (*release)(struct isar_hw *);
56 int (*init)(struct isar_hw *); 56 int (*init)(struct isar_hw *);
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index 85ffd132bada..3116410b3499 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -832,7 +832,9 @@ static int corkscrew_open(struct net_device *dev)
832 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ 832 skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */
833 vp->rx_ring[i].addr = isa_virt_to_bus(skb->data); 833 vp->rx_ring[i].addr = isa_virt_to_bus(skb->data);
834 } 834 }
835 vp->rx_ring[i - 1].next = isa_virt_to_bus(&vp->rx_ring[0]); /* Wrap the ring. */ 835 if (i != 0)
836 vp->rx_ring[i - 1].next =
837 isa_virt_to_bus(&vp->rx_ring[0]); /* Wrap the ring. */
836 outl(isa_virt_to_bus(&vp->rx_ring[0]), ioaddr + UpListPtr); 838 outl(isa_virt_to_bus(&vp->rx_ring[0]), ioaddr + UpListPtr);
837 } 839 }
838 if (vp->full_bus_master_tx) { /* Boomerang bus master Tx. */ 840 if (vp->full_bus_master_tx) { /* Boomerang bus master Tx. */
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index c2227d79673a..5349c58d1fae 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -318,7 +318,7 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr)
318 pos3 = mca_read_stored_pos( slot, 3 ); 318 pos3 = mca_read_stored_pos( slot, 3 );
319 pos4 = mca_read_stored_pos( slot, 4 ); 319 pos4 = mca_read_stored_pos( slot, 4 );
320 320
321 for (l_i = 0; l_i < 0x09; l_i++) 321 for (l_i = 0; l_i < 8; l_i++)
322 if (( pos3 & 0x07) == at1700_ioaddr_pattern[l_i]) 322 if (( pos3 & 0x07) == at1700_ioaddr_pattern[l_i])
323 break; 323 break;
324 ioaddr = at1700_mca_probe_list[l_i]; 324 ioaddr = at1700_mca_probe_list[l_i];
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index a2de0cd9c9f9..2d035d795f02 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -56,8 +56,8 @@
56#include "bnx2x_init_ops.h" 56#include "bnx2x_init_ops.h"
57#include "bnx2x_dump.h" 57#include "bnx2x_dump.h"
58 58
59#define DRV_MODULE_VERSION "1.48.113-1" 59#define DRV_MODULE_VERSION "1.48.114-1"
60#define DRV_MODULE_RELDATE "2009/07/21" 60#define DRV_MODULE_RELDATE "2009/07/29"
61#define BNX2X_BC_VER 0x040200 61#define BNX2X_BC_VER 0x040200
62 62
63#include <linux/firmware.h> 63#include <linux/firmware.h>
@@ -4831,7 +4831,14 @@ static void bnx2x_set_storm_rx_mode(struct bnx2x *bp)
4831 int mode = bp->rx_mode; 4831 int mode = bp->rx_mode;
4832 int mask = (1 << BP_L_ID(bp)); 4832 int mask = (1 << BP_L_ID(bp));
4833 int func = BP_FUNC(bp); 4833 int func = BP_FUNC(bp);
4834 int port = BP_PORT(bp);
4834 int i; 4835 int i;
4836 /* All but management unicast packets should pass to the host as well */
4837 u32 llh_mask =
4838 NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_BRCST |
4839 NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_MLCST |
4840 NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_VLAN |
4841 NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_NO_VLAN;
4835 4842
4836 DP(NETIF_MSG_IFUP, "rx mode %d mask 0x%x\n", mode, mask); 4843 DP(NETIF_MSG_IFUP, "rx mode %d mask 0x%x\n", mode, mask);
4837 4844
@@ -4855,6 +4862,8 @@ static void bnx2x_set_storm_rx_mode(struct bnx2x *bp)
4855 tstorm_mac_filter.ucast_accept_all = mask; 4862 tstorm_mac_filter.ucast_accept_all = mask;
4856 tstorm_mac_filter.mcast_accept_all = mask; 4863 tstorm_mac_filter.mcast_accept_all = mask;
4857 tstorm_mac_filter.bcast_accept_all = mask; 4864 tstorm_mac_filter.bcast_accept_all = mask;
4865 /* pass management unicast packets as well */
4866 llh_mask |= NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_UNCST;
4858 break; 4867 break;
4859 4868
4860 default: 4869 default:
@@ -4862,6 +4871,10 @@ static void bnx2x_set_storm_rx_mode(struct bnx2x *bp)
4862 break; 4871 break;
4863 } 4872 }
4864 4873
4874 REG_WR(bp,
4875 (port ? NIG_REG_LLH1_BRB1_DRV_MASK : NIG_REG_LLH0_BRB1_DRV_MASK),
4876 llh_mask);
4877
4865 for (i = 0; i < sizeof(struct tstorm_eth_mac_filter_config)/4; i++) { 4878 for (i = 0; i < sizeof(struct tstorm_eth_mac_filter_config)/4; i++) {
4866 REG_WR(bp, BAR_TSTRORM_INTMEM + 4879 REG_WR(bp, BAR_TSTRORM_INTMEM +
4867 TSTORM_MAC_FILTER_CONFIG_OFFSET(func) + i * 4, 4880 TSTORM_MAC_FILTER_CONFIG_OFFSET(func) + i * 4,
@@ -7341,17 +7354,17 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
7341 7354
7342 for (i = 0; i < MC_HASH_SIZE; i++) 7355 for (i = 0; i < MC_HASH_SIZE; i++)
7343 REG_WR(bp, MC_HASH_OFFSET(bp, i), 0); 7356 REG_WR(bp, MC_HASH_OFFSET(bp, i), 0);
7357
7358 REG_WR(bp, MISC_REG_E1HMF_MODE, 0);
7344 } 7359 }
7345 7360
7346 if (unload_mode == UNLOAD_NORMAL) 7361 if (unload_mode == UNLOAD_NORMAL)
7347 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; 7362 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
7348 7363
7349 else if (bp->flags & NO_WOL_FLAG) { 7364 else if (bp->flags & NO_WOL_FLAG)
7350 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP; 7365 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP;
7351 if (CHIP_IS_E1H(bp))
7352 REG_WR(bp, MISC_REG_E1HMF_MODE, 0);
7353 7366
7354 } else if (bp->wol) { 7367 else if (bp->wol) {
7355 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 7368 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
7356 u8 *mac_addr = bp->dev->dev_addr; 7369 u8 *mac_addr = bp->dev->dev_addr;
7357 u32 val; 7370 u32 val;
@@ -9402,10 +9415,9 @@ static int bnx2x_test_registers(struct bnx2x *bp)
9402 { XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD00, 4, 0x00000001 }, 9415 { XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD00, 4, 0x00000001 },
9403 { XCM_REG_WU_DA_CNT_CMD00, 4, 0x00000003 }, 9416 { XCM_REG_WU_DA_CNT_CMD00, 4, 0x00000003 },
9404 { XCM_REG_GLB_DEL_ACK_MAX_CNT_0, 4, 0x000000ff }, 9417 { XCM_REG_GLB_DEL_ACK_MAX_CNT_0, 4, 0x000000ff },
9405 { NIG_REG_EGRESS_MNG0_FIFO, 20, 0xffffffff },
9406 { NIG_REG_LLH0_T_BIT, 4, 0x00000001 }, 9418 { NIG_REG_LLH0_T_BIT, 4, 0x00000001 },
9407/* 20 */ { NIG_REG_EMAC0_IN_EN, 4, 0x00000001 }, 9419 { NIG_REG_EMAC0_IN_EN, 4, 0x00000001 },
9408 { NIG_REG_BMAC0_IN_EN, 4, 0x00000001 }, 9420/* 20 */ { NIG_REG_BMAC0_IN_EN, 4, 0x00000001 },
9409 { NIG_REG_XCM0_OUT_EN, 4, 0x00000001 }, 9421 { NIG_REG_XCM0_OUT_EN, 4, 0x00000001 },
9410 { NIG_REG_BRB0_OUT_EN, 4, 0x00000001 }, 9422 { NIG_REG_BRB0_OUT_EN, 4, 0x00000001 },
9411 { NIG_REG_LLH0_XCM_MASK, 4, 0x00000007 }, 9423 { NIG_REG_LLH0_XCM_MASK, 4, 0x00000007 },
@@ -9414,8 +9426,8 @@ static int bnx2x_test_registers(struct bnx2x *bp)
9414 { NIG_REG_LLH0_DEST_MAC_0_0, 160, 0xffffffff }, 9426 { NIG_REG_LLH0_DEST_MAC_0_0, 160, 0xffffffff },
9415 { NIG_REG_LLH0_DEST_IP_0_1, 160, 0xffffffff }, 9427 { NIG_REG_LLH0_DEST_IP_0_1, 160, 0xffffffff },
9416 { NIG_REG_LLH0_IPV4_IPV6_0, 160, 0x00000001 }, 9428 { NIG_REG_LLH0_IPV4_IPV6_0, 160, 0x00000001 },
9417/* 30 */ { NIG_REG_LLH0_DEST_UDP_0, 160, 0x0000ffff }, 9429 { NIG_REG_LLH0_DEST_UDP_0, 160, 0x0000ffff },
9418 { NIG_REG_LLH0_DEST_TCP_0, 160, 0x0000ffff }, 9430/* 30 */ { NIG_REG_LLH0_DEST_TCP_0, 160, 0x0000ffff },
9419 { NIG_REG_LLH0_VLAN_ID_0, 160, 0x00000fff }, 9431 { NIG_REG_LLH0_VLAN_ID_0, 160, 0x00000fff },
9420 { NIG_REG_XGXS_SERDES0_MODE_SEL, 4, 0x00000001 }, 9432 { NIG_REG_XGXS_SERDES0_MODE_SEL, 4, 0x00000001 },
9421 { NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0, 4, 0x00000001 }, 9433 { NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0, 4, 0x00000001 },
diff --git a/drivers/net/bnx2x_reg.h b/drivers/net/bnx2x_reg.h
index d771168ec20a..8e9e7a24f2fc 100644
--- a/drivers/net/bnx2x_reg.h
+++ b/drivers/net/bnx2x_reg.h
@@ -1616,6 +1616,11 @@
1616/* [RW 1] Set by the MCP to remember if one or more of the drivers is/are 1616/* [RW 1] Set by the MCP to remember if one or more of the drivers is/are
1617 loaded; 0-prepare; -unprepare */ 1617 loaded; 0-prepare; -unprepare */
1618#define MISC_REG_UNPREPARED 0xa424 1618#define MISC_REG_UNPREPARED 0xa424
1619#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_BRCST (0x1<<0)
1620#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_MLCST (0x1<<1)
1621#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_NO_VLAN (0x1<<4)
1622#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_UNCST (0x1<<2)
1623#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_VLAN (0x1<<3)
1619#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_EMAC0_MISC_MI_INT (0x1<<0) 1624#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_EMAC0_MISC_MI_INT (0x1<<0)
1620#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_SERDES0_LINK_STATUS (0x1<<9) 1625#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_SERDES0_LINK_STATUS (0x1<<9)
1621#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_XGXS0_LINK10G (0x1<<15) 1626#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_XGXS0_LINK10G (0x1<<15)
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 4d1515f45ba2..4869d77cbe91 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -227,7 +227,7 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
227 } 227 }
228 228
229 rcu_read_lock(); 229 rcu_read_lock();
230 ulp_ops = rcu_dereference(cp->ulp_ops[CNIC_ULP_ISCSI]); 230 ulp_ops = rcu_dereference(cnic_ulp_tbl[CNIC_ULP_ISCSI]);
231 if (ulp_ops) 231 if (ulp_ops)
232 ulp_ops->iscsi_nl_send_msg(cp->dev, msg_type, buf, len); 232 ulp_ops->iscsi_nl_send_msg(cp->dev, msg_type, buf, len);
233 rcu_read_unlock(); 233 rcu_read_unlock();
@@ -319,6 +319,20 @@ static int cnic_abort_prep(struct cnic_sock *csk)
319 return 0; 319 return 0;
320} 320}
321 321
322static void cnic_uio_stop(void)
323{
324 struct cnic_dev *dev;
325
326 read_lock(&cnic_dev_lock);
327 list_for_each_entry(dev, &cnic_dev_list, list) {
328 struct cnic_local *cp = dev->cnic_priv;
329
330 if (cp->cnic_uinfo)
331 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
332 }
333 read_unlock(&cnic_dev_lock);
334}
335
322int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops) 336int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
323{ 337{
324 struct cnic_dev *dev; 338 struct cnic_dev *dev;
@@ -390,6 +404,9 @@ int cnic_unregister_driver(int ulp_type)
390 } 404 }
391 read_unlock(&cnic_dev_lock); 405 read_unlock(&cnic_dev_lock);
392 406
407 if (ulp_type == CNIC_ULP_ISCSI)
408 cnic_uio_stop();
409
393 rcu_assign_pointer(cnic_ulp_tbl[ulp_type], NULL); 410 rcu_assign_pointer(cnic_ulp_tbl[ulp_type], NULL);
394 411
395 mutex_unlock(&cnic_lock); 412 mutex_unlock(&cnic_lock);
@@ -632,7 +649,6 @@ static void cnic_free_resc(struct cnic_dev *dev)
632 int i = 0; 649 int i = 0;
633 650
634 if (cp->cnic_uinfo) { 651 if (cp->cnic_uinfo) {
635 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
636 while (cp->uio_dev != -1 && i < 15) { 652 while (cp->uio_dev != -1 && i < 15) {
637 msleep(100); 653 msleep(100);
638 i++; 654 i++;
@@ -1057,6 +1073,9 @@ static void cnic_ulp_stop(struct cnic_dev *dev)
1057 struct cnic_local *cp = dev->cnic_priv; 1073 struct cnic_local *cp = dev->cnic_priv;
1058 int if_type; 1074 int if_type;
1059 1075
1076 if (cp->cnic_uinfo)
1077 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
1078
1060 rcu_read_lock(); 1079 rcu_read_lock();
1061 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { 1080 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
1062 struct cnic_ulp_ops *ulp_ops; 1081 struct cnic_ulp_ops *ulp_ops;
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 71605d63708c..53317a83857a 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1784,7 +1784,7 @@ int __init init_module(void)
1784 printk(KERN_INFO "eepro_init_module: Auto-detecting boards (May God protect us...)\n"); 1784 printk(KERN_INFO "eepro_init_module: Auto-detecting boards (May God protect us...)\n");
1785 } 1785 }
1786 1786
1787 for (i = 0; io[i] != -1 && i < MAX_EEPRO; i++) { 1787 for (i = 0; i < MAX_EEPRO && io[i] != -1; i++) {
1788 dev = alloc_etherdev(sizeof(struct eepro_local)); 1788 dev = alloc_etherdev(sizeof(struct eepro_local));
1789 if (!dev) 1789 if (!dev)
1790 break; 1790 break;
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
index 8c44ef4ba357..d1b6368faacd 100644
--- a/drivers/net/eexpress.c
+++ b/drivers/net/eexpress.c
@@ -1474,13 +1474,13 @@ static void eexp_hw_init586(struct net_device *dev)
1474 outw(0x0000, ioaddr + 0x800c); 1474 outw(0x0000, ioaddr + 0x800c);
1475 outw(0x0000, ioaddr + 0x800e); 1475 outw(0x0000, ioaddr + 0x800e);
1476 1476
1477 for (i = 0; i < (sizeof(start_code)); i+=32) { 1477 for (i = 0; i < ARRAY_SIZE(start_code) * 2; i+=32) {
1478 int j; 1478 int j;
1479 outw(i, ioaddr + SM_PTR); 1479 outw(i, ioaddr + SM_PTR);
1480 for (j = 0; j < 16; j+=2) 1480 for (j = 0; j < 16 && (i+j)/2 < ARRAY_SIZE(start_code); j+=2)
1481 outw(start_code[(i+j)/2], 1481 outw(start_code[(i+j)/2],
1482 ioaddr+0x4000+j); 1482 ioaddr+0x4000+j);
1483 for (j = 0; j < 16; j+=2) 1483 for (j = 0; j < 16 && (i+j+16)/2 < ARRAY_SIZE(start_code); j+=2)
1484 outw(start_code[(i+j+16)/2], 1484 outw(start_code[(i+j+16)/2],
1485 ioaddr+0x8000+j); 1485 ioaddr+0x8000+j);
1486 } 1486 }
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index ceb6a9c357ad..4dbe5f173273 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -894,7 +894,7 @@ static int ethoc_probe(struct platform_device *pdev)
894 894
895 mmio = devm_request_mem_region(&pdev->dev, res->start, 895 mmio = devm_request_mem_region(&pdev->dev, res->start,
896 res->end - res->start + 1, res->name); 896 res->end - res->start + 1, res->name);
897 if (!res) { 897 if (!mmio) {
898 dev_err(&pdev->dev, "cannot request I/O memory space\n"); 898 dev_err(&pdev->dev, "cannot request I/O memory space\n");
899 ret = -ENXIO; 899 ret = -ENXIO;
900 goto free; 900 goto free;
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index 75e5fe5153d9..b2d617206bd9 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -584,7 +584,8 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
584 if (np->flags == HAS_MII_XCVR) { 584 if (np->flags == HAS_MII_XCVR) {
585 int phy, phy_idx = 0; 585 int phy, phy_idx = 0;
586 586
587 for (phy = 1; phy < 32 && phy_idx < 4; phy++) { 587 for (phy = 1; phy < 32 && phy_idx < ARRAY_SIZE(np->phys);
588 phy++) {
588 int mii_status = mdio_read(dev, phy, 1); 589 int mii_status = mdio_read(dev, phy, 1);
589 590
590 if (mii_status != 0xffff && mii_status != 0x0000) { 591 if (mii_status != 0xffff && mii_status != 0x0000) {
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index dbf06e9313cc..2234118eedbb 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -366,9 +366,8 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals
366 return -EINVAL; 366 return -EINVAL;
367 } 367 }
368 368
369 priv->rxic = mk_ic_value( 369 priv->rxic = mk_ic_value(cvals->rx_max_coalesced_frames,
370 gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs), 370 gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs));
371 cvals->rx_max_coalesced_frames);
372 371
373 /* Set up tx coalescing */ 372 /* Set up tx coalescing */
374 if ((cvals->tx_coalesce_usecs == 0) || 373 if ((cvals->tx_coalesce_usecs == 0) ||
@@ -390,9 +389,8 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals
390 return -EINVAL; 389 return -EINVAL;
391 } 390 }
392 391
393 priv->txic = mk_ic_value( 392 priv->txic = mk_ic_value(cvals->tx_max_coalesced_frames,
394 gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs), 393 gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs));
395 cvals->tx_max_coalesced_frames);
396 394
397 gfar_write(&priv->regs->rxic, 0); 395 gfar_write(&priv->regs->rxic, 0);
398 if (priv->rxcoalescing) 396 if (priv->rxcoalescing)
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index dc3cc4348d1d..62b6c028ae81 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -96,6 +96,8 @@
96#define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0x0000e000 96#define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0x0000e000
97#define IXGBE_TX_FLAGS_VLAN_SHIFT 16 97#define IXGBE_TX_FLAGS_VLAN_SHIFT 16
98 98
99#define IXGBE_MAX_RSC_INT_RATE 162760
100
99/* wrapper around a pointer to a socket buffer, 101/* wrapper around a pointer to a socket buffer,
100 * so a DMA handle can be stored along with the buffer */ 102 * so a DMA handle can be stored along with the buffer */
101struct ixgbe_tx_buffer { 103struct ixgbe_tx_buffer {
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 1464b33f1b8e..c6db9a04187d 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -1980,7 +1980,10 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
1980 * any other value means disable eitr, which is best 1980 * any other value means disable eitr, which is best
1981 * served by setting the interrupt rate very high 1981 * served by setting the interrupt rate very high
1982 */ 1982 */
1983 adapter->eitr_param = IXGBE_MAX_INT_RATE; 1983 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
1984 adapter->eitr_param = IXGBE_MAX_RSC_INT_RATE;
1985 else
1986 adapter->eitr_param = IXGBE_MAX_INT_RATE;
1984 adapter->itr_setting = 0; 1987 adapter->itr_setting = 0;
1985 } 1988 }
1986 1989
@@ -2004,13 +2007,13 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data)
2004 2007
2005 ethtool_op_set_flags(netdev, data); 2008 ethtool_op_set_flags(netdev, data);
2006 2009
2007 if (!(adapter->flags & IXGBE_FLAG2_RSC_CAPABLE)) 2010 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE))
2008 return 0; 2011 return 0;
2009 2012
2010 /* if state changes we need to update adapter->flags and reset */ 2013 /* if state changes we need to update adapter->flags and reset */
2011 if ((!!(data & ETH_FLAG_LRO)) != 2014 if ((!!(data & ETH_FLAG_LRO)) !=
2012 (!!(adapter->flags & IXGBE_FLAG2_RSC_ENABLED))) { 2015 (!!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))) {
2013 adapter->flags ^= IXGBE_FLAG2_RSC_ENABLED; 2016 adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED;
2014 if (netif_running(netdev)) 2017 if (netif_running(netdev))
2015 ixgbe_reinit_locked(adapter); 2018 ixgbe_reinit_locked(adapter);
2016 else 2019 else
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 50709da922c7..44adc9862826 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -513,8 +513,11 @@ static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector,
513 * @skb: skb currently being received and modified 513 * @skb: skb currently being received and modified
514 **/ 514 **/
515static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter, 515static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter,
516 u32 status_err, struct sk_buff *skb) 516 union ixgbe_adv_rx_desc *rx_desc,
517 struct sk_buff *skb)
517{ 518{
519 u32 status_err = le32_to_cpu(rx_desc->wb.upper.status_error);
520
518 skb->ip_summed = CHECKSUM_NONE; 521 skb->ip_summed = CHECKSUM_NONE;
519 522
520 /* Rx csum disabled */ 523 /* Rx csum disabled */
@@ -532,6 +535,16 @@ static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter,
532 return; 535 return;
533 536
534 if (status_err & IXGBE_RXDADV_ERR_TCPE) { 537 if (status_err & IXGBE_RXDADV_ERR_TCPE) {
538 u16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info;
539
540 /*
541 * 82599 errata, UDP frames with a 0 checksum can be marked as
542 * checksum errors.
543 */
544 if ((pkt_info & IXGBE_RXDADV_PKTTYPE_UDP) &&
545 (adapter->hw.mac.type == ixgbe_mac_82599EB))
546 return;
547
535 adapter->hw_csum_rx_error++; 548 adapter->hw_csum_rx_error++;
536 return; 549 return;
537 } 550 }
@@ -769,7 +782,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
769 prefetch(next_rxd); 782 prefetch(next_rxd);
770 cleaned_count++; 783 cleaned_count++;
771 784
772 if (adapter->flags & IXGBE_FLAG2_RSC_CAPABLE) 785 if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)
773 rsc_count = ixgbe_get_rsc_count(rx_desc); 786 rsc_count = ixgbe_get_rsc_count(rx_desc);
774 787
775 if (rsc_count) { 788 if (rsc_count) {
@@ -805,7 +818,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
805 goto next_desc; 818 goto next_desc;
806 } 819 }
807 820
808 ixgbe_rx_checksum(adapter, staterr, skb); 821 ixgbe_rx_checksum(adapter, rx_desc, skb);
809 822
810 /* probably a little skewed due to removing CRC */ 823 /* probably a little skewed due to removing CRC */
811 total_rx_bytes += skb->len; 824 total_rx_bytes += skb->len;
@@ -2025,7 +2038,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2025 IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(0), psrtype); 2038 IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(0), psrtype);
2026 } 2039 }
2027 } else { 2040 } else {
2028 if (!(adapter->flags & IXGBE_FLAG2_RSC_ENABLED) && 2041 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) &&
2029 (netdev->mtu <= ETH_DATA_LEN)) 2042 (netdev->mtu <= ETH_DATA_LEN))
2030 rx_buf_len = MAXIMUM_ETHERNET_VLAN_SIZE; 2043 rx_buf_len = MAXIMUM_ETHERNET_VLAN_SIZE;
2031 else 2044 else
@@ -2154,7 +2167,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2154 IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl); 2167 IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl);
2155 } 2168 }
2156 2169
2157 if (adapter->flags & IXGBE_FLAG2_RSC_ENABLED) { 2170 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
2158 /* Enable 82599 HW-RSC */ 2171 /* Enable 82599 HW-RSC */
2159 for (i = 0; i < adapter->num_rx_queues; i++) { 2172 for (i = 0; i < adapter->num_rx_queues; i++) {
2160 j = adapter->rx_ring[i].reg_idx; 2173 j = adapter->rx_ring[i].reg_idx;
@@ -3801,8 +3814,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
3801 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82598; 3814 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82598;
3802 } else if (hw->mac.type == ixgbe_mac_82599EB) { 3815 } else if (hw->mac.type == ixgbe_mac_82599EB) {
3803 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599; 3816 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599;
3804 adapter->flags |= IXGBE_FLAG2_RSC_CAPABLE; 3817 adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE;
3805 adapter->flags |= IXGBE_FLAG2_RSC_ENABLED; 3818 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
3806 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; 3819 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
3807 adapter->ring_feature[RING_F_FDIR].indices = 3820 adapter->ring_feature[RING_F_FDIR].indices =
3808 IXGBE_MAX_FDIR_INDICES; 3821 IXGBE_MAX_FDIR_INDICES;
@@ -5349,12 +5362,19 @@ static int ixgbe_del_sanmac_netdev(struct net_device *dev)
5349static void ixgbe_netpoll(struct net_device *netdev) 5362static void ixgbe_netpoll(struct net_device *netdev)
5350{ 5363{
5351 struct ixgbe_adapter *adapter = netdev_priv(netdev); 5364 struct ixgbe_adapter *adapter = netdev_priv(netdev);
5365 int i;
5352 5366
5353 disable_irq(adapter->pdev->irq);
5354 adapter->flags |= IXGBE_FLAG_IN_NETPOLL; 5367 adapter->flags |= IXGBE_FLAG_IN_NETPOLL;
5355 ixgbe_intr(adapter->pdev->irq, netdev); 5368 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) {
5369 int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;
5370 for (i = 0; i < num_q_vectors; i++) {
5371 struct ixgbe_q_vector *q_vector = adapter->q_vector[i];
5372 ixgbe_msix_clean_many(0, q_vector);
5373 }
5374 } else {
5375 ixgbe_intr(adapter->pdev->irq, netdev);
5376 }
5356 adapter->flags &= ~IXGBE_FLAG_IN_NETPOLL; 5377 adapter->flags &= ~IXGBE_FLAG_IN_NETPOLL;
5357 enable_irq(adapter->pdev->irq);
5358} 5378}
5359#endif 5379#endif
5360 5380
@@ -5600,7 +5620,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
5600 if (pci_using_dac) 5620 if (pci_using_dac)
5601 netdev->features |= NETIF_F_HIGHDMA; 5621 netdev->features |= NETIF_F_HIGHDMA;
5602 5622
5603 if (adapter->flags & IXGBE_FLAG2_RSC_ENABLED) 5623 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
5604 netdev->features |= NETIF_F_LRO; 5624 netdev->features |= NETIF_F_LRO;
5605 5625
5606 /* make sure the EEPROM is good */ 5626 /* make sure the EEPROM is good */
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index f86e05047d19..e22d08615893 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -57,8 +57,8 @@
57 57
58#define _NETXEN_NIC_LINUX_MAJOR 4 58#define _NETXEN_NIC_LINUX_MAJOR 4
59#define _NETXEN_NIC_LINUX_MINOR 0 59#define _NETXEN_NIC_LINUX_MINOR 0
60#define _NETXEN_NIC_LINUX_SUBVERSION 30 60#define _NETXEN_NIC_LINUX_SUBVERSION 41
61#define NETXEN_NIC_LINUX_VERSIONID "4.0.30" 61#define NETXEN_NIC_LINUX_VERSIONID "4.0.41"
62 62
63#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) 63#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c))
64#define _major(v) (((v) >> 24) & 0xff) 64#define _major(v) (((v) >> 24) & 0xff)
@@ -143,18 +143,13 @@
143#define NX_ETHERMTU 1500 143#define NX_ETHERMTU 1500
144#define NX_MAX_ETHERHDR 32 /* This contains some padding */ 144#define NX_MAX_ETHERHDR 32 /* This contains some padding */
145 145
146#define NX_RX_NORMAL_BUF_MAX_LEN (NX_MAX_ETHERHDR + NX_ETHERMTU) 146#define NX_P2_RX_BUF_MAX_LEN 1760
147#define NX_P3_RX_BUF_MAX_LEN (NX_MAX_ETHERHDR + NX_ETHERMTU)
147#define NX_P2_RX_JUMBO_BUF_MAX_LEN (NX_MAX_ETHERHDR + P2_MAX_MTU) 148#define NX_P2_RX_JUMBO_BUF_MAX_LEN (NX_MAX_ETHERHDR + P2_MAX_MTU)
148#define NX_P3_RX_JUMBO_BUF_MAX_LEN (NX_MAX_ETHERHDR + P3_MAX_MTU) 149#define NX_P3_RX_JUMBO_BUF_MAX_LEN (NX_MAX_ETHERHDR + P3_MAX_MTU)
149#define NX_CT_DEFAULT_RX_BUF_LEN 2048 150#define NX_CT_DEFAULT_RX_BUF_LEN 2048
150 151
151#define MAX_RX_BUFFER_LENGTH 1760 152#define NX_RX_LRO_BUFFER_LENGTH (8060)
152#define MAX_RX_JUMBO_BUFFER_LENGTH 8062
153#define MAX_RX_LRO_BUFFER_LENGTH (8062)
154#define RX_DMA_MAP_LEN (MAX_RX_BUFFER_LENGTH - 2)
155#define RX_JUMBO_DMA_MAP_LEN \
156 (MAX_RX_JUMBO_BUFFER_LENGTH - 2)
157#define RX_LRO_DMA_MAP_LEN (MAX_RX_LRO_BUFFER_LENGTH - 2)
158 153
159/* 154/*
160 * Maximum number of ring contexts 155 * Maximum number of ring contexts
@@ -200,13 +195,20 @@
200#define RCV_RING_JUMBO 1 195#define RCV_RING_JUMBO 1
201#define RCV_RING_LRO 2 196#define RCV_RING_LRO 2
202 197
203#define MAX_CMD_DESCRIPTORS 4096 198#define MIN_CMD_DESCRIPTORS 64
204#define MAX_RCV_DESCRIPTORS 16384 199#define MIN_RCV_DESCRIPTORS 64
205#define MAX_CMD_DESCRIPTORS_HOST 1024 200#define MIN_JUMBO_DESCRIPTORS 32
206#define MAX_RCV_DESCRIPTORS_1G 2048 201
207#define MAX_RCV_DESCRIPTORS_10G 4096 202#define MAX_CMD_DESCRIPTORS 1024
208#define MAX_JUMBO_RCV_DESCRIPTORS 1024 203#define MAX_RCV_DESCRIPTORS_1G 4096
204#define MAX_RCV_DESCRIPTORS_10G 8192
205#define MAX_JUMBO_RCV_DESCRIPTORS_1G 512
206#define MAX_JUMBO_RCV_DESCRIPTORS_10G 1024
209#define MAX_LRO_RCV_DESCRIPTORS 8 207#define MAX_LRO_RCV_DESCRIPTORS 8
208
209#define DEFAULT_RCV_DESCRIPTORS_1G 2048
210#define DEFAULT_RCV_DESCRIPTORS_10G 4096
211
210#define NETXEN_CTX_SIGNATURE 0xdee0 212#define NETXEN_CTX_SIGNATURE 0xdee0
211#define NETXEN_CTX_SIGNATURE_V2 0x0002dee0 213#define NETXEN_CTX_SIGNATURE_V2 0x0002dee0
212#define NETXEN_CTX_RESET 0xbad0 214#define NETXEN_CTX_RESET 0xbad0
@@ -302,6 +304,10 @@ struct netxen_ring_ctx {
302#define FLAGS_IPSEC_SA_ADD 0x04 304#define FLAGS_IPSEC_SA_ADD 0x04
303#define FLAGS_IPSEC_SA_DELETE 0x08 305#define FLAGS_IPSEC_SA_DELETE 0x08
304#define FLAGS_VLAN_TAGGED 0x10 306#define FLAGS_VLAN_TAGGED 0x10
307#define FLAGS_VLAN_OOB 0x40
308
309#define netxen_set_tx_vlan_tci(cmd_desc, v) \
310 (cmd_desc)->vlan_TCI = cpu_to_le16(v);
305 311
306#define netxen_set_cmd_desc_port(cmd_desc, var) \ 312#define netxen_set_cmd_desc_port(cmd_desc, var) \
307 ((cmd_desc)->port_ctxid |= ((var) & 0x0F)) 313 ((cmd_desc)->port_ctxid |= ((var) & 0x0F))
@@ -316,58 +322,33 @@ struct netxen_ring_ctx {
316 cpu_to_le16(((_flags) & 0x7f) | (((_opcode) & 0x3f) << 7)) 322 cpu_to_le16(((_flags) & 0x7f) | (((_opcode) & 0x3f) << 7))
317 323
318#define netxen_set_tx_frags_len(_desc, _frags, _len) \ 324#define netxen_set_tx_frags_len(_desc, _frags, _len) \
319 (_desc)->num_of_buffers_total_length = \ 325 (_desc)->nfrags__length = \
320 cpu_to_le32(((_frags) & 0xff) | (((_len) & 0xffffff) << 8)) 326 cpu_to_le32(((_frags) & 0xff) | (((_len) & 0xffffff) << 8))
321 327
322struct cmd_desc_type0 { 328struct cmd_desc_type0 {
323 u8 tcp_hdr_offset; /* For LSO only */ 329 u8 tcp_hdr_offset; /* For LSO only */
324 u8 ip_hdr_offset; /* For LSO only */ 330 u8 ip_hdr_offset; /* For LSO only */
325 /* Bit pattern: 0-6 flags, 7-12 opcode, 13-15 unused */ 331 __le16 flags_opcode; /* 15:13 unused, 12:7 opcode, 6:0 flags */
326 __le16 flags_opcode; 332 __le32 nfrags__length; /* 31:8 total len, 7:0 frag count */
327 /* Bit pattern: 0-7 total number of segments, 333
328 8-31 Total size of the packet */ 334 __le64 addr_buffer2;
329 __le32 num_of_buffers_total_length;
330 union {
331 struct {
332 __le32 addr_low_part2;
333 __le32 addr_high_part2;
334 };
335 __le64 addr_buffer2;
336 };
337 335
338 __le16 reference_handle; /* changed to u16 to add mss */ 336 __le16 reference_handle;
339 __le16 mss; /* passed by NDIS_PACKET for LSO */ 337 __le16 mss;
340 /* Bit pattern 0-3 port, 0-3 ctx id */ 338 u8 port_ctxid; /* 7:4 ctxid 3:0 port */
341 u8 port_ctxid;
342 u8 total_hdr_length; /* LSO only : MAC+IP+TCP Hdr size */ 339 u8 total_hdr_length; /* LSO only : MAC+IP+TCP Hdr size */
343 __le16 conn_id; /* IPSec offoad only */ 340 __le16 conn_id; /* IPSec offoad only */
344 341
345 union { 342 __le64 addr_buffer3;
346 struct { 343 __le64 addr_buffer1;
347 __le32 addr_low_part3;
348 __le32 addr_high_part3;
349 };
350 __le64 addr_buffer3;
351 };
352 union {
353 struct {
354 __le32 addr_low_part1;
355 __le32 addr_high_part1;
356 };
357 __le64 addr_buffer1;
358 };
359 344
360 __le16 buffer_length[4]; 345 __le16 buffer_length[4];
361 346
362 union { 347 __le64 addr_buffer4;
363 struct {
364 __le32 addr_low_part4;
365 __le32 addr_high_part4;
366 };
367 __le64 addr_buffer4;
368 };
369 348
370 __le64 unused; 349 __le16 vlan_TCI;
350 __le16 reserved;
351 __le32 reserved2;
371 352
372} __attribute__ ((aligned(64))); 353} __attribute__ ((aligned(64)));
373 354
@@ -380,6 +361,7 @@ struct rcv_desc {
380}; 361};
381 362
382/* opcode field in status_desc */ 363/* opcode field in status_desc */
364#define NETXEN_NIC_SYN_OFFLOAD 0x03
383#define NETXEN_NIC_RXPKT_DESC 0x04 365#define NETXEN_NIC_RXPKT_DESC 0x04
384#define NETXEN_OLD_RXPKT_DESC 0x3f 366#define NETXEN_OLD_RXPKT_DESC 0x3f
385#define NETXEN_NIC_RESPONSE_DESC 0x05 367#define NETXEN_NIC_RESPONSE_DESC 0x05
@@ -1078,6 +1060,9 @@ typedef struct {
1078 1060
1079#define NX_MAC_EVENT 0x1 1061#define NX_MAC_EVENT 0x1
1080 1062
1063#define NX_IP_UP 2
1064#define NX_IP_DOWN 3
1065
1081/* 1066/*
1082 * Driver --> Firmware 1067 * Driver --> Firmware
1083 */ 1068 */
@@ -1132,6 +1117,9 @@ typedef struct {
1132 1117
1133#define NX_FW_CAPABILITY_LINK_NOTIFICATION (1 << 5) 1118#define NX_FW_CAPABILITY_LINK_NOTIFICATION (1 << 5)
1134#define NX_FW_CAPABILITY_SWITCHING (1 << 6) 1119#define NX_FW_CAPABILITY_SWITCHING (1 << 6)
1120#define NX_FW_CAPABILITY_PEXQ (1 << 7)
1121#define NX_FW_CAPABILITY_BDG (1 << 8)
1122#define NX_FW_CAPABILITY_FVLANTX (1 << 9)
1135 1123
1136/* module types */ 1124/* module types */
1137#define LINKEVENT_MODULE_NOT_PRESENT 1 1125#define LINKEVENT_MODULE_NOT_PRESENT 1
@@ -1315,29 +1303,11 @@ struct netxen_adapter {
1315 1303
1316 nx_nic_intr_coalesce_t coal; 1304 nx_nic_intr_coalesce_t coal;
1317 1305
1318 u32 fw_major; 1306 u32 resv5;
1319 u32 fw_version; 1307 u32 fw_version;
1320 const struct firmware *fw; 1308 const struct firmware *fw;
1321}; 1309};
1322 1310
1323/*
1324 * NetXen dma watchdog control structure
1325 *
1326 * Bit 0 : enabled => R/O: 1 watchdog active, 0 inactive
1327 * Bit 1 : disable_request => 1 req disable dma watchdog
1328 * Bit 2 : enable_request => 1 req enable dma watchdog
1329 * Bit 3-31 : unused
1330 */
1331
1332#define netxen_set_dma_watchdog_disable_req(config_word) \
1333 _netxen_set_bits(config_word, 1, 1, 1)
1334#define netxen_set_dma_watchdog_enable_req(config_word) \
1335 _netxen_set_bits(config_word, 2, 1, 1)
1336#define netxen_get_dma_watchdog_enabled(config_word) \
1337 ((config_word) & 0x1)
1338#define netxen_get_dma_watchdog_disabled(config_word) \
1339 (((config_word) >> 1) & 0x1)
1340
1341int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter); 1311int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter);
1342int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter); 1312int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter);
1343int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter); 1313int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter);
@@ -1398,8 +1368,9 @@ unsigned long netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter,
1398 unsigned long long addr); 1368 unsigned long long addr);
1399 1369
1400/* Functions from netxen_nic_init.c */ 1370/* Functions from netxen_nic_init.c */
1401void netxen_free_adapter_offload(struct netxen_adapter *adapter); 1371int netxen_init_dummy_dma(struct netxen_adapter *adapter);
1402int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); 1372void netxen_free_dummy_dma(struct netxen_adapter *adapter);
1373
1403int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); 1374int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val);
1404int netxen_load_firmware(struct netxen_adapter *adapter); 1375int netxen_load_firmware(struct netxen_adapter *adapter);
1405int netxen_need_fw_reset(struct netxen_adapter *adapter); 1376int netxen_need_fw_reset(struct netxen_adapter *adapter);
@@ -1443,6 +1414,7 @@ void netxen_p3_free_mac_list(struct netxen_adapter *adapter);
1443int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); 1414int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32);
1444int netxen_config_intr_coalesce(struct netxen_adapter *adapter); 1415int netxen_config_intr_coalesce(struct netxen_adapter *adapter);
1445int netxen_config_rss(struct netxen_adapter *adapter, int enable); 1416int netxen_config_rss(struct netxen_adapter *adapter, int enable);
1417int netxen_config_ipaddr(struct netxen_adapter *adapter, u32 ip, int cmd);
1446int netxen_linkevent_request(struct netxen_adapter *adapter, int enable); 1418int netxen_linkevent_request(struct netxen_adapter *adapter, int enable);
1447void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup); 1419void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup);
1448 1420
@@ -1455,6 +1427,9 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);
1455void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, 1427void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter,
1456 struct nx_host_tx_ring *tx_ring); 1428 struct nx_host_tx_ring *tx_ring);
1457 1429
1430/* Functions from netxen_nic_main.c */
1431int netxen_nic_reset_context(struct netxen_adapter *);
1432
1458/* 1433/*
1459 * NetXen Board information 1434 * NetXen Board information
1460 */ 1435 */
@@ -1505,56 +1480,6 @@ static inline void get_brd_name_by_type(u32 type, char *name)
1505 name = "Unknown"; 1480 name = "Unknown";
1506} 1481}
1507 1482
1508static inline int
1509dma_watchdog_shutdown_request(struct netxen_adapter *adapter)
1510{
1511 u32 ctrl;
1512
1513 /* check if already inactive */
1514 ctrl = adapter->hw_read_wx(adapter,
1515 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL));
1516
1517 if (netxen_get_dma_watchdog_enabled(ctrl) == 0)
1518 return 1;
1519
1520 /* Send the disable request */
1521 netxen_set_dma_watchdog_disable_req(ctrl);
1522 NXWR32(adapter, NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
1523
1524 return 0;
1525}
1526
1527static inline int
1528dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter)
1529{
1530 u32 ctrl;
1531
1532 ctrl = adapter->hw_read_wx(adapter,
1533 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL));
1534
1535 return (netxen_get_dma_watchdog_enabled(ctrl) == 0);
1536}
1537
1538static inline int
1539dma_watchdog_wakeup(struct netxen_adapter *adapter)
1540{
1541 u32 ctrl;
1542
1543 ctrl = adapter->hw_read_wx(adapter,
1544 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL));
1545
1546 if (netxen_get_dma_watchdog_enabled(ctrl))
1547 return 1;
1548
1549 /* send the wakeup request */
1550 netxen_set_dma_watchdog_enable_req(ctrl);
1551
1552 NXWR32(adapter, NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
1553
1554 return 0;
1555}
1556
1557
1558static inline u32 netxen_tx_avail(struct nx_host_tx_ring *tx_ring) 1483static inline u32 netxen_tx_avail(struct nx_host_tx_ring *tx_ring)
1559{ 1484{
1560 smp_mb(); 1485 smp_mb();
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c
index 9f8ae4719e2f..9e0469643d34 100644
--- a/drivers/net/netxen/netxen_nic_ctx.c
+++ b/drivers/net/netxen/netxen_nic_ctx.c
@@ -647,7 +647,7 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
647 } 647 }
648 rds_ring->desc_head = (struct rcv_desc *)addr; 648 rds_ring->desc_head = (struct rcv_desc *)addr;
649 649
650 if (adapter->fw_major < 4) 650 if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
651 rds_ring->crb_rcv_producer = 651 rds_ring->crb_rcv_producer =
652 recv_crb_registers[port].crb_rcv_producer[ring]; 652 recv_crb_registers[port].crb_rcv_producer[ring];
653 } 653 }
@@ -675,7 +675,7 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
675 } 675 }
676 676
677 677
678 if (adapter->fw_major >= 4) { 678 if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
679 err = nx_fw_cmd_create_rx_ctx(adapter); 679 err = nx_fw_cmd_create_rx_ctx(adapter);
680 if (err) 680 if (err)
681 goto err_out_free; 681 goto err_out_free;
@@ -705,7 +705,7 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter)
705 705
706 int port = adapter->portnum; 706 int port = adapter->portnum;
707 707
708 if (adapter->fw_major >= 4) { 708 if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
709 nx_fw_cmd_destroy_rx_ctx(adapter); 709 nx_fw_cmd_destroy_rx_ctx(adapter);
710 nx_fw_cmd_destroy_tx_ctx(adapter); 710 nx_fw_cmd_destroy_tx_ctx(adapter);
711 } else { 711 } else {
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index e16ea46c24b8..39a308c363c7 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -490,28 +490,86 @@ netxen_nic_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
490} 490}
491 491
492static void 492static void
493netxen_nic_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring) 493netxen_nic_get_ringparam(struct net_device *dev,
494 struct ethtool_ringparam *ring)
494{ 495{
495 struct netxen_adapter *adapter = netdev_priv(dev); 496 struct netxen_adapter *adapter = netdev_priv(dev);
496 497
497 ring->rx_pending = 0; 498 ring->rx_pending = adapter->num_rxd;
498 ring->rx_jumbo_pending = 0; 499 ring->rx_jumbo_pending = adapter->num_jumbo_rxd;
499 ring->rx_pending += adapter->recv_ctx. 500 ring->rx_jumbo_pending += adapter->num_lro_rxd;
500 rds_rings[RCV_RING_NORMAL].num_desc;
501 ring->rx_jumbo_pending += adapter->recv_ctx.
502 rds_rings[RCV_RING_JUMBO].num_desc;
503 ring->tx_pending = adapter->num_txd; 501 ring->tx_pending = adapter->num_txd;
504 502
505 if (adapter->ahw.port_type == NETXEN_NIC_GBE) 503 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
506 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_1G; 504 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_1G;
507 else 505 ring->rx_jumbo_max_pending = MAX_JUMBO_RCV_DESCRIPTORS_1G;
506 } else {
508 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_10G; 507 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_10G;
509 ring->tx_max_pending = MAX_CMD_DESCRIPTORS_HOST; 508 ring->rx_jumbo_max_pending = MAX_JUMBO_RCV_DESCRIPTORS_10G;
510 ring->rx_jumbo_max_pending = MAX_JUMBO_RCV_DESCRIPTORS; 509 }
510
511 ring->tx_max_pending = MAX_CMD_DESCRIPTORS;
512
511 ring->rx_mini_max_pending = 0; 513 ring->rx_mini_max_pending = 0;
512 ring->rx_mini_pending = 0; 514 ring->rx_mini_pending = 0;
513} 515}
514 516
517static u32
518netxen_validate_ringparam(u32 val, u32 min, u32 max, char *r_name)
519{
520 u32 num_desc;
521 num_desc = max(val, min);
522 num_desc = min(num_desc, max);
523 num_desc = roundup_pow_of_two(num_desc);
524
525 if (val != num_desc) {
526 printk(KERN_INFO "%s: setting %s ring size %d instead of %d\n",
527 netxen_nic_driver_name, r_name, num_desc, val);
528 }
529
530 return num_desc;
531}
532
533static int
534netxen_nic_set_ringparam(struct net_device *dev,
535 struct ethtool_ringparam *ring)
536{
537 struct netxen_adapter *adapter = netdev_priv(dev);
538 u16 max_rcv_desc = MAX_RCV_DESCRIPTORS_10G;
539 u16 max_jumbo_desc = MAX_JUMBO_RCV_DESCRIPTORS_10G;
540 u16 num_rxd, num_jumbo_rxd, num_txd;
541
542 if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
543 return -EOPNOTSUPP;
544
545 if (ring->rx_mini_pending)
546 return -EOPNOTSUPP;
547
548 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
549 max_rcv_desc = MAX_RCV_DESCRIPTORS_1G;
550 max_jumbo_desc = MAX_JUMBO_RCV_DESCRIPTORS_10G;
551 }
552
553 num_rxd = netxen_validate_ringparam(ring->rx_pending,
554 MIN_RCV_DESCRIPTORS, max_rcv_desc, "rx");
555
556 num_jumbo_rxd = netxen_validate_ringparam(ring->rx_jumbo_pending,
557 MIN_JUMBO_DESCRIPTORS, max_jumbo_desc, "rx jumbo");
558
559 num_txd = netxen_validate_ringparam(ring->tx_pending,
560 MIN_CMD_DESCRIPTORS, MAX_CMD_DESCRIPTORS, "tx");
561
562 if (num_rxd == adapter->num_rxd && num_txd == adapter->num_txd &&
563 num_jumbo_rxd == adapter->num_jumbo_rxd)
564 return 0;
565
566 adapter->num_rxd = num_rxd;
567 adapter->num_jumbo_rxd = num_jumbo_rxd;
568 adapter->num_txd = num_txd;
569
570 return netxen_nic_reset_context(adapter);
571}
572
515static void 573static void
516netxen_nic_get_pauseparam(struct net_device *dev, 574netxen_nic_get_pauseparam(struct net_device *dev,
517 struct ethtool_pauseparam *pause) 575 struct ethtool_pauseparam *pause)
@@ -893,6 +951,7 @@ struct ethtool_ops netxen_nic_ethtool_ops = {
893 .get_eeprom_len = netxen_nic_get_eeprom_len, 951 .get_eeprom_len = netxen_nic_get_eeprom_len,
894 .get_eeprom = netxen_nic_get_eeprom, 952 .get_eeprom = netxen_nic_get_eeprom,
895 .get_ringparam = netxen_nic_get_ringparam, 953 .get_ringparam = netxen_nic_get_ringparam,
954 .set_ringparam = netxen_nic_set_ringparam,
896 .get_pauseparam = netxen_nic_get_pauseparam, 955 .get_pauseparam = netxen_nic_get_pauseparam,
897 .set_pauseparam = netxen_nic_set_pauseparam, 956 .set_pauseparam = netxen_nic_set_pauseparam,
898 .set_tx_csum = ethtool_op_set_tx_csum, 957 .set_tx_csum = ethtool_op_set_tx_csum,
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index 824103675648..a7328584a21a 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -852,7 +852,7 @@ enum {
852#define NX_PEG_TUNE_MN_PRESENT 0x1 852#define NX_PEG_TUNE_MN_PRESENT 0x1
853#define NX_PEG_TUNE_CAPABILITY (NETXEN_CAM_RAM(0x02c)) 853#define NX_PEG_TUNE_CAPABILITY (NETXEN_CAM_RAM(0x02c))
854 854
855#define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14) 855#define NETXEN_DMA_WATCHDOG_CTRL (NETXEN_CAM_RAM(0x14))
856#define NETXEN_PEG_ALIVE_COUNTER (NETXEN_CAM_RAM(0xb0)) 856#define NETXEN_PEG_ALIVE_COUNTER (NETXEN_CAM_RAM(0xb0))
857 857
858#define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC))) 858#define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC)))
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index b9123d445c96..ddb9deb12b33 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -706,6 +706,30 @@ int netxen_config_rss(struct netxen_adapter *adapter, int enable)
706 return rv; 706 return rv;
707} 707}
708 708
709int netxen_config_ipaddr(struct netxen_adapter *adapter, u32 ip, int cmd)
710{
711 nx_nic_req_t req;
712 u64 word;
713 int rv;
714
715 memset(&req, 0, sizeof(nx_nic_req_t));
716 req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23);
717
718 word = NX_NIC_H2C_OPCODE_CONFIG_IPADDR | ((u64)adapter->portnum << 16);
719 req.req_hdr = cpu_to_le64(word);
720
721 req.words[0] = cpu_to_le64(cmd);
722 req.words[1] = cpu_to_le64(ip);
723
724 rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
725 if (rv != 0) {
726 printk(KERN_ERR "%s: could not notify %s IP 0x%x reuqest\n",
727 adapter->netdev->name,
728 (cmd == NX_IP_UP) ? "Add" : "Remove", ip);
729 }
730 return rv;
731}
732
709int netxen_linkevent_request(struct netxen_adapter *adapter, int enable) 733int netxen_linkevent_request(struct netxen_adapter *adapter, int enable)
710{ 734{
711 nx_nic_req_t req; 735 nx_nic_req_t req;
@@ -2021,7 +2045,6 @@ void netxen_nic_get_firmware_info(struct netxen_adapter *adapter)
2021 fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR); 2045 fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR);
2022 fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB); 2046 fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB);
2023 2047
2024 adapter->fw_major = fw_major;
2025 adapter->fw_version = NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build); 2048 adapter->fw_version = NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build);
2026 2049
2027 if (adapter->portnum == 0) { 2050 if (adapter->portnum == 0) {
@@ -2047,6 +2070,9 @@ void netxen_nic_get_firmware_info(struct netxen_adapter *adapter)
2047 dev_info(&pdev->dev, "firmware running in %s mode\n", 2070 dev_info(&pdev->dev, "firmware running in %s mode\n",
2048 adapter->ahw.cut_through ? "cut-through" : "legacy"); 2071 adapter->ahw.cut_through ? "cut-through" : "legacy");
2049 } 2072 }
2073
2074 if (adapter->fw_version >= NETXEN_VERSION_CODE(4, 0, 222))
2075 adapter->capabilities = NXRD32(adapter, CRB_FW_CAPABILITIES_1);
2050} 2076}
2051 2077
2052int 2078int
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 5d3343ef3d86..81253abbfa34 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -184,6 +184,13 @@ void netxen_free_sw_resources(struct netxen_adapter *adapter)
184 kfree(recv_ctx->rds_rings); 184 kfree(recv_ctx->rds_rings);
185 185
186skip_rds: 186skip_rds:
187 if (recv_ctx->sds_rings == NULL)
188 goto skip_sds;
189
190 for(ring = 0; ring < adapter->max_sds_rings; ring++)
191 recv_ctx->sds_rings[ring].consumer = 0;
192
193skip_sds:
187 if (adapter->tx_ring == NULL) 194 if (adapter->tx_ring == NULL)
188 return; 195 return;
189 196
@@ -247,9 +254,14 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
247 rds_ring->skb_size = 254 rds_ring->skb_size =
248 NX_CT_DEFAULT_RX_BUF_LEN; 255 NX_CT_DEFAULT_RX_BUF_LEN;
249 } else { 256 } else {
250 rds_ring->dma_size = RX_DMA_MAP_LEN; 257 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
258 rds_ring->dma_size =
259 NX_P3_RX_BUF_MAX_LEN;
260 else
261 rds_ring->dma_size =
262 NX_P2_RX_BUF_MAX_LEN;
251 rds_ring->skb_size = 263 rds_ring->skb_size =
252 MAX_RX_BUFFER_LENGTH; 264 rds_ring->dma_size + NET_IP_ALIGN;
253 } 265 }
254 break; 266 break;
255 267
@@ -267,8 +279,8 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
267 279
268 case RCV_RING_LRO: 280 case RCV_RING_LRO:
269 rds_ring->num_desc = adapter->num_lro_rxd; 281 rds_ring->num_desc = adapter->num_lro_rxd;
270 rds_ring->dma_size = RX_LRO_DMA_MAP_LEN; 282 rds_ring->dma_size = NX_RX_LRO_BUFFER_LENGTH;
271 rds_ring->skb_size = MAX_RX_LRO_BUFFER_LENGTH; 283 rds_ring->skb_size = rds_ring->dma_size + NET_IP_ALIGN;
272 break; 284 break;
273 285
274 } 286 }
@@ -880,22 +892,10 @@ netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname)
880 return 0; 892 return 0;
881} 893}
882 894
883void netxen_request_firmware(struct netxen_adapter *adapter) 895static int
896netxen_p3_has_mn(struct netxen_adapter *adapter)
884{ 897{
885 u32 capability, flashed_ver; 898 u32 capability, flashed_ver;
886 u8 fw_type;
887 struct pci_dev *pdev = adapter->pdev;
888 int rc = 0;
889
890 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
891 fw_type = NX_P2_MN_ROMIMAGE;
892 goto request_fw;
893 } else {
894 fw_type = NX_P3_CT_ROMIMAGE;
895 goto request_fw;
896 }
897
898request_mn:
899 capability = 0; 899 capability = 0;
900 900
901 netxen_rom_fast_read(adapter, 901 netxen_rom_fast_read(adapter,
@@ -903,23 +903,35 @@ request_mn:
903 flashed_ver = NETXEN_DECODE_VERSION(flashed_ver); 903 flashed_ver = NETXEN_DECODE_VERSION(flashed_ver);
904 904
905 if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) { 905 if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) {
906
906 capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY); 907 capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY);
907 if (capability & NX_PEG_TUNE_MN_PRESENT) { 908 if (capability & NX_PEG_TUNE_MN_PRESENT)
908 fw_type = NX_P3_MN_ROMIMAGE; 909 return 1;
909 goto request_fw;
910 }
911 } 910 }
911 return 0;
912}
912 913
913 fw_type = NX_FLASH_ROMIMAGE; 914void netxen_request_firmware(struct netxen_adapter *adapter)
914 adapter->fw = NULL; 915{
915 goto done; 916 u8 fw_type;
917 struct pci_dev *pdev = adapter->pdev;
918 int rc = 0;
919
920 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
921 fw_type = NX_P2_MN_ROMIMAGE;
922 goto request_fw;
923 }
924
925 fw_type = netxen_p3_has_mn(adapter) ?
926 NX_P3_MN_ROMIMAGE : NX_P3_CT_ROMIMAGE;
916 927
917request_fw: 928request_fw:
918 rc = request_firmware(&adapter->fw, fw_name[fw_type], &pdev->dev); 929 rc = request_firmware(&adapter->fw, fw_name[fw_type], &pdev->dev);
919 if (rc != 0) { 930 if (rc != 0) {
920 if (fw_type == NX_P3_CT_ROMIMAGE) { 931 if (fw_type == NX_P3_MN_ROMIMAGE) {
921 msleep(1); 932 msleep(1);
922 goto request_mn; 933 fw_type = NX_P3_CT_ROMIMAGE;
934 goto request_fw;
923 } 935 }
924 936
925 fw_type = NX_FLASH_ROMIMAGE; 937 fw_type = NX_FLASH_ROMIMAGE;
@@ -931,9 +943,10 @@ request_fw:
931 if (rc != 0) { 943 if (rc != 0) {
932 release_firmware(adapter->fw); 944 release_firmware(adapter->fw);
933 945
934 if (fw_type == NX_P3_CT_ROMIMAGE) { 946 if (fw_type == NX_P3_MN_ROMIMAGE) {
935 msleep(1); 947 msleep(1);
936 goto request_mn; 948 fw_type = NX_P3_CT_ROMIMAGE;
949 goto request_fw;
937 } 950 }
938 951
939 fw_type = NX_FLASH_ROMIMAGE; 952 fw_type = NX_FLASH_ROMIMAGE;
@@ -953,19 +966,20 @@ netxen_release_firmware(struct netxen_adapter *adapter)
953 release_firmware(adapter->fw); 966 release_firmware(adapter->fw);
954} 967}
955 968
956int netxen_initialize_adapter_offload(struct netxen_adapter *adapter) 969int netxen_init_dummy_dma(struct netxen_adapter *adapter)
957{ 970{
958 uint64_t addr; 971 u64 addr;
959 uint32_t hi; 972 u32 hi, lo;
960 uint32_t lo; 973
974 if (!NX_IS_REVISION_P2(adapter->ahw.revision_id))
975 return 0;
961 976
962 adapter->dummy_dma.addr = 977 adapter->dummy_dma.addr = pci_alloc_consistent(adapter->pdev,
963 pci_alloc_consistent(adapter->pdev,
964 NETXEN_HOST_DUMMY_DMA_SIZE, 978 NETXEN_HOST_DUMMY_DMA_SIZE,
965 &adapter->dummy_dma.phys_addr); 979 &adapter->dummy_dma.phys_addr);
966 if (adapter->dummy_dma.addr == NULL) { 980 if (adapter->dummy_dma.addr == NULL) {
967 printk("%s: ERROR: Could not allocate dummy DMA memory\n", 981 dev_err(&adapter->pdev->dev,
968 __func__); 982 "ERROR: Could not allocate dummy DMA memory\n");
969 return -ENOMEM; 983 return -ENOMEM;
970 } 984 }
971 985
@@ -976,29 +990,41 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
976 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_HI, hi); 990 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_HI, hi);
977 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_LO, lo); 991 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_LO, lo);
978 992
979 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
980 uint32_t temp = 0;
981 NXWR32(adapter, CRB_HOST_DUMMY_BUF, temp);
982 }
983
984 return 0; 993 return 0;
985} 994}
986 995
987void netxen_free_adapter_offload(struct netxen_adapter *adapter) 996/*
997 * NetXen DMA watchdog control:
998 *
999 * Bit 0 : enabled => R/O: 1 watchdog active, 0 inactive
1000 * Bit 1 : disable_request => 1 req disable dma watchdog
1001 * Bit 2 : enable_request => 1 req enable dma watchdog
1002 * Bit 3-31 : unused
1003 */
1004void netxen_free_dummy_dma(struct netxen_adapter *adapter)
988{ 1005{
989 int i = 100; 1006 int i = 100;
1007 u32 ctrl;
1008
1009 if (!NX_IS_REVISION_P2(adapter->ahw.revision_id))
1010 return;
990 1011
991 if (!adapter->dummy_dma.addr) 1012 if (!adapter->dummy_dma.addr)
992 return; 1013 return;
993 1014
994 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { 1015 ctrl = NXRD32(adapter, NETXEN_DMA_WATCHDOG_CTRL);
995 do { 1016 if ((ctrl & 0x1) != 0) {
996 if (dma_watchdog_shutdown_request(adapter) == 1) 1017 NXWR32(adapter, NETXEN_DMA_WATCHDOG_CTRL, (ctrl | 0x2));
997 break; 1018
1019 while ((ctrl & 0x1) != 0) {
1020
998 msleep(50); 1021 msleep(50);
999 if (dma_watchdog_shutdown_poll_result(adapter) == 1) 1022
1023 ctrl = NXRD32(adapter, NETXEN_DMA_WATCHDOG_CTRL);
1024
1025 if (--i == 0)
1000 break; 1026 break;
1001 } while (--i); 1027 };
1002 } 1028 }
1003 1029
1004 if (i) { 1030 if (i) {
@@ -1007,10 +1033,8 @@ void netxen_free_adapter_offload(struct netxen_adapter *adapter)
1007 adapter->dummy_dma.addr, 1033 adapter->dummy_dma.addr,
1008 adapter->dummy_dma.phys_addr); 1034 adapter->dummy_dma.phys_addr);
1009 adapter->dummy_dma.addr = NULL; 1035 adapter->dummy_dma.addr = NULL;
1010 } else { 1036 } else
1011 printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", 1037 dev_err(&adapter->pdev->dev, "dma_watchdog_shutdown failed\n");
1012 adapter->netdev->name);
1013 }
1014} 1038}
1015 1039
1016int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val) 1040int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val)
@@ -1083,10 +1107,6 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
1083 NXWR32(adapter, CRB_MPORT_MODE, MPORT_MULTI_FUNCTION_MODE); 1107 NXWR32(adapter, CRB_MPORT_MODE, MPORT_MULTI_FUNCTION_MODE);
1084 NXWR32(adapter, CRB_CMDPEG_STATE, PHAN_INITIALIZE_ACK); 1108 NXWR32(adapter, CRB_CMDPEG_STATE, PHAN_INITIALIZE_ACK);
1085 1109
1086 if (adapter->fw_version >= NETXEN_VERSION_CODE(4, 0, 222)) {
1087 adapter->capabilities = NXRD32(adapter, CRB_FW_CAPABILITIES_1);
1088 }
1089
1090 return err; 1110 return err;
1091} 1111}
1092 1112
@@ -1296,6 +1316,7 @@ netxen_process_rcv_ring(struct nx_host_sds_ring *sds_ring, int max)
1296 switch (opcode) { 1316 switch (opcode) {
1297 case NETXEN_NIC_RXPKT_DESC: 1317 case NETXEN_NIC_RXPKT_DESC:
1298 case NETXEN_OLD_RXPKT_DESC: 1318 case NETXEN_OLD_RXPKT_DESC:
1319 case NETXEN_NIC_SYN_OFFLOAD:
1299 break; 1320 break;
1300 case NETXEN_NIC_RESPONSE_DESC: 1321 case NETXEN_NIC_RESPONSE_DESC:
1301 netxen_handle_fw_message(desc_cnt, consumer, sds_ring); 1322 netxen_handle_fw_message(desc_cnt, consumer, sds_ring);
@@ -1468,7 +1489,7 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
1468 NXWR32(adapter, rds_ring->crb_rcv_producer, 1489 NXWR32(adapter, rds_ring->crb_rcv_producer,
1469 (producer-1) & (rds_ring->num_desc-1)); 1490 (producer-1) & (rds_ring->num_desc-1));
1470 1491
1471 if (adapter->fw_major < 4) { 1492 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
1472 /* 1493 /*
1473 * Write a doorbell msg to tell phanmon of change in 1494 * Write a doorbell msg to tell phanmon of change in
1474 * receive ring producer 1495 * receive ring producer
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 637ac8b89bac..40549a0e9ff0 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -39,6 +39,7 @@
39#include <linux/if_vlan.h> 39#include <linux/if_vlan.h>
40#include <net/ip.h> 40#include <net/ip.h>
41#include <linux/ipv6.h> 41#include <linux/ipv6.h>
42#include <linux/inetdevice.h>
42 43
43MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); 44MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver");
44MODULE_LICENSE("GPL"); 45MODULE_LICENSE("GPL");
@@ -65,7 +66,7 @@ static int netxen_nic_open(struct net_device *netdev);
65static int netxen_nic_close(struct net_device *netdev); 66static int netxen_nic_close(struct net_device *netdev);
66static int netxen_nic_xmit_frame(struct sk_buff *, struct net_device *); 67static int netxen_nic_xmit_frame(struct sk_buff *, struct net_device *);
67static void netxen_tx_timeout(struct net_device *netdev); 68static void netxen_tx_timeout(struct net_device *netdev);
68static void netxen_tx_timeout_task(struct work_struct *work); 69static void netxen_reset_task(struct work_struct *work);
69static void netxen_watchdog(unsigned long); 70static void netxen_watchdog(unsigned long);
70static int netxen_nic_poll(struct napi_struct *napi, int budget); 71static int netxen_nic_poll(struct napi_struct *napi, int budget);
71#ifdef CONFIG_NET_POLL_CONTROLLER 72#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -181,7 +182,7 @@ netxen_napi_add(struct netxen_adapter *adapter, struct net_device *netdev)
181 struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; 182 struct netxen_recv_context *recv_ctx = &adapter->recv_ctx;
182 183
183 if (netxen_alloc_sds_rings(recv_ctx, adapter->max_sds_rings)) 184 if (netxen_alloc_sds_rings(recv_ctx, adapter->max_sds_rings))
184 return 1; 185 return -ENOMEM;
185 186
186 for (ring = 0; ring < adapter->max_sds_rings; ring++) { 187 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
187 sds_ring = &recv_ctx->sds_rings[ring]; 188 sds_ring = &recv_ctx->sds_rings[ring];
@@ -282,12 +283,16 @@ nx_update_dma_mask(struct netxen_adapter *adapter)
282 return 0; 283 return 0;
283} 284}
284 285
285static void netxen_check_options(struct netxen_adapter *adapter) 286static void
287netxen_check_options(struct netxen_adapter *adapter)
286{ 288{
287 if (adapter->ahw.port_type == NETXEN_NIC_XGBE) 289 if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
288 adapter->num_rxd = MAX_RCV_DESCRIPTORS_10G; 290 adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_10G;
289 else if (adapter->ahw.port_type == NETXEN_NIC_GBE) 291 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G;
290 adapter->num_rxd = MAX_RCV_DESCRIPTORS_1G; 292 } else if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
293 adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_1G;
294 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G;
295 }
291 296
292 adapter->msix_supported = 0; 297 adapter->msix_supported = 0;
293 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { 298 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
@@ -305,11 +310,15 @@ static void netxen_check_options(struct netxen_adapter *adapter)
305 } 310 }
306 } 311 }
307 312
308 adapter->num_txd = MAX_CMD_DESCRIPTORS_HOST; 313 adapter->num_txd = MAX_CMD_DESCRIPTORS;
309 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS;
310 adapter->num_lro_rxd = MAX_LRO_RCV_DESCRIPTORS;
311 314
312 return; 315 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
316 adapter->num_lro_rxd = MAX_LRO_RCV_DESCRIPTORS;
317 adapter->max_rds_rings = 3;
318 } else {
319 adapter->num_lro_rxd = 0;
320 adapter->max_rds_rings = 2;
321 }
313} 322}
314 323
315static int 324static int
@@ -744,7 +753,7 @@ netxen_start_firmware(struct netxen_adapter *adapter, int request_fw)
744 753
745 } 754 }
746 755
747 err = netxen_initialize_adapter_offload(adapter); 756 err = netxen_init_dummy_dma(adapter);
748 if (err) 757 if (err)
749 return err; 758 return err;
750 759
@@ -760,10 +769,14 @@ wait_init:
760 /* Handshake with the card before we register the devices. */ 769 /* Handshake with the card before we register the devices. */
761 err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 770 err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
762 if (err) { 771 if (err) {
763 netxen_free_adapter_offload(adapter); 772 netxen_free_dummy_dma(adapter);
764 return err; 773 return err;
765 } 774 }
766 775
776 nx_update_dma_mask(adapter);
777
778 netxen_nic_get_firmware_info(adapter);
779
767 return 0; 780 return 0;
768} 781}
769 782
@@ -814,6 +827,20 @@ netxen_nic_free_irq(struct netxen_adapter *adapter)
814 } 827 }
815} 828}
816 829
830static void
831netxen_nic_init_coalesce_defaults(struct netxen_adapter *adapter)
832{
833 adapter->coal.flags = NETXEN_NIC_INTR_DEFAULT;
834 adapter->coal.normal.data.rx_time_us =
835 NETXEN_DEFAULT_INTR_COALESCE_RX_TIME_US;
836 adapter->coal.normal.data.rx_packets =
837 NETXEN_DEFAULT_INTR_COALESCE_RX_PACKETS;
838 adapter->coal.normal.data.tx_time_us =
839 NETXEN_DEFAULT_INTR_COALESCE_TX_TIME_US;
840 adapter->coal.normal.data.tx_packets =
841 NETXEN_DEFAULT_INTR_COALESCE_TX_PACKETS;
842}
843
817static int 844static int
818netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) 845netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev)
819{ 846{
@@ -836,6 +863,9 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev)
836 if (adapter->max_sds_rings > 1) 863 if (adapter->max_sds_rings > 1)
837 netxen_config_rss(adapter, 1); 864 netxen_config_rss(adapter, 1);
838 865
866 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
867 netxen_config_intr_coalesce(adapter);
868
839 netxen_napi_enable(adapter); 869 netxen_napi_enable(adapter);
840 870
841 if (adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION) 871 if (adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION)
@@ -880,17 +910,15 @@ netxen_nic_attach(struct netxen_adapter *adapter)
880 struct nx_host_rds_ring *rds_ring; 910 struct nx_host_rds_ring *rds_ring;
881 struct nx_host_tx_ring *tx_ring; 911 struct nx_host_tx_ring *tx_ring;
882 912
913 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC)
914 return 0;
915
883 err = netxen_init_firmware(adapter); 916 err = netxen_init_firmware(adapter);
884 if (err != 0) { 917 if (err != 0) {
885 printk(KERN_ERR "Failed to init firmware\n"); 918 printk(KERN_ERR "Failed to init firmware\n");
886 return -EIO; 919 return -EIO;
887 } 920 }
888 921
889 if (adapter->fw_major < 4)
890 adapter->max_rds_rings = 3;
891 else
892 adapter->max_rds_rings = 2;
893
894 err = netxen_alloc_sw_resources(adapter); 922 err = netxen_alloc_sw_resources(adapter);
895 if (err) { 923 if (err) {
896 printk(KERN_ERR "%s: Error in setting sw resources\n", 924 printk(KERN_ERR "%s: Error in setting sw resources\n",
@@ -907,7 +935,7 @@ netxen_nic_attach(struct netxen_adapter *adapter)
907 goto err_out_free_sw; 935 goto err_out_free_sw;
908 } 936 }
909 937
910 if (adapter->fw_major < 4) { 938 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
911 tx_ring = adapter->tx_ring; 939 tx_ring = adapter->tx_ring;
912 tx_ring->crb_cmd_producer = crb_cmd_producer[adapter->portnum]; 940 tx_ring->crb_cmd_producer = crb_cmd_producer[adapter->portnum];
913 tx_ring->crb_cmd_consumer = crb_cmd_consumer[adapter->portnum]; 941 tx_ring->crb_cmd_consumer = crb_cmd_consumer[adapter->portnum];
@@ -931,6 +959,9 @@ netxen_nic_attach(struct netxen_adapter *adapter)
931 goto err_out_free_rxbuf; 959 goto err_out_free_rxbuf;
932 } 960 }
933 961
962 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
963 netxen_nic_init_coalesce_defaults(adapter);
964
934 adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; 965 adapter->is_up = NETXEN_ADAPTER_UP_MAGIC;
935 return 0; 966 return 0;
936 967
@@ -945,6 +976,9 @@ err_out_free_sw:
945static void 976static void
946netxen_nic_detach(struct netxen_adapter *adapter) 977netxen_nic_detach(struct netxen_adapter *adapter)
947{ 978{
979 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
980 return;
981
948 netxen_free_hw_resources(adapter); 982 netxen_free_hw_resources(adapter);
949 netxen_release_rx_buffers(adapter); 983 netxen_release_rx_buffers(adapter);
950 netxen_nic_free_irq(adapter); 984 netxen_nic_free_irq(adapter);
@@ -953,6 +987,95 @@ netxen_nic_detach(struct netxen_adapter *adapter)
953 adapter->is_up = 0; 987 adapter->is_up = 0;
954} 988}
955 989
990int
991netxen_nic_reset_context(struct netxen_adapter *adapter)
992{
993 int err = 0;
994 struct net_device *netdev = adapter->netdev;
995
996 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
997
998 if (netif_running(netdev))
999 netxen_nic_down(adapter, netdev);
1000
1001 netxen_nic_detach(adapter);
1002
1003 err = netxen_nic_attach(adapter);
1004 if (err)
1005 goto done;
1006
1007 if (netif_running(netdev))
1008 err = netxen_nic_up(adapter, netdev);
1009 }
1010done:
1011 return err;
1012}
1013
1014static int
1015netxen_setup_netdev(struct netxen_adapter *adapter,
1016 struct net_device *netdev)
1017{
1018 int err = 0;
1019 struct pci_dev *pdev = adapter->pdev;
1020
1021 adapter->rx_csum = 1;
1022 adapter->mc_enabled = 0;
1023 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
1024 adapter->max_mc_count = 38;
1025 else
1026 adapter->max_mc_count = 16;
1027
1028 netdev->netdev_ops = &netxen_netdev_ops;
1029 netdev->watchdog_timeo = 2*HZ;
1030
1031 netxen_nic_change_mtu(netdev, netdev->mtu);
1032
1033 SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops);
1034
1035 netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
1036 netdev->features |= (NETIF_F_GRO);
1037 netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
1038
1039 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
1040 netdev->features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
1041 netdev->vlan_features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
1042 }
1043
1044 if (adapter->pci_using_dac) {
1045 netdev->features |= NETIF_F_HIGHDMA;
1046 netdev->vlan_features |= NETIF_F_HIGHDMA;
1047 }
1048
1049 if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX)
1050 netdev->features |= (NETIF_F_HW_VLAN_TX);
1051
1052 netdev->irq = adapter->msix_entries[0].vector;
1053
1054 err = netxen_napi_add(adapter, netdev);
1055 if (err)
1056 return err;
1057
1058 init_timer(&adapter->watchdog_timer);
1059 adapter->watchdog_timer.function = &netxen_watchdog;
1060 adapter->watchdog_timer.data = (unsigned long)adapter;
1061 INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task);
1062 INIT_WORK(&adapter->tx_timeout_task, netxen_reset_task);
1063
1064 if (netxen_read_mac_addr(adapter))
1065 dev_warn(&pdev->dev, "failed to read mac addr\n");
1066
1067 netif_carrier_off(netdev);
1068 netif_stop_queue(netdev);
1069
1070 err = register_netdev(netdev);
1071 if (err) {
1072 dev_err(&pdev->dev, "failed to register net device\n");
1073 return err;
1074 }
1075
1076 return 0;
1077}
1078
956static int __devinit 1079static int __devinit
957netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1080netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
958{ 1081{
@@ -990,9 +1113,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
990 1113
991 netdev = alloc_etherdev(sizeof(struct netxen_adapter)); 1114 netdev = alloc_etherdev(sizeof(struct netxen_adapter));
992 if(!netdev) { 1115 if(!netdev) {
993 printk(KERN_ERR"%s: Failed to allocate memory for the " 1116 dev_err(&pdev->dev, "failed to allocate net_device\n");
994 "device block.Check system memory resource" 1117 err = -ENOMEM;
995 " usage.\n", netxen_nic_driver_name);
996 goto err_out_free_res; 1118 goto err_out_free_res;
997 } 1119 }
998 1120
@@ -1020,38 +1142,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1020 1142
1021 /* This will be reset for mezz cards */ 1143 /* This will be reset for mezz cards */
1022 adapter->portnum = pci_func_id; 1144 adapter->portnum = pci_func_id;
1023 adapter->rx_csum = 1;
1024 adapter->mc_enabled = 0;
1025 if (NX_IS_REVISION_P3(revision_id))
1026 adapter->max_mc_count = 38;
1027 else
1028 adapter->max_mc_count = 16;
1029
1030 netdev->netdev_ops = &netxen_netdev_ops;
1031 netdev->watchdog_timeo = 2*HZ;
1032
1033 netxen_nic_change_mtu(netdev, netdev->mtu);
1034 1145
1035 SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); 1146 err = netxen_nic_get_board_info(adapter);
1036 1147 if (err) {
1037 netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO); 1148 dev_err(&pdev->dev, "Error getting board config info.\n");
1038 netdev->features |= (NETIF_F_GRO);
1039 netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
1040
1041 if (NX_IS_REVISION_P3(revision_id)) {
1042 netdev->features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
1043 netdev->vlan_features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
1044 }
1045
1046 if (adapter->pci_using_dac) {
1047 netdev->features |= NETIF_F_HIGHDMA;
1048 netdev->vlan_features |= NETIF_F_HIGHDMA;
1049 }
1050
1051 if (netxen_nic_get_board_info(adapter) != 0) {
1052 printk("%s: Error getting board config info.\n",
1053 netxen_nic_driver_name);
1054 err = -EIO;
1055 goto err_out_iounmap; 1149 goto err_out_iounmap;
1056 } 1150 }
1057 1151
@@ -1072,15 +1166,11 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1072 if (err) 1166 if (err)
1073 goto err_out_iounmap; 1167 goto err_out_iounmap;
1074 1168
1075 nx_update_dma_mask(adapter);
1076
1077 netxen_nic_get_firmware_info(adapter);
1078
1079 /* 1169 /*
1080 * See if the firmware gave us a virtual-physical port mapping. 1170 * See if the firmware gave us a virtual-physical port mapping.
1081 */ 1171 */
1082 adapter->physical_port = adapter->portnum; 1172 adapter->physical_port = adapter->portnum;
1083 if (adapter->fw_major < 4) { 1173 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
1084 i = NXRD32(adapter, CRB_V2P(adapter->portnum)); 1174 i = NXRD32(adapter, CRB_V2P(adapter->portnum));
1085 if (i != 0x55555555) 1175 if (i != 0x55555555)
1086 adapter->physical_port = i; 1176 adapter->physical_port = i;
@@ -1090,31 +1180,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1090 1180
1091 netxen_setup_intr(adapter); 1181 netxen_setup_intr(adapter);
1092 1182
1093 netdev->irq = adapter->msix_entries[0].vector; 1183 err = netxen_setup_netdev(adapter, netdev);
1094
1095 if (netxen_napi_add(adapter, netdev))
1096 goto err_out_disable_msi;
1097
1098 init_timer(&adapter->watchdog_timer);
1099 adapter->watchdog_timer.function = &netxen_watchdog;
1100 adapter->watchdog_timer.data = (unsigned long)adapter;
1101 INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task);
1102 INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task);
1103
1104 err = netxen_read_mac_addr(adapter);
1105 if (err) 1184 if (err)
1106 dev_warn(&pdev->dev, "failed to read mac addr\n");
1107
1108 netif_carrier_off(netdev);
1109 netif_stop_queue(netdev);
1110
1111 if ((err = register_netdev(netdev))) {
1112 printk(KERN_ERR "%s: register_netdev failed port #%d"
1113 " aborting\n", netxen_nic_driver_name,
1114 adapter->portnum);
1115 err = -EIO;
1116 goto err_out_disable_msi; 1185 goto err_out_disable_msi;
1117 }
1118 1186
1119 pci_set_drvdata(pdev, adapter); 1187 pci_set_drvdata(pdev, adapter);
1120 1188
@@ -1134,7 +1202,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1134err_out_disable_msi: 1202err_out_disable_msi:
1135 netxen_teardown_intr(adapter); 1203 netxen_teardown_intr(adapter);
1136 1204
1137 netxen_free_adapter_offload(adapter); 1205 netxen_free_dummy_dma(adapter);
1138 1206
1139err_out_iounmap: 1207err_out_iounmap:
1140 netxen_cleanup_pci_map(adapter); 1208 netxen_cleanup_pci_map(adapter);
@@ -1164,12 +1232,10 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
1164 1232
1165 unregister_netdev(netdev); 1233 unregister_netdev(netdev);
1166 1234
1167 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 1235 netxen_nic_detach(adapter);
1168 netxen_nic_detach(adapter);
1169 }
1170 1236
1171 if (adapter->portnum == 0) 1237 if (adapter->portnum == 0)
1172 netxen_free_adapter_offload(adapter); 1238 netxen_free_dummy_dma(adapter);
1173 1239
1174 netxen_teardown_intr(adapter); 1240 netxen_teardown_intr(adapter);
1175 netxen_free_sds_rings(&adapter->recv_ctx); 1241 netxen_free_sds_rings(&adapter->recv_ctx);
@@ -1198,8 +1264,7 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
1198 if (netif_running(netdev)) 1264 if (netif_running(netdev))
1199 netxen_nic_down(adapter, netdev); 1265 netxen_nic_down(adapter, netdev);
1200 1266
1201 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) 1267 netxen_nic_detach(adapter);
1202 netxen_nic_detach(adapter);
1203 1268
1204 pci_save_state(pdev); 1269 pci_save_state(pdev);
1205 1270
@@ -1260,11 +1325,9 @@ static int netxen_nic_open(struct net_device *netdev)
1260 if (adapter->driver_mismatch) 1325 if (adapter->driver_mismatch)
1261 return -EIO; 1326 return -EIO;
1262 1327
1263 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) { 1328 err = netxen_nic_attach(adapter);
1264 err = netxen_nic_attach(adapter); 1329 if (err)
1265 if (err) 1330 return err;
1266 return err;
1267 }
1268 1331
1269 err = netxen_nic_up(adapter, netdev); 1332 err = netxen_nic_up(adapter, netdev);
1270 if (err) 1333 if (err)
@@ -1290,30 +1353,52 @@ static int netxen_nic_close(struct net_device *netdev)
1290 return 0; 1353 return 0;
1291} 1354}
1292 1355
1293static bool netxen_tso_check(struct net_device *netdev, 1356static void
1294 struct cmd_desc_type0 *desc, struct sk_buff *skb) 1357netxen_tso_check(struct net_device *netdev,
1358 struct nx_host_tx_ring *tx_ring,
1359 struct cmd_desc_type0 *first_desc,
1360 struct sk_buff *skb)
1295{ 1361{
1296 bool tso = false;
1297 u8 opcode = TX_ETHER_PKT; 1362 u8 opcode = TX_ETHER_PKT;
1298 __be16 protocol = skb->protocol; 1363 __be16 protocol = skb->protocol;
1299 u16 flags = 0; 1364 u16 flags = 0, vid = 0;
1365 u32 producer;
1366 int copied, offset, copy_len, hdr_len = 0, tso = 0, vlan_oob = 0;
1367 struct cmd_desc_type0 *hwdesc;
1368 struct vlan_ethhdr *vh;
1300 1369
1301 if (protocol == cpu_to_be16(ETH_P_8021Q)) { 1370 if (protocol == cpu_to_be16(ETH_P_8021Q)) {
1302 struct vlan_ethhdr *vh = (struct vlan_ethhdr *)skb->data; 1371
1372 vh = (struct vlan_ethhdr *)skb->data;
1303 protocol = vh->h_vlan_encapsulated_proto; 1373 protocol = vh->h_vlan_encapsulated_proto;
1304 flags = FLAGS_VLAN_TAGGED; 1374 flags = FLAGS_VLAN_TAGGED;
1375
1376 } else if (vlan_tx_tag_present(skb)) {
1377
1378 flags = FLAGS_VLAN_OOB;
1379 vid = vlan_tx_tag_get(skb);
1380 netxen_set_tx_vlan_tci(first_desc, vid);
1381 vlan_oob = 1;
1305 } 1382 }
1306 1383
1307 if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && 1384 if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) &&
1308 skb_shinfo(skb)->gso_size > 0) { 1385 skb_shinfo(skb)->gso_size > 0) {
1309 1386
1310 desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); 1387 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
1311 desc->total_hdr_length = 1388
1312 skb_transport_offset(skb) + tcp_hdrlen(skb); 1389 first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
1390 first_desc->total_hdr_length = hdr_len;
1391 if (vlan_oob) {
1392 first_desc->total_hdr_length += VLAN_HLEN;
1393 first_desc->tcp_hdr_offset = VLAN_HLEN;
1394 first_desc->ip_hdr_offset = VLAN_HLEN;
1395 /* Only in case of TSO on vlan device */
1396 flags |= FLAGS_VLAN_TAGGED;
1397 }
1313 1398
1314 opcode = (protocol == cpu_to_be16(ETH_P_IPV6)) ? 1399 opcode = (protocol == cpu_to_be16(ETH_P_IPV6)) ?
1315 TX_TCP_LSO6 : TX_TCP_LSO; 1400 TX_TCP_LSO6 : TX_TCP_LSO;
1316 tso = true; 1401 tso = 1;
1317 1402
1318 } else if (skb->ip_summed == CHECKSUM_PARTIAL) { 1403 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
1319 u8 l4proto; 1404 u8 l4proto;
@@ -1334,10 +1419,62 @@ static bool netxen_tso_check(struct net_device *netdev,
1334 opcode = TX_UDPV6_PKT; 1419 opcode = TX_UDPV6_PKT;
1335 } 1420 }
1336 } 1421 }
1337 desc->tcp_hdr_offset = skb_transport_offset(skb); 1422
1338 desc->ip_hdr_offset = skb_network_offset(skb); 1423 first_desc->tcp_hdr_offset += skb_transport_offset(skb);
1339 netxen_set_tx_flags_opcode(desc, flags, opcode); 1424 first_desc->ip_hdr_offset += skb_network_offset(skb);
1340 return tso; 1425 netxen_set_tx_flags_opcode(first_desc, flags, opcode);
1426
1427 if (!tso)
1428 return;
1429
1430 /* For LSO, we need to copy the MAC/IP/TCP headers into
1431 * the descriptor ring
1432 */
1433 producer = tx_ring->producer;
1434 copied = 0;
1435 offset = 2;
1436
1437 if (vlan_oob) {
1438 /* Create a TSO vlan header template for firmware */
1439
1440 hwdesc = &tx_ring->desc_head[producer];
1441 tx_ring->cmd_buf_arr[producer].skb = NULL;
1442
1443 copy_len = min((int)sizeof(struct cmd_desc_type0) - offset,
1444 hdr_len + VLAN_HLEN);
1445
1446 vh = (struct vlan_ethhdr *)((char *)hwdesc + 2);
1447 skb_copy_from_linear_data(skb, vh, 12);
1448 vh->h_vlan_proto = htons(ETH_P_8021Q);
1449 vh->h_vlan_TCI = htons(vid);
1450 skb_copy_from_linear_data_offset(skb, 12,
1451 (char *)vh + 16, copy_len - 16);
1452
1453 copied = copy_len;
1454 offset = 0;
1455
1456 producer = get_next_index(producer, tx_ring->num_desc);
1457 }
1458
1459 while (copied < hdr_len) {
1460
1461 copy_len = min((int)sizeof(struct cmd_desc_type0) - offset,
1462 (hdr_len - copied));
1463
1464 hwdesc = &tx_ring->desc_head[producer];
1465 tx_ring->cmd_buf_arr[producer].skb = NULL;
1466
1467 skb_copy_from_linear_data_offset(skb, copied,
1468 (char *)hwdesc + offset, copy_len);
1469
1470 copied += copy_len;
1471 offset = 0;
1472
1473 producer = get_next_index(producer, tx_ring->num_desc);
1474 }
1475
1476 tx_ring->producer = producer;
1477 barrier();
1341} 1478}
1342 1479
1343static void 1480static void
@@ -1361,9 +1498,8 @@ netxen_clean_tx_dma_mapping(struct pci_dev *pdev,
1361static inline void 1498static inline void
1362netxen_clear_cmddesc(u64 *desc) 1499netxen_clear_cmddesc(u64 *desc)
1363{ 1500{
1364 int i; 1501 desc[0] = 0ULL;
1365 for (i = 0; i < 8; i++) 1502 desc[2] = 0ULL;
1366 desc[i] = 0ULL;
1367} 1503}
1368 1504
1369static int 1505static int
@@ -1371,18 +1507,18 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1371{ 1507{
1372 struct netxen_adapter *adapter = netdev_priv(netdev); 1508 struct netxen_adapter *adapter = netdev_priv(netdev);
1373 struct nx_host_tx_ring *tx_ring = adapter->tx_ring; 1509 struct nx_host_tx_ring *tx_ring = adapter->tx_ring;
1374 unsigned int first_seg_len = skb->len - skb->data_len; 1510 struct skb_frag_struct *frag;
1375 struct netxen_cmd_buffer *pbuf; 1511 struct netxen_cmd_buffer *pbuf;
1376 struct netxen_skb_frag *buffrag; 1512 struct netxen_skb_frag *buffrag;
1377 struct cmd_desc_type0 *hwdesc; 1513 struct cmd_desc_type0 *hwdesc, *first_desc;
1378 struct pci_dev *pdev = adapter->pdev; 1514 struct pci_dev *pdev;
1379 dma_addr_t temp_dma; 1515 dma_addr_t temp_dma;
1380 int i, k; 1516 int i, k;
1517 unsigned long offset;
1381 1518
1382 u32 producer; 1519 u32 producer;
1383 int frag_count, no_of_desc; 1520 int len, frag_count, no_of_desc;
1384 u32 num_txd = tx_ring->num_desc; 1521 u32 num_txd = tx_ring->num_desc;
1385 bool is_tso = false;
1386 1522
1387 frag_count = skb_shinfo(skb)->nr_frags + 1; 1523 frag_count = skb_shinfo(skb)->nr_frags + 1;
1388 1524
@@ -1396,32 +1532,30 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1396 1532
1397 producer = tx_ring->producer; 1533 producer = tx_ring->producer;
1398 1534
1399 hwdesc = &tx_ring->desc_head[producer]; 1535 pdev = adapter->pdev;
1400 netxen_clear_cmddesc((u64 *)hwdesc); 1536 len = skb->len - skb->data_len;
1401 pbuf = &tx_ring->cmd_buf_arr[producer];
1402 1537
1403 is_tso = netxen_tso_check(netdev, hwdesc, skb); 1538 temp_dma = pci_map_single(pdev, skb->data, len, PCI_DMA_TODEVICE);
1539 if (pci_dma_mapping_error(pdev, temp_dma))
1540 goto drop_packet;
1404 1541
1542 pbuf = &tx_ring->cmd_buf_arr[producer];
1405 pbuf->skb = skb; 1543 pbuf->skb = skb;
1406 pbuf->frag_count = frag_count; 1544 pbuf->frag_count = frag_count;
1407 buffrag = &pbuf->frag_array[0];
1408 temp_dma = pci_map_single(pdev, skb->data, first_seg_len,
1409 PCI_DMA_TODEVICE);
1410 if (pci_dma_mapping_error(pdev, temp_dma))
1411 goto drop_packet;
1412 1545
1546 buffrag = &pbuf->frag_array[0];
1413 buffrag->dma = temp_dma; 1547 buffrag->dma = temp_dma;
1414 buffrag->length = first_seg_len; 1548 buffrag->length = len;
1549
1550 first_desc = hwdesc = &tx_ring->desc_head[producer];
1551 netxen_clear_cmddesc((u64 *)hwdesc);
1415 netxen_set_tx_frags_len(hwdesc, frag_count, skb->len); 1552 netxen_set_tx_frags_len(hwdesc, frag_count, skb->len);
1416 netxen_set_tx_port(hwdesc, adapter->portnum); 1553 netxen_set_tx_port(hwdesc, adapter->portnum);
1417 1554
1418 hwdesc->buffer_length[0] = cpu_to_le16(first_seg_len); 1555 hwdesc->buffer_length[0] = cpu_to_le16(len);
1419 hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); 1556 hwdesc->addr_buffer1 = cpu_to_le64(temp_dma);
1420 1557
1421 for (i = 1, k = 1; i < frag_count; i++, k++) { 1558 for (i = 1, k = 1; i < frag_count; i++, k++) {
1422 struct skb_frag_struct *frag;
1423 int len, temp_len;
1424 unsigned long offset;
1425 1559
1426 /* move to next desc. if there is a need */ 1560 /* move to next desc. if there is a need */
1427 if ((i & 0x3) == 0) { 1561 if ((i & 0x3) == 0) {
@@ -1432,11 +1566,11 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1432 pbuf = &tx_ring->cmd_buf_arr[producer]; 1566 pbuf = &tx_ring->cmd_buf_arr[producer];
1433 pbuf->skb = NULL; 1567 pbuf->skb = NULL;
1434 } 1568 }
1569 buffrag = &pbuf->frag_array[i];
1435 frag = &skb_shinfo(skb)->frags[i - 1]; 1570 frag = &skb_shinfo(skb)->frags[i - 1];
1436 len = frag->size; 1571 len = frag->size;
1437 offset = frag->page_offset; 1572 offset = frag->page_offset;
1438 1573
1439 temp_len = len;
1440 temp_dma = pci_map_page(pdev, frag->page, offset, 1574 temp_dma = pci_map_page(pdev, frag->page, offset,
1441 len, PCI_DMA_TODEVICE); 1575 len, PCI_DMA_TODEVICE);
1442 if (pci_dma_mapping_error(pdev, temp_dma)) { 1576 if (pci_dma_mapping_error(pdev, temp_dma)) {
@@ -1444,11 +1578,10 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1444 goto drop_packet; 1578 goto drop_packet;
1445 } 1579 }
1446 1580
1447 buffrag++;
1448 buffrag->dma = temp_dma; 1581 buffrag->dma = temp_dma;
1449 buffrag->length = temp_len; 1582 buffrag->length = len;
1450 1583
1451 hwdesc->buffer_length[k] = cpu_to_le16(temp_len); 1584 hwdesc->buffer_length[k] = cpu_to_le16(len);
1452 switch (k) { 1585 switch (k) {
1453 case 0: 1586 case 0:
1454 hwdesc->addr_buffer1 = cpu_to_le64(temp_dma); 1587 hwdesc->addr_buffer1 = cpu_to_le64(temp_dma);
@@ -1463,53 +1596,14 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1463 hwdesc->addr_buffer4 = cpu_to_le64(temp_dma); 1596 hwdesc->addr_buffer4 = cpu_to_le64(temp_dma);
1464 break; 1597 break;
1465 } 1598 }
1466 frag++;
1467 }
1468 producer = get_next_index(producer, num_txd);
1469
1470 /* For LSO, we need to copy the MAC/IP/TCP headers into
1471 * the descriptor ring
1472 */
1473 if (is_tso) {
1474 int hdr_len, first_hdr_len, more_hdr;
1475 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
1476 if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) {
1477 first_hdr_len = sizeof(struct cmd_desc_type0) - 2;
1478 more_hdr = 1;
1479 } else {
1480 first_hdr_len = hdr_len;
1481 more_hdr = 0;
1482 }
1483 /* copy the MAC/IP/TCP headers to the cmd descriptor list */
1484 hwdesc = &tx_ring->desc_head[producer];
1485 pbuf = &tx_ring->cmd_buf_arr[producer];
1486 pbuf->skb = NULL;
1487
1488 /* copy the first 64 bytes */
1489 memcpy(((void *)hwdesc) + 2,
1490 (void *)(skb->data), first_hdr_len);
1491 producer = get_next_index(producer, num_txd);
1492
1493 if (more_hdr) {
1494 hwdesc = &tx_ring->desc_head[producer];
1495 pbuf = &tx_ring->cmd_buf_arr[producer];
1496 pbuf->skb = NULL;
1497 /* copy the next 64 bytes - should be enough except
1498 * for pathological case
1499 */
1500 skb_copy_from_linear_data_offset(skb, first_hdr_len,
1501 hwdesc,
1502 (hdr_len -
1503 first_hdr_len));
1504 producer = get_next_index(producer, num_txd);
1505 }
1506 } 1599 }
1600 tx_ring->producer = get_next_index(producer, num_txd);
1507 1601
1508 tx_ring->producer = producer; 1602 netxen_tso_check(netdev, tx_ring, first_desc, skb);
1509 adapter->stats.txbytes += skb->len;
1510 1603
1511 netxen_nic_update_cmd_producer(adapter, tx_ring); 1604 netxen_nic_update_cmd_producer(adapter, tx_ring);
1512 1605
1606 adapter->stats.txbytes += skb->len;
1513 adapter->stats.xmitcalled++; 1607 adapter->stats.xmitcalled++;
1514 1608
1515 return NETDEV_TX_OK; 1609 return NETDEV_TX_OK;
@@ -1641,10 +1735,13 @@ static void netxen_tx_timeout(struct net_device *netdev)
1641{ 1735{
1642 struct netxen_adapter *adapter = (struct netxen_adapter *) 1736 struct netxen_adapter *adapter = (struct netxen_adapter *)
1643 netdev_priv(netdev); 1737 netdev_priv(netdev);
1738
1739 dev_err(&netdev->dev, "transmit timeout, resetting.\n");
1740
1644 SCHEDULE_WORK(&adapter->tx_timeout_task); 1741 SCHEDULE_WORK(&adapter->tx_timeout_task);
1645} 1742}
1646 1743
1647static void netxen_tx_timeout_task(struct work_struct *work) 1744static void netxen_reset_task(struct work_struct *work)
1648{ 1745{
1649 struct netxen_adapter *adapter = 1746 struct netxen_adapter *adapter =
1650 container_of(work, struct netxen_adapter, tx_timeout_task); 1747 container_of(work, struct netxen_adapter, tx_timeout_task);
@@ -1652,9 +1749,6 @@ static void netxen_tx_timeout_task(struct work_struct *work)
1652 if (!netif_running(adapter->netdev)) 1749 if (!netif_running(adapter->netdev))
1653 return; 1750 return;
1654 1751
1655 printk(KERN_ERR "%s %s: transmit timeout, resetting.\n",
1656 netxen_nic_driver_name, adapter->netdev->name);
1657
1658 netxen_napi_disable(adapter); 1752 netxen_napi_disable(adapter);
1659 1753
1660 adapter->netdev->trans_start = jiffies; 1754 adapter->netdev->trans_start = jiffies;
@@ -1712,7 +1806,7 @@ static irqreturn_t netxen_intr(int irq, void *data)
1712 } 1806 }
1713 1807
1714 /* clear interrupt */ 1808 /* clear interrupt */
1715 if (adapter->fw_major < 4) 1809 if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
1716 netxen_nic_disable_int(sds_ring); 1810 netxen_nic_disable_int(sds_ring);
1717 1811
1718 adapter->pci_write_immediate(adapter, 1812 adapter->pci_write_immediate(adapter,
@@ -1781,6 +1875,128 @@ static void netxen_nic_poll_controller(struct net_device *netdev)
1781} 1875}
1782#endif 1876#endif
1783 1877
1878#ifdef CONFIG_INET
1879
1880#define is_netxen_netdev(dev) (dev->netdev_ops == &netxen_netdev_ops)
1881
1882static int
1883netxen_destip_supported(struct netxen_adapter *adapter)
1884{
1885 if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
1886 return 0;
1887
1888 if (adapter->ahw.cut_through)
1889 return 0;
1890
1891 return 1;
1892}
1893
1894static int netxen_netdev_event(struct notifier_block *this,
1895 unsigned long event, void *ptr)
1896{
1897 struct netxen_adapter *adapter;
1898 struct net_device *dev = (struct net_device *)ptr;
1899 struct in_device *indev;
1900
1901recheck:
1902 if (dev == NULL)
1903 goto done;
1904
1905 if (dev->priv_flags & IFF_802_1Q_VLAN) {
1906 dev = vlan_dev_real_dev(dev);
1907 goto recheck;
1908 }
1909
1910 if (!is_netxen_netdev(dev))
1911 goto done;
1912
1913 adapter = netdev_priv(dev);
1914
1915 if (!adapter || !netxen_destip_supported(adapter))
1916 goto done;
1917
1918 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
1919 goto done;
1920
1921 indev = in_dev_get(dev);
1922 if (!indev)
1923 goto done;
1924
1925 for_ifa(indev) {
1926 switch (event) {
1927 case NETDEV_UP:
1928 netxen_config_ipaddr(adapter,
1929 ifa->ifa_address, NX_IP_UP);
1930 break;
1931 case NETDEV_DOWN:
1932 netxen_config_ipaddr(adapter,
1933 ifa->ifa_address, NX_IP_DOWN);
1934 break;
1935 default:
1936 break;
1937 }
1938 } endfor_ifa(indev);
1939
1940 in_dev_put(indev);
1941done:
1942 return NOTIFY_DONE;
1943}
1944
1945static int
1946netxen_inetaddr_event(struct notifier_block *this,
1947 unsigned long event, void *ptr)
1948{
1949 struct netxen_adapter *adapter;
1950 struct net_device *dev;
1951
1952 struct in_ifaddr *ifa = (struct in_ifaddr *)ptr;
1953
1954 dev = ifa->ifa_dev ? ifa->ifa_dev->dev : NULL;
1955
1956recheck:
1957 if (dev == NULL || !netif_running(dev))
1958 goto done;
1959
1960 if (dev->priv_flags & IFF_802_1Q_VLAN) {
1961 dev = vlan_dev_real_dev(dev);
1962 goto recheck;
1963 }
1964
1965 if (!is_netxen_netdev(dev))
1966 goto done;
1967
1968 adapter = netdev_priv(dev);
1969
1970 if (!adapter || !netxen_destip_supported(adapter))
1971 goto done;
1972
1973 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
1974 goto done;
1975
1976 switch (event) {
1977 case NETDEV_UP:
1978 netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP);
1979 break;
1980 case NETDEV_DOWN:
1981 netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN);
1982 break;
1983 default:
1984 break;
1985 }
1986
1987done:
1988 return NOTIFY_DONE;
1989}
1990
1991static struct notifier_block netxen_netdev_cb = {
1992 .notifier_call = netxen_netdev_event,
1993};
1994
1995static struct notifier_block netxen_inetaddr_cb = {
1996 .notifier_call = netxen_inetaddr_event,
1997};
1998#endif
1999
1784static struct pci_driver netxen_driver = { 2000static struct pci_driver netxen_driver = {
1785 .name = netxen_nic_driver_name, 2001 .name = netxen_nic_driver_name,
1786 .id_table = netxen_pci_tbl, 2002 .id_table = netxen_pci_tbl,
@@ -1792,8 +2008,6 @@ static struct pci_driver netxen_driver = {
1792#endif 2008#endif
1793}; 2009};
1794 2010
1795/* Driver Registration on NetXen card */
1796
1797static int __init netxen_init_module(void) 2011static int __init netxen_init_module(void)
1798{ 2012{
1799 printk(KERN_INFO "%s\n", netxen_nic_driver_string); 2013 printk(KERN_INFO "%s\n", netxen_nic_driver_string);
@@ -1801,6 +2015,11 @@ static int __init netxen_init_module(void)
1801 if ((netxen_workq = create_singlethread_workqueue("netxen")) == NULL) 2015 if ((netxen_workq = create_singlethread_workqueue("netxen")) == NULL)
1802 return -ENOMEM; 2016 return -ENOMEM;
1803 2017
2018#ifdef CONFIG_INET
2019 register_netdevice_notifier(&netxen_netdev_cb);
2020 register_inetaddr_notifier(&netxen_inetaddr_cb);
2021#endif
2022
1804 return pci_register_driver(&netxen_driver); 2023 return pci_register_driver(&netxen_driver);
1805} 2024}
1806 2025
@@ -1809,6 +2028,11 @@ module_init(netxen_init_module);
1809static void __exit netxen_exit_module(void) 2028static void __exit netxen_exit_module(void)
1810{ 2029{
1811 pci_unregister_driver(&netxen_driver); 2030 pci_unregister_driver(&netxen_driver);
2031
2032#ifdef CONFIG_INET
2033 unregister_inetaddr_notifier(&netxen_inetaddr_cb);
2034 unregister_netdevice_notifier(&netxen_netdev_cb);
2035#endif
1812 destroy_workqueue(netxen_workq); 2036 destroy_workqueue(netxen_workq);
1813} 2037}
1814 2038
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index f0031f1f97e5..5f2090233d7b 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -1063,6 +1063,7 @@ static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1063 else { 1063 else {
1064 int hash = hash_item(po->pppoe_pa.sid, po->pppoe_pa.remote); 1064 int hash = hash_item(po->pppoe_pa.sid, po->pppoe_pa.remote);
1065 1065
1066 po = NULL;
1066 while (++hash < PPPOE_HASH_SIZE) { 1067 while (++hash < PPPOE_HASH_SIZE) {
1067 po = pn->hash_table[hash]; 1068 po = pn->hash_table[hash];
1068 if (po) 1069 if (po)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 4b53b58d75fc..b82780d805f5 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2060,8 +2060,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2060 } 2060 }
2061 } 2061 }
2062 2062
2063 pci_set_master(pdev);
2064
2065 /* ioremap MMIO region */ 2063 /* ioremap MMIO region */
2066 ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE); 2064 ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE);
2067 if (!ioaddr) { 2065 if (!ioaddr) {
@@ -2089,6 +2087,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2089 2087
2090 RTL_W16(IntrStatus, 0xffff); 2088 RTL_W16(IntrStatus, 0xffff);
2091 2089
2090 pci_set_master(pdev);
2091
2092 /* Identify chip attached to board */ 2092 /* Identify chip attached to board */
2093 rtl8169_get_mac_version(tp, ioaddr); 2093 rtl8169_get_mac_version(tp, ioaddr);
2094 2094
@@ -3874,6 +3874,15 @@ static void rtl_shutdown(struct pci_dev *pdev)
3874 spin_unlock_irq(&tp->lock); 3874 spin_unlock_irq(&tp->lock);
3875 3875
3876 if (system_state == SYSTEM_POWER_OFF) { 3876 if (system_state == SYSTEM_POWER_OFF) {
3877 /* WoL fails with some 8168 when the receiver is disabled. */
3878 if (tp->features & RTL_FEATURE_WOL) {
3879 pci_clear_master(pdev);
3880
3881 RTL_W8(ChipCmd, CmdRxEnb);
3882 /* PCI commit */
3883 RTL_R8(ChipCmd);
3884 }
3885
3877 pci_wake_from_d3(pdev, true); 3886 pci_wake_from_d3(pdev, true);
3878 pci_set_power_state(pdev, PCI_D3hot); 3887 pci_set_power_state(pdev, PCI_D3hot);
3879 } 3888 }
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index f1f773b17fe1..57a159fac99f 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -186,7 +186,8 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
186#define SMC_outsb(a, r, p, l) writesb((a) + (r), p, (l)) 186#define SMC_outsb(a, r, p, l) writesb((a) + (r), p, (l))
187#define SMC_IRQ_FLAGS (-1) /* from resource */ 187#define SMC_IRQ_FLAGS (-1) /* from resource */
188 188
189#elif defined(CONFIG_MACH_LOGICPD_PXA270) 189#elif defined(CONFIG_MACH_LOGICPD_PXA270) \
190 || defined(CONFIG_MACH_NOMADIK_8815NHK)
190 191
191#define SMC_CAN_USE_8BIT 0 192#define SMC_CAN_USE_8BIT 0
192#define SMC_CAN_USE_16BIT 1 193#define SMC_CAN_USE_16BIT 1
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index 6472ba5cfc5e..96d00c8f8d3e 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -1912,7 +1912,7 @@ static int __init ibmtr_init(void)
1912 1912
1913 find_turbo_adapters(io); 1913 find_turbo_adapters(io);
1914 1914
1915 for (i = 0; io[i] && (i < IBMTR_MAX_ADAPTERS); i++) { 1915 for (i = 0; i < IBMTR_MAX_ADAPTERS && io[i]; i++) {
1916 struct net_device *dev; 1916 struct net_device *dev;
1917 irq[i] = 0; 1917 irq[i] = 0;
1918 mem[i] = 0; 1918 mem[i] = 0;
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 49f3139a3fe7..c150c4858576 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5918,20 +5918,19 @@ static int airo_set_essid(struct net_device *dev,
5918 readSsidRid(local, &SSID_rid); 5918 readSsidRid(local, &SSID_rid);
5919 5919
5920 /* Check if we asked for `any' */ 5920 /* Check if we asked for `any' */
5921 if(dwrq->flags == 0) { 5921 if (dwrq->flags == 0) {
5922 /* Just send an empty SSID list */ 5922 /* Just send an empty SSID list */
5923 memset(&SSID_rid, 0, sizeof(SSID_rid)); 5923 memset(&SSID_rid, 0, sizeof(SSID_rid));
5924 } else { 5924 } else {
5925 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; 5925 unsigned index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
5926 5926
5927 /* Check the size of the string */ 5927 /* Check the size of the string */
5928 if(dwrq->length > IW_ESSID_MAX_SIZE) { 5928 if (dwrq->length > IW_ESSID_MAX_SIZE)
5929 return -E2BIG ; 5929 return -E2BIG ;
5930 } 5930
5931 /* Check if index is valid */ 5931 /* Check if index is valid */
5932 if((index < 0) || (index >= 4)) { 5932 if (index >= ARRAY_SIZE(SSID_rid.ssids))
5933 return -EINVAL; 5933 return -EINVAL;
5934 }
5935 5934
5936 /* Set the SSID */ 5935 /* Set the SSID */
5937 memset(SSID_rid.ssids[index].ssid, 0, 5936 memset(SSID_rid.ssids[index].ssid, 0,
@@ -6819,7 +6818,7 @@ static int airo_set_txpow(struct net_device *dev,
6819 return -EINVAL; 6818 return -EINVAL;
6820 } 6819 }
6821 clear_bit (FLAG_RADIO_OFF, &local->flags); 6820 clear_bit (FLAG_RADIO_OFF, &local->flags);
6822 for (i = 0; cap_rid.txPowerLevels[i] && (i < 8); i++) 6821 for (i = 0; i < 8 && cap_rid.txPowerLevels[i]; i++)
6823 if (v == cap_rid.txPowerLevels[i]) { 6822 if (v == cap_rid.txPowerLevels[i]) {
6824 readConfigRid(local, 1); 6823 readConfigRid(local, 1);
6825 local->config.txPower = v; 6824 local->config.txPower = v;
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index 9b1d960dc80f..6fb1a8034b3c 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -460,7 +460,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
460 integer = swab32(eep->modalHeader.antCtrlCommon); 460 integer = swab32(eep->modalHeader.antCtrlCommon);
461 eep->modalHeader.antCtrlCommon = integer; 461 eep->modalHeader.antCtrlCommon = integer;
462 462
463 for (i = 0; i < AR5416_MAX_CHAINS; i++) { 463 for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
464 integer = swab32(eep->modalHeader.antCtrlChain[i]); 464 integer = swab32(eep->modalHeader.antCtrlChain[i]);
465 eep->modalHeader.antCtrlChain[i] = integer; 465 eep->modalHeader.antCtrlChain[i] = integer;
466 } 466 }
@@ -914,7 +914,7 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah,
914 ctlMode, numCtlModes, isHt40CtlMode, 914 ctlMode, numCtlModes, isHt40CtlMode,
915 (pCtlMode[ctlMode] & EXT_ADDITIVE)); 915 (pCtlMode[ctlMode] & EXT_ADDITIVE));
916 916
917 for (i = 0; (i < AR5416_NUM_CTLS) && 917 for (i = 0; (i < AR5416_EEP4K_NUM_CTLS) &&
918 pEepData->ctlIndex[i]; i++) { 918 pEepData->ctlIndex[i]; i++) {
919 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 919 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
920 " LOOP-Ctlidx %d: cfgCtl 0x%2.2x " 920 " LOOP-Ctlidx %d: cfgCtl 0x%2.2x "
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 660d1a76292b..6bb9602f3477 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -737,8 +737,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
737 goto drop_unlock; 737 goto drop_unlock;
738 } 738 }
739 739
740 spin_unlock_irqrestore(&priv->lock, flags);
741
742 hdr_len = ieee80211_hdrlen(fc); 740 hdr_len = ieee80211_hdrlen(fc);
743 741
744 /* Find (or create) index into station table for destination station */ 742 /* Find (or create) index into station table for destination station */
@@ -746,7 +744,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
746 if (sta_id == IWL_INVALID_STATION) { 744 if (sta_id == IWL_INVALID_STATION) {
747 IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", 745 IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
748 hdr->addr1); 746 hdr->addr1);
749 goto drop; 747 goto drop_unlock;
750 } 748 }
751 749
752 IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); 750 IWL_DEBUG_TX(priv, "station Id %d\n", sta_id);
@@ -764,14 +762,17 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
764 /* aggregation is on for this <sta,tid> */ 762 /* aggregation is on for this <sta,tid> */
765 if (info->flags & IEEE80211_TX_CTL_AMPDU) 763 if (info->flags & IEEE80211_TX_CTL_AMPDU)
766 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; 764 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id;
767 priv->stations[sta_id].tid[tid].tfds_in_queue++;
768 } 765 }
769 766
770 txq = &priv->txq[txq_id]; 767 txq = &priv->txq[txq_id];
771 swq_id = txq->swq_id; 768 swq_id = txq->swq_id;
772 q = &txq->q; 769 q = &txq->q;
773 770
774 spin_lock_irqsave(&priv->lock, flags); 771 if (unlikely(iwl_queue_space(q) < q->high_mark))
772 goto drop_unlock;
773
774 if (ieee80211_is_data_qos(fc))
775 priv->stations[sta_id].tid[tid].tfds_in_queue++;
775 776
776 /* Set up driver data for this TFD */ 777 /* Set up driver data for this TFD */
777 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); 778 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info));
@@ -917,7 +918,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
917 918
918drop_unlock: 919drop_unlock:
919 spin_unlock_irqrestore(&priv->lock, flags); 920 spin_unlock_irqrestore(&priv->lock, flags);
920drop:
921 return -1; 921 return -1;
922} 922}
923EXPORT_SYMBOL(iwl_tx_skb); 923EXPORT_SYMBOL(iwl_tx_skb);
@@ -1194,6 +1194,8 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn)
1194 IWL_ERR(priv, "Start AGG on invalid station\n"); 1194 IWL_ERR(priv, "Start AGG on invalid station\n");
1195 return -ENXIO; 1195 return -ENXIO;
1196 } 1196 }
1197 if (unlikely(tid >= MAX_TID_COUNT))
1198 return -EINVAL;
1197 1199
1198 if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { 1200 if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) {
1199 IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); 1201 IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n");
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c
index 30116d1b4489..35ec006c2d2c 100644
--- a/drivers/net/wireless/iwmc3200wifi/netdev.c
+++ b/drivers/net/wireless/iwmc3200wifi/netdev.c
@@ -99,10 +99,8 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev,
99 int ret = 0; 99 int ret = 0;
100 100
101 wdev = iwm_wdev_alloc(sizeof_bus, dev); 101 wdev = iwm_wdev_alloc(sizeof_bus, dev);
102 if (!wdev) { 102 if (IS_ERR(wdev))
103 dev_err(dev, "no memory for wireless device instance\n"); 103 return wdev;
104 return ERR_PTR(-ENOMEM);
105 }
106 104
107 iwm = wdev_to_iwm(wdev); 105 iwm = wdev_to_iwm(wdev);
108 iwm->bus_ops = if_ops; 106 iwm->bus_ops = if_ops;
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 385b50f4b105..1902b6f0b78c 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -1,6 +1,7 @@
1/* Copyright (C) 2006, Red Hat, Inc. */ 1/* Copyright (C) 2006, Red Hat, Inc. */
2 2
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/kernel.h>
4#include <linux/etherdevice.h> 5#include <linux/etherdevice.h>
5#include <linux/ieee80211.h> 6#include <linux/ieee80211.h>
6#include <linux/if_arp.h> 7#include <linux/if_arp.h>
@@ -43,21 +44,21 @@ static int get_common_rates(struct lbs_private *priv,
43 u16 *rates_size) 44 u16 *rates_size)
44{ 45{
45 u8 *card_rates = lbs_bg_rates; 46 u8 *card_rates = lbs_bg_rates;
46 size_t num_card_rates = sizeof(lbs_bg_rates);
47 int ret = 0, i, j; 47 int ret = 0, i, j;
48 u8 tmp[30]; 48 u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)];
49 size_t tmp_size = 0; 49 size_t tmp_size = 0;
50 50
51 /* For each rate in card_rates that exists in rate1, copy to tmp */ 51 /* For each rate in card_rates that exists in rate1, copy to tmp */
52 for (i = 0; card_rates[i] && (i < num_card_rates); i++) { 52 for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) {
53 for (j = 0; rates[j] && (j < *rates_size); j++) { 53 for (j = 0; j < *rates_size && rates[j]; j++) {
54 if (rates[j] == card_rates[i]) 54 if (rates[j] == card_rates[i])
55 tmp[tmp_size++] = card_rates[i]; 55 tmp[tmp_size++] = card_rates[i];
56 } 56 }
57 } 57 }
58 58
59 lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); 59 lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size);
60 lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); 60 lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates,
61 ARRAY_SIZE(lbs_bg_rates));
61 lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); 62 lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size);
62 lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); 63 lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate);
63 64
@@ -69,10 +70,7 @@ static int get_common_rates(struct lbs_private *priv,
69 lbs_pr_alert("Previously set fixed data rate %#x isn't " 70 lbs_pr_alert("Previously set fixed data rate %#x isn't "
70 "compatible with the network.\n", priv->cur_rate); 71 "compatible with the network.\n", priv->cur_rate);
71 ret = -1; 72 ret = -1;
72 goto done;
73 } 73 }
74 ret = 0;
75
76done: 74done:
77 memset(rates, 0, *rates_size); 75 memset(rates, 0, *rates_size);
78 *rates_size = min_t(int, tmp_size, *rates_size); 76 *rates_size = min_t(int, tmp_size, *rates_size);
@@ -320,7 +318,7 @@ static int lbs_associate(struct lbs_private *priv,
320 rates = (struct mrvl_ie_rates_param_set *) pos; 318 rates = (struct mrvl_ie_rates_param_set *) pos;
321 rates->header.type = cpu_to_le16(TLV_TYPE_RATES); 319 rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
322 memcpy(&rates->rates, &bss->rates, MAX_RATES); 320 memcpy(&rates->rates, &bss->rates, MAX_RATES);
323 tmplen = MAX_RATES; 321 tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES);
324 if (get_common_rates(priv, rates->rates, &tmplen)) { 322 if (get_common_rates(priv, rates->rates, &tmplen)) {
325 ret = -1; 323 ret = -1;
326 goto done; 324 goto done;
@@ -594,7 +592,7 @@ static int lbs_adhoc_join(struct lbs_private *priv,
594 592
595 /* Copy Data rates from the rates recorded in scan response */ 593 /* Copy Data rates from the rates recorded in scan response */
596 memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); 594 memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates));
597 ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES); 595 ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES);
598 memcpy(cmd.bss.rates, bss->rates, ratesize); 596 memcpy(cmd.bss.rates, bss->rates, ratesize);
599 if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { 597 if (get_common_rates(priv, cmd.bss.rates, &ratesize)) {
600 lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); 598 lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n");
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 601b54249677..6c95af3023cc 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -5,6 +5,7 @@
5 * for sending scan commands to the firmware. 5 * for sending scan commands to the firmware.
6 */ 6 */
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/kernel.h>
8#include <linux/etherdevice.h> 9#include <linux/etherdevice.h>
9#include <linux/if_arp.h> 10#include <linux/if_arp.h>
10#include <asm/unaligned.h> 11#include <asm/unaligned.h>
@@ -876,7 +877,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
876 iwe.u.bitrate.disabled = 0; 877 iwe.u.bitrate.disabled = 0;
877 iwe.u.bitrate.value = 0; 878 iwe.u.bitrate.value = 0;
878 879
879 for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) { 880 for (j = 0; j < ARRAY_SIZE(bss->rates) && bss->rates[j]; j++) {
880 /* Bit rate given in 500 kb/s units */ 881 /* Bit rate given in 500 kb/s units */
881 iwe.u.bitrate.value = bss->rates[j] * 500000; 882 iwe.u.bitrate.value = bss->rates[j] * 500000;
882 current_val = iwe_stream_add_value(info, start, current_val, 883 current_val = iwe_stream_add_value(info, start, current_val,
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 783e33c65eb7..b47240ca4b19 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -990,7 +990,7 @@ int iscsi_offload_mesg(struct Scsi_Host *shost,
990 struct iscsi_uevent *ev; 990 struct iscsi_uevent *ev;
991 int len = NLMSG_SPACE(sizeof(*ev) + data_size); 991 int len = NLMSG_SPACE(sizeof(*ev) + data_size);
992 992
993 skb = alloc_skb(len, GFP_NOIO); 993 skb = alloc_skb(len, GFP_ATOMIC);
994 if (!skb) { 994 if (!skb) {
995 printk(KERN_ERR "can not deliver iscsi offload message:OOM\n"); 995 printk(KERN_ERR "can not deliver iscsi offload message:OOM\n");
996 return -ENOMEM; 996 return -ENOMEM;
@@ -1012,7 +1012,7 @@ int iscsi_offload_mesg(struct Scsi_Host *shost,
1012 1012
1013 memcpy((char *)ev + sizeof(*ev), data, data_size); 1013 memcpy((char *)ev + sizeof(*ev), data, data_size);
1014 1014
1015 return iscsi_multicast_skb(skb, ISCSI_NL_GRP_UIP, GFP_NOIO); 1015 return iscsi_multicast_skb(skb, ISCSI_NL_GRP_UIP, GFP_ATOMIC);
1016} 1016}
1017EXPORT_SYMBOL_GPL(iscsi_offload_mesg); 1017EXPORT_SYMBOL_GPL(iscsi_offload_mesg);
1018 1018
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 9b660bd2e2b3..90c4a3616d94 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -368,6 +368,7 @@ struct net_device;
368 368
369/* Some generic methods drivers may use in their ethtool_ops */ 369/* Some generic methods drivers may use in their ethtool_ops */
370u32 ethtool_op_get_link(struct net_device *dev); 370u32 ethtool_op_get_link(struct net_device *dev);
371u32 ethtool_op_get_rx_csum(struct net_device *dev);
371u32 ethtool_op_get_tx_csum(struct net_device *dev); 372u32 ethtool_op_get_tx_csum(struct net_device *dev);
372int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 373int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
373int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 374int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index acef2a770b6b..ad27c7da8798 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -82,7 +82,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
82 82
83#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) 83#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
84#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) 84#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
85#define IN_DEV_RPFILTER(in_dev) IN_DEV_ANDCONF((in_dev), RP_FILTER) 85#define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER)
86#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ 86#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \
87 ACCEPT_SOURCE_ROUTE) 87 ACCEPT_SOURCE_ROUTE)
88#define IN_DEV_BOOTP_RELAY(in_dev) IN_DEV_ANDCONF((in_dev), BOOTP_RELAY) 88#define IN_DEV_BOOTP_RELAY(in_dev) IN_DEV_ANDCONF((in_dev), BOOTP_RELAY)
diff --git a/include/net/ieee802154/af_ieee802154.h b/include/net/af_ieee802154.h
index 0d78605fb1a6..0d78605fb1a6 100644
--- a/include/net/ieee802154/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
diff --git a/include/net/ieee802154/mac_def.h b/include/net/ieee802154.h
index 8cb684635650..d52685defb11 100644
--- a/include/net/ieee802154/mac_def.h
+++ b/include/net/ieee802154.h
@@ -23,8 +23,8 @@
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */ 24 */
25 25
26#ifndef IEEE802154_MAC_DEF_H 26#ifndef NET_IEEE802154_H
27#define IEEE802154_MAC_DEF_H 27#define NET_IEEE802154_H
28 28
29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ 29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ 30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
diff --git a/include/net/ieee802154/nl802154.h b/include/net/ieee802154/nl802154.h
deleted file mode 100644
index 78efcdf52b59..000000000000
--- a/include/net/ieee802154/nl802154.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27int ieee802154_nl_assoc_indic(struct net_device *dev,
28 struct ieee802154_addr *addr, u8 cap);
29int ieee802154_nl_assoc_confirm(struct net_device *dev,
30 u16 short_addr, u8 status);
31int ieee802154_nl_disassoc_indic(struct net_device *dev,
32 struct ieee802154_addr *addr, u8 reason);
33int ieee802154_nl_disassoc_confirm(struct net_device *dev,
34 u8 status);
35int ieee802154_nl_scan_confirm(struct net_device *dev,
36 u8 status, u8 scan_type, u32 unscanned,
37 u8 *edl/*, struct list_head *pan_desc_list */);
38int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
39 u16 coord_addr);
40
41#endif
diff --git a/include/net/ieee802154/netdevice.h b/include/net/ieee802154_netdev.h
index e2506af3e7c8..e2506af3e7c8 100644
--- a/include/net/ieee802154/netdevice.h
+++ b/include/net/ieee802154_netdev.h
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 7c5c0f79168a..15b492a9aa79 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -22,6 +22,12 @@
22#include <net/flow.h> 22#include <net/flow.h>
23#include <net/netlink.h> 23#include <net/netlink.h>
24 24
25#ifdef CONFIG_IPV6_MULTIPLE_TABLES
26#define FIB6_TABLE_HASHSZ 256
27#else
28#define FIB6_TABLE_HASHSZ 1
29#endif
30
25struct rt6_info; 31struct rt6_info;
26 32
27struct fib6_config 33struct fib6_config
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index bbae1e87efcd..910820327bc4 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -99,47 +99,47 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
99 return &buf[*idx - len]; 99 return &buf[*idx - len];
100} 100}
101 101
102#define IP_VS_DBG_BUF(level, msg...) \ 102#define IP_VS_DBG_BUF(level, msg, ...) \
103 do { \ 103 do { \
104 char ip_vs_dbg_buf[160]; \ 104 char ip_vs_dbg_buf[160]; \
105 int ip_vs_dbg_idx = 0; \ 105 int ip_vs_dbg_idx = 0; \
106 if (level <= ip_vs_get_debug_level()) \ 106 if (level <= ip_vs_get_debug_level()) \
107 printk(KERN_DEBUG "IPVS: " msg); \ 107 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
108 } while (0) 108 } while (0)
109#define IP_VS_ERR_BUF(msg...) \ 109#define IP_VS_ERR_BUF(msg...) \
110 do { \ 110 do { \
111 char ip_vs_dbg_buf[160]; \ 111 char ip_vs_dbg_buf[160]; \
112 int ip_vs_dbg_idx = 0; \ 112 int ip_vs_dbg_idx = 0; \
113 printk(KERN_ERR "IPVS: " msg); \ 113 pr_err(msg); \
114 } while (0) 114 } while (0)
115 115
116/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */ 116/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */
117#define IP_VS_DBG_ADDR(af, addr) \ 117#define IP_VS_DBG_ADDR(af, addr) \
118 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \ 118 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \
119 sizeof(ip_vs_dbg_buf), addr, \ 119 sizeof(ip_vs_dbg_buf), addr, \
120 &ip_vs_dbg_idx) 120 &ip_vs_dbg_idx)
121 121
122#define IP_VS_DBG(level, msg...) \ 122#define IP_VS_DBG(level, msg, ...) \
123 do { \ 123 do { \
124 if (level <= ip_vs_get_debug_level()) \ 124 if (level <= ip_vs_get_debug_level()) \
125 printk(KERN_DEBUG "IPVS: " msg); \ 125 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
126 } while (0) 126 } while (0)
127#define IP_VS_DBG_RL(msg...) \ 127#define IP_VS_DBG_RL(msg, ...) \
128 do { \ 128 do { \
129 if (net_ratelimit()) \ 129 if (net_ratelimit()) \
130 printk(KERN_DEBUG "IPVS: " msg); \ 130 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
131 } while (0) 131 } while (0)
132#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \ 132#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \
133 do { \ 133 do { \
134 if (level <= ip_vs_get_debug_level()) \ 134 if (level <= ip_vs_get_debug_level()) \
135 pp->debug_packet(pp, skb, ofs, msg); \ 135 pp->debug_packet(pp, skb, ofs, msg); \
136 } while (0) 136 } while (0)
137#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \ 137#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \
138 do { \ 138 do { \
139 if (level <= ip_vs_get_debug_level() && \ 139 if (level <= ip_vs_get_debug_level() && \
140 net_ratelimit()) \ 140 net_ratelimit()) \
141 pp->debug_packet(pp, skb, ofs, msg); \ 141 pp->debug_packet(pp, skb, ofs, msg); \
142 } while (0) 142 } while (0)
143#else /* NO DEBUGGING at ALL */ 143#else /* NO DEBUGGING at ALL */
144#define IP_VS_DBG_BUF(level, msg...) do {} while (0) 144#define IP_VS_DBG_BUF(level, msg...) do {} while (0)
145#define IP_VS_ERR_BUF(msg...) do {} while (0) 145#define IP_VS_ERR_BUF(msg...) do {} while (0)
@@ -150,29 +150,30 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
150#endif 150#endif
151 151
152#define IP_VS_BUG() BUG() 152#define IP_VS_BUG() BUG()
153#define IP_VS_ERR(msg...) printk(KERN_ERR "IPVS: " msg) 153#define IP_VS_ERR(msg...) pr_err(msg)
154#define IP_VS_INFO(msg...) printk(KERN_INFO "IPVS: " msg) 154#define IP_VS_INFO(msg...) pr_info(msg)
155#define IP_VS_WARNING(msg...) \ 155#define IP_VS_WARNING(msg...) pr_warning(msg)
156 printk(KERN_WARNING "IPVS: " msg) 156#define IP_VS_ERR_RL(msg...) \
157#define IP_VS_ERR_RL(msg...) \ 157 do { \
158 do { \ 158 if (net_ratelimit()) \
159 if (net_ratelimit()) \ 159 pr_err(msg); \
160 printk(KERN_ERR "IPVS: " msg); \ 160 } while (0)
161 } while (0)
162 161
163#ifdef CONFIG_IP_VS_DEBUG 162#ifdef CONFIG_IP_VS_DEBUG
164#define EnterFunction(level) \ 163#define EnterFunction(level) \
165 do { \ 164 do { \
166 if (level <= ip_vs_get_debug_level()) \ 165 if (level <= ip_vs_get_debug_level()) \
167 printk(KERN_DEBUG "Enter: %s, %s line %i\n", \ 166 printk(KERN_DEBUG \
168 __func__, __FILE__, __LINE__); \ 167 pr_fmt("Enter: %s, %s line %i\n"), \
169 } while (0) 168 __func__, __FILE__, __LINE__); \
170#define LeaveFunction(level) \ 169 } while (0)
171 do { \ 170#define LeaveFunction(level) \
172 if (level <= ip_vs_get_debug_level()) \ 171 do { \
173 printk(KERN_DEBUG "Leave: %s, %s line %i\n", \ 172 if (level <= ip_vs_get_debug_level()) \
174 __func__, __FILE__, __LINE__); \ 173 printk(KERN_DEBUG \
175 } while (0) 174 pr_fmt("Leave: %s, %s line %i\n"), \
175 __func__, __FILE__, __LINE__); \
176 } while (0)
176#else 177#else
177#define EnterFunction(level) do {} while (0) 178#define EnterFunction(level) do {} while (0)
178#define LeaveFunction(level) do {} while (0) 179#define LeaveFunction(level) do {} while (0)
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
new file mode 100644
index 000000000000..6096096f6d7d
--- /dev/null
+++ b/include/net/nl802154.h
@@ -0,0 +1,117 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27/**
28 * ieee802154_nl_assoc_indic - Notify userland of an association request.
29 * @dev: The network device on which this association request was
30 * received.
31 * @addr: The address of the device requesting association.
32 * @cap: The capability information field from the device.
33 *
34 * This informs a userland coordinator of a device requesting to
35 * associate with the PAN controlled by the coordinator.
36 *
37 * Note: This is in section 7.3.1 of the IEEE 802.15.4-2006 document.
38 */
39int ieee802154_nl_assoc_indic(struct net_device *dev,
40 struct ieee802154_addr *addr, u8 cap);
41
42/**
43 * ieee802154_nl_assoc_confirm - Notify userland of association.
44 * @dev: The device which has completed association.
45 * @short_addr: The short address assigned to the device.
46 * @status: The status of the association.
47 *
48 * Inform userland of the result of an association request. If the
49 * association request included asking the coordinator to allocate
50 * a short address then it is returned in @short_addr.
51 *
52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document.
53 */
54int ieee802154_nl_assoc_confirm(struct net_device *dev,
55 u16 short_addr, u8 status);
56
57/**
58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation.
59 * @dev: The device on which disassociation was indicated.
60 * @addr: The device which is disassociating.
61 * @reason: The reason for the disassociation.
62 *
63 * Inform userland that a device has disassociated from the network.
64 *
65 * Note: This is in section 7.3.3 of the IEEE 802.15.4 document.
66 */
67int ieee802154_nl_disassoc_indic(struct net_device *dev,
68 struct ieee802154_addr *addr, u8 reason);
69
70/**
71 * ieee802154_nl_disassoc_confirm - Notify userland of disassociation
72 * completion.
73 * @dev: The device on which disassociation was ordered.
74 * @status: The result of the disassociation.
75 *
76 * Inform userland of the result of requesting that a device
77 * disassociate, or the result of requesting that we disassociate from
78 * a PAN managed by another coordinator.
79 *
80 * Note: This is in section 7.1.4.3 of the IEEE 802.15.4 document.
81 */
82int ieee802154_nl_disassoc_confirm(struct net_device *dev,
83 u8 status);
84
85/**
86 * ieee802154_nl_scan_confirm - Notify userland of completion of scan.
87 * @dev: The device which was instructed to scan.
88 * @status: The status of the scan operation.
89 * @scan_type: What type of scan was performed.
90 * @unscanned: Any channels that the device was unable to scan.
91 * @edl: The energy levels (if a passive scan).
92 *
93 *
94 * Note: This is in section 7.1.11 of the IEEE 802.15.4 document.
95 * Note: This API does not permit the return of an active scan result.
96 */
97int ieee802154_nl_scan_confirm(struct net_device *dev,
98 u8 status, u8 scan_type, u32 unscanned,
99 u8 *edl/*, struct list_head *pan_desc_list */);
100
101/**
102 * ieee802154_nl_beacon_indic - Notify userland of a received beacon.
103 * @dev: The device on which a beacon was received.
104 * @panid: The PAN of the coordinator.
105 * @coord_addr: The short address of the coordinator on that PAN.
106 *
107 * Note: This is in section 7.1.5 of the IEEE 802.15.4 document.
108 * Note: This API does not provide extended information such as what
109 * channel the PAN is on or what the LQI of the beacon frame was on
110 * receipt.
111 * Note: This API cannot indicate a beacon frame for a coordinator
112 * operating in long addressing mode.
113 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
115 u16 coord_addr);
116
117#endif
diff --git a/include/net/rose.h b/include/net/rose.h
index cbd5364b2c8a..5ba9f02731eb 100644
--- a/include/net/rose.h
+++ b/include/net/rose.h
@@ -156,7 +156,7 @@ extern int sysctl_rose_maximum_vcs;
156extern int sysctl_rose_window_size; 156extern int sysctl_rose_window_size;
157extern int rosecmp(rose_address *, rose_address *); 157extern int rosecmp(rose_address *, rose_address *);
158extern int rosecmpm(rose_address *, rose_address *, unsigned short); 158extern int rosecmpm(rose_address *, rose_address *, unsigned short);
159extern const char *rose2asc(const rose_address *); 159extern char *rose2asc(char *buf, const rose_address *);
160extern struct sock *rose_find_socket(unsigned int, struct rose_neigh *); 160extern struct sock *rose_find_socket(unsigned int, struct rose_neigh *);
161extern void rose_kill_by_neigh(struct rose_neigh *); 161extern void rose_kill_by_neigh(struct rose_neigh *);
162extern unsigned int rose_new_lci(struct rose_neigh *); 162extern unsigned int rose_new_lci(struct rose_neigh *);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 9e3a3f4c1f60..223e90a44824 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1280,7 +1280,7 @@ struct xfrm6_tunnel {
1280}; 1280};
1281 1281
1282extern void xfrm_init(void); 1282extern void xfrm_init(void);
1283extern void xfrm4_init(void); 1283extern void xfrm4_init(int rt_hash_size);
1284extern int xfrm_state_init(struct net *net); 1284extern int xfrm_state_init(struct net *net);
1285extern void xfrm_state_fini(struct net *net); 1285extern void xfrm_state_fini(struct net *net);
1286extern void xfrm4_state_init(void); 1286extern void xfrm4_state_init(void);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 6d37b7e2a767..a1f16303703a 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -225,12 +225,6 @@ int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id)
225 return -EOPNOTSUPP; 225 return -EOPNOTSUPP;
226 } 226 }
227 227
228 /* The real device must be up and operating in order to
229 * assosciate a VLAN device with it.
230 */
231 if (!(real_dev->flags & IFF_UP))
232 return -ENETDOWN;
233
234 if (__find_vlan_dev(real_dev, vlan_id) != NULL) 228 if (__find_vlan_dev(real_dev, vlan_id) != NULL)
235 return -EEXIST; 229 return -EEXIST;
236 230
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 8a96672e2c5c..eb404dc3ed6e 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -424,7 +424,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
424err2: 424err2:
425 br_fdb_delete_by_port(br, p, 1); 425 br_fdb_delete_by_port(br, p, 1);
426err1: 426err1:
427 kobject_del(&p->kobj); 427 kobject_put(&p->kobj);
428err0: 428err0:
429 dev_set_promiscuity(dev, -1); 429 dev_set_promiscuity(dev, -1);
430put_back: 430put_back:
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index cf36ff44ebb2..44e571111d3a 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -34,11 +34,13 @@ u32 ethtool_op_get_rx_csum(struct net_device *dev)
34{ 34{
35 return (dev->features & NETIF_F_ALL_CSUM) != 0; 35 return (dev->features & NETIF_F_ALL_CSUM) != 0;
36} 36}
37EXPORT_SYMBOL(ethtool_op_get_rx_csum);
37 38
38u32 ethtool_op_get_tx_csum(struct net_device *dev) 39u32 ethtool_op_get_tx_csum(struct net_device *dev)
39{ 40{
40 return (dev->features & NETIF_F_ALL_CSUM) != 0; 41 return (dev->features & NETIF_F_ALL_CSUM) != 0;
41} 42}
43EXPORT_SYMBOL(ethtool_op_get_tx_csum);
42 44
43int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) 45int ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
44{ 46{
@@ -1125,7 +1127,6 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
1125EXPORT_SYMBOL(ethtool_op_get_link); 1127EXPORT_SYMBOL(ethtool_op_get_link);
1126EXPORT_SYMBOL(ethtool_op_get_sg); 1128EXPORT_SYMBOL(ethtool_op_get_sg);
1127EXPORT_SYMBOL(ethtool_op_get_tso); 1129EXPORT_SYMBOL(ethtool_op_get_tso);
1128EXPORT_SYMBOL(ethtool_op_get_tx_csum);
1129EXPORT_SYMBOL(ethtool_op_set_sg); 1130EXPORT_SYMBOL(ethtool_op_set_sg);
1130EXPORT_SYMBOL(ethtool_op_set_tso); 1131EXPORT_SYMBOL(ethtool_op_set_tso);
1131EXPORT_SYMBOL(ethtool_op_set_tx_csum); 1132EXPORT_SYMBOL(ethtool_op_set_tx_csum);
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index 3bb6bdb1dac1..69c8d9207aa7 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -34,8 +34,8 @@
34#include <net/tcp_states.h> 34#include <net/tcp_states.h>
35#include <net/route.h> 35#include <net/route.h>
36 36
37#include <net/ieee802154/af_ieee802154.h> 37#include <net/af_ieee802154.h>
38#include <net/ieee802154/netdevice.h> 38#include <net/ieee802154_netdev.h>
39 39
40#include "af802154.h" 40#include "af802154.h"
41 41
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c
index 14d39840dd62..53dd912d52b4 100644
--- a/net/ieee802154/dgram.c
+++ b/net/ieee802154/dgram.c
@@ -26,9 +26,9 @@
26#include <linux/if_arp.h> 26#include <linux/if_arp.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <net/sock.h> 28#include <net/sock.h>
29#include <net/ieee802154/af_ieee802154.h> 29#include <net/af_ieee802154.h>
30#include <net/ieee802154/mac_def.h> 30#include <net/ieee802154.h>
31#include <net/ieee802154/netdevice.h> 31#include <net/ieee802154_netdev.h>
32 32
33#include <asm/ioctls.h> 33#include <asm/ioctls.h>
34 34
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c
index 27eda9fdf3c2..a615b9d13212 100644
--- a/net/ieee802154/netlink.c
+++ b/net/ieee802154/netlink.c
@@ -27,9 +27,9 @@
27#include <net/netlink.h> 27#include <net/netlink.h>
28#include <net/genetlink.h> 28#include <net/genetlink.h>
29#include <linux/nl802154.h> 29#include <linux/nl802154.h>
30#include <net/ieee802154/af_ieee802154.h> 30#include <net/af_ieee802154.h>
31#include <net/ieee802154/nl802154.h> 31#include <net/nl802154.h>
32#include <net/ieee802154/netdevice.h> 32#include <net/ieee802154_netdev.h>
33 33
34static unsigned int ieee802154_seq_num; 34static unsigned int ieee802154_seq_num;
35 35
diff --git a/net/ieee802154/raw.c b/net/ieee802154/raw.c
index fca44d59f97e..ea8d1f15206e 100644
--- a/net/ieee802154/raw.c
+++ b/net/ieee802154/raw.c
@@ -26,7 +26,7 @@
26#include <linux/if_arp.h> 26#include <linux/if_arp.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <net/sock.h> 28#include <net/sock.h>
29#include <net/ieee802154/af_ieee802154.h> 29#include <net/af_ieee802154.h>
30 30
31#include "af802154.h" 31#include "af802154.h"
32 32
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index c29d75d8f1b1..090e9991ac2a 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1304,7 +1304,9 @@ static void arp_format_neigh_entry(struct seq_file *seq,
1304 hbuffer[k++] = hex_asc_lo(n->ha[j]); 1304 hbuffer[k++] = hex_asc_lo(n->ha[j]);
1305 hbuffer[k++] = ':'; 1305 hbuffer[k++] = ':';
1306 } 1306 }
1307 hbuffer[--k] = 0; 1307 if (k != 0)
1308 --k;
1309 hbuffer[k] = 0;
1308#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 1310#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
1309 } 1311 }
1310#endif 1312#endif
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 278f46f5011b..fafbe163e2b5 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3442,7 +3442,7 @@ int __init ip_rt_init(void)
3442 printk(KERN_ERR "Unable to create route proc files\n"); 3442 printk(KERN_ERR "Unable to create route proc files\n");
3443#ifdef CONFIG_XFRM 3443#ifdef CONFIG_XFRM
3444 xfrm_init(); 3444 xfrm_init();
3445 xfrm4_init(); 3445 xfrm4_init(ip_rt_max_size);
3446#endif 3446#endif
3447 rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL); 3447 rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL);
3448 3448
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 0071ee6f441f..1ba44742ebbf 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -264,6 +264,20 @@ static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
264 .fill_dst = xfrm4_fill_dst, 264 .fill_dst = xfrm4_fill_dst,
265}; 265};
266 266
267static struct ctl_table xfrm4_policy_table[] = {
268 {
269 .ctl_name = CTL_UNNUMBERED,
270 .procname = "xfrm4_gc_thresh",
271 .data = &xfrm4_dst_ops.gc_thresh,
272 .maxlen = sizeof(int),
273 .mode = 0644,
274 .proc_handler = proc_dointvec,
275 },
276 { }
277};
278
279static struct ctl_table_header *sysctl_hdr;
280
267static void __init xfrm4_policy_init(void) 281static void __init xfrm4_policy_init(void)
268{ 282{
269 xfrm_policy_register_afinfo(&xfrm4_policy_afinfo); 283 xfrm_policy_register_afinfo(&xfrm4_policy_afinfo);
@@ -271,12 +285,27 @@ static void __init xfrm4_policy_init(void)
271 285
272static void __exit xfrm4_policy_fini(void) 286static void __exit xfrm4_policy_fini(void)
273{ 287{
288 if (sysctl_hdr)
289 unregister_net_sysctl_table(sysctl_hdr);
274 xfrm_policy_unregister_afinfo(&xfrm4_policy_afinfo); 290 xfrm_policy_unregister_afinfo(&xfrm4_policy_afinfo);
275} 291}
276 292
277void __init xfrm4_init(void) 293void __init xfrm4_init(int rt_max_size)
278{ 294{
279 xfrm4_state_init(); 295 xfrm4_state_init();
280 xfrm4_policy_init(); 296 xfrm4_policy_init();
297 /*
298 * Select a default value for the gc_thresh based on the main route
299 * table hash size. It seems to me the worst case scenario is when
300 * we have ipsec operating in transport mode, in which we create a
301 * dst_entry per socket. The xfrm gc algorithm starts trying to remove
302 * entries at gc_thresh, and prevents new allocations as 2*gc_thresh
303 * so lets set an initial xfrm gc_thresh value at the rt_max_size/2.
304 * That will let us store an ipsec connection per route table entry,
305 * and start cleaning when were 1/2 full
306 */
307 xfrm4_dst_ops.gc_thresh = rt_max_size/2;
308 sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv4_ctl_path,
309 xfrm4_policy_table);
281} 310}
282 311
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 52ee1dced2ff..0e93ca56eb69 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -164,12 +164,6 @@ static __inline__ void rt6_release(struct rt6_info *rt)
164 dst_free(&rt->u.dst); 164 dst_free(&rt->u.dst);
165} 165}
166 166
167#ifdef CONFIG_IPV6_MULTIPLE_TABLES
168#define FIB_TABLE_HASHSZ 256
169#else
170#define FIB_TABLE_HASHSZ 1
171#endif
172
173static void fib6_link_table(struct net *net, struct fib6_table *tb) 167static void fib6_link_table(struct net *net, struct fib6_table *tb)
174{ 168{
175 unsigned int h; 169 unsigned int h;
@@ -180,7 +174,7 @@ static void fib6_link_table(struct net *net, struct fib6_table *tb)
180 */ 174 */
181 rwlock_init(&tb->tb6_lock); 175 rwlock_init(&tb->tb6_lock);
182 176
183 h = tb->tb6_id & (FIB_TABLE_HASHSZ - 1); 177 h = tb->tb6_id & (FIB6_TABLE_HASHSZ - 1);
184 178
185 /* 179 /*
186 * No protection necessary, this is the only list mutatation 180 * No protection necessary, this is the only list mutatation
@@ -231,7 +225,7 @@ struct fib6_table *fib6_get_table(struct net *net, u32 id)
231 225
232 if (id == 0) 226 if (id == 0)
233 id = RT6_TABLE_MAIN; 227 id = RT6_TABLE_MAIN;
234 h = id & (FIB_TABLE_HASHSZ - 1); 228 h = id & (FIB6_TABLE_HASHSZ - 1);
235 rcu_read_lock(); 229 rcu_read_lock();
236 head = &net->ipv6.fib_table_hash[h]; 230 head = &net->ipv6.fib_table_hash[h];
237 hlist_for_each_entry_rcu(tb, node, head, tb6_hlist) { 231 hlist_for_each_entry_rcu(tb, node, head, tb6_hlist) {
@@ -382,7 +376,7 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
382 arg.net = net; 376 arg.net = net;
383 w->args = &arg; 377 w->args = &arg;
384 378
385 for (h = s_h; h < FIB_TABLE_HASHSZ; h++, s_e = 0) { 379 for (h = s_h; h < FIB6_TABLE_HASHSZ; h++, s_e = 0) {
386 e = 0; 380 e = 0;
387 head = &net->ipv6.fib_table_hash[h]; 381 head = &net->ipv6.fib_table_hash[h];
388 hlist_for_each_entry(tb, node, head, tb6_hlist) { 382 hlist_for_each_entry(tb, node, head, tb6_hlist) {
@@ -1368,7 +1362,7 @@ void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
1368 unsigned int h; 1362 unsigned int h;
1369 1363
1370 rcu_read_lock(); 1364 rcu_read_lock();
1371 for (h = 0; h < FIB_TABLE_HASHSZ; h++) { 1365 for (h = 0; h < FIB6_TABLE_HASHSZ; h++) {
1372 head = &net->ipv6.fib_table_hash[h]; 1366 head = &net->ipv6.fib_table_hash[h];
1373 hlist_for_each_entry_rcu(table, node, head, tb6_hlist) { 1367 hlist_for_each_entry_rcu(table, node, head, tb6_hlist) {
1374 write_lock_bh(&table->tb6_lock); 1368 write_lock_bh(&table->tb6_lock);
@@ -1483,7 +1477,7 @@ static int fib6_net_init(struct net *net)
1483 if (!net->ipv6.rt6_stats) 1477 if (!net->ipv6.rt6_stats)
1484 goto out_timer; 1478 goto out_timer;
1485 1479
1486 net->ipv6.fib_table_hash = kcalloc(FIB_TABLE_HASHSZ, 1480 net->ipv6.fib_table_hash = kcalloc(FIB6_TABLE_HASHSZ,
1487 sizeof(*net->ipv6.fib_table_hash), 1481 sizeof(*net->ipv6.fib_table_hash),
1488 GFP_KERNEL); 1482 GFP_KERNEL);
1489 if (!net->ipv6.fib_table_hash) 1483 if (!net->ipv6.fib_table_hash)
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 3a3c677bc0f2..611cffcf554f 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -306,9 +306,24 @@ static void xfrm6_policy_fini(void)
306 xfrm_policy_unregister_afinfo(&xfrm6_policy_afinfo); 306 xfrm_policy_unregister_afinfo(&xfrm6_policy_afinfo);
307} 307}
308 308
309static struct ctl_table xfrm6_policy_table[] = {
310 {
311 .ctl_name = CTL_UNNUMBERED,
312 .procname = "xfrm6_gc_thresh",
313 .data = &xfrm6_dst_ops.gc_thresh,
314 .maxlen = sizeof(int),
315 .mode = 0644,
316 .proc_handler = proc_dointvec,
317 },
318 { }
319};
320
321static struct ctl_table_header *sysctl_hdr;
322
309int __init xfrm6_init(void) 323int __init xfrm6_init(void)
310{ 324{
311 int ret; 325 int ret;
326 unsigned int gc_thresh;
312 327
313 ret = xfrm6_policy_init(); 328 ret = xfrm6_policy_init();
314 if (ret) 329 if (ret)
@@ -317,6 +332,22 @@ int __init xfrm6_init(void)
317 ret = xfrm6_state_init(); 332 ret = xfrm6_state_init();
318 if (ret) 333 if (ret)
319 goto out_policy; 334 goto out_policy;
335 /*
336 * We need a good default value for the xfrm6 gc threshold.
337 * In ipv4 we set it to the route hash table size * 8, which
338 * is half the size of the maximaum route cache for ipv4. It
339 * would be good to do the same thing for v6, except the table is
340 * constructed differently here. Here each table for a net namespace
341 * can have FIB_TABLE_HASHSZ entries, so lets go with the same
342 * computation that we used for ipv4 here. Also, lets keep the initial
343 * gc_thresh to a minimum of 1024, since, the ipv6 route cache defaults
344 * to that as a minimum as well
345 */
346 gc_thresh = FIB6_TABLE_HASHSZ * 8;
347 xfrm6_dst_ops.gc_thresh = (gc_thresh < 1024) ? 1024 : gc_thresh;
348
349 sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv6_ctl_path,
350 xfrm6_policy_table);
320out: 351out:
321 return ret; 352 return ret;
322out_policy: 353out_policy:
@@ -326,6 +357,8 @@ out_policy:
326 357
327void xfrm6_fini(void) 358void xfrm6_fini(void)
328{ 359{
360 if (sysctl_hdr)
361 unregister_net_sysctl_table(sysctl_hdr);
329 //xfrm6_input_fini(); 362 //xfrm6_input_fini();
330 xfrm6_policy_fini(); 363 xfrm6_policy_fini();
331 xfrm6_state_fini(); 364 xfrm6_state_fini();
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index ecf4eb2717cb..9cb79f95bf63 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -1453,6 +1453,7 @@ struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
1453 } 1453 }
1454 /* Dup */ 1454 /* Dup */
1455 memcpy(new, orig, sizeof(struct tsap_cb)); 1455 memcpy(new, orig, sizeof(struct tsap_cb));
1456 spin_lock_init(&new->lock);
1456 1457
1457 /* We don't need the old instance any more */ 1458 /* We don't need the old instance any more */
1458 spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, flags); 1459 spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, flags);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index f60a83102ea2..ee83125ed179 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -760,7 +760,7 @@ void ieee80211_dynamic_ps_timer(unsigned long data)
760{ 760{
761 struct ieee80211_local *local = (void *) data; 761 struct ieee80211_local *local = (void *) data;
762 762
763 if (local->quiescing) 763 if (local->quiescing || local->suspended)
764 return; 764 return;
765 765
766 queue_work(local->hw.workqueue, &local->dynamic_ps_enable_work); 766 queue_work(local->hw.workqueue, &local->dynamic_ps_enable_work);
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index 7a549f9deb96..5e3d476972f9 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -55,15 +55,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
55 55
56 rcu_read_unlock(); 56 rcu_read_unlock();
57 57
58 /* flush again, in case driver queued work */
59 flush_workqueue(local->hw.workqueue);
60
61 /* stop hardware - this must stop RX */
62 if (local->open_count) {
63 ieee80211_led_radio(local, false);
64 drv_stop(local);
65 }
66
67 /* remove STAs */ 58 /* remove STAs */
68 spin_lock_irqsave(&local->sta_lock, flags); 59 spin_lock_irqsave(&local->sta_lock, flags);
69 list_for_each_entry(sta, &local->sta_list, list) { 60 list_for_each_entry(sta, &local->sta_list, list) {
@@ -111,7 +102,22 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
111 drv_remove_interface(local, &conf); 102 drv_remove_interface(local, &conf);
112 } 103 }
113 104
105 /* stop hardware - this must stop RX */
106 if (local->open_count) {
107 ieee80211_led_radio(local, false);
108 drv_stop(local);
109 }
110
111 /*
112 * flush again, in case driver queued work -- it
113 * shouldn't be doing (or cancel everything in the
114 * stop callback) that but better safe than sorry.
115 */
116 flush_workqueue(local->hw.workqueue);
117
114 local->suspended = true; 118 local->suspended = true;
119 /* need suspended to be visible before quiescing is false */
120 barrier();
115 local->quiescing = false; 121 local->quiescing = false;
116 122
117 return 0; 123 return 0;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index f195705146bd..25a669c86e14 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2442,6 +2442,18 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
2442 return; 2442 return;
2443 } 2443 }
2444 2444
2445 /*
2446 * If we're suspending, it is possible although not too likely
2447 * that we'd be receiving frames after having already partially
2448 * quiesced the stack. We can't process such frames then since
2449 * that might, for example, cause stations to be added or other
2450 * driver callbacks be invoked.
2451 */
2452 if (unlikely(local->quiescing || local->suspended)) {
2453 kfree_skb(skb);
2454 return;
2455 }
2456
2445 if (status->flag & RX_FLAG_HT) { 2457 if (status->flag & RX_FLAG_HT) {
2446 /* rate_idx is MCS index */ 2458 /* rate_idx is MCS index */
2447 if (WARN_ON(status->rate_idx < 0 || 2459 if (WARN_ON(status->rate_idx < 0 ||
diff --git a/net/netfilter/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c
index 201b8ea3020d..c1781f80daf2 100644
--- a/net/netfilter/ipvs/ip_vs_app.c
+++ b/net/netfilter/ipvs/ip_vs_app.c
@@ -18,6 +18,9 @@
18 * 18 *
19 */ 19 */
20 20
21#define KMSG_COMPONENT "IPVS"
22#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
23
21#include <linux/module.h> 24#include <linux/module.h>
22#include <linux/kernel.h> 25#include <linux/kernel.h>
23#include <linux/skbuff.h> 26#include <linux/skbuff.h>
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 77bfdfeb966e..4173d7b1d4cc 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -22,6 +22,9 @@
22 * 22 *
23 */ 23 */
24 24
25#define KMSG_COMPONENT "IPVS"
26#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
27
25#include <linux/interrupt.h> 28#include <linux/interrupt.h>
26#include <linux/in.h> 29#include <linux/in.h>
27#include <linux/net.h> 30#include <linux/net.h>
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 8dddb17a947a..6811dcaca0f6 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -24,6 +24,9 @@
24 * 24 *
25 */ 25 */
26 26
27#define KMSG_COMPONENT "IPVS"
28#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
29
27#include <linux/module.h> 30#include <linux/module.h>
28#include <linux/kernel.h> 31#include <linux/kernel.h>
29#include <linux/ip.h> 32#include <linux/ip.h>
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 2d24d81474ce..e6133ea1ea4c 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -18,6 +18,9 @@
18 * 18 *
19 */ 19 */
20 20
21#define KMSG_COMPONENT "IPVS"
22#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
23
21#include <linux/module.h> 24#include <linux/module.h>
22#include <linux/init.h> 25#include <linux/init.h>
23#include <linux/types.h> 26#include <linux/types.h>
diff --git a/net/netfilter/ipvs/ip_vs_dh.c b/net/netfilter/ipvs/ip_vs_dh.c
index a9dac74bb13f..d0c0594d1e2e 100644
--- a/net/netfilter/ipvs/ip_vs_dh.c
+++ b/net/netfilter/ipvs/ip_vs_dh.c
@@ -35,6 +35,9 @@
35 * 35 *
36 */ 36 */
37 37
38#define KMSG_COMPONENT "IPVS"
39#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
40
38#include <linux/ip.h> 41#include <linux/ip.h>
39#include <linux/module.h> 42#include <linux/module.h>
40#include <linux/kernel.h> 43#include <linux/kernel.h>
diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c
index 2eb2860dabb5..702b53ca937c 100644
--- a/net/netfilter/ipvs/ip_vs_est.c
+++ b/net/netfilter/ipvs/ip_vs_est.c
@@ -11,6 +11,10 @@
11 * Changes: 11 * Changes:
12 * 12 *
13 */ 13 */
14
15#define KMSG_COMPONENT "IPVS"
16#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
17
14#include <linux/kernel.h> 18#include <linux/kernel.h>
15#include <linux/jiffies.h> 19#include <linux/jiffies.h>
16#include <linux/slab.h> 20#include <linux/slab.h>
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
index 428edbf481cc..9c16a3f64c1b 100644
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -22,6 +22,9 @@
22 * 22 *
23 */ 23 */
24 24
25#define KMSG_COMPONENT "IPVS"
26#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
27
25#include <linux/module.h> 28#include <linux/module.h>
26#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
27#include <linux/kernel.h> 30#include <linux/kernel.h>
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c
index 3eb5e2660c49..98fb185d890b 100644
--- a/net/netfilter/ipvs/ip_vs_lblc.c
+++ b/net/netfilter/ipvs/ip_vs_lblc.c
@@ -39,6 +39,9 @@
39 * me to write this module. 39 * me to write this module.
40 */ 40 */
41 41
42#define KMSG_COMPONENT "IPVS"
43#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
44
42#include <linux/ip.h> 45#include <linux/ip.h>
43#include <linux/module.h> 46#include <linux/module.h>
44#include <linux/kernel.h> 47#include <linux/kernel.h>
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
index c04ce56c7f0f..5f5e5f4bad5e 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -37,6 +37,9 @@
37 * 37 *
38 */ 38 */
39 39
40#define KMSG_COMPONENT "IPVS"
41#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
42
40#include <linux/ip.h> 43#include <linux/ip.h>
41#include <linux/module.h> 44#include <linux/module.h>
42#include <linux/kernel.h> 45#include <linux/kernel.h>
diff --git a/net/netfilter/ipvs/ip_vs_lc.c b/net/netfilter/ipvs/ip_vs_lc.c
index d0dadc8a65fd..4ecd5e19c39a 100644
--- a/net/netfilter/ipvs/ip_vs_lc.c
+++ b/net/netfilter/ipvs/ip_vs_lc.c
@@ -14,6 +14,9 @@
14 * 14 *
15 */ 15 */
16 16
17#define KMSG_COMPONENT "IPVS"
18#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
19
17#include <linux/module.h> 20#include <linux/module.h>
18#include <linux/kernel.h> 21#include <linux/kernel.h>
19 22
diff --git a/net/netfilter/ipvs/ip_vs_nq.c b/net/netfilter/ipvs/ip_vs_nq.c
index 694952db5026..2224478bdea8 100644
--- a/net/netfilter/ipvs/ip_vs_nq.c
+++ b/net/netfilter/ipvs/ip_vs_nq.c
@@ -31,6 +31,9 @@
31 * 31 *
32 */ 32 */
33 33
34#define KMSG_COMPONENT "IPVS"
35#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
36
34#include <linux/module.h> 37#include <linux/module.h>
35#include <linux/kernel.h> 38#include <linux/kernel.h>
36 39
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c
index a01520e3d6b8..a95bc4021c90 100644
--- a/net/netfilter/ipvs/ip_vs_proto.c
+++ b/net/netfilter/ipvs/ip_vs_proto.c
@@ -13,6 +13,9 @@
13 * 13 *
14 */ 14 */
15 15
16#define KMSG_COMPONENT "IPVS"
17#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
18
16#include <linux/module.h> 19#include <linux/module.h>
17#include <linux/kernel.h> 20#include <linux/kernel.h>
18#include <linux/skbuff.h> 21#include <linux/skbuff.h>
@@ -181,7 +184,7 @@ ip_vs_tcpudp_debug_packet_v4(struct ip_vs_protocol *pp,
181 &ih->daddr, ntohs(pptr[1])); 184 &ih->daddr, ntohs(pptr[1]));
182 } 185 }
183 186
184 printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); 187 pr_debug("%s: %s\n", msg, buf);
185} 188}
186 189
187#ifdef CONFIG_IP_VS_IPV6 190#ifdef CONFIG_IP_VS_IPV6
@@ -215,7 +218,7 @@ ip_vs_tcpudp_debug_packet_v6(struct ip_vs_protocol *pp,
215 &ih->daddr, ntohs(pptr[1])); 218 &ih->daddr, ntohs(pptr[1]));
216 } 219 }
217 220
218 printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); 221 pr_debug("%s: %s\n", msg, buf);
219} 222}
220#endif 223#endif
221 224
diff --git a/net/netfilter/ipvs/ip_vs_proto_ah_esp.c b/net/netfilter/ipvs/ip_vs_proto_ah_esp.c
index 79f56c1e7c19..c30b43c36cd7 100644
--- a/net/netfilter/ipvs/ip_vs_proto_ah_esp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_ah_esp.c
@@ -10,6 +10,9 @@
10 * 10 *
11 */ 11 */
12 12
13#define KMSG_COMPONENT "IPVS"
14#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
15
13#include <linux/in.h> 16#include <linux/in.h>
14#include <linux/ip.h> 17#include <linux/ip.h>
15#include <linux/module.h> 18#include <linux/module.h>
@@ -138,7 +141,7 @@ ah_esp_debug_packet_v4(struct ip_vs_protocol *pp, const struct sk_buff *skb,
138 sprintf(buf, "%s %pI4->%pI4", 141 sprintf(buf, "%s %pI4->%pI4",
139 pp->name, &ih->saddr, &ih->daddr); 142 pp->name, &ih->saddr, &ih->daddr);
140 143
141 printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); 144 pr_debug("%s: %s\n", msg, buf);
142} 145}
143 146
144#ifdef CONFIG_IP_VS_IPV6 147#ifdef CONFIG_IP_VS_IPV6
@@ -156,7 +159,7 @@ ah_esp_debug_packet_v6(struct ip_vs_protocol *pp, const struct sk_buff *skb,
156 sprintf(buf, "%s %pI6->%pI6", 159 sprintf(buf, "%s %pI6->%pI6",
157 pp->name, &ih->saddr, &ih->daddr); 160 pp->name, &ih->saddr, &ih->daddr);
158 161
159 printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); 162 pr_debug("%s: %s\n", msg, buf);
160} 163}
161#endif 164#endif
162 165
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
index 8cba41802850..c36c80d3a2b4 100644
--- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
@@ -13,6 +13,9 @@
13 * 13 *
14 */ 14 */
15 15
16#define KMSG_COMPONENT "IPVS"
17#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
18
16#include <linux/kernel.h> 19#include <linux/kernel.h>
17#include <linux/ip.h> 20#include <linux/ip.h>
18#include <linux/tcp.h> /* for tcphdr */ 21#include <linux/tcp.h> /* for tcphdr */
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c
index d2930a71084b..96ebe40bc537 100644
--- a/net/netfilter/ipvs/ip_vs_proto_udp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_udp.c
@@ -13,6 +13,9 @@
13 * 13 *
14 */ 14 */
15 15
16#define KMSG_COMPONENT "IPVS"
17#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
18
16#include <linux/in.h> 19#include <linux/in.h>
17#include <linux/ip.h> 20#include <linux/ip.h>
18#include <linux/kernel.h> 21#include <linux/kernel.h>
diff --git a/net/netfilter/ipvs/ip_vs_rr.c b/net/netfilter/ipvs/ip_vs_rr.c
index 2d16ab7f8c1e..b01007e1c11e 100644
--- a/net/netfilter/ipvs/ip_vs_rr.c
+++ b/net/netfilter/ipvs/ip_vs_rr.c
@@ -19,6 +19,9 @@
19 * 19 *
20 */ 20 */
21 21
22#define KMSG_COMPONENT "IPVS"
23#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
24
22#include <linux/module.h> 25#include <linux/module.h>
23#include <linux/kernel.h> 26#include <linux/kernel.h>
24 27
diff --git a/net/netfilter/ipvs/ip_vs_sched.c b/net/netfilter/ipvs/ip_vs_sched.c
index a46ad9e35016..87bc5ea0ef29 100644
--- a/net/netfilter/ipvs/ip_vs_sched.c
+++ b/net/netfilter/ipvs/ip_vs_sched.c
@@ -17,6 +17,9 @@
17 * 17 *
18 */ 18 */
19 19
20#define KMSG_COMPONENT "IPVS"
21#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
22
20#include <linux/module.h> 23#include <linux/module.h>
21#include <linux/spinlock.h> 24#include <linux/spinlock.h>
22#include <linux/interrupt.h> 25#include <linux/interrupt.h>
diff --git a/net/netfilter/ipvs/ip_vs_sed.c b/net/netfilter/ipvs/ip_vs_sed.c
index 20e4657d2f3b..4f745dd86dd8 100644
--- a/net/netfilter/ipvs/ip_vs_sed.c
+++ b/net/netfilter/ipvs/ip_vs_sed.c
@@ -35,6 +35,9 @@
35 * 35 *
36 */ 36 */
37 37
38#define KMSG_COMPONENT "IPVS"
39#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
40
38#include <linux/module.h> 41#include <linux/module.h>
39#include <linux/kernel.h> 42#include <linux/kernel.h>
40 43
diff --git a/net/netfilter/ipvs/ip_vs_sh.c b/net/netfilter/ipvs/ip_vs_sh.c
index 75709ebeb630..fb4d2d23f2fe 100644
--- a/net/netfilter/ipvs/ip_vs_sh.c
+++ b/net/netfilter/ipvs/ip_vs_sh.c
@@ -32,6 +32,9 @@
32 * 32 *
33 */ 33 */
34 34
35#define KMSG_COMPONENT "IPVS"
36#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
37
35#include <linux/ip.h> 38#include <linux/ip.h>
36#include <linux/module.h> 39#include <linux/module.h>
37#include <linux/kernel.h> 40#include <linux/kernel.h>
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index 5c48378a852f..cc04c99815fd 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -17,6 +17,9 @@
17 * Justin Ossevoort : Fix endian problem on sync message size. 17 * Justin Ossevoort : Fix endian problem on sync message size.
18 */ 18 */
19 19
20#define KMSG_COMPONENT "IPVS"
21#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
22
20#include <linux/module.h> 23#include <linux/module.h>
21#include <linux/slab.h> 24#include <linux/slab.h>
22#include <linux/inetdevice.h> 25#include <linux/inetdevice.h>
diff --git a/net/netfilter/ipvs/ip_vs_wlc.c b/net/netfilter/ipvs/ip_vs_wlc.c
index 8e942565b47d..bbddfdb10db2 100644
--- a/net/netfilter/ipvs/ip_vs_wlc.c
+++ b/net/netfilter/ipvs/ip_vs_wlc.c
@@ -19,6 +19,9 @@
19 * 19 *
20 */ 20 */
21 21
22#define KMSG_COMPONENT "IPVS"
23#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
24
22#include <linux/module.h> 25#include <linux/module.h>
23#include <linux/kernel.h> 26#include <linux/kernel.h>
24 27
diff --git a/net/netfilter/ipvs/ip_vs_wrr.c b/net/netfilter/ipvs/ip_vs_wrr.c
index f7d74ef1ecf9..c39ebb6c5a54 100644
--- a/net/netfilter/ipvs/ip_vs_wrr.c
+++ b/net/netfilter/ipvs/ip_vs_wrr.c
@@ -18,6 +18,9 @@
18 * 18 *
19 */ 19 */
20 20
21#define KMSG_COMPONENT "IPVS"
22#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
23
21#include <linux/module.h> 24#include <linux/module.h>
22#include <linux/kernel.h> 25#include <linux/kernel.h>
23#include <linux/net.h> 26#include <linux/net.h>
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index 5874657af7f2..061e76dfdad9 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -13,6 +13,9 @@
13 * 13 *
14 */ 14 */
15 15
16#define KMSG_COMPONENT "IPVS"
17#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
18
16#include <linux/kernel.h> 19#include <linux/kernel.h>
17#include <linux/tcp.h> /* for tcphdr */ 20#include <linux/tcp.h> /* for tcphdr */
18#include <net/ip.h> 21#include <net/ip.h>
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index b0e582f2d37a..6ce00205f342 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -151,7 +151,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
151 addr6 = addr; 151 addr6 = addr;
152 mask6 = mask; 152 mask6 = mask;
153 map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); 153 map6 = kzalloc(sizeof(*map6), GFP_ATOMIC);
154 if (map4 == NULL) 154 if (map6 == NULL)
155 goto cfg_unlbl_map_add_failure; 155 goto cfg_unlbl_map_add_failure;
156 map6->type = NETLBL_NLTYPE_UNLABELED; 156 map6->type = NETLBL_NLTYPE_UNLABELED;
157 ipv6_addr_copy(&map6->list.addr, addr6); 157 ipv6_addr_copy(&map6->list.addr, addr6);
@@ -185,8 +185,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
185 return 0; 185 return 0;
186 186
187cfg_unlbl_map_add_failure: 187cfg_unlbl_map_add_failure:
188 if (entry != NULL) 188 kfree(entry->domain);
189 kfree(entry->domain);
190 kfree(entry); 189 kfree(entry);
191 kfree(addrmap); 190 kfree(addrmap);
192 kfree(map4); 191 kfree(map4);
@@ -385,8 +384,7 @@ int netlbl_cfg_cipsov4_map_add(u32 doi,
385 384
386cfg_cipsov4_map_add_failure: 385cfg_cipsov4_map_add_failure:
387 cipso_v4_doi_putdef(doi_def); 386 cipso_v4_doi_putdef(doi_def);
388 if (entry != NULL) 387 kfree(entry->domain);
389 kfree(entry->domain);
390 kfree(entry); 388 kfree(entry);
391 kfree(addrmap); 389 kfree(addrmap);
392 kfree(addrinfo); 390 kfree(addrinfo);
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 6bd8e93869ed..f0a76f6bca71 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -92,23 +92,21 @@ static void rose_set_lockdep_key(struct net_device *dev)
92/* 92/*
93 * Convert a ROSE address into text. 93 * Convert a ROSE address into text.
94 */ 94 */
95const char *rose2asc(const rose_address *addr) 95char *rose2asc(char *buf, const rose_address *addr)
96{ 96{
97 static char buffer[11];
98
99 if (addr->rose_addr[0] == 0x00 && addr->rose_addr[1] == 0x00 && 97 if (addr->rose_addr[0] == 0x00 && addr->rose_addr[1] == 0x00 &&
100 addr->rose_addr[2] == 0x00 && addr->rose_addr[3] == 0x00 && 98 addr->rose_addr[2] == 0x00 && addr->rose_addr[3] == 0x00 &&
101 addr->rose_addr[4] == 0x00) { 99 addr->rose_addr[4] == 0x00) {
102 strcpy(buffer, "*"); 100 strcpy(buf, "*");
103 } else { 101 } else {
104 sprintf(buffer, "%02X%02X%02X%02X%02X", addr->rose_addr[0] & 0xFF, 102 sprintf(buf, "%02X%02X%02X%02X%02X", addr->rose_addr[0] & 0xFF,
105 addr->rose_addr[1] & 0xFF, 103 addr->rose_addr[1] & 0xFF,
106 addr->rose_addr[2] & 0xFF, 104 addr->rose_addr[2] & 0xFF,
107 addr->rose_addr[3] & 0xFF, 105 addr->rose_addr[3] & 0xFF,
108 addr->rose_addr[4] & 0xFF); 106 addr->rose_addr[4] & 0xFF);
109 } 107 }
110 108
111 return buffer; 109 return buf;
112} 110}
113 111
114/* 112/*
@@ -1437,7 +1435,7 @@ static void rose_info_stop(struct seq_file *seq, void *v)
1437 1435
1438static int rose_info_show(struct seq_file *seq, void *v) 1436static int rose_info_show(struct seq_file *seq, void *v)
1439{ 1437{
1440 char buf[11]; 1438 char buf[11], rsbuf[11];
1441 1439
1442 if (v == SEQ_START_TOKEN) 1440 if (v == SEQ_START_TOKEN)
1443 seq_puts(seq, 1441 seq_puts(seq,
@@ -1455,8 +1453,8 @@ static int rose_info_show(struct seq_file *seq, void *v)
1455 devname = dev->name; 1453 devname = dev->name;
1456 1454
1457 seq_printf(seq, "%-10s %-9s ", 1455 seq_printf(seq, "%-10s %-9s ",
1458 rose2asc(&rose->dest_addr), 1456 rose2asc(rsbuf, &rose->dest_addr),
1459 ax2asc(buf, &rose->dest_call)); 1457 ax2asc(buf, &rose->dest_call));
1460 1458
1461 if (ax25cmp(&rose->source_call, &null_ax25_address) == 0) 1459 if (ax25cmp(&rose->source_call, &null_ax25_address) == 0)
1462 callsign = "??????-?"; 1460 callsign = "??????-?";
@@ -1465,7 +1463,7 @@ static int rose_info_show(struct seq_file *seq, void *v)
1465 1463
1466 seq_printf(seq, 1464 seq_printf(seq,
1467 "%-10s %-9s %-5s %3.3X %05d %d %d %d %d %3lu %3lu %3lu %3lu %3lu %3lu/%03lu %5d %5d %ld\n", 1465 "%-10s %-9s %-5s %3.3X %05d %d %d %d %d %3lu %3lu %3lu %3lu %3lu %3lu/%03lu %5d %5d %ld\n",
1468 rose2asc(&rose->source_addr), 1466 rose2asc(rsbuf, &rose->source_addr),
1469 callsign, 1467 callsign,
1470 devname, 1468 devname,
1471 rose->lci & 0x0FFF, 1469 rose->lci & 0x0FFF,
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index a81066a1010a..9478d9b3d977 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -1104,6 +1104,7 @@ static void rose_node_stop(struct seq_file *seq, void *v)
1104 1104
1105static int rose_node_show(struct seq_file *seq, void *v) 1105static int rose_node_show(struct seq_file *seq, void *v)
1106{ 1106{
1107 char rsbuf[11];
1107 int i; 1108 int i;
1108 1109
1109 if (v == SEQ_START_TOKEN) 1110 if (v == SEQ_START_TOKEN)
@@ -1112,13 +1113,13 @@ static int rose_node_show(struct seq_file *seq, void *v)
1112 const struct rose_node *rose_node = v; 1113 const struct rose_node *rose_node = v;
1113 /* if (rose_node->loopback) { 1114 /* if (rose_node->loopback) {
1114 seq_printf(seq, "%-10s %04d 1 loopback\n", 1115 seq_printf(seq, "%-10s %04d 1 loopback\n",
1115 rose2asc(&rose_node->address), 1116 rose2asc(rsbuf, &rose_node->address),
1116 rose_node->mask); 1117 rose_node->mask);
1117 } else { */ 1118 } else { */
1118 seq_printf(seq, "%-10s %04d %d", 1119 seq_printf(seq, "%-10s %04d %d",
1119 rose2asc(&rose_node->address), 1120 rose2asc(rsbuf, &rose_node->address),
1120 rose_node->mask, 1121 rose_node->mask,
1121 rose_node->count); 1122 rose_node->count);
1122 1123
1123 for (i = 0; i < rose_node->count; i++) 1124 for (i = 0; i < rose_node->count; i++)
1124 seq_printf(seq, " %05d", 1125 seq_printf(seq, " %05d",
@@ -1267,7 +1268,7 @@ static void rose_route_stop(struct seq_file *seq, void *v)
1267 1268
1268static int rose_route_show(struct seq_file *seq, void *v) 1269static int rose_route_show(struct seq_file *seq, void *v)
1269{ 1270{
1270 char buf[11]; 1271 char buf[11], rsbuf[11];
1271 1272
1272 if (v == SEQ_START_TOKEN) 1273 if (v == SEQ_START_TOKEN)
1273 seq_puts(seq, 1274 seq_puts(seq,
@@ -1279,7 +1280,7 @@ static int rose_route_show(struct seq_file *seq, void *v)
1279 seq_printf(seq, 1280 seq_printf(seq,
1280 "%3.3X %-10s %-9s %05d ", 1281 "%3.3X %-10s %-9s %05d ",
1281 rose_route->lci1, 1282 rose_route->lci1,
1282 rose2asc(&rose_route->src_addr), 1283 rose2asc(rsbuf, &rose_route->src_addr),
1283 ax2asc(buf, &rose_route->src_call), 1284 ax2asc(buf, &rose_route->src_call),
1284 rose_route->neigh1->number); 1285 rose_route->neigh1->number);
1285 else 1286 else
@@ -1289,10 +1290,10 @@ static int rose_route_show(struct seq_file *seq, void *v)
1289 if (rose_route->neigh2) 1290 if (rose_route->neigh2)
1290 seq_printf(seq, 1291 seq_printf(seq,
1291 "%3.3X %-10s %-9s %05d\n", 1292 "%3.3X %-10s %-9s %05d\n",
1292 rose_route->lci2, 1293 rose_route->lci2,
1293 rose2asc(&rose_route->dest_addr), 1294 rose2asc(rsbuf, &rose_route->dest_addr),
1294 ax2asc(buf, &rose_route->dest_call), 1295 ax2asc(buf, &rose_route->dest_call),
1295 rose_route->neigh2->number); 1296 rose_route->neigh2->number);
1296 else 1297 else
1297 seq_puts(seq, 1298 seq_puts(seq,
1298 "000 * * 00000\n"); 1299 "000 * * 00000\n");