All of lore.kernel.org
 help / color / mirror / Atom feed
From: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Hadar Hen Zion <hadarh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	matanb <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Shawn Bohrer
	<shawn.bohrer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Igor Ivanov <Igor.Ivanov-wN0M4riKYwLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH V4 for-next 2/4] IB/core: Infra-structure to support verbs extensions through uverbs
Date: Wed, 14 Aug 2013 12:06:31 +0300	[thread overview]
Message-ID: <520B4897.2010608@mellanox.com> (raw)
In-Reply-To: <CAL1RGDXJtrc849M6_XNZT5xO1+ybKtLWGq6yg6LhoSsKpsmkYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 13/08/2013 22:18, Roland Dreier wrote:
>> >+struct ib_uverbs_cmd_hdr_ex {
>> >+       __u32 command;
>> >+       __u16 in_words;
>> >+       __u16 out_words;
>> >+       __u16 provider_in_words;
>> >+       __u16 provider_out_words;
>> >+       __u32 cmd_hdr_reserved;
>> >+};
>> >+
> If I understand the vague explanations and the analogy to the
> presentation about userspace, then cmd_hdr_reserved is supposed to be
> used as a mask field.  Should a kernel that doesn't understand any
> mask components make sure that this reserved field is 0, and return an
> error if it isn't?  I don't see any code to do that, and it seems to
> risk new userspace silently getting wrong answers on an old kernel.
>
> Is there any reason not to name it as a mask field from the start?


NO.

The last field in the extended uverbs command header isn't for extending 
the command for which this instance serves as the header. Each new 
command which is defined in the extensions framework carries a comp_mask 
as the first field its specificstructure, for example


+struct ib_uverbs_create_flow  {
+	__u32 comp_mask;
+	__u64 response;
+	__u32 qp_handle;
+	struct ib_kern_flow_attr flow_attr;
+};

+struct ib_uverbs_destroy_flow  {
+	__u32 comp_mask;
+	__u32 flow_handle;
+};
+


As for new/modified user space working on old/unmodified kernel driver, 
the kernel will simply return -EINVAL based on inspecting the command 
field. This field is the first one in both the non-extended (old) and 
the extended (new) header.


> static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
>                              size_t count, loff_t *pos)
> {
>         struct ib_uverbs_file *file = filp->private_data;
>         struct ib_uverbs_cmd_hdr hdr;
>
>         if (count < sizeof hdr)
>                 return -EINVAL;
>
>         if (copy_from_user(&hdr, buf, sizeof hdr))
>                 return -EFAULT;
>
>         if (hdr.in_words * 4 != count)
>                 return -EINVAL;
>
>         if (hdr.command >= ARRAY_SIZE(uverbs_cmd_table) ||
>             !uverbs_cmd_table[hdr.command]) <-- old kernels will 
> return error here
>                 return -EINVAL;

--
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-08-14  9:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07 11:01 [PATCH V4 for-next 0/4] Add receive Flow Steering support Or Gerlitz
     [not found] ` <1375873322-19384-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-08-07 11:01   ` [PATCH V4 for-next 1/4] IB/core: " Or Gerlitz
2013-08-07 11:02   ` [PATCH V4 for-next 2/4] IB/core: Infra-structure to support verbs extensions through uverbs Or Gerlitz
     [not found]     ` <1375873322-19384-3-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-08-13 19:18       ` Roland Dreier
     [not found]         ` <CAL1RGDXJtrc849M6_XNZT5xO1+ybKtLWGq6yg6LhoSsKpsmkYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-14  9:06           ` Or Gerlitz [this message]
     [not found]             ` <520B4897.2010608-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-08-14 10:04               ` Or Gerlitz
2013-08-14 10:13           ` Or Gerlitz
2013-08-07 11:02   ` [PATCH V4 for-next 3/4] IB/core: Export ib_create/destroy_flow " Or Gerlitz
2013-08-07 11:02   ` [PATCH V4 for-next 4/4] IB/mlx4: Add receive Flow Steering support Or Gerlitz
2013-08-12 14:28   ` [PATCH V4 for-next 0/4] " 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=520B4897.2010608@mellanox.com \
    --to=ogerlitz-vpraknaxozvwk0htik3j/w@public.gmane.org \
    --cc=Igor.Ivanov-wN0M4riKYwLQT0dZR+AlfA@public.gmane.org \
    --cc=hadarh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=shawn.bohrer-Re5JQEeQqe8AvxtiuMwx3w@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.