[ovs-dev] [optimize 05/26] netlink-socket: Avoid forcing a reply for final message in a transaction.
Ethan Jackson
ethan at nicira.com
Tue Apr 17 21:44:17 UTC 2012
Looks good, thanks.
Ethan
On Mon, Apr 16, 2012 at 17:18, Ben Pfaff <blp at nicira.com> wrote:
> From: Ben Pfaff <blp at hardrock.nicira.com>
>
> Signed-off-by: Ben Pfaff <blp at hardrock.nicira.com>
> ---
> lib/netlink-socket.c | 13 ++++++-------
> 1 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
> index df6f1d8..15a800b 100644
> --- a/lib/netlink-socket.c
> +++ b/lib/netlink-socket.c
> @@ -440,11 +440,6 @@ nl_sock_transact_multiple__(struct nl_sock *sock,
>
> nlmsg->nlmsg_len = request->size;
> nlmsg->nlmsg_pid = sock->pid;
> - if (i == n - 1) {
> - /* Ensure that we get a reply even if the final request doesn't
> - * ordinarily call for one. */
> - nlmsg->nlmsg_flags |= NLM_F_ACK;
> - }
>
> iovs[i].iov_base = request->data;
> iovs[i].iov_len = request->size;
> @@ -474,8 +469,12 @@ nl_sock_transact_multiple__(struct nl_sock *sock,
> while (n > 0) {
> struct ofpbuf *reply;
>
> - error = nl_sock_recv__(sock, &reply, true);
> - if (error) {
> + error = nl_sock_recv__(sock, &reply, false);
> + if (error == EAGAIN) {
> + nl_sock_record_errors__(transactions, n, 0);
> + *done += n;
> + return 0;
> + } else if (error) {
> return error;
> }
>
> --
> 1.7.9
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list