[openib-general] [PATCH] libibat: little / big endian problems in example programs

Heiko J Schick SCHICKHJ at de.ibm.com
Thu Oct 6 05:14:43 PDT 2005


Hello,

during (some) test with libibat I found out that the example programs 
include a little/big endian problem.
Below you will find the patch for ats.c and att.c which will solve this 
problem on PPC64:

Signed-off-by: Heiko Joerg Schick <schickhj at de.ibm.com>

--- /home/source/trunk_3615_orig/src/userspace/libibat/examples/ats.c 
2005-08-23 18:49:39.000000000 +0200
+++ ats.c       2005-10-06 13:42:02.492909848 +0200
@@ -225,7 +225,7 @@ int main(int argc, char **argv)
        }

        for (i = 0; i < MAX_REQ; i++) {
-               r = ib_at_route_by_ip(0x0100a8c0, 0, 0,
+               r = ib_at_route_by_ip(htonl(0xc0a80001), 0, 0,
                                      IB_AT_ROUTE_FORCE_ATS,
                                      att_rt + i, att_rt_comp + i, 
&req_id);


--- /home/source/trunk_3615_orig/src/userspace/libibat/examples/att.c 
2005-08-23 18:49:39.000000000 +0200
+++ att.c       2005-10-06 13:40:26.293891760 +0200
@@ -190,7 +190,7 @@ int main(int argc, char **argv)
        }

        for (i = 0; i < MAX_REQ; i++) {
-               r = ib_at_route_by_ip(0x0100a8c0, 0, 0, 0,
+               r = ib_at_route_by_ip(htonl(0xc0a80001), 0, 0, 0,
                                      att_rt + i, att_rt_comp + i, 
&req_id);

 #if __WORDSIZE == 64

BTW. Does the output of the uatt program looks alright?

uatt: att_path_comp_fn: id 21 context 0x10012ae8 completed with rec_num 1
===> slid 0xab dlid 0xae
uatt: main: ib_at_route_by_ip: ret 1 errno 0 for request 21 id 0 0
uatt: att_rt_comp_fn: id 0 context 0x100135f0 completed with rec_num 1
===> rt 0x100135f0 sgid 0xfe8000000000000067eafbe000040001 dgid 
0xfe8000000000000067eafbe000040002
uatt: att_rt_comp_fn: ib_at_paths_by_route: ret 0 errno 0 id 22 22
uatt: att_path_comp_fn: id 22 context 0x10012b30 completed with rec_num 1
===> slid 0xab dlid 0xae
uatt: main: ib_at_route_by_ip: ret 1 errno 0 for request 22 id 0 0
uatt: att_rt_comp_fn: id 0 context 0x10013628 completed with rec_num 1
===> rt 0x10013628 sgid 0xfe8000000000000067eafbe000040001 dgid 
0xfe8000000000000067eafbe000040002
uatt: att_rt_comp_fn: ib_at_paths_by_route: ret 0 errno 0 id 23 23
uatt: att_path_comp_fn: id 23 context 0x10012b78 completed with rec_num 1
===> slid 0xab dlid 0xae
...

Many thanks in advance!

Mit freundlichen Gruessen / Kind Regards
Heiko Joerg Schick

IBM Deutschland Entwicklung GmbH
I/Ox Microcode Development
Linux Infiniband Device Drivers

Schoenaicher Str. 220
71032 Boeblingen
E-Mail: schickhj at de.ibm.com
External: 49-7031-16-0 x4219,   t/l: 120-4219
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20051006/b283449a/attachment.html>


More information about the general mailing list