[openib-general] Use Linux generics in iWARP driver patch
Tom Tucker
tom at ammasso.com
Fri Aug 12 08:14:16 PDT 2005
Here's a patch for the iWARP branch that changes the driver
to use all Linux byte swapping generics. Thanks to Christoph
and Roland for their help here.
Signed-off-by: Tom Tucker <tom at ammasso.com>
Index: devccil_adapter.c
===================================================================
--- devccil_adapter.c (revision 3072)
+++ devccil_adapter.c (working copy)
@@ -219,7 +219,7 @@
/*
* update the resource indicator and id
*/
- er.resource_indicator =
wr32_to_cpu(wr->ae.ae_generic.resource_type);
+ er.resource_indicator =
be32_to_cpu(wr->ae.ae_generic.resource_type);
er.resource_user_context =
CC_CTX_TO_PTR(wr->ae.ae_generic.user_context, void *);
/*
@@ -228,7 +228,7 @@
switch (er.resource_indicator) {
case CC_RES_IND_QP: {
cc_kern_qp_t *qp = (cc_kern_qp_t
*)er.resource_user_context;
- qp->qp_state =
wr32_to_cpu(wr->ae.ae_generic.qp_state);
+ qp->qp_state =
be32_to_cpu(wr->ae.ae_generic.qp_state);
er.resource_id.qp_id = qp->adapter_handle;
er.resource_user_context = qp->user_context;
break;
@@ -273,7 +273,7 @@
er.event_data.active_connect_results.rport =
wr->ae.ae_active_connect_results.rport;
er.event_data.active_connect_results.private_data_length =
-
wr32_to_cpu(wr->ae.ae_active_connect_results.private_data_length);
+
be32_to_cpu(wr->ae.ae_active_connect_results.private_data_length);
memcpy(er.event_data.active_connect_results.private_data,
wr->ae.ae_active_connect_results.private_data,
er.event_data.active_connect_results.private_data_length);
@@ -290,7 +290,7 @@
er.event_data.connection_request.rport =
wr->ae.ae_connection_request.rport;
er.event_data.connection_request.private_data_length =
-
wr32_to_cpu(wr->ae.ae_connection_request.private_data_length);
+
be32_to_cpu(wr->ae.ae_connection_request.private_data_length);
memcpy(er.event_data.connection_request.private_data,
wr->ae.ae_connection_request.private_data,
er.event_data.connection_request.private_data_length);
@@ -580,8 +580,8 @@
if (pci == NULL)
return CCERR_INSUFFICIENT_RESOURCES;
- q1_pages_len = cpu_to_wr32(pci->q1_q_size) *
cpu_to_wr32(pci->q1_msg_size);
- q2_pages_len = cpu_to_wr32(pci->q2_q_size) *
cpu_to_wr32(pci->q2_msg_size);
+ q1_pages_len = cpu_to_be32(pci->q1_q_size) *
cpu_to_be32(pci->q1_msg_size);
+ q2_pages_len = cpu_to_be32(pci->q2_q_size) *
cpu_to_be32(pci->q2_msg_size);
q1_pages = ccil_malloc(q1_pages_len, CCIL_WAIT);
if (!q1_pages) {
@@ -597,22 +597,22 @@
memset(q2_pages, 0xb0, q2_pages_len);
#endif
- cc_mq_init(&cca->req_vq, 0, cpu_to_wr32(pci->q0_q_size),
- cpu_to_wr32(pci->q0_msg_size),
- aoff_to_virt(cca, cpu_to_wr32(pci->q0_pool_start)),
- aoff_to_virt(cca, cpu_to_wr32(pci->q0_shared)),
+ cc_mq_init(&cca->req_vq, 0, cpu_to_be32(pci->q0_q_size),
+ cpu_to_be32(pci->q0_msg_size),
+ aoff_to_virt(cca, cpu_to_be32(pci->q0_pool_start)),
+ aoff_to_virt(cca, cpu_to_be32(pci->q0_shared)),
CC_MQ_ADAPTER_TARGET);
- cc_mq_init(&cca->rep_vq, 1, cpu_to_wr32(pci->q1_q_size),
- cpu_to_wr32(pci->q1_msg_size),
+ cc_mq_init(&cca->rep_vq, 1, cpu_to_be32(pci->q1_q_size),
+ cpu_to_be32(pci->q1_msg_size),
(void *)q1_pages,
- aoff_to_virt(cca, cpu_to_wr32(pci->q1_shared)),
+ aoff_to_virt(cca, cpu_to_be32(pci->q1_shared)),
CC_MQ_HOST_TARGET);
- cc_mq_init(&cca->aeq, 2, cpu_to_wr32(pci->q2_q_size),
- cpu_to_wr32(pci->q2_msg_size),
+ cc_mq_init(&cca->aeq, 2, cpu_to_be32(pci->q2_q_size),
+ cpu_to_be32(pci->q2_msg_size),
(void *)q2_pages,
- aoff_to_virt(cca, cpu_to_wr32(pci->q2_shared)),
+ aoff_to_virt(cca, cpu_to_be32(pci->q2_shared)),
CC_MQ_HOST_TARGET);
/*
@@ -641,17 +641,17 @@
*/
cc_wr_set_id(&wr, CCWR_INIT);
wr.hdr.context = 0;
- wr.hint_count = cpu_to_wr64(__pa(&cca->hint_count));
+ wr.hint_count = cpu_to_be64(__pa(&cca->hint_count));
wr.q0_host_shared =
- cpu_to_wr64(__pa(cca->req_vq.shared));
+ cpu_to_be64(__pa(cca->req_vq.shared));
wr.q1_host_shared =
- cpu_to_wr64(__pa(cca->rep_vq.shared));
+ cpu_to_be64(__pa(cca->rep_vq.shared));
wr.q1_host_msg_pool =
- cpu_to_wr64(__pa(cca->rep_vq.msg_pool));
+ cpu_to_be64(__pa(cca->rep_vq.msg_pool));
wr.q2_host_shared =
- cpu_to_wr64(__pa(cca->aeq.shared));
+ cpu_to_be64(__pa(cca->aeq.shared));
wr.q2_host_msg_pool =
- cpu_to_wr64(__pa(cca->aeq.msg_pool));
+ cpu_to_be64(__pa(cca->aeq.msg_pool));
/*
* Send WR to adapter
*/
@@ -783,7 +783,7 @@
cc_kern_eh_t *eh;
- while (cca->hints_read != wr16_to_cpu(cca->hint_count)) {
+ while (cca->hints_read != be16_to_cpu(cca->hint_count)) {
mq_index = *(unsigned int
*)(cca->bars[0].virt+PCI_BAR0_HOST_HINT);
if (mq_index & 0x80000000) {
DEVCCIL_LOG(KERN_INFO "no hint present although
one is expected\n");
@@ -879,10 +879,10 @@
* Ensure that the Interface Version Numbers match
* between the kernel driver and the firmware.
*/
- if (wr32_to_cpu(adapter_regs->ivn) != CC_IVN) {
+ if (be32_to_cpu(adapter_regs->ivn) != CC_IVN) {
devccil_err("devccil_probe: fw IVN mismatch (fw
0x%x devccil 0x%x).\n"
"Adapter not claimed.\n",
- wr32_to_cpu(adapter_regs->ivn),
CC_IVN);
+ be32_to_cpu(adapter_regs->ivn),
CC_IVN);
iounmap((void *)adapter_regs);
free_adapter(cca);
return -1;
@@ -892,7 +892,7 @@
* Obtain the actual size of the verbs request MQ to map
that
* adapter memory.
*/
- size = CC_ADAPTER_PCI_REGS_OFFSET +
wr32_to_cpu(adapter_regs->pci_window_size);
+ size = CC_ADAPTER_PCI_REGS_OFFSET +
be32_to_cpu(adapter_regs->pci_window_size);
iounmap((void *)adapter_regs);
}
cca->bars[i].size = size;
Index: cc_mq.h
===================================================================
--- cc_mq.h (revision 3072)
+++ cc_mq.h (working copy)
@@ -1,5 +1,6 @@
#ifndef _CC_MQ_H_
#define _CC_MQ_H_
+#include <linux/kernel.h>
#include "cc_types.h"
#include "cc_adapter.h"
#include "cc_wr.h"
@@ -46,18 +47,18 @@
#endif /* X86_64 */
#define BUMP(q,p) (p) = ((p)+1) % (q)->q_size
-#define BUMP_SHARED(q,p) (p) = cpu_to_wr16((wr16_to_cpu(p)+1) %
(q)->q_size)
+#define BUMP_SHARED(q,p) (p) = cpu_to_be16((be16_to_cpu(p)+1) %
(q)->q_size)
static __inline__ cc_bool_t
cc_mq_empty(cc_mq_t *q)
{
- return q->priv == wr16_to_cpu(*q->shared);
+ return q->priv == be16_to_cpu(*q->shared);
}
static __inline__ cc_bool_t
cc_mq_full(cc_mq_t *q)
{
- return q->priv == (wr16_to_cpu(*q->shared) + q->q_size-1) %
q->q_size;
+ return q->priv == (be16_to_cpu(*q->shared) + q->q_size-1) %
q->q_size;
}
extern void * cc_mq_alloc(cc_mq_t *q);
Index: devccil_cq.c
===================================================================
--- devccil_cq.c (revision 3072)
+++ devccil_cq.c (working copy)
@@ -396,10 +396,10 @@
cc_wr_set_id(&wr, CCWR_CQ_CREATE);
wr.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.rnic_handle = devp->adapter_handle;
- wr.msg_size = cpu_to_wr32(cq->mq_handle.msg_size);
- wr.depth = cpu_to_wr32(cq->mq_handle.q_size);
- wr.shared_ht = cpu_to_wr64(__pa(shared_kva));
- wr.msg_pool = cpu_to_wr64(__pa(cq->mq.u.h.msg_pool_kva));
+ wr.msg_size = cpu_to_be32(cq->mq_handle.msg_size);
+ wr.depth = cpu_to_be32(cq->mq_handle.q_size);
+ wr.shared_ht = cpu_to_be64(__pa(shared_kva));
+ wr.msg_pool = cpu_to_be64(__pa(cq->mq.u.h.msg_pool_kva));
wr.user_context = CC_PTR_TO_CTX(user_context);
/*
@@ -436,9 +436,9 @@
goto bail5;
}
- cq->mq.mq_idx = wr32_to_cpu(reply->mq_index);
+ cq->mq.mq_idx = be32_to_cpu(reply->mq_index);
cq->adapter_handle = reply->cq_handle;
- cq->mq.u.h.peer_aoff = wr32_to_cpu(reply->adapter_shared);
+ cq->mq.u.h.peer_aoff = be32_to_cpu(reply->adapter_shared);
/*
* Free Msg
@@ -550,8 +550,8 @@
wr.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.rnic_handle = devp->adapter_handle;
wr.cq_handle = cq->adapter_handle;
- wr.new_depth = cpu_to_wr32(*p_cq_depth+1);
- wr.new_msg_pool = cpu_to_wr64(__pa(new_msg_pool_kva));
+ wr.new_depth = cpu_to_be32(*p_cq_depth+1);
+ wr.new_msg_pool = cpu_to_be64(__pa(new_msg_pool_kva));
/*
* reference the request struct. dereferenced in the int
handler.
Index: devccil_ep.c
===================================================================
--- devccil_ep.c (revision 3072)
+++ devccil_ep.c (working copy)
@@ -145,7 +145,7 @@
wr.rnic_handle = devp->adapter_handle;
wr.local_addr = addr; /* already in Net Byte
Order */
wr.local_port = *p_port; /* already in Net Byte
Order */
- wr.backlog = cpu_to_wr32(backlog);
+ wr.backlog = cpu_to_be32(backlog);
wr.user_context = CC_PTR_TO_CTX(ep->user_handle);
/*
@@ -433,7 +433,7 @@
wr->ep_handle = CC_PTR_TO_CTX(cr_handle);
wr->qp_handle = qp->adapter_handle;
if (p_private_data) {
- wr->private_data_length =
cpu_to_wr32(private_data_length);
+ wr->private_data_length =
cpu_to_be32(private_data_length);
memcpy(&wr->private_data[0], p_private_data,
private_data_length);
} else {
wr->private_data_length = 0;
Index: cc_qp_common.c
===================================================================
--- cc_qp_common.c (revision 3072)
+++ cc_qp_common.c (working copy)
@@ -106,9 +106,9 @@
*/
if (src->length) {
tot += src->length;
- dst->stag = cpu_to_wr32(src->stag);
- dst->to = cpu_to_wr64(src->to);
- dst->length = cpu_to_wr32(src->length);
+ dst->stag = cpu_to_be32(src->stag);
+ dst->to = cpu_to_be64(src->to);
+ dst->length = cpu_to_be32(src->length);
dst++;
acount++;
}
@@ -189,7 +189,7 @@
len -= 8;
}
-#elif
+#else
#error "You need to define your platform, or add optimized"
#error "cc_memcpy8 support for your platform."
@@ -296,7 +296,7 @@
}
#ifdef CCMSGMAGIC
- ((ccwr_hdr_t *)wr)->magic = cpu_to_wr32(CCWR_MAGIC);
+ ((ccwr_hdr_t *)wr)->magic = cpu_to_be32(CCWR_MAGIC);
#endif
/*
@@ -384,13 +384,13 @@
case CC_WR_TYPE_SEND_INV:
msg_size = sizeof(ccwr_send_inv_req_t);
wr.sqwr.send.remote_stag =
-
cpu_to_wr32(wr_list->wr_u.send.remote_stag);
+
cpu_to_be32(wr_list->wr_u.send.remote_stag);
goto send;
case CC_WR_TYPE_SEND_SE_INV:
msg_size = sizeof(ccwr_send_se_inv_req_t);
wr.sqwr.send.remote_stag =
-
cpu_to_wr32(wr_list->wr_u.send.remote_stag);
+
cpu_to_be32(wr_list->wr_u.send.remote_stag);
goto send;
case CC_WR_TYPE_SEND:
@@ -416,7 +416,7 @@
wr_list->wr_u.send.local_sgl.sge_count,
&tot_len,
&actual_sge_count);
- wr.sqwr.send.sge_len = cpu_to_wr32(tot_len);
+ wr.sqwr.send.sge_len = cpu_to_be32(tot_len);
cc_wr_set_sge_count(&wr, actual_sge_count);
break;
@@ -432,9 +432,9 @@
if (wr_list->wr_u.rdma_write.read_fence) {
flags |= SQ_READ_FENCE;
}
- wr.sqwr.rdma_write.remote_stag = cpu_to_wr32(
+ wr.sqwr.rdma_write.remote_stag = cpu_to_be32(
wr_list->wr_u.rdma_write.remote_stag);
- wr.sqwr.rdma_write.remote_to = cpu_to_wr64(
+ wr.sqwr.rdma_write.remote_to = cpu_to_be64(
wr_list->wr_u.rdma_write.remote_to);
status = move_sgl((cc_data_addr_t*)
&(wr.sqwr.rdma_write.data),
@@ -442,7 +442,7 @@
wr_list->wr_u.rdma_write.local_sgl.sge_count,
&tot_len,
&actual_sge_count);
- wr.sqwr.rdma_write.sge_len =
cpu_to_wr32(tot_len);
+ wr.sqwr.rdma_write.sge_len =
cpu_to_be32(tot_len);
cc_wr_set_sge_count(&wr, actual_sge_count);
break;
@@ -453,15 +453,15 @@
/*
* Move the local and remote stag/to/len into
the WR.
*/
- wr.sqwr.rdma_read.local_stag = cpu_to_wr32(
+ wr.sqwr.rdma_read.local_stag = cpu_to_be32(
wr_list->wr_u.rdma_read.local_stag);
- wr.sqwr.rdma_read.local_to = cpu_to_wr64(
+ wr.sqwr.rdma_read.local_to = cpu_to_be64(
wr_list->wr_u.rdma_read.local_to);
- wr.sqwr.rdma_read.remote_stag = cpu_to_wr32(
+ wr.sqwr.rdma_read.remote_stag = cpu_to_be32(
wr_list->wr_u.rdma_read.remote_stag);
- wr.sqwr.rdma_read.remote_to = cpu_to_wr64(
+ wr.sqwr.rdma_read.remote_to = cpu_to_be64(
wr_list->wr_u.rdma_read.remote_to);
- wr.sqwr.rdma_read.length = cpu_to_wr32(
+ wr.sqwr.rdma_read.length = cpu_to_be32(
wr_list->wr_u.rdma_read.length);
break;
@@ -474,17 +474,17 @@
mwflags |= MEM_VA_BASED;
}
mwflags |= wr_list->wr_u.mw_bind.acf;
- wr.sqwr.mw_bind.flags = cpu_to_wr32(mwflags);
+ wr.sqwr.mw_bind.flags = cpu_to_be32(mwflags);
wr.sqwr.mw_bind.stag_key =
wr_list->wr_u.mw_bind.stag_key;
wr.sqwr.mw_bind.mw_stag_index =
-
cpu_to_wr32(wr_list->wr_u.mw_bind.mw_stag_index);
+
cpu_to_be32(wr_list->wr_u.mw_bind.mw_stag_index);
wr.sqwr.mw_bind.mr_stag_index =
-
cpu_to_wr32(wr_list->wr_u.mw_bind.mr_stag_index);
+
cpu_to_be32(wr_list->wr_u.mw_bind.mr_stag_index);
wr.sqwr.mw_bind.length =
- cpu_to_wr32(wr_list->wr_u.mw_bind.length);
+ cpu_to_be32(wr_list->wr_u.mw_bind.length);
wr.sqwr.mw_bind.va =
- cpu_to_wr64((u64)(unsigned long)
+ cpu_to_be64((u64)(unsigned long)
wr_list->wr_u.mw_bind.va);
break;
}
@@ -501,7 +501,7 @@
wr.sqwr.stag_inv.stag_key =
wr_list->wr_u.inv_stag.stag_key;
wr.sqwr.stag_inv.stag_index =
-
cpu_to_wr32(wr_list->wr_u.inv_stag.stag_index);
+
cpu_to_be32(wr_list->wr_u.inv_stag.stag_index);
break;
case CC_WR_TYPE_NOP:
Index: cc_wr.h
===================================================================
--- cc_wr.h (revision 3072)
+++ cc_wr.h (working copy)
@@ -23,17 +23,6 @@
* in common/include/clustercore/cc_ivn.h.
*/
-/*
- * Work Request Byte Order - define only one of these.
- */
-#define WR_BYTE_ORDER_BIG_ENDIAN
-/*#define WR_BYTE_ORDER_LITTLE_ENDIAN */
-
-/*
- * Now include host or adapter specific macros
- */
-#include "cc_byteorder.h"
-
#ifdef CCDEBUG
#define CCWR_MAGIC 0xb07700b0
#endif
Index: devccil_qp.c
===================================================================
--- devccil_qp.c (revision 3072)
+++ devccil_qp.c (working copy)
@@ -348,8 +348,8 @@
wr.rnic_handle = devp->adapter_handle;
wr.sq_cq_handle = qp->sq_cq->adapter_handle;
wr.rq_cq_handle = qp->rq_cq->adapter_handle;
- wr.sq_depth = cpu_to_wr32(p_attrs->sq_depth+1);
- wr.rq_depth = cpu_to_wr32(p_attrs->rq_depth+1);
+ wr.sq_depth = cpu_to_be32(p_attrs->sq_depth+1);
+ wr.rq_depth = cpu_to_be32(p_attrs->rq_depth+1);
if (qp->srq) {
wr.srq_handle = qp->srq->adapter_handle;
} else {
@@ -361,14 +361,14 @@
flags |= p_attrs->zero_stag_enabled ? QP_ZERO_STAG : 0;
flags |= p_attrs->rdma_read_response_enabled ?
QP_RDMA_READ_RESPONSE : 0;
- wr.flags = cpu_to_wr32(flags);
- wr.send_sgl_depth = cpu_to_wr32(p_attrs->send_sgl_depth);
- wr.recv_sgl_depth = cpu_to_wr32(p_attrs->recv_sgl_depth);
- wr.rdma_write_sgl_depth =
cpu_to_wr32(p_attrs->rdma_write_sgl_depth);
- wr.shared_sq_ht = cpu_to_wr64(__pa(qp->sq_mq.shared_kva));
- wr.shared_rq_ht = cpu_to_wr64(__pa(qp->rq_mq.shared_kva));
- wr.ord = cpu_to_wr32(p_attrs->ord);
- wr.ird = cpu_to_wr32(p_attrs->ird);
+ wr.flags = cpu_to_be32(flags);
+ wr.send_sgl_depth = cpu_to_be32(p_attrs->send_sgl_depth);
+ wr.recv_sgl_depth = cpu_to_be32(p_attrs->recv_sgl_depth);
+ wr.rdma_write_sgl_depth =
cpu_to_be32(p_attrs->rdma_write_sgl_depth);
+ wr.shared_sq_ht = cpu_to_be64(__pa(qp->sq_mq.shared_kva));
+ wr.shared_rq_ht = cpu_to_be64(__pa(qp->rq_mq.shared_kva));
+ wr.ord = cpu_to_be32(p_attrs->ord);
+ wr.ird = cpu_to_be32(p_attrs->ird);
wr.pd_id = p_attrs->pdid;
/*
* the kernel caller will pass in a null context, in which case
@@ -414,10 +414,10 @@
goto bail5;
}
- qp->sq_mq.mq_idx = wr32_to_cpu(reply->sq_mq_index);
- qp->sq_mq.u.a.msg_pool_aoff = wr32_to_cpu(reply->sq_mq_start);
- qp->rq_mq.mq_idx = wr32_to_cpu(reply->rq_mq_index);
- qp->rq_mq.u.a.msg_pool_aoff = wr32_to_cpu(reply->rq_mq_start);
+ qp->sq_mq.mq_idx = be32_to_cpu(reply->sq_mq_index);
+ qp->sq_mq.u.a.msg_pool_aoff = be32_to_cpu(reply->sq_mq_start);
+ qp->rq_mq.mq_idx = be32_to_cpu(reply->rq_mq_index);
+ qp->rq_mq.u.a.msg_pool_aoff = be32_to_cpu(reply->rq_mq_start);
qp->adapter_handle = reply->qp_handle;
/*
@@ -426,23 +426,23 @@
* NOTE: The sq/rq depth fields in the wr are the mq q_size
values,
* which are the sq/rq depth + 1.
*/
- p_attrs->sq_depth = wr32_to_cpu(reply->sq_depth)-1;
- p_attrs->rq_depth = wr32_to_cpu(reply->rq_depth)-1;
- p_attrs->send_sgl_depth = wr32_to_cpu(reply->send_sgl_depth);
- p_attrs->recv_sgl_depth = wr32_to_cpu(reply->recv_sgl_depth);
+ p_attrs->sq_depth = be32_to_cpu(reply->sq_depth)-1;
+ p_attrs->rq_depth = be32_to_cpu(reply->rq_depth)-1;
+ p_attrs->send_sgl_depth = be32_to_cpu(reply->send_sgl_depth);
+ p_attrs->recv_sgl_depth = be32_to_cpu(reply->recv_sgl_depth);
p_attrs->rdma_write_sgl_depth =
- wr32_to_cpu(reply->rdma_write_sgl_depth);
- p_attrs->ird = wr32_to_cpu(reply->ird);
- p_attrs->ord = wr32_to_cpu(reply->ord);
+ be32_to_cpu(reply->rdma_write_sgl_depth);
+ p_attrs->ird = be32_to_cpu(reply->ird);
+ p_attrs->ord = be32_to_cpu(reply->ord);
/*
* save off sq/rq size and depth for use after common qp
* create code completes
*/
- qp->sq_mq_handle.msg_size = wr32_to_cpu(reply->sq_msg_size);
- qp->sq_mq_handle.q_size = wr32_to_cpu(reply->sq_depth);
- qp->rq_mq_handle.msg_size = wr32_to_cpu(reply->rq_msg_size);
- qp->rq_mq_handle.q_size = wr32_to_cpu(reply->rq_depth);
+ qp->sq_mq_handle.msg_size = be32_to_cpu(reply->sq_msg_size);
+ qp->sq_mq_handle.q_size = be32_to_cpu(reply->sq_depth);
+ qp->rq_mq_handle.msg_size = be32_to_cpu(reply->rq_msg_size);
+ qp->rq_mq_handle.q_size = be32_to_cpu(reply->rq_depth);
/*
* Free Msg
@@ -700,14 +700,14 @@
wr.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.rnic_handle = devp->adapter_handle;
wr.qp_handle = (u32)qp->adapter_handle;
- wr.next_qp_state = cpu_to_wr32(p_attrs->next_qp_state);
- wr.ord = cpu_to_wr32(p_attrs->ord);
- wr.ird = cpu_to_wr32(p_attrs->ird);
- wr.sq_depth = cpu_to_wr32(sq_depth);
- wr.rq_depth = cpu_to_wr32(rq_depth);
- /*wr.llp_ep_handle = cpu_to_wr32((u32)p_attrs->llp_ep); */
- wr.stream_msg_length =
cpu_to_wr32(p_attrs->stream_message_length);
- wr.stream_msg = cpu_to_wr64((unsigned
long)p_attrs->stream_message_buffer);
+ wr.next_qp_state = cpu_to_be32(p_attrs->next_qp_state);
+ wr.ord = cpu_to_be32(p_attrs->ord);
+ wr.ird = cpu_to_be32(p_attrs->ird);
+ wr.sq_depth = cpu_to_be32(sq_depth);
+ wr.rq_depth = cpu_to_be32(rq_depth);
+ /*wr.llp_ep_handle = cpu_to_be32((u32)p_attrs->llp_ep); */
+ wr.stream_msg_length =
cpu_to_be32(p_attrs->stream_message_length);
+ wr.stream_msg = cpu_to_be64((unsigned
long)p_attrs->stream_message_buffer);
/*
* reference the request struct. dereferenced in the int
handler.
@@ -747,14 +747,14 @@
* Update actuals for user.
*/
if (!devp->rnic_attrs.ord_static) {
- p_attrs->ord = wr32_to_cpu(reply->ord);
+ p_attrs->ord = be32_to_cpu(reply->ord);
}
if (!devp->rnic_attrs.ird_static) {
- p_attrs->ird = wr32_to_cpu(reply->ird);
+ p_attrs->ird = be32_to_cpu(reply->ird);
}
if (!devp->rnic_attrs.qp_depth_static) {
- p_attrs->sq_depth = wr32_to_cpu(reply->sq_depth)-1;
- p_attrs->rq_depth = wr32_to_cpu(reply->rq_depth)-1;
+ p_attrs->sq_depth = be32_to_cpu(reply->sq_depth)-1;
+ p_attrs->rq_depth = be32_to_cpu(reply->rq_depth)-1;
}
bail2:
@@ -833,17 +833,17 @@
p_attrs->sq_cq = qp->sq_cq->user_handle;
p_attrs->rq_cq = qp->rq_cq->user_handle;
p_attrs->srq = qp->srq ? CC_PTR_TO_64(qp->srq->user_handle) : 0;
- p_attrs->sq_depth = wr32_to_cpu(reply->sq_depth)-1;
- p_attrs->rq_depth = wr32_to_cpu(reply->rq_depth)-1;
- p_attrs->send_sgl_depth = wr32_to_cpu(reply->send_sgl_depth);
- p_attrs->recv_sgl_depth = wr32_to_cpu(reply->recv_sgl_depth);
- p_attrs->rdma_write_sgl_depth =
wr32_to_cpu(reply->rdma_write_sgl_depth);
- p_attrs->ord = wr32_to_cpu(reply->ord);
- p_attrs->ird = wr32_to_cpu(reply->ird);
+ p_attrs->sq_depth = be32_to_cpu(reply->sq_depth)-1;
+ p_attrs->rq_depth = be32_to_cpu(reply->rq_depth)-1;
+ p_attrs->send_sgl_depth = be32_to_cpu(reply->send_sgl_depth);
+ p_attrs->recv_sgl_depth = be32_to_cpu(reply->recv_sgl_depth);
+ p_attrs->rdma_write_sgl_depth =
be32_to_cpu(reply->rdma_write_sgl_depth);
+ p_attrs->ord = be32_to_cpu(reply->ord);
+ p_attrs->ird = be32_to_cpu(reply->ird);
p_attrs->pd_id = qp->pd->pd_id;
- p_attrs->qp_id = wr32_to_cpu(reply->qp_id);
+ p_attrs->qp_id = be32_to_cpu(reply->qp_id);
p_attrs->llp_ep = qp->ep ? (u64)(qp->ep->adapter_handle) : 0;
- flags = wr16_to_cpu(reply->flags);
+ flags = be16_to_cpu(reply->flags);
p_attrs->rdma_read_enabled = (flags&QP_RDMA_READ);
p_attrs->rdma_write_enabled = (flags&QP_RDMA_WRITE);
p_attrs->rdma_read_response_enabled =
(flags&QP_RDMA_READ_RESPONSE);
@@ -854,16 +854,16 @@
p_attrs->local_port = reply->local_port;
p_attrs->remote_addr = reply->remote_addr;
p_attrs->remote_port = reply->remote_port;
- p_attrs->user_context =
CC_CTX_TO_PTR(wr64_to_cpu(reply->user_context), void *);
- p_attrs->qp_state = wr16_to_cpu(reply->qp_state);
+ p_attrs->user_context =
CC_CTX_TO_PTR(be64_to_cpu(reply->user_context), void *);
+ p_attrs->qp_state = be16_to_cpu(reply->qp_state);
/*
* If the caller wants the terminate message, then copy it
out...
*/
if (p_attrs->terminate_message &&
p_attrs->terminate_message_length) {
- if (wr32_to_cpu(reply->terminate_msg_length) > 0) {
+ if (be32_to_cpu(reply->terminate_msg_length) > 0) {
p_attrs->terminate_message_length =
-
ccmin(wr32_to_cpu(reply->terminate_msg_length),
+
ccmin(be32_to_cpu(reply->terminate_msg_length),
p_attrs->terminate_message_length);
memcpy(p_attrs->terminate_message, &reply->data,
p_attrs->terminate_message_length);
@@ -931,7 +931,7 @@
* the WR.
*/
if (p_private_data) {
- wr->private_data_length =
cpu_to_wr32(private_data_length);
+ wr->private_data_length =
cpu_to_be32(private_data_length);
memcpy(&wr->private_data[0], p_private_data,
private_data_length);
} else {
wr->private_data_length = 0;
Index: cc_cq_common.c
===================================================================
--- cc_cq_common.c (revision 3072)
+++ cc_cq_common.c (working copy)
@@ -90,16 +90,16 @@
p_wc->wr_type = cc_wr_get_id(ce);
p_wc->wr_id = ce->hdr.context;
p_wc->status = cc_wr_get_result(ce);
- p_wc->bytes_rcvd = wr32_to_cpu(ce->bytes_rcvd);
+ p_wc->bytes_rcvd = be32_to_cpu(ce->bytes_rcvd);
p_wc->stag_invalidated = (ce->stag != 0);
- *(u32*)&p_wc->stag = wr32_to_cpu(ce->stag);
+ *(u32*)&p_wc->stag = be32_to_cpu(ce->stag);
p_wc->qp_id = ce->handle;
/*
* update the qp state
*/
ASSERT(VALID_MAGIC(qp->magic, QP_MAGIC));
- qp->qp_state = wr32_to_cpu(ce->qp_state);
+ qp->qp_state = be32_to_cpu(ce->qp_state);
/*
* Consume WQEs on the SQ or RQ now. The completion event
@@ -109,7 +109,7 @@
cc_mq_lconsume(&qp->rq_mq_handle, 1);
} else {
cc_mq_lconsume(&qp->sq_mq_handle,
- wr32_to_cpu(cc_wr_get_wqe_count(ce))+1);
+ be32_to_cpu(cc_wr_get_wqe_count(ce))+1);
}
/*
@@ -209,7 +209,7 @@
u16 priv = q->priv;
ccwr_ce_t *msg;
- while (priv != cpu_to_wr16(*q->shared)) {
+ while (priv != cpu_to_be16(*q->shared)) {
msg = (ccwr_ce_t *)(q->msg_pool + priv *
q->msg_size);
if (msg->qp_user_context == (u64)(unsigned
long)qp) {
msg->qp_user_context = (u64)0;
@@ -266,7 +266,7 @@
bo_cq_dump()
{
cc_user_cq_t *cq = bo_last_cq;
- u16 shared = wr16_to_cpu(*cq->mq.shared);
+ u16 shared = be16_to_cpu(*cq->mq.shared);
cc_mq_shared_t peer = *cq->mq.peer;
ccwr_ce_t *ce;
int i, priv, count, atend;
@@ -284,7 +284,7 @@
peer.notification_type ==
CC_CQ_NOTIFICATION_TYPE_NEXT_SE? "CC_CQ_NOTIFICATION_TYPE_NEXT_SE":
peer.notification_type == CC_CQ_NOTIFICATION_TYPE_NONE?
"CC_CQ_NOTIFICATION_TYPE_NONE": "<BAD TYPE>",
peer.notification_type,
- wr16_to_cpu(peer.shared));
+ be16_to_cpu(peer.shared));
priv = cq->mq.priv;
ce = (ccwr_ce_t *)(cq->mq.msg_pool + priv * cq->mq.msg_size);
@@ -295,14 +295,14 @@
printf("\t%c%3d: id %s (%d) result %d mag %08x rcvd %d state %s
(%d) wqe %d\n",
atend? ' ':'N',
priv,
- bo_wr_name(wr16_to_cpu(ce->hdr.id)),
+ bo_wr_name(be16_to_cpu(ce->hdr.id)),
cc_wr_get_id(ce),
cc_wr_get_result(ce),
- wr32_to_cpu(ce->hdr.magic),
- wr32_to_cpu(ce->bytes_rcvd),
- bo_qp_state_name(wr32_to_cpu(ce->qp_state)),
- wr32_to_cpu(ce->qp_state),
- wr32_to_cpu(cc_wr_get_wqe_count(ce)));
+ be32_to_cpu(ce->hdr.magic),
+ be32_to_cpu(ce->bytes_rcvd),
+ bo_qp_state_name(be32_to_cpu(ce->qp_state)),
+ be32_to_cpu(ce->qp_state),
+ be32_to_cpu(cc_wr_get_wqe_count(ce)));
priv = (priv + 1) % cq->mq.q_size;
ce = (ccwr_ce_t *)(cq->mq.msg_pool + priv * cq->mq.msg_size);
}
Index: devccil_rnic.c
===================================================================
--- devccil_rnic.c (revision 3072)
+++ devccil_rnic.c (working copy)
@@ -387,8 +387,8 @@
if (capable(CAP_SYS_ADMIN)) {
wr.rnic_open.req.flags |= RNIC_PRIV_MODE;
}
- wr.rnic_open.req.flags = cpu_to_wr16(wr.rnic_open.req.flags);
- wr.rnic_open.req.port_num = cpu_to_wr16(myport);
+ wr.rnic_open.req.flags = cpu_to_be16(wr.rnic_open.req.flags);
+ wr.rnic_open.req.port_num = cpu_to_be16(myport);
wr.rnic_open.req.user_context = CC_PTR_TO_CTX(rnic);
/*
@@ -1057,60 +1057,60 @@
/*
* marshall the query attrs into the request buffer
*/
- p_attrs->vendor_id.vendor_id = wr32_to_cpu(reply->vendor_id);
- p_attrs->vendor_id.part_number =wr32_to_cpu(reply->part_number);
+ p_attrs->vendor_id.vendor_id = be32_to_cpu(reply->vendor_id);
+ p_attrs->vendor_id.part_number =be32_to_cpu(reply->part_number);
p_attrs->vendor_id.hardware_version =
- wr32_to_cpu(reply->hw_version);
+ be32_to_cpu(reply->hw_version);
p_attrs->vendor_id.fw_ver_major =
- wr32_to_cpu(reply->fw_ver_major);
+ be32_to_cpu(reply->fw_ver_major);
p_attrs->vendor_id.fw_ver_minor =
- wr32_to_cpu(reply->fw_ver_minor);
+ be32_to_cpu(reply->fw_ver_minor);
p_attrs->vendor_id.fw_ver_patch =
- wr32_to_cpu(reply->fw_ver_patch);
- p_attrs->max_qps = wr32_to_cpu(reply->max_qps);
- p_attrs->max_srq_depth = wr32_to_cpu(reply->max_srq_depth);
+ be32_to_cpu(reply->fw_ver_patch);
+ p_attrs->max_qps = be32_to_cpu(reply->max_qps);
+ p_attrs->max_srq_depth = be32_to_cpu(reply->max_srq_depth);
memcpy(p_attrs->vendor_id.fw_ver_build_str,
reply->fw_ver_build_str, CC_BUILD_STR_LEN);
p_attrs->vendor_id.fw_ver_build_str[CC_BUILD_STR_LEN-1] = 0;
p_attrs->max_send_sgl_depth =
- wr32_to_cpu(reply->max_send_sgl_depth);
+ be32_to_cpu(reply->max_send_sgl_depth);
p_attrs->max_rdma_sgl_depth =
- wr32_to_cpu(reply->max_rdma_sgl_depth);
- p_attrs->max_cqs = wr32_to_cpu(reply->max_cqs);
- p_attrs->max_cq_depth = wr32_to_cpu(reply->max_cq_depth);
- p_attrs->max_qp_depth = wr32_to_cpu(reply->max_qp_depth);
+ be32_to_cpu(reply->max_rdma_sgl_depth);
+ p_attrs->max_cqs = be32_to_cpu(reply->max_cqs);
+ p_attrs->max_cq_depth = be32_to_cpu(reply->max_cq_depth);
+ p_attrs->max_qp_depth = be32_to_cpu(reply->max_qp_depth);
p_attrs->max_cq_ehs = CC_MAX_EHS;
- p_attrs->max_mrs = wr32_to_cpu(reply->max_mrs);
- p_attrs->max_pbl_depth = wr32_to_cpu(reply->max_pbl_depth);
- p_attrs->max_pds = wr32_to_cpu(reply->max_pds);
- p_attrs->max_ird = wr32_to_cpu(reply->max_global_ird);
- p_attrs->max_ord = wr32_to_cpu(reply->max_global_ord);
- p_attrs->max_qp_ird = wr32_to_cpu(reply->max_qp_ird);
- p_attrs->max_qp_ord = wr32_to_cpu(reply->max_qp_ord);
- p_attrs->ird_static = wr32_to_cpu(reply->flags)&RNIC_IRD_STATIC;
- p_attrs->ord_static = wr32_to_cpu(reply->flags)&RNIC_ORD_STATIC;
+ p_attrs->max_mrs = be32_to_cpu(reply->max_mrs);
+ p_attrs->max_pbl_depth = be32_to_cpu(reply->max_pbl_depth);
+ p_attrs->max_pds = be32_to_cpu(reply->max_pds);
+ p_attrs->max_ird = be32_to_cpu(reply->max_global_ird);
+ p_attrs->max_ord = be32_to_cpu(reply->max_global_ord);
+ p_attrs->max_qp_ird = be32_to_cpu(reply->max_qp_ird);
+ p_attrs->max_qp_ord = be32_to_cpu(reply->max_qp_ord);
+ p_attrs->ird_static = be32_to_cpu(reply->flags)&RNIC_IRD_STATIC;
+ p_attrs->ord_static = be32_to_cpu(reply->flags)&RNIC_ORD_STATIC;
p_attrs->qp_depth_static =
- wr32_to_cpu(reply->flags)&RNIC_QP_STATIC;
+ be32_to_cpu(reply->flags)&RNIC_QP_STATIC;
p_attrs->srq_supported =
- wr32_to_cpu(reply->flags)&RNIC_SRQ_SUPPORTED;
+ be32_to_cpu(reply->flags)&RNIC_SRQ_SUPPORTED;
p_attrs->cq_overflow_detected =
- wr32_to_cpu(reply->flags)&RNIC_CQ_OVF_DETECTED;
- p_attrs->max_mws = wr32_to_cpu(reply->max_mws);
- p_attrs->max_srqs = wr32_to_cpu(reply->max_srqs);
- if (wr32_to_cpu(reply->flags)&RNIC_PBL_BLOCK_MODE) {
+ be32_to_cpu(reply->flags)&RNIC_CQ_OVF_DETECTED;
+ p_attrs->max_mws = be32_to_cpu(reply->max_mws);
+ p_attrs->max_srqs = be32_to_cpu(reply->max_srqs);
+ if (be32_to_cpu(reply->flags)&RNIC_PBL_BLOCK_MODE) {
p_attrs->pbl_mode = CC_PBL_BLOCK_MODE;
} else {
p_attrs->pbl_mode = CC_PBL_PAGE_MODE;
}
- if (wr32_to_cpu(reply->flags)&RNIC_SRQ_MODEL_ARRIVAL) {
+ if (be32_to_cpu(reply->flags)&RNIC_SRQ_MODEL_ARRIVAL) {
p_attrs->srq_model = CC_SRQ_MODEL_ARRIVAL_ORDER;
} else {
p_attrs->srq_model = CC_SRQ_MODEL_SEQUENTIAL_ORDER;
}
- p_attrs->pbe_range.range_low =wr32_to_cpu(reply->pbe_range_low);
+ p_attrs->pbe_range.range_low =be32_to_cpu(reply->pbe_range_low);
p_attrs->pbe_range.range_high =
- wr32_to_cpu(reply->pbe_range_high);
- p_attrs->page_size =wr32_to_cpu(reply->page_size);
+ be32_to_cpu(reply->pbe_range_high);
+ p_attrs->page_size =be32_to_cpu(reply->page_size);
p_attrs->user_context = CC_64_TO_PTR(reply->user_context);
bail2:
@@ -1185,7 +1185,7 @@
cc_wr_set_id(wr, CCWR_RNIC_SETCONFIG);
wr->hdr.context = CC_PTR_TO_CTX(vq_req);
wr->rnic_handle = devp->adapter_handle;
- wr->option = cpu_to_wr32(cmd);
+ wr->option = cpu_to_be32(cmd);
/*
* Move the cmd-specific data into the wr.
@@ -1306,13 +1306,13 @@
cc_wr_set_id(&wr, CCWR_RNIC_GETCONFIG);
wr.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.rnic_handle = devp->adapter_handle;
- wr.option = cpu_to_wr32(cmd);
+ wr.option = cpu_to_be32(cmd);
if (buf) {
- wr.reply_buf = cpu_to_wr64((u64)__pa(wr_buf));
+ wr.reply_buf = cpu_to_be64((u64)__pa(wr_buf));
} else {
wr.reply_buf = (u64)NULL;
}
- wr.reply_buf_len = cpu_to_wr32(size);
+ wr.reply_buf_len = cpu_to_be32(size);
/*
* reference the request struct. dereferenced in the int handler.
@@ -1351,7 +1351,7 @@
/*
* update the caller's notion of the count length
*/
- *buf_len = wr32_to_cpu(reply->count_len);
+ *buf_len = be32_to_cpu(reply->count_len);
/*
* copy the data to the caller's buffer.
@@ -1573,8 +1573,8 @@
cc_wr_set_id(&wr, CCWR_CONSOLE);
wr.console.req.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.console.req.reply_buf =
- cpu_to_wr64((u64)__pa(reply_buf));
- wr.console.req.reply_buf_len = cpu_to_wr32(req->reply_buf_len);
+ cpu_to_be64((u64)__pa(reply_buf));
+ wr.console.req.reply_buf_len = cpu_to_be32(req->reply_buf_len);
memcpy(wr.console.req.command, req->cmd, req->cmd_len);
/*
@@ -1624,7 +1624,7 @@
if (cc != 0) {
req->status = CCERR_INVALID_MODIFIER;
}
- req->truncated = (wr32_to_cpu(reply->flags) &
CONS_REPLY_TRUNCATED);
+ req->truncated = (be32_to_cpu(reply->flags) &
CONS_REPLY_TRUNCATED);
vq_repbuf_free(devp->cca, reply);
vq_req_free(devp->cca, vq_req);
@@ -1671,8 +1671,8 @@
* Map the log pages to the user process.
*/
pci = (cc_adapter_pci_regs_t*)devp->cca->kva;
- log_size = wr32_to_cpu(pci->log_size);
- log_pa = (unsigned long)aoff_to_phys(devp->cca,
wr32_to_cpu(pci->log_start)) & CC_PAGEMASK;
+ log_size = be32_to_cpu(pci->log_size);
+ log_pa = (unsigned long)aoff_to_phys(devp->cca,
be32_to_cpu(pci->log_start)) & CC_PAGEMASK;
down_write(¤t->mm->mmap_sem);
ret = do_mmap(filp, 0, log_size, PROT_READ|PROT_WRITE,
MAP_SHARED, log_pa);
up_write(¤t->mm->mmap_sem);
@@ -1682,7 +1682,7 @@
return;
}
req->log_start = (void *)ret;
- req->log_size = wr32_to_cpu(pci->log_size);
+ req->log_size = be32_to_cpu(pci->log_size);
req->status = CC_OK;
return;
}
@@ -1789,17 +1789,17 @@
/*
* Map adapter flash buffer to user process.
*/
- adapter_flash_buf_len = wr32_to_cpu(reply->adapter_flash_len);
+ adapter_flash_buf_len = be32_to_cpu(reply->adapter_flash_len);
adapter_flash_buf_pa = (unsigned long)aoff_to_phys(devp->cca,
-
wr32_to_cpu(reply->adapter_flash_buf_offset) & CC_PAGEMASK);
+
be32_to_cpu(reply->adapter_flash_buf_offset) & CC_PAGEMASK);
down_write(¤t->mm->mmap_sem);
ret = do_mmap(filp, 0, adapter_flash_buf_len,
PROT_READ|PROT_WRITE,
MAP_SHARED, adapter_flash_buf_pa);
up_write(¤t->mm->mmap_sem);
DEVCCIL_LOG(KERN_INFO "flash init: flash buf offset 0x%x pa 0x%x
len %d uva 0x%x\n",
- wr32_to_cpu(reply->adapter_flash_buf_offset),
+ be32_to_cpu(reply->adapter_flash_buf_offset),
(int)adapter_flash_buf_pa,
- wr32_to_cpu(reply->adapter_flash_len),
+ be32_to_cpu(reply->adapter_flash_len),
(int)ret);
if (IS_ERR((void *)ret)) {
req->status = CCERR_INSUFFICIENT_RESOURCES;
@@ -1876,8 +1876,8 @@
cc_wr_set_id(&wr, CCWR_FLASH);
wr.flash.req.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.flash.req.rnic_handle = devp->adapter_handle;
- wr.flash.req.len = cpu_to_wr32(req->len);
- DEVCCIL_LOG(KERN_INFO "flash: len %d\n", cpu_to_wr32(req->len));
+ wr.flash.req.len = cpu_to_be32(req->len);
+ DEVCCIL_LOG(KERN_INFO "flash: len %d\n", cpu_to_be32(req->len));
/*
* reference the request struct. dereferenced in the int
handler.
@@ -1935,7 +1935,7 @@
* Return flash status to app. The flash_status field contains
* flash-part-specific status information (see
cc_flash_status_t).
*/
- req->flash_status = cpu_to_wr32(reply->status);
+ req->flash_status = cpu_to_be32(reply->status);
req->status = CC_OK;
@@ -2063,8 +2063,8 @@
cc_wr_set_id(&wr, CCWR_BUF_ALLOC);
wr.buf_alloc.req.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.buf_alloc.req.rnic_handle = devp->adapter_handle;
- wr.buf_alloc.req.size = cpu_to_wr32(req_len);
- DEVCCIL_LOG(KERN_INFO "rnic_buf_alloc: len %d\n",
cpu_to_wr32(req_len));
+ wr.buf_alloc.req.size = cpu_to_be32(req_len);
+ DEVCCIL_LOG(KERN_INFO "rnic_buf_alloc: len %d\n",
cpu_to_be32(req_len));
/*
* reference the request struct. dereferenced in the int handler.
@@ -2106,10 +2106,10 @@
return status;
}
- *act_len = wr32_to_cpu(reply->size);
+ *act_len = be32_to_cpu(reply->size);
*addr_adapter = reply->offset;
*addr_phys = aoff_to_phys(devp->cca,
- wr32_to_cpu(reply->offset) &
CC_PAGEMASK);
+ be32_to_cpu(reply->offset) &
CC_PAGEMASK);
/* Free the request and reply */
vq_repbuf_free(devp->cca, reply);
@@ -2141,7 +2141,7 @@
cc_wr_set_id(&wr, CCWR_BUF_FREE);
wr.buf_free.req.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.buf_free.req.rnic_handle = devp->adapter_handle;
- wr.buf_free.req.size = cpu_to_wr32(len);
+ wr.buf_free.req.size = cpu_to_be32(len);
wr.buf_free.req.offset = addr_adapter;
/*
@@ -2215,8 +2215,8 @@
cc_wr_set_id(&wr, CCWR_FLASH_WRITE);
wr.flash_write.req.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.flash_write.req.rnic_handle = devp->adapter_handle;
- wr.flash_write.req.type = cpu_to_wr32(type);
- wr.flash_write.req.size = cpu_to_wr32(len);
+ wr.flash_write.req.type = cpu_to_be32(type);
+ wr.flash_write.req.size = cpu_to_be32(len);
wr.flash_write.req.offset = addr_adapter;
/*
@@ -2258,7 +2258,7 @@
vq_req_free(devp->cca, vq_req);
return status;
}
- *flash_status = cpu_to_wr32(reply->status);
+ *flash_status = cpu_to_be32(reply->status);
/* Free the request and reply */
vq_repbuf_free(devp->cca, reply);
Index: cc_mq_common.c
===================================================================
--- cc_mq_common.c (revision 3072)
+++ cc_mq_common.c (working copy)
@@ -20,7 +20,7 @@
extern void cc_memcpy8(u64 *, u64 *, s32);
#define BUMP(q,p) (p) = ((p)+1) % (q)->q_size
-#define BUMP_SHARED(q,p) (p) = cpu_to_wr16((wr16_to_cpu(p)+1) %
(q)->q_size)
+#define BUMP_SHARED(q,p) (p) = cpu_to_be16((be16_to_cpu(p)+1) %
(q)->q_size)
#ifdef CC_STALL_DEBUG
/* For debug only. */
@@ -42,15 +42,15 @@
ccwr_hdr_t *m = (ccwr_hdr_t*)(q->msg_pool + q->priv *
q->msg_size);
#if 0
unsigned int bar=0;
- while (m->magic != wr32_to_cpu(~CCWR_MAGIC)) {
+ while (m->magic != be32_to_cpu(~CCWR_MAGIC)) {
bar++;
if (bar >= 10000) ASSERT(0);
}
if (bar)
CC_WARN_LOG(CCIL_LOG_MQ|CCIL_LOG_WARNING,"cc_mq_alloc spun %d times\n",
bar);
#endif
#ifdef CCMSGMAGIC
- ASSERT(m->magic == wr32_to_cpu(~CCWR_MAGIC));
- m->magic = cpu_to_wr32(CCWR_MAGIC);
+ ASSERT(m->magic == be32_to_cpu(~CCWR_MAGIC));
+ m->magic = cpu_to_be32(CCWR_MAGIC);
#endif
CC_LOG(CCIL_LOG_MQ|CCIL_LOG_DEBUG,"cc_mq_alloc %p\n", m);
return m;
@@ -78,7 +78,7 @@
BUMP(q, q->priv);
q->hint_count++;
/* Update peer's offset. */
- q->peer->shared = cpu_to_wr16(q->priv);
+ q->peer->shared = cpu_to_be16(q->priv);
}
}
@@ -97,14 +97,14 @@
(q->msg_pool + q->priv * q->msg_size);
#if 0
unsigned int bar=0;
- while (m->magic != wr32_to_cpu(CCWR_MAGIC)) {
+ while (m->magic != be32_to_cpu(CCWR_MAGIC)) {
bar++;
if (bar >= 10000) ASSERT(0);
}
if (bar)
CC_WARN_LOG(CCIL_LOG_MQ|CCIL_LOG_WARNING,"cc_mq_consume spun %d
times\n",bar);
#endif
#ifdef CCMSGMAGIC
- ASSERT(m->magic == wr32_to_cpu(CCWR_MAGIC));
+ ASSERT(m->magic == be32_to_cpu(CCWR_MAGIC));
#endif
CC_LOG(CCIL_LOG_MQ|CCIL_LOG_DEBUG,"cc_mq_consume %p\n",
m);
return m;
@@ -133,12 +133,12 @@
{
ccwr_hdr_t *m = (ccwr_hdr_t*)
(q->msg_pool + q->priv * q->msg_size);
- m->magic = cpu_to_wr32(~CCWR_MAGIC);
+ m->magic = cpu_to_be32(~CCWR_MAGIC);
}
#endif
BUMP(q, q->priv);
/* Update peer's offset. */
- q->peer->shared = cpu_to_wr16(q->priv);
+ q->peer->shared = cpu_to_be16(q->priv);
}
}
@@ -164,9 +164,9 @@
ASSERT(q);
if (q->type == CC_MQ_HOST_TARGET) {
- count = wr16_to_cpu(*q->shared) - q->priv;
+ count = be16_to_cpu(*q->shared) - q->priv;
} else {
- count = q->priv - wr16_to_cpu(*q->shared);
+ count = q->priv - be16_to_cpu(*q->shared);
}
if (count < 0) {
@@ -176,3 +176,4 @@
return (u32)count;
}
#endif /* #ifndef _CC_MQ_COMMON_C_ */
+
Index: devccil_ae.c
===================================================================
--- devccil_ae.c (revision 3072)
+++ devccil_ae.c (working copy)
@@ -127,7 +127,7 @@
/*
* Save current state.
*/
- req->qp_state = wr32_to_cpu(wr->ae.ae_generic.qp_state);
+ req->qp_state = be32_to_cpu(wr->ae.ae_generic.qp_state);
/*
* We update the resource indicator (type) and the resource
@@ -136,7 +136,7 @@
* QP ID...
*/
req->er.resource_indicator =
- wr32_to_cpu(wr->ae.ae_generic.resource_type);
+ be32_to_cpu(wr->ae.ae_generic.resource_type);
req->er.resource_user_context =
CC_CTX_TO_PTR(wr->ae.ae_generic.user_context, void *);
/*
@@ -156,7 +156,7 @@
req->er.event_data.active_connect_results.rport
=
wr->ae.ae_active_connect_results.rport;
req->er.event_data.active_connect_results.private_data_length =
-
wr32_to_cpu(wr->ae.ae_active_connect_results.private_data_length);
+
be32_to_cpu(wr->ae.ae_active_connect_results.private_data_length);
memcpy(req->er.event_data.active_connect_results.private_data,
wr->ae.ae_active_connect_results.private_data,
req->er.event_data.active_connect_results.private_data_length);
@@ -173,7 +173,7 @@
req->er.event_data.connection_request.rport =
wr->ae.ae_connection_request.rport;
req->er.event_data.connection_request.private_data_length =
-
wr32_to_cpu(wr->ae.ae_connection_request.private_data_length);
+
be32_to_cpu(wr->ae.ae_connection_request.private_data_length);
memcpy(req->er.event_data.connection_request.private_data,
wr->ae.ae_connection_request.private_data,
req->er.event_data.connection_request.private_data_length);
Index: devccil_vq.c
===================================================================
--- devccil_vq.c (revision 3072)
+++ devccil_vq.c (working copy)
@@ -230,7 +230,7 @@
* copy wr into adapter msg
*/
#ifdef CCMSGMAGIC
- ((ccwr_hdr_t*)wr)->magic = cpu_to_wr32(CCWR_MAGIC);
+ ((ccwr_hdr_t*)wr)->magic = cpu_to_be32(CCWR_MAGIC);
#endif
memcpy(msg, wr, cca->req_vq.msg_size);
Index: devccil_mm.c
===================================================================
--- devccil_mm.c (revision 3072)
+++ devccil_mm.c (working copy)
@@ -519,7 +519,7 @@
wr->flags = 0;
while (pbl_depth) {
count = ccmin(pbe_count, pbl_depth);
- wr->addrs_length = cpu_to_wr32(count);
+ wr->addrs_length = cpu_to_be32(count);
/*
* If this is the last message, then reference the
@@ -532,7 +532,7 @@
* int handler.
*/
vq_req_get(devp->cca, vq_req);
- wr->flags = cpu_to_wr32(MEM_PBL_COMPLETE);
+ wr->flags = cpu_to_be32(MEM_PBL_COMPLETE);
/*
* This is the last PBL message.
@@ -554,10 +554,10 @@
*/
for (i=0; i < count; i++) {
if (pbl_virt) {
- wr->paddrs[i] =
cpu_to_wr64(user_virt_to_phys(va));
+ wr->paddrs[i] =
cpu_to_be64(user_virt_to_phys(va));
va += PAGE_SIZE;
} else {
- wr->paddrs[i] =
cpu_to_wr64((u64)(unsigned long)((void **)va)[i]);
+ wr->paddrs[i] =
cpu_to_be64((u64)(unsigned long)((void **)va)[i]);
}
}
@@ -779,16 +779,16 @@
if (pbl_depth <= pbe_count) {
flags |= MEM_PBL_COMPLETE;
}
- wr->flags = cpu_to_wr16(flags);
+ wr->flags = cpu_to_be16(flags);
wr->stag_key = stag_key;
- wr->va = cpu_to_wr64((u64)(unsigned long)va);
+ wr->va = cpu_to_be64((u64)(unsigned long)va);
wr->pd_id = pdid;
- wr->pbe_size = cpu_to_wr32(CC_PAGESIZE);
- wr->length = cpu_to_wr32(length);
- wr->pbl_depth = cpu_to_wr32(pbl_depth);
- wr->fbo = cpu_to_wr32(fbo);
+ wr->pbe_size = cpu_to_be32(CC_PAGESIZE);
+ wr->length = cpu_to_be32(length);
+ wr->pbl_depth = cpu_to_be32(pbl_depth);
+ wr->fbo = cpu_to_be32(fbo);
count = ccmin(pbl_depth, pbe_count);
- wr->addrs_length = cpu_to_wr32(count);
+ wr->addrs_length = cpu_to_be32(count);
/*
* Fill out the PBL for this message
@@ -797,10 +797,10 @@
pbe_count, count);
tmp_va = (unsigned long)va;
for (i=0; i < count; i++) {
- wr->paddrs[i] = cpu_to_wr64(user_virt_to_phys(tmp_va));
+ wr->paddrs[i] = cpu_to_be64(user_virt_to_phys(tmp_va));
DEVCCIL_LOG(KERN_INFO " paddr[%d] = 0x%Lx %Lu\n", i,
- wr64_to_cpu(wr->paddrs[i]),
- wr64_to_cpu(wr->paddrs[i]));
+ be64_to_cpu(wr->paddrs[i]),
+ be64_to_cpu(wr->paddrs[i]));
tmp_va += PAGE_SIZE;
}
@@ -848,7 +848,7 @@
if ( (status = cc_wr_get_result(reply)) != CC_OK) {
goto bail6;
}
- mr->stag_index = wr32_to_cpu(reply->stag_index);
+ mr->stag_index = be32_to_cpu(reply->stag_index);
*p_stag_index = mr->stag_index;
vq_repbuf_free(devp->cca, reply);
vq_req->reply_msg = (u64)NULL;
@@ -866,7 +866,7 @@
pbl_depth -= count;
if (pbl_depth) {
status = send_pbl_messages(devp,
- cpu_to_wr32(mr->stag_index),
+ cpu_to_be32(mr->stag_index),
tmp_va,
pbl_depth, vq_req, PBL_VIRT);
if (status != CC_OK) {
@@ -1033,22 +1033,22 @@
if (pbl_depth <= pbe_count) {
flags |= MEM_PBL_COMPLETE;
}
- wr->flags = cpu_to_wr16(flags);
+ wr->flags = cpu_to_be16(flags);
wr->stag_key = stag_key;
- wr->va = cpu_to_wr64((u64)(unsigned long)va);
+ wr->va = cpu_to_be64((u64)(unsigned long)va);
wr->pd_id = pdid;
- wr->pbe_size = cpu_to_wr32(pb_sz);
- wr->length = cpu_to_wr32(length);
- wr->pbl_depth = cpu_to_wr32(pbl_depth);
- wr->fbo = cpu_to_wr32(fbo);
+ wr->pbe_size = cpu_to_be32(pb_sz);
+ wr->length = cpu_to_be32(length);
+ wr->pbl_depth = cpu_to_be32(pbl_depth);
+ wr->fbo = cpu_to_be32(fbo);
count = ccmin(pbl_depth, pbe_count);
- wr->addrs_length = cpu_to_wr32(count);
+ wr->addrs_length = cpu_to_be32(count);
/*
* fill out the PBL for this message
*/
for (i = 0; i < count; i++) {
- wr->paddrs[i] = cpu_to_wr64((u64)(unsigned
long)addr_list[i]);
+ wr->paddrs[i] = cpu_to_be64((u64)(unsigned
long)addr_list[i]);
}
/*
@@ -1084,8 +1084,8 @@
if ( (status = cc_wr_get_result(reply)) != CC_OK) {
goto bail4;
}
- *p_pb_entries = wr32_to_cpu(reply->pbl_depth);
- mr->stag_index = wr32_to_cpu(reply->stag_index);
+ *p_pb_entries = be32_to_cpu(reply->pbl_depth);
+ mr->stag_index = be32_to_cpu(reply->stag_index);
*p_stag_index = mr->stag_index;
vq_repbuf_free(devp->cca, reply);
@@ -1100,7 +1100,7 @@
vq_req->reply_msg = CC_PTR_TO_64(NULL);
atomic_set(&vq_req->reply_ready, 0);
status = send_pbl_messages(devp,
- cpu_to_wr32(mr->stag_index),
+ cpu_to_be32(mr->stag_index),
CC_PTR_TO_64(&addr_list[i]),
pbl_depth, vq_req, PBL_PHYS);
if (status != CC_OK) {
@@ -1158,7 +1158,7 @@
cc_wr_set_id(&wr, CCWR_MR_QUERY);
wr.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.rnic_handle = devp->adapter_handle;
- wr.stag_index = cpu_to_wr32(stag_index);
+ wr.stag_index = cpu_to_be32(stag_index);
/*
* reference the request struct. dereferenced in the int
handler.
@@ -1199,8 +1199,8 @@
*/
p_attrs->stag_key = reply->stag_key;
p_attrs->pdid = reply->pd_id;
- p_attrs->pbl_depth = wr32_to_cpu(reply->pbl_depth);
- flags = wr32_to_cpu(reply->flags);
+ p_attrs->pbl_depth = be32_to_cpu(reply->pbl_depth);
+ flags = be32_to_cpu(reply->flags);
p_attrs->remote = (flags & MEM_REMOTE) ? 1 : 0;
p_attrs->acf = flags & (MEM_LOCAL_READ|MEM_LOCAL_WRITE|
MEM_REMOTE_READ|MEM_REMOTE_WRITE|MEM_WINDOW_BIND);
@@ -1238,7 +1238,7 @@
cc_wr_set_id(&wr, CCWR_STAG_DEALLOC);
wr.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.rnic_handle = devp->adapter_handle;
- wr.stag_index = cpu_to_wr32(stag_index);
+ wr.stag_index = cpu_to_be32(stag_index);
/*
* reference the request struct. dereferenced in the int
handler.
@@ -1460,7 +1460,7 @@
goto bail3;
}
- mw->stag_index = wr32_to_cpu(reply->stag_index);
+ mw->stag_index = be32_to_cpu(reply->stag_index);
*p_stag_index = mw->stag_index;
vq_req_free(devp->cca, vq_req);
vq_repbuf_free(devp->cca, reply);
@@ -1508,7 +1508,7 @@
cc_wr_set_id(&wr, CCWR_MW_QUERY);
wr.hdr.context = CC_PTR_TO_CTX(vq_req);
wr.rnic_handle = devp->adapter_handle;
- wr.stag_index = cpu_to_wr32(stag_index);
+ wr.stag_index = cpu_to_be32(stag_index);
/*
* reference the request struct. dereferenced in the int
handler.
@@ -1549,7 +1549,7 @@
*/
p_attrs->stag_key = reply->stag_key;
p_attrs->pdid = reply->pd_id;
- flags = wr32_to_cpu(reply->flags);
+ flags = be32_to_cpu(reply->flags);
p_attrs->acf = flags & (MEM_REMOTE_READ|MEM_REMOTE_WRITE);
p_attrs->stag_state = (flags & MEM_STAG_VALID) ? CC_STAG_VALID :
CC_STAG_INVALID;
bail2:
Index: devccil_mq.c
===================================================================
--- devccil_mq.c (revision 3072)
+++ devccil_mq.c (working copy)
@@ -217,7 +217,7 @@
for (i = 0; i < q_size; ++i) {
ccwr_hdr_t *h = (ccwr_hdr_t *)(*p_msg_pool_kva +
i *
msg_size);
- h->magic = cpu_to_wr32(~CCWR_MAGIC);
+ h->magic = cpu_to_be32(~CCWR_MAGIC);
}
}
#endif
@@ -313,7 +313,7 @@
for (i = 0; i < new_q_size; ++i) {
ccwr_hdr_t *h = (ccwr_hdr_t
*)(*p_new_msg_pool_kva +
i *
new_msg_size);
- h->magic = cpu_to_wr32(~CCWR_MAGIC);
+ h->magic = cpu_to_be32(~CCWR_MAGIC);
}
}
#endif
Index: ccilnet.c
===================================================================
--- ccilnet.c (revision 3072)
+++ ccilnet.c (working copy)
@@ -2327,7 +2327,7 @@
* index instead of a real pointer.
* See BugId: 1319
*/
- desc =
wr32_to_cpu(adapter_regs->fw_hrxd_cur);
+ desc =
be32_to_cpu(adapter_regs->fw_hrxd_cur);
idx = (desc - 0xffffc000) /
sizeof(rxp_hrxd_t);
adapter->adapter_recv_last_idx = idx;
dprintf(CCILNET_DBGMSK_PROBE,
Index: ccilnet.h
===================================================================
--- ccilnet.h (revision 3072)
+++ ccilnet.h (working copy)
@@ -35,7 +35,6 @@
#include "cc_ivn.h"
#include "cc_adapter.h"
#include "cc_wr.h" /* define byte ordering */
-#include "cc_byteorder.h" /* byte ordering macros */
#include "cc_rxpiface.h" /* defs for RXP_RXD_DONE, RXP_STATUS_OK,
etc.*/
#include "cc_txpiface.h"
#include "cc_hostintr.h" /* defs for transmit & receive interrupt
bits */
@@ -85,12 +84,12 @@
* ATOHL - adapter to host long (32 bits)
* ATOHS - adapter to host short (16 bits)
*/
-#define HTOAS(_x16) cpu_to_wr16(_x16)
-#define HTOAL(_x32) cpu_to_wr32(_x32)
-#define HTOALL(_x64) cpu_to_wr64(_x64)
-#define ATOHS(_x16) wr16_to_cpu(_x16)
-#define ATOHL(_x32) wr32_to_cpu(_x32)
-#define ATOHLL(_x64) wr64_to_cpu(_x64)
+#define HTOAS(_x16) cpu_to_be16(_x16)
+#define HTOAL(_x32) cpu_to_be32(_x32)
+#define HTOALL(_x64) cpu_to_be64(_x64)
+#define ATOHS(_x16) be16_to_cpu(_x16)
+#define ATOHL(_x32) be32_to_cpu(_x32)
+#define ATOHLL(_x64) be64_to_cpu(_x64)
#define CCILNET_ADAPTER_MAGIC 0x20044002
More information about the general
mailing list