aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
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 /Documentation
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>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/infiniband/user_mad.txt53
1 files changed, 40 insertions, 13 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