linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: "Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [RFC] split struct ib_send_wr
Date: Tue, 4 Aug 2015 09:29:24 -0700	[thread overview]
Message-ID: <20150804162924.GA4867@infradead.org> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A82373A902272C-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>

On Tue, Aug 04, 2015 at 04:07:42PM +0000, Hefty, Sean wrote:
> This looks like a reasonable start.  It may help with feedback if you
> could just post the changes to ib_verbs.h.

Not sure it's all that useful, but here we go:


diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 0940051..666b571 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1100,55 +1100,96 @@ struct ib_send_wr {
 		__be32		imm_data;
 		u32		invalidate_rkey;
 	} ex;
-	union {
-		struct {
-			u64	remote_addr;
-			u32	rkey;
-		} rdma;
-		struct {
-			u64	remote_addr;
-			u64	compare_add;
-			u64	swap;
-			u64	compare_add_mask;
-			u64	swap_mask;
-			u32	rkey;
-		} atomic;
-		struct {
-			struct ib_ah *ah;
-			void   *header;
-			int     hlen;
-			int     mss;
-			u32	remote_qpn;
-			u32	remote_qkey;
-			u16	pkey_index; /* valid for GSI only */
-			u8	port_num;   /* valid for DR SMPs on switch only */
-		} ud;
-		struct {
-			u64				iova_start;
-			struct ib_fast_reg_page_list   *page_list;
-			unsigned int			page_shift;
-			unsigned int			page_list_len;
-			u32				length;
-			int				access_flags;
-			u32				rkey;
-		} fast_reg;
-		struct {
-			struct ib_mw            *mw;
-			/* The new rkey for the memory window. */
-			u32                      rkey;
-			struct ib_mw_bind_info   bind_info;
-		} bind_mw;
-		struct {
-			struct ib_sig_attrs    *sig_attrs;
-			struct ib_mr	       *sig_mr;
-			int			access_flags;
-			struct ib_sge	       *prot;
-		} sig_handover;
-	} wr;
 	u32			xrc_remote_srq_num;	/* XRC TGT QPs only */
 };
 
