* [RFC PATCH] iproute2: Add flag to indicate extended dump info
@ 2012-02-10 15:18 Greg Rose
2012-02-10 16:41 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Greg Rose @ 2012-02-10 15:18 UTC (permalink / raw)
To: netdev; +Cc: shemminger, davem
Add flag to the ip link dump command to indicate to the kernel that
the application is requesting the extended interface information such
as VFs. The kernel will take this flag as an implicit indication that
the application has allocated a 16K or larger buffer, which is what
the 'ip' command in fact does.
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
---
include/linux/netlink.h | 1 +
lib/libnetlink.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 5c4f087..f913797 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -59,6 +59,7 @@ struct nlmsghdr {
#define NLM_F_MATCH 0x200 /* return all matching */
#define NLM_F_ATOMIC 0x400 /* atomic GET */
#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
+#define NLM_F_EXT 0x800 /* Get extended interface info such as VFs */
/* Modifiers to NEW request */
#define NLM_F_REPLACE 0x100 /* Override existing */
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index c581e11..f29da3d 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -99,7 +99,7 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = type;
- req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST;
+ req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST|NLM_F_EXT;
req.nlh.nlmsg_pid = 0;
req.nlh.nlmsg_seq = rth->dump = ++rth->seq;
req.g.rtgen_family = family;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] iproute2: Add flag to indicate extended dump info
2012-02-10 15:18 [RFC PATCH] iproute2: Add flag to indicate extended dump info Greg Rose
@ 2012-02-10 16:41 ` Stephen Hemminger
2012-02-10 16:43 ` Rose, Gregory V
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2012-02-10 16:41 UTC (permalink / raw)
To: Greg Rose; +Cc: netdev, davem
On Fri, 10 Feb 2012 07:18:05 -0800
Greg Rose <gregory.v.rose@intel.com> wrote:
> Add flag to the ip link dump command to indicate to the kernel that
> the application is requesting the extended interface information such
> as VFs. The kernel will take this flag as an implicit indication that
> the application has allocated a 16K or larger buffer, which is what
> the 'ip' command in fact does.
>
> Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
> ---
>
> include/linux/netlink.h | 1 +
> lib/libnetlink.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/netlink.h b/include/linux/netlink.h
> index 5c4f087..f913797 100644
> --- a/include/linux/netlink.h
> +++ b/include/linux/netlink.h
> @@ -59,6 +59,7 @@ struct nlmsghdr {
> #define NLM_F_MATCH 0x200 /* return all matching */
> #define NLM_F_ATOMIC 0x400 /* atomic GET */
> #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
> +#define NLM_F_EXT 0x800 /* Get extended interface info such as VFs */
>
> /* Modifiers to NEW request */
> #define NLM_F_REPLACE 0x100 /* Override existing */
> diff --git a/lib/libnetlink.c b/lib/libnetlink.c
> index c581e11..f29da3d 100644
> --- a/lib/libnetlink.c
> +++ b/lib/libnetlink.c
> @@ -99,7 +99,7 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
> memset(&req, 0, sizeof(req));
> req.nlh.nlmsg_len = sizeof(req);
> req.nlh.nlmsg_type = type;
> - req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST;
> + req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST|NLM_F_EXT;
> req.nlh.nlmsg_pid = 0;
> req.nlh.nlmsg_seq = rth->dump = ++rth->seq;
> req.g.rtgen_family = family;
>
Make sure and test backwards compatibility with older kernels.
It should be fine as long as the flag is ignored now.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [RFC PATCH] iproute2: Add flag to indicate extended dump info
2012-02-10 16:41 ` Stephen Hemminger
@ 2012-02-10 16:43 ` Rose, Gregory V
0 siblings, 0 replies; 3+ messages in thread
From: Rose, Gregory V @ 2012-02-10 16:43 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev@vger.kernel.org, davem@davemloft.net
> -----Original Message-----
> From: Stephen Hemminger [mailto:shemminger@vyatta.com]
> Sent: Friday, February 10, 2012 8:41 AM
> To: Rose, Gregory V
> Cc: netdev@vger.kernel.org; davem@davemloft.net
> Subject: Re: [RFC PATCH] iproute2: Add flag to indicate extended dump info
>
> On Fri, 10 Feb 2012 07:18:05 -0800
> Greg Rose <gregory.v.rose@intel.com> wrote:
>
> > Add flag to the ip link dump command to indicate to the kernel that
> > the application is requesting the extended interface information such
> > as VFs. The kernel will take this flag as an implicit indication that
> > the application has allocated a 16K or larger buffer, which is what
> > the 'ip' command in fact does.
> >
> > Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
> > ---
> >
> > include/linux/netlink.h | 1 +
> > lib/libnetlink.c | 2 +-
> > 2 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/include/linux/netlink.h b/include/linux/netlink.h
> > index 5c4f087..f913797 100644
> > --- a/include/linux/netlink.h
> > +++ b/include/linux/netlink.h
> > @@ -59,6 +59,7 @@ struct nlmsghdr {
> > #define NLM_F_MATCH 0x200 /* return all matching */
> > #define NLM_F_ATOMIC 0x400 /* atomic GET */
> > #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
> > +#define NLM_F_EXT 0x800 /* Get extended interface info such as VFs
> */
> >
> > /* Modifiers to NEW request */
> > #define NLM_F_REPLACE 0x100 /* Override existing */
> > diff --git a/lib/libnetlink.c b/lib/libnetlink.c
> > index c581e11..f29da3d 100644
> > --- a/lib/libnetlink.c
> > +++ b/lib/libnetlink.c
> > @@ -99,7 +99,7 @@ int rtnl_wilddump_request(struct rtnl_handle *rth, int
> family, int type)
> > memset(&req, 0, sizeof(req));
> > req.nlh.nlmsg_len = sizeof(req);
> > req.nlh.nlmsg_type = type;
> > - req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST;
> > + req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST|NLM_F_EXT;
> > req.nlh.nlmsg_pid = 0;
> > req.nlh.nlmsg_seq = rth->dump = ++rth->seq;
> > req.g.rtgen_family = family;
> >
>
> Make sure and test backwards compatibility with older kernels.
> It should be fine as long as the flag is ignored now.
We'll do that as soon as I get an indication that this associated kernel patch might actually fly. I've been shot down in flames and wreckage once already so I'm not placing any bets.
Thanks,
- Greg
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-10 16:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-10 15:18 [RFC PATCH] iproute2: Add flag to indicate extended dump info Greg Rose
2012-02-10 16:41 ` Stephen Hemminger
2012-02-10 16:43 ` Rose, Gregory V
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).