aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2006-02-14 03:38:30 +0000
committerRoland Dreier <rolandd@cisco.com>2006-11-09 11:35:59 -0800
commitd00e2fc5f830ef7cce1c2dd76e356d3166ec38dd (patch)
tree273b93264c41b594f525f0929176b4f1fb3892cd
parentadb3e447db1f5f9ce0ac18054ab77db3eff32fc6 (diff)
downloadlibibverbs-d00e2fc5f830ef7cce1c2dd76e356d3166ec38dd.tar.gz
Remove cpu_to_be64/be64_to_cpu
Remove duplicated cpu_to_be64/be64_to_cpu functions in favor of htonll/ntohll from <infiniband/arch.h>. Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--ChangeLog6
-rw-r--r--README2
-rw-r--r--examples/asyncwatch.c6
-rw-r--r--examples/device_list.c9
-rw-r--r--examples/devinfo.c17
-rw-r--r--include/infiniband/driver.h2
-rw-r--r--include/infiniband/verbs.h4
-rw-r--r--src/init.c2
8 files changed, 19 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index b16495c..d28bea2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-13 Roland Dreier <rdreier@cisco.com>
+
+ * examples/asyncwatch.c, examples/device_list.c,
+ examples/devinfo.c: Remove cpu_to_be64()/be64_to_cpu() and use
+ htonll()/ntohll() from <infiniband/arch.h>.
+
2006-02-13 Dotan Barak <dotanb@mellanox.co.il>
* src/cmd.c (ibv_cmd_query_qp, ibv_cmd_query_srq),
diff --git a/README b/README
index 37074a8..347612d 100644
--- a/README
+++ b/README
@@ -99,4 +99,4 @@ TODO
====
* Memory windows (MWs) need to be implemented.
- * Query QP, query SRQ and other query verbs need to be implemented.
+ * Some query verbs (query AH, etc) need to be implemented.
diff --git a/examples/asyncwatch.c b/examples/asyncwatch.c
index 734d018..c469ad7 100644
--- a/examples/asyncwatch.c
+++ b/examples/asyncwatch.c
@@ -42,12 +42,6 @@
#include <infiniband/verbs.h>
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static inline uint64_t be64_to_cpu(uint64_t x) { return bswap_64(x); }
-#elif __BYTE_ORDER == __BIG_ENDIAN
-static inline uint64_t be64_to_cpu(uint64_t x) { return x; }
-#endif
-
int main(int argc, char *argv[])
{
struct ibv_device **dev_list;
diff --git a/examples/device_list.c b/examples/device_list.c
index f04fba4..939a127 100644
--- a/examples/device_list.c
+++ b/examples/device_list.c
@@ -42,12 +42,7 @@
#include <byteswap.h>
#include <infiniband/verbs.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static inline uint64_t be64_to_cpu(uint64_t x) { return bswap_64(x); }
-#elif __BYTE_ORDER == __BIG_ENDIAN
-static inline uint64_t be64_to_cpu(uint64_t x) { return x; }
-#endif
+#include <infiniband/arch.h>
int main(int argc, char *argv[])
{
@@ -65,7 +60,7 @@ int main(int argc, char *argv[])
while (*dev_list) {
printf(" %-16s\t%016llx\n",
ibv_get_device_name(*dev_list),
- (unsigned long long) be64_to_cpu(ibv_get_device_guid(*dev_list)));
+ (unsigned long long) ntohll(ibv_get_device_guid(*dev_list)));
++dev_list;
}
diff --git a/examples/devinfo.c b/examples/devinfo.c
index 1e75bf4..3be2cff 100644
--- a/examples/devinfo.c
+++ b/examples/devinfo.c
@@ -47,24 +47,19 @@
#include <byteswap.h>
#include <infiniband/verbs.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static inline uint64_t be64_to_cpu(uint64_t x) { return bswap_64(x); }
-#elif __BYTE_ORDER == __BIG_ENDIAN
-static inline uint64_t be64_to_cpu(uint64_t x) { return x; }
-#endif
+#include <infiniband/arch.h>
static int verbose = 0;
static int null_gid(union ibv_gid *gid)
{
- return !(gid->raw[8] | gid->raw[9] | gid->raw[10] | gid->raw[11] |
+ return !(gid->raw[8] | gid->raw[9] | gid->raw[10] | gid->raw[11] |
gid->raw[12] | gid->raw[13] | gid->raw[14] | gid->raw[15]);
}
static const char *guid_str(uint64_t node_guid, char *str)
{
- node_guid = be64_to_cpu(node_guid);
+ node_guid = ntohll(node_guid);
sprintf(str, "%04x:%04x:%04x:%04x",
(unsigned) (node_guid >> 48) & 0xffff,
(unsigned) (node_guid >> 32) & 0xffff,
@@ -247,7 +242,7 @@ static int print_hca_cap(struct ibv_device *ib_dev, uint8_t ib_port)
for (port = 1; port <= device_attr.phys_port_cnt; ++port) {
/* if in the command line the user didn't ask for info about this port */
if ((ib_port) && (port != ib_port))
- continue;
+ continue;
rc = ibv_query_port(ctx, port, &port_attr);
if (rc) {
@@ -267,7 +262,7 @@ static int print_hca_cap(struct ibv_device *ib_dev, uint8_t ib_port)
if (verbose) {
printf("\t\t\tmax_msg_sz:\t\t0x%x\n", port_attr.max_msg_sz);
- printf("\t\t\tport_cap_flags:\t\t0x%08x\n", port_attr.port_cap_flags);
+ printf("\t\t\tport_cap_flags:\t\t0x%08x\n", port_attr.port_cap_flags);
printf("\t\t\tmax_vl_num:\t\t%d\n", port_attr.max_vl_num);
printf("\t\t\tbad_pkey_cntr:\t\t0x%x\n", port_attr.bad_pkey_cntr);
printf("\t\t\tqkey_viol_cntr:\t\t0x%x\n", port_attr.qkey_viol_cntr);
@@ -326,7 +321,7 @@ int main(int argc, char *argv[])
{ .name = "verbose", .has_arg = 0, .val = 'v' },
{ 0, 0, 0, 0}
};
-
+
c = getopt_long(argc, argv, "d:i:lv", long_options, NULL);
if (c == -1)
break;
diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h
index 0d55f7e..ca00b3c 100644
--- a/include/infiniband/driver.h
+++ b/include/infiniband/driver.h
@@ -62,7 +62,7 @@
* ops member filled in. If the driver does not support the device,
* it should return NULL from openib_driver_init().
*/
-
+
typedef struct ibv_device *(*ibv_driver_init_func)(struct sysfs_class_device *);
int ibv_cmd_get_context(struct ibv_context *context, struct ibv_get_context *cmd,
diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index d33a880..69f3f17 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -471,7 +471,7 @@ struct ibv_recv_wr {
struct ibv_srq {
struct ibv_context *context;
void *srq_context;
- struct ibv_pd *pd;
+ struct ibv_pd *pd;
uint32_t handle;
pthread_mutex_t mutex;
@@ -482,7 +482,7 @@ struct ibv_srq {
struct ibv_qp {
struct ibv_context *context;
void *qp_context;
- struct ibv_pd *pd;
+ struct ibv_pd *pd;
struct ibv_cq *send_cq;
struct ibv_cq *recv_cq;
struct ibv_srq *srq;
diff --git a/src/init.c b/src/init.c
index 51a5b72..8a85ab3 100644
--- a/src/init.c
+++ b/src/init.c
@@ -115,7 +115,7 @@ static void find_drivers(char *dir)
static struct ibv_device *init_drivers(struct sysfs_class_device *verbs_dev)
{
- struct sysfs_class_device *ib_dev;
+ struct sysfs_class_device *ib_dev;
struct sysfs_attribute *attr;
struct ibv_driver *driver;
struct ibv_device *dev;