+struct ib_rdma_wr {
+	struct ib_send_wr	wr;
+	u64			remote_addr;
+	u32			rkey;
+};
+
+static inline struct ib_rdma_wr *rdma_wr(struct ib_send_wr *wr)
+{
+	return container_of(wr, struct ib_rdma_wr, wr);
+}
+
+struct ib_atomic_wr {
+	struct ib_send_wr	wr;
+	u64			remote_addr;
+	u64			compare_add;
+	u64			swap;
+	u64			compare_add_mask;
+	u64			swap_mask;
+	u32			rkey;
+};
+
+static inline struct ib_atomic_wr *atomic_wr(struct ib_send_wr *wr)
+{
+	return container_of(wr, struct ib_atomic_wr, wr);
+}
+
+struct ib_ud_wr {
+	struct ib_send_wr	wr;
+	struct ib_ah		*ah;
+	void			*header;
+	int			hlen;
+	int			mss;
+	u32			remote_qpn;
+	u32			remote_qkey;
+	u16			pkey_index; /* valid for GSI only */
+	u8			port_num;   /* valid for DR SMPs on switch only */
+};
+
+static inline struct ib_ud_wr *ud_wr(struct ib_send_wr *wr)
+{
+	return container_of(wr, struct ib_ud_wr, wr);
+}
+
+struct ib_fast_reg_wr {
+	struct ib_send_wr	wr;
+	u64			iova_start;
+	struct ib_fast_reg_page_list *page_list;
+	unsigned int		page_shift;
+	unsigned int		page_list_len;
+	u32			length;
+	int			access_flags;
+	u32			rkey;
+};
+
+static inline struct ib_fast_reg_wr *fast_reg_wr(struct ib_send_wr *wr)
+{
+	return container_of(wr, struct ib_fast_reg_wr, wr);
+}
+
+struct ib_bind_mw_wr {
+	struct ib_send_wr	wr;
+	struct ib_mw		*mw;
+	/* The new rkey for the memory window. */
+	u32			rkey;
+	struct ib_mw_bind_info	bind_info;
+};
+
+static inline struct ib_bind_mw_wr *bind_mw_wr(struct ib_send_wr *wr)
+{
+	return container_of(wr, struct ib_bind_mw_wr, wr);
+}
+
+struct ib_sig_handover_wr {
+	struct ib_send_wr	wr;
+	struct ib_sig_attrs    *sig_attrs;
+	struct ib_mr	       *sig_mr;
+	int			access_flags;
+	struct ib_sge	       *prot;
+};
+
+static inline struct ib_sig_handover_wr *sig_handover_wr(struct ib_send_wr *wr)
+{
+	return container_of(wr, struct ib_sig_handover_wr, wr);
+}
+
 struct ib_recv_wr {
+	struct ib_send_wr	wr;
 	struct ib_recv_wr      *next;
 	u64			wr_id;
 	struct ib_sge	       *sg_list;
--
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:[~2015-08-04 16:29 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 14:34 [RFC] split struct ib_send_wr Christoph Hellwig
     [not found] ` <20150804143447.GA22172-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-08-04 16:07   ` Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A82373A902272C-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-08-04 16:29       ` Christoph Hellwig [this message]
     [not found]         ` <20150804162924.GA4867-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-08-04 16:36           ` Bart Van Assche
     [not found]             ` <55C0EA21.2070609-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-08-04 16:41               ` Christoph Hellwig
2015-08-06  4:40   ` Jason Gunthorpe
     [not found]     ` <20150806044008.GB14153-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-08-06  9:47       ` Christoph Hellwig
2015-08-06 16:24   ` Christoph Hellwig
     [not found]     ` <20150806162438.GA27608-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-08-06 16:46       ` Sagi Grimberg
     [not found]         ` <55C38F74.7070200-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-08-07  7:05           ` Christoph Hellwig
2015-08-06 17:04       ` Steve Wise
     [not found]         ` <55C393A0.6000002-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2015-08-06 17:31           ` Christoph Hellwig
     [not found]             ` <20150806173143.GA25497-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-08-06 17:44               ` Steve Wise
2015-08-06 17:58                 ` Chuck Lever
     [not found]                   ` <0B199DE1-B76A-44BD-91BC-E4285E439C70-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-08-07  6:36                     ` Christoph Hellwig
     [not found]                       ` <20150807063637.GE31458-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-08-07 14:17                         ` Chuck Lever
     [not found]                           ` <72E34077-7332-4F7D-8498-E67E7192CD2A-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-08-07 14:19                             ` Christoph Hellwig
     [not found]                               ` <20150807141929.GA12442-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-08-13  1:45                                 ` Doug Ledford
     [not found]                                   ` <55CBF6C1.8010803-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-08-13  2:24                                     ` Chuck Lever
     [not found]                                       ` <79BCB01F-AD69-4BEB-8F03-F5A52701211E-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-08-13  5:54                                         ` Christoph Hellwig
     [not found]                                           ` <20150813055450.GA19344-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-08-13 13:07                                             ` Doug Ledford
     [not found]                                               ` <55CC9682.1020203-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-08-13 16:04                                                 ` Christoph Hellwig
     [not found]                                                   ` <20150813160439.GA32690-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-08-13 16:46                                                     ` Chuck Lever
2015-08-13 17:22                                                     ` Jason Gunthorpe
     [not found]                                                       ` <20150813172234.GB13535-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-08-13 17:53                                                         ` Christoph Hellwig
     [not found]                                                           ` <20150813175354.GA4566-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-08-13 18:01                                                             ` Jason Gunthorpe
2015-08-17  7:20                                                     ` Christoph Hellwig
2015-08-07  6:36                 ` 'Christoph Hellwig'
2015-08-06 17:38       ` Parav Pandit
     [not found]         ` <CAG53R5VWR99OUmVTYWjvQiPKDuZ=ogbsEyfTJMcURjeohYyLmQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-07  6:35           ` Christoph Hellwig
2015-08-07 18:56       ` Steve Wise
2015-08-10 23:44       ` Bart Van Assche
2015-08-12 17:24       ` Sagi Grimberg
     [not found]         ` <55CB8161.8040702-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-08-13 15:38           ` Christoph Hellwig

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=20150804162924.GA4867@infradead.org \
    --to=hch-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@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;
as well as URLs for NNTP newsgroup(s).