* Re: [PATCH] net: Add support for handling queueing in hardware
From: David Miller @ 2013-03-22 15:17 UTC (permalink / raw)
To: benmcollins13; +Cc: afleming, linux-kernel, netdev
In-Reply-To: <FE78128C-01DB-4831-ACBE-BA3E3A428BFC@gmail.com>
From: Ben Collins <benmcollins13@gmail.com>
Date: Fri, 22 Mar 2013 10:43:44 -0400
> "For us" is a loose term, when it's more that we are attempting to
> upstream code so our system is supported by a mainline kernel
> instead of having one-off kernels.
If this other person doesn't want their code upstreams, it is absolutely
inappropriate for you to try and force the matter and "do it for them."
^ permalink raw reply
* Re: [PATCH iproute2] libnetlink: check flag NLM_F_DUMP_INTR during dumps
From: Thomas Graf @ 2013-03-22 15:22 UTC (permalink / raw)
To: Eric Dumazet; +Cc: nicolas.dichtel, shemminger, netdev
In-Reply-To: <1363965296.4431.69.camel@edumazet-glaptop>
On 03/22/13 at 08:14am, Eric Dumazet wrote:
> On Fri, 2013-03-22 at 16:03 +0100, Nicolas Dichtel wrote:
> > Le 22/03/2013 15:59, Eric Dumazet a écrit :
> > > On Fri, 2013-03-22 at 15:45 +0100, Nicolas Dichtel wrote:
> > >> When this flag is set, it means that dump was interrupted and result may be
> > >> wrong. Ask user to restart.
> > >>
> > >> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > >
> > >
> > > Do we have a guarantee this will complete eventually, on some hosts
> > > constantly adding removing entries ?
> > >
> >
> > No. You mean it will be better to just print a warning and continue the dump?
>
> I would not break the dump, return the indication, so that caller can
> chose to restart the loop one or two times.
Right, I would do it on an informal level at first. In fact libnl
will do an automatic restart of cache refills but I'm considering
to make it configurable for the application.
^ permalink raw reply
* Re: NULL pointer deref, selinux_socket_unix_may_send+0x34/0x90
From: Paul Moore @ 2013-03-22 15:24 UTC (permalink / raw)
To: Ján Stanček; +Cc: netdev, eparis, sds
In-Reply-To: <CAMpz-8YY1ZFJnx5JAuGu3GBYhkbnYggEAqmVMQoHg7eqKNtyeg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2995 bytes --]
On Thursday, March 21, 2013 11:19:22 PM Ján Stanček wrote:
> Hi,
>
> I'm occasionally seeing a panic early after system booted and while
> systemd is starting other services.
>
> I made a reproducer which is quite reliable on my system (32 CPU Intel)
> and can usually trigger this issue within a minute or two. I can reproduce
> this issue with 3.9.0-rc3 as root or unprivileged user (see call trace
> below).
>
> I'm attaching my reproducer and (experimental) patch, which fixes the
> issue for me.
Hi Jan,
I've heard some similar reports over the past few years but I've never been
able to reproduce the problem and the reporters have never show enough
interest to be able to help me diagnose the problem. Your information about
the size of the machine and the reproducer may help, thank you!
I'll try your reproducer but since I don't happen to have a machine handy that
is the same size as yours would you mind trying the attached (also pasted
inline for others to comment on) patch? I can't promise it will solve your
problem but it was the best idea I could come up with a few years ago when I
first became aware of the problem. I think you are right in that there is a
race condition somewhere with the AF_UNIX sockets shutting down, I'm just not
yet certain where it is ...
Thanks again.
net: fix some potential race issues in the AF_UNIX code
From: Paul Moore <pmoore@redhat.com>
At least one user had reported some odd behavior with UNIX sockets which
could be attributed to some _possible_ race conditions in
unix_release_sock().
Reported-by: Konstantin Boyandin <konstantin@boyandin.com>
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
---
net/unix/af_unix.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 51be64f..886b8da 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -408,8 +408,10 @@ static int unix_release_sock(struct sock *sk, int
embrion)
skpair = unix_peer(sk);
if (skpair != NULL) {
- if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
- unix_state_lock(skpair);
+ unix_state_lock(skpair);
+ if (unix_our_peer(sk, skpair) &&
+ (sk->sk_type == SOCK_STREAM ||
+ sk->sk_type == SOCK_SEQPACKET)) {
/* No more writes */
skpair->sk_shutdown = SHUTDOWN_MASK;
if (!skb_queue_empty(&sk->sk_receive_queue) || embrion)
@@ -417,9 +419,10 @@ static int unix_release_sock(struct sock *sk, int
embrion)
unix_state_unlock(skpair);
skpair->sk_state_change(skpair);
sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP);
- }
- sock_put(skpair); /* It may now die */
+ } else
+ unix_state_unlock(skpair);
unix_peer(sk) = NULL;
+ sock_put(skpair); /* It may now die */
}
/* Try to flush out this socket. Throw out buffers at least */
--
paul moore
www.paul-moore.com
[-- Attachment #2: unix-race_fix.patch --]
[-- Type: text/x-patch, Size: 1555 bytes --]
net: fix some potential race issues in the AF_UNIX code
From: Paul Moore <pmoore@redhat.com>
At least one user had reported some odd behavior with UNIX sockets which
could be attributed to some _possible_ race conditions in
unix_release_sock().
Reported-by: Konstantin Boyandin <konstantin@boyandin.com>
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
---
net/unix/af_unix.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 51be64f..886b8da 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -408,8 +408,10 @@ static int unix_release_sock(struct sock *sk, int embrion)
skpair = unix_peer(sk);
if (skpair != NULL) {
- if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
- unix_state_lock(skpair);
+ unix_state_lock(skpair);
+ if (unix_our_peer(sk, skpair) &&
+ (sk->sk_type == SOCK_STREAM ||
+ sk->sk_type == SOCK_SEQPACKET)) {
/* No more writes */
skpair->sk_shutdown = SHUTDOWN_MASK;
if (!skb_queue_empty(&sk->sk_receive_queue) || embrion)
@@ -417,9 +419,10 @@ static int unix_release_sock(struct sock *sk, int embrion)
unix_state_unlock(skpair);
skpair->sk_state_change(skpair);
sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP);
- }
- sock_put(skpair); /* It may now die */
+ } else
+ unix_state_unlock(skpair);
unix_peer(sk) = NULL;
+ sock_put(skpair); /* It may now die */
}
/* Try to flush out this socket. Throw out buffers at least */
^ permalink raw reply related
* Re: [PATCH] net: Add support for handling queueing in hardware
From: Ben Collins @ 2013-03-22 15:39 UTC (permalink / raw)
To: David Miller; +Cc: afleming, linux-kernel, netdev
In-Reply-To: <20130322.111759.2108472348146991505.davem@davemloft.net>
On Mar 22, 2013, at 11:17 AM, David Miller <davem@davemloft.net> wrote:
> From: Ben Collins <benmcollins13@gmail.com>
> Date: Fri, 22 Mar 2013 10:43:44 -0400
>
>> "For us" is a loose term, when it's more that we are attempting to
>> upstream code so our system is supported by a mainline kernel
>> instead of having one-off kernels.
>
> If this other person doesn't want their code upstreams, it is absolutely
> inappropriate for you to try and force the matter and "do it for them."
If your company had hardware going to production, you'd want it supported in mainline too, I suspect.
Either way, I'll redact this patch because it isn't necessarily needed for the driver to work.
--
Servergy : http://www.servergy.com/
SwissDisk : http://www.swissdisk.com/
Ubuntu : http://www.ubuntu.com/
My Blog : http://ben-collins.blogspot.com/
^ permalink raw reply
* Re: [PATCH] net: Add support for handling queueing in hardware
From: David Miller @ 2013-03-22 15:41 UTC (permalink / raw)
To: benmcollins13; +Cc: afleming, linux-kernel, netdev
In-Reply-To: <9AEAD974-4549-475A-AE15-C92523CD2466@gmail.com>
From: Ben Collins <benmcollins13@gmail.com>
Date: Fri, 22 Mar 2013 11:39:20 -0400
> If your company had hardware going to production, you'd want it
> supported in mainline too, I suspect.
But never against the wishes of the author of the code.
This has firm and strict precedence, for example one of the
implementations block layer encryption was not wanted to be merged by
the author, and Linus reverted it.
So if the person who wrote the code doesn't want it upstream, you can't
bypass them against their wishes, ever. It's their code not your's.
^ permalink raw reply
* [PATCH iproute2 v2] libnetlink: check flag NLM_F_DUMP_INTR during dumps
From: Nicolas Dichtel @ 2013-03-22 15:42 UTC (permalink / raw)
To: tgraf; +Cc: shemminger, netdev, eric.dumazet, Nicolas Dichtel
In-Reply-To: <20130322152213.GB11368@casper.infradead.org>
When this flag is set, it means that dump was interrupted and result may be
wrong. Inform the user and let him choose to restart or not.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
v2: do not stop the dump, only display a warning
lib/libnetlink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index f262959..1a882b2 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -230,6 +230,10 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth,
h->nlmsg_seq != rth->dump)
goto skip_it;
+ if (h->nlmsg_flags & NLM_F_DUMP_INTR)
+ fprintf(stderr,
+ "Dump was interrupted and may be wrong.\n");
+
if (h->nlmsg_type == NLMSG_DONE) {
found_done = 1;
break; /* process next filter */
--
1.8.0.1
^ permalink raw reply related
* Re: NULL pointer deref, selinux_socket_unix_may_send+0x34/0x90
From: Ján Stanček @ 2013-03-22 15:48 UTC (permalink / raw)
To: Paul Moore; +Cc: netdev, eparis, sds
In-Reply-To: <2355680.noQDWa4NlY@sifl>
[-- Attachment #1: Type: text/plain, Size: 1809 bytes --]
On Fri, Mar 22, 2013 at 4:24 PM, Paul Moore <paul@paul-moore.com> wrote:
> On Thursday, March 21, 2013 11:19:22 PM Ján Stanček wrote:
>> Hi,
>>
>> I'm occasionally seeing a panic early after system booted and while
>> systemd is starting other services.
>>
>> I made a reproducer which is quite reliable on my system (32 CPU Intel)
>> and can usually trigger this issue within a minute or two. I can reproduce
>> this issue with 3.9.0-rc3 as root or unprivileged user (see call trace
>> below).
>>
>> I'm attaching my reproducer and (experimental) patch, which fixes the
>> issue for me.
>
> Hi Jan,
>
> I've heard some similar reports over the past few years but I've never been
> able to reproduce the problem and the reporters have never show enough
> interest to be able to help me diagnose the problem. Your information about
> the size of the machine and the reproducer may help, thank you!
>
> I'll try your reproducer but since I don't happen to have a machine handy that
> is the same size as yours would you mind trying the attached (also pasted
> inline for others to comment on) patch? I can't promise it will solve your
> problem but it was the best idea I could come up with a few years ago when I
> first became aware of the problem. I think you are right in that there is a
> race condition somewhere with the AF_UNIX sockets shutting down, I'm just not
> yet certain where it is ...
Hi Paul,
thanks for reply, I'll try your patch and let you know.
I'm not certain about cause either, but patch I sent in last email
makes it go away,
so maybe that can help in some way.
I made a v2 of the reproducer (attached), which triggers the issue a lot faster
on 2 systems I tried (32 CPU and 4 CPU systems) - just in couple of seconds.
Regards,
Jan
[-- Attachment #2: selinux_socket_unix_may_send_v2.c --]
[-- Type: text/x-csrc, Size: 3762 bytes --]
/*
* reproducer for Bug 887683 v2
* unable to handle kernel NULL in selinux_socket_unix_may_send
*
* This reproducer is based on systemd/journald sources,
* it's possible there is way to make it even more simple, but
* since I was able to trigger the Bug, I rather kept it as it is.
*
* jstancek@redhat.com
*
* gcc selinux_socket_unix_may_send.c; ./a.out
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <net/if.h>
#include <netinet/in.h>
#include <linux/netlink.h>
#include <unistd.h>
#define offsetof(type, member) __builtin_offsetof (type, member)
#define SNDBUF_SIZE (8*1024*1024)
int pipefd[2];
union sockaddr_union {
struct sockaddr sa;
struct sockaddr_in in4;
struct sockaddr_in6 in6;
struct sockaddr_un un;
struct sockaddr_nl nl;
struct sockaddr_storage storage;
};
int fd_inc_sndbuf(int fd, size_t n) {
int r, value;
socklen_t l = sizeof(value);
r = getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &value, &l);
if (r >= 0 &&
l == sizeof(value) &&
(size_t) value >= n*2)
return 0;
value = (int) n;
r = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &value, sizeof(value));
if (r < 0)
return -errno;
return 1;
}
int client(int id, int loops)
{
int fd;
char data[1024] = "123456789";
struct iovec *w;
int i;
int j = 0;
int n = 1;
int ret;
int dummy;
struct sockaddr_un sa;
struct msghdr mh;
union {
struct cmsghdr cmsghdr;
uint8_t buf[CMSG_SPACE(sizeof(int))];
} control;
memset(&sa, 0, sizeof(sa));
sa.sun_family = AF_UNIX;
snprintf(sa.sun_path, sizeof(sa.sun_path), "/tmp/socket_test%d", id);
w = malloc(sizeof(struct iovec) * n * 5 + 3);
w[j].iov_base = data;
w[j].iov_len = 10;
j++;
memset(&control, 0, sizeof(control));
mh.msg_control = &control;
mh.msg_controllen = sizeof(control);
memset(&mh, 0, sizeof(mh));
mh.msg_name = &sa;
mh.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(sa.sun_path);
mh.msg_iov = w;
mh.msg_iovlen = 1;
for (i = 0; i < loops; i++) {
fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0)
return -errno;
ret = fd_inc_sndbuf(fd, SNDBUF_SIZE);
if (ret < 0)
perror("fd_inc_sndbuf");
write(pipefd[1], &dummy, 1);
ret = sendmsg(fd, &mh, MSG_NOSIGNAL);
/*if (ret < 0)
perror("ret:");
else
printf("ret: %d\n", ret);*/
close(fd);
}
}
int server(int id, int loops)
{
int fd, ret, status;
union sockaddr_union sa;
int dummy;
int i;
sa.un.sun_family = AF_UNIX;
snprintf(sa.un.sun_path, sizeof(sa.un.sun_path), "/tmp/socket_test%d", id);
for (i = 0; i < loops; i++) {
unlink(sa.un.sun_path);
fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
if (fd < 0)
perror("socket");
int one = 1;
ret = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one));
if (ret < 0)
perror("setsockopt 1");
ret = setsockopt(fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
if (ret < 0)
perror("setsockopt 2");
ret = setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP, &one, sizeof(one));
if (ret < 0)
perror("setsockopt 3");
ret = bind(fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
if (ret < 0)
perror("bind");
read(pipefd[0], &dummy, 1);
close(fd);
}
}
void child(int loops)
{
int i;
int mypid = getpid();
if (pipe(pipefd) < 0) {
perror("pipe");
return;
}
if (fork() == 0) {
client(mypid, loops);
exit(0);
} else {
server(mypid, loops);
}
}
int main()
{
int i = 0;
int cpus = sysconf(_SC_NPROCESSORS_ONLN)*4;
int status;
for (i = 0; i < cpus; i++) {
if (fork() == 0) {
child(100000);
exit(0);
}
}
for (i = 0; i < cpus; i++) {
wait(&status);
}
printf("Done.\n");
return 0;
}
^ permalink raw reply
* Re: [PATCH iproute2 v2] libnetlink: check flag NLM_F_DUMP_INTR during dumps
From: Eric Dumazet @ 2013-03-22 15:49 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: tgraf, shemminger, netdev
In-Reply-To: <1363966944-4420-1-git-send-email-nicolas.dichtel@6wind.com>
On Fri, 2013-03-22 at 16:42 +0100, Nicolas Dichtel wrote:
> When this flag is set, it means that dump was interrupted and result may be
> wrong. Inform the user and let him choose to restart or not.
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
>
> v2: do not stop the dump, only display a warning
>
> lib/libnetlink.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lib/libnetlink.c b/lib/libnetlink.c
> index f262959..1a882b2 100644
> --- a/lib/libnetlink.c
> +++ b/lib/libnetlink.c
> @@ -230,6 +230,10 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth,
> h->nlmsg_seq != rth->dump)
> goto skip_it;
>
> + if (h->nlmsg_flags & NLM_F_DUMP_INTR)
> + fprintf(stderr,
> + "Dump was interrupted and may be wrong.\n");
> +
> if (h->nlmsg_type == NLMSG_DONE) {
> found_done = 1;
> break; /* process next filter */
How many times this will be displayed ?
Please try to cook something that wont emit one warning per 8KB fetched
from the kernel ;)
^ permalink raw reply
* Re: [PATCH] net: Add support for handling queueing in hardware
From: Ben Collins @ 2013-03-22 15:53 UTC (permalink / raw)
To: David Miller; +Cc: afleming, linux-kernel, netdev
In-Reply-To: <20130322.114159.2303026992656610194.davem@davemloft.net>
On Mar 22, 2013, at 11:41 AM, David Miller <davem@davemloft.net> wrote:
> From: Ben Collins <benmcollins13@gmail.com>
> Date: Fri, 22 Mar 2013 11:39:20 -0400
>
>> If your company had hardware going to production, you'd want it
>> supported in mainline too, I suspect.
>
> But never against the wishes of the author of the code.
>
> This has firm and strict precedence, for example one of the
> implementations block layer encryption was not wanted to be merged by
> the author, and Linus reverted it.
>
> So if the person who wrote the code doesn't want it upstream, you can't
> bypass them against their wishes, ever. It's their code not your's.
They never made such a statement. The commit (which is publicly available in Freescale's git repo) makes no mention of it being "good enough for our SDK, but don't send upstream". Freescale wants this upstream, but doesn't have the resources because they are embedded focused and gear more toward SDKs to support their SoCs (currently that means a 3.0.x kernel).
Don't accuse me of something I didn't do. Also, if there's a patch that makes my hardware work, but I can't use it because (even though it's open source licensed) the author doesn't want it in mainline, then that is effectively squatting.
We are a hardware company. We've been provided with a driver for the platform we designed by the SoC vendor. It's GPL licensed. We've attempted to get this done by them, but they haven't been able to, so we are exercising prudence and making sure our platform is supported in mainline. I don't see where that's any different than tons of other patches that go into the kernel.
If it makes everyone feel better, I'll limit attribution in the patches to just an Originally-By: line.
--
Servergy : http://www.servergy.com/
SwissDisk : http://www.swissdisk.com/
Ubuntu : http://www.ubuntu.com/
My Blog : http://ben-collins.blogspot.com/
^ permalink raw reply
* Re: [PATCH] net: Add support for handling queueing in hardware
From: David Miller @ 2013-03-22 15:59 UTC (permalink / raw)
To: benmcollins13; +Cc: afleming, linux-kernel, netdev
In-Reply-To: <14243FE7-A0A6-4C0C-AEFB-95F19C8898E3@gmail.com>
From: Ben Collins <benmcollins13@gmail.com>
Date: Fri, 22 Mar 2013 11:53:54 -0400
> Also, if there's a patch that makes my hardware work, but I can't
> use it because (even though it's open source licensed) the author
> doesn't want it in mainline, then that is effectively squatting.
This is called respecting the wishes of the author of the code, I'm
sorry if this is a foreign concept for you.
^ permalink raw reply
* [PATCH net-next] ioat/dca: Update DCA BIOS workarounds to use TAINT_FIRMWARE_WORKAROUND
From: Alexander Duyck @ 2013-03-22 16:01 UTC (permalink / raw)
To: netdev, davem
Cc: bhutchings, gospo, david.woodhouse, sassmann, jeffrey.t.kirsher
This patch is meant to be a follow-up for a patch originally submitted under
the title "ioat: Do not enable DCA if tag map is invalid". It was brought to
my attention that the preferred approach for BIOS workarounds is to set the
taint flag for TAINT_FIRMWARE_WORKAROUND for systems that require BIOS
workarounds.
This change makes it so that the DCA workarounds for broken BIOSes will now
use WARN_TAINT_ONCE(1, TAINT_FIRMWARE_WORKAROUND, ...) instead of just
printing a message via dev_err.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
I am submitting this for net-next since that is the path that the original
patch that this is an update to had followed. My apologies for not making
that clear in the original submission.
drivers/dma/ioat/dca.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/ioat/dca.c b/drivers/dma/ioat/dca.c
index 9b04185..9e84d5b 100644
--- a/drivers/dma/ioat/dca.c
+++ b/drivers/dma/ioat/dca.c
@@ -470,8 +470,10 @@ struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase)
}
if (!dca2_tag_map_valid(ioatdca->tag_map)) {
- dev_err(&pdev->dev, "APICID_TAG_MAP set incorrectly by BIOS, "
- "disabling DCA\n");
+ WARN_TAINT_ONCE(1, TAINT_FIRMWARE_WORKAROUND,
+ "%s %s: APICID_TAG_MAP set incorrectly by BIOS, disabling DCA\n",
+ dev_driver_string(&pdev->dev),
+ dev_name(&pdev->dev));
free_dca_provider(dca);
return NULL;
}
@@ -689,7 +691,10 @@ struct dca_provider *ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase)
}
if (dca3_tag_map_invalid(ioatdca->tag_map)) {
- dev_err(&pdev->dev, "APICID_TAG_MAP set incorrectly by BIOS, disabling DCA\n");
+ WARN_TAINT_ONCE(1, TAINT_FIRMWARE_WORKAROUND,
+ "%s %s: APICID_TAG_MAP set incorrectly by BIOS, disabling DCA\n",
+ dev_driver_string(&pdev->dev),
+ dev_name(&pdev->dev));
free_dca_provider(dca);
return NULL;
}
^ permalink raw reply related
* Re: [PATCH] net: Add support for handling queueing in hardware
From: Ben Collins @ 2013-03-22 16:14 UTC (permalink / raw)
To: David Miller; +Cc: afleming, linux-kernel, netdev
In-Reply-To: <20130322.115924.1452021957855498515.davem@davemloft.net>
On Mar 22, 2013, at 11:59 AM, David Miller <davem@davemloft.net> wrote:
> From: Ben Collins <benmcollins13@gmail.com>
> Date: Fri, 22 Mar 2013 11:53:54 -0400
>
>> Also, if there's a patch that makes my hardware work, but I can't
>> use it because (even though it's open source licensed) the author
>> doesn't want it in mainline, then that is effectively squatting.
>
> This is called respecting the wishes of the author of the code, I'm
> sorry if this is a foreign concept for you.
I'm sorry, I thought we were working on open source projects here. If the code isn't encumbered by patents, legal issues or technical problems, and is licensed compatible with the kernel, I just thought it was fair game.
--
Servergy : http://www.servergy.com/
SwissDisk : http://www.swissdisk.com/
Ubuntu : http://www.ubuntu.com/
My Blog : http://ben-collins.blogspot.com/
^ permalink raw reply
* Re: [PATCH] net: Add support for handling queueing in hardware
From: David Miller @ 2013-03-22 16:16 UTC (permalink / raw)
To: benmcollins13; +Cc: afleming, linux-kernel, netdev
In-Reply-To: <0FF79196-E252-4738-BFB5-C0B10F447B33@gmail.com>
From: Ben Collins <benmcollins13@gmail.com>
Date: Fri, 22 Mar 2013 12:14:44 -0400
> I'm sorry, I thought we were working on open source projects
> here. If the code isn't encumbered by patents, legal issues or
> technical problems, and is licensed compatible with the kernel, I
> just thought it was fair game.
This is about being nice to people, rather than exercising your rights
to the maximum possible extent regardless of how that effects other
people.
^ permalink raw reply
* [PATCH net-next 0/5] qlcnic: bug fixes and log enhancement
From: Shahed Shaikh @ 2013-03-22 15:57 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Shahed Shaikh
From: Shahed Shaikh <shahed.shaikh@qlogic.com>
Please apply to net-next.
Thanks,
Shahed
Himanshu Madhani (1):
qlcnic: Log warning message for 83xx adapter in MSI mode.
Manish chopra (1):
qlcnic: Fix configure mailbox interrupt command for 83xx adapter
Shahed Shaikh (3):
qlcnic: change mdelay to msleep
qlcnic: Clear link status when interface is down
qlcnic: Bump up the version to 5.1.38
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 4 ++--
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 3 +--
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 2 +-
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 7 +++++++
4 files changed, 11 insertions(+), 5 deletions(-)
^ permalink raw reply
* [PATCH net-next 1/5] qlcnic: Fix configure mailbox interrupt command for 83xx adapter
From: Shahed Shaikh @ 2013-03-22 15:57 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Manish chopra
In-Reply-To: <1363967877-16812-1-git-send-email-shahed.shaikh@qlogic.com>
From: Manish chopra <manish.chopra@qlogic.com>
o Due to improper data type of variable "type", interrupt resources were
not getting deleted in hardware which was causing resource exhaustion
in hardware. Hence mailbox command fails after some iterations of context change.
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
---
.../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 56c3676..8de8ca5 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -2111,9 +2111,8 @@ int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *adapter,
int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *adapter, bool op_type)
{
int i, index, err;
- bool type;
u8 max_ints;
- u32 val, temp;
+ u32 val, temp, type;
struct qlcnic_cmd_args cmd;
max_ints = adapter->ahw->num_msix - 1;
--
1.5.6
^ permalink raw reply related
* [PATCH net-next 2/5] qlcnic: Log warning message for 83xx adapter in MSI mode.
From: Shahed Shaikh @ 2013-03-22 15:57 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Himanshu Madhani
In-Reply-To: <1363967877-16812-1-git-send-email-shahed.shaikh@qlogic.com>
From: Himanshu Madhani <himanshu.madhani@qlogic.com>
o 83xx adapter does not support MSI interrupts, display
warning whenever module parameter is used to load driver
in MSI mode.
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index c6f9d5e..d980723 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -1923,6 +1923,12 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
module_name(THIS_MODULE),
board_name, adapter->ahw->revision_id);
}
+
+ if (qlcnic_83xx_check(adapter) && !qlcnic_use_msi_x &&
+ !!qlcnic_use_msi)
+ dev_warn(&pdev->dev,
+ "83xx adapter do not support MSI interrupts\n");
+
err = qlcnic_setup_intr(adapter, 0);
if (err) {
dev_err(&pdev->dev, "Failed to setup interrupt\n");
--
1.5.6
^ permalink raw reply related
* [PATCH net-next 3/5] qlcnic: change mdelay to msleep
From: Shahed Shaikh @ 2013-03-22 15:57 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Shahed Shaikh
In-Reply-To: <1363967877-16812-1-git-send-email-shahed.shaikh@qlogic.com>
From: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index a69097c..6428a14 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -655,7 +655,7 @@ void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter)
qlcnic_83xx_config_intrpt(adapter, 0);
}
/* Allow dma queues to drain after context reset */
- mdelay(20);
+ msleep(20);
}
}
--
1.5.6
^ permalink raw reply related
* [PATCH net-next 4/5] qlcnic: Clear link status when interface is down
From: Shahed Shaikh @ 2013-03-22 15:57 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Shahed Shaikh
In-Reply-To: <1363967877-16812-1-git-send-email-shahed.shaikh@qlogic.com>
From: Shahed Shaikh <shahed.shaikh@qlogic.com>
o When interface is down, mailbox command to get context statistics
fails. So restrict driver from issuing get statistics command when
interface is down.
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index d980723..d8b9e3b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -1412,6 +1412,7 @@ void __qlcnic_down(struct qlcnic_adapter *adapter, struct net_device *netdev)
smp_mb();
spin_lock(&adapter->tx_clean_lock);
netif_carrier_off(netdev);
+ adapter->ahw->linkup = 0;
netif_tx_disable(netdev);
qlcnic_free_mac_list(adapter);
--
1.5.6
^ permalink raw reply related
* [PATCH net-next 5/5] qlcnic: Bump up the version to 5.1.38
From: Shahed Shaikh @ 2013-03-22 15:57 UTC (permalink / raw)
To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Shahed Shaikh
In-Reply-To: <1363967877-16812-1-git-send-email-shahed.shaikh@qlogic.com>
From: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 1577799..72bbba0 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -38,8 +38,8 @@
#define _QLCNIC_LINUX_MAJOR 5
#define _QLCNIC_LINUX_MINOR 1
-#define _QLCNIC_LINUX_SUBVERSION 37
-#define QLCNIC_LINUX_VERSIONID "5.1.37"
+#define _QLCNIC_LINUX_SUBVERSION 38
+#define QLCNIC_LINUX_VERSIONID "5.1.38"
#define QLCNIC_DRV_IDC_VER 0x01
#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\
(_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
--
1.5.6
^ permalink raw reply related
* Re: [PATCH net-next 2/2] ipv6: provide addr and netconf dump consistency info
From: Nicolas Dichtel @ 2013-03-22 16:22 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: netdev, davem, junwei.zhang, hongjun.li
In-Reply-To: <1363963360-3603-2-git-send-email-nicolas.dichtel@6wind.com>
Please, drop both patches. If we dump addresses via rtnl_dump_all(), seq is not
reset and thus NLM_F_DUMP_INTR is always set when switching from ipv4 to ipv6
family.
I will send a new patch.
Nicolas
Le 22/03/2013 15:42, Nicolas Dichtel a écrit :
> This patch adds a dev_addr_genid for IPv6. The goal is to use it, combined with
> dev_base_seq to check if a change occurs during a netlink dump.
> If a change is detected, the flag NLM_F_DUMP_INTR is set in the first message
> after the dump was interrupted.
>
> Note that only dump of unicast addresses is checked (multicast and anycast are
> not checked).
>
> Reported-by: Junwei Zhang <junwei.zhang@6wind.com>
> Reported-by: Hongjun Li <hongjun.li@6wind.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> include/net/netns/ipv6.h | 1 +
> net/ipv6/addrconf.c | 8 ++++++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
> index 1242f37..005e2c2 100644
> --- a/include/net/netns/ipv6.h
> +++ b/include/net/netns/ipv6.h
> @@ -71,6 +71,7 @@ struct netns_ipv6 {
> struct fib_rules_ops *mr6_rules_ops;
> #endif
> #endif
> + atomic_t dev_addr_genid;
> };
>
> #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index fa36a67..d0e40d4 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -622,6 +622,8 @@ static int inet6_netconf_dump_devconf(struct sk_buff *skb,
> idx = 0;
> head = &net->dev_index_head[h];
> rcu_read_lock();
> + cb->seq = atomic_read(&net->ipv6.dev_addr_genid) ^
> + net->dev_base_seq;
> hlist_for_each_entry_rcu(dev, head, index_hlist) {
> if (idx < s_idx)
> goto cont;
> @@ -639,6 +641,7 @@ static int inet6_netconf_dump_devconf(struct sk_buff *skb,
> rcu_read_unlock();
> goto done;
> }
> + nl_dump_check_consistent(cb, nlmsg_hdr(skb));
> cont:
> idx++;
> }
> @@ -3875,6 +3878,7 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,
> NLM_F_MULTI);
> if (err <= 0)
> break;
> + nl_dump_check_consistent(cb, nlmsg_hdr(skb));
> }
> break;
> }
> @@ -3932,6 +3936,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
> s_ip_idx = ip_idx = cb->args[2];
>
> rcu_read_lock();
> + cb->seq = atomic_read(&net->ipv6.dev_addr_genid) ^ net->dev_base_seq;
> for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
> idx = 0;
> head = &net->dev_index_head[h];
> @@ -4409,6 +4414,8 @@ errout:
>
> static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
> {
> + struct net *net = dev_net(ifp->idev->dev);
> +
> inet6_ifa_notify(event ? : RTM_NEWADDR, ifp);
>
> switch (event) {
> @@ -4434,6 +4441,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
> dst_free(&ifp->rt->dst);
> break;
> }
> + atomic_inc(&net->ipv6.dev_addr_genid);
> }
>
> static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
>
--
Nicolas DICHTEL
6WIND
R&D Engineer
Tel: +33 1 39 30 92 41
Fax: +33 1 39 30 92 11
nicolas.dichtel@6wind.com
www.6wind.com
www.6windblog.com
Twitter: http://twitter.com/6windsoftware
Ce courriel ainsi que toutes les pièces jointes, est uniquement destiné à son ou
ses destinataires. Il contient des informations confidentielles qui sont la
propriété de 6WIND. Toute révélation, distribution ou copie des informations
qu'il contient est strictement interdite. Si vous avez reçu ce message par
erreur, veuillez immédiatement le signaler à l'émetteur et détruire toutes les
données reçues.
This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and contains information that is confidential and
proprietary to 6WIND. All unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message.
^ permalink raw reply
* Re: [PATCH] net: Add support for handling queueing in hardware
From: Ben Collins @ 2013-03-22 16:23 UTC (permalink / raw)
To: David Miller; +Cc: afleming, linux-kernel, netdev
In-Reply-To: <20130322.121600.1984397550534213180.davem@davemloft.net>
On Mar 22, 2013, at 12:16 PM, David Miller <davem@davemloft.net> wrote:
> From: Ben Collins <benmcollins13@gmail.com>
> Date: Fri, 22 Mar 2013 12:14:44 -0400
>
>> I'm sorry, I thought we were working on open source projects
>> here. If the code isn't encumbered by patents, legal issues or
>> technical problems, and is licensed compatible with the kernel, I
>> just thought it was fair game.
>
> This is about being nice to people, rather than exercising your rights
> to the maximum possible extent regardless of how that effects other
> people.
Right, because a 3-line patch is such a ballsy move on my part. Better restrain myself next time.
--
Servergy : http://www.servergy.com/
SwissDisk : http://www.swissdisk.com/
Ubuntu : http://www.ubuntu.com/
My Blog : http://ben-collins.blogspot.com/
^ permalink raw reply
* Re: NULL pointer deref, selinux_socket_unix_may_send+0x34/0x90
From: Paul Moore @ 2013-03-22 16:24 UTC (permalink / raw)
To: Ján Stanček; +Cc: netdev, eparis, sds
In-Reply-To: <CAMpz-8bzjyBzk+mkaR-hHndtRZVyTb0LX8idEvypRV-itdSRYw@mail.gmail.com>
On Friday, March 22, 2013 04:48:32 PM Ján Stanček wrote:
> Hi Paul,
>
> thanks for reply, I'll try your patch and let you know.
Great, thanks.
> I'm not certain about cause either, but patch I sent in last email
> makes it go away, so maybe that can help in some way.
At the very least you've found a way to reproduce the problem and your patch
furthers my belief that we've got a race condition somewhere - all very
helpful! It may also turn out that your patch is the "right" solution, I'd
just like to better understand why we are seeing the race in the first place.
> I made a v2 of the reproducer (attached), which triggers the issue a lot
> faster on 2 systems I tried (32 CPU and 4 CPU systems) - just in couple of
> seconds.
Excellent, while I don't have a 32 cpu system handy, I do have a 4 cpu system
that I can play with. Thanks again.
-Paul
--
paul moore
www.paul-moore.com
^ permalink raw reply
* [PATCH net-next v2 2/2] ipv6: provide addr and netconf dump consistency info
From: Nicolas Dichtel @ 2013-03-22 16:28 UTC (permalink / raw)
To: netdev; +Cc: davem, junwei.zhang, hongjun.li, Nicolas Dichtel
In-Reply-To: <1363969723-4390-1-git-send-email-nicolas.dichtel@6wind.com>
This patch adds a dev_addr_genid for IPv6. The goal is to use it, combined with
dev_base_seq to check if a change occurs during a netlink dump.
If a change is detected, the flag NLM_F_DUMP_INTR is set in the first message
after the dump was interrupted.
Note that only dump of unicast addresses is checked (multicast and anycast are
not checked).
Reported-by: Junwei Zhang <junwei.zhang@6wind.com>
Reported-by: Hongjun Li <hongjun.li@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
include/net/netns/ipv6.h | 1 +
net/ipv6/addrconf.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 1242f37..005e2c2 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -71,6 +71,7 @@ struct netns_ipv6 {
struct fib_rules_ops *mr6_rules_ops;
#endif
#endif
+ atomic_t dev_addr_genid;
};
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index fa36a67..d0e40d4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -622,6 +622,8 @@ static int inet6_netconf_dump_devconf(struct sk_buff *skb,
idx = 0;
head = &net->dev_index_head[h];
rcu_read_lock();
+ cb->seq = atomic_read(&net->ipv6.dev_addr_genid) ^
+ net->dev_base_seq;
hlist_for_each_entry_rcu(dev, head, index_hlist) {
if (idx < s_idx)
goto cont;
@@ -639,6 +641,7 @@ static int inet6_netconf_dump_devconf(struct sk_buff *skb,
rcu_read_unlock();
goto done;
}
+ nl_dump_check_consistent(cb, nlmsg_hdr(skb));
cont:
idx++;
}
@@ -3875,6 +3878,7 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,
NLM_F_MULTI);
if (err <= 0)
break;
+ nl_dump_check_consistent(cb, nlmsg_hdr(skb));
}
break;
}
@@ -3932,6 +3936,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
s_ip_idx = ip_idx = cb->args[2];
rcu_read_lock();
+ cb->seq = atomic_read(&net->ipv6.dev_addr_genid) ^ net->dev_base_seq;
for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
idx = 0;
head = &net->dev_index_head[h];
@@ -4409,6 +4414,8 @@ errout:
static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
{
+ struct net *net = dev_net(ifp->idev->dev);
+
inet6_ifa_notify(event ? : RTM_NEWADDR, ifp);
switch (event) {
@@ -4434,6 +4441,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
dst_free(&ifp->rt->dst);
break;
}
+ atomic_inc(&net->ipv6.dev_addr_genid);
}
static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
--
1.8.0.1
^ permalink raw reply related
* [PATCH net-next v2 1/2] ipv4: provide addr and netconf dump consistency info
From: Nicolas Dichtel @ 2013-03-22 16:28 UTC (permalink / raw)
To: netdev; +Cc: davem, junwei.zhang, hongjun.li, Nicolas Dichtel
In-Reply-To: <514C8559.5030301@6wind.com>
This patch takes benefit of dev_addr_genid and dev_base_seq to check if a change
occurs during a netlink dump. If a change is detected, the flag NLM_F_DUMP_INTR
is set in the first message after the dump was interrupted.
Note that seq and prev_seq must be reset between each family in rtnl_dump_all()
because they are specific to each family.
Reported-by: Junwei Zhang <junwei.zhang@6wind.com>
Reported-by: Hongjun Li <hongjun.li@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
v2: reset seq and prev_seq in rtnl_dump_all()
net/core/rtnetlink.c | 5 ++++-
net/ipv4/devinet.c | 6 ++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 9a9b99e..4493d7a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1955,8 +1955,11 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
if (rtnl_msg_handlers[idx] == NULL ||
rtnl_msg_handlers[idx][type].dumpit == NULL)
continue;
- if (idx > s_idx)
+ if (idx > s_idx) {
memset(&cb->args[0], 0, sizeof(cb->args));
+ cb->prev_seq = 0;
+ cb->seq = 0;
+ }
if (rtnl_msg_handlers[idx][type].dumpit(skb, cb))
break;
}
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index af57bba..158ca5e 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1499,6 +1499,8 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
idx = 0;
head = &net->dev_index_head[h];
rcu_read_lock();
+ cb->seq = atomic_read(&net->ipv4.dev_addr_genid) ^
+ net->dev_base_seq;
hlist_for_each_entry_rcu(dev, head, index_hlist) {
if (idx < s_idx)
goto cont;
@@ -1519,6 +1521,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
rcu_read_unlock();
goto done;
}
+ nl_dump_check_consistent(cb, nlmsg_hdr(skb));
}
cont:
idx++;
@@ -1808,6 +1811,8 @@ static int inet_netconf_dump_devconf(struct sk_buff *skb,
idx = 0;
head = &net->dev_index_head[h];
rcu_read_lock();
+ cb->seq = atomic_read(&net->ipv4.dev_addr_genid) ^
+ net->dev_base_seq;
hlist_for_each_entry_rcu(dev, head, index_hlist) {
if (idx < s_idx)
goto cont;
@@ -1825,6 +1830,7 @@ static int inet_netconf_dump_devconf(struct sk_buff *skb,
rcu_read_unlock();
goto done;
}
+ nl_dump_check_consistent(cb, nlmsg_hdr(skb));
cont:
idx++;
}
--
1.8.0.1
^ permalink raw reply related
* [PATCH iproute2 v3] libnetlink: check flag NLM_F_DUMP_INTR during dumps
From: Nicolas Dichtel @ 2013-03-22 16:34 UTC (permalink / raw)
To: eric.dumazet; +Cc: shemminger, netdev, tgraf, Nicolas Dichtel
In-Reply-To: <1363967372.4431.71.camel@edumazet-glaptop>
When this flag is set, it means that dump was interrupted and result may be
inconsistent.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
v3: display the warning only once
v2: do not stop the dump, only display a warning
lib/libnetlink.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index f262959..04201cd 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -194,6 +194,7 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth,
.msg_iovlen = 1,
};
char buf[16384];
+ int dump_intr = 0;
iov.iov_base = buf;
while (1) {
@@ -230,6 +231,9 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth,
h->nlmsg_seq != rth->dump)
goto skip_it;
+ if (h->nlmsg_flags & NLM_F_DUMP_INTR)
+ dump_intr = 1;
+
if (h->nlmsg_type == NLMSG_DONE) {
found_done = 1;
break; /* process next filter */
@@ -254,8 +258,12 @@ skip_it:
}
}
- if (found_done)
+ if (found_done) {
+ if (dump_intr)
+ fprintf(stderr,
+ "Dump was interrupted and may be inconsistent.\n");
return 0;
+ }
if (msg.msg_flags & MSG_TRUNC) {
fprintf(stderr, "Message truncated\n");
--
1.8.0.1
^ 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