All of lore.kernel.org
 help / color / mirror / Atom feed
From: sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH v4 1/9] rdma/cm: define native IB address
Date: Tue, 22 Jan 2013 13:56:29 -0800	[thread overview]
Message-ID: <1358891797-14625-2-git-send-email-sean.hefty@intel.com> (raw)
In-Reply-To: <1358891797-14625-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Define AF_IB and sockaddr_ib to allow the rdma_cm to use native IB
addressing.

Signed-off-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 include/linux/socket.h |    2 +
 include/rdma/ib.h      |   89 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 0 deletions(-)
 create mode 100644 include/rdma/ib.h

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 9a546ff..17a33f7 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -167,6 +167,7 @@ struct ucred {
 #define AF_PPPOX	24	/* PPPoX sockets		*/
 #define AF_WANPIPE	25	/* Wanpipe API Sockets */
 #define AF_LLC		26	/* Linux LLC			*/
+#define AF_IB		27	/* Native InfiniBand address	*/
 #define AF_CAN		29	/* Controller Area Network      */
 #define AF_TIPC		30	/* TIPC sockets			*/
 #define AF_BLUETOOTH	31	/* Bluetooth sockets 		*/
@@ -210,6 +211,7 @@ struct ucred {
 #define PF_PPPOX	AF_PPPOX
 #define PF_WANPIPE	AF_WANPIPE
 #define PF_LLC		AF_LLC
+#define PF_IB		AF_IB
 #define PF_CAN		AF_CAN
 #define PF_TIPC		AF_TIPC
 #define PF_BLUETOOTH	AF_BLUETOOTH
diff --git a/include/rdma/ib.h b/include/rdma/ib.h
new file mode 100644
index 0000000..cf8f9e7
--- /dev/null
+++ b/include/rdma/ib.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2010 Intel Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#if !defined(_RDMA_IB_H)
+#define _RDMA_IB_H
+
+#include <linux/types.h>
+
+struct ib_addr {
+	union {
+		__u8		uib_addr8[16];
+		__be16		uib_addr16[8];
+		__be32		uib_addr32[4];
+		__be64		uib_addr64[2];
+	} ib_u;
+#define sib_addr8		ib_u.uib_addr8
+#define sib_addr16		ib_u.uib_addr16
+#define sib_addr32		ib_u.uib_addr32
+#define sib_addr64		ib_u.uib_addr64
+#define sib_raw			ib_u.uib_addr8
+#define sib_subnet_prefix	ib_u.uib_addr64[0]
+#define sib_interface_id	ib_u.uib_addr64[1]
+};
+
+static inline int ib_addr_any(const struct ib_addr *a)
+{
+	return ((a->sib_addr64[0] | a->sib_addr64[1]) == 0);
+}
+
+static inline int ib_addr_loopback(const struct ib_addr *a)
+{
+	return ((a->sib_addr32[0] | a->sib_addr32[1] |
+		 a->sib_addr32[2] | (a->sib_addr32[3] ^ htonl(1))) == 0);
+}
+
+static inline void ib_addr_set(struct ib_addr *addr,
+			       __be32 w1, __be32 w2, __be32 w3, __be32 w4)
+{
+	addr->sib_addr32[0] = w1;
+	addr->sib_addr32[1] = w2;
+	addr->sib_addr32[2] = w3;
+	addr->sib_addr32[3] = w4;
+}
+
+static inline int ib_addr_cmp(const struct ib_addr *a1, const struct ib_addr *a2)
+{
+	return memcmp(a1, a2, sizeof(struct ib_addr));
+}
+
+struct sockaddr_ib {
+	unsigned short int	sib_family;	/* AF_IB */
+	__be16			sib_pkey;
+	__be32			sib_flowinfo;
+	struct ib_addr		sib_addr;
+	__be64			sib_sid;
+	__be64			sib_sid_mask;
+	__u64			sib_scope_id;
+};
+
+#endif /* _RDMA_IB_H */
-- 
1.7.3

--
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-01-22 21:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-22 21:56 [PATCH v4 0/9] rdma/cm: Add support for native Infiniband addressing sean.hefty-ral2JQCrhuEAvxtiuMwx3w
     [not found] ` <1358891797-14625-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-22 21:56   ` sean.hefty-ral2JQCrhuEAvxtiuMwx3w [this message]
2013-02-11 18:02     ` [PATCH v4 1/9] rdma/cm: define native IB address Hefty, Sean
2013-02-13 12:51       ` Or Gerlitz
     [not found]       ` <1828884A29C6694DAF28B7E6B8A8237368B99D59-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-03-01  3:49         ` Hefty, Sean
     [not found]           ` <1828884A29C6694DAF28B7E6B8A823736F35600F-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-03-06 15:40             ` Qperf and APM Suresh Shelvapille
     [not found]               ` <82EBBE0B04D4427381C29144BE078F2B-+IkoAhRkys/CbFgIbBqbbjGjJy/sRE9J@public.gmane.org>
2013-03-06 18:51                 ` Luick, Dean
     [not found]                   ` <4AF12E8016D2BF46BCDFCE8FAA77A3580394D479-96pTJSsuoYQd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-03-06 18:59                     ` Suresh Shelvapille
     [not found]                       ` <58D79FF01489431AB6D87CD4977F2E45-+IkoAhRkys/CbFgIbBqbbjGjJy/sRE9J@public.gmane.org>
2013-03-06 20:56                         ` Luick, Dean
     [not found]                           ` <4AF12E8016D2BF46BCDFCE8FAA77A3580394D4FB-96pTJSsuoYQd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-03-06 22:24                             ` Suresh Shelvapille
     [not found]                               ` <8AF67C8E913E4EE49D65CABA83E3DEBF-+IkoAhRkys/CbFgIbBqbbjGjJy/sRE9J@public.gmane.org>
2013-03-13 22:25                                 ` Luick, Dean
     [not found]                                   ` <4AF12E8016D2BF46BCDFCE8FAA77A3580394F46B-96pTJSsuoYQd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-03-13 22:43                                     ` Suresh Shelvapille
2013-02-13 12:56     ` [PATCH v4 1/9] rdma/cm: define native IB address Or Gerlitz
2013-02-13 12:56       ` Or Gerlitz
2013-01-22 21:56   ` [PATCH v4 2/9] rdma/cm: Include AF_IB in loopback and any address checks sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-01-22 21:56   ` [PATCH v4 4/9] rdma/cm: Update port reservation to support AF_IB sean.hefty-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1358891797-14625-5-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-02-13 11:09       ` Or Gerlitz
2013-02-13 11:09         ` Or Gerlitz
     [not found]         ` <511B7474.3040201-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-02-13 17:44           ` Hefty, Sean
2013-02-13 18:10             ` Jason Gunthorpe
2013-02-13 18:19               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A8237368B9A432-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-02-13 18:26                   ` Jason Gunthorpe
2013-02-13 18:37                     ` Hefty, Sean
2013-01-22 21:56   ` [PATCH v4 6/9] rdma/cm: Do not modify sa_family when setting loopback address sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-01-22 21:56   ` [PATCH v4 7/9] rdma/cm: Add helper functions to return id address information sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-02-13 12:44     ` Or Gerlitz
2013-02-13 12:44       ` Or Gerlitz
2013-01-22 21:56   ` [PATCH v4 8/9] rdma/cm: Restrict AF_IB loopback to binding to IB devices only sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-01-22 21:56   ` [PATCH v4 9/9] rdma/cm: Verify that source and dest sa_family are the same sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-01-22 21:56 ` [PATCH v4 3/9] ib/addr: Add AF_IB support to ip_addr_size sean.hefty
2013-01-22 21:56 ` [PATCH v4 5/9] rdma/cm: Allow user to specify AF_IB when binding sean.hefty

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=1358891797-14625-2-git-send-email-sean.hefty@intel.com \
    --to=sean.hefty-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@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.