On Mon, Sep 19, 2011 at 03:00:04PM -0700, Jesse Gross wrote: > In the future, the kernel will use unicast messages instead of > multicast to send upcalls. As a result, we need to be able to > tell it where to direct the traffic. This adds a function to expose > the Netlink pid of a socket so it can be included in messages to the > kernel.
The Netlink socket library in OVS has logic to keep fds used for Netlink dump operations separate from fds used for multicast reception, because we don't want reading dump output to discard an arbitrary number of possibly interleaved multicast messages. Even though it's not technically multicast, this new way of receiving upcalls is still asynchronous and could still have the same issue as a socket subscribed to a multicast group. So the implementation should be analogous to nl_sock_join_mcgroup(), e.g. something like this: /* Obtains the Netlink pid of 'sock', for the purpose of allowing the caller * to enable asynchronous reception of Netlink messages on that pid. * * If successful, stores the pid in '*pid'p and returns 0. Otherwise, * stores 0 in '*pidp' and returns a positive errno value. */ int nl_sock_get_pid_for_async_recv(struct nl_sock *sock, uint32_t *pidp) { int error = nl_sock_cow__(sock); if (!error) { sock->any_groups = true; *pidp = sock->pid; return 0; } else { *pidp = 0; return error; } } _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev