From: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>,
Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>,
Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Igor Ivanov <Igor.Ivanov-wN0M4riKYwLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 9/9] IB/core: extended command: move comp_mask to the extended header
Date: Mon, 14 Oct 2013 18:44:09 +0300 [thread overview]
Message-ID: <525C1149.6000701@mellanox.com> (raw)
In-Reply-To: <40175eda10d670d098204da6aa4c327a0171ae5f.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
On 11/10/2013 8:57 PM, Yann Droneaud wrote:
> The unused field in the extended header is a perfect candidate
> to hold the command "comp_mask" (eg. bit field used to handle
> compatibility). This was suggested by Roland Dreier in a previous
> review[1].
>
> So this patch move comp_mask from create_flow/destroy_flow commands
> to the extended command header. Then comp_mask is passed as part
> of function parameters.
>
> [1]:
> http://marc.info/?iÊL1RGDXJtrc849M6_XNZT5xO1+ybKtLWGq6yg6LhoSsKpsmkYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
>
> Cc: Igor Ivanov <Igor.Ivanov-wN0M4riKYwLQT0dZR+AlfA@public.gmane.org>
> Cc: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
> Link: http://marc.info/?i=ver.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org
> Link: http://mid.gmane.org/cover.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org
> ---
> drivers/infiniband/core/uverbs.h | 3 ++-
> drivers/infiniband/core/uverbs_cmd.c | 15 ++++++++++-----
> drivers/infiniband/core/uverbs_main.c | 6 ++++--
> include/uapi/rdma/ib_user_verbs.h | 6 +++---
> 4 files changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
> index bdc842e..a12b516 100644
> --- a/drivers/infiniband/core/uverbs.h
> +++ b/drivers/infiniband/core/uverbs.h
> @@ -245,7 +245,8 @@ IB_UVERBS_DECLARE_CMD(close_xrcd);
> #define IB_UVERBS_DECLARE_EX_CMD(name) \
> int ib_uverbs_ex_##name(struct ib_uverbs_file *file, \
> struct ib_udata *ucore, \
> - struct ib_udata *uhw)
> + struct ib_udata *uhw, \
> + __u32 comp_mask)
>
> IB_UVERBS_DECLARE_EX_CMD(create_flow);
> IB_UVERBS_DECLARE_EX_CMD(destroy_flow);
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index e35877d..a8ecb3a 100644
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -2633,7 +2633,8 @@ static int kern_spec_to_ib_spec(struct ib_uverbs_flow_spec *kern_spec,
>
> int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
> struct ib_udata *ucore,
> - struct ib_udata *uhw)
> + struct ib_udata *uhw,
> + __u32 comp_mask)
> {
> struct ib_uverbs_create_flow cmd;
> struct ib_uverbs_create_flow_resp resp;
> @@ -2647,6 +2648,9 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
> void *ib_spec;
> int i;
>
> + if (comp_mask)
> + return -EINVAL;
> +
> if (ucore->outlen < sizeof(resp))
> return -ENOSPC;
>
> @@ -2657,9 +2661,6 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
> ucore->inbuf +=izeof(cmd);
> ucore->inlen -=izeof(cmd);
>
> - if (cmd.comp_mask)
> - return -EINVAL;
> -
> if ((cmd.flow_attr.type =IB_FLOW_ATTR_SNIFFER &&
> !capable(CAP_NET_ADMIN)) || !capable(CAP_NET_RAW))
> return -EPERM;
> @@ -2785,13 +2786,17 @@ err_free_attr:
>
> int ib_uverbs_ex_destroy_flow(struct ib_uverbs_file *file,
> struct ib_udata *ucore,
> - struct ib_udata *uhw)
> + struct ib_udata *uhw,
> + __u32 comp_mask)
> {
> struct ib_uverbs_destroy_flow cmd;
> struct ib_flow *flow_id;
> struct ib_uobject *uobj;
> int ret;
>
> + if (comp_mask)
> + return -EINVAL;
> +
> ret =b_copy_from_udata(&cmd, ucore, sizeof(cmd));
> if (ret)
> return ret;
> diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
> index 4f00654..a9687dd 100644
> --- a/drivers/infiniband/core/uverbs_main.c
> +++ b/drivers/infiniband/core/uverbs_main.c
> @@ -119,7 +119,8 @@ static ssize_t (*uverbs_cmd_table[])(struct ib_uverbs_file *file,
>
> static int (*uverbs_ex_cmd_table[])(struct ib_uverbs_file *file,
> struct ib_udata *ucore,
> - struct ib_udata *uhw) =
> + struct ib_udata *uhw,
> + __u32 comp_mask) =
> [IB_USER_VERBS_EX_CMD_CREATE_FLOW] =b_uverbs_ex_create_flow,
> [IB_USER_VERBS_EX_CMD_DESTROY_FLOW] =b_uverbs_ex_destroy_flow
> };
> @@ -689,7 +690,8 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
>
> err =verbs_ex_cmd_table[command](file,
> &ucore,
> - &uhw);
> + &uhw,
> + ex_hdr.comp_mask);
>
> if (err)
> return err;
> diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
> index cbfdd4c..095a2bd 100644
> --- a/include/uapi/rdma/ib_user_verbs.h
> +++ b/include/uapi/rdma/ib_user_verbs.h
> @@ -139,7 +139,7 @@ struct ib_uverbs_ex_cmd_hdr {
> __u64 response;
> __u16 provider_in_words;
> __u16 provider_out_words;
> - __u32 cmd_hdr_reserved;
> + __u32 comp_mask;
> };
>
> struct ib_uverbs_get_context {
> @@ -783,8 +783,8 @@ struct ib_uverbs_flow_attr {
> };
>
> struct ib_uverbs_create_flow {
> - __u32 comp_mask;
> __u32 qp_handle;
> + __u32 reserved;
> struct ib_uverbs_flow_attr flow_attr;
> };
>
> @@ -794,8 +794,8 @@ struct ib_uverbs_create_flow_resp {
> };
>
> struct ib_uverbs_destroy_flow {
> - __u32 comp_mask;
> __u32 flow_handle;
> + __u32 reserved;
> };
>
> struct ib_uverbs_create_srq {
> --
> 1.8.3.1
>
I think that's a good idea to make the comp_mask field a part of our
infrastructure. But, I think we should consider making this symmetrical.
If we use the command's comp_mask as an input parameter, shouldn't we
use the response's comp_mask as an output parameter ?
What's about the provider's comp_mask ?
Matan
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-10-14 15:44 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 17:18 [PATCH 0/9] IB/core: batch of fix against create/destroy_flow uverbs for v3.12 Yann Droneaud
[not found] ` <cover.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2013-10-11 17:18 ` [PATCH 1/9] IB/core: clarify overflow/underflow checks on ib_create/destroy_flow Yann Droneaud
2013-10-11 17:18 ` [PATCH 2/9] IB/core: Includes flow attribute size in uverbs create_flow Yann Droneaud
[not found] ` <a83e37e225cd16e5a556b35dcadc7a1234519c2a.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2013-10-14 11:01 ` Or Gerlitz
[not found] ` <525BCF21.3090706-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-14 12:22 ` Yann Droneaud
2013-10-14 15:13 ` Matan Barak
2013-10-11 17:18 ` [PATCH 3/9] IB/core: Don't include command header " Yann Droneaud
[not found] ` <ca92c22d0aea21d559d57e6152cb313729a11274.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2013-10-14 15:21 ` Matan Barak
[not found] ` <525C0BF2.2060201-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-14 15:46 ` Yann Droneaud
[not found] ` <72b95284386dc57dfa1c7c883b4f45af-zgzEX58YAwA@public.gmane.org>
2013-10-14 18:19 ` Roland Dreier
[not found] ` <CAL1RGDWarJPu_6u5oaL6NgZZJXBuB09vTi9xhxHALfiY_W9Sgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-15 14:08 ` Yann Droneaud
[not found] ` <122f1a29d6fe45449a6a153a3a9ba8b1-zgzEX58YAwA@public.gmane.org>
2013-10-15 16:44 ` Roland Dreier
[not found] ` <CAL1RGDXP3+X=go4GiW_SsvSvC_VS-B7uacJN0u5wVtU3NWfvQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-15 17:07 ` Yann Droneaud
2013-10-15 21:34 ` Or Gerlitz
[not found] ` <CAJZOPZLr41MGb7qPHcFVQxNcwwAB8i4vnGQhEcu0oZ-BOiMBcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-16 0:04 ` Roland Dreier
[not found] ` <CAL1RGDW7KwSOmmsRxDokUHR-Mh1OzaQvDege5Rq7JsSU8AgEHQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-17 9:19 ` Or Gerlitz
[not found] ` <525FABA2.6000507-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-17 15:29 ` Yann Droneaud
[not found] ` <80c62f070af55a176923315b3fbb7b0d-zgzEX58YAwA@public.gmane.org>
2013-10-21 16:46 ` Roland Dreier
2013-10-11 17:18 ` [PATCH 4/9] IB/core: Rename 'flow' structs to match other uverbs structs Yann Droneaud
2013-10-11 17:18 ` [PATCH 5/9] IB/core: Makes uverbs flow structure using names more similar to verbs ones Yann Droneaud
2013-10-11 17:18 ` [PATCH 6/9] IB/core: Uses a common header for uverbs flow_specs Yann Droneaud
2013-10-11 17:18 ` [PATCH 7/9] IB/core: Remove ib_uverbs_flow_spec structure from userspace Yann Droneaud
[not found] ` <f8673f302536d503cdeef005a67f4531706ae578.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2013-10-14 15:26 ` Matan Barak
2013-10-11 17:18 ` [PATCH 8/9] IB/core: extended command: an improved infrastructure for uverbs commands Yann Droneaud
[not found] ` <0b84e20b204eb0fc67db9ca9106d6bf753a12ae3.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2013-10-14 15:38 ` Matan Barak
[not found] ` <525C0FF2.5040905-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-17 14:41 ` Matan Barak
[not found] ` <525FF724.5050601-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-10-17 15:05 ` Yann Droneaud
[not found] ` <f45595bcb4399ea2cb81d99a914dd9a0-zgzEX58YAwA@public.gmane.org>
2013-10-24 0:34 ` Or Gerlitz
2013-10-11 17:18 ` [PATCH 9/9] IB/core: extended command: move comp_mask to the extended header Yann Droneaud
[not found] ` <40175eda10d670d098204da6aa4c327a0171ae5f.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2013-10-14 15:44 ` Matan Barak [this message]
2013-10-14 15:36 ` [PATCH 0/9] IB/core: batch of fix against create/destroy_flow uverbs for v3.12 Or Gerlitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=525C1149.6000701@mellanox.com \
--to=matanb-vpraknaxozvwk0htik3j/w@public.gmane.org \
--cc=Igor.Ivanov-wN0M4riKYwLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.