@@ -46,7 +46,6 @@
#include <arpa/inet.h>
#include <sys/time.h>
#include <netinet/in.h>
-#include <infiniband/arch.h>
#include <ccan/minmax.h>
@@ -338,7 +338,7 @@ int ib_acm_query_perf(int index, uint64_t **counters, int *count)
*count = msg.hdr.data[0];
for (i = 0; i < *count; i++)
- (*counters)[i] = ntohll(msg.perf_data[i]);
+ (*counters)[i] = be64toh(msg.perf_data[i]);
ret = 0;
out:
pthread_mutex_unlock(&acm_lock);
@@ -385,7 +385,7 @@ int ib_acm_enum_ep(int index, struct acm_ep_config_data **data)
}
memcpy(edata, &msg.ep_data[0], len);
- edata->dev_guid = ntohll(msg.ep_data[0].dev_guid);
+ edata->dev_guid = be64toh(msg.ep_data[0].dev_guid);
edata->pkey = ntohs(msg.ep_data[0].pkey);
edata->addr_cnt = cnt;
*data = edata;
@@ -440,7 +440,7 @@ int ib_acm_query_perf_ep_addr(uint8_t *src, uint8_t type,
*count = msg.hdr.data[0];
for (i = 0; i < *count; i++)
- (*counters)[i] = ntohll(msg.perf_data[i]);
+ (*counters)[i] = be64toh(msg.perf_data[i]);
ret = 0;
out:
@@ -43,7 +43,6 @@
#include <fcntl.h>
#include <byteswap.h>
#include <netinet/in.h>
-#include <infiniband/arch.h>
#include "sysfs.h"
static int ret_code(void)
@@ -98,7 +97,7 @@ int sys_read_guid(const char *dir_name, const char *file_name, uint64_t * net_gu
guid = (guid << 16) | (strtoul(str, NULL, 16) & 0xffff);
}
- *net_guid = htonll(guid);
+ *net_guid = htobe64(guid);
return 0;
}
@@ -43,8 +43,6 @@
#include <alloca.h>
#include <errno.h>
-#include <infiniband/arch.h>
-
#include "ibverbs.h"
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
@@ -118,7 +116,7 @@ uint64_t __ibv_get_device_guid(struct ibv_device *device)
for (i = 0; i < 4; ++i)
guid = (guid << 16) | parts[i];
- return htonll(guid);
+ return htobe64(guid);
}
default_symver(__ibv_get_device_guid, ibv_get_device_guid);
@@ -38,7 +38,6 @@
#include <byteswap.h>
#include <infiniband/verbs.h>
-#include <infiniband/arch.h>
int main(int argc, char *argv[])
{
@@ -57,7 +56,7 @@ int main(int argc, char *argv[])
for (i = 0; i < num_devices; ++i) {
printf(" %-16s\t%016llx\n",
ibv_get_device_name(dev_list[i]),
- (unsigned long long) ntohll(ibv_get_device_guid(dev_list[i])));
+ (unsigned long long) be64toh(ibv_get_device_guid(dev_list[i])));
}
ibv_free_device_list(dev_list);
@@ -45,7 +45,6 @@
#include <infiniband/verbs.h>
#include <infiniband/driver.h>
-#include <infiniband/arch.h>
static int verbose;
@@ -57,7 +56,7 @@ static int null_gid(union ibv_gid *gid)
static const char *guid_str(uint64_t node_guid, char *str)
{
- node_guid = ntohll(node_guid);
+ node_guid = be64toh(node_guid);
sprintf(str, "%04x:%04x:%04x:%04x",
(unsigned) (node_guid >> 48) & 0xffff,
(unsigned) (node_guid >> 32) & 0xffff,
@@ -113,12 +113,12 @@ void ucma_set_sid(enum rdma_port_space ps, struct sockaddr *addr,
uint16_t port;
port = addr ? ucma_get_port(addr) : 0;
- sib->sib_sid = htonll(((uint64_t) ps << 16) + ntohs(port));
+ sib->sib_sid = htobe64(((uint64_t) ps << 16) + ntohs(port));
if (ps)
- sib->sib_sid_mask = htonll(RDMA_IB_IP_PS_MASK);
+ sib->sib_sid_mask = htobe64(RDMA_IB_IP_PS_MASK);
if (port)
- sib->sib_sid_mask |= htonll(RDMA_IB_IP_PORT_MASK);
+ sib->sib_sid_mask |= htobe64(RDMA_IB_IP_PORT_MASK);
}
static int ucma_convert_in6(int ps, struct sockaddr_ib **dst, socklen_t *dst_len,
@@ -177,8 +177,8 @@ static void ucma_set_af_ib_support(void)
memset(&sib, 0, sizeof sib);
sib.sib_family = AF_IB;
- sib.sib_sid = htonll(RDMA_IB_IP_PS_TCP);
- sib.sib_sid_mask = htonll(RDMA_IB_IP_PS_MASK);
+ sib.sib_sid = htobe64(RDMA_IB_IP_PS_TCP);
+ sib.sib_sid_mask = htobe64(RDMA_IB_IP_PS_MASK);
af_ib_support = 1;
ret = rdma_bind_addr(id, (struct sockaddr *) &sib);
af_ib_support = !ret;
@@ -2443,7 +2443,7 @@ uint16_t ucma_get_port(struct sockaddr *addr)
case AF_INET6:
return ((struct sockaddr_in6 *) addr)->sin6_port;
case AF_IB:
- return htons((uint16_t) ntohll(((struct sockaddr_ib *) addr)->sib_sid));
+ return htons((uint16_t) be64toh(((struct sockaddr_ib *) addr)->sib_sid));
default:
return 0;
}
@@ -44,7 +44,6 @@
#include <rdma/rdma_cma.h>
#include <infiniband/ib.h>
-#include <infiniband/arch.h>
#include <ccan/minmax.h>
@@ -47,7 +47,6 @@
#include <inttypes.h>
#include <rdma/rdma_cma.h>
-#include <infiniband/arch.h>
static int debug = 0;
#define DEBUG_LOG if (debug) printf
@@ -246,7 +245,7 @@ static int server_recv(struct rping_cb *cb, struct ibv_wc *wc)
}
cb->remote_rkey = ntohl(cb->recv_buf.rkey);
- cb->remote_addr = ntohll(cb->recv_buf.buf);
+ cb->remote_addr = be64toh(cb->recv_buf.buf);
cb->remote_len = ntohl(cb->recv_buf.size);
DEBUG_LOG("Received rkey %x addr %" PRIx64 " len %d from peer\n",
cb->remote_rkey, cb->remote_addr, cb->remote_len);
@@ -622,12 +621,12 @@ static void rping_format_send(struct rping_cb *cb, char *buf, struct ibv_mr *mr)
{
struct rping_rdma_info *info = &cb->send_buf;
- info->buf = htonll((uint64_t) (unsigned long) buf);
+ info->buf = htobe64((uint64_t) (unsigned long) buf);
info->rkey = htonl(mr->rkey);
info->size = htonl(cb->size);
DEBUG_LOG("RDMA addr %" PRIx64" rkey %x len %d\n",
- ntohll(info->buf), ntohl(info->rkey), ntohl(info->size));
+ be64toh(info->buf), ntohl(info->rkey), ntohl(info->size));
}
static int rping_test_server(struct rping_cb *cb)
@@ -1045,18 +1045,18 @@ static void rs_format_conn_data(struct rsocket *rs, struct rs_conn_data *conn)
memset(conn->reserved, 0, sizeof conn->reserved);
conn->target_iomap_size = (uint8_t) rs_value_to_scale(rs->target_iomap_size, 8);
- conn->target_sgl.addr = htonll((uintptr_t) rs->target_sgl);
+ conn->target_sgl.addr = htobe64((uintptr_t) rs->target_sgl);
conn->target_sgl.length = htonl(RS_SGL_SIZE);
conn->target_sgl.key = htonl(rs->target_mr->rkey);
- conn->data_buf.addr = htonll((uintptr_t) rs->rbuf);
+ conn->data_buf.addr = htobe64((uintptr_t) rs->rbuf);
conn->data_buf.length = htonl(rs->rbuf_size >> 1);
conn->data_buf.key = htonl(rs->rmr->rkey);
}
static void rs_save_conn_data(struct rsocket *rs, struct rs_conn_data *conn)
{
- rs->remote_sgl.addr = ntohll(conn->target_sgl.addr);
+ rs->remote_sgl.addr = be64toh(conn->target_sgl.addr);
rs->remote_sgl.length = ntohl(conn->target_sgl.length);
rs->remote_sgl.key = ntohl(conn->target_sgl.key);
rs->remote_sge = 1;
@@ -1071,7 +1071,7 @@ static void rs_save_conn_data(struct rsocket *rs, struct rs_conn_data *conn)
rs->remote_iomap.key = rs->remote_sgl.key;
}
- rs->target_sgl[0].addr = ntohll(conn->data_buf.addr);
+ rs->target_sgl[0].addr = be64toh(conn->data_buf.addr);
rs->target_sgl[0].length = ntohl(conn->data_buf.length);
rs->target_sgl[0].key = ntohl(conn->data_buf.key);
@@ -42,7 +42,6 @@
#include <byteswap.h>
#include <infiniband/verbs.h>
#include <infiniband/umad.h>
-#include <infiniband/arch.h>
#include "config.h"
#include "srp_ib_types.h"
We never want to use it for htonll as this header can only be compiled on architectures that define the PCI memory barriers. Instead use byteswap.h directly. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> --- ibacm/linux/osd.h | 1 - ibacm/src/libacm.c | 6 +++--- libibumad/sysfs.c | 3 +-- libibverbs/device.c | 4 +--- libibverbs/examples/device_list.c | 3 +-- libibverbs/examples/devinfo.c | 3 +-- librdmacm/addrinfo.c | 6 +++--- librdmacm/cma.c | 6 +++--- librdmacm/cma.h | 1 - librdmacm/examples/rping.c | 7 +++---- librdmacm/rsocket.c | 8 ++++---- srp_daemon/srp_daemon.h | 1 - 12 files changed, 20 insertions(+), 29 deletions(-)