All of lore.kernel.org
 help / color / mirror / Atom feed
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>
Subject: Re: [PATCH 7/9] IB/core: Remove ib_uverbs_flow_spec structure from userspace
Date: Mon, 14 Oct 2013 18:26:40 +0300	[thread overview]
Message-ID: <525C0D30.2050602@mellanox.com> (raw)
In-Reply-To: <f8673f302536d503cdeef005a67f4531706ae578.1381510045.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>

On 11/10/2013 8:56 PM, Yann Droneaud wrote:
> The structure holding any types of flow_spec is of no use to userspace.
> It would be wrong for userspace to do:
>
>    struct ib_uverbs_flow_spec flow_spec;
>
>    flow_spec.type =B_FLOW_SPEC_TCP;
>    flow_spec.size =izeof(flow_spec);
>
> Instead, userspace should use the dedicated flow_spec structure for
>    - Ethernet : struct ib_uverbs_flow_spec_eth,
>    - IPv4     : struct ib_uverbs_flow_spec_ipv4,
>    - TCP/UDP  : struct ib_uverbs_flow_spec_tcp_udp.
>
> In other words, struct ib_uverbs_flow_spec is a "virtual"
> data structure that can only be use by the kernel as an alias
> to the other.
>
> 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  | 16 ++++++++++++++++
>   include/uapi/rdma/ib_user_verbs.h | 16 ----------------
>   2 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
> index d040b87..4ae0307 100644
> --- a/drivers/infiniband/core/uverbs.h
> +++ b/drivers/infiniband/core/uverbs.h
> @@ -178,6 +178,22 @@ void ib_uverbs_event_handler(struct ib_event_handler *handler,
>                               struct ib_event *event);
>   void ib_uverbs_dealloc_xrcd(struct ib_uverbs_device *dev, struct ib_xrcd *xrcd);
>
> +struct ib_uverbs_flow_spec {
> +       union {
> +               union {
> +                       struct ib_uverbs_flow_spec_hdr hdr;
> +                       struct {
> +                               __u32 type;
> +                               __u16 size;
> +                               __u16 reserved;
> +                       };
> +               };
> +               struct ib_uverbs_flow_spec_eth     eth;
> +               struct ib_uverbs_flow_spec_ipv4    ipv4;
> +               struct ib_uverbs_flow_spec_tcp_udp tcp_udp;
> +       };
> +};
> +
>   #define IB_UVERBS_DECLARE_CMD(name)                                    \
>          ssize_t ib_uverbs_##name(struct ib_uverbs_file *file,           \
>                                   const char __user *buf, int in_len,    \
> diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
> index f7f233b5..93577fc 100644
> --- a/include/uapi/rdma/ib_user_verbs.h
> +++ b/include/uapi/rdma/ib_user_verbs.h
> @@ -760,22 +760,6 @@ struct ib_uverbs_flow_spec_tcp_udp {
>          struct ib_uverbs_flow_tcp_udp_filter mask;
>   };
>
> -struct ib_uverbs_flow_spec {
> -       union {
> -               union {
> -                       struct ib_uverbs_flow_spec_hdr hdr;
> -                       struct {
> -                               __u32 type;
> -                               __u16 size;
> -                               __u16 reserved;
> -                       };
> -               };
> -               struct ib_uverbs_flow_spec_eth      eth;
> -               struct ib_uverbs_flow_spec_ipv4    ipv4;
> -               struct ib_uverbs_flow_spec_tcp_udp tcp_udp;
> -       };
> -};
> -
>   struct ib_uverbs_flow_attr {
>          __u32 type;
>          __u16 size;
> --
> 1.8.3.1
>

Hi,

Nice catch - exposing struct ib_uverbs_flow_spec to userspace imposes 
another risk. Adding a spec that is larger than all previous specs will 
result in a larger  ib_uverbs_flow_spec structure. This in turn could 
lead to ABI breaks - something we definitely don't want. The ABI 
shouldn't include a "do-it-all" spec.

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

  parent reply	other threads:[~2013-10-14 15:26 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 [this message]
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
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=525C0D30.2050602@mellanox.com \
    --to=matanb-vpraknaxozvwk0htik3j/w@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.