* Re: [PATCH v3 net-next] fix unsafe set_memory_rw from softirq
From: Ingo Molnar @ 2013-10-04 17:35 UTC (permalink / raw)
To: Eric Dumazet
Cc: Benjamin Herrenschmidt, Heiko Carstens, Paul Mackerras,
H. Peter Anvin, sparclinux, Nicolas Dichtel, Alexei Starovoitov,
linux-s390, Russell King, x86, James Morris, Ingo Molnar,
Alexey Kuznetsov, Paul E. McKenney, Xi Wang, Matt Evans,
Thomas Gleixner, linux-arm-kernel, Stelian Nirlu,
Nicolas Schichan, Hideaki YOSHIFUJI, netdev, linux-kernel,
David S. Miller, Mi
In-Reply-To: <CANn89iKkbR0_HaofvC_OVvqRv_Hqj3rATx-Z_4xXeusOasa56g@mail.gmail.com>
* Eric Dumazet <edumazet@google.com> wrote:
> 1)
> >
> > I took a brief look at arch/x86/net/bpf_jit_comp.c while reviewing this
> > patch.
> >
> > You need to split up bpf_jit_compile(), it's an obscenely large, ~600
> > lines long function. We don't do that in modern, maintainable kernel code.
> >
> > 2)
> >
> > This 128 bytes extra padding:
> >
> > /* Most of BPF filters are really small,
> > * but if some of them fill a page, allow at least
> > * 128 extra bytes to insert a random section of int3
> > */
> > sz = round_up(proglen + sizeof(*header) + 128, PAGE_SIZE);
> >
> > why is it done? It's not clear to me from the comment.
> >
>
> commit 314beb9bcabfd6b4542ccbced2402af2c6f6142a
> Author: Eric Dumazet <edumazet@google.com>
> Date: Fri May 17 16:37:03 2013 +0000
>
> x86: bpf_jit_comp: secure bpf jit against spraying attacks
>
> hpa bringed into my attention some security related issues
> with BPF JIT on x86.
>
> This patch makes sure the bpf generated code is marked read only,
> as other kernel text sections.
>
> It also splits the unused space (we vmalloc() and only use a fraction of
> the page) in two parts, so that the generated bpf code not starts at a
> known offset in the page, but a pseudo random one.
Thanks for the explanation - that makes sense.
Ingo
^ permalink raw reply
* Let the moment last as much as you want.
From: JamesEPolk @ 2013-10-04 17:40 UTC (permalink / raw)
Dear Customer,
Sometimes things happen much quicker than you would love to.
Let the moment last as much as you want.
http://translate.googleusercontent.com/translate_c?depth=1&hl=auto&sl=de&url=www.google.cn&u=http://onlineshop63.yolasite.com/store&usg=ALkJrhjuuBC9SIdn3nj6vfQ7-8vR_Bt35g
Best Regards,
^ permalink raw reply
* Re: [PATCH v3 net-next] fix unsafe set_memory_rw from softirq
From: Alexei Starovoitov @ 2013-10-04 17:49 UTC (permalink / raw)
To: Ingo Molnar
Cc: Benjamin Herrenschmidt, Heiko Carstens, Eric Dumazet,
Paul Mackerras, H. Peter Anvin, sparclinux, Nicolas Dichtel,
linux-s390, Russell King, x86, James Morris, Ingo Molnar,
Alexey Kuznetsov, Paul E. McKenney, Xi Wang, Matt Evans,
Thomas Gleixner, linux-arm-kernel, Stelian Nirlu,
Nicolas Schichan, Hideaki YOSHIFUJI, netdev, linux-kernel,
David S. Miller, Mircea
In-Reply-To: <20131004075133.GA12313@gmail.com>
On Fri, Oct 4, 2013 at 12:51 AM, Ingo Molnar <mingo@kernel.org> wrote:
>> +static void bpf_jit_free_deferred(struct work_struct *work)
>> +{
>> + struct sk_filter *fp = container_of((void *)work, struct sk_filter,
>> + insns);
>> + unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
>> + struct bpf_binary_header *header = (void *)addr;
>> +
>> + set_memory_rw(addr, header->pages);
>> + module_free(NULL, header);
>> + kfree(fp);
>> +}
>
> Using the data type suggestions I make further below, this could be
> written in a simpler form, as:
>
> struct sk_filter *fp = container_of(work, struct sk_filter, work);
yes. I've made it already as part of V4
> Also, a question, why do you mask with PAGE_MASK here:
>
> unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
>
> ?
>
> AFAICS bpf_func is the module_alloc() result - and module code is page
> aligned. So ->bpf_func is always page aligned here. (The sk_run_filter
> special case cannot happen here.)
randomization of bpf_func start is a prevention of jit spraying
attacks as Eric pointed out.
>> void bpf_jit_free(struct sk_filter *fp)
>> {
>> if (fp->bpf_func != sk_run_filter) {
>> - unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
>> - struct bpf_binary_header *header = (void *)addr;
>> -
>> - set_memory_rw(addr, header->pages);
>> - module_free(NULL, header);
>> + struct work_struct *work = (struct work_struct *)fp->insns;
>> + INIT_WORK(work, bpf_jit_free_deferred);
>
> Missing newline between local variables and statements.
yes. noted and fixed in V4.
>> unsigned int (*bpf_func)(const struct sk_buff *skb,
>> const struct sock_filter *filter);
>> - struct rcu_head rcu;
>> + /* insns start right after bpf_func, so that sk_run_filter() fetches
>> + * first insn from the same cache line that was used to call into
>> + * sk_run_filter()
>> + */
>> struct sock_filter insns[0];
>
> Please use the customary (multi-line) comment style:
>
> /*
> * Comment .....
> * ...... goes here.
> */
>
> specified in Documentation/CodingStyle.
I believe filter.h belongs to networking comment style, that's why
checkpatch didn't complain.
But I removed the comment in V4
>> static inline unsigned int sk_filter_len(const struct sk_filter *fp)
>> {
>> - return fp->len * sizeof(struct sock_filter) + sizeof(*fp);
>> + return max(fp->len * sizeof(struct sock_filter),
>> + sizeof(struct work_struct)) + sizeof(*fp);
>
> So, "sizeof(struct work_struct)) + sizeof(*fp)" is a pattern that repeats
> a couple of times. Might make sense to stick that into a helper of its own
> - but in general this open coded overlay allocation method looks a bit
> fragile and not very obvious in isolation.
>
> So it could be done a bit cleaner, using an anonymous union:
>
> /*
> * These two overlay, the work struct is used during workqueue
> * driven teardown, when the instructions are not used anymore:
> */
> union {
> struct sock_filter insns[0];
> struct work_struct work;
> };
>
> And then all the sizeof() calculations become obvious and sk_filter_len()
> could be eliminated - I've marked the conversions in the code further
> below.
Eric made exactly the same comment. Agreed and fixed in V4
>> #else
>> +#include <linux/slab.h>
>
> Inlines in the middle of header files are generally frowned upon.
>
> The standard pattern is to put them at the top, that way it's easier to
> see the dependencies and there's also less .config dependent inclusion,
> which makes header hell cleanup work easier.
Agree. I only followed the style that is already in filter.h 20 lines above.
#ifdef CONFIG_BPF_JIT
#include <stdarg.h>
#include <linux/linkage.h>
#include <linux/printk.h>
as part of the cleanup can move all of them to the top. In the separate commit?
>> struct sk_filter *fp;
>> unsigned int fsize = sizeof(struct sock_filter) * fprog->len;
>> + unsigned int sk_fsize = max_t(u32, fsize, sizeof(struct work_struct))
>> + + sizeof(*fp);
>
> Using the structure definition I suggested, this could be replaced with
> the more obvious:
>
> unsigned int sk_fsize = max(fsize, sizeof(*fp));
with helper function it's even cleaner. Fixed in V4
> A couple of questions/suggestions:
>
> 1)
>
> I took a brief look at arch/x86/net/bpf_jit_comp.c while reviewing this
> patch.
>
> You need to split up bpf_jit_compile(), it's an obscenely large, ~600
> lines long function. We don't do that in modern, maintainable kernel code.
I had the same thought, therefore in my proposed generalization of bpf:
http://patchwork.ozlabs.org/patch/279280/
It is split into two. do_jit() is still a bit large at 400 lines. Can
split it further.
> 3)
>
> It's nice code altogether! Are there any plans to generalize its
> interfaces, to allow arbitrary bytecode to be used by other kernel
> subsystems as well? In particular tracing filters could make use of it,
> but it would also allow safe probe points.
That was exactly the reasons to generalize bpf as I proposed.
"extended BPF is a set of pseudo instructions that stitch kernel provided
data in the form of bpf_context with kernel provided set of functions in a safe
and deterministic way with minimal performance overhead vs native code"
Not sure what 'tracing filters' you have in mind, but I'm happy to try
them with extended bpf model.
imo existing bpf with two registers is too limiting for performance
and argument passing.
That's why going to 10 made it a lot more flexible and generically usable.
Sorry to hijack the thread.
Thanks
Alexei
^ permalink raw reply
* Re: [PATCH] veth: Showing peer of veth type dev in ip link (kernel side)
From: Stephen Hemminger @ 2013-10-04 17:55 UTC (permalink / raw)
To: Masatake YAMATO; +Cc: netdev
In-Reply-To: <1380859529-32351-1-git-send-email-yamato@redhat.com>
On Fri, 4 Oct 2013 13:05:29 +0900
Masatake YAMATO <yamato@redhat.com> wrote:
> ip link has ability to show extra information of net work device if
> kernel provides sunh information. With this patch veth driver can
> provide its peer ifindex information to ip command via netlink
> interface.
>
> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
> ---
netlink API's are supposed to be symmetrical.
When creating veth, the VETH_INFO_PEER attribute is struct(ifinfomsg).
The fill_info should tack on the same data.
^ permalink raw reply
* Re: [PATCH 00/33] Netfilter updates for net-next
From: David Miller @ 2013-10-04 17:59 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
In-Reply-To: <1380875598-5250-1-git-send-email-pablo@netfilter.org>
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Fri, 4 Oct 2013 10:32:45 +0200
> The following patchset contains Netfilter updates for your net-next tree,
> mostly ipset improvements and enhancements features, they are:
...
Pulled, thanks a lot Pablo.
^ permalink raw reply
* Re: [PATCH v3 net-next] fix unsafe set_memory_rw from softirq
From: Ingo Molnar @ 2013-10-04 18:00 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Benjamin Herrenschmidt, Heiko Carstens, Eric Dumazet,
Paul Mackerras, H. Peter Anvin, sparclinux, Nicolas Dichtel,
linux-s390, Russell King, x86, James Morris, Ingo Molnar,
Alexey Kuznetsov, Paul E. McKenney, Xi Wang, Matt Evans,
Thomas Gleixner, linux-arm-kernel, Stelian Nirlu,
Nicolas Schichan, Hideaki YOSHIFUJI, netdev, linux-kernel,
David S. Miller, Mircea
In-Reply-To: <CAMEtUuy0mpdUHJjztK31mHjNVahnoZ8CHo2sLLyJmt=p5+gq0w@mail.gmail.com>
* Alexei Starovoitov <ast@plumgrid.com> wrote:
> >> #else
> >> +#include <linux/slab.h>
> >
> > Inlines in the middle of header files are generally frowned upon.
> >
> > The standard pattern is to put them at the top, that way it's easier to
> > see the dependencies and there's also less .config dependent inclusion,
> > which makes header hell cleanup work easier.
>
> Agree. I only followed the style that is already in filter.h 20 lines above.
>
> #ifdef CONFIG_BPF_JIT
> #include <stdarg.h>
> #include <linux/linkage.h>
> #include <linux/printk.h>
>
> as part of the cleanup can move all of them to the top. In the separate commit?
Yeah, sure, that's fine.
> >> struct sk_filter *fp;
> >> unsigned int fsize = sizeof(struct sock_filter) * fprog->len;
> >> + unsigned int sk_fsize = max_t(u32, fsize, sizeof(struct work_struct))
> >> + + sizeof(*fp);
> >
> > Using the structure definition I suggested, this could be replaced with
> > the more obvious:
> >
> > unsigned int sk_fsize = max(fsize, sizeof(*fp));
>
> with helper function it's even cleaner. Fixed in V4
So my thought was that the helper function is perhaps too trivial and
somewhat obscures the allocation pattern, but yeah. Either way is fine
with me.
> > A couple of questions/suggestions:
> >
> > 1)
> >
> > I took a brief look at arch/x86/net/bpf_jit_comp.c while reviewing this
> > patch.
> >
> > You need to split up bpf_jit_compile(), it's an obscenely large, ~600
> > lines long function. We don't do that in modern, maintainable kernel code.
>
> I had the same thought, therefore in my proposed generalization of bpf:
> http://patchwork.ozlabs.org/patch/279280/
> It is split into two. do_jit() is still a bit large at 400 lines. Can
> split it further.
Yeah, I think as long as you split out the loop iterator into a separate
function it gets much better.
The actual instruction generation code within the iterator looks good in a
single chunk - splitting it up further than that might in fact make it
less readable.
> > 3)
> >
> > It's nice code altogether! Are there any plans to generalize its
> > interfaces, to allow arbitrary bytecode to be used by other kernel
> > subsystems as well? In particular tracing filters could make use of
> > it, but it would also allow safe probe points.
>
> That was exactly the reasons to generalize bpf as I proposed.
Ok, cool :-)
For the x86 bits:
Acked-by: Ingo Molnar <mingo@kernel.org>
Thanks,
Ingo
^ permalink raw reply
* Re: [PATCH] tcp: do not forget FIN in tcp_shifted_skb()
From: Ilpo Järvinen @ 2013-10-04 18:03 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Neal Cardwell, Yuchung Cheng
In-Reply-To: <1380907901.3564.24.camel@edumazet-glaptop.roam.corp.google.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1941 bytes --]
On Fri, 4 Oct 2013, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Yuchung found following problem :
>
> There are bugs in the SACK processing code, merging part in
> tcp_shift_skb_data(), that incorrectly resets or ignores the sacked
> skbs FIN flag. When a receiver first SACK the FIN sequence, and later
> throw away ofo queue (e.g., sack-reneging), the sender will stop
> retransmitting the FIN flag, and hangs forever.
>
> Following packetdrill test can be used to reproduce the bug.
>
> [...snip...]
>
> First, a typo inverted left/right of one OR operation, then
> code forgot to advance end_seq if the merged skb carried FIN.
>
> Bug was added in 2.6.29 by commit 832d11c5cd076ab
> ("tcp: Try to restore large SKBs while SACK processing")
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Acked-by: Neal Cardwell <ncardwell@google.com>
> Cc: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> ---
> net/ipv4/tcp_input.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 25a89ea..113dc5f 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -1284,7 +1284,10 @@ static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
> tp->lost_cnt_hint -= tcp_skb_pcount(prev);
> }
>
> - TCP_SKB_CB(skb)->tcp_flags |= TCP_SKB_CB(prev)->tcp_flags;
> + TCP_SKB_CB(prev)->tcp_flags |= TCP_SKB_CB(skb)->tcp_flags;
> + if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
> + TCP_SKB_CB(prev)->end_seq++;
> +
> if (skb == tcp_highest_sack(sk))
> tcp_advance_highest_sack(sk, skb);
Nice that it was finally found. For some reason my memory tries to say
that it wouldn't have not even tried to merge skbs with FIN but either
I changed that at some point while deving or I just remember wrong.
Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
--
i.
^ permalink raw reply
* Re: [PATCH] tcp: do not forget FIN in tcp_shifted_skb()
From: David Miller @ 2013-10-04 18:17 UTC (permalink / raw)
To: ilpo.jarvinen; +Cc: eric.dumazet, netdev, ncardwell, ycheng
In-Reply-To: <alpine.DEB.2.02.1310042101040.32153@melkinpaasi.cs.helsinki.fi>
From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Fri, 4 Oct 2013 21:03:53 +0300 (EEST)
> On Fri, 4 Oct 2013, Eric Dumazet wrote:
>
>> From: Eric Dumazet <edumazet@google.com>
>>
>> Yuchung found following problem :
>>
>> There are bugs in the SACK processing code, merging part in
>> tcp_shift_skb_data(), that incorrectly resets or ignores the sacked
>> skbs FIN flag. When a receiver first SACK the FIN sequence, and later
>> throw away ofo queue (e.g., sack-reneging), the sender will stop
>> retransmitting the FIN flag, and hangs forever.
>>
>> Following packetdrill test can be used to reproduce the bug.
...
> Nice that it was finally found. For some reason my memory tries to say
> that it wouldn't have not even tried to merge skbs with FIN but either
> I changed that at some point while deving or I just remember wrong.
>
> Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Applied, thanks everyone.
^ permalink raw reply
* [PATCH nf-next] netfilter: xtables: lightweight process control group matching
From: Daniel Borkmann @ 2013-10-04 18:20 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev, Tejun Heo, cgroups
It would be useful e.g. in a server or desktop environment to have
a facility in the notion of fine-grained "per application" or "per
application group" firewall policies. Probably, users in the mobile/
embedded area (e.g. Android based) with different security policy
requirements for application groups could have great benefit from
that as well. For example, with a little bit of configuration effort,
an admin could whitelist well-known applications, and thus block
otherwise unwanted "hard-to-track" applications like [1] from a
user's machine.
Implementation of PID-based matching would not be appropriate
as they frequently change, and child tracking would make that
even more complex and ugly. Cgroups would be a perfect candidate
for accomplishing that as they associate a set of tasks with a
set of parameters for one or more subsystems, in our case the
netfilter subsystem, which, of course, can be combined with other
cgroup subsystems into something more complex.
As mentioned, to overcome this constraint, such processes could
be placed into one or multiple cgroups where different fine-grained
rules can be defined depending on the application scenario, while
e.g. everything else that is not part of that could be dropped (or
vice versa), thus making life harder for unwanted processes to
communicate to the outside world. So, we make use of cgroups here
to track jobs and limit their resources in terms of iptables
policies; in other words, limiting what they are allowed to
communicate.
We have similar cgroup facilities in networking for traffic
classifier, and netprio cgroups. This feature adds a lightweight
cgroup id matching in terms of network security resp. network
traffic isolation as part of netfilter's xtables subsystem.
Minimal, basic usage example (many other iptables options can be
applied obviously):
1) Configuring cgroups:
mkdir /sys/fs/cgroup/net_filter
mount -t cgroup -o net_filter net_filter /sys/fs/cgroup/net_filter
mkdir /sys/fs/cgroup/net_filter/0
echo 1 > /sys/fs/cgroup/net_filter/0/net_filter.fwid
2) Configuring netfilter:
iptables -A OUTPUT -m cgroup ! --cgroup 1 -j DROP
3) Running applications:
ping 208.67.222.222 <pid:1799>
echo 1799 > /sys/fs/cgroup/net_filter/0/tasks
64 bytes from 208.67.222.222: icmp_seq=44 ttl=49 time=11.9 ms
...
ping 208.67.220.220 <pid:1804>
ping: sendmsg: Operation not permitted
...
echo 1804 > /sys/fs/cgroup/net_filter/0/tasks
64 bytes from 208.67.220.220: icmp_seq=89 ttl=56 time=19.0 ms
...
Of course, real-world deployments would make use of cgroups user
space toolsuite, or custom daemons dynamically moving applications
from/to net_filter cgroups.
[1] http://www.blackhat.com/presentations/bh-europe-06/bh-eu-06-biondi/bh-eu-06-biondi-up.pdf
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: cgroups@vger.kernel.org
---
Documentation/cgroups/00-INDEX | 2 +
Documentation/cgroups/net_filter.txt | 27 +++++
include/linux/cgroup_subsys.h | 5 +
include/net/netfilter/xt_cgroup.h | 58 ++++++++++
include/net/sock.h | 3 +
include/uapi/linux/netfilter/Kbuild | 1 +
include/uapi/linux/netfilter/xt_cgroup.h | 11 ++
net/core/scm.c | 2 +
net/core/sock.c | 14 +++
net/netfilter/Kconfig | 8 ++
net/netfilter/Makefile | 1 +
net/netfilter/xt_cgroup.c | 182 +++++++++++++++++++++++++++++++
12 files changed, 314 insertions(+)
create mode 100644 Documentation/cgroups/net_filter.txt
create mode 100644 include/net/netfilter/xt_cgroup.h
create mode 100644 include/uapi/linux/netfilter/xt_cgroup.h
create mode 100644 net/netfilter/xt_cgroup.c
diff --git a/Documentation/cgroups/00-INDEX b/Documentation/cgroups/00-INDEX
index bc461b6..14424d2 100644
--- a/Documentation/cgroups/00-INDEX
+++ b/Documentation/cgroups/00-INDEX
@@ -20,6 +20,8 @@ memory.txt
- Memory Resource Controller; design, accounting, interface, testing.
net_cls.txt
- Network classifier cgroups details and usages.
+net_filter.txt
+ - Network firewalling (netfilter) cgroups details and usages.
net_prio.txt
- Network priority cgroups details and usages.
resource_counter.txt
diff --git a/Documentation/cgroups/net_filter.txt b/Documentation/cgroups/net_filter.txt
new file mode 100644
index 0000000..0e21822
--- /dev/null
+++ b/Documentation/cgroups/net_filter.txt
@@ -0,0 +1,27 @@
+Netfilter cgroup
+----------------
+
+The netfilter cgroup provides an interface to aggregate jobs
+to a particular netfilter tag, that can be used to apply
+various iptables/netfilter policies for those jobs in order
+to limit resources/abilities for network communication.
+
+Creating a net_filter cgroups instance creates a net_filter.fwid
+file. The value of net_filter.fwid is initialized to 0 on
+default (so only global iptables/netfilter policies apply).
+You can write a unique decimal fwid tag into net_filter.fwid
+file, and use that tag along with iptables' --cgroup option.
+
+Minimal/basic usage example:
+
+1) Configuring cgroup:
+
+ mkdir /sys/fs/cgroup/net_filter
+ mount -t cgroup -o net_filter net_filter /sys/fs/cgroup/net_filter
+ mkdir /sys/fs/cgroup/net_filter/0
+ echo 1 > /sys/fs/cgroup/net_filter/0/net_filter.fwid
+ echo [pid] > /sys/fs/cgroup/net_filter/0/tasks
+
+2) Configuring netfilter:
+
+ iptables -A OUTPUT -m cgroup ! --cgroup 1 -p tcp --dport 80 -j DROP
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index b613ffd..ef58217 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -50,6 +50,11 @@ SUBSYS(net_prio)
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
SUBSYS(hugetlb)
#endif
+
+#if IS_SUBSYS_ENABLED(CONFIG_NETFILTER_XT_MATCH_CGROUP)
+SUBSYS(net_filter)
+#endif
+
/*
* DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
*/
diff --git a/include/net/netfilter/xt_cgroup.h b/include/net/netfilter/xt_cgroup.h
new file mode 100644
index 0000000..b2c702f
--- /dev/null
+++ b/include/net/netfilter/xt_cgroup.h
@@ -0,0 +1,58 @@
+#ifndef _XT_CGROUP_H
+#define _XT_CGROUP_H
+
+#include <linux/types.h>
+#include <linux/cgroup.h>
+#include <linux/hardirq.h>
+#include <linux/rcupdate.h>
+
+#if IS_ENABLED(CONFIG_NETFILTER_XT_MATCH_CGROUP)
+struct cgroup_nf_state {
+ struct cgroup_subsys_state css;
+ u32 fwid;
+};
+
+void sock_update_fwid(struct sock *sk);
+
+#if IS_BUILTIN(CONFIG_NETFILTER_XT_MATCH_CGROUP)
+static inline u32 task_fwid(struct task_struct *p)
+{
+ u32 fwid;
+
+ if (in_interrupt())
+ return 0;
+
+ rcu_read_lock();
+ fwid = container_of(task_css(p, net_filter_subsys_id),
+ struct cgroup_nf_state, css)->fwid;
+ rcu_read_unlock();
+
+ return fwid;
+}
+#elif IS_MODULE(CONFIG_NETFILTER_XT_MATCH_CGROUP)
+static inline u32 task_fwid(struct task_struct *p)
+{
+ struct cgroup_subsys_state *css;
+ u32 fwid = 0;
+
+ if (in_interrupt())
+ return 0;
+
+ rcu_read_lock();
+ css = task_css(p, net_filter_subsys_id);
+ if (css)
+ fwid = container_of(css, struct cgroup_nf_state, css)->fwid;
+ rcu_read_unlock();
+
+ return fwid;
+}
+#endif
+#else /* !CONFIG_NETFILTER_XT_MATCH_CGROUP */
+static inline u32 task_fwid(struct task_struct *p)
+{
+ return 0;
+}
+
+#define sock_update_fwid(sk)
+#endif /* CONFIG_NETFILTER_XT_MATCH_CGROUP */
+#endif /* _XT_CGROUP_H */
diff --git a/include/net/sock.h b/include/net/sock.h
index e3bf213..f7da4b4 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -387,6 +387,9 @@ struct sock {
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
__u32 sk_cgrp_prioidx;
#endif
+#if IS_ENABLED(CONFIG_NETFILTER_XT_MATCH_CGROUP)
+ __u32 sk_cgrp_fwid;
+#endif
struct pid *sk_peer_pid;
const struct cred *sk_peer_cred;
long sk_rcvtimeo;
diff --git a/include/uapi/linux/netfilter/Kbuild b/include/uapi/linux/netfilter/Kbuild
index 1749154..94a4890 100644
--- a/include/uapi/linux/netfilter/Kbuild
+++ b/include/uapi/linux/netfilter/Kbuild
@@ -37,6 +37,7 @@ header-y += xt_TEE.h
header-y += xt_TPROXY.h
header-y += xt_addrtype.h
header-y += xt_bpf.h
+header-y += xt_cgroup.h
header-y += xt_cluster.h
header-y += xt_comment.h
header-y += xt_connbytes.h
diff --git a/include/uapi/linux/netfilter/xt_cgroup.h b/include/uapi/linux/netfilter/xt_cgroup.h
new file mode 100644
index 0000000..43acb7e
--- /dev/null
+++ b/include/uapi/linux/netfilter/xt_cgroup.h
@@ -0,0 +1,11 @@
+#ifndef _UAPI_XT_CGROUP_H
+#define _UAPI_XT_CGROUP_H
+
+#include <linux/types.h>
+
+struct xt_cgroup_info {
+ __u32 id;
+ __u32 invert;
+};
+
+#endif /* _UAPI_XT_CGROUP_H */
diff --git a/net/core/scm.c b/net/core/scm.c
index b442e7e..f08672a 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -36,6 +36,7 @@
#include <net/sock.h>
#include <net/compat.h>
#include <net/scm.h>
+#include <net/netfilter/xt_cgroup.h>
#include <net/cls_cgroup.h>
@@ -290,6 +291,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
/* Bump the usage count and install the file. */
sock = sock_from_file(fp[i], &err);
if (sock) {
+ sock_update_fwid(sock->sk);
sock_update_netprioidx(sock->sk);
sock_update_classid(sock->sk);
}
diff --git a/net/core/sock.c b/net/core/sock.c
index 2bd9b3f..524a376 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -125,6 +125,7 @@
#include <linux/skbuff.h>
#include <net/net_namespace.h>
#include <net/request_sock.h>
+#include <net/netfilter/xt_cgroup.h>
#include <net/sock.h>
#include <linux/net_tstamp.h>
#include <net/xfrm.h>
@@ -1337,6 +1338,18 @@ void sock_update_netprioidx(struct sock *sk)
EXPORT_SYMBOL_GPL(sock_update_netprioidx);
#endif
+#if IS_ENABLED(CONFIG_NETFILTER_XT_MATCH_CGROUP)
+void sock_update_fwid(struct sock *sk)
+{
+ u32 fwid;
+
+ fwid = task_fwid(current);
+ if (fwid != sk->sk_cgrp_fwid)
+ sk->sk_cgrp_fwid = fwid;
+}
+EXPORT_SYMBOL(sock_update_fwid);
+#endif
+
/**
* sk_alloc - All socket objects are allocated here
* @net: the applicable net namespace
@@ -1363,6 +1376,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
sock_update_classid(sk);
sock_update_netprioidx(sk);
+ sock_update_fwid(sk);
}
return sk;
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 6e839b6..d276ff4 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -806,6 +806,14 @@ config NETFILTER_XT_MATCH_BPF
To compile it as a module, choose M here. If unsure, say N.
+config NETFILTER_XT_MATCH_CGROUP
+ tristate '"control group" match support'
+ depends on NETFILTER_ADVANCED
+ depends on CGROUPS
+ ---help---
+ Socket/process control group matching allows you to match locally
+ generated packets based on which control group processes belong to.
+
config NETFILTER_XT_MATCH_CLUSTER
tristate '"cluster" match support'
depends on NF_CONNTRACK
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile
index c3a0a12..12f014f 100644
--- a/net/netfilter/Makefile
+++ b/net/netfilter/Makefile
@@ -124,6 +124,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o
obj-$(CONFIG_NETFILTER_XT_MATCH_NFACCT) += xt_nfacct.o
obj-$(CONFIG_NETFILTER_XT_MATCH_OSF) += xt_osf.o
obj-$(CONFIG_NETFILTER_XT_MATCH_OWNER) += xt_owner.o
+obj-$(CONFIG_NETFILTER_XT_MATCH_CGROUP) += xt_cgroup.o
obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o
obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o
obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o
diff --git a/net/netfilter/xt_cgroup.c b/net/netfilter/xt_cgroup.c
new file mode 100644
index 0000000..86be16d
--- /dev/null
+++ b/net/netfilter/xt_cgroup.c
@@ -0,0 +1,182 @@
+/*
+ * Xtables module to match the process control group.
+ *
+ * Might be used to implement individual "per-application" firewall
+ * policies (in contrast to global policies) based on control groups.
+ *
+ * (C) 2013 Daniel Borkmann <dborkman@redhat.com>
+ * (C) 2013 Thomas Graf <tgraf@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/skbuff.h>
+#include <linux/module.h>
+#include <linux/file.h>
+#include <linux/cgroup.h>
+#include <linux/fdtable.h>
+#include <linux/netfilter/x_tables.h>
+#include <linux/netfilter/xt_cgroup.h>
+#include <net/netfilter/xt_cgroup.h>
+#include <net/sock.h>
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Daniel Borkmann <dborkman@redhat.com>");
+MODULE_DESCRIPTION("Xtables: process control group matching");
+MODULE_ALIAS("ipt_cgroup");
+MODULE_ALIAS("ip6t_cgroup");
+
+static int cgroup_mt_check(const struct xt_mtchk_param *par)
+{
+ struct xt_cgroup_info *info = par->matchinfo;
+
+ if (info->invert & ~1)
+ return -EINVAL;
+
+ return info->id ? 0 : -EINVAL;
+}
+
+static bool
+cgroup_mt(const struct sk_buff *skb, struct xt_action_param *par)
+{
+ const struct xt_cgroup_info *info = par->matchinfo;
+
+ if (skb->sk == NULL)
+ return false;
+
+ return (info->id == skb->sk->sk_cgrp_fwid) ^ info->invert;
+}
+
+static struct xt_match cgroup_mt_reg __read_mostly = {
+ .name = "cgroup",
+ .revision = 0,
+ .family = NFPROTO_UNSPEC,
+ .checkentry = cgroup_mt_check,
+ .match = cgroup_mt,
+ .matchsize = sizeof(struct xt_cgroup_info),
+ .me = THIS_MODULE,
+ .hooks = (1 << NF_INET_LOCAL_OUT) |
+ (1 << NF_INET_POST_ROUTING),
+};
+
+static inline struct cgroup_nf_state *
+css_nf_state(struct cgroup_subsys_state *css)
+{
+ return css ? container_of(css, struct cgroup_nf_state, css) : NULL;
+}
+
+static inline struct cgroup_nf_state *task_nf_state(struct task_struct *p)
+{
+ return css_nf_state(task_css(p, net_filter_subsys_id));
+}
+
+static struct cgroup_subsys_state *
+cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
+{
+ struct cgroup_nf_state *cs;
+
+ cs = kzalloc(sizeof(*cs), GFP_KERNEL);
+ if (!cs)
+ return ERR_PTR(-ENOMEM);
+
+ return &cs->css;
+}
+
+static int cgroup_css_online(struct cgroup_subsys_state *css)
+{
+ struct cgroup_nf_state *cs = css_nf_state(css);
+ struct cgroup_nf_state *parent = css_nf_state(css_parent(css));
+
+ if (parent)
+ cs->fwid = parent->fwid;
+
+ return 0;
+}
+
+static void cgroup_css_free(struct cgroup_subsys_state *css)
+{
+ kfree(css_nf_state(css));
+}
+
+static int cgroup_fwid_update(const void *v, struct file *file, unsigned n)
+{
+ int err;
+ struct socket *sock = sock_from_file(file, &err);
+
+ if (sock)
+ sock->sk->sk_cgrp_fwid = (u32)(unsigned long) v;
+
+ return 0;
+}
+
+static u64 cgroup_fwid_read(struct cgroup_subsys_state *css,
+ struct cftype *cft)
+{
+ return css_nf_state(css)->fwid;
+}
+
+static int cgroup_fwid_write(struct cgroup_subsys_state *css,
+ struct cftype *cft, u64 id)
+{
+ css_nf_state(css)->fwid = (u32) id;
+
+ return 0;
+}
+
+static void cgroup_attach(struct cgroup_subsys_state *css,
+ struct cgroup_taskset *tset)
+{
+ struct task_struct *p;
+ void *v;
+
+ cgroup_taskset_for_each(p, css, tset) {
+ task_lock(p);
+ v = (void *)(unsigned long) task_fwid(p);
+ iterate_fd(p->files, 0, cgroup_fwid_update, v);
+ task_unlock(p);
+ }
+}
+
+static struct cftype net_filter_ss_files[] = {
+ {
+ .name = "fwid",
+ .read_u64 = cgroup_fwid_read,
+ .write_u64 = cgroup_fwid_write,
+ },
+ { }
+};
+
+struct cgroup_subsys net_filter_subsys = {
+ .name = "net_filter",
+ .css_alloc = cgroup_css_alloc,
+ .css_online = cgroup_css_online,
+ .css_free = cgroup_css_free,
+ .attach = cgroup_attach,
+ .subsys_id = net_filter_subsys_id,
+ .base_cftypes = net_filter_ss_files,
+ .module = THIS_MODULE,
+};
+
+static int __init cgroup_mt_init(void)
+{
+ int ret = cgroup_load_subsys(&net_filter_subsys);
+ if (ret)
+ goto out;
+
+ ret = xt_register_match(&cgroup_mt_reg);
+ if (ret)
+ cgroup_unload_subsys(&net_filter_subsys);
+out:
+ return ret;
+}
+
+static void __exit cgroup_mt_exit(void)
+{
+ xt_unregister_match(&cgroup_mt_reg);
+ cgroup_unload_subsys(&net_filter_subsys);
+}
+
+module_init(cgroup_mt_init);
+module_exit(cgroup_mt_exit);
--
1.8.3.1
^ permalink raw reply related
* [PATCH iptables] iptables: add libxt_cgroup frontend
From: Daniel Borkmann @ 2013-10-04 18:21 UTC (permalink / raw)
To: pablo-Cap9r6Oaw4JrovVCs/uTlw
Cc: netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA, Tejun Heo,
cgroups-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <cover.1380892786.git.dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
This patch adds the user space extension/frontend for process matching
based on cgroups from the kernel patch entitled "netfilter: xtables:
lightweight process control group matching".
Signed-off-by: Daniel Borkmann <dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
extensions/libxt_cgroup.c | 67 +++++++++++++++++++++++++++++++++++++
extensions/libxt_cgroup.man | 14 ++++++++
include/linux/netfilter/xt_cgroup.h | 11 ++++++
3 files changed, 92 insertions(+)
create mode 100644 extensions/libxt_cgroup.c
create mode 100644 extensions/libxt_cgroup.man
create mode 100644 include/linux/netfilter/xt_cgroup.h
diff --git a/extensions/libxt_cgroup.c b/extensions/libxt_cgroup.c
new file mode 100644
index 0000000..2ac6f22
--- /dev/null
+++ b/extensions/libxt_cgroup.c
@@ -0,0 +1,67 @@
+#include <stdio.h>
+#include <xtables.h>
+#include <linux/netfilter/xt_cgroup.h>
+
+enum {
+ O_CGROUP = 0,
+};
+
+static void cgroup_help(void)
+{
+ printf(
+"cgroup match options:\n"
+"[!] --cgroup fwid Match cgroup fwid\n");
+}
+
+static const struct xt_option_entry cgroup_opts[] = {
+ {
+ .name = "cgroup",
+ .id = O_CGROUP,
+ .type = XTTYPE_UINT32,
+ .flags = XTOPT_INVERT | XTOPT_MAND | XTOPT_PUT,
+ XTOPT_POINTER(struct xt_cgroup_info, id)
+ },
+ XTOPT_TABLEEND,
+};
+
+static void cgroup_parse(struct xt_option_call *cb)
+{
+ struct xt_cgroup_info *cgroupinfo = cb->data;
+
+ xtables_option_parse(cb);
+ if (cb->invert)
+ cgroupinfo->invert = true;
+}
+
+static void
+cgroup_print(const void *ip, const struct xt_entry_match *match, int numeric)
+{
+ const struct xt_cgroup_info *info = (void *) match->data;
+
+ printf(" cgroup %s%u", info->invert ? "! ":"", info->id);
+}
+
+static void cgroup_save(const void *ip, const struct xt_entry_match *match)
+{
+ const struct xt_cgroup_info *info = (void *) match->data;
+
+ printf("%s --cgroup %u", info->invert ? " !" : "", info->id);
+}
+
+static struct xtables_match cgroup_match = {
+ .family = NFPROTO_UNSPEC,
+ .name = "cgroup",
+ .version = XTABLES_VERSION,
+ .size = XT_ALIGN(sizeof(struct xt_cgroup_info)),
+ .userspacesize = XT_ALIGN(sizeof(struct xt_cgroup_info)),
+ .help = cgroup_help,
+ .print = cgroup_print,
+ .save = cgroup_save,
+ .x6_parse = cgroup_parse,
+ .x6_options = cgroup_opts,
+};
+
+void _init(void)
+{
+ xtables_register_match(&cgroup_match);
+}
diff --git a/extensions/libxt_cgroup.man b/extensions/libxt_cgroup.man
new file mode 100644
index 0000000..7423dc7
--- /dev/null
+++ b/extensions/libxt_cgroup.man
@@ -0,0 +1,14 @@
+.TP
+[\fB!\fP] \fB\-\-cgroup\fP \fIfwid\fP
+Match corresponding cgroup for this packet.
+
+Can be used to assign particular firewall policies for aggregated
+task/jobs on the system. This allows for more fine-grained firewall
+policies that only match for a subset of the system's processes.
+.PP
+Example:
+.PP
+iptables \-A OUTPUT \-p tcp \-\-sport 80 \-m cgroup ! \-\-cgroup 1
+\-j DROP
+.PP
+Available since Linux 3.13.
diff --git a/include/linux/netfilter/xt_cgroup.h b/include/linux/netfilter/xt_cgroup.h
new file mode 100644
index 0000000..943d3a0
--- /dev/null
+++ b/include/linux/netfilter/xt_cgroup.h
@@ -0,0 +1,11 @@
+#ifndef _XT_CGROUP_H
+#define _XT_CGROUP_H
+
+#include <linux/types.h>
+
+struct xt_cgroup_info {
+ __u32 id;
+ __u32 invert;
+};
+
+#endif /* _XT_CGROUP_H */
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] ip: Showing peer of veth type dev in ip link (ip cmd side)
From: Stephen Hemminger @ 2013-10-04 18:23 UTC (permalink / raw)
To: Masatake YAMATO; +Cc: netdev
In-Reply-To: <1380859565-32388-1-git-send-email-yamato@redhat.com>
On Fri, 4 Oct 2013 13:06:05 +0900
Masatake YAMATO <yamato@redhat.com> wrote:
> Implement print_opt method to veth to show peer ifindex
> as ethtool -S does.
>
> A patch submitted with following subject is needed:
>
> veth: Showing peer of veth type dev in ip link (kernel side)
>
> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
NAK, see kernel comments
^ permalink raw reply
* Re: [PATCH] ip: make -resolve addr to print names rather than addresses
From: Stephen Hemminger @ 2013-10-04 18:25 UTC (permalink / raw)
To: Sami Kerola; +Cc: netdev
In-Reply-To: <1380574908-9220-1-git-send-email-kerolasa@iki.fi>
On Mon, 30 Sep 2013 22:01:48 +0100
Sami Kerola <kerolasa@iki.fi> wrote:
> As a system admin I occasionally want to be able to check that all
> interfaces has a name in DNS or /etc/hosts file.
>
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
> ip/ipaddress.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 1c3e4da..d02eaaf 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -636,7 +636,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
> fprintf(fp, " family %d ", ifa->ifa_family);
>
> if (rta_tb[IFA_LOCAL]) {
> - fprintf(fp, "%s", rt_addr_n2a(ifa->ifa_family,
> + fprintf(fp, "%s", format_host(ifa->ifa_family,
> RTA_PAYLOAD(rta_tb[IFA_LOCAL]),
> RTA_DATA(rta_tb[IFA_LOCAL]),
> abuf, sizeof(abuf)));
> @@ -647,7 +647,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
> fprintf(fp, "/%d ", ifa->ifa_prefixlen);
> } else {
> fprintf(fp, " peer %s/%d ",
> - rt_addr_n2a(ifa->ifa_family,
> + format_host(ifa->ifa_family,
> RTA_PAYLOAD(rta_tb[IFA_ADDRESS]),
> RTA_DATA(rta_tb[IFA_ADDRESS]),
> abuf, sizeof(abuf)),
> @@ -657,14 +657,14 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
>
> if (rta_tb[IFA_BROADCAST]) {
> fprintf(fp, "brd %s ",
> - rt_addr_n2a(ifa->ifa_family,
> + format_host(ifa->ifa_family,
> RTA_PAYLOAD(rta_tb[IFA_BROADCAST]),
> RTA_DATA(rta_tb[IFA_BROADCAST]),
> abuf, sizeof(abuf)));
> }
> if (rta_tb[IFA_ANYCAST]) {
> fprintf(fp, "any %s ",
> - rt_addr_n2a(ifa->ifa_family,
> + format_host(ifa->ifa_family,
> RTA_PAYLOAD(rta_tb[IFA_ANYCAST]),
> RTA_DATA(rta_tb[IFA_ANYCAST]),
> abuf, sizeof(abuf)));
This shouldn't be the default. It will change the result that user's expect now.
^ permalink raw reply
* Re: [PATCH] tcp: do not forget FIN in tcp_shifted_skb()
From: Eric Dumazet @ 2013-10-04 18:25 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: David Miller, netdev, Neal Cardwell, Yuchung Cheng
In-Reply-To: <alpine.DEB.2.02.1310042101040.32153@melkinpaasi.cs.helsinki.fi>
On Fri, 2013-10-04 at 21:03 +0300, Ilpo Järvinen wrote:
> Nice that it was finally found. For some reason my memory tries to say
> that it wouldn't have not even tried to merge skbs with FIN but either
> I changed that at some point while deving or I just remember wrong.
>
> Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
>
Thanks for reviewing.
It looks like I chose the opposite strategy in tcp_try_coalesce() :
Not allowing a merge if the FIN was set of the skb.
But really it seems we could have the merge.
I'll test the following before official submission.
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index fa6cf1f..90cf0b3 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4119,9 +4119,6 @@ static bool tcp_try_coalesce(struct sock *sk,
*fragstolen = false;
- if (tcp_hdr(from)->fin)
- return false;
-
/* Its possible this segment overlaps with prior segment in queue */
if (TCP_SKB_CB(from)->seq != TCP_SKB_CB(to)->end_seq)
return false;
@@ -4134,6 +4131,10 @@ static bool tcp_try_coalesce(struct sock *sk,
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRCVCOALESCE);
TCP_SKB_CB(to)->end_seq = TCP_SKB_CB(from)->end_seq;
TCP_SKB_CB(to)->ack_seq = TCP_SKB_CB(from)->ack_seq;
+
+ if (tcp_hdr(from)->fin)
+ tcp_hdr(to)->fin = 1;
+
return true;
}
^ permalink raw reply related
* [PATCH] usbnet: smsc95xx: Add device tree input for MAC address
From: Dan Murphy @ 2013-10-04 18:25 UTC (permalink / raw)
To: steve.glendinning, netdev
Cc: linux-kernel, linux-usb, mugunthanvnm, Dan Murphy
If the smsc95xx does not have a valid MAC address stored within
the eeprom then a random number is generated. The MAC can also
be set by uBoot but the smsc95xx does not have a way to read this.
Create the binding for the smsc95xx so that uBoot can set the MAC
and the code can retrieve the MAC from the modified DTB file.
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
Documentation/devicetree/bindings/net/smsc95xx.txt | 17 ++++++++++++++
drivers/net/usb/smsc95xx.c | 24 ++++++++++++++++++++
2 files changed, 41 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/smsc95xx.txt
diff --git a/Documentation/devicetree/bindings/net/smsc95xx.txt b/Documentation/devicetree/bindings/net/smsc95xx.txt
new file mode 100644
index 0000000..4c37280
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/smsc95xx.txt
@@ -0,0 +1,17 @@
+* Smart Mixed-Signal Connectivity (SMSC) 95xx Controller
+
+Required properties:
+None
+
+Optional properties:
+- mac-address - Read the mac address that was stored by uBoot
+- local-address - Read the mac address that was stored by uBoot
+- address - Read the mac address that was stored by uBoot
+
+Examples:
+
+smsc0: smsc95xx@0 {
+ /* Filled in by U-Boot */
+ mac-address = [ 00 00 00 00 00 00 ];
+};
+
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 3f38ba8..baee0bd 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -31,6 +31,9 @@
#include <linux/crc32.h>
#include <linux/usb/usbnet.h>
#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_net.h>
+
#include "smsc95xx.h"
#define SMSC_CHIPNAME "smsc95xx"
@@ -62,6 +65,8 @@
#define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \
SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3)
+#define SMSC95XX_OF_NAME "/smsc95xx@"
+
struct smsc95xx_priv {
u32 mac_cr;
u32 hash_hi;
@@ -767,6 +772,25 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
static void smsc95xx_init_mac_address(struct usbnet *dev)
{
+
+#ifdef CONFIG_OF
+ struct device_node *ap;
+ const char *mac = NULL;
+ char *of_name = SMSC95XX_OF_NAME;
+
+ sprintf(of_name, "%s%i", SMSC95XX_OF_NAME, dev->udev->dev.id);
+ ap = of_find_node_by_path(of_name);
+ if (ap) {
+ mac = of_get_mac_address(ap);
+ if (is_valid_ether_addr(mac)) {
+ /* Device tree has a mac for this so use that */
+ memcpy(dev->net->dev_addr, mac, ETH_ALEN);
+ netif_dbg(dev, ifup, dev->net, "MAC address read from DTB\n");
+ return;
+ }
+ }
+#endif
+
/* try reading mac address from EEPROM */
if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
dev->net->dev_addr) == 0) {
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] iproute2: ip6gre: update man pages
From: Stephen Hemminger @ 2013-10-04 18:26 UTC (permalink / raw)
To: Dmitry Kozlov; +Cc: Hannes Frederic Sowa, Templin, Fred L, netdev
In-Reply-To: <20131001111834.56f34d28@dima>
On Tue, 1 Oct 2013 11:18:34 +0400
Dmitry Kozlov <xeb@mail.ru> wrote:
> Update man pages with ip6gre info.
>
> Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
applied
^ permalink raw reply
* [PATCH] ip: Showing peer of veth type dev in ip link (ip cmd side)
From: Masatake YAMATO @ 2013-10-04 2:35 UTC (permalink / raw)
To: netdev; +Cc: yamato
Implement print_opt method to veth to show peer ifindex
as ethtool -S does.
A patch submitted with following subject is needed:
veth: Showing peer of veth type dev in ip link (kernel side)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
ip/link_veth.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ip/link_veth.c b/ip/link_veth.c
index 7730f39..bd84815 100644
--- a/ip/link_veth.c
+++ b/ip/link_veth.c
@@ -11,6 +11,7 @@
*/
#include <string.h>
+#include <inttypes.h>
#include <net/if.h>
#include <linux/veth.h>
@@ -57,7 +58,22 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
return argc - 1 - err;
}
+static void veth_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
+{
+ if (!tb)
+ return;
+
+ if (tb[VETH_INFO_PEER] &&
+ RTA_PAYLOAD(tb[VETH_INFO_PEER]) < sizeof(__u64))
+ return;
+
+ fprintf(f, "peer_ifindex %"PRIu64,
+ (uint64_t)rta_getattr_u64(tb[VETH_INFO_PEER]));
+}
+
struct link_util veth_link_util = {
.id = "veth",
+ .maxattr = VETH_INFO_MAX,
.parse_opt = veth_parse_opt,
+ .print_opt = veth_print_opt,
};
--
1.8.3.1
^ permalink raw reply related
* [PATCH] veth: Showing peer of veth type dev in ip link (kernel side)
From: Masatake YAMATO @ 2013-10-04 2:34 UTC (permalink / raw)
To: netdev; +Cc: yamato
ip link has ability to show extra information of net work device if
kernel provides sunh information. With this patch veth driver can
provide its peer ifindex information to ip command via netlink
interface.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
drivers/net/veth.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index eee1f19..54187b9 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -434,6 +434,25 @@ static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = {
[VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) },
};
+static size_t veth_get_size(const struct net_device *dev)
+{
+ return nla_total_size(sizeof(u64)) + /* VETH_INFO_PEER */
+ 0;
+}
+
+static int veth_fill_info(struct sk_buff *skb, const struct net_device *dev)
+{
+ struct veth_priv *priv = netdev_priv(dev);
+ struct net_device *peer = rtnl_dereference(priv->peer);
+ u64 peer_ifindex;
+
+ peer_ifindex = peer ? peer->ifindex : 0;
+ if (nla_put_u64(skb, VETH_INFO_PEER, peer_ifindex))
+ return -EMSGSIZE;
+
+ return 0;
+}
+
static struct rtnl_link_ops veth_link_ops = {
.kind = DRV_NAME,
.priv_size = sizeof(struct veth_priv),
@@ -443,6 +462,8 @@ static struct rtnl_link_ops veth_link_ops = {
.dellink = veth_dellink,
.policy = veth_policy,
.maxtype = VETH_INFO_MAX,
+ .get_size = veth_get_size,
+ .fill_info = veth_fill_info,
};
/*
--
1.8.3.1
^ permalink raw reply related
* pull request: wireless-next 2013-10-04
From: John W. Linville @ 2013-10-04 18:16 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev
[-- Attachment #1: Type: text/plain, Size: 27026 bytes --]
Dave,
Please pull this batch of patches intended for the 3.13 stream!
Regarding the Bluetooth bits, Gustavo says:
"The big work here is from Marcel and Johan. They did a lot of work
in the L2CAP, HCI and MGMT layers. The most important ones are the
addition of a new MGMT command to enable/disable LE advertisement
and the introduction of the HCI user channel to allow applications
to get directly and exclusive access to Bluetooth devices."
As to the ath10k bits, Kalle says:
"Bartosz dropped support for qca98xx hw1.0 hardware from ath10k, it's
just too much to support it. Michal added support for the new firmware
interface. Marek fixed WEP in AP and IBSS mode. Rest of the changes are
minor fixes or cleanups."
And also:
"Major changes are:
* throughput improvements including aligning the RX frames correctly and
optimising HTT layer (Michal)
* remove qca98xx hw1.0 support (Bartosz)
* add support for firmware version 999.999.0.636 (Michal)
* firmware htt statistics support (Kalle)
* fix WEP in AP and IBSS mode (Marek)
* fix a mutex unlock balance in debugfs file (Shafi)
And of course there's a lot of smaller fixes and cleanup."
For the wl12xx bits, Luca says:
"Here are some patches intended for 3.13. Eliad is upstreaming a bunch
of patches that have been pending in the internal tree. Mostly bugfixes
and other small improvements."
Along with that...
Arend and friends bring us a batch of brcmfmac updates, Larry Finger
offers some rtlwifi refactoring, and Sujith sends the usual batch of
ath9k updates. As usual, there are a number of other small updates
from a variety of players as well.
Please let me know if there are any problems!
Thanks,
John
---
The following changes since commit
96f817fedec48b59c9e8b22141cec4e56ad47913:
tcp: shrink tcp6_timewait_sock by one cache line (2013-10-03
17:43:39 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git
for-davem
for you to fetch changes up to
c522ddf1aea71c2cb8ea4876697bc69bdfb5446f:
Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next
into for-davem (2013-10-04 13:26:50 -0400)
----------------------------------------------------------------
Albert Pool (1):
ar5523: Add USB ID of D-Link WUA-2340 rev A1
Amitkumar Karwar (4):
Bluetooth: btmrvl: add btmrvl_send_sync_cmd() function
Bluetooth: btmrvl: get rid of struct btmrvl_cmd
Bluetooth: btmrvl: add setup handler
Bluetooth: btmrvl: add calibration data download support
Arend van Spriel (2):
brcmfmac: fix sparse error 'bad constant expression'
brcmfmac: rework rx path bus interface
Arik Nemtsov (3):
wlcore: ROC on AP channel before auth reply
wlcore: re-enable idle handling
wlcore: always register dummy hardirq
Bartosz Markowski (5):
ath10k: Remove qca98xx hw1.0 support
ath10k: update supported FW build version
ath10k: set the UART baud rate to 19200
ath10k: remove obsolete INIT STATUS definitions
ath10k: define ath10k_debug_start/_stop as static inline
Catalin Iacob (1):
rtlwifi: remove duplicate declarations and macros in headers
Chris Metcalf (1):
ath9k: mark wmi_event_swba as __packed
Dave Jones (1):
ath10k: add missing braces to ath10k_pci_tx_pipe_cleanup
DoHyun Pyun (8):
Bluetooth: Add the definition and structure for Set Reserved LT_ADDR
Bluetooth: Add the definition and structure for Delete Reserved LT_ADDR
Bluetooth: Add the definition and structure for Set CSB Data
Bluetooth: Add the structure for Write Sync Train Parameters
Bluetooth: Add the definition and structure for Set CSB
Bluetooth: Add the definition for Start Synchronization Train
Bluetooth: Add the definition and stcuture for Sync Train Complete
Bluetooth: Add the definition for Slave Page Response Timeout
Eliad Peller (2):
wlcore: remove unsupported channels
wlcore: clarify and fix regulatory domain bit translation
Franky Lin (4):
brcmfmac: sync firmware event list
brcmfmac: add BCM4339 SDIO interface support
brcmfmac: add valid core index check in related functions
brcmfmac: reserve memory for bus layer in sk_buff::cb
Gabor Juhos (1):
rt2x00: rt2800lib: fix band selection and LNA PE control for RT3593 PCIe cards
Gustavo Padovan (1):
Merge git://git.kernel.org/.../bluetooth/bluetooth
Hante Meuleman (1):
brcmfmac: Use fw filename and nvram based of devid for sdio.
Janusz Dziedzic (2):
ath10k: setup peer UAPSD flag correctly
ath10k: check allocation errors in CE
Jingoo Han (21):
wireless: ath10k: remove unnecessary pci_set_drvdata()
mwifiex: Remove casting the return value which is a void pointer
wireless: ath5k: use dev_get_platdata()
wireless: ath9k: use dev_get_platdata()
wireless: brcmfmac: use dev_get_platdata()
wireless: cw1200: use dev_get_platdata()
wireless: libertas: use dev_get_platdata()
wireless: wl1251: use dev_get_platdata()
wireless: wlcore: use dev_get_platdata()
wireless: wl12xx: use dev_get_platdata()
wireless: rtlwifi: remove unnecessary pci_set_drvdata()
wireless: iwlegacy: remove unnecessary pci_set_drvdata()
wireless: adm8211: remove unnecessary pci_set_drvdata()
wireless: airo: remove unnecessary pci_set_drvdata()
wireless: ath10k: remove unnecessary pci_set_drvdata()
wireless: wil6210: remove unnecessary pci_set_drvdata()
wireless: ipw2x00: remove unnecessary pci_set_drvdata()
wireless: mwl8k: remove unnecessary pci_set_drvdata()
wireless: orinoco: remove unnecessary pci_set_drvdata()
wireless: p54pci: remove unnecessary pci_set_drvdata()
wireless: rtl818x: remove unnecessary pci_set_drvdata()
Johan Hedberg (23):
Bluetooth: Remove unused event mask struct
Bluetooth: Fix double error response for l2cap_create_chan_req
Bluetooth: Fix L2CAP error return used for failed channel lookups
Bluetooth: Fix L2CAP Disconnect response for unknown CID
Bluetooth: Fix L2CAP command reject reason
Bluetooth: Fix sending responses to identified L2CAP response packets
Bluetooth: Fix responding to invalid L2CAP signaling commands
Bluetooth: Fix waiting for clearing of BT_SK_SUSPEND flag
Bluetooth: Add synchronization train parameters reading support
Bluetooth: Add event mask page 2 setting support
Bluetooth: Add clarifying comment to bt_sock_wait_state()
Bluetooth: Clean up socket locking in l2cap_sock_recvmsg
Bluetooth: Fix busy return for mgmt_set_powered in some cases
Bluetooth: Move mgmt response convenience functions to a better location
Bluetooth: Use async request for LE enable/disable
Bluetooth: Add new mgmt setting for LE advertising
Bluetooth: Add new mgmt_set_advertising command
Bluetooth: Refactor hci_dev_open to a separate hci_dev_do_open function
Bluetooth: Fix workqueue synchronization in hci_dev_open
Bluetooth: Introduce a new HCI_BREDR_ENABLED flag
Bluetooth: Add a new mgmt_set_bredr command
Bluetooth: Fix REJECTED vs NOT_SUPPORTED mgmt responses
Bluetooth: Fix advertising data flags with disabled BR/EDR
Johannes Berg (1):
iwlwifi: pcie: fix merge damage
John W. Linville (5):
Merge branch 'for-linville' of git://github.com/kvalo/ath
Merge branch 'for-linville' of git://git.kernel.org/.../luca/wl12xx
Merge tag 'for-linville-20131001' of git://github.com/kvalo/ath
Merge branch 'for-upstream' of git://git.kernel.org/.../bluetooth/bluetooth-next
Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next into for-davem
Kalle Valo (22):
ath10k: remove un ar_pci->cacheline_sz field
ath10k: pci: make host_ce_config_wlan[] more readable
ath10k: make target_ce_config_wlan more readable
ath10k: remove void pointer from struct ath10k_pci_compl
ath10k: convert ath10k_pci_reg_read/write32() to take struct ath10k
ath10k: clean up ath10k_ce_completed_send_next_nolock()
ath10k: convert ath10k_pci_wake() to return
ath10k: simplify ath10k_ce_init() wake up handling
ath10k: check chip id from the soc register during probe
ath10k: add chip_id file to debugfs
ath10k: add trace event ath10k_htt_stats
ath10k: implement ath10k_debug_start/stop()
ath10k: add htt_stats_enable debugfs file
ath10k: add BMI log level
ath10k: rename ATH10K_DBG_CORE to BOOT
ath10k: cleanup debug messages in core.c
ath10k: add boot debug messages to pci.c and ce.c
ath10k: add boot debug messages to htc.c
ath10k: add boot messages to htt.c
ath10k: clean mac.c debug messages
ath10k: print phymode as a string
ath10k: delete struct ce_sendlist
Kevin Lo (1):
rt2x00: Fix rf register for RT3070
Larry Finger (16):
rtlwifi: rtl8192cu: Convert driver to use rtl_process_phyinfo()
rtlwifi: rtl8192du: Fix smatch errors in /rtl8192de/dm.c
rtlwifi: rtl8192de: Fix smatch warnings in rtl8192de/hw.c
rtlwifi: rtl8192cu: Fix smatch warning in rtl8192cu/trx.c
rtlwifi: rtl8192_common: Fix smatch errors and warnings in rtl8192c/dm_common.c
rtlwifi: Fix smatch warning in pci.c
rtlwifi: Fix smatch warnings in usb.c
rtlwifi: rtl8188ee: Fix smatch warning in rtl8188ee/hw.c
rtlwifi: Remove all remaining references to variable 'noise' in rtl_stats struct
rtlwifi: Implement a common rtl_phy_scan_operation_backup() routine
rtlwifi: rtl8192cu: Convert to use new rtl_phy_scan_operation_backup() routine
rtlwifi: rtl8192ce: Convert driver to use new rtl_phy_scan_operation_backup() routine
rtlwifi: rtl8192c: Remove rtl8192c_phy_scan_operation_backup()
rtlwifi: rtl8192ce: Convert driver to use new rtl_phy_scan_operation_backup() routine
rtlwifi: rtl8723ae: Convert driver to use new rtl_phy_scan_operation_backup() routine
rtlwifi: rtl8188ee: Convert driver to use new rtl_phy_scan_operation_backup() routine
Marcel Holtmann (35):
Bluetooth: Refactor raw socket filter into more readable code
Bluetooth: Fix handling of getpeername() for HCI sockets
Bluetooth: Fix handling of getsockname() for HCI sockets
Bluetooth: Report error for HCI reset ioctl when device is down
Bluetooth: Fix error handling for HCI socket options
Bluetooth: Restrict ioctls to HCI raw channel sockets
Bluetooth: Introduce user channel flag for HCI devices
Bluetooth: Introduce new HCI socket channel for user operation
Bluetooth: Use devname:vhci module alias for virtual HCI driver
Bluetooth: Add support creating virtual AMP controllers
Bluetooth: Disable upper layer connections when user channel is active
Bluetooth: Use GFP_KERNEL when cloning SKB in a workqueue
Bluetooth: Only schedule raw queue when user channel is active
Bluetooth: Use only 2 bits for controller type information
Bluetooth: Replace BDADDR_LOCAL with BDADDR_NONE
Bluetooth: Provide high speed configuration option
Bluetooth: Send new settings event when changing high speed option
Bluetooth: Require CAP_NET_ADMIN for HCI User Channel operation
Bluetooth: Enable -D__CHECK_ENDIAN__ for sparse by default
Bluetooth: Restrict disabling of HS when controller is powered off
Bluetooth: Add management command for setting static address
Bluetooth: Increment management interface revision
Bluetooth: Fix memory leak with L2CAP signal channels
Bluetooth: Restrict SSP setting changes to BR/EDR enabled controllers
Bluetooth: Allow setting static address even if LE is disabled
Bluetooth: Restrict loading of link keys to BR/EDR capable controllers
Bluetooth: Restrict loading of long term keys to LE capable controllers
Bluetooth: Allow changing device class when BR/EDR is disabled
Bluetooth: Fix switch statement order for L2CAP fixed channels
Bluetooth: Don't copy L2CAP LE signalling to raw sockets
Bluetooth: SMP packets are only valid on LE connections
Bluetooth: L2CAP connectionless channels are only valid for BR/EDR
Bluetooth: Drop packets on ATT fixed channel on BR/EDR
Bluetooth: Check minimum length of SMP packets
Bluetooth: Only one command per L2CAP LE signalling is supported
Marek Puzyniak (1):
ath10k: fix WEP in AP and IBSS mode
Michal Kazior (36):
ath10k: clean up monitor start code
ath10k: use sizeof(*var) in kmalloc
ath10k: clean up PCI completion states
ath10k: print errcode when CE ring setup fails
ath10k: fix HTT service setup
ath10k: implement 802.3 SNAP rx decap type A-MSDU handling
ath10k: plug possible memory leak in WMI
ath10k: add support for firmware newer than 636
ath10k: add support for HTT 3.0
ath10k: use inline ce_state structure
ath10k: remove ce_op_state
ath10k: remove unused ce_attr parameters
ath10k: rename hif_ce_pipe_info to ath10k_pci_pipe
ath10k: rename ce_state to ath10k_ce_pipe
ath10k: rename ce_ring_state to ath10k_ce_ring
ath10k: prevent CE from looping indefinitely
ath10k: simplify HTC credits calculation
ath10k: add HTC TX credits replenishing notification
ath10k: make WMI commands block by design
ath10k: simplify HTC command submitting
ath10k: improve beacon submission latency
ath10k: remove wmi pending count limit
ath10k: remove wmi event worker thread
ath10k: fix tracing build for ath10k_wmi_cmd
ath10k: fix num_sends_allowed replenishing
ath10k: use num_pending_tx instead of msdu id bitmap
ath10k: avoid needless memset on TX path
ath10k: decouple HTT TX completions
ath10k: cleanup HTT TX functions
ath10k: use msdu headroom to store txfrag
ath10k: report A-MSDU subframes individually
ath10k: document decap modes
ath10k: cleanup RX decap handling
ath10k: fix Native Wifi decap mode RX
ath10k: align RX frames properly
ath10k: replenish HTT RX buffers in a tasklet
Mohammed Shafi Shajakhan (1):
ath10k: Fix mutex unlock balance
Peter Senna Tschudin (2):
Bluetooth: Fix assignment of 0/1 to bool variables
wireless: rtlwifi: Replace variable with a break
Sachin Kamat (1):
net: ath9k: Use NULL instead of false
Stanislaw Gruszka (2):
rt2800: comment enable radio initialization sequence
rt2800: add support for radio chip RF3070
Sujith Manoharan (21):
ath10k: Calculate correct peer PHY mode for VHT
ath9k: Update initvals for AR9565 1.0
ath9k: Bypass EEPROM for diversity cap for AR9565
ath9k: Fix antenna diversity init for AR9565
ath9k: Use correct RX gain table for AR9565
ath9k: Add support for AR9565 v1.0.1 LNA diversity
ath9k: Enable antenna diversity for WB335
ath9k: Identify CUS252 cards
ath9k: Identify WB335 Antenna configuration
ath9k: Fix regulatory compliance for AR9462/AR9565
ath9k: Add and use initvals for channel 14
ath9k: Update AR9485 1.1 initvals
ath9k: Add DELL 1707 to supported card table
ath9k: Fix calibration for AR9462
ath9k: Fix issue with parsing malformed CFP IE
ath9k: Handle abnormal NAV in AP mode
ath9k: Use bitops for calibration flags
ath9k: Fix PeakDetect calibration for AR9462
ath9k: Fix NF calibration for single stream cards
ath9k: Handle FATAL interrupts correctly
ath9k: Remove incorrect diversity initialization
Victor Goldenshtein (4):
wlcore: cleanup scan debug prints
wlcore: fix unsafe dereference of the wlvif
wl18xx: fix boot process in high temperature environment
wl18xx: print new RDL versions during boot
Xose Vazquez Perez (1):
wireless: rt2x00: rt2800usb: add new devices
Yair Shapira (2):
wlcore: add new plt power-mode: CHIP_AWAKE
wlcore: disable elp sleep while in plt mode
Zefir Kurtisi (1):
ath9k: replace snprintf() with scnprintf()
drivers/bluetooth/Makefile | 2 +
drivers/bluetooth/btmrvl_drv.h | 12 +-
drivers/bluetooth/btmrvl_main.c | 269 ++++++----
drivers/bluetooth/btmrvl_sdio.c | 15 +-
drivers/bluetooth/btmrvl_sdio.h | 2 +
drivers/bluetooth/hci_vhci.c | 170 +++++--
drivers/net/wireless/adm8211.c | 1 -
drivers/net/wireless/airo.c | 1 -
drivers/net/wireless/ath/ar5523/ar5523.c | 1 +
drivers/net/wireless/ath/ath10k/bmi.c | 42 +-
drivers/net/wireless/ath/ath10k/ce.c | 382 ++++++--------
drivers/net/wireless/ath/ath10k/ce.h | 120 +----
drivers/net/wireless/ath/ath10k/core.c | 70 ++-
drivers/net/wireless/ath/ath10k/core.h | 35 +-
drivers/net/wireless/ath/ath10k/debug.c | 144 +++++-
drivers/net/wireless/ath/ath10k/debug.h | 14 +-
drivers/net/wireless/ath/ath10k/htc.c | 241 +++------
drivers/net/wireless/ath/ath10k/htc.h | 5 +-
drivers/net/wireless/ath/ath10k/htt.c | 19 +-
drivers/net/wireless/ath/ath10k/htt.h | 13 +-
drivers/net/wireless/ath/ath10k/htt_rx.c | 314 ++++++------
drivers/net/wireless/ath/ath10k/htt_tx.c | 285 ++++++-----
drivers/net/wireless/ath/ath10k/hw.h | 25 +-
drivers/net/wireless/ath/ath10k/mac.c | 244 +++++----
drivers/net/wireless/ath/ath10k/pci.c | 446 +++++++++-------
drivers/net/wireless/ath/ath10k/pci.h | 73 ++-
drivers/net/wireless/ath/ath10k/rx_desc.h | 24 +-
drivers/net/wireless/ath/ath10k/trace.h | 32 +-
drivers/net/wireless/ath/ath10k/txrx.c | 67 +--
drivers/net/wireless/ath/ath10k/txrx.h | 5 +-
drivers/net/wireless/ath/ath10k/wmi.c | 232 ++++-----
drivers/net/wireless/ath/ath10k/wmi.h | 71 ++-
drivers/net/wireless/ath/ath5k/ahb.c | 15 +-
drivers/net/wireless/ath/ath9k/ahb.c | 4 +-
drivers/net/wireless/ath/ath9k/antenna.c | 36 +-
drivers/net/wireless/ath/ath9k/ar5008_phy.c | 5 +-
drivers/net/wireless/ath/ath9k/ar9002_calib.c | 4 +-
drivers/net/wireless/ath/ath9k/ar9002_phy.c | 3 +-
drivers/net/wireless/ath/ath9k/ar9003_calib.c | 92 +++-
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 34 +-
drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | 2 +
drivers/net/wireless/ath/ath9k/ar9003_hw.c | 5 +
drivers/net/wireless/ath/ath9k/ar9003_mci.c | 6 +-
drivers/net/wireless/ath/ath9k/ar9003_phy.c | 32 +-
drivers/net/wireless/ath/ath9k/ar9003_phy.h | 4 +
drivers/net/wireless/ath/ath9k/ar9003_rtt.c | 58 ++-
drivers/net/wireless/ath/ath9k/ar9485_initvals.h | 218 ++++++--
.../net/wireless/ath/ath9k/ar9565_1p0_initvals.h | 24 +-
drivers/net/wireless/ath/ath9k/ath9k.h | 20 +-
drivers/net/wireless/ath/ath9k/beacon.c | 2 +
drivers/net/wireless/ath/ath9k/calib.c | 14 +-
drivers/net/wireless/ath/ath9k/debug.c | 446 ++++++++--------
drivers/net/wireless/ath/ath9k/debug.h | 12 +-
drivers/net/wireless/ath/ath9k/dfs_debug.c | 25 +-
drivers/net/wireless/ath/ath9k/dfs_pri_detector.c | 2 +-
drivers/net/wireless/ath/ath9k/eeprom_4k.c | 10 +-
drivers/net/wireless/ath/ath9k/eeprom_9287.c | 8 +-
drivers/net/wireless/ath/ath9k/eeprom_def.c | 12 +-
drivers/net/wireless/ath/ath9k/gpio.c | 22 +-
drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 456 ++++++++---------
drivers/net/wireless/ath/ath9k/hw.c | 59 ++-
drivers/net/wireless/ath/ath9k/hw.h | 26 +-
drivers/net/wireless/ath/ath9k/init.c | 20 +
drivers/net/wireless/ath/ath9k/link.c | 12 +-
drivers/net/wireless/ath/ath9k/main.c | 10 +-
drivers/net/wireless/ath/ath9k/pci.c | 195 ++++++-
drivers/net/wireless/ath/ath9k/rc.c | 32 +-
drivers/net/wireless/ath/ath9k/wmi.h | 2 +-
drivers/net/wireless/ath/ath9k/xmit.c | 2 +-
drivers/net/wireless/ath/wil6210/pcie_bus.c | 1 -
.../net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 13 +-
drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 2 -
drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h | 2 +-
.../net/wireless/brcm80211/brcmfmac/dhd_linux.c | 38 +-
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 234 +++++----
drivers/net/wireless/brcm80211/brcmfmac/fweh.h | 5 +-
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | 2 +
.../net/wireless/brcm80211/brcmfmac/sdio_chip.c | 28 +
.../net/wireless/brcm80211/brcmfmac/sdio_chip.h | 8 +
drivers/net/wireless/brcm80211/brcmfmac/usb.c | 5 +-
.../net/wireless/brcm80211/include/brcm_hw_ids.h | 1 +
drivers/net/wireless/cw1200/cw1200_spi.c | 4 +-
drivers/net/wireless/ipw2x00/ipw2200.c | 2 -
drivers/net/wireless/iwlegacy/3945-mac.c | 2 -
drivers/net/wireless/iwlegacy/4965-mac.c | 2 -
drivers/net/wireless/iwlwifi/pcie/trans.c | 8 +-
drivers/net/wireless/libertas/if_spi.c | 2 +-
drivers/net/wireless/mwifiex/pcie.c | 6 +-
drivers/net/wireless/mwl8k.c | 2 -
drivers/net/wireless/orinoco/orinoco_nortel.c | 2 -
drivers/net/wireless/orinoco/orinoco_pci.c | 2 -
drivers/net/wireless/orinoco/orinoco_plx.c | 2 -
drivers/net/wireless/orinoco/orinoco_tmd.c | 2 -
drivers/net/wireless/p54/p54pci.c | 1 -
drivers/net/wireless/rt2x00/rt2800.h | 2 +
drivers/net/wireless/rt2x00/rt2800lib.c | 49 +-
drivers/net/wireless/rt2x00/rt2800usb.c | 17 +-
drivers/net/wireless/rtl818x/rtl8180/dev.c | 1 -
drivers/net/wireless/rtlwifi/base.c | 29 ++
drivers/net/wireless/rtlwifi/base.h | 2 +-
drivers/net/wireless/rtlwifi/efuse.c | 18 +-
drivers/net/wireless/rtlwifi/pci.c | 4 -
drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | 1 +
drivers/net/wireless/rtlwifi/rtl8188ee/phy.c | 28 -
drivers/net/wireless/rtlwifi/rtl8188ee/phy.h | 1 -
drivers/net/wireless/rtlwifi/rtl8188ee/sw.c | 3 +-
drivers/net/wireless/rtlwifi/rtl8188ee/trx.c | 1 -
drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | 25 +-
drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | 30 --
drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h | 4 -
drivers/net/wireless/rtlwifi/rtl8192ce/def.h | 2 -
drivers/net/wireless/rtlwifi/rtl8192ce/phy.h | 4 -
drivers/net/wireless/rtlwifi/rtl8192ce/reg.h | 20 -
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c | 3 +-
drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | 1 -
drivers/net/wireless/rtlwifi/rtl8192cu/mac.c | 187 +------
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 3 +-
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 2 -
drivers/net/wireless/rtlwifi/rtl8192de/dm.c | 8 +-
drivers/net/wireless/rtlwifi/rtl8192de/hw.c | 18 -
drivers/net/wireless/rtlwifi/rtl8192de/phy.c | 28 -
drivers/net/wireless/rtlwifi/rtl8192de/phy.h | 4 -
drivers/net/wireless/rtlwifi/rtl8192de/sw.c | 3 +-
drivers/net/wireless/rtlwifi/rtl8192de/trx.c | 1 -
drivers/net/wireless/rtlwifi/rtl8192se/reg.h | 5 -
drivers/net/wireless/rtlwifi/rtl8192se/trx.c | 1 -
drivers/net/wireless/rtlwifi/rtl8723ae/phy.c | 29 --
drivers/net/wireless/rtlwifi/rtl8723ae/phy.h | 1 -
drivers/net/wireless/rtlwifi/rtl8723ae/sw.c | 3 +-
drivers/net/wireless/rtlwifi/rtl8723ae/trx.c | 1 -
drivers/net/wireless/rtlwifi/usb.c | 6 +-
drivers/net/wireless/rtlwifi/wifi.h | 2 -
drivers/net/wireless/ti/wl1251/spi.c | 2 +-
drivers/net/wireless/ti/wl12xx/main.c | 2 +-
drivers/net/wireless/ti/wl18xx/main.c | 95 +++-
drivers/net/wireless/ti/wl18xx/reg.h | 33 +-
drivers/net/wireless/ti/wlcore/cmd.c | 58 ++-
drivers/net/wireless/ti/wlcore/main.c | 158 +++++-
drivers/net/wireless/ti/wlcore/ps.c | 4 +
drivers/net/wireless/ti/wlcore/scan.c | 27 +-
drivers/net/wireless/ti/wlcore/spi.c | 2 +-
drivers/net/wireless/ti/wlcore/testmode.c | 13 +-
drivers/net/wireless/ti/wlcore/tx.c | 27 +-
drivers/net/wireless/ti/wlcore/tx.h | 3 +
drivers/net/wireless/ti/wlcore/wlcore.h | 2 +
drivers/net/wireless/ti/wlcore/wlcore_i.h | 11 +
include/net/bluetooth/bluetooth.h | 5 +-
include/net/bluetooth/hci.h | 81 ++-
include/net/bluetooth/hci_core.h | 2 +-
include/net/bluetooth/l2cap.h | 1 +
include/net/bluetooth/mgmt.h | 11 +
net/bluetooth/Makefile | 2 +
net/bluetooth/af_bluetooth.c | 41 ++
net/bluetooth/hci_conn.c | 4 +
net/bluetooth/hci_core.c | 189 +++++--
net/bluetooth/hci_event.c | 17 +-
net/bluetooth/hci_sock.c | 204 ++++++--
net/bluetooth/l2cap_core.c | 162 +++---
net/bluetooth/l2cap_sock.c | 20 +-
net/bluetooth/mgmt.c | 562 ++++++++++++++++-----
net/bluetooth/rfcomm/sock.c | 7 +-
net/bluetooth/smp.c | 15 +-
162 files changed, 4802 insertions(+), 3186 deletions(-)
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] ip: Showing peer of veth type dev in ip link (ip cmd side)
From: Masatake YAMATO @ 2013-10-04 18:42 UTC (permalink / raw)
To: stephen; +Cc: netdev
In-Reply-To: <20131004112350.06818715@nehalam.linuxnetplumber.net>
Thank you those who review my patch and give me comments.
I'll revise the patch.
Forgive me sending the same patches twice accidentally.
Masatake YAMATO
> On Fri, 4 Oct 2013 13:06:05 +0900
> Masatake YAMATO <yamato@redhat.com> wrote:
>
>> Implement print_opt method to veth to show peer ifindex
>> as ethtool -S does.
>>
>> A patch submitted with following subject is needed:
>>
>> veth: Showing peer of veth type dev in ip link (kernel side)
>>
>> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
>
> NAK, see kernel comments
^ permalink raw reply
* Re: [PATCH] ip: make -resolve addr to print names rather than addresses
From: Sami Kerola @ 2013-10-04 18:49 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20131004112530.1cab081c@nehalam.linuxnetplumber.net>
On 4 October 2013 19:25, Stephen Hemminger <stephen@networkplumber.org> wrote:
> On Mon, 30 Sep 2013 22:01:48 +0100 Sami Kerola <kerolasa@iki.fi> wrote:
>
>> As a system admin I occasionally want to be able to check that all
>> interfaces has a name in DNS or /etc/hosts file.
>
> This shouldn't be the default. It will change the result that user's expect now.
Doesn't the format_host() print exactly the same output as before,
unless -r is defined.
I intended resolution to happen when
ip -r addr
is used, but not when the -r is not specified. Or did I somehow messed
up the logic?
--
Sami Kerola
http://www.iki.fi/kerolasa/
^ permalink raw reply
* [PATCH net-next 02/10] qlcnic: Enhance ethtool to display ring indices and interrupt mask
From: Himanshu Madhani @ 2013-10-04 18:30 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Pratik Pujar, himanshu.madhani
In-Reply-To: <cover.1380937706.git.himanshu.madhani@qlogic.com>
From: Pratik Pujar <pratik.pujar@qlogic.com>
o Updated ethtool -d <ethX> option to display ring indices for Transmit(Tx),
Receive(Rx), and Status(St) rings.
o Updated ethtool -d <ethX> option to display ring interrupt mask for Transmit(Tx),
and Status(St) rings.
Signed-off-by: Pratik Pujar <pratik.pujar@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
---
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 8 +--
.../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 61 +++++++++++++++++-----
2 files changed, 51 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 66e94dc..c2df4ce 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -3267,12 +3267,12 @@ int qlcnic_83xx_reg_test(struct qlcnic_adapter *adapter)
return 0;
}
-int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *adapter)
+inline int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *adapter)
{
return (ARRAY_SIZE(qlcnic_83xx_ext_reg_tbl) *
- sizeof(adapter->ahw->ext_reg_tbl)) +
- (ARRAY_SIZE(qlcnic_83xx_reg_tbl) +
- sizeof(adapter->ahw->reg_tbl));
+ sizeof(*adapter->ahw->ext_reg_tbl)) +
+ (ARRAY_SIZE(qlcnic_83xx_reg_tbl) *
+ sizeof(*adapter->ahw->reg_tbl));
}
int qlcnic_83xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index ebe4c86..01edc09 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -187,8 +187,11 @@ static int qlcnic_dev_statistics_len(struct qlcnic_adapter *adapter)
return -1;
}
-#define QLCNIC_RING_REGS_COUNT 20
-#define QLCNIC_RING_REGS_LEN (QLCNIC_RING_REGS_COUNT * sizeof(u32))
+#define QLCNIC_TX_RING_MARKER 0xAAAAAAAA
+#define QLCNIC_RX_RING_MARKER 0XBBBBBBBB
+#define QLCNIC_SDS_RING_MARKER 0XCCCCCCCC
+#define QLCNIC_TX_INTR_NOT_CONFIGURED 0X78563412
+
#define QLCNIC_MAX_EEPROM_LEN 1024
static const u32 diag_registers[] = {
@@ -221,6 +224,14 @@ static const u32 ext_diag_registers[] = {
#define QLCNIC_MGMT_API_VERSION 2
#define QLCNIC_ETHTOOL_REGS_VER 3
+static inline int qlcnic_get_ring_regs_len(struct qlcnic_adapter *adapter)
+{
+ int ring_regs_cnt = (adapter->max_drv_tx_rings * 5) +
+ (adapter->max_rds_rings * 2) +
+ (adapter->max_sds_rings * 3) + 5;
+ return ring_regs_cnt * sizeof(u32);
+}
+
static int qlcnic_get_regs_len(struct net_device *dev)
{
struct qlcnic_adapter *adapter = netdev_priv(dev);
@@ -231,7 +242,9 @@ static int qlcnic_get_regs_len(struct net_device *dev)
else
len = sizeof(ext_diag_registers) + sizeof(diag_registers);
- return QLCNIC_RING_REGS_LEN + len + QLCNIC_DEV_INFO_SIZE + 1;
+ len += ((QLCNIC_DEV_INFO_SIZE + 2) * sizeof(u32));
+ len += qlcnic_get_ring_regs_len(adapter);
+ return len;
}
static int qlcnic_get_eeprom_len(struct net_device *dev)
@@ -493,6 +506,8 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
struct qlcnic_adapter *adapter = netdev_priv(dev);
struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
struct qlcnic_host_sds_ring *sds_ring;
+ struct qlcnic_host_rds_ring *rds_rings;
+ struct qlcnic_host_tx_ring *tx_ring;
u32 *regs_buff = p;
int ring, i = 0;
@@ -512,21 +527,39 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
if (!test_bit(__QLCNIC_DEV_UP, &adapter->state))
return;
- regs_buff[i++] = 0xFFEFCDAB; /* Marker btw regs and ring count*/
-
- regs_buff[i++] = 1; /* No. of tx ring */
- regs_buff[i++] = le32_to_cpu(*(adapter->tx_ring->hw_consumer));
- regs_buff[i++] = readl(adapter->tx_ring->crb_cmd_producer);
-
- regs_buff[i++] = 2; /* No. of rx ring */
- regs_buff[i++] = readl(recv_ctx->rds_rings[0].crb_rcv_producer);
- regs_buff[i++] = readl(recv_ctx->rds_rings[1].crb_rcv_producer);
-
- regs_buff[i++] = adapter->max_sds_rings;
+ /* Marker btw regs and TX ring count */
+ regs_buff[i++] = QLCNIC_TX_RING_MARKER;
+
+ regs_buff[i++] = adapter->max_drv_tx_rings; /* No. of TX ring */
+ for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) {
+ tx_ring = &adapter->tx_ring[ring];
+ regs_buff[i++] = le32_to_cpu(*(tx_ring->hw_consumer));
+ regs_buff[i++] = tx_ring->sw_consumer;
+ regs_buff[i++] = readl(tx_ring->crb_cmd_producer);
+ regs_buff[i++] = tx_ring->producer;
+ if (tx_ring->crb_intr_mask)
+ regs_buff[i++] = readl(tx_ring->crb_intr_mask);
+ else
+ regs_buff[i++] = QLCNIC_TX_INTR_NOT_CONFIGURED;
+ }
+ /* Marker btw TX ring regs and RDS ring count */
+ regs_buff[i++] = QLCNIC_RX_RING_MARKER;
+
+ regs_buff[i++] = adapter->max_rds_rings; /* No. of RX ring */
+ for (ring = 0; ring < adapter->max_rds_rings; ring++) {
+ rds_rings = &recv_ctx->rds_rings[ring];
+ regs_buff[i++] = readl(rds_rings->crb_rcv_producer);
+ regs_buff[i++] = rds_rings->producer;
+ }
+ /* Marker btw RDS ring regs and SDS ring count */
+ regs_buff[i++] = QLCNIC_SDS_RING_MARKER;
+ regs_buff[i++] = adapter->max_sds_rings; /* No. of SDS ring */
for (ring = 0; ring < adapter->max_sds_rings; ring++) {
sds_ring = &(recv_ctx->sds_rings[ring]);
regs_buff[i++] = readl(sds_ring->crb_sts_consumer);
+ regs_buff[i++] = sds_ring->consumer;
+ regs_buff[i++] = readl(sds_ring->crb_intr_mask);
}
}
--
1.8.1.4
^ permalink raw reply related
* [PATCH net-next 04/10] qlcnic: Update ethtool standard pause settings.
From: Himanshu Madhani @ 2013-10-04 18:30 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Jitendra Kalsaria,
himanshu.madhani
In-Reply-To: <cover.1380937706.git.himanshu.madhani@qlogic.com>
From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Update ethtool standard pause parameter settings and display
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 18 +++++++++++++++---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | 3 +++
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index c2df4ce..268fda6 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -3369,10 +3369,21 @@ void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *adapter,
}
config = ahw->port_config;
if (config & QLC_83XX_CFG_STD_PAUSE) {
- if (config & QLC_83XX_CFG_STD_TX_PAUSE)
+ switch (MSW(config)) {
+ case QLC_83XX_TX_PAUSE:
+ pause->tx_pause = 1;
+ break;
+ case QLC_83XX_RX_PAUSE:
+ pause->rx_pause = 1;
+ break;
+ case QLC_83XX_TX_RX_PAUSE:
+ default:
+ /* Backward compatibility for existing
+ * flash definitions
+ */
pause->tx_pause = 1;
- if (config & QLC_83XX_CFG_STD_RX_PAUSE)
pause->rx_pause = 1;
+ }
}
if (QLC_83XX_AUTONEG(config))
@@ -3415,7 +3426,8 @@ int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *adapter,
ahw->port_config &= ~QLC_83XX_CFG_STD_RX_PAUSE;
ahw->port_config |= QLC_83XX_CFG_STD_TX_PAUSE;
} else if (!pause->rx_pause && !pause->tx_pause) {
- ahw->port_config &= ~QLC_83XX_CFG_STD_TX_RX_PAUSE;
+ ahw->port_config &= ~(QLC_83XX_CFG_STD_TX_RX_PAUSE |
+ QLC_83XX_CFG_STD_PAUSE);
}
status = qlcnic_83xx_set_port_config(adapter);
if (status) {
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
index 533e150..2883b57 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
@@ -363,6 +363,9 @@ enum qlcnic_83xx_states {
#define QLC_83XX_LINK_EEE(data) ((data) & BIT_13)
#define QLC_83XX_DCBX(data) (((data) >> 28) & 7)
#define QLC_83XX_AUTONEG(data) ((data) & BIT_15)
+#define QLC_83XX_TX_PAUSE 0x10
+#define QLC_83XX_RX_PAUSE 0x20
+#define QLC_83XX_TX_RX_PAUSE 0x30
#define QLC_83XX_CFG_STD_PAUSE (1 << 5)
#define QLC_83XX_CFG_STD_TX_PAUSE (1 << 20)
#define QLC_83XX_CFG_STD_RX_PAUSE (2 << 20)
--
1.8.1.4
^ permalink raw reply related
* [PATCH net-next 03/10] qlcnic: Firmware dump collection when auto recovery is disabled.
From: Himanshu Madhani @ 2013-10-04 18:30 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Pratik Pujar, himanshu.madhani
In-Reply-To: <cover.1380937706.git.himanshu.madhani@qlogic.com>
From: Pratik Pujar <pratik.pujar@qlogic.com>
o Allow collecting the firmware dump of halted firmware when auto
recovery is disabled.
Signed-off-by: Pratik Pujar <pratik.pujar@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 11 +++++++++++
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 7 ++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
index f09e787..d303fab 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
@@ -818,6 +818,7 @@ static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter)
struct qlcnic_hardware_context *ahw = adapter->ahw;
struct qlcnic_mailbox *mbx = ahw->mailbox;
int ret = 0;
+ u32 owner;
u32 val;
/* Perform NIC configuration based ready state entry actions */
@@ -846,6 +847,10 @@ static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter)
clear_bit(QLC_83XX_MBX_READY, &mbx->status);
set_bit(__QLCNIC_RESETTING, &adapter->state);
qlcnic_83xx_idc_enter_need_reset_state(adapter, 1);
+ } else {
+ owner = qlcnic_83xx_idc_find_reset_owner_id(adapter);
+ if (ahw->pci_func == owner)
+ qlcnic_dump_fw(adapter);
}
return -EIO;
}
@@ -1058,6 +1063,12 @@ void qlcnic_83xx_idc_poll_dev_state(struct work_struct *work)
adapter->ahw->idc.prev_state = adapter->ahw->idc.curr_state;
qlcnic_83xx_periodic_tasks(adapter);
+ /* Do not reschedule if firmaware is in hanged state and auto
+ * recovery is disabled
+ */
+ if ((adapter->flags & QLCNIC_FW_HANG) && !qlcnic_auto_fw_reset)
+ return;
+
/* Re-schedule the function */
if (test_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status))
qlcnic_schedule_work(adapter, qlcnic_83xx_idc_poll_dev_state,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 11bedc5..ffc652f 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -3350,6 +3350,8 @@ done:
static int
qlcnic_check_health(struct qlcnic_adapter *adapter)
{
+ struct qlcnic_hardware_context *ahw = adapter->ahw;
+ struct qlcnic_fw_dump *fw_dump = &ahw->fw_dump;
u32 state = 0, heartbeat;
u32 peg_status;
int err = 0;
@@ -3374,7 +3376,7 @@ qlcnic_check_health(struct qlcnic_adapter *adapter)
if (adapter->need_fw_reset)
goto detach;
- if (adapter->ahw->reset_context && qlcnic_auto_fw_reset)
+ if (ahw->reset_context && qlcnic_auto_fw_reset)
qlcnic_reset_hw_context(adapter);
return 0;
@@ -3417,6 +3419,9 @@ detach:
qlcnic_schedule_work(adapter, qlcnic_detach_work, 0);
QLCDB(adapter, DRV, "fw recovery scheduled.\n");
+ } else if (!qlcnic_auto_fw_reset && fw_dump->enable &&
+ adapter->flags & QLCNIC_FW_RESET_OWNER) {
+ qlcnic_dump_fw(adapter);
}
return 1;
--
1.8.1.4
^ permalink raw reply related
* [PATCH net-next 00/10] qlcnic: fixes and ethtool enhancements.
From: Himanshu Madhani @ 2013-10-04 18:30 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Himanshu Madhani
From: Himanshu Madhani <himanshu.madhani@qlogic.com>
This patch series contains
o patch to fix regression introduced by commit
aa4a1f7df7cbb98797c9f4edfde3c726e2b3841f.
o updates to ethtool for pause settings and enhance
register dump to display mask and ring indices.
o cleanup in DCB code and remove redundant eSwitch enablement command.
o fixed firmware dump collection logic to skip unknown entries.
o fix to register device if adapter is in FAILED state.
Please apply to net-next.
Thanks,
Himanshu
Himanshu Madhani (2):
qlcnic: Validate Tx queue only for 82xx adapters.
qlcnic: update version to 5.3.51
Jitendra Kalsaria (1):
qlcnic: Update ethtool standard pause settings.
Pratik Pujar (2):
qlcnic: Enhance ethtool to display ring indices and interrupt mask
qlcnic: Firmware dump collection when auto recovery is disabled.
Shahed Shaikh (1):
qlcnic: Skip unknown entry type while collecting firmware dump
Sony Chacko (1):
qlcnic: Remove redundant eSwitch enable commands
Sucheta Chakraborty (3):
qlcnic: Print informational messages only once during driver load.
qlcnic: dcb code cleanup and refactoring.
qlcnic: Register netdev in FAILED state for 83xx/84xx
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 102 +-----------
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 72 ++++----
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | 5 +-
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 36 ++--
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c | 48 +++---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 182 ++++++++++-----------
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h | 109 ++++++++++--
.../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 69 +++++---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 2 +-
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 90 +++++-----
.../net/ethernet/qlogic/qlcnic/qlcnic_minidump.c | 41 +++--
.../ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 9 +-
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 8 +-
13 files changed, 417 insertions(+), 356 deletions(-)
--
1.8.1.4
^ permalink raw reply
* [PATCH net-next 01/10] qlcnic: Print informational messages only once during driver load.
From: Himanshu Madhani @ 2013-10-04 18:30 UTC (permalink / raw)
To: davem
Cc: netdev, Dept_NX_Linux_NIC_Driver, Sucheta Chakraborty,
himanshu.madhani
In-Reply-To: <cover.1380937706.git.himanshu.madhani@qlogic.com>
From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 1 +
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 12 -----------
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c | 25 ++++++++++++++++++----
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 1 +
4 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 81bf836..a3c4379 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -1199,6 +1199,7 @@ struct qlcnic_npar_info {
u8 promisc_mode;
u8 offload_flags;
u8 pci_func;
+ u8 mac[ETH_ALEN];
};
struct qlcnic_eswitch {
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 3ca00e0..66e94dc 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -2321,19 +2321,7 @@ int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *adapter,
i++;
memcpy(pci_info->mac + sizeof(u32), &cmd.rsp.arg[i], 2);
i = i + 3;
- if (ahw->op_mode == QLCNIC_MGMT_FUNC)
- dev_info(dev, "id = %d active = %d type = %d\n"
- "\tport = %d min bw = %d max bw = %d\n"
- "\tmac_addr = %pM\n", pci_info->id,
- pci_info->active, pci_info->type,
- pci_info->default_port,
- pci_info->tx_min_bw,
- pci_info->tx_max_bw, pci_info->mac);
}
- if (ahw->op_mode == QLCNIC_MGMT_FUNC)
- dev_info(dev, "Max functions = %d, active functions = %d\n",
- ahw->max_pci_func, ahw->act_pci_func);
-
} else {
dev_err(dev, "Failed to get PCI Info, error = %d\n", err);
err = -EIO;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
index 0248a4c..63cdddf 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
@@ -94,13 +94,30 @@ qlcnic_83xx_config_vnic_buff_descriptors(struct qlcnic_adapter *adapter)
**/
static int qlcnic_83xx_init_mgmt_vnic(struct qlcnic_adapter *adapter)
{
- int err = -EIO;
+ struct qlcnic_hardware_context *ahw = adapter->ahw;
+ struct device *dev = &adapter->pdev->dev;
+ struct qlcnic_npar_info *npar;
+ int i, err = -EIO;
qlcnic_83xx_get_minidump_template(adapter);
+
if (!(adapter->flags & QLCNIC_ADAPTER_INITIALIZED)) {
if (qlcnic_init_pci_info(adapter))
return err;
+ npar = adapter->npars;
+
+ for (i = 0; i < ahw->act_pci_func; i++, npar++) {
+ dev_info(dev, "id = %d active = %d type = %d\n"
+ "\tport = %d min bw = %d max bw = %d\n"
+ "\tmac_addr = %pM\n", npar->pci_func,
+ npar->active, npar->type, npar->phy_port,
+ npar->min_bw, npar->max_bw, npar->mac);
+ }
+
+ dev_info(dev, "Max functions = %d, active functions = %d\n",
+ ahw->max_pci_func, ahw->act_pci_func);
+
if (qlcnic_83xx_set_vnic_opmode(adapter))
return err;
@@ -115,12 +132,12 @@ static int qlcnic_83xx_init_mgmt_vnic(struct qlcnic_adapter *adapter)
return err;
qlcnic_83xx_config_vnic_buff_descriptors(adapter);
- adapter->ahw->msix_supported = !!qlcnic_use_msi_x;
+ ahw->msix_supported = qlcnic_use_msi_x ? 1 : 0;
adapter->flags |= QLCNIC_ADAPTER_INITIALIZED;
qlcnic_83xx_enable_vnic_mode(adapter, 1);
- dev_info(&adapter->pdev->dev, "HAL Version: %d, Management function\n",
- adapter->ahw->fw_hal_version);
+ dev_info(dev, "HAL Version: %d, Management function\n",
+ ahw->fw_hal_version);
return 0;
}
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 21d00a0..11bedc5 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -875,6 +875,7 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
adapter->npars[j].min_bw = pci_info[i].tx_min_bw;
adapter->npars[j].max_bw = pci_info[i].tx_max_bw;
+ memcpy(&adapter->npars[j].mac, &pci_info[i].mac, ETH_ALEN);
j++;
}
--
1.8.1.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox