Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-20 Thread Johannes Berg
On Wed, 2016-04-20 at 15:34 +0200, Jiri Benc wrote: > On Wed, 20 Apr 2016 15:17:08 +0200, Johannes Berg wrote: > > > > Looks like you have this on a per-message basis. I thought it was > > better on an attribute basis because that's really where the issue > > is. > No problem. I'm not that happy w

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-20 Thread Jiri Benc
On Wed, 20 Apr 2016 15:17:08 +0200, Johannes Berg wrote: > Looks like you have this on a per-message basis. I thought it was > better on an attribute basis because that's really where the issue is. No problem. I'm not that happy with my patchset myself. Just wanted to point it out in case it's use

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-20 Thread Johannes Berg
On Wed, 2016-04-20 at 14:48 +0200, Jiri Benc wrote: > On Wed, 20 Apr 2016 09:32:20 +0200, Johannes Berg wrote: > > > > 2) Use the new attribute flag with some required attribute for > >    existing commands, so that older kernel will not find the > > required > >    attribute and will reject the o

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-20 Thread Jiri Benc
On Wed, 20 Apr 2016 09:32:20 +0200, Johannes Berg wrote: > 2) Use the new attribute flag with some required attribute for >    existing commands, so that older kernel will not find the required >    attribute and will reject the operation entirely. >    May or may not fall back to trying the operat

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-20 Thread Johannes Berg
On Tue, 2016-04-19 at 19:53 -0600, David Ahern wrote: >  > The kernel can set a flag in the response that it acknowledges the > new  attribute/flag. I did that for filtering neigh dumps -- > 21fdd092acc7. > Hm, that works, but I think it requires writing extra code, which I was kinda trying to av

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Roopa Prabhu
On 4/19/16, 4:50 PM, David Miller wrote: > From: Nicolas Dichtel > Date: Tue, 19 Apr 2016 21:08:21 +0200 > >> Le 19/04/2016 20:47, Eric Dumazet a écrit : >>> Since we want to use this in other places, we could define a helper. >>> >>> nla_align_64bit(skb, attribute) or something. >> Yes, with the

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Roopa Prabhu
On 4/19/16, 3:49 PM, David Miller wrote: > From: Roopa Prabhu > Date: Tue, 19 Apr 2016 12:05:00 -0700 > >> ok, will do. one thing though, for GETSTATS, if I need a pad >> attribute like IFLA_PAD, I will need to add a new stats attribute >> IFLA_STATS_PAD and burn a bit for it in filter_mask too.

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread David Ahern
On 4/19/16 1:41 PM, Johannes Berg wrote: On Tue, 2016-04-19 at 14:23 -0400, David Miller wrote: I like this nlattr flag idea, it's opt-in and any tool can be updated to use the new facility. Right. I'd be willing the backport the nlattr flag bit change to all stable releases as well. I'm

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread David Miller
From: Nicolas Dichtel Date: Tue, 19 Apr 2016 21:08:21 +0200 > Le 19/04/2016 20:47, Eric Dumazet a écrit : >> Since we want to use this in other places, we could define a helper. >> >> nla_align_64bit(skb, attribute) or something. > Yes, with the corresponding nla_total_size_64bit() Good, idea,

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread David Miller
From: Roopa Prabhu Date: Tue, 19 Apr 2016 12:05:00 -0700 > ok, will do. one thing though, for GETSTATS, if I need a pad > attribute like IFLA_PAD, I will need to add a new stats attribute > IFLA_STATS_PAD and burn a bit for it in filter_mask too. In which > case, I am wondering if we should live

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Roopa Prabhu
On 4/19/16, 12:55 PM, Paul Moore wrote: > On Tue, Apr 19, 2016 at 4:26 AM, Nicolas Dichtel > wrote: >> + selinux maintainers >> >> Le 18/04/2016 23:10, Roopa Prabhu a écrit : >> [snip] >>> diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c >>> index 8495b93..1714633 100644 >>>

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Paul Moore
On Tue, Apr 19, 2016 at 4:26 AM, Nicolas Dichtel wrote: > + selinux maintainers > > Le 18/04/2016 23:10, Roopa Prabhu a écrit : > [snip] >> >> diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c >> index 8495b93..1714633 100644 >> --- a/security/selinux/nlmsgtab.c >> +++ b/secur

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Johannes Berg
On Tue, 2016-04-19 at 14:23 -0400, David Miller wrote: >  > I like this nlattr flag idea, it's opt-in and any tool can be updated > to use the new facility. Right. > I'd be willing the backport the nlattr flag bit change to all stable > releases as well. I'm not really convinced that helps much

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Nicolas Dichtel
Le 19/04/2016 20:47, Eric Dumazet a écrit : On Tue, 2016-04-19 at 14:31 -0400, David Miller wrote: +#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS + /* IF necessary, add a zero length NOP attribute so that the +* nla_data() of the IFLA_STATS64 will be 64-bit aligned. +* +

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Roopa Prabhu
On 4/19/16, 11:31 AM, David Miller wrote: [snip] > > Here is the final patch I'm about to push out, thanks a lot Eric. > > Roopa, please adjust your GETSTATS patch as needed (I think you need > to adjust the SELinux table entry as well) and we can integrate that > too. ok, will do. one thing thoug

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Eric Dumazet
On Tue, 2016-04-19 at 14:31 -0400, David Miller wrote: > +#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS > + /* IF necessary, add a zero length NOP attribute so that the > + * nla_data() of the IFLA_STATS64 will be 64-bit aligned. > + * > + * The nlattr header is 4 bytes in size, that'

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Eric Dumazet
On Tue, 2016-04-19 at 14:31 -0400, David Miller wrote: > > Here is the final patch I'm about to push out, thanks a lot Eric. > > Roopa, please adjust your GETSTATS patch as needed (I think you need > to adjust the SELinux table entry as well) and we can integrate that > too. > > ===

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread David Miller
From: David Miller Date: Tue, 19 Apr 2016 01:03:16 -0400 (EDT) > From: Eric Dumazet > Date: Mon, 18 Apr 2016 21:32:04 -0700 > >> On Mon, 2016-04-18 at 23:41 -0400, David Miller wrote: >>> >>> + /* Add a zero length NOP attribute so that the nla_data() >>> +* of the IFLA_STATS64 will be

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread David Miller
From: Johannes Berg Date: Tue, 19 Apr 2016 12:09:03 +0200 > At netconf, we talked about how awkward it can be that one doesn't know > if an attribute was accepted by the kernel or simply ignored because > it's not supported (older kernel version). > > I considered (and Emmanuel has started to co

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread David Miller
From: Nicolas Dichtel Date: Tue, 19 Apr 2016 09:45:32 +0200 > But we finally discover that some netlink API use the attribute '0'. I explicitly did not use attribute zero, and instead made a new IFLA_* attribute exactly to avoid compatability problems. Every netlink attribute space that needs t

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Emmanuel Grumbach
On Tue, Apr 19, 2016 at 1:09 PM, Johannes Berg wrote: > On Mon, 2016-04-18 at 23:52 -0400, David Miller wrote: >> From: David Miller >> Date: Mon, 18 Apr 2016 21:48:51 -0400 (EDT) >> >> > I think the time has probably come to have a new netlink attribute >> > format that doesn't have this multi-d

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Johannes Berg
On Mon, 2016-04-18 at 23:52 -0400, David Miller wrote: > From: David Miller > Date: Mon, 18 Apr 2016 21:48:51 -0400 (EDT) > > > I think the time has probably come to have a new netlink attribute > > format that doesn't have this multi-decade old problem. >  ... > > Scratch this whole idea, I thi

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Nicolas Dichtel
+ selinux maintainers Le 18/04/2016 23:10, Roopa Prabhu a écrit : [snip] diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index 8495b93..1714633 100644 --- a/security/selinux/nlmsgtab.c +++ b/security/selinux/nlmsgtab.c @@ -76,6 +76,8 @@ static struct nlmsg_perm nlmsg_route

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-19 Thread Nicolas Dichtel
Le 19/04/2016 05:41, David Miller a écrit : [snip] I just tested out a clever idea, where for architectures where unaligned accesses is a problem, we insert a zero length NOP attribute before the 64-bit stats. This makes it properly aligned. A quick hack patch just passed testing on my sparc64

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread David Miller
From: Eric Dumazet Date: Mon, 18 Apr 2016 21:32:04 -0700 > On Mon, 2016-04-18 at 23:41 -0400, David Miller wrote: >> >> +/* Add a zero length NOP attribute so that the nla_data() >> + * of the IFLA_STATS64 will be 64-bit aligned. >> + */ >> +#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS >

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread Roopa Prabhu
On 4/18/16, 8:41 PM, David Miller wrote: > From: Roopa Prabhu > Date: Mon, 18 Apr 2016 14:10:19 -0700 > >> This patch adds a new RTM_GETSTATS message to query link stats via >> netlink from the kernel. RTM_NEWLINK also dumps stats today, but >> RTM_NEWLINK returns a lot more than just stats and is

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread Eric Dumazet
On Mon, 2016-04-18 at 23:41 -0400, David Miller wrote: > > + /* Add a zero length NOP attribute so that the nla_data() > + * of the IFLA_STATS64 will be 64-bit aligned. > + */ > +#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS > + attr = nla_reserve(skb, IFLA_PAD, 0); > + if (!attr)

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread Eric Dumazet
On Mon, 2016-04-18 at 23:41 -0400, David Miller wrote: > From: Roopa Prabhu > Date: Mon, 18 Apr 2016 14:10:19 -0700 > > > This patch adds a new RTM_GETSTATS message to query link stats via > > netlink from the kernel. RTM_NEWLINK also dumps stats today, but > > RTM_NEWLINK returns a lot more than

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread David Miller
From: David Miller Date: Mon, 18 Apr 2016 21:48:51 -0400 (EDT) > I think the time has probably come to have a new netlink attribute > format that doesn't have this multi-decade old problem. ... Scratch this whole idea, I think the padding attribute works a lot better and is backwards compatible

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread David Miller
From: Roopa Prabhu Date: Mon, 18 Apr 2016 19:40:08 -0700 > On 4/18/16, 7:22 PM, Eric Dumazet wrote: >> On Mon, 2016-04-18 at 21:48 -0400, David Miller wrote: >> >>> And anyways, I get unaligned accesses without Roopa's changes :-/ >>> >>> davem@patience:~$ ip l l >>> [3391066.656729] Kernel unali

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread David Miller
From: Roopa Prabhu Date: Mon, 18 Apr 2016 14:10:19 -0700 > This patch adds a new RTM_GETSTATS message to query link stats via > netlink from the kernel. RTM_NEWLINK also dumps stats today, but > RTM_NEWLINK returns a lot more than just stats and is expensive in > some cases when frequent polling

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread Roopa Prabhu
On 4/18/16, 7:22 PM, Eric Dumazet wrote: > On Mon, 2016-04-18 at 21:48 -0400, David Miller wrote: > >> And anyways, I get unaligned accesses without Roopa's changes :-/ >> >> davem@patience:~$ ip l l >> [3391066.656729] Kernel unaligned access at TPC[7d6c14] >> loopback_get_stats64+0x74/0xa0 >> [3

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread roopa
On 4/18/16, 5:57 PM, David Miller wrote: > From: Eric Dumazet > Date: Mon, 18 Apr 2016 14:35:56 -0700 > >> On Mon, 2016-04-18 at 14:10 -0700, Roopa Prabhu wrote: >> >>> + if (filter_mask & IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_64)) { >>> + struct rtnl_link_stats64 *sp; >>> + >>> +

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread Eric Dumazet
On Mon, 2016-04-18 at 21:48 -0400, David Miller wrote: > > And anyways, I get unaligned accesses without Roopa's changes :-/ > > davem@patience:~$ ip l l > [3391066.656729] Kernel unaligned access at TPC[7d6c14] > loopback_get_stats64+0x74/0xa0 > [3391066.672020] Kernel unaligned access at TPC[

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread David Miller
From: David Miller Date: Mon, 18 Apr 2016 20:57:55 -0400 (EDT) > From: Eric Dumazet > Date: Mon, 18 Apr 2016 14:35:56 -0700 > >> On Mon, 2016-04-18 at 14:10 -0700, Roopa Prabhu wrote: >> >>> + if (filter_mask & IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_64)) { >>> + struct rtnl_link_sta

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread David Miller
From: Eric Dumazet Date: Mon, 18 Apr 2016 14:35:56 -0700 > On Mon, 2016-04-18 at 14:10 -0700, Roopa Prabhu wrote: > >> +if (filter_mask & IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_64)) { >> +struct rtnl_link_stats64 *sp; >> + >> +attr = nla_reserve(skb, IFLA_STATS_LINK_64

Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread Eric Dumazet
On Mon, 2016-04-18 at 14:10 -0700, Roopa Prabhu wrote: > + if (filter_mask & IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_64)) { > + struct rtnl_link_stats64 *sp; > + > + attr = nla_reserve(skb, IFLA_STATS_LINK_64, > +sizeof(struct rtnl_link_sta

[PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats

2016-04-18 Thread Roopa Prabhu
From: Roopa Prabhu This patch adds a new RTM_GETSTATS message to query link stats via netlink from the kernel. RTM_NEWLINK also dumps stats today, but RTM_NEWLINK returns a lot more than just stats and is expensive in some cases when frequent polling for stats from userspace is a common operation