Message ID | d6c8c90f-bf0b-b310-2737-27d3741f2043@sberdevices.ru (mailing list archive) |
---|---|
State | RFC |
Headers | show |
Series | vsock: MSG_ZEROCOPY flag support | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Guessed tree name to be net-next, async |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 21 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
On Mon, Feb 06, 2023 at 06:55:46AM +0000, Arseniy Krasnov wrote: >This feature totally depends on transport, so if transport doesn't >support it, return error. > >Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> >--- > include/net/af_vsock.h | 2 ++ > net/vmw_vsock/af_vsock.c | 7 +++++++ > 2 files changed, 9 insertions(+) > >diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h >index 568a87c5e0d0..96d829004c81 100644 >--- a/include/net/af_vsock.h >+++ b/include/net/af_vsock.h >@@ -173,6 +173,8 @@ struct vsock_transport { > > /* Addressing. */ > u32 (*get_local_cid)(void); >+ LGTM, just add comment here for a new section following what we did for other callaback, e.g.: /* Zero-copy. */ >+ bool (*msgzerocopy_allow)(void); > }; > > /**** CORE ****/ >diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >index f752b30b71d6..fb0fcb390113 100644 >--- a/net/vmw_vsock/af_vsock.c >+++ b/net/vmw_vsock/af_vsock.c >@@ -1788,6 +1788,13 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg, > goto out; > } > >+ if (msg->msg_flags & MSG_ZEROCOPY && >+ (!transport->msgzerocopy_allow || >+ !transport->msgzerocopy_allow())) { >+ err = -EOPNOTSUPP; >+ goto out; >+ } >+ > /* Wait for room in the produce queue to enqueue our user's data. */ > timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); > >-- >2.25.1
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index 568a87c5e0d0..96d829004c81 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h @@ -173,6 +173,8 @@ struct vsock_transport { /* Addressing. */ u32 (*get_local_cid)(void); + + bool (*msgzerocopy_allow)(void); }; /**** CORE ****/ diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index f752b30b71d6..fb0fcb390113 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1788,6 +1788,13 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg, goto out; } + if (msg->msg_flags & MSG_ZEROCOPY && + (!transport->msgzerocopy_allow || + !transport->msgzerocopy_allow())) { + err = -EOPNOTSUPP; + goto out; + } + /* Wait for room in the produce queue to enqueue our user's data. */ timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
This feature totally depends on transport, so if transport doesn't support it, return error. Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> --- include/net/af_vsock.h | 2 ++ net/vmw_vsock/af_vsock.c | 7 +++++++ 2 files changed, 9 insertions(+)