Modified 'nl_sock_transact_multiple__' function to send asynchronous I/O requests to the kernel driver.
Signed-off-by: Sorin Vinturis <svintu...@cloudbasesolutions.com> Reported-by: Alin Gabriel Serdean <aserd...@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/64 --- lib/netlink-socket.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c index 42eb232..63b78d9 100644 --- a/lib/netlink-socket.c +++ b/lib/netlink-socket.c @@ -802,7 +802,7 @@ nl_sock_transact_multiple__(struct nl_sock *sock, txn->request->data, txn->request->size, reply_buf, sizeof reply_buf, - &reply_len, NULL); + &reply_len, &sock->overlapped); if (ret && reply_len == 0) { /* @@ -815,11 +815,28 @@ nl_sock_transact_multiple__(struct nl_sock *sock, ofpbuf_clear(txn->reply); } } else if (!ret) { - /* XXX: Map to a more appropriate error. */ - error = EINVAL; - VLOG_DBG_RL(&rl, "fatal driver failure: %s", - ovs_lasterror_to_string()); - break; + if (GetLastError() != ERROR_IO_PENDING) { + /* XXX: Map to a more appropriate error. */ + error = EINVAL; + VLOG_DBG_RL(&rl, "fatal driver failure: %s", + ovs_lasterror_to_string()); + break; + } else { + /* Operation is pending and will complete in the future. + * Wait for the operation to complete before continuing. */ + if (!GetOverlappedResult(sock->handle, + &sock->overlapped, + &reply_len, + TRUE)) { + /* Operation has completed, but it failed. */ + /* XXX: Map to a more appropriate error. */ + error = EINVAL; + VLOG_DBG_RL( + &rl, "fatal driver asynchronous operation failure: %s", + ovs_lasterror_to_string()); + break; + } + } } if (reply_len != 0) { -- 1.9.0.msysgit.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev