diff options
author | David S. Miller <davem@davemloft.net> | 2013-10-08 23:07:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-08 23:07:53 -0400 |
commit | 53af53ae83fe960ceb9ef74cac7915e9088f4266 (patch) | |
tree | 0cd5309f2a931d3f210aa3d2025aae64f2276e8c | |
parent | b343ca84b4e3ba65508503333c923a797801a588 (diff) | |
parent | 9684d7b0dab3cf3a897edd85dca501d413888d56 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
include/linux/netdevice.h
net/core/sock.c
Trivial merge issues.
Removal of "extern" for functions declaration in netdevice.h
at the same time "const" was added to an argument.
Two parallel line additions in net/core/sock.c
Signed-off-by: David S. Miller <davem@davemloft.net>
62 files changed, 475 insertions, 207 deletions
diff --git a/Documentation/connector/ucon.c b/Documentation/connector/ucon.c index 4848db8c71ff..8a4da64e02a8 100644 --- a/Documentation/connector/ucon.c +++ b/Documentation/connector/ucon.c | |||
@@ -71,7 +71,7 @@ static int netlink_send(int s, struct cn_msg *msg) | |||
71 | nlh->nlmsg_seq = seq++; | 71 | nlh->nlmsg_seq = seq++; |
72 | nlh->nlmsg_pid = getpid(); | 72 | nlh->nlmsg_pid = getpid(); |
73 | nlh->nlmsg_type = NLMSG_DONE; | 73 | nlh->nlmsg_type = NLMSG_DONE; |
74 | nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh)); | 74 | nlh->nlmsg_len = size; |
75 | nlh->nlmsg_flags = 0; | 75 | nlh->nlmsg_flags = 0; |
76 | 76 | ||
77 | m = NLMSG_DATA(nlh); | 77 | m = NLMSG_DATA(nlh); |
diff --git a/MAINTAINERS b/MAINTAINERS index 744a23954a34..43dfc821c584 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1785,6 +1785,7 @@ F: include/net/bluetooth/ | |||
1785 | 1785 | ||
1786 | BONDING DRIVER | 1786 | BONDING DRIVER |
1787 | M: Jay Vosburgh <fubar@us.ibm.com> | 1787 | M: Jay Vosburgh <fubar@us.ibm.com> |
1788 | M: Veaceslav Falico <vfalico@redhat.com> | ||
1788 | M: Andy Gospodarek <andy@greyhouse.net> | 1789 | M: Andy Gospodarek <andy@greyhouse.net> |
1789 | L: netdev@vger.kernel.org | 1790 | L: netdev@vger.kernel.org |
1790 | W: http://sourceforge.net/projects/bonding/ | 1791 | W: http://sourceforge.net/projects/bonding/ |
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index f50d223a0bd3..99b44e0e8d86 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c | |||
@@ -930,4 +930,5 @@ void bpf_jit_free(struct sk_filter *fp) | |||
930 | { | 930 | { |
931 | if (fp->bpf_func != sk_run_filter) | 931 | if (fp->bpf_func != sk_run_filter) |
932 | module_free(NULL, fp->bpf_func); | 932 | module_free(NULL, fp->bpf_func); |
933 | kfree(fp); | ||
933 | } | 934 | } |
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index bf56e33f8257..2345bdb4d917 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c | |||
@@ -691,4 +691,5 @@ void bpf_jit_free(struct sk_filter *fp) | |||
691 | { | 691 | { |
692 | if (fp->bpf_func != sk_run_filter) | 692 | if (fp->bpf_func != sk_run_filter) |
693 | module_free(NULL, fp->bpf_func); | 693 | module_free(NULL, fp->bpf_func); |
694 | kfree(fp); | ||
694 | } | 695 | } |
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 709239285869..a5df511e27a2 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c | |||
@@ -881,7 +881,9 @@ void bpf_jit_free(struct sk_filter *fp) | |||
881 | struct bpf_binary_header *header = (void *)addr; | 881 | struct bpf_binary_header *header = (void *)addr; |
882 | 882 | ||
883 | if (fp->bpf_func == sk_run_filter) | 883 | if (fp->bpf_func == sk_run_filter) |
884 | return; | 884 | goto free_filter; |
885 | set_memory_rw(addr, header->pages); | 885 | set_memory_rw(addr, header->pages); |
886 | module_free(NULL, header); | 886 | module_free(NULL, header); |
887 | free_filter: | ||
888 | kfree(fp); | ||
887 | } | 889 | } |
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c index 9c7be59e6f5a..218b6b23c378 100644 --- a/arch/sparc/net/bpf_jit_comp.c +++ b/arch/sparc/net/bpf_jit_comp.c | |||
@@ -808,4 +808,5 @@ void bpf_jit_free(struct sk_filter *fp) | |||
808 | { | 808 | { |
809 | if (fp->bpf_func != sk_run_filter) | 809 | if (fp->bpf_func != sk_run_filter) |
810 | module_free(NULL, fp->bpf_func); | 810 | module_free(NULL, fp->bpf_func); |
811 | kfree(fp); | ||
811 | } | 812 | } |
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 79c216aa0e2b..516593e1ce33 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c | |||
@@ -772,13 +772,21 @@ out: | |||
772 | return; | 772 | return; |
773 | } | 773 | } |
774 | 774 | ||
775 | static void bpf_jit_free_deferred(struct work_struct *work) | ||
776 | { | ||
777 | struct sk_filter *fp = container_of(work, struct sk_filter, work); | ||
778 | unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK; | ||
779 | struct bpf_binary_header *header = (void *)addr; | ||
780 | |||
781 | set_memory_rw(addr, header->pages); | ||
782 | module_free(NULL, header); | ||
783 | kfree(fp); | ||
784 | } | ||
785 | |||
775 | void bpf_jit_free(struct sk_filter *fp) | 786 | void bpf_jit_free(struct sk_filter *fp) |
776 | { | 787 | { |
777 | if (fp->bpf_func != sk_run_filter) { | 788 | if (fp->bpf_func != sk_run_filter) { |
778 | unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK; | 789 | INIT_WORK(&fp->work, bpf_jit_free_deferred); |
779 | struct bpf_binary_header *header = (void *)addr; | 790 | schedule_work(&fp->work); |
780 | |||
781 | set_memory_rw(addr, header->pages); | ||
782 | module_free(NULL, header); | ||
783 | } | 791 | } |
784 | } | 792 | } |
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 08ae128cce9b..c73fc2b74de2 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
@@ -65,6 +65,7 @@ void proc_fork_connector(struct task_struct *task) | |||
65 | 65 | ||
66 | msg = (struct cn_msg *)buffer; | 66 | msg = (struct cn_msg *)buffer; |
67 | ev = (struct proc_event *)msg->data; | 67 | ev = (struct proc_event *)msg->data; |
68 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | ||
68 | get_seq(&msg->seq, &ev->cpu); | 69 | get_seq(&msg->seq, &ev->cpu); |
69 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 70 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
70 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 71 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -80,6 +81,7 @@ void proc_fork_connector(struct task_struct *task) | |||
80 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 81 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
81 | msg->ack = 0; /* not used */ | 82 | msg->ack = 0; /* not used */ |
82 | msg->len = sizeof(*ev); | 83 | msg->len = sizeof(*ev); |
84 | msg->flags = 0; /* not used */ | ||
83 | /* If cn_netlink_send() failed, the data is not sent */ | 85 | /* If cn_netlink_send() failed, the data is not sent */ |
84 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); | 86 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); |
85 | } | 87 | } |
@@ -96,6 +98,7 @@ void proc_exec_connector(struct task_struct *task) | |||
96 | 98 | ||
97 | msg = (struct cn_msg *)buffer; | 99 | msg = (struct cn_msg *)buffer; |
98 | ev = (struct proc_event *)msg->data; | 100 | ev = (struct proc_event *)msg->data; |
101 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | ||
99 | get_seq(&msg->seq, &ev->cpu); | 102 | get_seq(&msg->seq, &ev->cpu); |
100 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 103 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
101 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 104 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -106,6 +109,7 @@ void proc_exec_connector(struct task_struct *task) | |||
106 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 109 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
107 | msg->ack = 0; /* not used */ | 110 | msg->ack = 0; /* not used */ |
108 | msg->len = sizeof(*ev); | 111 | msg->len = sizeof(*ev); |
112 | msg->flags = 0; /* not used */ | ||
109 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); | 113 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); |
110 | } | 114 | } |
111 | 115 | ||
@@ -122,6 +126,7 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
122 | 126 | ||
123 | msg = (struct cn_msg *)buffer; | 127 | msg = (struct cn_msg *)buffer; |
124 | ev = (struct proc_event *)msg->data; | 128 | ev = (struct proc_event *)msg->data; |
129 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | ||
125 | ev->what = which_id; | 130 | ev->what = which_id; |
126 | ev->event_data.id.process_pid = task->pid; | 131 | ev->event_data.id.process_pid = task->pid; |
127 | ev->event_data.id.process_tgid = task->tgid; | 132 | ev->event_data.id.process_tgid = task->tgid; |
@@ -145,6 +150,7 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
145 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 150 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
146 | msg->ack = 0; /* not used */ | 151 | msg->ack = 0; /* not used */ |
147 | msg->len = sizeof(*ev); | 152 | msg->len = sizeof(*ev); |
153 | msg->flags = 0; /* not used */ | ||
148 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); | 154 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); |
149 | } | 155 | } |
150 | 156 | ||
@@ -160,6 +166,7 @@ void proc_sid_connector(struct task_struct *task) | |||
160 | 166 | ||
161 | msg = (struct cn_msg *)buffer; | 167 | msg = (struct cn_msg *)buffer; |
162 | ev = (struct proc_event *)msg->data; | 168 | ev = (struct proc_event *)msg->data; |
169 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | ||
163 | get_seq(&msg->seq, &ev->cpu); | 170 | get_seq(&msg->seq, &ev->cpu); |
164 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 171 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
165 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 172 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -170,6 +177,7 @@ void proc_sid_connector(struct task_struct *task) | |||
170 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 177 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
171 | msg->ack = 0; /* not used */ | 178 | msg->ack = 0; /* not used */ |
172 | msg->len = sizeof(*ev); | 179 | msg->len = sizeof(*ev); |
180 | msg->flags = 0; /* not used */ | ||
173 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); | 181 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); |
174 | } | 182 | } |
175 | 183 | ||
@@ -185,6 +193,7 @@ void proc_ptrace_connector(struct task_struct *task, int ptrace_id) | |||
185 | 193 | ||
186 | msg = (struct cn_msg *)buffer; | 194 | msg = (struct cn_msg *)buffer; |
187 | ev = (struct proc_event *)msg->data; | 195 | ev = (struct proc_event *)msg->data; |
196 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | ||
188 | get_seq(&msg->seq, &ev->cpu); | 197 | get_seq(&msg->seq, &ev->cpu); |
189 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 198 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
190 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 199 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -203,6 +212,7 @@ void proc_ptrace_connector(struct task_struct *task, int ptrace_id) | |||
203 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 212 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
204 | msg->ack = 0; /* not used */ | 213 | msg->ack = 0; /* not used */ |
205 | msg->len = sizeof(*ev); | 214 | msg->len = sizeof(*ev); |
215 | msg->flags = 0; /* not used */ | ||
206 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); | 216 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); |
207 | } | 217 | } |
208 | 218 | ||
@@ -218,6 +228,7 @@ void proc_comm_connector(struct task_struct *task) | |||
218 | 228 | ||
219 | msg = (struct cn_msg *)buffer; | 229 | msg = (struct cn_msg *)buffer; |
220 | ev = (struct proc_event *)msg->data; | 230 | ev = (struct proc_event *)msg->data; |
231 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | ||
221 | get_seq(&msg->seq, &ev->cpu); | 232 | get_seq(&msg->seq, &ev->cpu); |
222 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 233 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
223 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 234 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -229,6 +240,7 @@ void proc_comm_connector(struct task_struct *task) | |||
229 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 240 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
230 | msg->ack = 0; /* not used */ | 241 | msg->ack = 0; /* not used */ |
231 | msg->len = sizeof(*ev); | 242 | msg->len = sizeof(*ev); |
243 | msg->flags = 0; /* not used */ | ||
232 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); | 244 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); |
233 | } | 245 | } |
234 | 246 | ||
@@ -244,6 +256,7 @@ void proc_coredump_connector(struct task_struct *task) | |||
244 | 256 | ||
245 | msg = (struct cn_msg *)buffer; | 257 | msg = (struct cn_msg *)buffer; |
246 | ev = (struct proc_event *)msg->data; | 258 | ev = (struct proc_event *)msg->data; |
259 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | ||
247 | get_seq(&msg->seq, &ev->cpu); | 260 | get_seq(&msg->seq, &ev->cpu); |
248 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 261 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
249 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 262 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -254,6 +267,7 @@ void proc_coredump_connector(struct task_struct *task) | |||
254 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 267 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
255 | msg->ack = 0; /* not used */ | 268 | msg->ack = 0; /* not used */ |
256 | msg->len = sizeof(*ev); | 269 | msg->len = sizeof(*ev); |
270 | msg->flags = 0; /* not used */ | ||
257 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); | 271 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); |
258 | } | 272 | } |
259 | 273 | ||
@@ -269,6 +283,7 @@ void proc_exit_connector(struct task_struct *task) | |||
269 | 283 | ||
270 | msg = (struct cn_msg *)buffer; | 284 | msg = (struct cn_msg *)buffer; |
271 | ev = (struct proc_event *)msg->data; | 285 | ev = (struct proc_event *)msg->data; |
286 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | ||
272 | get_seq(&msg->seq, &ev->cpu); | 287 | get_seq(&msg->seq, &ev->cpu); |
273 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 288 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
274 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 289 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -281,6 +296,7 @@ void proc_exit_connector(struct task_struct *task) | |||
281 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 296 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
282 | msg->ack = 0; /* not used */ | 297 | msg->ack = 0; /* not used */ |
283 | msg->len = sizeof(*ev); | 298 | msg->len = sizeof(*ev); |
299 | msg->flags = 0; /* not used */ | ||
284 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); | 300 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); |
285 | } | 301 | } |
286 | 302 | ||
@@ -304,6 +320,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
304 | 320 | ||
305 | msg = (struct cn_msg *)buffer; | 321 | msg = (struct cn_msg *)buffer; |
306 | ev = (struct proc_event *)msg->data; | 322 | ev = (struct proc_event *)msg->data; |
323 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | ||
307 | msg->seq = rcvd_seq; | 324 | msg->seq = rcvd_seq; |
308 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 325 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
309 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 326 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -313,6 +330,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
313 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 330 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
314 | msg->ack = rcvd_ack + 1; | 331 | msg->ack = rcvd_ack + 1; |
315 | msg->len = sizeof(*ev); | 332 | msg->len = sizeof(*ev); |
333 | msg->flags = 0; /* not used */ | ||
316 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); | 334 | cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); |
317 | } | 335 | } |
318 | 336 | ||
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 6ecfa758942c..a36749f1e44a 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -109,7 +109,7 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask) | |||
109 | 109 | ||
110 | data = nlmsg_data(nlh); | 110 | data = nlmsg_data(nlh); |
111 | 111 | ||
112 | memcpy(data, msg, sizeof(*data) + msg->len); | 112 | memcpy(data, msg, size); |
113 | 113 | ||
114 | NETLINK_CB(skb).dst_group = group; | 114 | NETLINK_CB(skb).dst_group = group; |
115 | 115 | ||
@@ -157,17 +157,18 @@ static int cn_call_callback(struct sk_buff *skb) | |||
157 | static void cn_rx_skb(struct sk_buff *__skb) | 157 | static void cn_rx_skb(struct sk_buff *__skb) |
158 | { | 158 | { |
159 | struct nlmsghdr *nlh; | 159 | struct nlmsghdr *nlh; |
160 | int err; | ||
161 | struct sk_buff *skb; | 160 | struct sk_buff *skb; |
161 | int len, err; | ||
162 | 162 | ||
163 | skb = skb_get(__skb); | 163 | skb = skb_get(__skb); |
164 | 164 | ||
165 | if (skb->len >= NLMSG_HDRLEN) { | 165 | if (skb->len >= NLMSG_HDRLEN) { |
166 | nlh = nlmsg_hdr(skb); | 166 | nlh = nlmsg_hdr(skb); |
167 | len = nlmsg_len(nlh); | ||
167 | 168 | ||
168 | if (nlh->nlmsg_len < sizeof(struct cn_msg) || | 169 | if (len < (int)sizeof(struct cn_msg) || |
169 | skb->len < nlh->nlmsg_len || | 170 | skb->len < nlh->nlmsg_len || |
170 | nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) { | 171 | len > CONNECTOR_MAX_MSG_SIZE) { |
171 | kfree_skb(skb); | 172 | kfree_skb(skb); |
172 | return; | 173 | return; |
173 | } | 174 | } |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index f9cba4123c66..1870c4731a57 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -705,14 +705,14 @@ static size_t can_get_size(const struct net_device *dev) | |||
705 | size_t size; | 705 | size_t size; |
706 | 706 | ||
707 | size = nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ | 707 | size = nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ |
708 | size += sizeof(struct can_ctrlmode); /* IFLA_CAN_CTRLMODE */ | 708 | size += nla_total_size(sizeof(struct can_ctrlmode)); /* IFLA_CAN_CTRLMODE */ |
709 | size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ | 709 | size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ |
710 | size += sizeof(struct can_bittiming); /* IFLA_CAN_BITTIMING */ | 710 | size += nla_total_size(sizeof(struct can_bittiming)); /* IFLA_CAN_BITTIMING */ |
711 | size += sizeof(struct can_clock); /* IFLA_CAN_CLOCK */ | 711 | size += nla_total_size(sizeof(struct can_clock)); /* IFLA_CAN_CLOCK */ |
712 | if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ | 712 | if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ |
713 | size += sizeof(struct can_berr_counter); | 713 | size += nla_total_size(sizeof(struct can_berr_counter)); |
714 | if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ | 714 | if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ |
715 | size += sizeof(struct can_bittiming_const); | 715 | size += nla_total_size(sizeof(struct can_bittiming_const)); |
716 | 716 | ||
717 | return size; | 717 | return size; |
718 | } | 718 | } |
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index 78d6d6b970e1..48f52882a22b 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c | |||
@@ -106,7 +106,6 @@ | |||
106 | #define XGMAC_DMA_HW_FEATURE 0x00000f58 /* Enabled Hardware Features */ | 106 | #define XGMAC_DMA_HW_FEATURE 0x00000f58 /* Enabled Hardware Features */ |
107 | 107 | ||
108 | #define XGMAC_ADDR_AE 0x80000000 | 108 | #define XGMAC_ADDR_AE 0x80000000 |
109 | #define XGMAC_MAX_FILTER_ADDR 31 | ||
110 | 109 | ||
111 | /* PMT Control and Status */ | 110 | /* PMT Control and Status */ |
112 | #define XGMAC_PMT_POINTER_RESET 0x80000000 | 111 | #define XGMAC_PMT_POINTER_RESET 0x80000000 |
@@ -384,6 +383,7 @@ struct xgmac_priv { | |||
384 | struct device *device; | 383 | struct device *device; |
385 | struct napi_struct napi; | 384 | struct napi_struct napi; |
386 | 385 | ||
386 | int max_macs; | ||
387 | struct xgmac_extra_stats xstats; | 387 | struct xgmac_extra_stats xstats; |
388 | 388 | ||
389 | spinlock_t stats_lock; | 389 | spinlock_t stats_lock; |
@@ -1291,14 +1291,12 @@ static void xgmac_set_rx_mode(struct net_device *dev) | |||
1291 | netdev_dbg(priv->dev, "# mcasts %d, # unicast %d\n", | 1291 | netdev_dbg(priv->dev, "# mcasts %d, # unicast %d\n", |
1292 | netdev_mc_count(dev), netdev_uc_count(dev)); | 1292 | netdev_mc_count(dev), netdev_uc_count(dev)); |
1293 | 1293 | ||
1294 | if (dev->flags & IFF_PROMISC) { | 1294 | if (dev->flags & IFF_PROMISC) |
1295 | writel(XGMAC_FRAME_FILTER_PR, ioaddr + XGMAC_FRAME_FILTER); | 1295 | value |= XGMAC_FRAME_FILTER_PR; |
1296 | return; | ||
1297 | } | ||
1298 | 1296 | ||
1299 | memset(hash_filter, 0, sizeof(hash_filter)); | 1297 | memset(hash_filter, 0, sizeof(hash_filter)); |
1300 | 1298 | ||
1301 | if (netdev_uc_count(dev) > XGMAC_MAX_FILTER_ADDR) { | 1299 | if (netdev_uc_count(dev) > priv->max_macs) { |
1302 | use_hash = true; | 1300 | use_hash = true; |
1303 | value |= XGMAC_FRAME_FILTER_HUC | XGMAC_FRAME_FILTER_HPF; | 1301 | value |= XGMAC_FRAME_FILTER_HUC | XGMAC_FRAME_FILTER_HPF; |
1304 | } | 1302 | } |
@@ -1321,7 +1319,7 @@ static void xgmac_set_rx_mode(struct net_device *dev) | |||
1321 | goto out; | 1319 | goto out; |
1322 | } | 1320 | } |
1323 | 1321 | ||
1324 | if ((netdev_mc_count(dev) + reg - 1) > XGMAC_MAX_FILTER_ADDR) { | 1322 | if ((netdev_mc_count(dev) + reg - 1) > priv->max_macs) { |
1325 | use_hash = true; | 1323 | use_hash = true; |
1326 | value |= XGMAC_FRAME_FILTER_HMC | XGMAC_FRAME_FILTER_HPF; | 1324 | value |= XGMAC_FRAME_FILTER_HMC | XGMAC_FRAME_FILTER_HPF; |
1327 | } else { | 1325 | } else { |
@@ -1342,8 +1340,8 @@ static void xgmac_set_rx_mode(struct net_device *dev) | |||
1342 | } | 1340 | } |
1343 | 1341 | ||
1344 | out: | 1342 | out: |
1345 | for (i = reg; i < XGMAC_MAX_FILTER_ADDR; i++) | 1343 | for (i = reg; i <= priv->max_macs; i++) |
1346 | xgmac_set_mac_addr(ioaddr, NULL, reg); | 1344 | xgmac_set_mac_addr(ioaddr, NULL, i); |
1347 | for (i = 0; i < XGMAC_NUM_HASH; i++) | 1345 | for (i = 0; i < XGMAC_NUM_HASH; i++) |
1348 | writel(hash_filter[i], ioaddr + XGMAC_HASH(i)); | 1346 | writel(hash_filter[i], ioaddr + XGMAC_HASH(i)); |
1349 | 1347 | ||
@@ -1761,6 +1759,13 @@ static int xgmac_probe(struct platform_device *pdev) | |||
1761 | uid = readl(priv->base + XGMAC_VERSION); | 1759 | uid = readl(priv->base + XGMAC_VERSION); |
1762 | netdev_info(ndev, "h/w version is 0x%x\n", uid); | 1760 | netdev_info(ndev, "h/w version is 0x%x\n", uid); |
1763 | 1761 | ||
1762 | /* Figure out how many valid mac address filter registers we have */ | ||
1763 | writel(1, priv->base + XGMAC_ADDR_HIGH(31)); | ||
1764 | if (readl(priv->base + XGMAC_ADDR_HIGH(31)) == 1) | ||
1765 | priv->max_macs = 31; | ||
1766 | else | ||
1767 | priv->max_macs = 7; | ||
1768 | |||
1764 | writel(0, priv->base + XGMAC_DMA_INTR_ENA); | 1769 | writel(0, priv->base + XGMAC_DMA_INTR_ENA); |
1765 | ndev->irq = platform_get_irq(pdev, 0); | 1770 | ndev->irq = platform_get_irq(pdev, 0); |
1766 | if (ndev->irq == -ENXIO) { | 1771 | if (ndev->irq == -ENXIO) { |
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index ebdac0273501..0ae3177416c7 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | |||
@@ -2657,6 +2657,8 @@ static int igb_set_eee(struct net_device *netdev, | |||
2657 | (hw->phy.media_type != e1000_media_type_copper)) | 2657 | (hw->phy.media_type != e1000_media_type_copper)) |
2658 | return -EOPNOTSUPP; | 2658 | return -EOPNOTSUPP; |
2659 | 2659 | ||
2660 | memset(&eee_curr, 0, sizeof(struct ethtool_eee)); | ||
2661 | |||
2660 | ret_val = igb_get_eee(netdev, &eee_curr); | 2662 | ret_val = igb_get_eee(netdev, &eee_curr); |
2661 | if (ret_val) | 2663 | if (ret_val) |
2662 | return ret_val; | 2664 | return ret_val; |
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 99f16cbf2fd8..4cfae6c9a63f 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -1131,15 +1131,13 @@ static void mib_counters_update(struct mv643xx_eth_private *mp) | |||
1131 | p->rx_discard += rdlp(mp, RX_DISCARD_FRAME_CNT); | 1131 | p->rx_discard += rdlp(mp, RX_DISCARD_FRAME_CNT); |
1132 | p->rx_overrun += rdlp(mp, RX_OVERRUN_FRAME_CNT); | 1132 | p->rx_overrun += rdlp(mp, RX_OVERRUN_FRAME_CNT); |
1133 | spin_unlock_bh(&mp->mib_counters_lock); | 1133 | spin_unlock_bh(&mp->mib_counters_lock); |
1134 | |||
1135 | mod_timer(&mp->mib_counters_timer, jiffies + 30 * HZ); | ||
1136 | } | 1134 | } |
1137 | 1135 | ||
1138 | static void mib_counters_timer_wrapper(unsigned long _mp) | 1136 | static void mib_counters_timer_wrapper(unsigned long _mp) |
1139 | { | 1137 | { |
1140 | struct mv643xx_eth_private *mp = (void *)_mp; | 1138 | struct mv643xx_eth_private *mp = (void *)_mp; |
1141 | |||
1142 | mib_counters_update(mp); | 1139 | mib_counters_update(mp); |
1140 | mod_timer(&mp->mib_counters_timer, jiffies + 30 * HZ); | ||
1143 | } | 1141 | } |
1144 | 1142 | ||
1145 | 1143 | ||
@@ -2237,6 +2235,7 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
2237 | mp->int_mask |= INT_TX_END_0 << i; | 2235 | mp->int_mask |= INT_TX_END_0 << i; |
2238 | } | 2236 | } |
2239 | 2237 | ||
2238 | add_timer(&mp->mib_counters_timer); | ||
2240 | port_start(mp); | 2239 | port_start(mp); |
2241 | 2240 | ||
2242 | wrlp(mp, INT_MASK_EXT, INT_EXT_LINK_PHY | INT_EXT_TX); | 2241 | wrlp(mp, INT_MASK_EXT, INT_EXT_LINK_PHY | INT_EXT_TX); |
@@ -2534,6 +2533,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev, | |||
2534 | if (!ppdev) | 2533 | if (!ppdev) |
2535 | return -ENOMEM; | 2534 | return -ENOMEM; |
2536 | ppdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | 2535 | ppdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
2536 | ppdev->dev.of_node = pnp; | ||
2537 | 2537 | ||
2538 | ret = platform_device_add_resources(ppdev, &res, 1); | 2538 | ret = platform_device_add_resources(ppdev, &res, 1); |
2539 | if (ret) | 2539 | if (ret) |
@@ -2916,7 +2916,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2916 | mp->mib_counters_timer.data = (unsigned long)mp; | 2916 | mp->mib_counters_timer.data = (unsigned long)mp; |
2917 | mp->mib_counters_timer.function = mib_counters_timer_wrapper; | 2917 | mp->mib_counters_timer.function = mib_counters_timer_wrapper; |
2918 | mp->mib_counters_timer.expires = jiffies + 30 * HZ; | 2918 | mp->mib_counters_timer.expires = jiffies + 30 * HZ; |
2919 | add_timer(&mp->mib_counters_timer); | ||
2920 | 2919 | ||
2921 | spin_lock_init(&mp->mib_counters_lock); | 2920 | spin_lock_init(&mp->mib_counters_lock); |
2922 | 2921 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index dec455c8f627..afe2efa69c86 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
@@ -70,14 +70,15 @@ static int mlx4_alloc_pages(struct mlx4_en_priv *priv, | |||
70 | put_page(page); | 70 | put_page(page); |
71 | return -ENOMEM; | 71 | return -ENOMEM; |
72 | } | 72 | } |
73 | page_alloc->size = PAGE_SIZE << order; | 73 | page_alloc->page_size = PAGE_SIZE << order; |
74 | page_alloc->page = page; | 74 | page_alloc->page = page; |
75 | page_alloc->dma = dma; | 75 | page_alloc->dma = dma; |
76 | page_alloc->offset = frag_info->frag_align; | 76 | page_alloc->page_offset = frag_info->frag_align; |
77 | /* Not doing get_page() for each frag is a big win | 77 | /* Not doing get_page() for each frag is a big win |
78 | * on asymetric workloads. | 78 | * on asymetric workloads. |
79 | */ | 79 | */ |
80 | atomic_set(&page->_count, page_alloc->size / frag_info->frag_stride); | 80 | atomic_set(&page->_count, |
81 | page_alloc->page_size / frag_info->frag_stride); | ||
81 | return 0; | 82 | return 0; |
82 | } | 83 | } |
83 | 84 | ||
@@ -96,16 +97,19 @@ static int mlx4_en_alloc_frags(struct mlx4_en_priv *priv, | |||
96 | for (i = 0; i < priv->num_frags; i++) { | 97 | for (i = 0; i < priv->num_frags; i++) { |
97 | frag_info = &priv->frag_info[i]; | 98 | frag_info = &priv->frag_info[i]; |
98 | page_alloc[i] = ring_alloc[i]; | 99 | page_alloc[i] = ring_alloc[i]; |
99 | page_alloc[i].offset += frag_info->frag_stride; | 100 | page_alloc[i].page_offset += frag_info->frag_stride; |
100 | if (page_alloc[i].offset + frag_info->frag_stride <= ring_alloc[i].size) | 101 | |
102 | if (page_alloc[i].page_offset + frag_info->frag_stride <= | ||
103 | ring_alloc[i].page_size) | ||
101 | continue; | 104 | continue; |
105 | |||
102 | if (mlx4_alloc_pages(priv, &page_alloc[i], frag_info, gfp)) | 106 | if (mlx4_alloc_pages(priv, &page_alloc[i], frag_info, gfp)) |
103 | goto out; | 107 | goto out; |
104 | } | 108 | } |
105 | 109 | ||
106 | for (i = 0; i < priv->num_frags; i++) { | 110 | for (i = 0; i < priv->num_frags; i++) { |
107 | frags[i] = ring_alloc[i]; | 111 | frags[i] = ring_alloc[i]; |
108 | dma = ring_alloc[i].dma + ring_alloc[i].offset; | 112 | dma = ring_alloc[i].dma + ring_alloc[i].page_offset; |
109 | ring_alloc[i] = page_alloc[i]; | 113 | ring_alloc[i] = page_alloc[i]; |
110 | rx_desc->data[i].addr = cpu_to_be64(dma); | 114 | rx_desc->data[i].addr = cpu_to_be64(dma); |
111 | } | 115 | } |
@@ -117,7 +121,7 @@ out: | |||
117 | frag_info = &priv->frag_info[i]; | 121 | frag_info = &priv->frag_info[i]; |
118 | if (page_alloc[i].page != ring_alloc[i].page) { | 122 | if (page_alloc[i].page != ring_alloc[i].page) { |
119 | dma_unmap_page(priv->ddev, page_alloc[i].dma, | 123 | dma_unmap_page(priv->ddev, page_alloc[i].dma, |
120 | page_alloc[i].size, PCI_DMA_FROMDEVICE); | 124 | page_alloc[i].page_size, PCI_DMA_FROMDEVICE); |
121 | page = page_alloc[i].page; | 125 | page = page_alloc[i].page; |
122 | atomic_set(&page->_count, 1); | 126 | atomic_set(&page->_count, 1); |
123 | put_page(page); | 127 | put_page(page); |
@@ -131,10 +135,12 @@ static void mlx4_en_free_frag(struct mlx4_en_priv *priv, | |||
131 | int i) | 135 | int i) |
132 | { | 136 | { |
133 | const struct mlx4_en_frag_info *frag_info = &priv->frag_info[i]; | 137 | const struct mlx4_en_frag_info *frag_info = &priv->frag_info[i]; |
138 | u32 next_frag_end = frags[i].page_offset + 2 * frag_info->frag_stride; | ||
139 | |||
134 | 140 | ||
135 | if (frags[i].offset + frag_info->frag_stride > frags[i].size) | 141 | if (next_frag_end > frags[i].page_size) |
136 | dma_unmap_page(priv->ddev, frags[i].dma, frags[i].size, | 142 | dma_unmap_page(priv->ddev, frags[i].dma, frags[i].page_size, |
137 | PCI_DMA_FROMDEVICE); | 143 | PCI_DMA_FROMDEVICE); |
138 | 144 | ||
139 | if (frags[i].page) | 145 | if (frags[i].page) |
140 | put_page(frags[i].page); | 146 | put_page(frags[i].page); |
@@ -161,7 +167,7 @@ out: | |||
161 | 167 | ||
162 | page_alloc = &ring->page_alloc[i]; | 168 | page_alloc = &ring->page_alloc[i]; |
163 | dma_unmap_page(priv->ddev, page_alloc->dma, | 169 | dma_unmap_page(priv->ddev, page_alloc->dma, |
164 | page_alloc->size, PCI_DMA_FROMDEVICE); | 170 | page_alloc->page_size, PCI_DMA_FROMDEVICE); |
165 | page = page_alloc->page; | 171 | page = page_alloc->page; |
166 | atomic_set(&page->_count, 1); | 172 | atomic_set(&page->_count, 1); |
167 | put_page(page); | 173 | put_page(page); |
@@ -184,10 +190,11 @@ static void mlx4_en_destroy_allocator(struct mlx4_en_priv *priv, | |||
184 | i, page_count(page_alloc->page)); | 190 | i, page_count(page_alloc->page)); |
185 | 191 | ||
186 | dma_unmap_page(priv->ddev, page_alloc->dma, | 192 | dma_unmap_page(priv->ddev, page_alloc->dma, |
187 | page_alloc->size, PCI_DMA_FROMDEVICE); | 193 | page_alloc->page_size, PCI_DMA_FROMDEVICE); |
188 | while (page_alloc->offset + frag_info->frag_stride < page_alloc->size) { | 194 | while (page_alloc->page_offset + frag_info->frag_stride < |
195 | page_alloc->page_size) { | ||
189 | put_page(page_alloc->page); | 196 | put_page(page_alloc->page); |
190 | page_alloc->offset += frag_info->frag_stride; | 197 | page_alloc->page_offset += frag_info->frag_stride; |
191 | } | 198 | } |
192 | page_alloc->page = NULL; | 199 | page_alloc->page = NULL; |
193 | } | 200 | } |
@@ -478,7 +485,7 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv, | |||
478 | /* Save page reference in skb */ | 485 | /* Save page reference in skb */ |
479 | __skb_frag_set_page(&skb_frags_rx[nr], frags[nr].page); | 486 | __skb_frag_set_page(&skb_frags_rx[nr], frags[nr].page); |
480 | skb_frag_size_set(&skb_frags_rx[nr], frag_info->frag_size); | 487 | skb_frag_size_set(&skb_frags_rx[nr], frag_info->frag_size); |
481 | skb_frags_rx[nr].page_offset = frags[nr].offset; | 488 | skb_frags_rx[nr].page_offset = frags[nr].page_offset; |
482 | skb->truesize += frag_info->frag_stride; | 489 | skb->truesize += frag_info->frag_stride; |
483 | frags[nr].page = NULL; | 490 | frags[nr].page = NULL; |
484 | } | 491 | } |
@@ -517,7 +524,7 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv, | |||
517 | 524 | ||
518 | /* Get pointer to first fragment so we could copy the headers into the | 525 | /* Get pointer to first fragment so we could copy the headers into the |
519 | * (linear part of the) skb */ | 526 | * (linear part of the) skb */ |
520 | va = page_address(frags[0].page) + frags[0].offset; | 527 | va = page_address(frags[0].page) + frags[0].page_offset; |
521 | 528 | ||
522 | if (length <= SMALL_PACKET_SIZE) { | 529 | if (length <= SMALL_PACKET_SIZE) { |
523 | /* We are copying all relevant data to the skb - temporarily | 530 | /* We are copying all relevant data to the skb - temporarily |
@@ -645,7 +652,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud | |||
645 | dma_sync_single_for_cpu(priv->ddev, dma, sizeof(*ethh), | 652 | dma_sync_single_for_cpu(priv->ddev, dma, sizeof(*ethh), |
646 | DMA_FROM_DEVICE); | 653 | DMA_FROM_DEVICE); |
647 | ethh = (struct ethhdr *)(page_address(frags[0].page) + | 654 | ethh = (struct ethhdr *)(page_address(frags[0].page) + |
648 | frags[0].offset); | 655 | frags[0].page_offset); |
649 | 656 | ||
650 | if (is_multicast_ether_addr(ethh->h_dest)) { | 657 | if (is_multicast_ether_addr(ethh->h_dest)) { |
651 | struct mlx4_mac_entry *entry; | 658 | struct mlx4_mac_entry *entry; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 5e0aa569306a..bf06e3610d27 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -237,8 +237,8 @@ struct mlx4_en_tx_desc { | |||
237 | struct mlx4_en_rx_alloc { | 237 | struct mlx4_en_rx_alloc { |
238 | struct page *page; | 238 | struct page *page; |
239 | dma_addr_t dma; | 239 | dma_addr_t dma; |
240 | u32 offset; | 240 | u32 page_offset; |
241 | u32 size; | 241 | u32 page_size; |
242 | }; | 242 | }; |
243 | 243 | ||
244 | struct mlx4_en_tx_ring { | 244 | struct mlx4_en_tx_ring { |
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index bd1a2d2bc2ae..ea54d95e5b9f 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c | |||
@@ -448,7 +448,8 @@ static int moxart_mac_probe(struct platform_device *pdev) | |||
448 | irq = irq_of_parse_and_map(node, 0); | 448 | irq = irq_of_parse_and_map(node, 0); |
449 | if (irq <= 0) { | 449 | if (irq <= 0) { |
450 | netdev_err(ndev, "irq_of_parse_and_map failed\n"); | 450 | netdev_err(ndev, "irq_of_parse_and_map failed\n"); |
451 | return -EINVAL; | 451 | ret = -EINVAL; |
452 | goto irq_map_fail; | ||
452 | } | 453 | } |
453 | 454 | ||
454 | priv = netdev_priv(ndev); | 455 | priv = netdev_priv(ndev); |
@@ -472,24 +473,32 @@ static int moxart_mac_probe(struct platform_device *pdev) | |||
472 | priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * | 473 | priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * |
473 | TX_DESC_NUM, &priv->tx_base, | 474 | TX_DESC_NUM, &priv->tx_base, |
474 | GFP_DMA | GFP_KERNEL); | 475 | GFP_DMA | GFP_KERNEL); |
475 | if (priv->tx_desc_base == NULL) | 476 | if (priv->tx_desc_base == NULL) { |
477 | ret = -ENOMEM; | ||
476 | goto init_fail; | 478 | goto init_fail; |
479 | } | ||
477 | 480 | ||
478 | priv->rx_desc_base = dma_alloc_coherent(NULL, RX_REG_DESC_SIZE * | 481 | priv->rx_desc_base = dma_alloc_coherent(NULL, RX_REG_DESC_SIZE * |
479 | RX_DESC_NUM, &priv->rx_base, | 482 | RX_DESC_NUM, &priv->rx_base, |
480 | GFP_DMA | GFP_KERNEL); | 483 | GFP_DMA | GFP_KERNEL); |
481 | if (priv->rx_desc_base == NULL) | 484 | if (priv->rx_desc_base == NULL) { |
485 | ret = -ENOMEM; | ||
482 | goto init_fail; | 486 | goto init_fail; |
487 | } | ||
483 | 488 | ||
484 | priv->tx_buf_base = kmalloc(priv->tx_buf_size * TX_DESC_NUM, | 489 | priv->tx_buf_base = kmalloc(priv->tx_buf_size * TX_DESC_NUM, |
485 | GFP_ATOMIC); | 490 | GFP_ATOMIC); |
486 | if (!priv->tx_buf_base) | 491 | if (!priv->tx_buf_base) { |
492 | ret = -ENOMEM; | ||
487 | goto init_fail; | 493 | goto init_fail; |
494 | } | ||
488 | 495 | ||
489 | priv->rx_buf_base = kmalloc(priv->rx_buf_size * RX_DESC_NUM, | 496 | priv->rx_buf_base = kmalloc(priv->rx_buf_size * RX_DESC_NUM, |
490 | GFP_ATOMIC); | 497 | GFP_ATOMIC); |
491 | if (!priv->rx_buf_base) | 498 | if (!priv->rx_buf_base) { |
499 | ret = -ENOMEM; | ||
492 | goto init_fail; | 500 | goto init_fail; |
501 | } | ||
493 | 502 | ||
494 | platform_set_drvdata(pdev, ndev); | 503 | platform_set_drvdata(pdev, ndev); |
495 | 504 | ||
@@ -522,7 +531,8 @@ static int moxart_mac_probe(struct platform_device *pdev) | |||
522 | init_fail: | 531 | init_fail: |
523 | netdev_err(ndev, "init failed\n"); | 532 | netdev_err(ndev, "init failed\n"); |
524 | moxart_mac_free_memory(ndev); | 533 | moxart_mac_free_memory(ndev); |
525 | 534 | irq_map_fail: | |
535 | free_netdev(ndev); | ||
526 | return ret; | 536 | return ret; |
527 | } | 537 | } |
528 | 538 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 21d00a0449a1..f07f2b0fefa0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -2257,7 +2257,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2257 | 2257 | ||
2258 | err = qlcnic_alloc_adapter_resources(adapter); | 2258 | err = qlcnic_alloc_adapter_resources(adapter); |
2259 | if (err) | 2259 | if (err) |
2260 | goto err_out_free_netdev; | 2260 | goto err_out_free_wq; |
2261 | 2261 | ||
2262 | adapter->dev_rst_time = jiffies; | 2262 | adapter->dev_rst_time = jiffies; |
2263 | adapter->ahw->revision_id = pdev->revision; | 2263 | adapter->ahw->revision_id = pdev->revision; |
@@ -2396,6 +2396,9 @@ err_out_disable_msi: | |||
2396 | err_out_free_hw: | 2396 | err_out_free_hw: |
2397 | qlcnic_free_adapter_resources(adapter); | 2397 | qlcnic_free_adapter_resources(adapter); |
2398 | 2398 | ||
2399 | err_out_free_wq: | ||
2400 | destroy_workqueue(adapter->qlcnic_wq); | ||
2401 | |||
2399 | err_out_free_netdev: | 2402 | err_out_free_netdev: |
2400 | free_netdev(netdev); | 2403 | free_netdev(netdev); |
2401 | 2404 | ||
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index c8df52bac162..ee8df999494c 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -620,12 +620,16 @@ static struct sh_eth_cpu_data sh7734_data = { | |||
620 | .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | | 620 | .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | |
621 | EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE | | 621 | EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE | |
622 | EESR_TDE | EESR_ECI, | 622 | EESR_TDE | EESR_ECI, |
623 | .fdr_value = 0x0000070f, | ||
624 | .rmcr_value = 0x00000001, | ||
623 | 625 | ||
624 | .apr = 1, | 626 | .apr = 1, |
625 | .mpr = 1, | 627 | .mpr = 1, |
626 | .tpauser = 1, | 628 | .tpauser = 1, |
627 | .bculr = 1, | 629 | .bculr = 1, |
628 | .hw_swap = 1, | 630 | .hw_swap = 1, |
631 | .rpadir = 1, | ||
632 | .rpadir_value = 2 << 16, | ||
629 | .no_trimd = 1, | 633 | .no_trimd = 1, |
630 | .no_ade = 1, | 634 | .no_ade = 1, |
631 | .tsu = 1, | 635 | .tsu = 1, |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 844ee7539d33..676c3c057bfb 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
@@ -754,6 +754,18 @@ static const struct efx_hw_stat_desc efx_ef10_stat_desc[EF10_STAT_COUNT] = { | |||
754 | EF10_DMA_STAT(rx_align_error, RX_ALIGN_ERROR_PKTS), | 754 | EF10_DMA_STAT(rx_align_error, RX_ALIGN_ERROR_PKTS), |
755 | EF10_DMA_STAT(rx_length_error, RX_LENGTH_ERROR_PKTS), | 755 | EF10_DMA_STAT(rx_length_error, RX_LENGTH_ERROR_PKTS), |
756 | EF10_DMA_STAT(rx_nodesc_drops, RX_NODESC_DROPS), | 756 | EF10_DMA_STAT(rx_nodesc_drops, RX_NODESC_DROPS), |
757 | EF10_DMA_STAT(rx_pm_trunc_bb_overflow, PM_TRUNC_BB_OVERFLOW), | ||
758 | EF10_DMA_STAT(rx_pm_discard_bb_overflow, PM_DISCARD_BB_OVERFLOW), | ||
759 | EF10_DMA_STAT(rx_pm_trunc_vfifo_full, PM_TRUNC_VFIFO_FULL), | ||
760 | EF10_DMA_STAT(rx_pm_discard_vfifo_full, PM_DISCARD_VFIFO_FULL), | ||
761 | EF10_DMA_STAT(rx_pm_trunc_qbb, PM_TRUNC_QBB), | ||
762 | EF10_DMA_STAT(rx_pm_discard_qbb, PM_DISCARD_QBB), | ||
763 | EF10_DMA_STAT(rx_pm_discard_mapping, PM_DISCARD_MAPPING), | ||
764 | EF10_DMA_STAT(rx_dp_q_disabled_packets, RXDP_Q_DISABLED_PKTS), | ||
765 | EF10_DMA_STAT(rx_dp_di_dropped_packets, RXDP_DI_DROPPED_PKTS), | ||
766 | EF10_DMA_STAT(rx_dp_streaming_packets, RXDP_STREAMING_PKTS), | ||
767 | EF10_DMA_STAT(rx_dp_emerg_fetch, RXDP_EMERGENCY_FETCH_CONDITIONS), | ||
768 | EF10_DMA_STAT(rx_dp_emerg_wait, RXDP_EMERGENCY_WAIT_CONDITIONS), | ||
757 | }; | 769 | }; |
758 | 770 | ||
759 | #define HUNT_COMMON_STAT_MASK ((1ULL << EF10_STAT_tx_bytes) | \ | 771 | #define HUNT_COMMON_STAT_MASK ((1ULL << EF10_STAT_tx_bytes) | \ |
@@ -808,44 +820,72 @@ static const struct efx_hw_stat_desc efx_ef10_stat_desc[EF10_STAT_COUNT] = { | |||
808 | #define HUNT_40G_EXTRA_STAT_MASK ((1ULL << EF10_STAT_rx_align_error) | \ | 820 | #define HUNT_40G_EXTRA_STAT_MASK ((1ULL << EF10_STAT_rx_align_error) | \ |
809 | (1ULL << EF10_STAT_rx_length_error)) | 821 | (1ULL << EF10_STAT_rx_length_error)) |
810 | 822 | ||
811 | #if BITS_PER_LONG == 64 | 823 | /* These statistics are only provided if the firmware supports the |
812 | #define STAT_MASK_BITMAP(bits) (bits) | 824 | * capability PM_AND_RXDP_COUNTERS. |
813 | #else | 825 | */ |
814 | #define STAT_MASK_BITMAP(bits) (bits) & 0xffffffff, (bits) >> 32 | 826 | #define HUNT_PM_AND_RXDP_STAT_MASK ( \ |
815 | #endif | 827 | (1ULL << EF10_STAT_rx_pm_trunc_bb_overflow) | \ |
816 | 828 | (1ULL << EF10_STAT_rx_pm_discard_bb_overflow) | \ | |
817 | static const unsigned long *efx_ef10_stat_mask(struct efx_nic *efx) | 829 | (1ULL << EF10_STAT_rx_pm_trunc_vfifo_full) | \ |
818 | { | 830 | (1ULL << EF10_STAT_rx_pm_discard_vfifo_full) | \ |
819 | static const unsigned long hunt_40g_stat_mask[] = { | 831 | (1ULL << EF10_STAT_rx_pm_trunc_qbb) | \ |
820 | STAT_MASK_BITMAP(HUNT_COMMON_STAT_MASK | | 832 | (1ULL << EF10_STAT_rx_pm_discard_qbb) | \ |
821 | HUNT_40G_EXTRA_STAT_MASK) | 833 | (1ULL << EF10_STAT_rx_pm_discard_mapping) | \ |
822 | }; | 834 | (1ULL << EF10_STAT_rx_dp_q_disabled_packets) | \ |
823 | static const unsigned long hunt_10g_only_stat_mask[] = { | 835 | (1ULL << EF10_STAT_rx_dp_di_dropped_packets) | \ |
824 | STAT_MASK_BITMAP(HUNT_COMMON_STAT_MASK | | 836 | (1ULL << EF10_STAT_rx_dp_streaming_packets) | \ |
825 | HUNT_10G_ONLY_STAT_MASK) | 837 | (1ULL << EF10_STAT_rx_dp_emerg_fetch) | \ |
826 | }; | 838 | (1ULL << EF10_STAT_rx_dp_emerg_wait)) |
839 | |||
840 | static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx) | ||
841 | { | ||
842 | u64 raw_mask = HUNT_COMMON_STAT_MASK; | ||
827 | u32 port_caps = efx_mcdi_phy_get_caps(efx); | 843 | u32 port_caps = efx_mcdi_phy_get_caps(efx); |
844 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | ||
828 | 845 | ||
829 | if (port_caps & (1 << MC_CMD_PHY_CAP_40000FDX_LBN)) | 846 | if (port_caps & (1 << MC_CMD_PHY_CAP_40000FDX_LBN)) |
830 | return hunt_40g_stat_mask; | 847 | raw_mask |= HUNT_40G_EXTRA_STAT_MASK; |
831 | else | 848 | else |
832 | return hunt_10g_only_stat_mask; | 849 | raw_mask |= HUNT_10G_ONLY_STAT_MASK; |
850 | |||
851 | if (nic_data->datapath_caps & | ||
852 | (1 << MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_LBN)) | ||
853 | raw_mask |= HUNT_PM_AND_RXDP_STAT_MASK; | ||
854 | |||
855 | return raw_mask; | ||
856 | } | ||
857 | |||
858 | static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) | ||
859 | { | ||
860 | u64 raw_mask = efx_ef10_raw_stat_mask(efx); | ||
861 | |||
862 | #if BITS_PER_LONG == 64 | ||
863 | mask[0] = raw_mask; | ||
864 | #else | ||
865 | mask[0] = raw_mask & 0xffffffff; | ||
866 | mask[1] = raw_mask >> 32; | ||
867 | #endif | ||
833 | } | 868 | } |
834 | 869 | ||
835 | static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names) | 870 | static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names) |
836 | { | 871 | { |
872 | DECLARE_BITMAP(mask, EF10_STAT_COUNT); | ||
873 | |||
874 | efx_ef10_get_stat_mask(efx, mask); | ||
837 | return efx_nic_describe_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, | 875 | return efx_nic_describe_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, |
838 | efx_ef10_stat_mask(efx), names); | 876 | mask, names); |
839 | } | 877 | } |
840 | 878 | ||
841 | static int efx_ef10_try_update_nic_stats(struct efx_nic *efx) | 879 | static int efx_ef10_try_update_nic_stats(struct efx_nic *efx) |
842 | { | 880 | { |
843 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | 881 | struct efx_ef10_nic_data *nic_data = efx->nic_data; |
844 | const unsigned long *stats_mask = efx_ef10_stat_mask(efx); | 882 | DECLARE_BITMAP(mask, EF10_STAT_COUNT); |
845 | __le64 generation_start, generation_end; | 883 | __le64 generation_start, generation_end; |
846 | u64 *stats = nic_data->stats; | 884 | u64 *stats = nic_data->stats; |
847 | __le64 *dma_stats; | 885 | __le64 *dma_stats; |
848 | 886 | ||
887 | efx_ef10_get_stat_mask(efx, mask); | ||
888 | |||
849 | dma_stats = efx->stats_buffer.addr; | 889 | dma_stats = efx->stats_buffer.addr; |
850 | nic_data = efx->nic_data; | 890 | nic_data = efx->nic_data; |
851 | 891 | ||
@@ -853,8 +893,9 @@ static int efx_ef10_try_update_nic_stats(struct efx_nic *efx) | |||
853 | if (generation_end == EFX_MC_STATS_GENERATION_INVALID) | 893 | if (generation_end == EFX_MC_STATS_GENERATION_INVALID) |
854 | return 0; | 894 | return 0; |
855 | rmb(); | 895 | rmb(); |
856 | efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, stats_mask, | 896 | efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, mask, |
857 | stats, efx->stats_buffer.addr, false); | 897 | stats, efx->stats_buffer.addr, false); |
898 | rmb(); | ||
858 | generation_start = dma_stats[MC_CMD_MAC_GENERATION_START]; | 899 | generation_start = dma_stats[MC_CMD_MAC_GENERATION_START]; |
859 | if (generation_end != generation_start) | 900 | if (generation_end != generation_start) |
860 | return -EAGAIN; | 901 | return -EAGAIN; |
@@ -873,12 +914,14 @@ static int efx_ef10_try_update_nic_stats(struct efx_nic *efx) | |||
873 | static size_t efx_ef10_update_stats(struct efx_nic *efx, u64 *full_stats, | 914 | static size_t efx_ef10_update_stats(struct efx_nic *efx, u64 *full_stats, |
874 | struct rtnl_link_stats64 *core_stats) | 915 | struct rtnl_link_stats64 *core_stats) |
875 | { | 916 | { |
876 | const unsigned long *mask = efx_ef10_stat_mask(efx); | 917 | DECLARE_BITMAP(mask, EF10_STAT_COUNT); |
877 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | 918 | struct efx_ef10_nic_data *nic_data = efx->nic_data; |
878 | u64 *stats = nic_data->stats; | 919 | u64 *stats = nic_data->stats; |
879 | size_t stats_count = 0, index; | 920 | size_t stats_count = 0, index; |
880 | int retry; | 921 | int retry; |
881 | 922 | ||
923 | efx_ef10_get_stat_mask(efx, mask); | ||
924 | |||
882 | /* If we're unlucky enough to read statistics during the DMA, wait | 925 | /* If we're unlucky enough to read statistics during the DMA, wait |
883 | * up to 10ms for it to finish (typically takes <500us) | 926 | * up to 10ms for it to finish (typically takes <500us) |
884 | */ | 927 | */ |
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index c082562dbf4e..366c8e3e3784 100644 --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c | |||
@@ -963,7 +963,7 @@ static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, | |||
963 | bool *was_attached) | 963 | bool *was_attached) |
964 | { | 964 | { |
965 | MCDI_DECLARE_BUF(inbuf, MC_CMD_DRV_ATTACH_IN_LEN); | 965 | MCDI_DECLARE_BUF(inbuf, MC_CMD_DRV_ATTACH_IN_LEN); |
966 | MCDI_DECLARE_BUF(outbuf, MC_CMD_DRV_ATTACH_OUT_LEN); | 966 | MCDI_DECLARE_BUF(outbuf, MC_CMD_DRV_ATTACH_EXT_OUT_LEN); |
967 | size_t outlen; | 967 | size_t outlen; |
968 | int rc; | 968 | int rc; |
969 | 969 | ||
@@ -981,6 +981,22 @@ static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, | |||
981 | goto fail; | 981 | goto fail; |
982 | } | 982 | } |
983 | 983 | ||
984 | /* We currently assume we have control of the external link | ||
985 | * and are completely trusted by firmware. Abort probing | ||
986 | * if that's not true for this function. | ||
987 | */ | ||
988 | if (driver_operating && | ||
989 | outlen >= MC_CMD_DRV_ATTACH_EXT_OUT_LEN && | ||
990 | (MCDI_DWORD(outbuf, DRV_ATTACH_EXT_OUT_FUNC_FLAGS) & | ||
991 | (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL | | ||
992 | 1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_TRUSTED)) != | ||
993 | (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_LINKCTRL | | ||
994 | 1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_TRUSTED)) { | ||
995 | netif_err(efx, probe, efx->net_dev, | ||
996 | "This driver version only supports one function per port\n"); | ||
997 | return -ENODEV; | ||
998 | } | ||
999 | |||
984 | if (was_attached != NULL) | 1000 | if (was_attached != NULL) |
985 | *was_attached = MCDI_DWORD(outbuf, DRV_ATTACH_OUT_OLD_STATE); | 1001 | *was_attached = MCDI_DWORD(outbuf, DRV_ATTACH_OUT_OLD_STATE); |
986 | return 0; | 1002 | return 0; |
diff --git a/drivers/net/ethernet/sfc/mcdi_pcol.h b/drivers/net/ethernet/sfc/mcdi_pcol.h index b5cf62492f8e..e0a63ddb7a6c 100644 --- a/drivers/net/ethernet/sfc/mcdi_pcol.h +++ b/drivers/net/ethernet/sfc/mcdi_pcol.h | |||
@@ -2574,8 +2574,58 @@ | |||
2574 | #define MC_CMD_MAC_RX_LANES01_DISP_ERR 0x39 /* enum */ | 2574 | #define MC_CMD_MAC_RX_LANES01_DISP_ERR 0x39 /* enum */ |
2575 | #define MC_CMD_MAC_RX_LANES23_DISP_ERR 0x3a /* enum */ | 2575 | #define MC_CMD_MAC_RX_LANES23_DISP_ERR 0x3a /* enum */ |
2576 | #define MC_CMD_MAC_RX_MATCH_FAULT 0x3b /* enum */ | 2576 | #define MC_CMD_MAC_RX_MATCH_FAULT 0x3b /* enum */ |
2577 | #define MC_CMD_GMAC_DMABUF_START 0x40 /* enum */ | 2577 | /* enum: PM trunc_bb_overflow counter. Valid for EF10 with PM_AND_RXDP_COUNTERS |
2578 | #define MC_CMD_GMAC_DMABUF_END 0x5f /* enum */ | 2578 | * capability only. |
2579 | */ | ||
2580 | #define MC_CMD_MAC_PM_TRUNC_BB_OVERFLOW 0x3c | ||
2581 | /* enum: PM discard_bb_overflow counter. Valid for EF10 with | ||
2582 | * PM_AND_RXDP_COUNTERS capability only. | ||
2583 | */ | ||
2584 | #define MC_CMD_MAC_PM_DISCARD_BB_OVERFLOW 0x3d | ||
2585 | /* enum: PM trunc_vfifo_full counter. Valid for EF10 with PM_AND_RXDP_COUNTERS | ||
2586 | * capability only. | ||
2587 | */ | ||
2588 | #define MC_CMD_MAC_PM_TRUNC_VFIFO_FULL 0x3e | ||
2589 | /* enum: PM discard_vfifo_full counter. Valid for EF10 with | ||
2590 | * PM_AND_RXDP_COUNTERS capability only. | ||
2591 | */ | ||
2592 | #define MC_CMD_MAC_PM_DISCARD_VFIFO_FULL 0x3f | ||
2593 | /* enum: PM trunc_qbb counter. Valid for EF10 with PM_AND_RXDP_COUNTERS | ||
2594 | * capability only. | ||
2595 | */ | ||
2596 | #define MC_CMD_MAC_PM_TRUNC_QBB 0x40 | ||
2597 | /* enum: PM discard_qbb counter. Valid for EF10 with PM_AND_RXDP_COUNTERS | ||
2598 | * capability only. | ||
2599 | */ | ||
2600 | #define MC_CMD_MAC_PM_DISCARD_QBB 0x41 | ||
2601 | /* enum: PM discard_mapping counter. Valid for EF10 with PM_AND_RXDP_COUNTERS | ||
2602 | * capability only. | ||
2603 | */ | ||
2604 | #define MC_CMD_MAC_PM_DISCARD_MAPPING 0x42 | ||
2605 | /* enum: RXDP counter: Number of packets dropped due to the queue being | ||
2606 | * disabled. Valid for EF10 with PM_AND_RXDP_COUNTERS capability only. | ||
2607 | */ | ||
2608 | #define MC_CMD_MAC_RXDP_Q_DISABLED_PKTS 0x43 | ||
2609 | /* enum: RXDP counter: Number of packets dropped by the DICPU. Valid for EF10 | ||
2610 | * with PM_AND_RXDP_COUNTERS capability only. | ||
2611 | */ | ||
2612 | #define MC_CMD_MAC_RXDP_DI_DROPPED_PKTS 0x45 | ||
2613 | /* enum: RXDP counter: Number of non-host packets. Valid for EF10 with | ||
2614 | * PM_AND_RXDP_COUNTERS capability only. | ||
2615 | */ | ||
2616 | #define MC_CMD_MAC_RXDP_STREAMING_PKTS 0x46 | ||
2617 | /* enum: RXDP counter: Number of times an emergency descriptor fetch was | ||
2618 | * performed. Valid for EF10 with PM_AND_RXDP_COUNTERS capability only. | ||
2619 | */ | ||
2620 | #define MC_CMD_MAC_RXDP_EMERGENCY_FETCH_CONDITIONS 0x47 | ||
2621 | /* enum: RXDP counter: Number of times the DPCPU waited for an existing | ||
2622 | * descriptor fetch. Valid for EF10 with PM_AND_RXDP_COUNTERS capability only. | ||
2623 | */ | ||
2624 | #define MC_CMD_MAC_RXDP_EMERGENCY_WAIT_CONDITIONS 0x48 | ||
2625 | /* enum: Start of GMAC stats buffer space, for Siena only. */ | ||
2626 | #define MC_CMD_GMAC_DMABUF_START 0x40 | ||
2627 | /* enum: End of GMAC stats buffer space, for Siena only. */ | ||
2628 | #define MC_CMD_GMAC_DMABUF_END 0x5f | ||
2579 | #define MC_CMD_MAC_GENERATION_END 0x60 /* enum */ | 2629 | #define MC_CMD_MAC_GENERATION_END 0x60 /* enum */ |
2580 | #define MC_CMD_MAC_NSTATS 0x61 /* enum */ | 2630 | #define MC_CMD_MAC_NSTATS 0x61 /* enum */ |
2581 | 2631 | ||
@@ -5065,6 +5115,8 @@ | |||
5065 | #define MC_CMD_GET_CAPABILITIES_OUT_RX_BATCHING_WIDTH 1 | 5115 | #define MC_CMD_GET_CAPABILITIES_OUT_RX_BATCHING_WIDTH 1 |
5066 | #define MC_CMD_GET_CAPABILITIES_OUT_MCAST_FILTER_CHAINING_LBN 26 | 5116 | #define MC_CMD_GET_CAPABILITIES_OUT_MCAST_FILTER_CHAINING_LBN 26 |
5067 | #define MC_CMD_GET_CAPABILITIES_OUT_MCAST_FILTER_CHAINING_WIDTH 1 | 5117 | #define MC_CMD_GET_CAPABILITIES_OUT_MCAST_FILTER_CHAINING_WIDTH 1 |
5118 | #define MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_LBN 27 | ||
5119 | #define MC_CMD_GET_CAPABILITIES_OUT_PM_AND_RXDP_COUNTERS_WIDTH 1 | ||
5068 | /* RxDPCPU firmware id. */ | 5120 | /* RxDPCPU firmware id. */ |
5069 | #define MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_OFST 4 | 5121 | #define MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_OFST 4 |
5070 | #define MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_LEN 2 | 5122 | #define MC_CMD_GET_CAPABILITIES_OUT_RX_DPCPU_FW_ID_LEN 2 |
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c index c75009b8c0d9..9c90bf56090f 100644 --- a/drivers/net/ethernet/sfc/nic.c +++ b/drivers/net/ethernet/sfc/nic.c | |||
@@ -480,8 +480,7 @@ size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count, | |||
480 | * @count: Length of the @desc array | 480 | * @count: Length of the @desc array |
481 | * @mask: Bitmask of which elements of @desc are enabled | 481 | * @mask: Bitmask of which elements of @desc are enabled |
482 | * @stats: Buffer to update with the converted statistics. The length | 482 | * @stats: Buffer to update with the converted statistics. The length |
483 | * of this array must be at least the number of set bits in the | 483 | * of this array must be at least @count. |
484 | * first @count bits of @mask. | ||
485 | * @dma_buf: DMA buffer containing hardware statistics | 484 | * @dma_buf: DMA buffer containing hardware statistics |
486 | * @accumulate: If set, the converted values will be added rather than | 485 | * @accumulate: If set, the converted values will be added rather than |
487 | * directly stored to the corresponding elements of @stats | 486 | * directly stored to the corresponding elements of @stats |
@@ -514,11 +513,9 @@ void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count, | |||
514 | } | 513 | } |
515 | 514 | ||
516 | if (accumulate) | 515 | if (accumulate) |
517 | *stats += val; | 516 | stats[index] += val; |
518 | else | 517 | else |
519 | *stats = val; | 518 | stats[index] = val; |
520 | } | 519 | } |
521 | |||
522 | ++stats; | ||
523 | } | 520 | } |
524 | } | 521 | } |
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index 08883c8edf0e..11b6112d9249 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
@@ -402,6 +402,18 @@ enum { | |||
402 | EF10_STAT_rx_align_error, | 402 | EF10_STAT_rx_align_error, |
403 | EF10_STAT_rx_length_error, | 403 | EF10_STAT_rx_length_error, |
404 | EF10_STAT_rx_nodesc_drops, | 404 | EF10_STAT_rx_nodesc_drops, |
405 | EF10_STAT_rx_pm_trunc_bb_overflow, | ||
406 | EF10_STAT_rx_pm_discard_bb_overflow, | ||
407 | EF10_STAT_rx_pm_trunc_vfifo_full, | ||
408 | EF10_STAT_rx_pm_discard_vfifo_full, | ||
409 | EF10_STAT_rx_pm_trunc_qbb, | ||
410 | EF10_STAT_rx_pm_discard_qbb, | ||
411 | EF10_STAT_rx_pm_discard_mapping, | ||
412 | EF10_STAT_rx_dp_q_disabled_packets, | ||
413 | EF10_STAT_rx_dp_di_dropped_packets, | ||
414 | EF10_STAT_rx_dp_streaming_packets, | ||
415 | EF10_STAT_rx_dp_emerg_fetch, | ||
416 | EF10_STAT_rx_dp_emerg_wait, | ||
405 | EF10_STAT_COUNT | 417 | EF10_STAT_COUNT |
406 | }; | 418 | }; |
407 | 419 | ||
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 7290f11a937d..1fd8125e58a8 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1766,8 +1766,8 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1766 | } | 1766 | } |
1767 | data->mac_control = prop; | 1767 | data->mac_control = prop; |
1768 | 1768 | ||
1769 | if (!of_property_read_u32(node, "dual_emac", &prop)) | 1769 | if (of_property_read_bool(node, "dual_emac")) |
1770 | data->dual_emac = prop; | 1770 | data->dual_emac = 1; |
1771 | 1771 | ||
1772 | /* | 1772 | /* |
1773 | * Populate all the child nodes here... | 1773 | * Populate all the child nodes here... |
@@ -1777,7 +1777,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1777 | if (ret) | 1777 | if (ret) |
1778 | pr_warn("Doesn't have any child node\n"); | 1778 | pr_warn("Doesn't have any child node\n"); |
1779 | 1779 | ||
1780 | for_each_node_by_name(slave_node, "slave") { | 1780 | for_each_child_of_node(node, slave_node) { |
1781 | struct cpsw_slave_data *slave_data = data->slave_data + i; | 1781 | struct cpsw_slave_data *slave_data = data->slave_data + i; |
1782 | const void *mac_addr = NULL; | 1782 | const void *mac_addr = NULL; |
1783 | u32 phyid; | 1783 | u32 phyid; |
@@ -1786,6 +1786,10 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1786 | struct device_node *mdio_node; | 1786 | struct device_node *mdio_node; |
1787 | struct platform_device *mdio; | 1787 | struct platform_device *mdio; |
1788 | 1788 | ||
1789 | /* This is no slave child node, continue */ | ||
1790 | if (strcmp(slave_node->name, "slave")) | ||
1791 | continue; | ||
1792 | |||
1789 | parp = of_get_property(slave_node, "phy_id", &lenp); | 1793 | parp = of_get_property(slave_node, "phy_id", &lenp); |
1790 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { | 1794 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { |
1791 | pr_err("Missing slave[%d] phy_id property\n", i); | 1795 | pr_err("Missing slave[%d] phy_id property\n", i); |
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c index 42e6deee6db5..0632d34905c7 100644 --- a/drivers/net/ieee802154/mrf24j40.c +++ b/drivers/net/ieee802154/mrf24j40.c | |||
@@ -82,7 +82,6 @@ struct mrf24j40 { | |||
82 | 82 | ||
83 | struct mutex buffer_mutex; /* only used to protect buf */ | 83 | struct mutex buffer_mutex; /* only used to protect buf */ |
84 | struct completion tx_complete; | 84 | struct completion tx_complete; |
85 | struct work_struct irqwork; | ||
86 | u8 *buf; /* 3 bytes. Used for SPI single-register transfers. */ | 85 | u8 *buf; /* 3 bytes. Used for SPI single-register transfers. */ |
87 | }; | 86 | }; |
88 | 87 | ||
@@ -344,6 +343,8 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb) | |||
344 | if (ret) | 343 | if (ret) |
345 | goto err; | 344 | goto err; |
346 | 345 | ||
346 | INIT_COMPLETION(devrec->tx_complete); | ||
347 | |||
347 | /* Set TXNTRIG bit of TXNCON to send packet */ | 348 | /* Set TXNTRIG bit of TXNCON to send packet */ |
348 | ret = read_short_reg(devrec, REG_TXNCON, &val); | 349 | ret = read_short_reg(devrec, REG_TXNCON, &val); |
349 | if (ret) | 350 | if (ret) |
@@ -354,8 +355,6 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb) | |||
354 | val |= 0x4; | 355 | val |= 0x4; |
355 | write_short_reg(devrec, REG_TXNCON, val); | 356 | write_short_reg(devrec, REG_TXNCON, val); |
356 | 357 | ||
357 | INIT_COMPLETION(devrec->tx_complete); | ||
358 | |||
359 | /* Wait for the device to send the TX complete interrupt. */ | 358 | /* Wait for the device to send the TX complete interrupt. */ |
360 | ret = wait_for_completion_interruptible_timeout( | 359 | ret = wait_for_completion_interruptible_timeout( |
361 | &devrec->tx_complete, | 360 | &devrec->tx_complete, |
@@ -590,17 +589,6 @@ static struct ieee802154_ops mrf24j40_ops = { | |||
590 | static irqreturn_t mrf24j40_isr(int irq, void *data) | 589 | static irqreturn_t mrf24j40_isr(int irq, void *data) |
591 | { | 590 | { |
592 | struct mrf24j40 *devrec = data; | 591 | struct mrf24j40 *devrec = data; |
593 | |||
594 | disable_irq_nosync(irq); | ||
595 | |||
596 | schedule_work(&devrec->irqwork); | ||
597 | |||
598 | return IRQ_HANDLED; | ||
599 | } | ||
600 | |||
601 | static void mrf24j40_isrwork(struct work_struct *work) | ||
602 | { | ||
603 | struct mrf24j40 *devrec = container_of(work, struct mrf24j40, irqwork); | ||
604 | u8 intstat; | 592 | u8 intstat; |
605 | int ret; | 593 | int ret; |
606 | 594 | ||
@@ -618,7 +606,7 @@ static void mrf24j40_isrwork(struct work_struct *work) | |||
618 | mrf24j40_handle_rx(devrec); | 606 | mrf24j40_handle_rx(devrec); |
619 | 607 | ||
620 | out: | 608 | out: |
621 | enable_irq(devrec->spi->irq); | 609 | return IRQ_HANDLED; |
622 | } | 610 | } |
623 | 611 | ||
624 | static int mrf24j40_probe(struct spi_device *spi) | 612 | static int mrf24j40_probe(struct spi_device *spi) |
@@ -642,7 +630,6 @@ static int mrf24j40_probe(struct spi_device *spi) | |||
642 | 630 | ||
643 | mutex_init(&devrec->buffer_mutex); | 631 | mutex_init(&devrec->buffer_mutex); |
644 | init_completion(&devrec->tx_complete); | 632 | init_completion(&devrec->tx_complete); |
645 | INIT_WORK(&devrec->irqwork, mrf24j40_isrwork); | ||
646 | devrec->spi = spi; | 633 | devrec->spi = spi; |
647 | spi_set_drvdata(spi, devrec); | 634 | spi_set_drvdata(spi, devrec); |
648 | 635 | ||
@@ -688,11 +675,12 @@ static int mrf24j40_probe(struct spi_device *spi) | |||
688 | val &= ~0x3; /* Clear RX mode (normal) */ | 675 | val &= ~0x3; /* Clear RX mode (normal) */ |
689 | write_short_reg(devrec, REG_RXMCR, val); | 676 | write_short_reg(devrec, REG_RXMCR, val); |
690 | 677 | ||
691 | ret = request_irq(spi->irq, | 678 | ret = request_threaded_irq(spi->irq, |
692 | mrf24j40_isr, | 679 | NULL, |
693 | IRQF_TRIGGER_FALLING, | 680 | mrf24j40_isr, |
694 | dev_name(&spi->dev), | 681 | IRQF_TRIGGER_LOW|IRQF_ONESHOT, |
695 | devrec); | 682 | dev_name(&spi->dev), |
683 | devrec); | ||
696 | 684 | ||
697 | if (ret) { | 685 | if (ret) { |
698 | dev_err(printdev(devrec), "Unable to get IRQ"); | 686 | dev_err(printdev(devrec), "Unable to get IRQ"); |
@@ -721,7 +709,6 @@ static int mrf24j40_remove(struct spi_device *spi) | |||
721 | dev_dbg(printdev(devrec), "remove\n"); | 709 | dev_dbg(printdev(devrec), "remove\n"); |
722 | 710 | ||
723 | free_irq(spi->irq, devrec); | 711 | free_irq(spi->irq, devrec); |
724 | flush_work(&devrec->irqwork); /* TODO: Is this the right call? */ | ||
725 | ieee802154_unregister_device(devrec->dev); | 712 | ieee802154_unregister_device(devrec->dev); |
726 | ieee802154_free_device(devrec->dev); | 713 | ieee802154_free_device(devrec->dev); |
727 | /* TODO: Will ieee802154_free_device() wait until ->xmit() is | 714 | /* TODO: Will ieee802154_free_device() wait until ->xmit() is |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 807815fc9968..7cb105c103fe 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1293,7 +1293,8 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, | |||
1293 | if (unlikely(!noblock)) | 1293 | if (unlikely(!noblock)) |
1294 | add_wait_queue(&tfile->wq.wait, &wait); | 1294 | add_wait_queue(&tfile->wq.wait, &wait); |
1295 | while (len) { | 1295 | while (len) { |
1296 | current->state = TASK_INTERRUPTIBLE; | 1296 | if (unlikely(!noblock)) |
1297 | current->state = TASK_INTERRUPTIBLE; | ||
1297 | 1298 | ||
1298 | /* Read frames from the queue */ | 1299 | /* Read frames from the queue */ |
1299 | if (!(skb = skb_dequeue(&tfile->socket.sk->sk_receive_queue))) { | 1300 | if (!(skb = skb_dequeue(&tfile->socket.sk->sk_receive_queue))) { |
@@ -1320,9 +1321,10 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, | |||
1320 | break; | 1321 | break; |
1321 | } | 1322 | } |
1322 | 1323 | ||
1323 | current->state = TASK_RUNNING; | 1324 | if (unlikely(!noblock)) { |
1324 | if (unlikely(!noblock)) | 1325 | current->state = TASK_RUNNING; |
1325 | remove_wait_queue(&tfile->wq.wait, &wait); | 1326 | remove_wait_queue(&tfile->wq.wait, &wait); |
1327 | } | ||
1326 | 1328 | ||
1327 | return ret; | 1329 | return ret; |
1328 | } | 1330 | } |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 13f5434e7f6c..1ce8af276878 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1969,15 +1969,18 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, | |||
1969 | static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, | 1969 | static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, |
1970 | struct ath_atx_tid *tid, struct sk_buff *skb) | 1970 | struct ath_atx_tid *tid, struct sk_buff *skb) |
1971 | { | 1971 | { |
1972 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
1972 | struct ath_frame_info *fi = get_frame_info(skb); | 1973 | struct ath_frame_info *fi = get_frame_info(skb); |
1973 | struct list_head bf_head; | 1974 | struct list_head bf_head; |
1974 | struct ath_buf *bf; | 1975 | struct ath_buf *bf = fi->bf; |
1975 | |||
1976 | bf = fi->bf; | ||
1977 | 1976 | ||
1978 | INIT_LIST_HEAD(&bf_head); | 1977 | INIT_LIST_HEAD(&bf_head); |
1979 | list_add_tail(&bf->list, &bf_head); | 1978 | list_add_tail(&bf->list, &bf_head); |
1980 | bf->bf_state.bf_type = 0; | 1979 | bf->bf_state.bf_type = 0; |
1980 | if (tid && (tx_info->flags & IEEE80211_TX_CTL_AMPDU)) { | ||
1981 | bf->bf_state.bf_type = BUF_AMPDU; | ||
1982 | ath_tx_addto_baw(sc, tid, bf); | ||
1983 | } | ||
1981 | 1984 | ||
1982 | bf->bf_next = NULL; | 1985 | bf->bf_next = NULL; |
1983 | bf->bf_lastbf = bf; | 1986 | bf->bf_lastbf = bf; |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index fd778337deee..c2b91f566e05 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -358,10 +358,12 @@ process_start: | |||
358 | } | 358 | } |
359 | } while (true); | 359 | } while (true); |
360 | 360 | ||
361 | if ((adapter->int_status) || IS_CARD_RX_RCVD(adapter)) | 361 | spin_lock_irqsave(&adapter->main_proc_lock, flags); |
362 | if ((adapter->int_status) || IS_CARD_RX_RCVD(adapter)) { | ||
363 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); | ||
362 | goto process_start; | 364 | goto process_start; |
365 | } | ||
363 | 366 | ||
364 | spin_lock_irqsave(&adapter->main_proc_lock, flags); | ||
365 | adapter->mwifiex_processing = false; | 367 | adapter->mwifiex_processing = false; |
366 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); | 368 | spin_unlock_irqrestore(&adapter->main_proc_lock, flags); |
367 | 369 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 76d95deb274b..dc49e525ae5e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -105,13 +105,11 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops) | |||
105 | goto exit_release_regions; | 105 | goto exit_release_regions; |
106 | } | 106 | } |
107 | 107 | ||
108 | pci_enable_msi(pci_dev); | ||
109 | |||
110 | hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw); | 108 | hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw); |
111 | if (!hw) { | 109 | if (!hw) { |
112 | rt2x00_probe_err("Failed to allocate hardware\n"); | 110 | rt2x00_probe_err("Failed to allocate hardware\n"); |
113 | retval = -ENOMEM; | 111 | retval = -ENOMEM; |
114 | goto exit_disable_msi; | 112 | goto exit_release_regions; |
115 | } | 113 | } |
116 | 114 | ||
117 | pci_set_drvdata(pci_dev, hw); | 115 | pci_set_drvdata(pci_dev, hw); |
@@ -152,9 +150,6 @@ exit_free_reg: | |||
152 | exit_free_device: | 150 | exit_free_device: |
153 | ieee80211_free_hw(hw); | 151 | ieee80211_free_hw(hw); |
154 | 152 | ||
155 | exit_disable_msi: | ||
156 | pci_disable_msi(pci_dev); | ||
157 | |||
158 | exit_release_regions: | 153 | exit_release_regions: |
159 | pci_release_regions(pci_dev); | 154 | pci_release_regions(pci_dev); |
160 | 155 | ||
@@ -179,8 +174,6 @@ void rt2x00pci_remove(struct pci_dev *pci_dev) | |||
179 | rt2x00pci_free_reg(rt2x00dev); | 174 | rt2x00pci_free_reg(rt2x00dev); |
180 | ieee80211_free_hw(hw); | 175 | ieee80211_free_hw(hw); |
181 | 176 | ||
182 | pci_disable_msi(pci_dev); | ||
183 | |||
184 | /* | 177 | /* |
185 | * Free the PCI device data. | 178 | * Free the PCI device data. |
186 | */ | 179 | */ |
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index b45bce20ad76..1b08d8798372 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -39,11 +39,15 @@ static int connect_rings(struct backend_info *); | |||
39 | static void connect(struct backend_info *); | 39 | static void connect(struct backend_info *); |
40 | static void backend_create_xenvif(struct backend_info *be); | 40 | static void backend_create_xenvif(struct backend_info *be); |
41 | static void unregister_hotplug_status_watch(struct backend_info *be); | 41 | static void unregister_hotplug_status_watch(struct backend_info *be); |
42 | static void set_backend_state(struct backend_info *be, | ||
43 | enum xenbus_state state); | ||
42 | 44 | ||
43 | static int netback_remove(struct xenbus_device *dev) | 45 | static int netback_remove(struct xenbus_device *dev) |
44 | { | 46 | { |
45 | struct backend_info *be = dev_get_drvdata(&dev->dev); | 47 | struct backend_info *be = dev_get_drvdata(&dev->dev); |
46 | 48 | ||
49 | set_backend_state(be, XenbusStateClosed); | ||
50 | |||
47 | unregister_hotplug_status_watch(be); | 51 | unregister_hotplug_status_watch(be); |
48 | if (be->vif) { | 52 | if (be->vif) { |
49 | kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); | 53 | kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); |
diff --git a/include/linux/filter.h b/include/linux/filter.h index a6ac84871d6d..ff4e40cd45b1 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/atomic.h> | 7 | #include <linux/atomic.h> |
8 | #include <linux/compat.h> | 8 | #include <linux/compat.h> |
9 | #include <linux/workqueue.h> | ||
9 | #include <uapi/linux/filter.h> | 10 | #include <uapi/linux/filter.h> |
10 | 11 | ||
11 | #ifdef CONFIG_COMPAT | 12 | #ifdef CONFIG_COMPAT |
@@ -25,15 +26,19 @@ struct sk_filter | |||
25 | { | 26 | { |
26 | atomic_t refcnt; | 27 | atomic_t refcnt; |
27 | unsigned int len; /* Number of filter blocks */ | 28 | unsigned int len; /* Number of filter blocks */ |
29 | struct rcu_head rcu; | ||
28 | unsigned int (*bpf_func)(const struct sk_buff *skb, | 30 | unsigned int (*bpf_func)(const struct sk_buff *skb, |
29 | const struct sock_filter *filter); | 31 | const struct sock_filter *filter); |
30 | struct rcu_head rcu; | 32 | union { |
31 | struct sock_filter insns[0]; | 33 | struct sock_filter insns[0]; |
34 | struct work_struct work; | ||
35 | }; | ||
32 | }; | 36 | }; |
33 | 37 | ||
34 | static inline unsigned int sk_filter_len(const struct sk_filter *fp) | 38 | static inline unsigned int sk_filter_size(unsigned int proglen) |
35 | { | 39 | { |
36 | return fp->len * sizeof(struct sock_filter) + sizeof(*fp); | 40 | return max(sizeof(struct sk_filter), |
41 | offsetof(struct sk_filter, insns[proglen])); | ||
37 | } | 42 | } |
38 | 43 | ||
39 | extern int sk_filter(struct sock *sk, struct sk_buff *skb); | 44 | extern int sk_filter(struct sock *sk, struct sk_buff *skb); |
@@ -67,11 +72,13 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, | |||
67 | } | 72 | } |
68 | #define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) | 73 | #define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) |
69 | #else | 74 | #else |
75 | #include <linux/slab.h> | ||
70 | static inline void bpf_jit_compile(struct sk_filter *fp) | 76 | static inline void bpf_jit_compile(struct sk_filter *fp) |
71 | { | 77 | { |
72 | } | 78 | } |
73 | static inline void bpf_jit_free(struct sk_filter *fp) | 79 | static inline void bpf_jit_free(struct sk_filter *fp) |
74 | { | 80 | { |
81 | kfree(fp); | ||
75 | } | 82 | } |
76 | #define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns) | 83 | #define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns) |
77 | #endif | 84 | #endif |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 6d77e0f3cc10..2e53b44454ad 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -2273,11 +2273,11 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) | |||
2273 | } | 2273 | } |
2274 | 2274 | ||
2275 | #ifdef CONFIG_XPS | 2275 | #ifdef CONFIG_XPS |
2276 | int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, | 2276 | int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, |
2277 | u16 index); | 2277 | u16 index); |
2278 | #else | 2278 | #else |
2279 | static inline int netif_set_xps_queue(struct net_device *dev, | 2279 | static inline int netif_set_xps_queue(struct net_device *dev, |
2280 | struct cpumask *mask, | 2280 | const struct cpumask *mask, |
2281 | u16 index) | 2281 | u16 index) |
2282 | { | 2282 | { |
2283 | return 0; | 2283 | return 0; |
diff --git a/include/net/sock.h b/include/net/sock.h index 79532540201b..7cf8d2331afb 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1612,16 +1612,14 @@ static inline void sk_filter_release(struct sk_filter *fp) | |||
1612 | 1612 | ||
1613 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) | 1613 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) |
1614 | { | 1614 | { |
1615 | unsigned int size = sk_filter_len(fp); | 1615 | atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc); |
1616 | |||
1617 | atomic_sub(size, &sk->sk_omem_alloc); | ||
1618 | sk_filter_release(fp); | 1616 | sk_filter_release(fp); |
1619 | } | 1617 | } |
1620 | 1618 | ||
1621 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) | 1619 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) |
1622 | { | 1620 | { |
1623 | atomic_inc(&fp->refcnt); | 1621 | atomic_inc(&fp->refcnt); |
1624 | atomic_add(sk_filter_len(fp), &sk->sk_omem_alloc); | 1622 | atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc); |
1625 | } | 1623 | } |
1626 | 1624 | ||
1627 | /* | 1625 | /* |
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild index 0623ec4e728f..56f121605c99 100644 --- a/include/uapi/linux/tc_act/Kbuild +++ b/include/uapi/linux/tc_act/Kbuild | |||
@@ -1,5 +1,6 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | header-y += tc_csum.h | 2 | header-y += tc_csum.h |
3 | header-y += tc_defact.h | ||
3 | header-y += tc_gact.h | 4 | header-y += tc_gact.h |
4 | header-y += tc_ipt.h | 5 | header-y += tc_ipt.h |
5 | header-y += tc_mirred.h | 6 | header-y += tc_mirred.h |
diff --git a/include/linux/tc_act/tc_defact.h b/include/uapi/linux/tc_act/tc_defact.h index 6f65d07c7ce2..17dddb40f740 100644 --- a/include/linux/tc_act/tc_defact.h +++ b/include/uapi/linux/tc_act/tc_defact.h | |||
@@ -6,7 +6,7 @@ | |||
6 | struct tc_defact { | 6 | struct tc_defact { |
7 | tc_gen; | 7 | tc_gen; |
8 | }; | 8 | }; |
9 | 9 | ||
10 | enum { | 10 | enum { |
11 | TCA_DEF_UNSPEC, | 11 | TCA_DEF_UNSPEC, |
12 | TCA_DEF_TM, | 12 | TCA_DEF_TM, |
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c index 309129732285..c7e634af8516 100644 --- a/net/8021q/vlan_netlink.c +++ b/net/8021q/vlan_netlink.c | |||
@@ -171,7 +171,7 @@ static size_t vlan_get_size(const struct net_device *dev) | |||
171 | 171 | ||
172 | return nla_total_size(2) + /* IFLA_VLAN_PROTOCOL */ | 172 | return nla_total_size(2) + /* IFLA_VLAN_PROTOCOL */ |
173 | nla_total_size(2) + /* IFLA_VLAN_ID */ | 173 | nla_total_size(2) + /* IFLA_VLAN_ID */ |
174 | sizeof(struct ifla_vlan_flags) + /* IFLA_VLAN_FLAGS */ | 174 | nla_total_size(sizeof(struct ifla_vlan_flags)) + /* IFLA_VLAN_FLAGS */ |
175 | vlan_qos_map_size(vlan->nr_ingress_mappings) + | 175 | vlan_qos_map_size(vlan->nr_ingress_mappings) + |
176 | vlan_qos_map_size(vlan->nr_egress_mappings); | 176 | vlan_qos_map_size(vlan->nr_egress_mappings); |
177 | } | 177 | } |
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index c72d1bcdcf49..1356af660b5b 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
@@ -65,6 +65,7 @@ static int __init batadv_init(void) | |||
65 | batadv_recv_handler_init(); | 65 | batadv_recv_handler_init(); |
66 | 66 | ||
67 | batadv_iv_init(); | 67 | batadv_iv_init(); |
68 | batadv_nc_init(); | ||
68 | 69 | ||
69 | batadv_event_workqueue = create_singlethread_workqueue("bat_events"); | 70 | batadv_event_workqueue = create_singlethread_workqueue("bat_events"); |
70 | 71 | ||
@@ -142,7 +143,7 @@ int batadv_mesh_init(struct net_device *soft_iface) | |||
142 | if (ret < 0) | 143 | if (ret < 0) |
143 | goto err; | 144 | goto err; |
144 | 145 | ||
145 | ret = batadv_nc_init(bat_priv); | 146 | ret = batadv_nc_mesh_init(bat_priv); |
146 | if (ret < 0) | 147 | if (ret < 0) |
147 | goto err; | 148 | goto err; |
148 | 149 | ||
@@ -167,7 +168,7 @@ void batadv_mesh_free(struct net_device *soft_iface) | |||
167 | batadv_vis_quit(bat_priv); | 168 | batadv_vis_quit(bat_priv); |
168 | 169 | ||
169 | batadv_gw_node_purge(bat_priv); | 170 | batadv_gw_node_purge(bat_priv); |
170 | batadv_nc_free(bat_priv); | 171 | batadv_nc_mesh_free(bat_priv); |
171 | batadv_dat_free(bat_priv); | 172 | batadv_dat_free(bat_priv); |
172 | batadv_bla_free(bat_priv); | 173 | batadv_bla_free(bat_priv); |
173 | 174 | ||
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index a487d46e0aec..4ecc0b6bf8ab 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c | |||
@@ -35,6 +35,20 @@ static int batadv_nc_recv_coded_packet(struct sk_buff *skb, | |||
35 | struct batadv_hard_iface *recv_if); | 35 | struct batadv_hard_iface *recv_if); |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * batadv_nc_init - one-time initialization for network coding | ||
39 | */ | ||
40 | int __init batadv_nc_init(void) | ||
41 | { | ||
42 | int ret; | ||
43 | |||
44 | /* Register our packet type */ | ||
45 | ret = batadv_recv_handler_register(BATADV_CODED, | ||
46 | batadv_nc_recv_coded_packet); | ||
47 | |||
48 | return ret; | ||
49 | } | ||
50 | |||
51 | /** | ||
38 | * batadv_nc_start_timer - initialise the nc periodic worker | 52 | * batadv_nc_start_timer - initialise the nc periodic worker |
39 | * @bat_priv: the bat priv with all the soft interface information | 53 | * @bat_priv: the bat priv with all the soft interface information |
40 | */ | 54 | */ |
@@ -45,10 +59,10 @@ static void batadv_nc_start_timer(struct batadv_priv *bat_priv) | |||
45 | } | 59 | } |
46 | 60 | ||
47 | /** | 61 | /** |
48 | * batadv_nc_init - initialise coding hash table and start house keeping | 62 | * batadv_nc_mesh_init - initialise coding hash table and start house keeping |
49 | * @bat_priv: the bat priv with all the soft interface information | 63 | * @bat_priv: the bat priv with all the soft interface information |
50 | */ | 64 | */ |
51 | int batadv_nc_init(struct batadv_priv *bat_priv) | 65 | int batadv_nc_mesh_init(struct batadv_priv *bat_priv) |
52 | { | 66 | { |
53 | bat_priv->nc.timestamp_fwd_flush = jiffies; | 67 | bat_priv->nc.timestamp_fwd_flush = jiffies; |
54 | bat_priv->nc.timestamp_sniffed_purge = jiffies; | 68 | bat_priv->nc.timestamp_sniffed_purge = jiffies; |
@@ -70,11 +84,6 @@ int batadv_nc_init(struct batadv_priv *bat_priv) | |||
70 | batadv_hash_set_lock_class(bat_priv->nc.coding_hash, | 84 | batadv_hash_set_lock_class(bat_priv->nc.coding_hash, |
71 | &batadv_nc_decoding_hash_lock_class_key); | 85 | &batadv_nc_decoding_hash_lock_class_key); |
72 | 86 | ||
73 | /* Register our packet type */ | ||
74 | if (batadv_recv_handler_register(BATADV_CODED, | ||
75 | batadv_nc_recv_coded_packet) < 0) | ||
76 | goto err; | ||
77 | |||
78 | INIT_DELAYED_WORK(&bat_priv->nc.work, batadv_nc_worker); | 87 | INIT_DELAYED_WORK(&bat_priv->nc.work, batadv_nc_worker); |
79 | batadv_nc_start_timer(bat_priv); | 88 | batadv_nc_start_timer(bat_priv); |
80 | 89 | ||
@@ -1721,12 +1730,11 @@ free_nc_packet: | |||
1721 | } | 1730 | } |
1722 | 1731 | ||
1723 | /** | 1732 | /** |
1724 | * batadv_nc_free - clean up network coding memory | 1733 | * batadv_nc_mesh_free - clean up network coding memory |
1725 | * @bat_priv: the bat priv with all the soft interface information | 1734 | * @bat_priv: the bat priv with all the soft interface information |
1726 | */ | 1735 | */ |
1727 | void batadv_nc_free(struct batadv_priv *bat_priv) | 1736 | void batadv_nc_mesh_free(struct batadv_priv *bat_priv) |
1728 | { | 1737 | { |
1729 | batadv_recv_handler_unregister(BATADV_CODED); | ||
1730 | cancel_delayed_work_sync(&bat_priv->nc.work); | 1738 | cancel_delayed_work_sync(&bat_priv->nc.work); |
1731 | 1739 | ||
1732 | batadv_nc_purge_paths(bat_priv, bat_priv->nc.coding_hash, NULL); | 1740 | batadv_nc_purge_paths(bat_priv, bat_priv->nc.coding_hash, NULL); |
diff --git a/net/batman-adv/network-coding.h b/net/batman-adv/network-coding.h index 85a4ec81ad50..ddfa618e80bf 100644 --- a/net/batman-adv/network-coding.h +++ b/net/batman-adv/network-coding.h | |||
@@ -22,8 +22,9 @@ | |||
22 | 22 | ||
23 | #ifdef CONFIG_BATMAN_ADV_NC | 23 | #ifdef CONFIG_BATMAN_ADV_NC |
24 | 24 | ||
25 | int batadv_nc_init(struct batadv_priv *bat_priv); | 25 | int batadv_nc_init(void); |
26 | void batadv_nc_free(struct batadv_priv *bat_priv); | 26 | int batadv_nc_mesh_init(struct batadv_priv *bat_priv); |
27 | void batadv_nc_mesh_free(struct batadv_priv *bat_priv); | ||
27 | void batadv_nc_update_nc_node(struct batadv_priv *bat_priv, | 28 | void batadv_nc_update_nc_node(struct batadv_priv *bat_priv, |
28 | struct batadv_orig_node *orig_node, | 29 | struct batadv_orig_node *orig_node, |
29 | struct batadv_orig_node *orig_neigh_node, | 30 | struct batadv_orig_node *orig_neigh_node, |
@@ -46,12 +47,17 @@ int batadv_nc_init_debugfs(struct batadv_priv *bat_priv); | |||
46 | 47 | ||
47 | #else /* ifdef CONFIG_BATMAN_ADV_NC */ | 48 | #else /* ifdef CONFIG_BATMAN_ADV_NC */ |
48 | 49 | ||
49 | static inline int batadv_nc_init(struct batadv_priv *bat_priv) | 50 | static inline int batadv_nc_init(void) |
50 | { | 51 | { |
51 | return 0; | 52 | return 0; |
52 | } | 53 | } |
53 | 54 | ||
54 | static inline void batadv_nc_free(struct batadv_priv *bat_priv) | 55 | static inline int batadv_nc_mesh_init(struct batadv_priv *bat_priv) |
56 | { | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static inline void batadv_nc_mesh_free(struct batadv_priv *bat_priv) | ||
55 | { | 61 | { |
56 | return; | 62 | return; |
57 | } | 63 | } |
diff --git a/net/compat.c b/net/compat.c index f0a1ba6c8086..89032580bd1d 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -71,6 +71,8 @@ int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg) | |||
71 | __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || | 71 | __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || |
72 | __get_user(kmsg->msg_flags, &umsg->msg_flags)) | 72 | __get_user(kmsg->msg_flags, &umsg->msg_flags)) |
73 | return -EFAULT; | 73 | return -EFAULT; |
74 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) | ||
75 | return -EINVAL; | ||
74 | kmsg->msg_name = compat_ptr(tmp1); | 76 | kmsg->msg_name = compat_ptr(tmp1); |
75 | kmsg->msg_iov = compat_ptr(tmp2); | 77 | kmsg->msg_iov = compat_ptr(tmp2); |
76 | kmsg->msg_control = compat_ptr(tmp3); | 78 | kmsg->msg_control = compat_ptr(tmp3); |
diff --git a/net/core/dev.c b/net/core/dev.c index fa0b2b06c1a6..1b6eadf69289 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1916,7 +1916,8 @@ static struct xps_map *expand_xps_map(struct xps_map *map, | |||
1916 | return new_map; | 1916 | return new_map; |
1917 | } | 1917 | } |
1918 | 1918 | ||
1919 | int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, u16 index) | 1919 | int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, |
1920 | u16 index) | ||
1920 | { | 1921 | { |
1921 | struct xps_dev_maps *dev_maps, *new_dev_maps = NULL; | 1922 | struct xps_dev_maps *dev_maps, *new_dev_maps = NULL; |
1922 | struct xps_map *map, *new_map; | 1923 | struct xps_map *map, *new_map; |
diff --git a/net/core/filter.c b/net/core/filter.c index 6438f29ff266..01b780856db2 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -644,7 +644,6 @@ void sk_filter_release_rcu(struct rcu_head *rcu) | |||
644 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); | 644 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); |
645 | 645 | ||
646 | bpf_jit_free(fp); | 646 | bpf_jit_free(fp); |
647 | kfree(fp); | ||
648 | } | 647 | } |
649 | EXPORT_SYMBOL(sk_filter_release_rcu); | 648 | EXPORT_SYMBOL(sk_filter_release_rcu); |
650 | 649 | ||
@@ -683,7 +682,7 @@ int sk_unattached_filter_create(struct sk_filter **pfp, | |||
683 | if (fprog->filter == NULL) | 682 | if (fprog->filter == NULL) |
684 | return -EINVAL; | 683 | return -EINVAL; |
685 | 684 | ||
686 | fp = kmalloc(fsize + sizeof(*fp), GFP_KERNEL); | 685 | fp = kmalloc(sk_filter_size(fprog->len), GFP_KERNEL); |
687 | if (!fp) | 686 | if (!fp) |
688 | return -ENOMEM; | 687 | return -ENOMEM; |
689 | memcpy(fp->insns, fprog->filter, fsize); | 688 | memcpy(fp->insns, fprog->filter, fsize); |
@@ -723,6 +722,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) | |||
723 | { | 722 | { |
724 | struct sk_filter *fp, *old_fp; | 723 | struct sk_filter *fp, *old_fp; |
725 | unsigned int fsize = sizeof(struct sock_filter) * fprog->len; | 724 | unsigned int fsize = sizeof(struct sock_filter) * fprog->len; |
725 | unsigned int sk_fsize = sk_filter_size(fprog->len); | ||
726 | int err; | 726 | int err; |
727 | 727 | ||
728 | if (sock_flag(sk, SOCK_FILTER_LOCKED)) | 728 | if (sock_flag(sk, SOCK_FILTER_LOCKED)) |
@@ -732,11 +732,11 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) | |||
732 | if (fprog->filter == NULL) | 732 | if (fprog->filter == NULL) |
733 | return -EINVAL; | 733 | return -EINVAL; |
734 | 734 | ||
735 | fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL); | 735 | fp = sock_kmalloc(sk, sk_fsize, GFP_KERNEL); |
736 | if (!fp) | 736 | if (!fp) |
737 | return -ENOMEM; | 737 | return -ENOMEM; |
738 | if (copy_from_user(fp->insns, fprog->filter, fsize)) { | 738 | if (copy_from_user(fp->insns, fprog->filter, fsize)) { |
739 | sock_kfree_s(sk, fp, fsize+sizeof(*fp)); | 739 | sock_kfree_s(sk, fp, sk_fsize); |
740 | return -EFAULT; | 740 | return -EFAULT; |
741 | } | 741 | } |
742 | 742 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index 2bd9b3faa0d0..fd6afa267475 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -2331,6 +2331,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
2331 | #endif | 2331 | #endif |
2332 | 2332 | ||
2333 | sk->sk_max_pacing_rate = ~0U; | 2333 | sk->sk_max_pacing_rate = ~0U; |
2334 | sk->sk_pacing_rate = ~0U; | ||
2334 | /* | 2335 | /* |
2335 | * Before updating sk_refcnt, we must commit prior changes to memory | 2336 | * Before updating sk_refcnt, we must commit prior changes to memory |
2336 | * (Documentation/RCU/rculist_nulls.txt for details) | 2337 | * (Documentation/RCU/rculist_nulls.txt for details) |
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index c85e71e0c7ff..ff41b4d60d30 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c | |||
@@ -1372,6 +1372,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev, | |||
1372 | real_dev = dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK])); | 1372 | real_dev = dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK])); |
1373 | if (!real_dev) | 1373 | if (!real_dev) |
1374 | return -ENODEV; | 1374 | return -ENODEV; |
1375 | if (real_dev->type != ARPHRD_IEEE802154) | ||
1376 | return -EINVAL; | ||
1375 | 1377 | ||
1376 | lowpan_dev_info(dev)->real_dev = real_dev; | 1378 | lowpan_dev_info(dev)->real_dev = real_dev; |
1377 | lowpan_dev_info(dev)->fragment_tag = 0; | 1379 | lowpan_dev_info(dev)->fragment_tag = 0; |
@@ -1386,6 +1388,9 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev, | |||
1386 | 1388 | ||
1387 | entry->ldev = dev; | 1389 | entry->ldev = dev; |
1388 | 1390 | ||
1391 | /* Set the lowpan harware address to the wpan hardware address. */ | ||
1392 | memcpy(dev->dev_addr, real_dev->dev_addr, IEEE802154_ADDR_LEN); | ||
1393 | |||
1389 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); | 1394 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); |
1390 | INIT_LIST_HEAD(&entry->list); | 1395 | INIT_LIST_HEAD(&entry->list); |
1391 | list_add_tail(&entry->list, &lowpan_devices); | 1396 | list_add_tail(&entry->list, &lowpan_devices); |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 2779037bd113..ae199596b9b0 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -287,7 +287,7 @@ begintw: | |||
287 | if (unlikely(!INET_TW_MATCH(sk, net, acookie, | 287 | if (unlikely(!INET_TW_MATCH(sk, net, acookie, |
288 | saddr, daddr, ports, | 288 | saddr, daddr, ports, |
289 | dif))) { | 289 | dif))) { |
290 | sock_put(sk); | 290 | inet_twsk_put(inet_twsk(sk)); |
291 | goto begintw; | 291 | goto begintw; |
292 | } | 292 | } |
293 | goto out; | 293 | goto out; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 727f4365bcdf..6011615e810d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2072,7 +2072,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4) | |||
2072 | RT_SCOPE_LINK); | 2072 | RT_SCOPE_LINK); |
2073 | goto make_route; | 2073 | goto make_route; |
2074 | } | 2074 | } |
2075 | if (fl4->saddr) { | 2075 | if (!fl4->saddr) { |
2076 | if (ipv4_is_multicast(fl4->daddr)) | 2076 | if (ipv4_is_multicast(fl4->daddr)) |
2077 | fl4->saddr = inet_select_addr(dev_out, 0, | 2077 | fl4->saddr = inet_select_addr(dev_out, 0, |
2078 | fl4->flowi4_scope); | 2078 | fl4->flowi4_scope); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index fa6cf1f91ff8..47b8ab7dce9c 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1326,7 +1326,10 @@ static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *skb, | |||
1326 | tp->lost_cnt_hint -= tcp_skb_pcount(prev); | 1326 | tp->lost_cnt_hint -= tcp_skb_pcount(prev); |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | TCP_SKB_CB(skb)->tcp_flags |= TCP_SKB_CB(prev)->tcp_flags; | 1329 | TCP_SKB_CB(prev)->tcp_flags |= TCP_SKB_CB(skb)->tcp_flags; |
1330 | if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) | ||
1331 | TCP_SKB_CB(prev)->end_seq++; | ||
1332 | |||
1330 | if (skb == tcp_highest_sack(sk)) | 1333 | if (skb == tcp_highest_sack(sk)) |
1331 | tcp_advance_highest_sack(sk, skb); | 1334 | tcp_advance_highest_sack(sk, skb); |
1332 | 1335 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index e6bb8256e59f..c6f01f2cdb32 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -637,6 +637,8 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb | |||
637 | unsigned int size = 0; | 637 | unsigned int size = 0; |
638 | unsigned int eff_sacks; | 638 | unsigned int eff_sacks; |
639 | 639 | ||
640 | opts->options = 0; | ||
641 | |||
640 | #ifdef CONFIG_TCP_MD5SIG | 642 | #ifdef CONFIG_TCP_MD5SIG |
641 | *md5 = tp->af_specific->md5_lookup(sk, sk); | 643 | *md5 = tp->af_specific->md5_lookup(sk, sk); |
642 | if (unlikely(*md5)) { | 644 | if (unlikely(*md5)) { |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 32b4a1675d82..066640e0ba8e 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -116,7 +116,7 @@ begintw: | |||
116 | } | 116 | } |
117 | if (unlikely(!INET6_TW_MATCH(sk, net, saddr, daddr, | 117 | if (unlikely(!INET6_TW_MATCH(sk, net, saddr, daddr, |
118 | ports, dif))) { | 118 | ports, dif))) { |
119 | sock_put(sk); | 119 | inet_twsk_put(inet_twsk(sk)); |
120 | goto begintw; | 120 | goto begintw; |
121 | } | 121 | } |
122 | goto out; | 122 | goto out; |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 7bb5446b9d73..1ef1fa2b22a6 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -1173,9 +1173,8 @@ done: | |||
1173 | 1173 | ||
1174 | static int ip6gre_tunnel_change_mtu(struct net_device *dev, int new_mtu) | 1174 | static int ip6gre_tunnel_change_mtu(struct net_device *dev, int new_mtu) |
1175 | { | 1175 | { |
1176 | struct ip6_tnl *tunnel = netdev_priv(dev); | ||
1177 | if (new_mtu < 68 || | 1176 | if (new_mtu < 68 || |
1178 | new_mtu > 0xFFF8 - dev->hard_header_len - tunnel->hlen) | 1177 | new_mtu > 0xFFF8 - dev->hard_header_len) |
1179 | return -EINVAL; | 1178 | return -EINVAL; |
1180 | dev->mtu = new_mtu; | 1179 | dev->mtu = new_mtu; |
1181 | return 0; | 1180 | return 0; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index a791552e0422..583b77e2f69b 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1430,9 +1430,17 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1430 | static int | 1430 | static int |
1431 | ip6_tnl_change_mtu(struct net_device *dev, int new_mtu) | 1431 | ip6_tnl_change_mtu(struct net_device *dev, int new_mtu) |
1432 | { | 1432 | { |
1433 | if (new_mtu < IPV6_MIN_MTU) { | 1433 | struct ip6_tnl *tnl = netdev_priv(dev); |
1434 | return -EINVAL; | 1434 | |
1435 | if (tnl->parms.proto == IPPROTO_IPIP) { | ||
1436 | if (new_mtu < 68) | ||
1437 | return -EINVAL; | ||
1438 | } else { | ||
1439 | if (new_mtu < IPV6_MIN_MTU) | ||
1440 | return -EINVAL; | ||
1435 | } | 1441 | } |
1442 | if (new_mtu > 0xFFF8 - dev->hard_header_len) | ||
1443 | return -EINVAL; | ||
1436 | dev->mtu = new_mtu; | 1444 | dev->mtu = new_mtu; |
1437 | return 0; | 1445 | return 0; |
1438 | } | 1446 | } |
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index feae495a0a30..b076e8309bc2 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -115,6 +115,11 @@ struct l2tp_net { | |||
115 | static void l2tp_session_set_header_len(struct l2tp_session *session, int version); | 115 | static void l2tp_session_set_header_len(struct l2tp_session *session, int version); |
116 | static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); | 116 | static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); |
117 | 117 | ||
118 | static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk) | ||
119 | { | ||
120 | return sk->sk_user_data; | ||
121 | } | ||
122 | |||
118 | static inline struct l2tp_net *l2tp_pernet(struct net *net) | 123 | static inline struct l2tp_net *l2tp_pernet(struct net *net) |
119 | { | 124 | { |
120 | BUG_ON(!net); | 125 | BUG_ON(!net); |
@@ -504,7 +509,7 @@ static inline int l2tp_verify_udp_checksum(struct sock *sk, | |||
504 | return 0; | 509 | return 0; |
505 | 510 | ||
506 | #if IS_ENABLED(CONFIG_IPV6) | 511 | #if IS_ENABLED(CONFIG_IPV6) |
507 | if (sk->sk_family == PF_INET6) { | 512 | if (sk->sk_family == PF_INET6 && !l2tp_tunnel(sk)->v4mapped) { |
508 | if (!uh->check) { | 513 | if (!uh->check) { |
509 | LIMIT_NETDEBUG(KERN_INFO "L2TP: IPv6: checksum is 0\n"); | 514 | LIMIT_NETDEBUG(KERN_INFO "L2TP: IPv6: checksum is 0\n"); |
510 | return 1; | 515 | return 1; |
@@ -1128,7 +1133,7 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, | |||
1128 | /* Queue the packet to IP for output */ | 1133 | /* Queue the packet to IP for output */ |
1129 | skb->local_df = 1; | 1134 | skb->local_df = 1; |
1130 | #if IS_ENABLED(CONFIG_IPV6) | 1135 | #if IS_ENABLED(CONFIG_IPV6) |
1131 | if (skb->sk->sk_family == PF_INET6) | 1136 | if (skb->sk->sk_family == PF_INET6 && !tunnel->v4mapped) |
1132 | error = inet6_csk_xmit(skb, NULL); | 1137 | error = inet6_csk_xmit(skb, NULL); |
1133 | else | 1138 | else |
1134 | #endif | 1139 | #endif |
@@ -1255,7 +1260,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len | |||
1255 | 1260 | ||
1256 | /* Calculate UDP checksum if configured to do so */ | 1261 | /* Calculate UDP checksum if configured to do so */ |
1257 | #if IS_ENABLED(CONFIG_IPV6) | 1262 | #if IS_ENABLED(CONFIG_IPV6) |
1258 | if (sk->sk_family == PF_INET6) | 1263 | if (sk->sk_family == PF_INET6 && !tunnel->v4mapped) |
1259 | l2tp_xmit_ipv6_csum(sk, skb, udp_len); | 1264 | l2tp_xmit_ipv6_csum(sk, skb, udp_len); |
1260 | else | 1265 | else |
1261 | #endif | 1266 | #endif |
@@ -1304,10 +1309,9 @@ EXPORT_SYMBOL_GPL(l2tp_xmit_skb); | |||
1304 | */ | 1309 | */ |
1305 | static void l2tp_tunnel_destruct(struct sock *sk) | 1310 | static void l2tp_tunnel_destruct(struct sock *sk) |
1306 | { | 1311 | { |
1307 | struct l2tp_tunnel *tunnel; | 1312 | struct l2tp_tunnel *tunnel = l2tp_tunnel(sk); |
1308 | struct l2tp_net *pn; | 1313 | struct l2tp_net *pn; |
1309 | 1314 | ||
1310 | tunnel = sk->sk_user_data; | ||
1311 | if (tunnel == NULL) | 1315 | if (tunnel == NULL) |
1312 | goto end; | 1316 | goto end; |
1313 | 1317 | ||
@@ -1675,7 +1679,7 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1675 | } | 1679 | } |
1676 | 1680 | ||
1677 | /* Check if this socket has already been prepped */ | 1681 | /* Check if this socket has already been prepped */ |
1678 | tunnel = (struct l2tp_tunnel *)sk->sk_user_data; | 1682 | tunnel = l2tp_tunnel(sk); |
1679 | if (tunnel != NULL) { | 1683 | if (tunnel != NULL) { |
1680 | /* This socket has already been prepped */ | 1684 | /* This socket has already been prepped */ |
1681 | err = -EBUSY; | 1685 | err = -EBUSY; |
@@ -1704,6 +1708,24 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1704 | if (cfg != NULL) | 1708 | if (cfg != NULL) |
1705 | tunnel->debug = cfg->debug; | 1709 | tunnel->debug = cfg->debug; |
1706 | 1710 | ||
1711 | #if IS_ENABLED(CONFIG_IPV6) | ||
1712 | if (sk->sk_family == PF_INET6) { | ||
1713 | struct ipv6_pinfo *np = inet6_sk(sk); | ||
1714 | |||
1715 | if (ipv6_addr_v4mapped(&np->saddr) && | ||
1716 | ipv6_addr_v4mapped(&np->daddr)) { | ||
1717 | struct inet_sock *inet = inet_sk(sk); | ||
1718 | |||
1719 | tunnel->v4mapped = true; | ||
1720 | inet->inet_saddr = np->saddr.s6_addr32[3]; | ||
1721 | inet->inet_rcv_saddr = np->rcv_saddr.s6_addr32[3]; | ||
1722 | inet->inet_daddr = np->daddr.s6_addr32[3]; | ||
1723 | } else { | ||
1724 | tunnel->v4mapped = false; | ||
1725 | } | ||
1726 | } | ||
1727 | #endif | ||
1728 | |||
1707 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ | 1729 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ |
1708 | tunnel->encap = encap; | 1730 | tunnel->encap = encap; |
1709 | if (encap == L2TP_ENCAPTYPE_UDP) { | 1731 | if (encap == L2TP_ENCAPTYPE_UDP) { |
@@ -1712,7 +1734,7 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1712 | udp_sk(sk)->encap_rcv = l2tp_udp_encap_recv; | 1734 | udp_sk(sk)->encap_rcv = l2tp_udp_encap_recv; |
1713 | udp_sk(sk)->encap_destroy = l2tp_udp_encap_destroy; | 1735 | udp_sk(sk)->encap_destroy = l2tp_udp_encap_destroy; |
1714 | #if IS_ENABLED(CONFIG_IPV6) | 1736 | #if IS_ENABLED(CONFIG_IPV6) |
1715 | if (sk->sk_family == PF_INET6) | 1737 | if (sk->sk_family == PF_INET6 && !tunnel->v4mapped) |
1716 | udpv6_encap_enable(); | 1738 | udpv6_encap_enable(); |
1717 | else | 1739 | else |
1718 | #endif | 1740 | #endif |
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index 66a559b104b6..6f251cbc2ed7 100644 --- a/net/l2tp/l2tp_core.h +++ b/net/l2tp/l2tp_core.h | |||
@@ -194,6 +194,9 @@ struct l2tp_tunnel { | |||
194 | struct sock *sock; /* Parent socket */ | 194 | struct sock *sock; /* Parent socket */ |
195 | int fd; /* Parent fd, if tunnel socket | 195 | int fd; /* Parent fd, if tunnel socket |
196 | * was created by userspace */ | 196 | * was created by userspace */ |
197 | #if IS_ENABLED(CONFIG_IPV6) | ||
198 | bool v4mapped; | ||
199 | #endif | ||
197 | 200 | ||
198 | struct work_struct del_work; | 201 | struct work_struct del_work; |
199 | 202 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 54395d7583ba..674eac1f996c 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -3056,6 +3056,9 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx, | |||
3056 | case NL80211_IFTYPE_ADHOC: | 3056 | case NL80211_IFTYPE_ADHOC: |
3057 | if (!bssid) | 3057 | if (!bssid) |
3058 | return 0; | 3058 | return 0; |
3059 | if (ether_addr_equal(sdata->vif.addr, hdr->addr2) || | ||
3060 | ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2)) | ||
3061 | return 0; | ||
3059 | if (ieee80211_is_beacon(hdr->frame_control)) { | 3062 | if (ieee80211_is_beacon(hdr->frame_control)) { |
3060 | return 1; | 3063 | return 1; |
3061 | } else if (!ieee80211_bssid_match(bssid, sdata->u.ibss.bssid)) { | 3064 | } else if (!ieee80211_bssid_match(bssid, sdata->u.ibss.bssid)) { |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index e1b34a18b243..9c3200bcfc02 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -2103,7 +2103,7 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, | |||
2103 | { | 2103 | { |
2104 | struct ieee80211_local *local = sdata->local; | 2104 | struct ieee80211_local *local = sdata->local; |
2105 | struct ieee80211_supported_band *sband; | 2105 | struct ieee80211_supported_band *sband; |
2106 | int rate, skip, shift; | 2106 | int rate, shift; |
2107 | u8 i, exrates, *pos; | 2107 | u8 i, exrates, *pos; |
2108 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; | 2108 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; |
2109 | u32 rate_flags; | 2109 | u32 rate_flags; |
@@ -2131,14 +2131,11 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, | |||
2131 | pos = skb_put(skb, exrates + 2); | 2131 | pos = skb_put(skb, exrates + 2); |
2132 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | 2132 | *pos++ = WLAN_EID_EXT_SUPP_RATES; |
2133 | *pos++ = exrates; | 2133 | *pos++ = exrates; |
2134 | skip = 0; | ||
2135 | for (i = 8; i < sband->n_bitrates; i++) { | 2134 | for (i = 8; i < sband->n_bitrates; i++) { |
2136 | u8 basic = 0; | 2135 | u8 basic = 0; |
2137 | if ((rate_flags & sband->bitrates[i].flags) | 2136 | if ((rate_flags & sband->bitrates[i].flags) |
2138 | != rate_flags) | 2137 | != rate_flags) |
2139 | continue; | 2138 | continue; |
2140 | if (skip++ < 8) | ||
2141 | continue; | ||
2142 | if (need_basic && basic_rates & BIT(i)) | 2139 | if (need_basic && basic_rates & BIT(i)) |
2143 | basic = 0x80; | 2140 | basic = 0x80; |
2144 | rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, | 2141 | rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, |
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c index a2fef8b10b96..a9dfdda9ed1d 100644 --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c | |||
@@ -472,20 +472,16 @@ begin: | |||
472 | if (f->credit > 0 || !q->rate_enable) | 472 | if (f->credit > 0 || !q->rate_enable) |
473 | goto out; | 473 | goto out; |
474 | 474 | ||
475 | if (skb->sk && skb->sk->sk_state != TCP_TIME_WAIT) { | 475 | rate = q->flow_max_rate; |
476 | rate = skb->sk->sk_pacing_rate ?: q->flow_default_rate; | 476 | if (skb->sk && skb->sk->sk_state != TCP_TIME_WAIT) |
477 | rate = min(skb->sk->sk_pacing_rate, rate); | ||
477 | 478 | ||
478 | rate = min(rate, q->flow_max_rate); | 479 | if (rate != ~0U) { |
479 | } else { | ||
480 | rate = q->flow_max_rate; | ||
481 | if (rate == ~0U) | ||
482 | goto out; | ||
483 | } | ||
484 | if (rate) { | ||
485 | u32 plen = max(qdisc_pkt_len(skb), q->quantum); | 480 | u32 plen = max(qdisc_pkt_len(skb), q->quantum); |
486 | u64 len = (u64)plen * NSEC_PER_SEC; | 481 | u64 len = (u64)plen * NSEC_PER_SEC; |
487 | 482 | ||
488 | do_div(len, rate); | 483 | if (likely(rate)) |
484 | do_div(len, rate); | ||
489 | /* Since socket rate can change later, | 485 | /* Since socket rate can change later, |
490 | * clamp the delay to 125 ms. | 486 | * clamp the delay to 125 ms. |
491 | * TODO: maybe segment the too big skb, as in commit | 487 | * TODO: maybe segment the too big skb, as in commit |
@@ -656,7 +652,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt) | |||
656 | q->quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); | 652 | q->quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); |
657 | 653 | ||
658 | if (tb[TCA_FQ_INITIAL_QUANTUM]) | 654 | if (tb[TCA_FQ_INITIAL_QUANTUM]) |
659 | q->quantum = nla_get_u32(tb[TCA_FQ_INITIAL_QUANTUM]); | 655 | q->initial_quantum = nla_get_u32(tb[TCA_FQ_INITIAL_QUANTUM]); |
660 | 656 | ||
661 | if (tb[TCA_FQ_FLOW_DEFAULT_RATE]) | 657 | if (tb[TCA_FQ_FLOW_DEFAULT_RATE]) |
662 | q->flow_default_rate = nla_get_u32(tb[TCA_FQ_FLOW_DEFAULT_RATE]); | 658 | q->flow_default_rate = nla_get_u32(tb[TCA_FQ_FLOW_DEFAULT_RATE]); |
@@ -735,12 +731,14 @@ static int fq_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
735 | if (opts == NULL) | 731 | if (opts == NULL) |
736 | goto nla_put_failure; | 732 | goto nla_put_failure; |
737 | 733 | ||
734 | /* TCA_FQ_FLOW_DEFAULT_RATE is not used anymore, | ||
735 | * do not bother giving its value | ||
736 | */ | ||
738 | if (nla_put_u32(skb, TCA_FQ_PLIMIT, sch->limit) || | 737 | if (nla_put_u32(skb, TCA_FQ_PLIMIT, sch->limit) || |
739 | nla_put_u32(skb, TCA_FQ_FLOW_PLIMIT, q->flow_plimit) || | 738 | nla_put_u32(skb, TCA_FQ_FLOW_PLIMIT, q->flow_plimit) || |
740 | nla_put_u32(skb, TCA_FQ_QUANTUM, q->quantum) || | 739 | nla_put_u32(skb, TCA_FQ_QUANTUM, q->quantum) || |
741 | nla_put_u32(skb, TCA_FQ_INITIAL_QUANTUM, q->initial_quantum) || | 740 | nla_put_u32(skb, TCA_FQ_INITIAL_QUANTUM, q->initial_quantum) || |
742 | nla_put_u32(skb, TCA_FQ_RATE_ENABLE, q->rate_enable) || | 741 | nla_put_u32(skb, TCA_FQ_RATE_ENABLE, q->rate_enable) || |
743 | nla_put_u32(skb, TCA_FQ_FLOW_DEFAULT_RATE, q->flow_default_rate) || | ||
744 | nla_put_u32(skb, TCA_FQ_FLOW_MAX_RATE, q->flow_max_rate) || | 742 | nla_put_u32(skb, TCA_FQ_FLOW_MAX_RATE, q->flow_max_rate) || |
745 | nla_put_u32(skb, TCA_FQ_BUCKETS_LOG, q->fq_trees_log)) | 743 | nla_put_u32(skb, TCA_FQ_BUCKETS_LOG, q->fq_trees_log)) |
746 | goto nla_put_failure; | 744 | goto nla_put_failure; |
diff --git a/net/socket.c b/net/socket.c index ebed4b68f768..c226aceee65b 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1964,6 +1964,16 @@ struct used_address { | |||
1964 | unsigned int name_len; | 1964 | unsigned int name_len; |
1965 | }; | 1965 | }; |
1966 | 1966 | ||
1967 | static int copy_msghdr_from_user(struct msghdr *kmsg, | ||
1968 | struct msghdr __user *umsg) | ||
1969 | { | ||
1970 | if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) | ||
1971 | return -EFAULT; | ||
1972 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) | ||
1973 | return -EINVAL; | ||
1974 | return 0; | ||
1975 | } | ||
1976 | |||
1967 | static int ___sys_sendmsg(struct socket *sock, struct msghdr __user *msg, | 1977 | static int ___sys_sendmsg(struct socket *sock, struct msghdr __user *msg, |
1968 | struct msghdr *msg_sys, unsigned int flags, | 1978 | struct msghdr *msg_sys, unsigned int flags, |
1969 | struct used_address *used_address) | 1979 | struct used_address *used_address) |
@@ -1982,8 +1992,11 @@ static int ___sys_sendmsg(struct socket *sock, struct msghdr __user *msg, | |||
1982 | if (MSG_CMSG_COMPAT & flags) { | 1992 | if (MSG_CMSG_COMPAT & flags) { |
1983 | if (get_compat_msghdr(msg_sys, msg_compat)) | 1993 | if (get_compat_msghdr(msg_sys, msg_compat)) |
1984 | return -EFAULT; | 1994 | return -EFAULT; |
1985 | } else if (copy_from_user(msg_sys, msg, sizeof(struct msghdr))) | 1995 | } else { |
1986 | return -EFAULT; | 1996 | err = copy_msghdr_from_user(msg_sys, msg); |
1997 | if (err) | ||
1998 | return err; | ||
1999 | } | ||
1987 | 2000 | ||
1988 | if (msg_sys->msg_iovlen > UIO_FASTIOV) { | 2001 | if (msg_sys->msg_iovlen > UIO_FASTIOV) { |
1989 | err = -EMSGSIZE; | 2002 | err = -EMSGSIZE; |
@@ -2191,8 +2204,11 @@ static int ___sys_recvmsg(struct socket *sock, struct msghdr __user *msg, | |||
2191 | if (MSG_CMSG_COMPAT & flags) { | 2204 | if (MSG_CMSG_COMPAT & flags) { |
2192 | if (get_compat_msghdr(msg_sys, msg_compat)) | 2205 | if (get_compat_msghdr(msg_sys, msg_compat)) |
2193 | return -EFAULT; | 2206 | return -EFAULT; |
2194 | } else if (copy_from_user(msg_sys, msg, sizeof(struct msghdr))) | 2207 | } else { |
2195 | return -EFAULT; | 2208 | err = copy_msghdr_from_user(msg_sys, msg); |
2209 | if (err) | ||
2210 | return err; | ||
2211 | } | ||
2196 | 2212 | ||
2197 | if (msg_sys->msg_iovlen > UIO_FASTIOV) { | 2213 | if (msg_sys->msg_iovlen > UIO_FASTIOV) { |
2198 | err = -EMSGSIZE; | 2214 | err = -EMSGSIZE; |
diff --git a/net/sysctl_net.c b/net/sysctl_net.c index 9bc6db04be3e..e7000be321b0 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c | |||
@@ -47,12 +47,12 @@ static int net_ctl_permissions(struct ctl_table_header *head, | |||
47 | 47 | ||
48 | /* Allow network administrator to have same access as root. */ | 48 | /* Allow network administrator to have same access as root. */ |
49 | if (ns_capable(net->user_ns, CAP_NET_ADMIN) || | 49 | if (ns_capable(net->user_ns, CAP_NET_ADMIN) || |
50 | uid_eq(root_uid, current_uid())) { | 50 | uid_eq(root_uid, current_euid())) { |
51 | int mode = (table->mode >> 6) & 7; | 51 | int mode = (table->mode >> 6) & 7; |
52 | return (mode << 6) | (mode << 3) | mode; | 52 | return (mode << 6) | (mode << 3) | mode; |
53 | } | 53 | } |
54 | /* Allow netns root group to have the same access as the root group */ | 54 | /* Allow netns root group to have the same access as the root group */ |
55 | if (gid_eq(root_gid, current_gid())) { | 55 | if (in_egroup_p(root_gid)) { |
56 | int mode = (table->mode >> 3) & 7; | 56 | int mode = (table->mode >> 3) & 7; |
57 | return (mode << 3) | mode; | 57 | return (mode << 3) | mode; |
58 | } | 58 | } |
diff --git a/net/unix/diag.c b/net/unix/diag.c index d591091603bf..86fa0f3b2caf 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c | |||
@@ -124,6 +124,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_r | |||
124 | rep->udiag_family = AF_UNIX; | 124 | rep->udiag_family = AF_UNIX; |
125 | rep->udiag_type = sk->sk_type; | 125 | rep->udiag_type = sk->sk_type; |
126 | rep->udiag_state = sk->sk_state; | 126 | rep->udiag_state = sk->sk_state; |
127 | rep->pad = 0; | ||
127 | rep->udiag_ino = sk_ino; | 128 | rep->udiag_ino = sk_ino; |
128 | sock_diag_save_cookie(sk, rep->udiag_cookie); | 129 | sock_diag_save_cookie(sk, rep->udiag_cookie); |
129 | 130 | ||
diff --git a/net/wireless/core.c b/net/wireless/core.c index 67153964aad2..fe8d4f2be49b 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -566,18 +566,13 @@ int wiphy_register(struct wiphy *wiphy) | |||
566 | /* check and set up bitrates */ | 566 | /* check and set up bitrates */ |
567 | ieee80211_set_bitrate_flags(wiphy); | 567 | ieee80211_set_bitrate_flags(wiphy); |
568 | 568 | ||
569 | 569 | rtnl_lock(); | |
570 | res = device_add(&rdev->wiphy.dev); | 570 | res = device_add(&rdev->wiphy.dev); |
571 | if (res) | ||
572 | return res; | ||
573 | |||
574 | res = rfkill_register(rdev->rfkill); | ||
575 | if (res) { | 571 | if (res) { |
576 | device_del(&rdev->wiphy.dev); | 572 | rtnl_unlock(); |
577 | return res; | 573 | return res; |
578 | } | 574 | } |
579 | 575 | ||
580 | rtnl_lock(); | ||
581 | /* set up regulatory info */ | 576 | /* set up regulatory info */ |
582 | wiphy_regulatory_register(wiphy); | 577 | wiphy_regulatory_register(wiphy); |
583 | 578 | ||
@@ -606,6 +601,15 @@ int wiphy_register(struct wiphy *wiphy) | |||
606 | 601 | ||
607 | rdev->wiphy.registered = true; | 602 | rdev->wiphy.registered = true; |
608 | rtnl_unlock(); | 603 | rtnl_unlock(); |
604 | |||
605 | res = rfkill_register(rdev->rfkill); | ||
606 | if (res) { | ||
607 | rfkill_destroy(rdev->rfkill); | ||
608 | rdev->rfkill = NULL; | ||
609 | wiphy_unregister(&rdev->wiphy); | ||
610 | return res; | ||
611 | } | ||
612 | |||
609 | return 0; | 613 | return 0; |
610 | } | 614 | } |
611 | EXPORT_SYMBOL(wiphy_register); | 615 | EXPORT_SYMBOL(wiphy_register); |
@@ -640,7 +644,8 @@ void wiphy_unregister(struct wiphy *wiphy) | |||
640 | rtnl_unlock(); | 644 | rtnl_unlock(); |
641 | __count == 0; })); | 645 | __count == 0; })); |
642 | 646 | ||
643 | rfkill_unregister(rdev->rfkill); | 647 | if (rdev->rfkill) |
648 | rfkill_unregister(rdev->rfkill); | ||
644 | 649 | ||
645 | rtnl_lock(); | 650 | rtnl_lock(); |
646 | rdev->wiphy.registered = false; | 651 | rdev->wiphy.registered = false; |
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index 39bff7d36768..403fe29c024d 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -263,6 +263,8 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, | |||
263 | if (chan->flags & IEEE80211_CHAN_DISABLED) | 263 | if (chan->flags & IEEE80211_CHAN_DISABLED) |
264 | continue; | 264 | continue; |
265 | wdev->wext.ibss.chandef.chan = chan; | 265 | wdev->wext.ibss.chandef.chan = chan; |
266 | wdev->wext.ibss.chandef.center_freq1 = | ||
267 | chan->center_freq; | ||
266 | break; | 268 | break; |
267 | } | 269 | } |
268 | 270 | ||
@@ -347,6 +349,7 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | |||
347 | if (chan) { | 349 | if (chan) { |
348 | wdev->wext.ibss.chandef.chan = chan; | 350 | wdev->wext.ibss.chandef.chan = chan; |
349 | wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; | 351 | wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; |
352 | wdev->wext.ibss.chandef.center_freq1 = freq; | ||
350 | wdev->wext.ibss.channel_fixed = true; | 353 | wdev->wext.ibss.channel_fixed = true; |
351 | } else { | 354 | } else { |
352 | /* cfg80211_ibss_wext_join will pick one if needed */ | 355 | /* cfg80211_ibss_wext_join will pick one if needed */ |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index af8d84a4a5b2..626dc3b5fd8d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2421,7 +2421,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) | |||
2421 | change = true; | 2421 | change = true; |
2422 | } | 2422 | } |
2423 | 2423 | ||
2424 | if (flags && (*flags & NL80211_MNTR_FLAG_ACTIVE) && | 2424 | if (flags && (*flags & MONITOR_FLAG_ACTIVE) && |
2425 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) | 2425 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) |
2426 | return -EOPNOTSUPP; | 2426 | return -EOPNOTSUPP; |
2427 | 2427 | ||
@@ -2483,7 +2483,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
2483 | info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, | 2483 | info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, |
2484 | &flags); | 2484 | &flags); |
2485 | 2485 | ||
2486 | if (!err && (flags & NL80211_MNTR_FLAG_ACTIVE) && | 2486 | if (!err && (flags & MONITOR_FLAG_ACTIVE) && |
2487 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) | 2487 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) |
2488 | return -EOPNOTSUPP; | 2488 | return -EOPNOTSUPP; |
2489 | 2489 | ||