From: Jason Gunthorpe <jgg@ziepe.ca>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
Leon Romanovsky <leonro@mellanox.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>,
Yishai Hadas <yishaih@mellanox.com>,
Saeed Mahameed <saeedm@mellanox.com>,
linux-netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH rdma-next 6/9] IB/mlx5: Introduce vendor create and destroy flow methods
Date: Tue, 10 Jul 2018 11:44:17 -0600 [thread overview]
Message-ID: <20180710174417.GC8266@ziepe.ca> (raw)
In-Reply-To: <20180708102445.25496-7-leon@kernel.org>
On Sun, Jul 08, 2018 at 01:24:42PM +0300, Leon Romanovsky wrote:
> +static int UVERBS_HANDLER(MLX5_IB_METHOD_CREATE_FLOW)(struct ib_device *ib_dev,
> + struct ib_uverbs_file *file,
> + struct uverbs_attr_bundle *attrs)
> +{
> + struct mlx5_ib_dev *dev = to_mdev(ib_dev);
Same comment as before, the dev needs to come from uboj->context->device
> -/* Used by drivers to declare a complete parsing tree for a single method that
> - * differs only in having additional driver specific attributes.
> +/* Used by drivers to declare a complete parsing tree for new methods
> */
> -#define ADD_UVERBS_ATTRIBUTES_SIMPLE(_name, _object_id, _method_id, ...) \
> - static const struct uverbs_attr_def *const UVERBS_METHOD_ATTRS( \
> - _method_id)[] = { __VA_ARGS__ }; \
> - static const struct uverbs_method_def UVERBS_METHOD(_method_id) = { \
> - .id = _method_id, \
> - .num_attrs = ARRAY_SIZE(UVERBS_METHOD_ATTRS(_method_id)), \
> - .attrs = &UVERBS_METHOD_ATTRS(_method_id), \
> - }; \
> +#define ADD_UVERBS_METHODS(_name, _object_id, ...) \
> static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \
> - _object_id)[] = { &UVERBS_METHOD(_method_id) }; \
> + _object_id)[] = { __VA_ARGS__ }; \
> static const struct uverbs_object_def _name##_struct = { \
> .id = _object_id, \
> - .num_methods = 1, \
> + .num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
> .methods = &UVERBS_OBJECT_METHODS(_object_id) \
> }; \
> static const struct uverbs_object_def *const _name##_ptrs[] = { \
> @@ -123,4 +115,17 @@
> .objects = &_name##_ptrs, \
> }
>
> +/* Used by drivers to declare a complete parsing tree for a single method that
> + * differs only in having additional driver specific attributes.
> + */
> +#define ADD_UVERBS_ATTRIBUTES_SIMPLE(_name, _object_id, _method_id, ...) \
> + static const struct uverbs_attr_def *const UVERBS_METHOD_ATTRS( \
> + _method_id)[] = { __VA_ARGS__ }; \
> + static const struct uverbs_method_def UVERBS_METHOD(_method_id) = { \
> + .id = _method_id, \
> + .num_attrs = ARRAY_SIZE(UVERBS_METHOD_ATTRS(_method_id)), \
> + .attrs = &UVERBS_METHOD_ATTRS(_method_id), \
> + }; \
> + ADD_UVERBS_METHODS(_name, _object_id, _method_id)
Wow. How does that even compile? Oh I see, the only two users are
passing in a 0 constant which the compiler will understand as NULL
without a warning.
I guess this is an instant crash at runtime?
Should be:
ADD_UVERBS_METHODS(_name, _object_id, &UVERBS_METHOD(_method_id)
Jason
next prev parent reply other threads:[~2018-07-10 17:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-08 10:24 [PATCH rdma-next 0/9] Support mlx5 flow steering with RAW data Leon Romanovsky
2018-07-08 10:24 ` [PATCH mlx5-next 1/9] net/mlx5: Add forward compatible support for the FTE match data Leon Romanovsky
2018-07-08 10:24 ` [PATCH mlx5-next 2/9] net/mlx5: Add support for flow table destination number Leon Romanovsky
2018-07-10 22:26 ` Saeed Mahameed
2018-07-11 9:47 ` Yishai Hadas
2018-07-08 10:24 ` [PATCH rdma-next 3/9] IB: Enable uverbs_destroy_def_handler to be used by drivers Leon Romanovsky
2018-07-08 10:24 ` [PATCH rdma-next 4/9] IB/mlx5: Introduce flow steering matcher object Leon Romanovsky
2018-07-10 17:34 ` Jason Gunthorpe
2018-07-11 9:32 ` Yishai Hadas
2018-07-11 12:02 ` Jason Gunthorpe
2018-07-08 10:24 ` [PATCH rdma-next 5/9] IB: Consider ib_flow creation by the KABI infrastructure Leon Romanovsky
2018-07-08 10:24 ` [PATCH rdma-next 6/9] IB/mlx5: Introduce vendor create and destroy flow methods Leon Romanovsky
2018-07-10 17:44 ` Jason Gunthorpe [this message]
2018-07-11 9:44 ` Yishai Hadas
2018-07-08 10:24 ` [PATCH rdma-next 7/9] IB/mlx5: Support adding flow steering rule by raw data Leon Romanovsky
2018-07-08 10:24 ` [PATCH rdma-next 8/9] IB/mlx5: Add support for a flow table destination Leon Romanovsky
2018-07-08 10:24 ` [PATCH rdma-next 9/9] IB/mlx5: Expose vendor flow trees Leon Romanovsky
2018-07-10 18:28 ` [PATCH rdma-next 0/9] Support mlx5 flow steering with RAW data Jason Gunthorpe
2018-07-11 5:43 ` Leon Romanovsky
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=20180710174417.GC8266@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=dledford@redhat.com \
--cc=leon@kernel.org \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.com \
--cc=yishaih@mellanox.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).