aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHal Rosenstock <halr@voltaire.com>2005-07-27 14:45:41 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-27 19:26:14 -0400
commit3f75daddb4fc6b695faa4e12e76894389e913dcb (patch)
tree33f665bd5d0c42d616196dbbc15d9925519feb50
parenta977049dacdef6a9e69fb4872b42a68e93a69956 (diff)
[PATCH] IB: User MAD ABI changes to support RMPP
User MAD ABI changes to support RMPP Signed-off-by: Hal Rosenstock <halr@voltaire.com> Cc: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--Documentation/infiniband/user_mad.txt53
-rw-r--r--drivers/infiniband/include/ib_user_mad.h28
2 files changed, 62 insertions, 19 deletions
diff --git a/Documentation/infiniband/user_mad.txt b/Documentation/infiniband/user_mad.txt
index cae0c83f1ee9..750fe5e80ebc 100644
--- a/Documentation/infiniband/user_mad.txt
+++ b/Documentation/infiniband/user_mad.txt
@@ -28,13 +28,37 @@ Creating MAD agents
28 28
29Receiving MADs 29Receiving MADs
30 30
31 MADs are received using read(). The buffer passed to read() must be 31 MADs are received using read(). The receive side now supports
32 large enough to hold at least one struct ib_user_mad. For example: 32 RMPP. The buffer passed to read() must be at least one
33 33 struct ib_user_mad + 256 bytes. For example:
34 struct ib_user_mad mad; 34
35 ret = read(fd, &mad, sizeof mad); 35 If the buffer passed is not large enough to hold the received
36 if (ret != sizeof mad) 36 MAD (RMPP), the errno is set to ENOSPC and the length of the
37 buffer needed is set in mad.length.
38
39 Example for normal MAD (non RMPP) reads:
40 struct ib_user_mad *mad;
41 mad = malloc(sizeof *mad + 256);
42 ret = read(fd, mad, sizeof *mad + 256);
43 if (ret != sizeof mad + 256) {
44 perror("read");
45 free(mad);
46 }
47
48 Example for RMPP reads:
49 struct ib_user_mad *mad;
50 mad = malloc(sizeof *mad + 256);
51 ret = read(fd, mad, sizeof *mad + 256);
52 if (ret == -ENOSPC)) {
53 length = mad.length;
54 free(mad);
55 mad = malloc(sizeof *mad + length);
56 ret = read(fd, mad, sizeof *mad + length);
57 }
58 if (ret < 0) {
37 perror("read"); 59 perror("read");
60 free(mad);
61 }
38 62
39 In addition to the actual MAD contents, the other struct ib_user_mad 63 In addition to the actual MAD contents, the other struct ib_user_mad
40 fields will be filled in with information on the received MAD. For 64 fields will be filled in with information on the received MAD. For
@@ -50,18 +74,21 @@ Sending MADs
50 74
51 MADs are sent using write(). The agent ID for sending should be 75 MADs are sent using write(). The agent ID for sending should be
52 filled into the id field of the MAD, the destination LID should be 76 filled into the id field of the MAD, the destination LID should be
53 filled into the lid field, and so on. For example: 77 filled into the lid field, and so on. The send side does support
78 RMPP so arbitrary length MAD can be sent. For example:
79
80 struct ib_user_mad *mad;
54 81
55 struct ib_user_mad mad; 82 mad = malloc(sizeof *mad + mad_length);
56 83
57 /* fill in mad.data */ 84 /* fill in mad->data */
58 85
59 mad.id = my_agent; /* req.id from agent registration */ 86 mad->hdr.id = my_agent; /* req.id from agent registration */
60 mad.lid = my_dest; /* in network byte order... */ 87 mad->hdr.lid = my_dest; /* in network byte order... */
61 /* etc. */ 88 /* etc. */
62 89
63 ret = write(fd, &mad, sizeof mad); 90 ret = write(fd, &mad, sizeof *mad + mad_length);
64 if (ret != sizeof mad) 91 if (ret != sizeof *mad + mad_length)
65 perror("write"); 92 perror("write");
66 93
67Setting IsSM Capability Bit 94Setting IsSM Capability Bit
diff --git a/drivers/infiniband/include/ib_user_mad.h b/drivers/infiniband/include/ib_user_mad.h
index 06ad4a6075fa..a9a56b50aacc 100644
--- a/drivers/infiniband/include/ib_user_mad.h
+++ b/drivers/infiniband/include/ib_user_mad.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 6 * licenses. You may choose to be licensed under the terms of the GNU
@@ -29,7 +30,7 @@
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE. 31 * SOFTWARE.
31 * 32 *
32 * $Id: ib_user_mad.h 1389 2004-12-27 22:56:47Z roland $ 33 * $Id: ib_user_mad.h 2814 2005-07-06 19:14:09Z halr $
33 */ 34 */
34 35
35#ifndef IB_USER_MAD_H 36#ifndef IB_USER_MAD_H
@@ -42,7 +43,7 @@
42 * Increment this value if any changes that break userspace ABI 43 * Increment this value if any changes that break userspace ABI
43 * compatibility are made. 44 * compatibility are made.
44 */ 45 */
45#define IB_USER_MAD_ABI_VERSION 2 46#define IB_USER_MAD_ABI_VERSION 5
46 47
47/* 48/*
48 * Make sure that all structs defined in this file remain laid out so 49 * Make sure that all structs defined in this file remain laid out so
@@ -51,13 +52,13 @@
51 */ 52 */
52 53
53/** 54/**
54 * ib_user_mad - MAD packet 55 * ib_user_mad_hdr - MAD packet header
55 * @data - Contents of MAD
56 * @id - ID of agent MAD received with/to be sent with 56 * @id - ID of agent MAD received with/to be sent with
57 * @status - 0 on successful receive, ETIMEDOUT if no response 57 * @status - 0 on successful receive, ETIMEDOUT if no response
58 * received (transaction ID in data[] will be set to TID of original 58 * received (transaction ID in data[] will be set to TID of original
59 * request) (ignored on send) 59 * request) (ignored on send)
60 * @timeout_ms - Milliseconds to wait for response (unset on receive) 60 * @timeout_ms - Milliseconds to wait for response (unset on receive)
61 * @retries - Number of automatic retries to attempt
61 * @qpn - Remote QP number received from/to be sent to 62 * @qpn - Remote QP number received from/to be sent to
62 * @qkey - Remote Q_Key to be sent with (unset on receive) 63 * @qkey - Remote Q_Key to be sent with (unset on receive)
63 * @lid - Remote lid received from/to be sent to 64 * @lid - Remote lid received from/to be sent to
@@ -72,11 +73,12 @@
72 * 73 *
73 * All multi-byte quantities are stored in network (big endian) byte order. 74 * All multi-byte quantities are stored in network (big endian) byte order.
74 */ 75 */
75struct ib_user_mad { 76struct ib_user_mad_hdr {
76 __u8 data[256];
77 __u32 id; 77 __u32 id;
78 __u32 status; 78 __u32 status;
79 __u32 timeout_ms; 79 __u32 timeout_ms;
80 __u32 retries;
81 __u32 length;
80 __u32 qpn; 82 __u32 qpn;
81 __u32 qkey; 83 __u32 qkey;
82 __u16 lid; 84 __u16 lid;
@@ -91,6 +93,17 @@ struct ib_user_mad {
91}; 93};
92 94
93/** 95/**
96 * ib_user_mad - MAD packet
97 * @hdr - MAD packet header
98 * @data - Contents of MAD
99 *
100 */
101struct ib_user_mad {
102 struct ib_user_mad_hdr hdr;
103 __u8 data[0];
104};
105
106/**
94 * ib_user_mad_reg_req - MAD registration request 107 * ib_user_mad_reg_req - MAD registration request
95 * @id - Set by the kernel; used to identify agent in future requests. 108 * @id - Set by the kernel; used to identify agent in future requests.
96 * @qpn - Queue pair number; must be 0 or 1. 109 * @qpn - Queue pair number; must be 0 or 1.
@@ -103,6 +116,8 @@ struct ib_user_mad {
103 * management class to receive. 116 * management class to receive.
104 * @oui: Indicates IEEE OUI when mgmt_class is a vendor class 117 * @oui: Indicates IEEE OUI when mgmt_class is a vendor class
105 * in the range from 0x30 to 0x4f. Otherwise not used. 118 * in the range from 0x30 to 0x4f. Otherwise not used.
119 * @rmpp_version: If set, indicates the RMPP version used.
120 *
106 */ 121 */
107struct ib_user_mad_reg_req { 122struct ib_user_mad_reg_req {
108 __u32 id; 123 __u32 id;
@@ -111,6 +126,7 @@ struct ib_user_mad_reg_req {
111 __u8 mgmt_class; 126 __u8 mgmt_class;
112 __u8 mgmt_class_version; 127 __u8 mgmt_class_version;
113 __u8 oui[3]; 128 __u8 oui[3];
129 __u8 rmpp_version;
114}; 130};
115 131
116#define IB_IOCTL_MAGIC 0x1b 132#define IB_IOCTL_MAGIC 0x1b