Hi Sorin, It would be probably better to make this call synchronous as the thread has nothing else to do. The WFP transaction in the driver is guaranteed to being completed so we should be ok here. Thanks, Eitan
-----Original Message----- From: dev [mailto:[email protected]] On Behalf Of Sorin Vinturis Sent: Thursday, March 12, 2015 5:43 PM To: [email protected] Subject: [ovs-dev] [PATCH 3/3] netlink: support for asynchronous NL transactions Modified 'nl_sock_transact_multiple__' function to send asynchronous I/O requests to the kernel driver. Signed-off-by: Sorin Vinturis <[email protected]> Reported-by: Alin Gabriel Serdean <[email protected]> Reported-at: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openvswitch_ovs-2Dissues_issues_64&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=CWsgHUxi6ExLXY798tmo3LJ4e3geGYp56lkcH-5cLCY&m=mnPxbs5kxqNdJzi-qc-vofl6JQrEuyx3Tb5Uxj5l7YA&s=vGvK7gc_nZkPLpeiZVXNdRHky8DjHd9aT46oNKn8lmI&e= --- lib/netlink-socket.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c index e4f153f..64f93ff 100644 --- a/lib/netlink-socket.c +++ b/lib/netlink-socket.c @@ -832,10 +832,28 @@ nl_sock_transact_multiple__(struct nl_sock *sock, ofpbuf_data(txn->request), ofpbuf_size(txn->request), reply_buf, sizeof reply_buf, - &reply_len, NULL)) { - /* XXX: Map to a more appropriate error. */ - error = EINVAL; - break; + &reply_len, &sock->overlapped)) { + if (GetLastError() != ERROR_IO_PENDING) { + /* XXX: Map to a more appropriate error. */ + VLOG_DBG_RL(&rl, "nl_transact operation failed - %s", + ovs_strerror(error)); + error = EINVAL; + break; + } else { + /* Operation has been queued 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. */ + VLOG_DBG_RL(&rl, "nl_transact asynchronous operation failed - %s", + ovs_strerror(error)); + error = EINVAL; + break; + } + } } if (reply_len < sizeof *reply_nlmsg) { -- 1.9.0.msysgit.0 _______________________________________________ dev mailing list [email protected] https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_mailman_listinfo_dev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=CWsgHUxi6ExLXY798tmo3LJ4e3geGYp56lkcH-5cLCY&m=mnPxbs5kxqNdJzi-qc-vofl6JQrEuyx3Tb5Uxj5l7YA&s=Ea6-zNGdcWXl55yngXjvxDyuRn1v9WCsX8B3jJj5mtA&e= _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
