* Netlink usage question (for bonding comm with userspace)
@ 2010-01-26 0:48 Jay Vosburgh
2010-01-26 0:51 ` David Miller
2010-01-26 11:25 ` Patrick McHardy
0 siblings, 2 replies; 5+ messages in thread
From: Jay Vosburgh @ 2010-01-26 0:48 UTC (permalink / raw)
To: netdev
Could any netlink gurus comment on my questions? I'm hoping to
figure out the right way to do what I need without working up patches
that end up being excellent examples of the wrong way. I've looked
through the kernel, and it's almost a cases of too many choices (private
netlink, rtnetlink, connector, genetlink) to sort through.
Background: I'm working on a bonding mode that involves two-way
communication between bonding itself and a user-space daemon, and I'm
trying to determine the best way to utilize netlink for this project
with an eye towards forwards compatibility with future expansion (e.g.,
general bonding setup via netlink). For purposes of discussion, the
communication requires that bonding-specific requests, responses and
asynchronous events flow in both directions.
I could, for this project, use a netlink_kernel_create and
socket(AF_NETLINK) pair to perform the communication (presumably adding
a NETLINK_BONDING or the like to <linux/netlink.h>).
That, however, wouldn't dovetail with moving control of bonding
into iproute2 ("ip link add link bond0 type bond mode whatever"), and it
seems suboptimal to have two independent netlink gizmos in bonding. I'm
not planning to implement full bonding control via netlink at this time,
but I don't want to do anything that would cause difficulty for doing so
in the future.
I've done some prototyping with working through the existing
rtnetlink infrastructure, adding an RTNLGRP_BONDING, AF_BONDING, etc,
vaguely paralleling how the bridge code is architected. What's unclear
to me is how to insert the bonding-specific request / response message
types into the rtnetlink infrastructure, or, indeed, if this is simply
not the right way to go about this.
So, in summary:
For user / kernel communications via netlink: private socket,
add to rtnetlink API, or something else (connector, genetlink, ...)?
Is having private socket netlink and rtnetlink in the same
module a reasonable methodology?
If rtnetlink is suitable, basic "do this" or "don't do this"
thoughts? The various HOWTOs google finds for me concentrate on the
mechanisms, less so on interface selection / design.
Thoughts?
-J
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Netlink usage question (for bonding comm with userspace)
2010-01-26 0:48 Netlink usage question (for bonding comm with userspace) Jay Vosburgh
@ 2010-01-26 0:51 ` David Miller
2010-01-26 1:14 ` Jay Vosburgh
2010-01-26 11:25 ` Patrick McHardy
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2010-01-26 0:51 UTC (permalink / raw)
To: fubar; +Cc: netdev
From: Jay Vosburgh <fubar@us.ibm.com>
Date: Mon, 25 Jan 2010 16:48:21 -0800
> I could, for this project, use a netlink_kernel_create and
> socket(AF_NETLINK) pair to perform the communication (presumably adding
> a NETLINK_BONDING or the like to <linux/netlink.h>).
This is no longer done, so that we don't have an issue with
running out of netlink sub-protocol numbers.
Instead use generic netlink, the IDs are allocated dynamically
and looked up via text strings which provides a better scheme
for namespace allocation.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Netlink usage question (for bonding comm with userspace)
2010-01-26 0:51 ` David Miller
@ 2010-01-26 1:14 ` Jay Vosburgh
2010-01-26 2:03 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Jay Vosburgh @ 2010-01-26 1:14 UTC (permalink / raw)
To: David Miller; +Cc: netdev
David Miller <davem@davemloft.net> wrote:
[...]
>> I could, for this project, use a netlink_kernel_create and
>> socket(AF_NETLINK) pair to perform the communication (presumably adding
>> a NETLINK_BONDING or the like to <linux/netlink.h>).
>
>This is no longer done, so that we don't have an issue with
>running out of netlink sub-protocol numbers.
>
>Instead use generic netlink, the IDs are allocated dynamically
>and looked up via text strings which provides a better scheme
>for namespace allocation.
Thanks for the response.
Just so I'm clear, though: use generic netlink for the needs of
this particular project, and then later it's acceptable to have both
generic and rtnetlink co-existing for their respective uses?
-J
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Netlink usage question (for bonding comm with userspace)
2010-01-26 1:14 ` Jay Vosburgh
@ 2010-01-26 2:03 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-01-26 2:03 UTC (permalink / raw)
To: fubar; +Cc: netdev
From: Jay Vosburgh <fubar@us.ibm.com>
Date: Mon, 25 Jan 2010 17:14:00 -0800
> Just so I'm clear, though: use generic netlink for the needs of
> this particular project, and then later it's acceptable to have both
> generic and rtnetlink co-existing for their respective uses?
Use generic netlink for everything.
It's just a different namespace ("text strings", vs. fixed integer
IDs) for netlink sockets, nothing more really.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Netlink usage question (for bonding comm with userspace)
2010-01-26 0:48 Netlink usage question (for bonding comm with userspace) Jay Vosburgh
2010-01-26 0:51 ` David Miller
@ 2010-01-26 11:25 ` Patrick McHardy
1 sibling, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2010-01-26 11:25 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: netdev
Jay Vosburgh wrote:
> Could any netlink gurus comment on my questions? I'm hoping to
> figure out the right way to do what I need without working up patches
> that end up being excellent examples of the wrong way. I've looked
> through the kernel, and it's almost a cases of too many choices (private
> netlink, rtnetlink, connector, genetlink) to sort through.
>
> Background: I'm working on a bonding mode that involves two-way
> communication between bonding itself and a user-space daemon, and I'm
> trying to determine the best way to utilize netlink for this project
> with an eye towards forwards compatibility with future expansion (e.g.,
> general bonding setup via netlink). For purposes of discussion, the
> communication requires that bonding-specific requests, responses and
> asynchronous events flow in both directions.
>
> I could, for this project, use a netlink_kernel_create and
> socket(AF_NETLINK) pair to perform the communication (presumably adding
> a NETLINK_BONDING or the like to <linux/netlink.h>).
>
> That, however, wouldn't dovetail with moving control of bonding
> into iproute2 ("ip link add link bond0 type bond mode whatever"), and it
> seems suboptimal to have two independent netlink gizmos in bonding. I'm
> not planning to implement full bonding control via netlink at this time,
> but I don't want to do anything that would cause difficulty for doing so
> in the future.
I actually have an 75% finished patchset for rtnl_link support.
> I've done some prototyping with working through the existing
> rtnetlink infrastructure, adding an RTNLGRP_BONDING, AF_BONDING, etc,
> vaguely paralleling how the bridge code is architected. What's unclear
> to me is how to insert the bonding-specific request / response message
> types into the rtnetlink infrastructure, or, indeed, if this is simply
> not the right way to go about this.
>
> So, in summary:
>
> For user / kernel communications via netlink: private socket,
> add to rtnetlink API, or something else (connector, genetlink, ...)?
>
> Is having private socket netlink and rtnetlink in the same
> module a reasonable methodology?
It depends. If your requests and responses can be expressed as
device configuration and state changes then you could include them
in the bonding specific part of an rtnetlink message. Otherwise
you should use a private netlink family or genetlink.
> If rtnetlink is suitable, basic "do this" or "don't do this"
> thoughts? The various HOWTOs google finds for me concentrate on the
> mechanisms, less so on interface selection / design.
>
> Thoughts?
>
> -J
>
> ---
> -Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-01-26 11:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-26 0:48 Netlink usage question (for bonding comm with userspace) Jay Vosburgh
2010-01-26 0:51 ` David Miller
2010-01-26 1:14 ` Jay Vosburgh
2010-01-26 2:03 ` David Miller
2010-01-26 11:25 ` Patrick McHardy
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).