public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: "Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "linux-rdma
	(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"miked-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<miked-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	"Tzahi Oved (tzahio-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org)"
	<tzahio-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH v3 1/2] libmlx4: Infra-structure changes to support verbs extensions
Date: Sun, 30 Sep 2012 15:14:14 -0600	[thread overview]
Message-ID: <20120930211414.GA26575@obsidianresearch.com> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A8237346A981D8-Q3cL8pyY+6ukrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>

> -static struct ibv_device *mlx4_driver_init(const char *uverbs_sys_path,
> -					    int abi_version)
> +static struct verbs_device *mlx4_driver_init(const char *uverbs_sys_path,
> +					     int abi_version)
>  {
>  	char			value[8];
> -	struct mlx4_device    *dev;
> +	struct mlx4_device_ex	*dev;
>  	unsigned		vendor, device;
>  	int			i;

[..]

The allocation of 'dev' needs to be via zero'ing calloc so new
unsupported members of verbs_device are zero'd.

> +++ b/src/mlx4.h
> @@ -135,6 +135,11 @@ struct mlx4_device {
>  	int				page_size;
>  };
>  
> +struct mlx4_device_ex {
> +	struct verbs_device	verbs_dev;
> +	int			page_size;
> +};
> +

This looks wrong to me. offsetof(page_size) will be different on
mlx4_device_ex vs mlx4_device, and mlx4_alloc_cq_buf has no test to
correct for that.

mlx4_device_ex should be removed, and mlx4_device changed to always
use verbs_device, as a provider-allocated structure the provider
assumes the ibv_device * pointers it gets were created by driver_init.

> +#define to_mxxx_ex(xxx, type)						\
> +	((struct mlx4_##type##_ex *)					\
> +	 ((void *) verbs##xxx - offsetof(struct mlx4_##type##_ex, verbs_##xxx)))
> +
> +
> +static inline struct mlx4_device_ex *to_mdev_ex(const struct verbs_device
> +						*verbsdev)
> +{
> +	return to_mxxx_ex(dev, device);
> +}

Dump too..

Maybe make your containerof available to the providers and ditch all
these converters?

Jason
--
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:[~2012-09-30 21:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 22:53 [PATCH v3 1/2] libmlx4: Infra-structure changes to support verbs extensions Hefty, Sean
     [not found] ` <1828884A29C6694DAF28B7E6B8A8237346A981D8-Q3cL8pyY+6ukrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-09-30 21:14   ` Jason Gunthorpe [this message]
     [not found]     ` <20120930211414.GA26575-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2012-10-11 16:26       ` Yishai Hadas
2013-03-16  0:39   ` [PATCH v4 " sean.hefty-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1363394396-951-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-03-18 19:10       ` [PATCH libmlx4 v5 1/2] " sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-03-18 19:10       ` [PATCH libmlx4 v5 2/2] Add support for XRC QPs sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-03-16  0:39   ` [PATCH v4 2/2] libmlx4: " sean.hefty-ral2JQCrhuEAvxtiuMwx3w

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=20120930211414.GA26575@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=miked-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=tzahio-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox