aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/event.c25
-rw-r--r--drivers/atm/idt77252.c2
-rw-r--r--drivers/connector/cn_proc.c72
-rw-r--r--drivers/isdn/isdnloop/isdnloop.c8
-rw-r--r--drivers/net/bonding/bond_sysfs.c30
-rw-r--r--drivers/net/bonding/bonding.h3
-rw-r--r--drivers/net/ethernet/atheros/alx/main.c3
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c5
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c17
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h11
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c2
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c16
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c16
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c7
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c31
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c14
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c3
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c12
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c12
-rw-r--r--drivers/net/ethernet/ti/cpsw.c36
-rw-r--r--drivers/net/ethernet/xscale/ixp4xx_eth.c12
-rw-r--r--drivers/net/macvtap.c8
-rw-r--r--drivers/net/team/team.c29
-rw-r--r--drivers/net/tun.c10
-rw-r--r--drivers/net/usb/cdc_ncm.c2
-rw-r--r--drivers/net/usb/usbnet.c3
-rw-r--r--drivers/net/virtio_net.c34
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_hw.c22
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9485_initvals.h42
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h19
-rw-r--r--drivers/net/wireless/ath/ath9k/dfs_debug.c13
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c87
-rw-r--r--drivers/net/wireless/ath/wcn36xx/debug.c2
-rw-r--r--drivers/net/wireless/ath/wcn36xx/smd.c9
-rw-r--r--drivers/net/wireless/libertas/debugfs.c6
-rw-r--r--drivers/net/wireless/libertas/if_cs.c1
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c5
-rw-r--r--drivers/net/wireless/mwifiex/fw.h4
-rw-r--r--drivers/net/wireless/mwifiex/ie.c11
-rw-r--r--drivers/net/wireless/mwifiex/sdio.c3
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmd.c4
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c46
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c5
-rw-r--r--drivers/net/wireless/mwifiex/uap_txrx.c29
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c3
-rw-r--r--drivers/net/wireless/prism54/islpci_dev.c7
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c4
-rw-r--r--drivers/net/wireless/rtlwifi/base.c93
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.c5
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/trx.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/trx.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/rf.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/trx.c2
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h6
-rw-r--r--drivers/net/xen-netfront.c7
-rw-r--r--drivers/scsi/pmcraid.c3
-rw-r--r--drivers/thermal/thermal_core.c25
65 files changed, 538 insertions, 379 deletions
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index fdef416c0ff6..cae3b387b867 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -78,15 +78,17 @@ enum {
78#define ACPI_GENL_VERSION 0x01 78#define ACPI_GENL_VERSION 0x01
79#define ACPI_GENL_MCAST_GROUP_NAME "acpi_mc_group" 79#define ACPI_GENL_MCAST_GROUP_NAME "acpi_mc_group"
80 80
81static const struct genl_multicast_group acpi_event_mcgrps[] = {
82 { .name = ACPI_GENL_MCAST_GROUP_NAME, },
83};
84
81static struct genl_family acpi_event_genl_family = { 85static struct genl_family acpi_event_genl_family = {
82 .id = GENL_ID_GENERATE, 86 .id = GENL_ID_GENERATE,
83 .name = ACPI_GENL_FAMILY_NAME, 87 .name = ACPI_GENL_FAMILY_NAME,
84 .version = ACPI_GENL_VERSION, 88 .version = ACPI_GENL_VERSION,
85 .maxattr = ACPI_GENL_ATTR_MAX, 89 .maxattr = ACPI_GENL_ATTR_MAX,
86}; 90 .mcgrps = acpi_event_mcgrps,
87 91 .n_mcgrps = ARRAY_SIZE(acpi_event_mcgrps),
88static struct genl_multicast_group acpi_event_mcgrp = {
89 .name = ACPI_GENL_MCAST_GROUP_NAME,
90}; 92};
91 93
92int acpi_bus_generate_netlink_event(const char *device_class, 94int acpi_bus_generate_netlink_event(const char *device_class,
@@ -141,7 +143,7 @@ int acpi_bus_generate_netlink_event(const char *device_class,
141 return result; 143 return result;
142 } 144 }
143 145
144 genlmsg_multicast(skb, 0, acpi_event_mcgrp.id, GFP_ATOMIC); 146 genlmsg_multicast(&acpi_event_genl_family, skb, 0, 0, GFP_ATOMIC);
145 return 0; 147 return 0;
146} 148}
147 149
@@ -149,18 +151,7 @@ EXPORT_SYMBOL(acpi_bus_generate_netlink_event);
149 151
150static int acpi_event_genetlink_init(void) 152static int acpi_event_genetlink_init(void)
151{ 153{
152 int result; 154 return genl_register_family(&acpi_event_genl_family);
153
154 result = genl_register_family(&acpi_event_genl_family);
155 if (result)
156 return result;
157
158 result = genl_register_mc_group(&acpi_event_genl_family,
159 &acpi_event_mcgrp);
160 if (result)
161 genl_unregister_family(&acpi_event_genl_family);
162
163 return result;
164} 155}
165 156
166#else 157#else
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 272f00927761..1bdf104e90bb 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -3511,7 +3511,7 @@ static int init_card(struct atm_dev *dev)
3511 tmp = dev_get_by_name(&init_net, tname); /* jhs: was "tmp = dev_get(tname);" */ 3511 tmp = dev_get_by_name(&init_net, tname); /* jhs: was "tmp = dev_get(tname);" */
3512 if (tmp) { 3512 if (tmp) {
3513 memcpy(card->atmdev->esi, tmp->dev_addr, 6); 3513 memcpy(card->atmdev->esi, tmp->dev_addr, 6);
3514 3514 dev_put(tmp);
3515 printk("%s: ESI %pM\n", card->name, card->atmdev->esi); 3515 printk("%s: ESI %pM\n", card->name, card->atmdev->esi);
3516 } 3516 }
3517 /* 3517 /*
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index c73fc2b74de2..18c5b9b16645 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -32,11 +32,23 @@
32#include <linux/atomic.h> 32#include <linux/atomic.h>
33#include <linux/pid_namespace.h> 33#include <linux/pid_namespace.h>
34 34
35#include <asm/unaligned.h>
36
37#include <linux/cn_proc.h> 35#include <linux/cn_proc.h>
38 36
39#define CN_PROC_MSG_SIZE (sizeof(struct cn_msg) + sizeof(struct proc_event)) 37/*
38 * Size of a cn_msg followed by a proc_event structure. Since the
39 * sizeof struct cn_msg is a multiple of 4 bytes, but not 8 bytes, we
40 * add one 4-byte word to the size here, and then start the actual
41 * cn_msg structure 4 bytes into the stack buffer. The result is that
42 * the immediately following proc_event structure is aligned to 8 bytes.
43 */
44#define CN_PROC_MSG_SIZE (sizeof(struct cn_msg) + sizeof(struct proc_event) + 4)
45
46/* See comment above; we test our assumption about sizeof struct cn_msg here. */
47static inline struct cn_msg *buffer_to_cn_msg(__u8 *buffer)
48{
49 BUILD_BUG_ON(sizeof(struct cn_msg) != 20);
50 return (struct cn_msg *)(buffer + 4);
51}
40 52
41static atomic_t proc_event_num_listeners = ATOMIC_INIT(0); 53static atomic_t proc_event_num_listeners = ATOMIC_INIT(0);
42static struct cb_id cn_proc_event_id = { CN_IDX_PROC, CN_VAL_PROC }; 54static struct cb_id cn_proc_event_id = { CN_IDX_PROC, CN_VAL_PROC };
@@ -56,19 +68,19 @@ void proc_fork_connector(struct task_struct *task)
56{ 68{
57 struct cn_msg *msg; 69 struct cn_msg *msg;
58 struct proc_event *ev; 70 struct proc_event *ev;
59 __u8 buffer[CN_PROC_MSG_SIZE]; 71 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
60 struct timespec ts; 72 struct timespec ts;
61 struct task_struct *parent; 73 struct task_struct *parent;
62 74
63 if (atomic_read(&proc_event_num_listeners) < 1) 75 if (atomic_read(&proc_event_num_listeners) < 1)
64 return; 76 return;
65 77
66 msg = (struct cn_msg *)buffer; 78 msg = buffer_to_cn_msg(buffer);
67 ev = (struct proc_event *)msg->data; 79 ev = (struct proc_event *)msg->data;
68 memset(&ev->event_data, 0, sizeof(ev->event_data)); 80 memset(&ev->event_data, 0, sizeof(ev->event_data));
69 get_seq(&msg->seq, &ev->cpu); 81 get_seq(&msg->seq, &ev->cpu);
70 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 82 ktime_get_ts(&ts); /* get high res monotonic timestamp */
71 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 83 ev->timestamp_ns = timespec_to_ns(&ts);
72 ev->what = PROC_EVENT_FORK; 84 ev->what = PROC_EVENT_FORK;
73 rcu_read_lock(); 85 rcu_read_lock();
74 parent = rcu_dereference(task->real_parent); 86 parent = rcu_dereference(task->real_parent);
@@ -91,17 +103,17 @@ void proc_exec_connector(struct task_struct *task)
91 struct cn_msg *msg; 103 struct cn_msg *msg;
92 struct proc_event *ev; 104 struct proc_event *ev;
93 struct timespec ts; 105 struct timespec ts;
94 __u8 buffer[CN_PROC_MSG_SIZE]; 106 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
95 107
96 if (atomic_read(&proc_event_num_listeners) < 1) 108 if (atomic_read(&proc_event_num_listeners) < 1)
97 return; 109 return;
98 110
99 msg = (struct cn_msg *)buffer; 111 msg = buffer_to_cn_msg(buffer);
100 ev = (struct proc_event *)msg->data; 112 ev = (struct proc_event *)msg->data;
101 memset(&ev->event_data, 0, sizeof(ev->event_data)); 113 memset(&ev->event_data, 0, sizeof(ev->event_data));
102 get_seq(&msg->seq, &ev->cpu); 114 get_seq(&msg->seq, &ev->cpu);
103 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 115 ktime_get_ts(&ts); /* get high res monotonic timestamp */
104 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 116 ev->timestamp_ns = timespec_to_ns(&ts);
105 ev->what = PROC_EVENT_EXEC; 117 ev->what = PROC_EVENT_EXEC;
106 ev->event_data.exec.process_pid = task->pid; 118 ev->event_data.exec.process_pid = task->pid;
107 ev->event_data.exec.process_tgid = task->tgid; 119 ev->event_data.exec.process_tgid = task->tgid;
@@ -117,14 +129,14 @@ void proc_id_connector(struct task_struct *task, int which_id)
117{ 129{
118 struct cn_msg *msg; 130 struct cn_msg *msg;
119 struct proc_event *ev; 131 struct proc_event *ev;
120 __u8 buffer[CN_PROC_MSG_SIZE]; 132 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
121 struct timespec ts; 133 struct timespec ts;
122 const struct cred *cred; 134 const struct cred *cred;
123 135
124 if (atomic_read(&proc_event_num_listeners) < 1) 136 if (atomic_read(&proc_event_num_listeners) < 1)
125 return; 137 return;
126 138
127 msg = (struct cn_msg *)buffer; 139 msg = buffer_to_cn_msg(buffer);
128 ev = (struct proc_event *)msg->data; 140 ev = (struct proc_event *)msg->data;
129 memset(&ev->event_data, 0, sizeof(ev->event_data)); 141 memset(&ev->event_data, 0, sizeof(ev->event_data));
130 ev->what = which_id; 142 ev->what = which_id;
@@ -145,7 +157,7 @@ void proc_id_connector(struct task_struct *task, int which_id)
145 rcu_read_unlock(); 157 rcu_read_unlock();
146 get_seq(&msg->seq, &ev->cpu); 158 get_seq(&msg->seq, &ev->cpu);
147 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 159 ktime_get_ts(&ts); /* get high res monotonic timestamp */
148 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 160 ev->timestamp_ns = timespec_to_ns(&ts);
149 161
150 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 162 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
151 msg->ack = 0; /* not used */ 163 msg->ack = 0; /* not used */
@@ -159,17 +171,17 @@ void proc_sid_connector(struct task_struct *task)
159 struct cn_msg *msg; 171 struct cn_msg *msg;
160 struct proc_event *ev; 172 struct proc_event *ev;
161 struct timespec ts; 173 struct timespec ts;
162 __u8 buffer[CN_PROC_MSG_SIZE]; 174 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
163 175
164 if (atomic_read(&proc_event_num_listeners) < 1) 176 if (atomic_read(&proc_event_num_listeners) < 1)
165 return; 177 return;
166 178
167 msg = (struct cn_msg *)buffer; 179 msg = buffer_to_cn_msg(buffer);
168 ev = (struct proc_event *)msg->data; 180 ev = (struct proc_event *)msg->data;
169 memset(&ev->event_data, 0, sizeof(ev->event_data)); 181 memset(&ev->event_data, 0, sizeof(ev->event_data));
170 get_seq(&msg->seq, &ev->cpu); 182 get_seq(&msg->seq, &ev->cpu);
171 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 183 ktime_get_ts(&ts); /* get high res monotonic timestamp */
172 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 184 ev->timestamp_ns = timespec_to_ns(&ts);
173 ev->what = PROC_EVENT_SID; 185 ev->what = PROC_EVENT_SID;
174 ev->event_data.sid.process_pid = task->pid; 186 ev->event_data.sid.process_pid = task->pid;
175 ev->event_data.sid.process_tgid = task->tgid; 187 ev->event_data.sid.process_tgid = task->tgid;
@@ -186,17 +198,17 @@ void proc_ptrace_connector(struct task_struct *task, int ptrace_id)
186 struct cn_msg *msg; 198 struct cn_msg *msg;
187 struct proc_event *ev; 199 struct proc_event *ev;
188 struct timespec ts; 200 struct timespec ts;
189 __u8 buffer[CN_PROC_MSG_SIZE]; 201 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
190 202
191 if (atomic_read(&proc_event_num_listeners) < 1) 203 if (atomic_read(&proc_event_num_listeners) < 1)
192 return; 204 return;
193 205
194 msg = (struct cn_msg *)buffer; 206 msg = buffer_to_cn_msg(buffer);
195 ev = (struct proc_event *)msg->data; 207 ev = (struct proc_event *)msg->data;
196 memset(&ev->event_data, 0, sizeof(ev->event_data)); 208 memset(&ev->event_data, 0, sizeof(ev->event_data));
197 get_seq(&msg->seq, &ev->cpu); 209 get_seq(&msg->seq, &ev->cpu);
198 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 210 ktime_get_ts(&ts); /* get high res monotonic timestamp */
199 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 211 ev->timestamp_ns = timespec_to_ns(&ts);
200 ev->what = PROC_EVENT_PTRACE; 212 ev->what = PROC_EVENT_PTRACE;
201 ev->event_data.ptrace.process_pid = task->pid; 213 ev->event_data.ptrace.process_pid = task->pid;
202 ev->event_data.ptrace.process_tgid = task->tgid; 214 ev->event_data.ptrace.process_tgid = task->tgid;
@@ -221,17 +233,17 @@ void proc_comm_connector(struct task_struct *task)
221 struct cn_msg *msg; 233 struct cn_msg *msg;
222 struct proc_event *ev; 234 struct proc_event *ev;
223 struct timespec ts; 235 struct timespec ts;
224 __u8 buffer[CN_PROC_MSG_SIZE]; 236 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
225 237
226 if (atomic_read(&proc_event_num_listeners) < 1) 238 if (atomic_read(&proc_event_num_listeners) < 1)
227 return; 239 return;
228 240
229 msg = (struct cn_msg *)buffer; 241 msg = buffer_to_cn_msg(buffer);
230 ev = (struct proc_event *)msg->data; 242 ev = (struct proc_event *)msg->data;
231 memset(&ev->event_data, 0, sizeof(ev->event_data)); 243 memset(&ev->event_data, 0, sizeof(ev->event_data));
232 get_seq(&msg->seq, &ev->cpu); 244 get_seq(&msg->seq, &ev->cpu);
233 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 245 ktime_get_ts(&ts); /* get high res monotonic timestamp */
234 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 246 ev->timestamp_ns = timespec_to_ns(&ts);
235 ev->what = PROC_EVENT_COMM; 247 ev->what = PROC_EVENT_COMM;
236 ev->event_data.comm.process_pid = task->pid; 248 ev->event_data.comm.process_pid = task->pid;
237 ev->event_data.comm.process_tgid = task->tgid; 249 ev->event_data.comm.process_tgid = task->tgid;
@@ -248,18 +260,18 @@ void proc_coredump_connector(struct task_struct *task)
248{ 260{
249 struct cn_msg *msg; 261 struct cn_msg *msg;
250 struct proc_event *ev; 262 struct proc_event *ev;
251 __u8 buffer[CN_PROC_MSG_SIZE]; 263 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
252 struct timespec ts; 264 struct timespec ts;
253 265
254 if (atomic_read(&proc_event_num_listeners) < 1) 266 if (atomic_read(&proc_event_num_listeners) < 1)
255 return; 267 return;
256 268
257 msg = (struct cn_msg *)buffer; 269 msg = buffer_to_cn_msg(buffer);
258 ev = (struct proc_event *)msg->data; 270 ev = (struct proc_event *)msg->data;
259 memset(&ev->event_data, 0, sizeof(ev->event_data)); 271 memset(&ev->event_data, 0, sizeof(ev->event_data));
260 get_seq(&msg->seq, &ev->cpu); 272 get_seq(&msg->seq, &ev->cpu);
261 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 273 ktime_get_ts(&ts); /* get high res monotonic timestamp */
262 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 274 ev->timestamp_ns = timespec_to_ns(&ts);
263 ev->what = PROC_EVENT_COREDUMP; 275 ev->what = PROC_EVENT_COREDUMP;
264 ev->event_data.coredump.process_pid = task->pid; 276 ev->event_data.coredump.process_pid = task->pid;
265 ev->event_data.coredump.process_tgid = task->tgid; 277 ev->event_data.coredump.process_tgid = task->tgid;
@@ -275,18 +287,18 @@ void proc_exit_connector(struct task_struct *task)
275{ 287{
276 struct cn_msg *msg; 288 struct cn_msg *msg;
277 struct proc_event *ev; 289 struct proc_event *ev;
278 __u8 buffer[CN_PROC_MSG_SIZE]; 290 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
279 struct timespec ts; 291 struct timespec ts;
280 292
281 if (atomic_read(&proc_event_num_listeners) < 1) 293 if (atomic_read(&proc_event_num_listeners) < 1)
282 return; 294 return;
283 295
284 msg = (struct cn_msg *)buffer; 296 msg = buffer_to_cn_msg(buffer);
285 ev = (struct proc_event *)msg->data; 297 ev = (struct proc_event *)msg->data;
286 memset(&ev->event_data, 0, sizeof(ev->event_data)); 298 memset(&ev->event_data, 0, sizeof(ev->event_data));
287 get_seq(&msg->seq, &ev->cpu); 299 get_seq(&msg->seq, &ev->cpu);
288 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 300 ktime_get_ts(&ts); /* get high res monotonic timestamp */
289 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 301 ev->timestamp_ns = timespec_to_ns(&ts);
290 ev->what = PROC_EVENT_EXIT; 302 ev->what = PROC_EVENT_EXIT;
291 ev->event_data.exit.process_pid = task->pid; 303 ev->event_data.exit.process_pid = task->pid;
292 ev->event_data.exit.process_tgid = task->tgid; 304 ev->event_data.exit.process_tgid = task->tgid;
@@ -312,18 +324,18 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
312{ 324{
313 struct cn_msg *msg; 325 struct cn_msg *msg;
314 struct proc_event *ev; 326 struct proc_event *ev;
315 __u8 buffer[CN_PROC_MSG_SIZE]; 327 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
316 struct timespec ts; 328 struct timespec ts;
317 329
318 if (atomic_read(&proc_event_num_listeners) < 1) 330 if (atomic_read(&proc_event_num_listeners) < 1)
319 return; 331 return;
320 332
321 msg = (struct cn_msg *)buffer; 333 msg = buffer_to_cn_msg(buffer);
322 ev = (struct proc_event *)msg->data; 334 ev = (struct proc_event *)msg->data;
323 memset(&ev->event_data, 0, sizeof(ev->event_data)); 335 memset(&ev->event_data, 0, sizeof(ev->event_data));
324 msg->seq = rcvd_seq; 336 msg->seq = rcvd_seq;
325 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 337 ktime_get_ts(&ts); /* get high res monotonic timestamp */
326 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 338 ev->timestamp_ns = timespec_to_ns(&ts);
327 ev->cpu = -1; 339 ev->cpu = -1;
328 ev->what = PROC_EVENT_NONE; 340 ev->what = PROC_EVENT_NONE;
329 ev->event_data.ack.err = err; 341 ev->event_data.ack.err = err;
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index baf2686aa8eb..02125e6a9109 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -1083,8 +1083,10 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
1083 spin_unlock_irqrestore(&card->isdnloop_lock, flags); 1083 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1084 return -ENOMEM; 1084 return -ENOMEM;
1085 } 1085 }
1086 for (i = 0; i < 3; i++) 1086 for (i = 0; i < 3; i++) {
1087 strcpy(card->s0num[i], sdef.num[i]); 1087 strlcpy(card->s0num[i], sdef.num[i],
1088 sizeof(card->s0num[0]));
1089 }
1088 break; 1090 break;
1089 case ISDN_PTYPE_1TR6: 1091 case ISDN_PTYPE_1TR6:
1090 if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95", 1092 if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95",
@@ -1097,7 +1099,7 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
1097 spin_unlock_irqrestore(&card->isdnloop_lock, flags); 1099 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1098 return -ENOMEM; 1100 return -ENOMEM;
1099 } 1101 }
1100 strcpy(card->s0num[0], sdef.num[0]); 1102 strlcpy(card->s0num[0], sdef.num[0], sizeof(card->s0num[0]));
1101 card->s0num[1][0] = '\0'; 1103 card->s0num[1][0] = '\0';
1102 card->s0num[2][0] = '\0'; 1104 card->s0num[2][0] = '\0';
1103 break; 1105 break;
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index bc8fd362a5aa..0ec2a7e8c8a9 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -524,8 +524,9 @@ static ssize_t bonding_store_arp_interval(struct device *d,
524 goto out; 524 goto out;
525 } 525 }
526 if (bond->params.mode == BOND_MODE_ALB || 526 if (bond->params.mode == BOND_MODE_ALB ||
527 bond->params.mode == BOND_MODE_TLB) { 527 bond->params.mode == BOND_MODE_TLB ||
528 pr_info("%s: ARP monitoring cannot be used with ALB/TLB. Only MII monitoring is supported on %s.\n", 528 bond->params.mode == BOND_MODE_8023AD) {
529 pr_info("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n",
529 bond->dev->name, bond->dev->name); 530 bond->dev->name, bond->dev->name);
530 ret = -EINVAL; 531 ret = -EINVAL;
531 goto out; 532 goto out;
@@ -603,15 +604,14 @@ static ssize_t bonding_store_arp_targets(struct device *d,
603 return restart_syscall(); 604 return restart_syscall();
604 605
605 targets = bond->params.arp_targets; 606 targets = bond->params.arp_targets;
606 newtarget = in_aton(buf + 1); 607 if (!in4_pton(buf + 1, -1, (u8 *)&newtarget, -1, NULL) ||
608 IS_IP_TARGET_UNUSABLE_ADDRESS(newtarget)) {
609 pr_err("%s: invalid ARP target %pI4 specified for addition\n",
610 bond->dev->name, &newtarget);
611 goto out;
612 }
607 /* look for adds */ 613 /* look for adds */
608 if (buf[0] == '+') { 614 if (buf[0] == '+') {
609 if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) {
610 pr_err("%s: invalid ARP target %pI4 specified for addition\n",
611 bond->dev->name, &newtarget);
612 goto out;
613 }
614
615 if (bond_get_targets_ip(targets, newtarget) != -1) { /* dup */ 615 if (bond_get_targets_ip(targets, newtarget) != -1) { /* dup */
616 pr_err("%s: ARP target %pI4 is already present\n", 616 pr_err("%s: ARP target %pI4 is already present\n",
617 bond->dev->name, &newtarget); 617 bond->dev->name, &newtarget);
@@ -634,12 +634,6 @@ static ssize_t bonding_store_arp_targets(struct device *d,
634 targets[ind] = newtarget; 634 targets[ind] = newtarget;
635 write_unlock_bh(&bond->lock); 635 write_unlock_bh(&bond->lock);
636 } else if (buf[0] == '-') { 636 } else if (buf[0] == '-') {
637 if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) {
638 pr_err("%s: invalid ARP target %pI4 specified for removal\n",
639 bond->dev->name, &newtarget);
640 goto out;
641 }
642
643 ind = bond_get_targets_ip(targets, newtarget); 637 ind = bond_get_targets_ip(targets, newtarget);
644 if (ind == -1) { 638 if (ind == -1) {
645 pr_err("%s: unable to remove nonexistent ARP target %pI4.\n", 639 pr_err("%s: unable to remove nonexistent ARP target %pI4.\n",
@@ -701,6 +695,8 @@ static ssize_t bonding_store_downdelay(struct device *d,
701 int new_value, ret = count; 695 int new_value, ret = count;
702 struct bonding *bond = to_bond(d); 696 struct bonding *bond = to_bond(d);
703 697
698 if (!rtnl_trylock())
699 return restart_syscall();
704 if (!(bond->params.miimon)) { 700 if (!(bond->params.miimon)) {
705 pr_err("%s: Unable to set down delay as MII monitoring is disabled\n", 701 pr_err("%s: Unable to set down delay as MII monitoring is disabled\n",
706 bond->dev->name); 702 bond->dev->name);
@@ -734,6 +730,7 @@ static ssize_t bonding_store_downdelay(struct device *d,
734 } 730 }
735 731
736out: 732out:
733 rtnl_unlock();
737 return ret; 734 return ret;
738} 735}
739static DEVICE_ATTR(downdelay, S_IRUGO | S_IWUSR, 736static DEVICE_ATTR(downdelay, S_IRUGO | S_IWUSR,
@@ -756,6 +753,8 @@ static ssize_t bonding_store_updelay(struct device *d,
756 int new_value, ret = count; 753 int new_value, ret = count;
757 struct bonding *bond = to_bond(d); 754 struct bonding *bond = to_bond(d);
758 755
756 if (!rtnl_trylock())
757 return restart_syscall();
759 if (!(bond->params.miimon)) { 758 if (!(bond->params.miimon)) {
760 pr_err("%s: Unable to set up delay as MII monitoring is disabled\n", 759 pr_err("%s: Unable to set up delay as MII monitoring is disabled\n",
761 bond->dev->name); 760 bond->dev->name);
@@ -789,6 +788,7 @@ static ssize_t bonding_store_updelay(struct device *d,
789 } 788 }
790 789
791out: 790out:
791 rtnl_unlock();
792 return ret; 792 return ret;
793} 793}
794static DEVICE_ATTR(updelay, S_IRUGO | S_IWUSR, 794static DEVICE_ATTR(updelay, S_IRUGO | S_IWUSR,
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 77a07a12e77f..ca31286aa028 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -63,6 +63,9 @@
63 (((mode) == BOND_MODE_TLB) || \ 63 (((mode) == BOND_MODE_TLB) || \
64 ((mode) == BOND_MODE_ALB)) 64 ((mode) == BOND_MODE_ALB))
65 65
66#define IS_IP_TARGET_UNUSABLE_ADDRESS(a) \
67 ((htonl(INADDR_BROADCAST) == a) || \
68 ipv4_is_zeronet(a))
66/* 69/*
67 * Less bad way to call ioctl from within the kernel; this needs to be 70 * Less bad way to call ioctl from within the kernel; this needs to be
68 * done some other way to get the call out of interrupt context. 71 * done some other way to get the call out of interrupt context.
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index 5aa5e8146496..c3c4c266b846 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -1388,6 +1388,9 @@ static int alx_resume(struct device *dev)
1388{ 1388{
1389 struct pci_dev *pdev = to_pci_dev(dev); 1389 struct pci_dev *pdev = to_pci_dev(dev);
1390 struct alx_priv *alx = pci_get_drvdata(pdev); 1390 struct alx_priv *alx = pci_get_drvdata(pdev);
1391 struct alx_hw *hw = &alx->hw;
1392
1393 alx_reset_phy(hw);
1391 1394
1392 if (!netif_running(alx->dev)) 1395 if (!netif_running(alx->dev))
1393 return 0; 1396 return 0;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 4e01c57d8c8d..a1f66e2c9a86 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1376,7 +1376,6 @@ enum {
1376 BNX2X_SP_RTNL_RX_MODE, 1376 BNX2X_SP_RTNL_RX_MODE,
1377 BNX2X_SP_RTNL_HYPERVISOR_VLAN, 1377 BNX2X_SP_RTNL_HYPERVISOR_VLAN,
1378 BNX2X_SP_RTNL_TX_STOP, 1378 BNX2X_SP_RTNL_TX_STOP,
1379 BNX2X_SP_RTNL_TX_RESUME,
1380}; 1379};
1381 1380
1382struct bnx2x_prev_path_list { 1381struct bnx2x_prev_path_list {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index dcafbda3e5be..ec96130533cc 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2959,6 +2959,10 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link)
2959 2959
2960 bp->port.pmf = 0; 2960 bp->port.pmf = 0;
2961 2961
2962 /* clear pending work in rtnl task */
2963 bp->sp_rtnl_state = 0;
2964 smp_mb();
2965
2962 /* Free SKBs, SGEs, TPA pool and driver internals */ 2966 /* Free SKBs, SGEs, TPA pool and driver internals */
2963 bnx2x_free_skbs(bp); 2967 bnx2x_free_skbs(bp);
2964 if (CNIC_LOADED(bp)) 2968 if (CNIC_LOADED(bp))
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
index fcf2761d8828..fdace204b054 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
@@ -778,11 +778,6 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
778 778
779 /* ets may affect cmng configuration: reinit it in hw */ 779 /* ets may affect cmng configuration: reinit it in hw */
780 bnx2x_set_local_cmng(bp); 780 bnx2x_set_local_cmng(bp);
781
782 set_bit(BNX2X_SP_RTNL_TX_RESUME, &bp->sp_rtnl_state);
783
784 schedule_delayed_work(&bp->sp_rtnl_task, 0);
785
786 return; 781 return;
787 case BNX2X_DCBX_STATE_TX_RELEASED: 782 case BNX2X_DCBX_STATE_TX_RELEASED:
788 DP(BNX2X_MSG_DCB, "BNX2X_DCBX_STATE_TX_RELEASED\n"); 783 DP(BNX2X_MSG_DCB, "BNX2X_DCBX_STATE_TX_RELEASED\n");
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index e622cc1f96ff..814d0eca9b33 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -577,7 +577,9 @@ void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr,
577 rc = bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp)); 577 rc = bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp));
578 if (rc) { 578 if (rc) {
579 BNX2X_ERR("DMAE returned failure %d\n", rc); 579 BNX2X_ERR("DMAE returned failure %d\n", rc);
580#ifdef BNX2X_STOP_ON_ERROR
580 bnx2x_panic(); 581 bnx2x_panic();
582#endif
581 } 583 }
582} 584}
583 585
@@ -614,7 +616,9 @@ void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32)
614 rc = bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp)); 616 rc = bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp));
615 if (rc) { 617 if (rc) {
616 BNX2X_ERR("DMAE returned failure %d\n", rc); 618 BNX2X_ERR("DMAE returned failure %d\n", rc);
619#ifdef BNX2X_STOP_ON_ERROR
617 bnx2x_panic(); 620 bnx2x_panic();
621#endif
618 } 622 }
619} 623}
620 624
@@ -5231,18 +5235,18 @@ static void bnx2x_eq_int(struct bnx2x *bp)
5231 5235
5232 case EVENT_RING_OPCODE_STOP_TRAFFIC: 5236 case EVENT_RING_OPCODE_STOP_TRAFFIC:
5233 DP(BNX2X_MSG_SP | BNX2X_MSG_DCB, "got STOP TRAFFIC\n"); 5237 DP(BNX2X_MSG_SP | BNX2X_MSG_DCB, "got STOP TRAFFIC\n");
5238 bnx2x_dcbx_set_params(bp, BNX2X_DCBX_STATE_TX_PAUSED);
5234 if (f_obj->complete_cmd(bp, f_obj, 5239 if (f_obj->complete_cmd(bp, f_obj,
5235 BNX2X_F_CMD_TX_STOP)) 5240 BNX2X_F_CMD_TX_STOP))
5236 break; 5241 break;
5237 bnx2x_dcbx_set_params(bp, BNX2X_DCBX_STATE_TX_PAUSED);
5238 goto next_spqe; 5242 goto next_spqe;
5239 5243
5240 case EVENT_RING_OPCODE_START_TRAFFIC: 5244 case EVENT_RING_OPCODE_START_TRAFFIC:
5241 DP(BNX2X_MSG_SP | BNX2X_MSG_DCB, "got START TRAFFIC\n"); 5245 DP(BNX2X_MSG_SP | BNX2X_MSG_DCB, "got START TRAFFIC\n");
5246 bnx2x_dcbx_set_params(bp, BNX2X_DCBX_STATE_TX_RELEASED);
5242 if (f_obj->complete_cmd(bp, f_obj, 5247 if (f_obj->complete_cmd(bp, f_obj,
5243 BNX2X_F_CMD_TX_START)) 5248 BNX2X_F_CMD_TX_START))
5244 break; 5249 break;
5245 bnx2x_dcbx_set_params(bp, BNX2X_DCBX_STATE_TX_RELEASED);
5246 goto next_spqe; 5250 goto next_spqe;
5247 5251
5248 case EVENT_RING_OPCODE_FUNCTION_UPDATE: 5252 case EVENT_RING_OPCODE_FUNCTION_UPDATE:
@@ -9352,6 +9356,10 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global)
9352 bnx2x_process_kill_chip_reset(bp, global); 9356 bnx2x_process_kill_chip_reset(bp, global);
9353 barrier(); 9357 barrier();
9354 9358
9359 /* clear errors in PGB */
9360 if (!CHIP_IS_E1x(bp))
9361 REG_WR(bp, PGLUE_B_REG_LATCHED_ERRORS_CLR, 0x7f);
9362
9355 /* Recover after reset: */ 9363 /* Recover after reset: */
9356 /* MCP */ 9364 /* MCP */
9357 if (global && bnx2x_reset_mcp_comp(bp, val)) 9365 if (global && bnx2x_reset_mcp_comp(bp, val))
@@ -9706,11 +9714,10 @@ sp_rtnl_not_reset:
9706 &bp->sp_rtnl_state)) 9714 &bp->sp_rtnl_state))
9707 bnx2x_pf_set_vfs_vlan(bp); 9715 bnx2x_pf_set_vfs_vlan(bp);
9708 9716
9709 if (test_and_clear_bit(BNX2X_SP_RTNL_TX_STOP, &bp->sp_rtnl_state)) 9717 if (test_and_clear_bit(BNX2X_SP_RTNL_TX_STOP, &bp->sp_rtnl_state)) {
9710 bnx2x_dcbx_stop_hw_tx(bp); 9718 bnx2x_dcbx_stop_hw_tx(bp);
9711
9712 if (test_and_clear_bit(BNX2X_SP_RTNL_TX_RESUME, &bp->sp_rtnl_state))
9713 bnx2x_dcbx_resume_hw_tx(bp); 9719 bnx2x_dcbx_resume_hw_tx(bp);
9720 }
9714 9721
9715 /* work which needs rtnl lock not-taken (as it takes the lock itself and 9722 /* work which needs rtnl lock not-taken (as it takes the lock itself and
9716 * can be called from other contexts as well) 9723 * can be called from other contexts as well)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
index 5ecf267dc4cc..3efbb35267c8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
@@ -2864,6 +2864,17 @@
2864#define PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ 0x9430 2864#define PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ 0x9430
2865#define PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_WRITE 0x9434 2865#define PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_WRITE 0x9434
2866#define PGLUE_B_REG_INTERNAL_VFID_ENABLE 0x9438 2866#define PGLUE_B_REG_INTERNAL_VFID_ENABLE 0x9438
2867/* [W 7] Writing 1 to each bit in this register clears a corresponding error
2868 * details register and enables logging new error details. Bit 0 - clears
2869 * INCORRECT_RCV_DETAILS; Bit 1 - clears RX_ERR_DETAILS; Bit 2 - clears
2870 * TX_ERR_WR_ADD_31_0 TX_ERR_WR_ADD_63_32 TX_ERR_WR_DETAILS
2871 * TX_ERR_WR_DETAILS2 TX_ERR_RD_ADD_31_0 TX_ERR_RD_ADD_63_32
2872 * TX_ERR_RD_DETAILS TX_ERR_RD_DETAILS2 TX_ERR_WR_DETAILS_ICPL; Bit 3 -
2873 * clears VF_LENGTH_VIOLATION_DETAILS. Bit 4 - clears
2874 * VF_GRC_SPACE_VIOLATION_DETAILS. Bit 5 - clears RX_TCPL_ERR_DETAILS. Bit 6
2875 * - clears TCPL_IN_TWO_RCBS_DETAILS. */
2876#define PGLUE_B_REG_LATCHED_ERRORS_CLR 0x943c
2877
2867/* [R 9] Interrupt register #0 read */ 2878/* [R 9] Interrupt register #0 read */
2868#define PGLUE_B_REG_PGLUE_B_INT_STS 0x9298 2879#define PGLUE_B_REG_PGLUE_B_INT_STS 0x9298
2869/* [RC 9] Interrupt register #0 read clear */ 2880/* [RC 9] Interrupt register #0 read clear */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
index 9199adf32d33..efa8a151d789 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
@@ -152,7 +152,7 @@ static int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping)
152 if (bp->old_bulletin.valid_bitmap & 1 << CHANNEL_DOWN) { 152 if (bp->old_bulletin.valid_bitmap & 1 << CHANNEL_DOWN) {
153 DP(BNX2X_MSG_IOV, "detecting channel down. Aborting message\n"); 153 DP(BNX2X_MSG_IOV, "detecting channel down. Aborting message\n");
154 *done = PFVF_STATUS_SUCCESS; 154 *done = PFVF_STATUS_SUCCESS;
155 return 0; 155 return -EINVAL;
156 } 156 }
157 157
158 /* Write message address */ 158 /* Write message address */
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 00c5be8c55b8..a9e068423ba0 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -13618,16 +13618,9 @@ static int tg3_hwtstamp_ioctl(struct net_device *dev,
13618 if (stmpconf.flags) 13618 if (stmpconf.flags)
13619 return -EINVAL; 13619 return -EINVAL;
13620 13620
13621 switch (stmpconf.tx_type) { 13621 if (stmpconf.tx_type != HWTSTAMP_TX_ON &&
13622 case HWTSTAMP_TX_ON: 13622 stmpconf.tx_type != HWTSTAMP_TX_OFF)
13623 tg3_flag_set(tp, TX_TSTAMP_EN);
13624 break;
13625 case HWTSTAMP_TX_OFF:
13626 tg3_flag_clear(tp, TX_TSTAMP_EN);
13627 break;
13628 default:
13629 return -ERANGE; 13623 return -ERANGE;
13630 }
13631 13624
13632 switch (stmpconf.rx_filter) { 13625 switch (stmpconf.rx_filter) {
13633 case HWTSTAMP_FILTER_NONE: 13626 case HWTSTAMP_FILTER_NONE:
@@ -13689,6 +13682,11 @@ static int tg3_hwtstamp_ioctl(struct net_device *dev,
13689 tw32(TG3_RX_PTP_CTL, 13682 tw32(TG3_RX_PTP_CTL,
13690 tp->rxptpctl | TG3_RX_PTP_CTL_HWTS_INTERLOCK); 13683 tp->rxptpctl | TG3_RX_PTP_CTL_HWTS_INTERLOCK);
13691 13684
13685 if (stmpconf.tx_type == HWTSTAMP_TX_ON)
13686 tg3_flag_set(tp, TX_TSTAMP_EN);
13687 else
13688 tg3_flag_clear(tp, TX_TSTAMP_EN);
13689
13692 return copy_to_user(ifr->ifr_data, &stmpconf, sizeof(stmpconf)) ? 13690 return copy_to_user(ifr->ifr_data, &stmpconf, sizeof(stmpconf)) ?
13693 -EFAULT : 0; 13691 -EFAULT : 0;
13694} 13692}
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 7fb0edfe3d24..dbcd5262c016 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1758,7 +1758,7 @@ err:
1758 1758
1759/* Uses sycnhronous mcc */ 1759/* Uses sycnhronous mcc */
1760int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, 1760int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
1761 u32 num, bool untagged, bool promiscuous) 1761 u32 num, bool promiscuous)
1762{ 1762{
1763 struct be_mcc_wrb *wrb; 1763 struct be_mcc_wrb *wrb;
1764 struct be_cmd_req_vlan_config *req; 1764 struct be_cmd_req_vlan_config *req;
@@ -1778,7 +1778,7 @@ int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
1778 1778
1779 req->interface_id = if_id; 1779 req->interface_id = if_id;
1780 req->promiscuous = promiscuous; 1780 req->promiscuous = promiscuous;
1781 req->untagged = untagged; 1781 req->untagged = BE_IF_FLAGS_UNTAGGED & be_if_cap_flags(adapter) ? 1 : 0;
1782 req->num_vlan = num; 1782 req->num_vlan = num;
1783 if (!promiscuous) { 1783 if (!promiscuous) {
1784 memcpy(req->normal_vlan, vtag_array, 1784 memcpy(req->normal_vlan, vtag_array,
@@ -1847,7 +1847,19 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
1847 memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN); 1847 memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN);
1848 } 1848 }
1849 1849
1850 if ((req->if_flags_mask & cpu_to_le32(be_if_cap_flags(adapter))) !=
1851 req->if_flags_mask) {
1852 dev_warn(&adapter->pdev->dev,
1853 "Cannot set rx filter flags 0x%x\n",
1854 req->if_flags_mask);
1855 dev_warn(&adapter->pdev->dev,
1856 "Interface is capable of 0x%x flags only\n",
1857 be_if_cap_flags(adapter));
1858 }
1859 req->if_flags_mask &= cpu_to_le32(be_if_cap_flags(adapter));
1860
1850 status = be_mcc_notify_wait(adapter); 1861 status = be_mcc_notify_wait(adapter);
1862
1851err: 1863err:
1852 spin_unlock_bh(&adapter->mcc_lock); 1864 spin_unlock_bh(&adapter->mcc_lock);
1853 return status; 1865 return status;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index edf3e8a0ff83..0075686276aa 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1984,7 +1984,7 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
1984 char *fw_on_flash); 1984 char *fw_on_flash);
1985int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num); 1985int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num);
1986int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, 1986int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
1987 u32 num, bool untagged, bool promiscuous); 1987 u32 num, bool promiscuous);
1988int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status); 1988int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status);
1989int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc); 1989int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc);
1990int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc); 1990int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index eaecaadfa8c5..abde97471636 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1079,7 +1079,7 @@ static int be_vid_config(struct be_adapter *adapter)
1079 vids[num++] = cpu_to_le16(i); 1079 vids[num++] = cpu_to_le16(i);
1080 1080
1081 status = be_cmd_vlan_config(adapter, adapter->if_handle, 1081 status = be_cmd_vlan_config(adapter, adapter->if_handle,
1082 vids, num, 1, 0); 1082 vids, num, 0);
1083 1083
1084 if (status) { 1084 if (status) {
1085 /* Set to VLAN promisc mode as setting VLAN filter failed */ 1085 /* Set to VLAN promisc mode as setting VLAN filter failed */
@@ -2676,6 +2676,11 @@ static int be_close(struct net_device *netdev)
2676 2676
2677 be_rx_qs_destroy(adapter); 2677 be_rx_qs_destroy(adapter);
2678 2678
2679 for (i = 1; i < (adapter->uc_macs + 1); i++)
2680 be_cmd_pmac_del(adapter, adapter->if_handle,
2681 adapter->pmac_id[i], 0);
2682 adapter->uc_macs = 0;
2683
2679 for_all_evt_queues(adapter, eqo, i) { 2684 for_all_evt_queues(adapter, eqo, i) {
2680 if (msix_enabled(adapter)) 2685 if (msix_enabled(adapter))
2681 synchronize_irq(be_msix_vec_get(adapter, eqo)); 2686 synchronize_irq(be_msix_vec_get(adapter, eqo));
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index b2793b91cc55..4cbebf3d80eb 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -386,7 +386,14 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
386 */ 386 */
387 bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, bufaddr, 387 bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, bufaddr,
388 FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); 388 FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE);
389 389 if (dma_mapping_error(&fep->pdev->dev, bdp->cbd_bufaddr)) {
390 bdp->cbd_bufaddr = 0;
391 fep->tx_skbuff[index] = NULL;
392 dev_kfree_skb_any(skb);
393 if (net_ratelimit())
394 netdev_err(ndev, "Tx DMA memory map failed\n");
395 return NETDEV_TX_OK;
396 }
390 /* Send it on its way. Tell FEC it's ready, interrupt when done, 397 /* Send it on its way. Tell FEC it's ready, interrupt when done,
391 * it's the last BD of the frame, and to put the CRC on the end. 398 * it's the last BD of the frame, and to put the CRC on the end.
392 */ 399 */
@@ -861,6 +868,7 @@ fec_enet_rx(struct net_device *ndev, int budget)
861 struct bufdesc_ex *ebdp = NULL; 868 struct bufdesc_ex *ebdp = NULL;
862 bool vlan_packet_rcvd = false; 869 bool vlan_packet_rcvd = false;
863 u16 vlan_tag; 870 u16 vlan_tag;
871 int index = 0;
864 872
865#ifdef CONFIG_M532x 873#ifdef CONFIG_M532x
866 flush_cache_all(); 874 flush_cache_all();
@@ -916,10 +924,15 @@ fec_enet_rx(struct net_device *ndev, int budget)
916 ndev->stats.rx_packets++; 924 ndev->stats.rx_packets++;
917 pkt_len = bdp->cbd_datlen; 925 pkt_len = bdp->cbd_datlen;
918 ndev->stats.rx_bytes += pkt_len; 926 ndev->stats.rx_bytes += pkt_len;
919 data = (__u8*)__va(bdp->cbd_bufaddr);
920 927
921 dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, 928 if (fep->bufdesc_ex)
922 FEC_ENET_TX_FRSIZE, DMA_FROM_DEVICE); 929 index = (struct bufdesc_ex *)bdp -
930 (struct bufdesc_ex *)fep->rx_bd_base;
931 else
932 index = bdp - fep->rx_bd_base;
933 data = fep->rx_skbuff[index]->data;
934 dma_sync_single_for_cpu(&fep->pdev->dev, bdp->cbd_bufaddr,
935 FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);
923 936
924 if (id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) 937 if (id_entry->driver_data & FEC_QUIRK_SWAP_FRAME)
925 swap_buffer(data, pkt_len); 938 swap_buffer(data, pkt_len);
@@ -999,8 +1012,8 @@ fec_enet_rx(struct net_device *ndev, int budget)
999 napi_gro_receive(&fep->napi, skb); 1012 napi_gro_receive(&fep->napi, skb);
1000 } 1013 }
1001 1014
1002 bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, data, 1015 dma_sync_single_for_device(&fep->pdev->dev, bdp->cbd_bufaddr,
1003 FEC_ENET_TX_FRSIZE, DMA_FROM_DEVICE); 1016 FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);
1004rx_processing_done: 1017rx_processing_done:
1005 /* Clear the status flags for this buffer */ 1018 /* Clear the status flags for this buffer */
1006 status &= ~BD_ENET_RX_STATS; 1019 status &= ~BD_ENET_RX_STATS;
@@ -1719,6 +1732,12 @@ static int fec_enet_alloc_buffers(struct net_device *ndev)
1719 1732
1720 bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, skb->data, 1733 bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, skb->data,
1721 FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE); 1734 FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE);
1735 if (dma_mapping_error(&fep->pdev->dev, bdp->cbd_bufaddr)) {
1736 fec_enet_free_buffers(ndev);
1737 if (net_ratelimit())
1738 netdev_err(ndev, "Rx DMA memory map failed\n");
1739 return -ENOMEM;
1740 }
1722 bdp->cbd_sc = BD_ENET_RX_EMPTY; 1741 bdp->cbd_sc = BD_ENET_RX_EMPTY;
1723 1742
1724 if (fep->bufdesc_ex) { 1743 if (fep->bufdesc_ex) {
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index aedd5736a87d..8d3945ab7334 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3482,10 +3482,10 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)
3482 * specified. Matching the kind of event packet is not supported, with the 3482 * specified. Matching the kind of event packet is not supported, with the
3483 * exception of "all V2 events regardless of level 2 or 4". 3483 * exception of "all V2 events regardless of level 2 or 4".
3484 **/ 3484 **/
3485static int e1000e_config_hwtstamp(struct e1000_adapter *adapter) 3485static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
3486 struct hwtstamp_config *config)
3486{ 3487{
3487 struct e1000_hw *hw = &adapter->hw; 3488 struct e1000_hw *hw = &adapter->hw;
3488 struct hwtstamp_config *config = &adapter->hwtstamp_config;
3489 u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED; 3489 u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED;
3490 u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; 3490 u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
3491 u32 rxmtrl = 0; 3491 u32 rxmtrl = 0;
@@ -3586,6 +3586,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter)
3586 return -ERANGE; 3586 return -ERANGE;
3587 } 3587 }
3588 3588
3589 adapter->hwtstamp_config = *config;
3590
3589 /* enable/disable Tx h/w time stamping */ 3591 /* enable/disable Tx h/w time stamping */
3590 regval = er32(TSYNCTXCTL); 3592 regval = er32(TSYNCTXCTL);
3591 regval &= ~E1000_TSYNCTXCTL_ENABLED; 3593 regval &= ~E1000_TSYNCTXCTL_ENABLED;
@@ -3874,7 +3876,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
3874 e1000e_reset_adaptive(hw); 3876 e1000e_reset_adaptive(hw);
3875 3877
3876 /* initialize systim and reset the ns time counter */ 3878 /* initialize systim and reset the ns time counter */
3877 e1000e_config_hwtstamp(adapter); 3879 e1000e_config_hwtstamp(adapter, &adapter->hwtstamp_config);
3878 3880
3879 /* Set EEE advertisement as appropriate */ 3881 /* Set EEE advertisement as appropriate */
3880 if (adapter->flags2 & FLAG2_HAS_EEE) { 3882 if (adapter->flags2 & FLAG2_HAS_EEE) {
@@ -5797,14 +5799,10 @@ static int e1000e_hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr)
5797 if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) 5799 if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
5798 return -EFAULT; 5800 return -EFAULT;
5799 5801
5800 adapter->hwtstamp_config = config; 5802 ret_val = e1000e_config_hwtstamp(adapter, &config);
5801
5802 ret_val = e1000e_config_hwtstamp(adapter);
5803 if (ret_val) 5803 if (ret_val)
5804 return ret_val; 5804 return ret_val;
5805 5805
5806 config = adapter->hwtstamp_config;
5807
5808 switch (config.rx_filter) { 5806 switch (config.rx_filter) {
5809 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: 5807 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
5810 case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: 5808 case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 00cd36e08601..61088a6a9424 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2890,7 +2890,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
2890 PHY_INTERFACE_MODE_GMII); 2890 PHY_INTERFACE_MODE_GMII);
2891 if (!mp->phy) 2891 if (!mp->phy)
2892 err = -ENODEV; 2892 err = -ENODEV;
2893 phy_addr_set(mp, mp->phy->addr); 2893 else
2894 phy_addr_set(mp, mp->phy->addr);
2894 } else if (pd->phy_addr != MV643XX_ETH_PHY_NONE) { 2895 } else if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
2895 mp->phy = phy_scan(mp, pd->phy_addr); 2896 mp->phy = phy_scan(mp, pd->phy_addr);
2896 2897
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 5a0f04c2c813..27ffe0ebf0a6 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -245,16 +245,8 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
245 /* Get ieee1588's dev information */ 245 /* Get ieee1588's dev information */
246 pdev = adapter->ptp_pdev; 246 pdev = adapter->ptp_pdev;
247 247
248 switch (cfg.tx_type) { 248 if (cfg.tx_type != HWTSTAMP_TX_OFF && cfg.tx_type != HWTSTAMP_TX_ON)
249 case HWTSTAMP_TX_OFF:
250 adapter->hwts_tx_en = 0;
251 break;
252 case HWTSTAMP_TX_ON:
253 adapter->hwts_tx_en = 1;
254 break;
255 default:
256 return -ERANGE; 249 return -ERANGE;
257 }
258 250
259 switch (cfg.rx_filter) { 251 switch (cfg.rx_filter) {
260 case HWTSTAMP_FILTER_NONE: 252 case HWTSTAMP_FILTER_NONE:
@@ -284,6 +276,8 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
284 return -ERANGE; 276 return -ERANGE;
285 } 277 }
286 278
279 adapter->hwts_tx_en = cfg.tx_type == HWTSTAMP_TX_ON;
280
287 /* Clear out any old time stamps. */ 281 /* Clear out any old time stamps. */
288 pch_ch_event_write(pdev, TX_SNAPSHOT_LOCKED | RX_SNAPSHOT_LOCKED); 282 pch_ch_event_write(pdev, TX_SNAPSHOT_LOCKED | RX_SNAPSHOT_LOCKED);
289 283
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8d4ccd35a016..8a7a23a84ac5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -435,16 +435,9 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
435 if (config.flags) 435 if (config.flags)
436 return -EINVAL; 436 return -EINVAL;
437 437
438 switch (config.tx_type) { 438 if (config.tx_type != HWTSTAMP_TX_OFF &&
439 case HWTSTAMP_TX_OFF: 439 config.tx_type != HWTSTAMP_TX_ON)
440 priv->hwts_tx_en = 0;
441 break;
442 case HWTSTAMP_TX_ON:
443 priv->hwts_tx_en = 1;
444 break;
445 default:
446 return -ERANGE; 440 return -ERANGE;
447 }
448 441
449 if (priv->adv_ts) { 442 if (priv->adv_ts) {
450 switch (config.rx_filter) { 443 switch (config.rx_filter) {
@@ -576,6 +569,7 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
576 } 569 }
577 } 570 }
578 priv->hwts_rx_en = ((config.rx_filter == HWTSTAMP_FILTER_NONE) ? 0 : 1); 571 priv->hwts_rx_en = ((config.rx_filter == HWTSTAMP_FILTER_NONE) ? 0 : 1);
572 priv->hwts_tx_en = config.tx_type == HWTSTAMP_TX_ON;
579 573
580 if (!priv->hwts_tx_en && !priv->hwts_rx_en) 574 if (!priv->hwts_tx_en && !priv->hwts_rx_en)
581 priv->hw->ptp->config_hw_tstamping(priv->ioaddr, 0); 575 priv->hw->ptp->config_hw_tstamping(priv->ioaddr, 0);
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 90d41d26ec6d..7536a4c01293 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -967,14 +967,19 @@ static inline void cpsw_add_dual_emac_def_ale_entries(
967 priv->host_port, ALE_VLAN, slave->port_vlan); 967 priv->host_port, ALE_VLAN, slave->port_vlan);
968} 968}
969 969
970static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) 970static void soft_reset_slave(struct cpsw_slave *slave)
971{ 971{
972 char name[32]; 972 char name[32];
973 u32 slave_port;
974
975 sprintf(name, "slave-%d", slave->slave_num);
976 973
974 snprintf(name, sizeof(name), "slave-%d", slave->slave_num);
977 soft_reset(name, &slave->sliver->soft_reset); 975 soft_reset(name, &slave->sliver->soft_reset);
976}
977
978static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
979{
980 u32 slave_port;
981
982 soft_reset_slave(slave);
978 983
979 /* setup priority mapping */ 984 /* setup priority mapping */
980 __raw_writel(RX_PRIORITY_MAPPING, &slave->sliver->rx_pri_map); 985 __raw_writel(RX_PRIORITY_MAPPING, &slave->sliver->rx_pri_map);
@@ -1323,6 +1328,10 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
1323 struct cpts *cpts = priv->cpts; 1328 struct cpts *cpts = priv->cpts;
1324 struct hwtstamp_config cfg; 1329 struct hwtstamp_config cfg;
1325 1330
1331 if (priv->version != CPSW_VERSION_1 &&
1332 priv->version != CPSW_VERSION_2)
1333 return -EOPNOTSUPP;
1334
1326 if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) 1335 if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
1327 return -EFAULT; 1336 return -EFAULT;
1328 1337
@@ -1330,16 +1339,8 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
1330 if (cfg.flags) 1339 if (cfg.flags)
1331 return -EINVAL; 1340 return -EINVAL;
1332 1341
1333 switch (cfg.tx_type) { 1342 if (cfg.tx_type != HWTSTAMP_TX_OFF && cfg.tx_type != HWTSTAMP_TX_ON)
1334 case HWTSTAMP_TX_OFF:
1335 cpts->tx_enable = 0;
1336 break;
1337 case HWTSTAMP_TX_ON:
1338 cpts->tx_enable = 1;
1339 break;
1340 default:
1341 return -ERANGE; 1343 return -ERANGE;
1342 }
1343 1344
1344 switch (cfg.rx_filter) { 1345 switch (cfg.rx_filter) {
1345 case HWTSTAMP_FILTER_NONE: 1346 case HWTSTAMP_FILTER_NONE:
@@ -1366,6 +1367,8 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
1366 return -ERANGE; 1367 return -ERANGE;
1367 } 1368 }
1368 1369
1370 cpts->tx_enable = cfg.tx_type == HWTSTAMP_TX_ON;
1371
1369 switch (priv->version) { 1372 switch (priv->version) {
1370 case CPSW_VERSION_1: 1373 case CPSW_VERSION_1:
1371 cpsw_hwtstamp_v1(priv); 1374 cpsw_hwtstamp_v1(priv);
@@ -1374,7 +1377,7 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
1374 cpsw_hwtstamp_v2(priv); 1377 cpsw_hwtstamp_v2(priv);
1375 break; 1378 break;
1376 default: 1379 default:
1377 return -ENOTSUPP; 1380 WARN_ON(1);
1378 } 1381 }
1379 1382
1380 return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; 1383 return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0;
@@ -2173,8 +2176,9 @@ static int cpsw_suspend(struct device *dev)
2173 2176
2174 if (netif_running(ndev)) 2177 if (netif_running(ndev))
2175 cpsw_ndo_stop(ndev); 2178 cpsw_ndo_stop(ndev);
2176 soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset); 2179
2177 soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset); 2180 for_each_slave(priv, soft_reset_slave);
2181
2178 pm_runtime_put_sync(&pdev->dev); 2182 pm_runtime_put_sync(&pdev->dev);
2179 2183
2180 /* Select sleep pin state */ 2184 /* Select sleep pin state */
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index e78802e75ea6..bcc224a83734 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -389,16 +389,8 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
389 ch = PORT2CHANNEL(port); 389 ch = PORT2CHANNEL(port);
390 regs = (struct ixp46x_ts_regs __iomem *) IXP4XX_TIMESYNC_BASE_VIRT; 390 regs = (struct ixp46x_ts_regs __iomem *) IXP4XX_TIMESYNC_BASE_VIRT;
391 391
392 switch (cfg.tx_type) { 392 if (cfg.tx_type != HWTSTAMP_TX_OFF && cfg.tx_type != HWTSTAMP_TX_ON)
393 case HWTSTAMP_TX_OFF:
394 port->hwts_tx_en = 0;
395 break;
396 case HWTSTAMP_TX_ON:
397 port->hwts_tx_en = 1;
398 break;
399 default:
400 return -ERANGE; 393 return -ERANGE;
401 }
402 394
403 switch (cfg.rx_filter) { 395 switch (cfg.rx_filter) {
404 case HWTSTAMP_FILTER_NONE: 396 case HWTSTAMP_FILTER_NONE:
@@ -416,6 +408,8 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
416 return -ERANGE; 408 return -ERANGE;
417 } 409 }
418 410
411 port->hwts_tx_en = cfg.tx_type == HWTSTAMP_TX_ON;
412
419 /* Clear out any old time stamps. */ 413 /* Clear out any old time stamps. */
420 __raw_writel(TX_SNAPSHOT_LOCKED | RX_SNAPSHOT_LOCKED, 414 __raw_writel(TX_SNAPSHOT_LOCKED | RX_SNAPSHOT_LOCKED,
421 &regs->channel[ch].ch_event); 415 &regs->channel[ch].ch_event);
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 9dccb1edfd2a..dc76670c2f2a 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -628,6 +628,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
628 const struct iovec *iv, unsigned long total_len, 628 const struct iovec *iv, unsigned long total_len,
629 size_t count, int noblock) 629 size_t count, int noblock)
630{ 630{
631 int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN);
631 struct sk_buff *skb; 632 struct sk_buff *skb;
632 struct macvlan_dev *vlan; 633 struct macvlan_dev *vlan;
633 unsigned long len = total_len; 634 unsigned long len = total_len;
@@ -670,6 +671,8 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
670 671
671 if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) { 672 if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) {
672 copylen = vnet_hdr.hdr_len ? vnet_hdr.hdr_len : GOODCOPY_LEN; 673 copylen = vnet_hdr.hdr_len ? vnet_hdr.hdr_len : GOODCOPY_LEN;
674 if (copylen > good_linear)
675 copylen = good_linear;
673 linear = copylen; 676 linear = copylen;
674 if (iov_pages(iv, vnet_hdr_len + copylen, count) 677 if (iov_pages(iv, vnet_hdr_len + copylen, count)
675 <= MAX_SKB_FRAGS) 678 <= MAX_SKB_FRAGS)
@@ -678,7 +681,10 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
678 681
679 if (!zerocopy) { 682 if (!zerocopy) {
680 copylen = len; 683 copylen = len;
681 linear = vnet_hdr.hdr_len; 684 if (vnet_hdr.hdr_len > good_linear)
685 linear = good_linear;
686 else
687 linear = vnet_hdr.hdr_len;
682 } 688 }
683 689
684 skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen, 690 skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen,
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 6574eb8766f9..34b0de09d881 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -2650,7 +2650,7 @@ static int team_nl_cmd_port_list_get(struct sk_buff *skb,
2650 return err; 2650 return err;
2651} 2651}
2652 2652
2653static struct genl_ops team_nl_ops[] = { 2653static const struct genl_ops team_nl_ops[] = {
2654 { 2654 {
2655 .cmd = TEAM_CMD_NOOP, 2655 .cmd = TEAM_CMD_NOOP,
2656 .doit = team_nl_cmd_noop, 2656 .doit = team_nl_cmd_noop,
@@ -2676,15 +2676,15 @@ static struct genl_ops team_nl_ops[] = {
2676 }, 2676 },
2677}; 2677};
2678 2678
2679static struct genl_multicast_group team_change_event_mcgrp = { 2679static const struct genl_multicast_group team_nl_mcgrps[] = {
2680 .name = TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME, 2680 { .name = TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME, },
2681}; 2681};
2682 2682
2683static int team_nl_send_multicast(struct sk_buff *skb, 2683static int team_nl_send_multicast(struct sk_buff *skb,
2684 struct team *team, u32 portid) 2684 struct team *team, u32 portid)
2685{ 2685{
2686 return genlmsg_multicast_netns(dev_net(team->dev), skb, 0, 2686 return genlmsg_multicast_netns(&team_nl_family, dev_net(team->dev),
2687 team_change_event_mcgrp.id, GFP_KERNEL); 2687 skb, 0, 0, GFP_KERNEL);
2688} 2688}
2689 2689
2690static int team_nl_send_event_options_get(struct team *team, 2690static int team_nl_send_event_options_get(struct team *team,
@@ -2703,23 +2703,8 @@ static int team_nl_send_event_port_get(struct team *team,
2703 2703
2704static int team_nl_init(void) 2704static int team_nl_init(void)
2705{ 2705{
2706 int err; 2706 return genl_register_family_with_ops_groups(&team_nl_family, team_nl_ops,
2707 2707 team_nl_mcgrps);
2708 err = genl_register_family_with_ops(&team_nl_family, team_nl_ops,
2709 ARRAY_SIZE(team_nl_ops));
2710 if (err)
2711 return err;
2712
2713 err = genl_register_mc_group(&team_nl_family, &team_change_event_mcgrp);
2714 if (err)
2715 goto err_change_event_grp_reg;
2716
2717 return 0;
2718
2719err_change_event_grp_reg:
2720 genl_unregister_family(&team_nl_family);
2721
2722 return err;
2723} 2708}
2724 2709
2725static void team_nl_fini(void) 2710static void team_nl_fini(void)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7cb105c103fe..782e38bfc1ee 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -981,6 +981,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
981 struct sk_buff *skb; 981 struct sk_buff *skb;
982 size_t len = total_len, align = NET_SKB_PAD, linear; 982 size_t len = total_len, align = NET_SKB_PAD, linear;
983 struct virtio_net_hdr gso = { 0 }; 983 struct virtio_net_hdr gso = { 0 };
984 int good_linear;
984 int offset = 0; 985 int offset = 0;
985 int copylen; 986 int copylen;
986 bool zerocopy = false; 987 bool zerocopy = false;
@@ -1021,12 +1022,16 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1021 return -EINVAL; 1022 return -EINVAL;
1022 } 1023 }
1023 1024
1025 good_linear = SKB_MAX_HEAD(align);
1026
1024 if (msg_control) { 1027 if (msg_control) {
1025 /* There are 256 bytes to be copied in skb, so there is 1028 /* There are 256 bytes to be copied in skb, so there is
1026 * enough room for skb expand head in case it is used. 1029 * enough room for skb expand head in case it is used.
1027 * The rest of the buffer is mapped from userspace. 1030 * The rest of the buffer is mapped from userspace.
1028 */ 1031 */
1029 copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN; 1032 copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN;
1033 if (copylen > good_linear)
1034 copylen = good_linear;
1030 linear = copylen; 1035 linear = copylen;
1031 if (iov_pages(iv, offset + copylen, count) <= MAX_SKB_FRAGS) 1036 if (iov_pages(iv, offset + copylen, count) <= MAX_SKB_FRAGS)
1032 zerocopy = true; 1037 zerocopy = true;
@@ -1034,7 +1039,10 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1034 1039
1035 if (!zerocopy) { 1040 if (!zerocopy) {
1036 copylen = len; 1041 copylen = len;
1037 linear = gso.hdr_len; 1042 if (gso.hdr_len > good_linear)
1043 linear = good_linear;
1044 else
1045 linear = gso.hdr_len;
1038 } 1046 }
1039 1047
1040 skb = tun_alloc_skb(tfile, align, copylen, linear, noblock); 1048 skb = tun_alloc_skb(tfile, align, copylen, linear, noblock);
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index f74786aa37be..e15ec2b12035 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -66,7 +66,7 @@ static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx);
66static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); 66static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer);
67static struct usb_driver cdc_ncm_driver; 67static struct usb_driver cdc_ncm_driver;
68 68
69static u8 cdc_ncm_setup(struct usbnet *dev) 69static int cdc_ncm_setup(struct usbnet *dev)
70{ 70{
71 struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; 71 struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
72 struct usb_cdc_ncm_ntb_parameters ncm_parm; 72 struct usb_cdc_ncm_ntb_parameters ncm_parm;
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 90a429b7ebad..8494bb53ebdc 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -204,9 +204,6 @@ static void intr_complete (struct urb *urb)
204 break; 204 break;
205 } 205 }
206 206
207 if (!netif_running (dev->net))
208 return;
209
210 status = usb_submit_urb (urb, GFP_ATOMIC); 207 status = usb_submit_urb (urb, GFP_ATOMIC);
211 if (status != 0) 208 if (status != 0)
212 netif_err(dev, timer, dev->net, 209 netif_err(dev, timer, dev->net,
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index cdc7c90a6a9e..7bab4de658a9 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -36,7 +36,10 @@ module_param(csum, bool, 0444);
36module_param(gso, bool, 0444); 36module_param(gso, bool, 0444);
37 37
38/* FIXME: MTU in config. */ 38/* FIXME: MTU in config. */
39#define MAX_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN) 39#define GOOD_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
40#define MERGE_BUFFER_LEN (ALIGN(GOOD_PACKET_LEN + \
41 sizeof(struct virtio_net_hdr_mrg_rxbuf), \
42 L1_CACHE_BYTES))
40#define GOOD_COPY_LEN 128 43#define GOOD_COPY_LEN 128
41 44
42#define VIRTNET_DRIVER_VERSION "1.0.0" 45#define VIRTNET_DRIVER_VERSION "1.0.0"
@@ -314,10 +317,10 @@ static int receive_mergeable(struct receive_queue *rq, struct sk_buff *head_skb)
314 head_skb->dev->stats.rx_length_errors++; 317 head_skb->dev->stats.rx_length_errors++;
315 return -EINVAL; 318 return -EINVAL;
316 } 319 }
317 if (unlikely(len > MAX_PACKET_LEN)) { 320 if (unlikely(len > MERGE_BUFFER_LEN)) {
318 pr_debug("%s: rx error: merge buffer too long\n", 321 pr_debug("%s: rx error: merge buffer too long\n",
319 head_skb->dev->name); 322 head_skb->dev->name);
320 len = MAX_PACKET_LEN; 323 len = MERGE_BUFFER_LEN;
321 } 324 }
322 if (unlikely(num_skb_frags == MAX_SKB_FRAGS)) { 325 if (unlikely(num_skb_frags == MAX_SKB_FRAGS)) {
323 struct sk_buff *nskb = alloc_skb(0, GFP_ATOMIC); 326 struct sk_buff *nskb = alloc_skb(0, GFP_ATOMIC);
@@ -336,18 +339,17 @@ static int receive_mergeable(struct receive_queue *rq, struct sk_buff *head_skb)
336 if (curr_skb != head_skb) { 339 if (curr_skb != head_skb) {
337 head_skb->data_len += len; 340 head_skb->data_len += len;
338 head_skb->len += len; 341 head_skb->len += len;
339 head_skb->truesize += MAX_PACKET_LEN; 342 head_skb->truesize += MERGE_BUFFER_LEN;
340 } 343 }
341 page = virt_to_head_page(buf); 344 page = virt_to_head_page(buf);
342 offset = buf - (char *)page_address(page); 345 offset = buf - (char *)page_address(page);
343 if (skb_can_coalesce(curr_skb, num_skb_frags, page, offset)) { 346 if (skb_can_coalesce(curr_skb, num_skb_frags, page, offset)) {
344 put_page(page); 347 put_page(page);
345 skb_coalesce_rx_frag(curr_skb, num_skb_frags - 1, 348 skb_coalesce_rx_frag(curr_skb, num_skb_frags - 1,
346 len, MAX_PACKET_LEN); 349 len, MERGE_BUFFER_LEN);
347 } else { 350 } else {
348 skb_add_rx_frag(curr_skb, num_skb_frags, page, 351 skb_add_rx_frag(curr_skb, num_skb_frags, page,
349 offset, len, 352 offset, len, MERGE_BUFFER_LEN);
350 MAX_PACKET_LEN);
351 } 353 }
352 --rq->num; 354 --rq->num;
353 } 355 }
@@ -383,7 +385,7 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
383 struct page *page = virt_to_head_page(buf); 385 struct page *page = virt_to_head_page(buf);
384 skb = page_to_skb(rq, page, 386 skb = page_to_skb(rq, page,
385 (char *)buf - (char *)page_address(page), 387 (char *)buf - (char *)page_address(page),
386 len, MAX_PACKET_LEN); 388 len, MERGE_BUFFER_LEN);
387 if (unlikely(!skb)) { 389 if (unlikely(!skb)) {
388 dev->stats.rx_dropped++; 390 dev->stats.rx_dropped++;
389 put_page(page); 391 put_page(page);
@@ -471,11 +473,11 @@ static int add_recvbuf_small(struct receive_queue *rq, gfp_t gfp)
471 struct skb_vnet_hdr *hdr; 473 struct skb_vnet_hdr *hdr;
472 int err; 474 int err;
473 475
474 skb = __netdev_alloc_skb_ip_align(vi->dev, MAX_PACKET_LEN, gfp); 476 skb = __netdev_alloc_skb_ip_align(vi->dev, GOOD_PACKET_LEN, gfp);
475 if (unlikely(!skb)) 477 if (unlikely(!skb))
476 return -ENOMEM; 478 return -ENOMEM;
477 479
478 skb_put(skb, MAX_PACKET_LEN); 480 skb_put(skb, GOOD_PACKET_LEN);
479 481
480 hdr = skb_vnet_hdr(skb); 482 hdr = skb_vnet_hdr(skb);
481 sg_set_buf(rq->sg, &hdr->hdr, sizeof hdr->hdr); 483 sg_set_buf(rq->sg, &hdr->hdr, sizeof hdr->hdr);
@@ -542,20 +544,20 @@ static int add_recvbuf_mergeable(struct receive_queue *rq, gfp_t gfp)
542 int err; 544 int err;
543 545
544 if (gfp & __GFP_WAIT) { 546 if (gfp & __GFP_WAIT) {
545 if (skb_page_frag_refill(MAX_PACKET_LEN, &vi->alloc_frag, 547 if (skb_page_frag_refill(MERGE_BUFFER_LEN, &vi->alloc_frag,
546 gfp)) { 548 gfp)) {
547 buf = (char *)page_address(vi->alloc_frag.page) + 549 buf = (char *)page_address(vi->alloc_frag.page) +
548 vi->alloc_frag.offset; 550 vi->alloc_frag.offset;
549 get_page(vi->alloc_frag.page); 551 get_page(vi->alloc_frag.page);
550 vi->alloc_frag.offset += MAX_PACKET_LEN; 552 vi->alloc_frag.offset += MERGE_BUFFER_LEN;
551 } 553 }
552 } else { 554 } else {
553 buf = netdev_alloc_frag(MAX_PACKET_LEN); 555 buf = netdev_alloc_frag(MERGE_BUFFER_LEN);
554 } 556 }
555 if (!buf) 557 if (!buf)
556 return -ENOMEM; 558 return -ENOMEM;
557 559
558 sg_init_one(rq->sg, buf, MAX_PACKET_LEN); 560 sg_init_one(rq->sg, buf, MERGE_BUFFER_LEN);
559 err = virtqueue_add_inbuf(rq->vq, rq->sg, 1, buf, gfp); 561 err = virtqueue_add_inbuf(rq->vq, rq->sg, 1, buf, gfp);
560 if (err < 0) 562 if (err < 0)
561 put_page(virt_to_head_page(buf)); 563 put_page(virt_to_head_page(buf));
@@ -1619,8 +1621,8 @@ static int virtnet_probe(struct virtio_device *vdev)
1619 if (err) 1621 if (err)
1620 goto free_stats; 1622 goto free_stats;
1621 1623
1622 netif_set_real_num_tx_queues(dev, 1); 1624 netif_set_real_num_tx_queues(dev, vi->curr_queue_pairs);
1623 netif_set_real_num_rx_queues(dev, 1); 1625 netif_set_real_num_rx_queues(dev, vi->curr_queue_pairs);
1624 1626
1625 err = register_netdev(dev); 1627 err = register_netdev(dev);
1626 if (err) { 1628 if (err) {
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index b07f164d65cf..20e49095db2a 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -187,17 +187,17 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
187 INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 187 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
188 ar9485_1_1_baseband_core_txfir_coeff_japan_2484); 188 ar9485_1_1_baseband_core_txfir_coeff_japan_2484);
189 189
190 /* Load PCIE SERDES settings from INI */ 190 if (ah->config.no_pll_pwrsave) {
191 191 INIT_INI_ARRAY(&ah->iniPcieSerdes,
192 /* Awake Setting */ 192 ar9485_1_1_pcie_phy_clkreq_disable_L1);
193 193 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
194 INIT_INI_ARRAY(&ah->iniPcieSerdes, 194 ar9485_1_1_pcie_phy_clkreq_disable_L1);
195 ar9485_1_1_pcie_phy_clkreq_disable_L1); 195 } else {
196 196 INIT_INI_ARRAY(&ah->iniPcieSerdes,
197 /* Sleep Setting */ 197 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
198 198 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
199 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 199 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
200 ar9485_1_1_pcie_phy_clkreq_disable_L1); 200 }
201 } else if (AR_SREV_9462_21(ah)) { 201 } else if (AR_SREV_9462_21(ah)) {
202 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 202 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
203 ar9462_2p1_mac_core); 203 ar9462_2p1_mac_core);
diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
index 6f899c692647..7c1845221e1c 100644
--- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
@@ -32,13 +32,6 @@ static const u32 ar9485_1_1_mac_postamble[][5] = {
32 {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, 32 {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440},
33}; 33};
34 34
35static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2] = {
36 /* Addr allmodes */
37 {0x00018c00, 0x18012e5e},
38 {0x00018c04, 0x000801d8},
39 {0x00018c08, 0x0000080c},
40};
41
42static const u32 ar9485Common_wo_xlna_rx_gain_1_1[][2] = { 35static const u32 ar9485Common_wo_xlna_rx_gain_1_1[][2] = {
43 /* Addr allmodes */ 36 /* Addr allmodes */
44 {0x00009e00, 0x037216a0}, 37 {0x00009e00, 0x037216a0},
@@ -1101,20 +1094,6 @@ static const u32 ar9485_common_rx_gain_1_1[][2] = {
1101 {0x0000a1fc, 0x00000296}, 1094 {0x0000a1fc, 0x00000296},
1102}; 1095};
1103 1096
1104static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2] = {
1105 /* Addr allmodes */
1106 {0x00018c00, 0x18052e5e},
1107 {0x00018c04, 0x000801d8},
1108 {0x00018c08, 0x0000080c},
1109};
1110
1111static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2] = {
1112 /* Addr allmodes */
1113 {0x00018c00, 0x18053e5e},
1114 {0x00018c04, 0x000801d8},
1115 {0x00018c08, 0x0000080c},
1116};
1117
1118static const u32 ar9485_1_1_soc_preamble[][2] = { 1097static const u32 ar9485_1_1_soc_preamble[][2] = {
1119 /* Addr allmodes */ 1098 /* Addr allmodes */
1120 {0x00004014, 0xba280400}, 1099 {0x00004014, 0xba280400},
@@ -1173,13 +1152,6 @@ static const u32 ar9485_1_1_baseband_postamble[][5] = {
1173 {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 1152 {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1174}; 1153};
1175 1154
1176static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = {
1177 /* Addr allmodes */
1178 {0x00018c00, 0x18013e5e},
1179 {0x00018c04, 0x000801d8},
1180 {0x00018c08, 0x0000080c},
1181};
1182
1183static const u32 ar9485_1_1_radio_postamble[][2] = { 1155static const u32 ar9485_1_1_radio_postamble[][2] = {
1184 /* Addr allmodes */ 1156 /* Addr allmodes */
1185 {0x0001609c, 0x0b283f31}, 1157 {0x0001609c, 0x0b283f31},
@@ -1358,4 +1330,18 @@ static const u32 ar9485_1_1_baseband_core_txfir_coeff_japan_2484[][2] = {
1358 {0x0000a3a0, 0xca9228ee}, 1330 {0x0000a3a0, 0xca9228ee},
1359}; 1331};
1360 1332
1333static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = {
1334 /* Addr allmodes */
1335 {0x00018c00, 0x18013e5e},
1336 {0x00018c04, 0x000801d8},
1337 {0x00018c08, 0x0000080c},
1338};
1339
1340static const u32 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1[][2] = {
1341 /* Addr allmodes */
1342 {0x00018c00, 0x1801265e},
1343 {0x00018c04, 0x000801d8},
1344 {0x00018c08, 0x0000080c},
1345};
1346
1361#endif /* INITVALS_9485_H */ 1347#endif /* INITVALS_9485_H */
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index e7a38d844a6a..60a5da53668f 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -632,15 +632,16 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs);
632/* Main driver core */ 632/* Main driver core */
633/********************/ 633/********************/
634 634
635#define ATH9K_PCI_CUS198 0x0001 635#define ATH9K_PCI_CUS198 0x0001
636#define ATH9K_PCI_CUS230 0x0002 636#define ATH9K_PCI_CUS230 0x0002
637#define ATH9K_PCI_CUS217 0x0004 637#define ATH9K_PCI_CUS217 0x0004
638#define ATH9K_PCI_CUS252 0x0008 638#define ATH9K_PCI_CUS252 0x0008
639#define ATH9K_PCI_WOW 0x0010 639#define ATH9K_PCI_WOW 0x0010
640#define ATH9K_PCI_BT_ANT_DIV 0x0020 640#define ATH9K_PCI_BT_ANT_DIV 0x0020
641#define ATH9K_PCI_D3_L1_WAR 0x0040 641#define ATH9K_PCI_D3_L1_WAR 0x0040
642#define ATH9K_PCI_AR9565_1ANT 0x0080 642#define ATH9K_PCI_AR9565_1ANT 0x0080
643#define ATH9K_PCI_AR9565_2ANT 0x0100 643#define ATH9K_PCI_AR9565_2ANT 0x0100
644#define ATH9K_PCI_NO_PLL_PWRSAVE 0x0200
644 645
645/* 646/*
646 * Default cache line size, in bytes. 647 * Default cache line size, in bytes.
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c
index 90b8342d1ed4..8824610c21fb 100644
--- a/drivers/net/wireless/ath/ath9k/dfs_debug.c
+++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c
@@ -44,14 +44,20 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
44 if (buf == NULL) 44 if (buf == NULL)
45 return -ENOMEM; 45 return -ENOMEM;
46 46
47 if (sc->dfs_detector)
48 dfs_pool_stats = sc->dfs_detector->get_stats(sc->dfs_detector);
49
50 len += scnprintf(buf + len, size - len, "DFS support for " 47 len += scnprintf(buf + len, size - len, "DFS support for "
51 "macVersion = 0x%x, macRev = 0x%x: %s\n", 48 "macVersion = 0x%x, macRev = 0x%x: %s\n",
52 hw_ver->macVersion, hw_ver->macRev, 49 hw_ver->macVersion, hw_ver->macRev,
53 (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ? 50 (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ?
54 "enabled" : "disabled"); 51 "enabled" : "disabled");
52
53 if (!sc->dfs_detector) {
54 len += scnprintf(buf + len, size - len,
55 "DFS detector not enabled\n");
56 goto exit;
57 }
58
59 dfs_pool_stats = sc->dfs_detector->get_stats(sc->dfs_detector);
60
55 len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n"); 61 len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n");
56 ATH9K_DFS_STAT("pulse events reported ", pulses_total); 62 ATH9K_DFS_STAT("pulse events reported ", pulses_total);
57 ATH9K_DFS_STAT("invalid pulse events ", pulses_no_dfs); 63 ATH9K_DFS_STAT("invalid pulse events ", pulses_no_dfs);
@@ -76,6 +82,7 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
76 ATH9K_DFS_POOL_STAT("Seqs. alloc error ", pseq_alloc_error); 82 ATH9K_DFS_POOL_STAT("Seqs. alloc error ", pseq_alloc_error);
77 ATH9K_DFS_POOL_STAT("Seqs. in use ", pseq_used); 83 ATH9K_DFS_POOL_STAT("Seqs. in use ", pseq_used);
78 84
85exit:
79 if (len > size) 86 if (len > size)
80 len = size; 87 len = size;
81 88
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 9ea24f1cba73..a2c9a5dbac6b 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -316,6 +316,7 @@ struct ath9k_ops_config {
316 u32 ant_ctrl_comm2g_switch_enable; 316 u32 ant_ctrl_comm2g_switch_enable;
317 bool xatten_margin_cfg; 317 bool xatten_margin_cfg;
318 bool alt_mingainidx; 318 bool alt_mingainidx;
319 bool no_pll_pwrsave;
319}; 320};
320 321
321enum ath9k_int { 322enum ath9k_int {
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index d8643ebabd30..710192ed27ed 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -609,6 +609,11 @@ static void ath9k_init_platform(struct ath_softc *sc)
609 ah->config.pcie_waen = 0x0040473b; 609 ah->config.pcie_waen = 0x0040473b;
610 ath_info(common, "Enable WAR for ASPM D3/L1\n"); 610 ath_info(common, "Enable WAR for ASPM D3/L1\n");
611 } 611 }
612
613 if (sc->driver_data & ATH9K_PCI_NO_PLL_PWRSAVE) {
614 ah->config.no_pll_pwrsave = true;
615 ath_info(common, "Disable PLL PowerSave\n");
616 }
612} 617}
613 618
614static void ath9k_eeprom_request_cb(const struct firmware *eeprom_blob, 619static void ath9k_eeprom_request_cb(const struct firmware *eeprom_blob,
@@ -863,8 +868,8 @@ static const struct ieee80211_iface_combination if_comb[] = {
863 .max_interfaces = 1, 868 .max_interfaces = 1,
864 .num_different_channels = 1, 869 .num_different_channels = 1,
865 .beacon_int_infra_match = true, 870 .beacon_int_infra_match = true,
866 .radar_detect_widths = BIT(NL80211_CHAN_NO_HT) | 871 .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
867 BIT(NL80211_CHAN_HT20), 872 BIT(NL80211_CHAN_WIDTH_20),
868 } 873 }
869}; 874};
870 875
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 7e4c2524b630..b5656fce4ff5 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -195,6 +195,93 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
195 0x3219), 195 0x3219),
196 .driver_data = ATH9K_PCI_BT_ANT_DIV }, 196 .driver_data = ATH9K_PCI_BT_ANT_DIV },
197 197
198 /* AR9485 cards with PLL power-save disabled by default. */
199 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
200 0x0032,
201 PCI_VENDOR_ID_AZWAVE,
202 0x2C97),
203 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
204 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
205 0x0032,
206 PCI_VENDOR_ID_AZWAVE,
207 0x2100),
208 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
209 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
210 0x0032,
211 0x1C56, /* ASKEY */
212 0x4001),
213 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
214 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
215 0x0032,
216 0x11AD, /* LITEON */
217 0x6627),
218 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
219 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
220 0x0032,
221 0x11AD, /* LITEON */
222 0x6628),
223 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
224 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
225 0x0032,
226 PCI_VENDOR_ID_FOXCONN,
227 0xE04E),
228 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
229 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
230 0x0032,
231 PCI_VENDOR_ID_FOXCONN,
232 0xE04F),
233 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
234 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
235 0x0032,
236 0x144F, /* ASKEY */
237 0x7197),
238 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
239 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
240 0x0032,
241 0x1B9A, /* XAVI */
242 0x2000),
243 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
244 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
245 0x0032,
246 0x1B9A, /* XAVI */
247 0x2001),
248 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
249 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
250 0x0032,
251 PCI_VENDOR_ID_AZWAVE,
252 0x1186),
253 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
254 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
255 0x0032,
256 PCI_VENDOR_ID_AZWAVE,
257 0x1F86),
258 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
259 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
260 0x0032,
261 PCI_VENDOR_ID_AZWAVE,
262 0x1195),
263 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
264 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
265 0x0032,
266 PCI_VENDOR_ID_AZWAVE,
267 0x1F95),
268 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
269 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
270 0x0032,
271 0x1B9A, /* XAVI */
272 0x1C00),
273 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
274 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
275 0x0032,
276 0x1B9A, /* XAVI */
277 0x1C01),
278 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
279 { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
280 0x0032,
281 PCI_VENDOR_ID_ASUSTEK,
282 0x850D),
283 .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
284
198 { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */ 285 { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */
199 { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */ 286 { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */
200 287
diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c b/drivers/net/wireless/ath/wcn36xx/debug.c
index 5b84f7ae0b1e..ef44a2da644d 100644
--- a/drivers/net/wireless/ath/wcn36xx/debug.c
+++ b/drivers/net/wireless/ath/wcn36xx/debug.c
@@ -126,7 +126,7 @@ static ssize_t write_file_dump(struct file *file,
126 if (begin == NULL) 126 if (begin == NULL)
127 break; 127 break;
128 128
129 if (kstrtoul(begin, 0, (unsigned long *)(arg + i)) != 0) 129 if (kstrtou32(begin, 0, &arg[i]) != 0)
130 break; 130 break;
131 } 131 }
132 132
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index f8c3a10510c2..de9eb2cfbf4b 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1286,7 +1286,8 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
1286 } else { 1286 } else {
1287 wcn36xx_err("Beacon is to big: beacon size=%d\n", 1287 wcn36xx_err("Beacon is to big: beacon size=%d\n",
1288 msg_body.beacon_length); 1288 msg_body.beacon_length);
1289 return -ENOMEM; 1289 ret = -ENOMEM;
1290 goto out;
1290 } 1291 }
1291 memcpy(msg_body.bssid, vif->addr, ETH_ALEN); 1292 memcpy(msg_body.bssid, vif->addr, ETH_ALEN);
1292 1293
@@ -1327,7 +1328,8 @@ int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
1327 if (skb->len > BEACON_TEMPLATE_SIZE) { 1328 if (skb->len > BEACON_TEMPLATE_SIZE) {
1328 wcn36xx_warn("probe response template is too big: %d\n", 1329 wcn36xx_warn("probe response template is too big: %d\n",
1329 skb->len); 1330 skb->len);
1330 return -E2BIG; 1331 ret = -E2BIG;
1332 goto out;
1331 } 1333 }
1332 1334
1333 msg.probe_resp_template_len = skb->len; 1335 msg.probe_resp_template_len = skb->len;
@@ -1606,7 +1608,8 @@ int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn,
1606 /* TODO: it also support ARP response type */ 1608 /* TODO: it also support ARP response type */
1607 } else { 1609 } else {
1608 wcn36xx_warn("unknow keep alive packet type %d\n", packet_type); 1610 wcn36xx_warn("unknow keep alive packet type %d\n", packet_type);
1609 return -EINVAL; 1611 ret = -EINVAL;
1612 goto out;
1610 } 1613 }
1611 1614
1612 PREPARE_HAL_BUF(wcn->hal_buf, msg_body); 1615 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 668dd27616a0..cc6a0a586f0b 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -913,7 +913,10 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,
913 char *p2; 913 char *p2;
914 struct debug_data *d = f->private_data; 914 struct debug_data *d = f->private_data;
915 915
916 pdata = kmalloc(cnt, GFP_KERNEL); 916 if (cnt == 0)
917 return 0;
918
919 pdata = kmalloc(cnt + 1, GFP_KERNEL);
917 if (pdata == NULL) 920 if (pdata == NULL)
918 return 0; 921 return 0;
919 922
@@ -922,6 +925,7 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,
922 kfree(pdata); 925 kfree(pdata);
923 return 0; 926 return 0;
924 } 927 }
928 pdata[cnt] = '\0';
925 929
926 p0 = pdata; 930 p0 = pdata;
927 for (i = 0; i < num_of_items; i++) { 931 for (i = 0; i < num_of_items; i++) {
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index ef8c98e21098..f499efc6abcf 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -902,6 +902,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
902 if (card->model == MODEL_UNKNOWN) { 902 if (card->model == MODEL_UNKNOWN) {
903 pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n", 903 pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n",
904 p_dev->manf_id, p_dev->card_id); 904 p_dev->manf_id, p_dev->card_id);
905 ret = -ENODEV;
905 goto out2; 906 goto out2;
906 } 907 }
907 908
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index de0df86704e7..9df7bc91a26f 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2097,7 +2097,7 @@ out:
2097} 2097}
2098 2098
2099/* Generic Netlink operations array */ 2099/* Generic Netlink operations array */
2100static struct genl_ops hwsim_ops[] = { 2100static const struct genl_ops hwsim_ops[] = {
2101 { 2101 {
2102 .cmd = HWSIM_CMD_REGISTER, 2102 .cmd = HWSIM_CMD_REGISTER,
2103 .policy = hwsim_genl_policy, 2103 .policy = hwsim_genl_policy,
@@ -2148,8 +2148,7 @@ static int hwsim_init_netlink(void)
2148 2148
2149 printk(KERN_INFO "mac80211_hwsim: initializing netlink\n"); 2149 printk(KERN_INFO "mac80211_hwsim: initializing netlink\n");
2150 2150
2151 rc = genl_register_family_with_ops(&hwsim_genl_family, 2151 rc = genl_register_family_with_ops(&hwsim_genl_family, hwsim_ops);
2152 hwsim_ops, ARRAY_SIZE(hwsim_ops));
2153 if (rc) 2152 if (rc)
2154 goto failure; 2153 goto failure;
2155 2154
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h
index f80f30b6160e..c8385ec77a86 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -1020,8 +1020,8 @@ struct mwifiex_power_group {
1020} __packed; 1020} __packed;
1021 1021
1022struct mwifiex_types_power_group { 1022struct mwifiex_types_power_group {
1023 u16 type; 1023 __le16 type;
1024 u16 length; 1024 __le16 length;
1025} __packed; 1025} __packed;
1026 1026
1027struct host_cmd_ds_txpwr_cfg { 1027struct host_cmd_ds_txpwr_cfg {
diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c
index 220af4fe0fc6..81ac001ee741 100644
--- a/drivers/net/wireless/mwifiex/ie.c
+++ b/drivers/net/wireless/mwifiex/ie.c
@@ -82,7 +82,7 @@ mwifiex_update_autoindex_ies(struct mwifiex_private *priv,
82 struct mwifiex_ie_list *ie_list) 82 struct mwifiex_ie_list *ie_list)
83{ 83{
84 u16 travel_len, index, mask; 84 u16 travel_len, index, mask;
85 s16 input_len; 85 s16 input_len, tlv_len;
86 struct mwifiex_ie *ie; 86 struct mwifiex_ie *ie;
87 u8 *tmp; 87 u8 *tmp;
88 88
@@ -91,11 +91,13 @@ mwifiex_update_autoindex_ies(struct mwifiex_private *priv,
91 91
92 ie_list->len = 0; 92 ie_list->len = 0;
93 93
94 while (input_len > 0) { 94 while (input_len >= sizeof(struct mwifiex_ie_types_header)) {
95 ie = (struct mwifiex_ie *)(((u8 *)ie_list) + travel_len); 95 ie = (struct mwifiex_ie *)(((u8 *)ie_list) + travel_len);
96 input_len -= le16_to_cpu(ie->ie_length) + MWIFIEX_IE_HDR_SIZE; 96 tlv_len = le16_to_cpu(ie->ie_length);
97 travel_len += le16_to_cpu(ie->ie_length) + MWIFIEX_IE_HDR_SIZE; 97 travel_len += tlv_len + MWIFIEX_IE_HDR_SIZE;
98 98
99 if (input_len < tlv_len + MWIFIEX_IE_HDR_SIZE)
100 return -1;
99 index = le16_to_cpu(ie->ie_index); 101 index = le16_to_cpu(ie->ie_index);
100 mask = le16_to_cpu(ie->mgmt_subtype_mask); 102 mask = le16_to_cpu(ie->mgmt_subtype_mask);
101 103
@@ -132,6 +134,7 @@ mwifiex_update_autoindex_ies(struct mwifiex_private *priv,
132 le16_add_cpu(&ie_list->len, 134 le16_add_cpu(&ie_list->len,
133 le16_to_cpu(priv->mgmt_ie[index].ie_length) + 135 le16_to_cpu(priv->mgmt_ie[index].ie_length) +
134 MWIFIEX_IE_HDR_SIZE); 136 MWIFIEX_IE_HDR_SIZE);
137 input_len -= tlv_len + MWIFIEX_IE_HDR_SIZE;
135 } 138 }
136 139
137 if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) 140 if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP)
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index 1576104e3d95..9bf8898743ab 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -1029,7 +1029,10 @@ static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter,
1029 struct sk_buff *skb, u32 upld_typ) 1029 struct sk_buff *skb, u32 upld_typ)
1030{ 1030{
1031 u8 *cmd_buf; 1031 u8 *cmd_buf;
1032 __le16 *curr_ptr = (__le16 *)skb->data;
1033 u16 pkt_len = le16_to_cpu(*curr_ptr);
1032 1034
1035 skb_trim(skb, pkt_len);
1033 skb_pull(skb, INTF_HEADER_LEN); 1036 skb_pull(skb, INTF_HEADER_LEN);
1034 1037
1035 switch (upld_typ) { 1038 switch (upld_typ) {
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index 7d66018a2e33..2181ee283d82 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -239,14 +239,14 @@ static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd,
239 memmove(cmd_txp_cfg, txp, 239 memmove(cmd_txp_cfg, txp,
240 sizeof(struct host_cmd_ds_txpwr_cfg) + 240 sizeof(struct host_cmd_ds_txpwr_cfg) +
241 sizeof(struct mwifiex_types_power_group) + 241 sizeof(struct mwifiex_types_power_group) +
242 pg_tlv->length); 242 le16_to_cpu(pg_tlv->length));
243 243
244 pg_tlv = (struct mwifiex_types_power_group *) ((u8 *) 244 pg_tlv = (struct mwifiex_types_power_group *) ((u8 *)
245 cmd_txp_cfg + 245 cmd_txp_cfg +
246 sizeof(struct host_cmd_ds_txpwr_cfg)); 246 sizeof(struct host_cmd_ds_txpwr_cfg));
247 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) + 247 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) +
248 sizeof(struct mwifiex_types_power_group) + 248 sizeof(struct mwifiex_types_power_group) +
249 pg_tlv->length); 249 le16_to_cpu(pg_tlv->length));
250 } else { 250 } else {
251 memmove(cmd_txp_cfg, txp, sizeof(*txp)); 251 memmove(cmd_txp_cfg, txp, sizeof(*txp));
252 } 252 }
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index 58a6013712d2..2675ca7f8d14 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -274,17 +274,20 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
274 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg; 274 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg;
275 struct mwifiex_rate_scope *rate_scope; 275 struct mwifiex_rate_scope *rate_scope;
276 struct mwifiex_ie_types_header *head; 276 struct mwifiex_ie_types_header *head;
277 u16 tlv, tlv_buf_len; 277 u16 tlv, tlv_buf_len, tlv_buf_left;
278 u8 *tlv_buf; 278 u8 *tlv_buf;
279 u32 i; 279 u32 i;
280 280
281 tlv_buf = ((u8 *)rate_cfg) + 281 tlv_buf = ((u8 *)rate_cfg) + sizeof(struct host_cmd_ds_tx_rate_cfg);
282 sizeof(struct host_cmd_ds_tx_rate_cfg); 282 tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*rate_cfg);
283 tlv_buf_len = le16_to_cpu(*(__le16 *) (tlv_buf + sizeof(u16)));
284 283
285 while (tlv_buf && tlv_buf_len > 0) { 284 while (tlv_buf_left >= sizeof(*head)) {
286 tlv = (*tlv_buf); 285 head = (struct mwifiex_ie_types_header *)tlv_buf;
287 tlv = tlv | (*(tlv_buf + 1) << 8); 286 tlv = le16_to_cpu(head->type);
287 tlv_buf_len = le16_to_cpu(head->len);
288
289 if (tlv_buf_left < (sizeof(*head) + tlv_buf_len))
290 break;
288 291
289 switch (tlv) { 292 switch (tlv) {
290 case TLV_TYPE_RATE_SCOPE: 293 case TLV_TYPE_RATE_SCOPE:
@@ -304,9 +307,8 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
304 /* Add RATE_DROP tlv here */ 307 /* Add RATE_DROP tlv here */
305 } 308 }
306 309
307 head = (struct mwifiex_ie_types_header *) tlv_buf; 310 tlv_buf += (sizeof(*head) + tlv_buf_len);
308 tlv_buf += le16_to_cpu(head->len) + sizeof(*head); 311 tlv_buf_left -= (sizeof(*head) + tlv_buf_len);
309 tlv_buf_len -= le16_to_cpu(head->len);
310 } 312 }
311 313
312 priv->is_data_rate_auto = mwifiex_is_rate_auto(priv); 314 priv->is_data_rate_auto = mwifiex_is_rate_auto(priv);
@@ -340,13 +342,17 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
340 ((u8 *) data_buf + sizeof(struct host_cmd_ds_txpwr_cfg)); 342 ((u8 *) data_buf + sizeof(struct host_cmd_ds_txpwr_cfg));
341 pg = (struct mwifiex_power_group *) 343 pg = (struct mwifiex_power_group *)
342 ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group)); 344 ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group));
343 length = pg_tlv_hdr->length; 345 length = le16_to_cpu(pg_tlv_hdr->length);
344 if (length > 0) { 346
345 max_power = pg->power_max; 347 /* At least one structure required to update power */
346 min_power = pg->power_min; 348 if (length < sizeof(struct mwifiex_power_group))
347 length -= sizeof(struct mwifiex_power_group); 349 return 0;
348 } 350
349 while (length) { 351 max_power = pg->power_max;
352 min_power = pg->power_min;
353 length -= sizeof(struct mwifiex_power_group);
354
355 while (length >= sizeof(struct mwifiex_power_group)) {
350 pg++; 356 pg++;
351 if (max_power < pg->power_max) 357 if (max_power < pg->power_max)
352 max_power = pg->power_max; 358 max_power = pg->power_max;
@@ -356,10 +362,8 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
356 362
357 length -= sizeof(struct mwifiex_power_group); 363 length -= sizeof(struct mwifiex_power_group);
358 } 364 }
359 if (pg_tlv_hdr->length > 0) { 365 priv->min_tx_power_level = (u8) min_power;
360 priv->min_tx_power_level = (u8) min_power; 366 priv->max_tx_power_level = (u8) max_power;
361 priv->max_tx_power_level = (u8) max_power;
362 }
363 367
364 return 0; 368 return 0;
365} 369}
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index f084412eee0b..c8e029df770e 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -638,8 +638,9 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
638 txp_cfg->mode = cpu_to_le32(1); 638 txp_cfg->mode = cpu_to_le32(1);
639 pg_tlv = (struct mwifiex_types_power_group *) 639 pg_tlv = (struct mwifiex_types_power_group *)
640 (buf + sizeof(struct host_cmd_ds_txpwr_cfg)); 640 (buf + sizeof(struct host_cmd_ds_txpwr_cfg));
641 pg_tlv->type = TLV_TYPE_POWER_GROUP; 641 pg_tlv->type = cpu_to_le16(TLV_TYPE_POWER_GROUP);
642 pg_tlv->length = 4 * sizeof(struct mwifiex_power_group); 642 pg_tlv->length =
643 cpu_to_le16(4 * sizeof(struct mwifiex_power_group));
643 pg = (struct mwifiex_power_group *) 644 pg = (struct mwifiex_power_group *)
644 (buf + sizeof(struct host_cmd_ds_txpwr_cfg) 645 (buf + sizeof(struct host_cmd_ds_txpwr_cfg)
645 + sizeof(struct mwifiex_types_power_group)); 646 + sizeof(struct mwifiex_types_power_group));
diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c b/drivers/net/wireless/mwifiex/uap_txrx.c
index 1cfe5a738c47..92f76d655e6c 100644
--- a/drivers/net/wireless/mwifiex/uap_txrx.c
+++ b/drivers/net/wireless/mwifiex/uap_txrx.c
@@ -97,6 +97,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
97 struct mwifiex_txinfo *tx_info; 97 struct mwifiex_txinfo *tx_info;
98 int hdr_chop; 98 int hdr_chop;
99 struct timeval tv; 99 struct timeval tv;
100 struct ethhdr *p_ethhdr;
100 u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; 101 u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
101 102
102 uap_rx_pd = (struct uap_rxpd *)(skb->data); 103 uap_rx_pd = (struct uap_rxpd *)(skb->data);
@@ -112,14 +113,36 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,
112 } 113 }
113 114
114 if (!memcmp(&rx_pkt_hdr->rfc1042_hdr, 115 if (!memcmp(&rx_pkt_hdr->rfc1042_hdr,
115 rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) 116 rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) {
117 /* Replace the 803 header and rfc1042 header (llc/snap) with
118 * an Ethernet II header, keep the src/dst and snap_type
119 * (ethertype).
120 *
121 * The firmware only passes up SNAP frames converting all RX
122 * data from 802.11 to 802.2/LLC/SNAP frames.
123 *
124 * To create the Ethernet II, just move the src, dst address
125 * right before the snap_type.
126 */
127 p_ethhdr = (struct ethhdr *)
128 ((u8 *)(&rx_pkt_hdr->eth803_hdr)
129 + sizeof(rx_pkt_hdr->eth803_hdr)
130 + sizeof(rx_pkt_hdr->rfc1042_hdr)
131 - sizeof(rx_pkt_hdr->eth803_hdr.h_dest)
132 - sizeof(rx_pkt_hdr->eth803_hdr.h_source)
133 - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type));
134 memcpy(p_ethhdr->h_source, rx_pkt_hdr->eth803_hdr.h_source,
135 sizeof(p_ethhdr->h_source));
136 memcpy(p_ethhdr->h_dest, rx_pkt_hdr->eth803_hdr.h_dest,
137 sizeof(p_ethhdr->h_dest));
116 /* Chop off the rxpd + the excess memory from 138 /* Chop off the rxpd + the excess memory from
117 * 802.2/llc/snap header that was removed. 139 * 802.2/llc/snap header that was removed.
118 */ 140 */
119 hdr_chop = (u8 *)eth_hdr - (u8 *)uap_rx_pd; 141 hdr_chop = (u8 *)p_ethhdr - (u8 *)uap_rx_pd;
120 else 142 } else {
121 /* Chop off the rxpd */ 143 /* Chop off the rxpd */
122 hdr_chop = (u8 *)&rx_pkt_hdr->eth803_hdr - (u8 *)uap_rx_pd; 144 hdr_chop = (u8 *)&rx_pkt_hdr->eth803_hdr - (u8 *)uap_rx_pd;
145 }
123 146
124 /* Chop off the leading header bytes so the it points 147 /* Chop off the leading header bytes so the it points
125 * to the start of either the reconstructed EthII frame 148 * to the start of either the reconstructed EthII frame
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 5dd0ccc70b86..13eaeed03898 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -722,6 +722,9 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
722 tlv_hdr = (struct mwifiex_ie_types_data *) curr; 722 tlv_hdr = (struct mwifiex_ie_types_data *) curr;
723 tlv_len = le16_to_cpu(tlv_hdr->header.len); 723 tlv_len = le16_to_cpu(tlv_hdr->header.len);
724 724
725 if (resp_len < tlv_len + sizeof(tlv_hdr->header))
726 break;
727
725 switch (le16_to_cpu(tlv_hdr->header.type)) { 728 switch (le16_to_cpu(tlv_hdr->header.type)) {
726 case TLV_TYPE_WMMQSTATUS: 729 case TLV_TYPE_WMMQSTATUS:
727 tlv_wmm_qstatus = 730 tlv_wmm_qstatus =
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c
index 41a16d30c79c..e05d9b4c8317 100644
--- a/drivers/net/wireless/prism54/islpci_dev.c
+++ b/drivers/net/wireless/prism54/islpci_dev.c
@@ -811,6 +811,10 @@ static const struct net_device_ops islpci_netdev_ops = {
811 .ndo_validate_addr = eth_validate_addr, 811 .ndo_validate_addr = eth_validate_addr,
812}; 812};
813 813
814static struct device_type wlan_type = {
815 .name = "wlan",
816};
817
814struct net_device * 818struct net_device *
815islpci_setup(struct pci_dev *pdev) 819islpci_setup(struct pci_dev *pdev)
816{ 820{
@@ -821,9 +825,8 @@ islpci_setup(struct pci_dev *pdev)
821 return ndev; 825 return ndev;
822 826
823 pci_set_drvdata(pdev, ndev); 827 pci_set_drvdata(pdev, ndev);
824#if defined(SET_NETDEV_DEV)
825 SET_NETDEV_DEV(ndev, &pdev->dev); 828 SET_NETDEV_DEV(ndev, &pdev->dev);
826#endif 829 SET_NETDEV_DEVTYPE(ndev, &wlan_type);
827 830
828 /* setup the structure members */ 831 /* setup the structure members */
829 ndev->base_addr = pci_resource_start(pdev, 0); 832 ndev->base_addr = pci_resource_start(pdev, 0);
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index c5738f14c4ba..776aff3678ff 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2640,7 +2640,7 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
2640 2640
2641 if (rt2x00_rt(rt2x00dev, RT5392)) { 2641 if (rt2x00_rt(rt2x00dev, RT5392)) {
2642 rt2800_rfcsr_read(rt2x00dev, 50, &rfcsr); 2642 rt2800_rfcsr_read(rt2x00dev, 50, &rfcsr);
2643 if (info->default_power1 > POWER_BOUND) 2643 if (info->default_power2 > POWER_BOUND)
2644 rt2x00_set_field8(&rfcsr, RFCSR50_TX, POWER_BOUND); 2644 rt2x00_set_field8(&rfcsr, RFCSR50_TX, POWER_BOUND);
2645 else 2645 else
2646 rt2x00_set_field8(&rfcsr, RFCSR50_TX, 2646 rt2x00_set_field8(&rfcsr, RFCSR50_TX,
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index a0935987fa3a..7f40ab8e1bd8 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -146,7 +146,7 @@ void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length);
146 * @local: frame is not from mac80211 146 * @local: frame is not from mac80211
147 */ 147 */
148int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, 148int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
149 bool local); 149 struct ieee80211_sta *sta, bool local);
150 150
151/** 151/**
152 * rt2x00queue_update_beacon - Send new beacon from mac80211 152 * rt2x00queue_update_beacon - Send new beacon from mac80211
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 7c157857f5ce..2183e7978399 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -90,7 +90,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
90 frag_skb->data, data_length, tx_info, 90 frag_skb->data, data_length, tx_info,
91 (struct ieee80211_rts *)(skb->data)); 91 (struct ieee80211_rts *)(skb->data));
92 92
93 retval = rt2x00queue_write_tx_frame(queue, skb, true); 93 retval = rt2x00queue_write_tx_frame(queue, skb, NULL, true);
94 if (retval) { 94 if (retval) {
95 dev_kfree_skb_any(skb); 95 dev_kfree_skb_any(skb);
96 rt2x00_warn(rt2x00dev, "Failed to send RTS/CTS frame\n"); 96 rt2x00_warn(rt2x00dev, "Failed to send RTS/CTS frame\n");
@@ -151,7 +151,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw,
151 goto exit_fail; 151 goto exit_fail;
152 } 152 }
153 153
154 if (unlikely(rt2x00queue_write_tx_frame(queue, skb, false))) 154 if (unlikely(rt2x00queue_write_tx_frame(queue, skb, control->sta, false)))
155 goto exit_fail; 155 goto exit_fail;
156 156
157 /* 157 /*
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 50590b1420a5..a5d38e8ad9e4 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -635,7 +635,7 @@ static void rt2x00queue_bar_check(struct queue_entry *entry)
635} 635}
636 636
637int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, 637int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
638 bool local) 638 struct ieee80211_sta *sta, bool local)
639{ 639{
640 struct ieee80211_tx_info *tx_info; 640 struct ieee80211_tx_info *tx_info;
641 struct queue_entry *entry; 641 struct queue_entry *entry;
@@ -649,7 +649,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
649 * after that we are free to use the skb->cb array 649 * after that we are free to use the skb->cb array
650 * for our information. 650 * for our information.
651 */ 651 */
652 rt2x00queue_create_tx_descriptor(queue->rt2x00dev, skb, &txdesc, NULL); 652 rt2x00queue_create_tx_descriptor(queue->rt2x00dev, skb, &txdesc, sta);
653 653
654 /* 654 /*
655 * All information is retrieved from the skb->cb array, 655 * All information is retrieved from the skb->cb array,
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index 9a78e3daf742..ff784072fb42 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -37,6 +37,7 @@
37 37
38#include <linux/ip.h> 38#include <linux/ip.h>
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/udp.h>
40 41
41/* 42/*
42 *NOTICE!!!: This file will be very big, we should 43 *NOTICE!!!: This file will be very big, we should
@@ -1074,64 +1075,52 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
1074 if (!ieee80211_is_data(fc)) 1075 if (!ieee80211_is_data(fc))
1075 return false; 1076 return false;
1076 1077
1078 ip = (const struct iphdr *)(skb->data + mac_hdr_len +
1079 SNAP_SIZE + PROTOC_TYPE_SIZE);
1080 ether_type = be16_to_cpup((__be16 *)
1081 (skb->data + mac_hdr_len + SNAP_SIZE));
1077 1082
1078 ip = (struct iphdr *)((u8 *) skb->data + mac_hdr_len + 1083 switch (ether_type) {
1079 SNAP_SIZE + PROTOC_TYPE_SIZE); 1084 case ETH_P_IP: {
1080 ether_type = *(u16 *) ((u8 *) skb->data + mac_hdr_len + SNAP_SIZE); 1085 struct udphdr *udp;
1081 /* ether_type = ntohs(ether_type); */ 1086 u16 src;
1082 1087 u16 dst;
1083 if (ETH_P_IP == ether_type) {
1084 if (IPPROTO_UDP == ip->protocol) {
1085 struct udphdr *udp = (struct udphdr *)((u8 *) ip +
1086 (ip->ihl << 2));
1087 if (((((u8 *) udp)[1] == 68) &&
1088 (((u8 *) udp)[3] == 67)) ||
1089 ((((u8 *) udp)[1] == 67) &&
1090 (((u8 *) udp)[3] == 68))) {
1091 /*
1092 * 68 : UDP BOOTP client
1093 * 67 : UDP BOOTP server
1094 */
1095 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV),
1096 DBG_DMESG, "dhcp %s !!\n",
1097 is_tx ? "Tx" : "Rx");
1098
1099 if (is_tx) {
1100 rtlpriv->enter_ps = false;
1101 schedule_work(&rtlpriv->
1102 works.lps_change_work);
1103 ppsc->last_delaylps_stamp_jiffies =
1104 jiffies;
1105 }
1106 1088
1107 return true; 1089 if (ip->protocol != IPPROTO_UDP)
1108 } 1090 return false;
1109 } 1091 udp = (struct udphdr *)((u8 *)ip + (ip->ihl << 2));
1110 } else if (ETH_P_ARP == ether_type) { 1092 src = be16_to_cpu(udp->source);
1111 if (is_tx) { 1093 dst = be16_to_cpu(udp->dest);
1112 rtlpriv->enter_ps = false;
1113 schedule_work(&rtlpriv->works.lps_change_work);
1114 ppsc->last_delaylps_stamp_jiffies = jiffies;
1115 }
1116 1094
1117 return true; 1095 /* If this case involves port 68 (UDP BOOTP client) connecting
1118 } else if (ETH_P_PAE == ether_type) { 1096 * with port 67 (UDP BOOTP server), then return true so that
1097 * the lowest speed is used.
1098 */
1099 if (!((src == 68 && dst == 67) || (src == 67 && dst == 68)))
1100 return false;
1101
1102 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
1103 "dhcp %s !!\n", is_tx ? "Tx" : "Rx");
1104 break;
1105 }
1106 case ETH_P_ARP:
1107 break;
1108 case ETH_P_PAE:
1119 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, 1109 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
1120 "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx"); 1110 "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx");
1121 1111 break;
1122 if (is_tx) { 1112 case ETH_P_IPV6:
1123 rtlpriv->enter_ps = false; 1113 /* TODO: Is this right? */
1124 schedule_work(&rtlpriv->works.lps_change_work); 1114 return false;
1125 ppsc->last_delaylps_stamp_jiffies = jiffies; 1115 default:
1126 } 1116 return false;
1127
1128 return true;
1129 } else if (ETH_P_IPV6 == ether_type) {
1130 /* IPv6 */
1131 return true;
1132 } 1117 }
1133 1118 if (is_tx) {
1134 return false; 1119 rtlpriv->enter_ps = false;
1120 schedule_work(&rtlpriv->works.lps_change_work);
1121 ppsc->last_delaylps_stamp_jiffies = jiffies;
1122 }
1123 return true;
1135} 1124}
1136EXPORT_SYMBOL_GPL(rtl_is_special_data); 1125EXPORT_SYMBOL_GPL(rtl_is_special_data);
1137 1126
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c
index ae13fb94b2e8..2ffc7298f686 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -262,9 +262,9 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
262 sizeof(u8), GFP_ATOMIC); 262 sizeof(u8), GFP_ATOMIC);
263 if (!efuse_tbl) 263 if (!efuse_tbl)
264 return; 264 return;
265 efuse_word = kmalloc(EFUSE_MAX_WORD_UNIT * sizeof(u16 *), GFP_ATOMIC); 265 efuse_word = kzalloc(EFUSE_MAX_WORD_UNIT * sizeof(u16 *), GFP_ATOMIC);
266 if (!efuse_word) 266 if (!efuse_word)
267 goto done; 267 goto out;
268 for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { 268 for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) {
269 efuse_word[i] = kmalloc(efuse_max_section * sizeof(u16), 269 efuse_word[i] = kmalloc(efuse_max_section * sizeof(u16),
270 GFP_ATOMIC); 270 GFP_ATOMIC);
@@ -378,6 +378,7 @@ done:
378 for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) 378 for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++)
379 kfree(efuse_word[i]); 379 kfree(efuse_word[i]);
380 kfree(efuse_word); 380 kfree(efuse_word);
381out:
381 kfree(efuse_tbl); 382 kfree(efuse_tbl);
382} 383}
383 384
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
index 25e50ffc44ec..b0c346a9e4b8 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
@@ -349,7 +349,7 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
349 p_drvinfo); 349 p_drvinfo);
350 } 350 }
351 /*rx_status->qual = stats->signal; */ 351 /*rx_status->qual = stats->signal; */
352 rx_status->signal = stats->rssi + 10; 352 rx_status->signal = stats->recvsignalpower + 10;
353 return true; 353 return true;
354} 354}
355 355
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
index 945ddecf90c9..0eb0f4ae5920 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
@@ -525,7 +525,7 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
525 p_drvinfo); 525 p_drvinfo);
526 } 526 }
527 /*rx_status->qual = stats->signal; */ 527 /*rx_status->qual = stats->signal; */
528 rx_status->signal = stats->rssi + 10; 528 rx_status->signal = stats->recvsignalpower + 10;
529 return true; 529 return true;
530} 530}
531 531
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
index 5061f1db3f02..92d38ab3c60e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
@@ -265,7 +265,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
265 rtlefuse->pwrgroup_ht40 265 rtlefuse->pwrgroup_ht40
266 [RF90_PATH_A][chnl - 1]) { 266 [RF90_PATH_A][chnl - 1]) {
267 pwrdiff_limit[i] = 267 pwrdiff_limit[i] =
268 rtlefuse->pwrgroup_ht20 268 rtlefuse->pwrgroup_ht40
269 [RF90_PATH_A][chnl - 1]; 269 [RF90_PATH_A][chnl - 1];
270 } 270 }
271 } else { 271 } else {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
index 222d2e792ca6..27efbcdac6a9 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
@@ -329,7 +329,7 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
329 } 329 }
330 330
331 /*rx_status->qual = stats->signal; */ 331 /*rx_status->qual = stats->signal; */
332 rx_status->signal = stats->rssi + 10; 332 rx_status->signal = stats->recvsignalpower + 10;
333 333
334 return true; 334 return true;
335} 335}
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index d224dc3bb092..0c65386fa30d 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -77,11 +77,7 @@
77#define RTL_SLOT_TIME_9 9 77#define RTL_SLOT_TIME_9 9
78#define RTL_SLOT_TIME_20 20 78#define RTL_SLOT_TIME_20 20
79 79
80/*related with tcp/ip. */ 80/*related to tcp/ip. */
81/*if_ehther.h*/
82#define ETH_P_PAE 0x888E /*Port Access Entity (IEEE 802.1X) */
83#define ETH_P_IP 0x0800 /*Internet Protocol packet */
84#define ETH_P_ARP 0x0806 /*Address Resolution packet */
85#define SNAP_SIZE 6 81#define SNAP_SIZE 6
86#define PROTOC_TYPE_SIZE 2 82#define PROTOC_TYPE_SIZE 2
87 83
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index d85e66979711..e59acb1daa23 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -277,12 +277,13 @@ static void xennet_alloc_rx_buffers(struct net_device *dev)
277 if (!page) { 277 if (!page) {
278 kfree_skb(skb); 278 kfree_skb(skb);
279no_skb: 279no_skb:
280 /* Any skbuffs queued for refill? Force them out. */
281 if (i != 0)
282 goto refill;
283 /* Could not allocate any skbuffs. Try again later. */ 280 /* Could not allocate any skbuffs. Try again later. */
284 mod_timer(&np->rx_refill_timer, 281 mod_timer(&np->rx_refill_timer,
285 jiffies + (HZ/10)); 282 jiffies + (HZ/10));
283
284 /* Any skbuffs queued for refill? Force them out. */
285 if (i != 0)
286 goto refill;
286 break; 287 break;
287 } 288 }
288 289
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index e43db7742047..bd6f743d87a7 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -1512,7 +1512,8 @@ static int pmcraid_notify_aen(
1512 } 1512 }
1513 1513
1514 result = 1514 result =
1515 genlmsg_multicast(skb, 0, pmcraid_event_family.id, GFP_ATOMIC); 1515 genlmsg_multicast(&pmcraid_event_family, skb, 0,
1516 pmcraid_event_family.id, GFP_ATOMIC);
1516 1517
1517 /* If there are no listeners, genlmsg_multicast may return non-zero 1518 /* If there are no listeners, genlmsg_multicast may return non-zero
1518 * value. 1519 * value.
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 03a567199bbe..f1d511a9475b 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1608,15 +1608,17 @@ exit:
1608EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name); 1608EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name);
1609 1609
1610#ifdef CONFIG_NET 1610#ifdef CONFIG_NET
1611static const struct genl_multicast_group thermal_event_mcgrps[] = {
1612 { .name = THERMAL_GENL_MCAST_GROUP_NAME, },
1613};
1614
1611static struct genl_family thermal_event_genl_family = { 1615static struct genl_family thermal_event_genl_family = {
1612 .id = GENL_ID_GENERATE, 1616 .id = GENL_ID_GENERATE,
1613 .name = THERMAL_GENL_FAMILY_NAME, 1617 .name = THERMAL_GENL_FAMILY_NAME,
1614 .version = THERMAL_GENL_VERSION, 1618 .version = THERMAL_GENL_VERSION,
1615 .maxattr = THERMAL_GENL_ATTR_MAX, 1619 .maxattr = THERMAL_GENL_ATTR_MAX,
1616}; 1620 .mcgrps = thermal_event_mcgrps,
1617 1621 .n_mcgrps = ARRAY_SIZE(thermal_event_mcgrps),
1618static struct genl_multicast_group thermal_event_mcgrp = {
1619 .name = THERMAL_GENL_MCAST_GROUP_NAME,
1620}; 1622};
1621 1623
1622int thermal_generate_netlink_event(struct thermal_zone_device *tz, 1624int thermal_generate_netlink_event(struct thermal_zone_device *tz,
@@ -1677,7 +1679,8 @@ int thermal_generate_netlink_event(struct thermal_zone_device *tz,
1677 return result; 1679 return result;
1678 } 1680 }
1679 1681
1680 result = genlmsg_multicast(skb, 0, thermal_event_mcgrp.id, GFP_ATOMIC); 1682 result = genlmsg_multicast(&thermal_event_genl_family, skb, 0,
1683 0, GFP_ATOMIC);
1681 if (result) 1684 if (result)
1682 dev_err(&tz->device, "Failed to send netlink event:%d", result); 1685 dev_err(&tz->device, "Failed to send netlink event:%d", result);
1683 1686
@@ -1687,17 +1690,7 @@ EXPORT_SYMBOL_GPL(thermal_generate_netlink_event);
1687 1690
1688static int genetlink_init(void) 1691static int genetlink_init(void)
1689{ 1692{
1690 int result; 1693 return genl_register_family(&thermal_event_genl_family);
1691
1692 result = genl_register_family(&thermal_event_genl_family);
1693 if (result)
1694 return result;
1695
1696 result = genl_register_mc_group(&thermal_event_genl_family,
1697 &thermal_event_mcgrp);
1698 if (result)
1699 genl_unregister_family(&thermal_event_genl_family);
1700 return result;
1701} 1694}
1702 1695
1703static void genetlink_exit(void) 1696static void genetlink_exit(void)