Commit 97f52eb4 authored by Sean Hefty's avatar Sean Hefty Committed by Roland Dreier

[PATCH] IB: sparse endianness cleanup

Fix sparse warnings.  Use __be* where appropriate.
Signed-off-by: default avatarSean Hefty <sean.hefty@intel.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 92a6b34b
......@@ -83,7 +83,7 @@ struct cm_port {
struct cm_device {
struct list_head list;
struct ib_device *device;
u64 ca_guid;
__be64 ca_guid;
struct cm_port port[0];
};
......@@ -100,8 +100,8 @@ struct cm_work {
struct list_head list;
struct cm_port *port;
struct ib_mad_recv_wc *mad_recv_wc; /* Received MADs */
u32 local_id; /* Established / timewait */
u32 remote_id;
__be32 local_id; /* Established / timewait */
__be32 remote_id;
struct ib_cm_event cm_event;
struct ib_sa_path_rec path[0];
};
......@@ -110,8 +110,8 @@ struct cm_timewait_info {
struct cm_work work; /* Must be first. */
struct rb_node remote_qp_node;
struct rb_node remote_id_node;
u64 remote_ca_guid;
u32 remote_qpn;
__be64 remote_ca_guid;
__be32 remote_qpn;
u8 inserted_remote_qp;
u8 inserted_remote_id;
};
......@@ -132,11 +132,11 @@ struct cm_id_private {
struct cm_av alt_av;
void *private_data;
u64 tid;
u32 local_qpn;
u32 remote_qpn;
u32 sq_psn;
u32 rq_psn;
__be64 tid;
__be32 local_qpn;
__be32 remote_qpn;
__be32 sq_psn;
__be32 rq_psn;
int timeout_ms;
enum ib_mtu path_mtu;
u8 private_data_len;
......@@ -253,7 +253,7 @@ static void cm_set_ah_attr(struct ib_ah_attr *ah_attr, u8 port_num,
u16 dlid, u8 sl, u16 src_path_bits)
{
memset(ah_attr, 0, sizeof ah_attr);
ah_attr->dlid = be16_to_cpu(dlid);
ah_attr->dlid = dlid;
ah_attr->sl = sl;
ah_attr->src_path_bits = src_path_bits;
ah_attr->port_num = port_num;
......@@ -264,7 +264,7 @@ static void cm_init_av_for_response(struct cm_port *port,
{
av->port = port;
av->pkey_index = wc->pkey_index;
cm_set_ah_attr(&av->ah_attr, port->port_num, cpu_to_be16(wc->slid),
cm_set_ah_attr(&av->ah_attr, port->port_num, wc->slid,
wc->sl, wc->dlid_path_bits);
}
......@@ -295,8 +295,9 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
return ret;
av->port = port;
cm_set_ah_attr(&av->ah_attr, av->port->port_num, path->dlid,
path->sl, path->slid & 0x7F);
cm_set_ah_attr(&av->ah_attr, av->port->port_num,
be16_to_cpu(path->dlid), path->sl,
be16_to_cpu(path->slid) & 0x7F);
av->packet_life_time = path->packet_life_time;
return 0;
}
......@@ -309,26 +310,26 @@ static int cm_alloc_id(struct cm_id_private *cm_id_priv)
do {
spin_lock_irqsave(&cm.lock, flags);
ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, 1,
(int *) &cm_id_priv->id.local_id);
(__force int *) &cm_id_priv->id.local_id);
spin_unlock_irqrestore(&cm.lock, flags);
} while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) );
return ret;
}
static void cm_free_id(u32 local_id)
static void cm_free_id(__be32 local_id)
{
unsigned long flags;
spin_lock_irqsave(&cm.lock, flags);
idr_remove(&cm.local_id_table, (int) local_id);
idr_remove(&cm.local_id_table, (__force int) local_id);
spin_unlock_irqrestore(&cm.lock, flags);
}
static struct cm_id_private * cm_get_id(u32 local_id, u32 remote_id)
static struct cm_id_private * cm_get_id(__be32 local_id, __be32 remote_id)
{
struct cm_id_private *cm_id_priv;
cm_id_priv = idr_find(&cm.local_id_table, (int) local_id);
cm_id_priv = idr_find(&cm.local_id_table, (__force int) local_id);
if (cm_id_priv) {
if (cm_id_priv->id.remote_id == remote_id)
atomic_inc(&cm_id_priv->refcount);
......@@ -339,7 +340,7 @@ static struct cm_id_private * cm_get_id(u32 local_id, u32 remote_id)
return cm_id_priv;
}
static struct cm_id_private * cm_acquire_id(u32 local_id, u32 remote_id)
static struct cm_id_private * cm_acquire_id(__be32 local_id, __be32 remote_id)
{
struct cm_id_private *cm_id_priv;
unsigned long flags;
......@@ -356,8 +357,8 @@ static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
struct rb_node **link = &cm.listen_service_table.rb_node;
struct rb_node *parent = NULL;
struct cm_id_private *cur_cm_id_priv;
u64 service_id = cm_id_priv->id.service_id;
u64 service_mask = cm_id_priv->id.service_mask;
__be64 service_id = cm_id_priv->id.service_id;
__be64 service_mask = cm_id_priv->id.service_mask;
while (*link) {
parent = *link;
......@@ -376,7 +377,7 @@ static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
return NULL;
}
static struct cm_id_private * cm_find_listen(u64 service_id)
static struct cm_id_private * cm_find_listen(__be64 service_id)
{
struct rb_node *node = cm.listen_service_table.rb_node;
struct cm_id_private *cm_id_priv;
......@@ -400,8 +401,8 @@ static struct cm_timewait_info * cm_insert_remote_id(struct cm_timewait_info
struct rb_node **link = &cm.remote_id_table.rb_node;
struct rb_node *parent = NULL;
struct cm_timewait_info *cur_timewait_info;
u64 remote_ca_guid = timewait_info->remote_ca_guid;
u32 remote_id = timewait_info->work.remote_id;
__be64 remote_ca_guid = timewait_info->remote_ca_guid;
__be32 remote_id = timewait_info->work.remote_id;
while (*link) {
parent = *link;
......@@ -424,8 +425,8 @@ static struct cm_timewait_info * cm_insert_remote_id(struct cm_timewait_info
return NULL;
}
static struct cm_timewait_info * cm_find_remote_id(u64 remote_ca_guid,
u32 remote_id)
static struct cm_timewait_info * cm_find_remote_id(__be64 remote_ca_guid,
__be32 remote_id)
{
struct rb_node *node = cm.remote_id_table.rb_node;
struct cm_timewait_info *timewait_info;
......@@ -453,8 +454,8 @@ static struct cm_timewait_info * cm_insert_remote_qpn(struct cm_timewait_info
struct rb_node **link = &cm.remote_qp_table.rb_node;
struct rb_node *parent = NULL;
struct cm_timewait_info *cur_timewait_info;
u64 remote_ca_guid = timewait_info->remote_ca_guid;
u32 remote_qpn = timewait_info->remote_qpn;
__be64 remote_ca_guid = timewait_info->remote_ca_guid;
__be32 remote_qpn = timewait_info->remote_qpn;
while (*link) {
parent = *link;
......@@ -484,7 +485,7 @@ static struct cm_id_private * cm_insert_remote_sidr(struct cm_id_private
struct rb_node *parent = NULL;
struct cm_id_private *cur_cm_id_priv;
union ib_gid *port_gid = &cm_id_priv->av.dgid;
u32 remote_id = cm_id_priv->id.remote_id;
__be32 remote_id = cm_id_priv->id.remote_id;
while (*link) {
parent = *link;
......@@ -598,7 +599,7 @@ static void cm_cleanup_timewait(struct cm_timewait_info *timewait_info)
spin_unlock_irqrestore(&cm.lock, flags);
}
static struct cm_timewait_info * cm_create_timewait_info(u32 local_id)
static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id)
{
struct cm_timewait_info *timewait_info;
......@@ -715,14 +716,15 @@ void ib_destroy_cm_id(struct ib_cm_id *cm_id)
EXPORT_SYMBOL(ib_destroy_cm_id);
int ib_cm_listen(struct ib_cm_id *cm_id,
u64 service_id,
u64 service_mask)
__be64 service_id,
__be64 service_mask)
{
struct cm_id_private *cm_id_priv, *cur_cm_id_priv;
unsigned long flags;
int ret = 0;
service_mask = service_mask ? service_mask : ~0ULL;
service_mask = service_mask ? service_mask :
__constant_cpu_to_be64(~0ULL);
service_id &= service_mask;
if ((service_id & IB_SERVICE_ID_AGN_MASK) == IB_CM_ASSIGN_SERVICE_ID &&
(service_id != IB_CM_ASSIGN_SERVICE_ID))
......@@ -735,8 +737,8 @@ int ib_cm_listen(struct ib_cm_id *cm_id,
spin_lock_irqsave(&cm.lock, flags);
if (service_id == IB_CM_ASSIGN_SERVICE_ID) {
cm_id->service_id = __cpu_to_be64(cm.listen_service_id++);
cm_id->service_mask = ~0ULL;
cm_id->service_id = cpu_to_be64(cm.listen_service_id++);
cm_id->service_mask = __constant_cpu_to_be64(~0ULL);
} else {
cm_id->service_id = service_id;
cm_id->service_mask = service_mask;
......@@ -752,18 +754,19 @@ int ib_cm_listen(struct ib_cm_id *cm_id,
}
EXPORT_SYMBOL(ib_cm_listen);
static u64 cm_form_tid(struct cm_id_private *cm_id_priv,
static __be64 cm_form_tid(struct cm_id_private *cm_id_priv,
enum cm_msg_sequence msg_seq)
{
u64 hi_tid, low_tid;
hi_tid = ((u64) cm_id_priv->av.port->mad_agent->hi_tid) << 32;
low_tid = (u64) (cm_id_priv->id.local_id | (msg_seq << 30));
low_tid = (u64) ((__force u32)cm_id_priv->id.local_id |
(msg_seq << 30));
return cpu_to_be64(hi_tid | low_tid);
}
static void cm_format_mad_hdr(struct ib_mad_hdr *hdr,
enum cm_msg_attr_id attr_id, u64 tid)
__be16 attr_id, __be64 tid)
{
hdr->base_version = IB_MGMT_BASE_VERSION;
hdr->mgmt_class = IB_MGMT_CLASS_CM;
......@@ -896,7 +899,7 @@ int ib_send_cm_req(struct ib_cm_id *cm_id,
goto error1;
}
cm_id->service_id = param->service_id;
cm_id->service_mask = ~0ULL;
cm_id->service_mask = __constant_cpu_to_be64(~0ULL);
cm_id_priv->timeout_ms = cm_convert_to_ms(
param->primary_path->packet_life_time) * 2 +
cm_convert_to_ms(
......@@ -963,7 +966,7 @@ static int cm_issue_rej(struct cm_port *port,
rej_msg->remote_comm_id = rcv_msg->local_comm_id;
rej_msg->local_comm_id = rcv_msg->remote_comm_id;
cm_rej_set_msg_rejected(rej_msg, msg_rejected);
rej_msg->reason = reason;
rej_msg->reason = cpu_to_be16(reason);
if (ari && ari_length) {
cm_rej_set_reject_info_len(rej_msg, ari_length);
......@@ -977,8 +980,8 @@ static int cm_issue_rej(struct cm_port *port,
return ret;
}
static inline int cm_is_active_peer(u64 local_ca_guid, u64 remote_ca_guid,
u32 local_qpn, u32 remote_qpn)
static inline int cm_is_active_peer(__be64 local_ca_guid, __be64 remote_ca_guid,
__be32 local_qpn, __be32 remote_qpn)
{
return (be64_to_cpu(local_ca_guid) > be64_to_cpu(remote_ca_guid) ||
((local_ca_guid == remote_ca_guid) &&
......@@ -1137,7 +1140,7 @@ static void cm_format_rej(struct cm_rej_msg *rej_msg,
break;
}
rej_msg->reason = reason;
rej_msg->reason = cpu_to_be16(reason);
if (ari && ari_length) {
cm_rej_set_reject_info_len(rej_msg, ari_length);
memcpy(rej_msg->ari, ari, ari_length);
......@@ -1276,7 +1279,7 @@ static int cm_req_handler(struct cm_work *work)
cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler;
cm_id_priv->id.context = listen_cm_id_priv->id.context;
cm_id_priv->id.service_id = req_msg->service_id;
cm_id_priv->id.service_mask = ~0ULL;
cm_id_priv->id.service_mask = __constant_cpu_to_be64(~0ULL);
cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]);
ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av);
......@@ -1969,7 +1972,7 @@ static void cm_format_rej_event(struct cm_work *work)
param = &work->cm_event.param.rej_rcvd;
param->ari = rej_msg->ari;
param->ari_length = cm_rej_get_reject_info_len(rej_msg);
param->reason = rej_msg->reason;
param->reason = __be16_to_cpu(rej_msg->reason);
work->cm_event.private_data = &rej_msg->private_data;
}
......@@ -1978,20 +1981,20 @@ static struct cm_id_private * cm_acquire_rejected_id(struct cm_rej_msg *rej_msg)
struct cm_timewait_info *timewait_info;
struct cm_id_private *cm_id_priv;
unsigned long flags;
u32 remote_id;
__be32 remote_id;
remote_id = rej_msg->local_comm_id;
if (rej_msg->reason == IB_CM_REJ_TIMEOUT) {
if (__be16_to_cpu(rej_msg->reason) == IB_CM_REJ_TIMEOUT) {
spin_lock_irqsave(&cm.lock, flags);
timewait_info = cm_find_remote_id( *((u64 *) rej_msg->ari),
timewait_info = cm_find_remote_id( *((__be64 *) rej_msg->ari),
remote_id);
if (!timewait_info) {
spin_unlock_irqrestore(&cm.lock, flags);
return NULL;
}
cm_id_priv = idr_find(&cm.local_id_table,
(int) timewait_info->work.local_id);
(__force int) timewait_info->work.local_id);
if (cm_id_priv) {
if (cm_id_priv->id.remote_id == remote_id)
atomic_inc(&cm_id_priv->refcount);
......@@ -2032,7 +2035,7 @@ static int cm_rej_handler(struct cm_work *work)
/* fall through */
case IB_CM_REQ_RCVD:
case IB_CM_MRA_REQ_SENT:
if (rej_msg->reason == IB_CM_REJ_STALE_CONN)
if (__be16_to_cpu(rej_msg->reason) == IB_CM_REJ_STALE_CONN)
cm_enter_timewait(cm_id_priv);
else
cm_reset_to_idle(cm_id_priv);
......@@ -2553,7 +2556,7 @@ static void cm_format_sidr_req(struct cm_sidr_req_msg *sidr_req_msg,
cm_format_mad_hdr(&sidr_req_msg->hdr, CM_SIDR_REQ_ATTR_ID,
cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_SIDR));
sidr_req_msg->request_id = cm_id_priv->id.local_id;
sidr_req_msg->pkey = param->pkey;
sidr_req_msg->pkey = cpu_to_be16(param->pkey);
sidr_req_msg->service_id = param->service_id;
if (param->private_data && param->private_data_len)
......@@ -2580,7 +2583,7 @@ int ib_send_cm_sidr_req(struct ib_cm_id *cm_id,
goto out;
cm_id->service_id = param->service_id;
cm_id->service_mask = ~0ULL;
cm_id->service_mask = __constant_cpu_to_be64(~0ULL);
cm_id_priv->timeout_ms = param->timeout_ms;
cm_id_priv->max_cm_retries = param->max_cm_retries;
ret = cm_alloc_msg(cm_id_priv, &msg);
......@@ -2621,7 +2624,7 @@ static void cm_format_sidr_req_event(struct cm_work *work,
sidr_req_msg = (struct cm_sidr_req_msg *)
work->mad_recv_wc->recv_buf.mad;
param = &work->cm_event.param.sidr_req_rcvd;
param->pkey = sidr_req_msg->pkey;
param->pkey = __be16_to_cpu(sidr_req_msg->pkey);
param->listen_id = listen_id;
param->device = work->port->mad_agent->device;
param->port = work->port->port_num;
......@@ -2645,7 +2648,7 @@ static int cm_sidr_req_handler(struct cm_work *work)
sidr_req_msg = (struct cm_sidr_req_msg *)
work->mad_recv_wc->recv_buf.mad;
wc = work->mad_recv_wc->wc;
cm_id_priv->av.dgid.global.subnet_prefix = wc->slid;
cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid);
cm_id_priv->av.dgid.global.interface_id = 0;
cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
&cm_id_priv->av);
......@@ -2673,7 +2676,7 @@ static int cm_sidr_req_handler(struct cm_work *work)
cm_id_priv->id.cm_handler = cur_cm_id_priv->id.cm_handler;
cm_id_priv->id.context = cur_cm_id_priv->id.context;
cm_id_priv->id.service_id = sidr_req_msg->service_id;
cm_id_priv->id.service_mask = ~0ULL;
cm_id_priv->id.service_mask = __constant_cpu_to_be64(~0ULL);
cm_format_sidr_req_event(work, &cur_cm_id_priv->id);
cm_process_work(cm_id_priv, work);
......@@ -3175,10 +3178,10 @@ int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
}
EXPORT_SYMBOL(ib_cm_init_qp_attr);
static u64 cm_get_ca_guid(struct ib_device *device)
static __be64 cm_get_ca_guid(struct ib_device *device)
{
struct ib_device_attr *device_attr;
u64 guid;
__be64 guid;
int ret;
device_attr = kmalloc(sizeof *device_attr, GFP_KERNEL);
......
......@@ -43,19 +43,17 @@
#define IB_CM_CLASS_VERSION 2 /* IB specification 1.2 */
enum cm_msg_attr_id {
CM_REQ_ATTR_ID = __constant_htons(0x0010),
CM_MRA_ATTR_ID = __constant_htons(0x0011),
CM_REJ_ATTR_ID = __constant_htons(0x0012),
CM_REP_ATTR_ID = __constant_htons(0x0013),
CM_RTU_ATTR_ID = __constant_htons(0x0014),
CM_DREQ_ATTR_ID = __constant_htons(0x0015),
CM_DREP_ATTR_ID = __constant_htons(0x0016),
CM_SIDR_REQ_ATTR_ID = __constant_htons(0x0017),
CM_SIDR_REP_ATTR_ID = __constant_htons(0x0018),
CM_LAP_ATTR_ID = __constant_htons(0x0019),
CM_APR_ATTR_ID = __constant_htons(0x001A)
};
#define CM_REQ_ATTR_ID __constant_htons(0x0010)
#define CM_MRA_ATTR_ID __constant_htons(0x0011)
#define CM_REJ_ATTR_ID __constant_htons(0x0012)
#define CM_REP_ATTR_ID __constant_htons(0x0013)
#define CM_RTU_ATTR_ID __constant_htons(0x0014)
#define CM_DREQ_ATTR_ID __constant_htons(0x0015)
#define CM_DREP_ATTR_ID __constant_htons(0x0016)
#define CM_SIDR_REQ_ATTR_ID __constant_htons(0x0017)
#define CM_SIDR_REP_ATTR_ID __constant_htons(0x0018)
#define CM_LAP_ATTR_ID __constant_htons(0x0019)
#define CM_APR_ATTR_ID __constant_htons(0x001A)
enum cm_msg_sequence {
CM_MSG_SEQUENCE_REQ,
......@@ -67,35 +65,35 @@ enum cm_msg_sequence {
struct cm_req_msg {
struct ib_mad_hdr hdr;
u32 local_comm_id;
u32 rsvd4;
u64 service_id;
u64 local_ca_guid;
u32 rsvd24;
u32 local_qkey;
__be32 local_comm_id;
__be32 rsvd4;
__be64 service_id;
__be64 local_ca_guid;
__be32 rsvd24;
__be32 local_qkey;
/* local QPN:24, responder resources:8 */
u32 offset32;
__be32 offset32;
/* local EECN:24, initiator depth:8 */
u32 offset36;
__be32 offset36;
/*
* remote EECN:24, remote CM response timeout:5,
* transport service type:2, end-to-end flow control:1
*/
u32 offset40;
__be32 offset40;
/* starting PSN:24, local CM response timeout:5, retry count:3 */
u32 offset44;
u16 pkey;
__be32 offset44;
__be16 pkey;
/* path MTU:4, RDC exists:1, RNR retry count:3. */
u8 offset50;
/* max CM Retries:4, SRQ:1, rsvd:3 */
u8 offset51;
u16 primary_local_lid;
u16 primary_remote_lid;
__be16 primary_local_lid;
__be16 primary_remote_lid;
union ib_gid primary_local_gid;
union ib_gid primary_remote_gid;
/* flow label:20, rsvd:6, packet rate:6 */
u32 primary_offset88;
__be32 primary_offset88;
u8 primary_traffic_class;
u8 primary_hop_limit;
/* SL:4, subnet local:1, rsvd:3 */
......@@ -103,12 +101,12 @@ struct cm_req_msg {
/* local ACK timeout:5, rsvd:3 */
u8 primary_offset95;
u16 alt_local_lid;
u16 alt_remote_lid;
__be16 alt_local_lid;
__be16 alt_remote_lid;
union ib_gid alt_local_gid;
union ib_gid alt_remote_gid;
/* flow label:20, rsvd:6, packet rate:6 */
u32 alt_offset132;
__be32 alt_offset132;
u8 alt_traffic_class;
u8 alt_hop_limit;
/* SL:4, subnet local:1, rsvd:3 */
......@@ -120,12 +118,12 @@ struct cm_req_msg {
} __attribute__ ((packed));
static inline u32 cm_req_get_local_qpn(struct cm_req_msg *req_msg)
static inline __be32 cm_req_get_local_qpn(struct cm_req_msg *req_msg)
{
return cpu_to_be32(be32_to_cpu(req_msg->offset32) >> 8);
}
static inline void cm_req_set_local_qpn(struct cm_req_msg *req_msg, u32 qpn)
static inline void cm_req_set_local_qpn(struct cm_req_msg *req_msg, __be32 qpn)
{
req_msg->offset32 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
(be32_to_cpu(req_msg->offset32) &
......@@ -208,13 +206,13 @@ static inline void cm_req_set_flow_ctrl(struct cm_req_msg *req_msg,
0xFFFFFFFE));
}
static inline u32 cm_req_get_starting_psn(struct cm_req_msg *req_msg)
static inline __be32 cm_req_get_starting_psn(struct cm_req_msg *req_msg)
{
return cpu_to_be32(be32_to_cpu(req_msg->offset44) >> 8);
}
static inline void cm_req_set_starting_psn(struct cm_req_msg *req_msg,
u32 starting_psn)
__be32 starting_psn)
{
req_msg->offset44 = cpu_to_be32((be32_to_cpu(starting_psn) << 8) |
(be32_to_cpu(req_msg->offset44) & 0x000000FF));
......@@ -288,13 +286,13 @@ static inline void cm_req_set_srq(struct cm_req_msg *req_msg, u8 srq)
((srq & 0x1) << 3));
}
static inline u32 cm_req_get_primary_flow_label(struct cm_req_msg *req_msg)
static inline __be32 cm_req_get_primary_flow_label(struct cm_req_msg *req_msg)
{
return cpu_to_be32((be32_to_cpu(req_msg->primary_offset88) >> 12));
return cpu_to_be32(be32_to_cpu(req_msg->primary_offset88) >> 12);
}
static inline void cm_req_set_primary_flow_label(struct cm_req_msg *req_msg,
u32 flow_label)
__be32 flow_label)
{
req_msg->primary_offset88 = cpu_to_be32(
(be32_to_cpu(req_msg->primary_offset88) &
......@@ -350,13 +348,13 @@ static inline void cm_req_set_primary_local_ack_timeout(struct cm_req_msg *req_m
(local_ack_timeout << 3));
}
static inline u32 cm_req_get_alt_flow_label(struct cm_req_msg *req_msg)
static inline __be32 cm_req_get_alt_flow_label(struct cm_req_msg *req_msg)
{
return cpu_to_be32((be32_to_cpu(req_msg->alt_offset132) >> 12));
return cpu_to_be32(be32_to_cpu(req_msg->alt_offset132) >> 12);
}
static inline void cm_req_set_alt_flow_label(struct cm_req_msg *req_msg,
u32 flow_label)
__be32 flow_label)
{
req_msg->alt_offset132 = cpu_to_be32(
(be32_to_cpu(req_msg->alt_offset132) &
......@@ -422,8 +420,8 @@ enum cm_msg_response {
struct cm_mra_msg {
struct ib_mad_hdr hdr;
u32 local_comm_id;
u32 remote_comm_id;
__be32 local_comm_id;
__be32 remote_comm_id;
/* message MRAed:2, rsvd:6 */
u8 offset8;
/* service timeout:5, rsvd:3 */
......@@ -458,13 +456,13 @@ static inline void cm_mra_set_service_timeout(struct cm_mra_msg *mra_msg,
struct cm_rej_msg {
struct ib_mad_hdr hdr;
u32 local_comm_id;
u32 remote_comm_id;
__be32 local_comm_id;
__be32 remote_comm_id;
/* message REJected:2, rsvd:6 */
u8 offset8;
/* reject info length:7, rsvd:1. */
u8 offset9;
u16 reason;
__be16 reason;
u8 ari[IB_CM_REJ_ARI_LENGTH];
u8 private_data[IB_CM_REJ_PRIVATE_DATA_SIZE];
......@@ -495,45 +493,45 @@ static inline void cm_rej_set_reject_info_len(struct cm_rej_msg *rej_msg,
struct cm_rep_msg {
struct ib_mad_hdr hdr;
u32 local_comm_id;
u32 remote_comm_id;
u32 local_qkey;
__be32 local_comm_id;
__be32 remote_comm_id;
__be32 local_qkey;
/* local QPN:24, rsvd:8 */
u32 offset12;
__be32 offset12;
/* local EECN:24, rsvd:8 */
u32 offset16;
__be32 offset16;
/* starting PSN:24 rsvd:8 */
u32 offset20;
__be32 offset20;
u8 resp_resources;
u8 initiator_depth;
/* target ACK delay:5, failover accepted:2, end-to-end flow control:1 */
u8 offset26;
/* RNR retry count:3, SRQ:1, rsvd:5 */
u8 offset27;
u64 local_ca_guid;
__be64 local_ca_guid;
u8 private_data[IB_CM_REP_PRIVATE_DATA_SIZE];
} __attribute__ ((packed));
static inline u32 cm_rep_get_local_qpn(struct cm_rep_msg *rep_msg)
static inline __be32 cm_rep_get_local_qpn(struct cm_rep_msg *rep_msg)
{
return cpu_to_be32(be32_to_cpu(rep_msg->offset12) >> 8);
}
static inline void cm_rep_set_local_qpn(struct cm_rep_msg *rep_msg, u32 qpn)
static inline void cm_rep_set_local_qpn(struct cm_rep_msg *rep_msg, __be32 qpn)
{
rep_msg->offset12 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
(be32_to_cpu(rep_msg->offset12) & 0x000000FF));
}
static inline u32 cm_rep_get_starting_psn(struct cm_rep_msg *rep_msg)
static inline __be32 cm_rep_get_starting_psn(struct cm_rep_msg *rep_msg)
{
return cpu_to_be32(be32_to_cpu(rep_msg->offset20) >> 8);
}
static inline void cm_rep_set_starting_psn(struct cm_rep_msg *rep_msg,
u32 starting_psn)
__be32 starting_psn)
{
rep_msg->offset20 = cpu_to_be32((be32_to_cpu(starting_psn) << 8) |
(be32_to_cpu(rep_msg->offset20) & 0x000000FF));
......@@ -600,8 +598,8 @@ static inline void cm_rep_set_srq(struct cm_rep_msg *rep_msg, u8 srq)
struct cm_rtu_msg {
struct ib_mad_hdr hdr;
u32 local_comm_id;
u32 remote_comm_id;
__be32 local_comm_id;
__be32 remote_comm_id;
u8 private_data[IB_CM_RTU_PRIVATE_DATA_SIZE];
......@@ -610,21 +608,21 @@ struct cm_rtu_msg {
struct cm_dreq_msg {
struct ib_mad_hdr hdr;
u32 local_comm_id;
u32 remote_comm_id;
__be32 local_comm_id;
__be32 remote_comm_id;
/* remote QPN/EECN:24, rsvd:8 */
u32 offset8;
__be32 offset8;
u8 private_data[IB_CM_DREQ_PRIVATE_DATA_SIZE];
} __attribute__ ((packed));
static inline u32 cm_dreq_get_remote_qpn(struct cm_dreq_msg *dreq_msg)
static inline __be32 cm_dreq_get_remote_qpn(struct cm_dreq_msg *dreq_msg)
{
return cpu_to_be32(be32_to_cpu(dreq_msg->offset8) >> 8);
}
static inline void cm_dreq_set_remote_qpn(struct cm_dreq_msg *dreq_msg, u32 qpn)
static inline void cm_dreq_set_remote_qpn(struct cm_dreq_msg *dreq_msg, __be32 qpn)
{
dreq_msg->offset8 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
(be32_to_cpu(dreq_msg->offset8) & 0x000000FF));
......@@ -633,8 +631,8 @@ static inline void cm_dreq_set_remote_qpn(struct cm_dreq_msg *dreq_msg, u32 qpn)
struct cm_drep_msg {
struct ib_mad_hdr hdr;
u32 local_comm_id;
u32 remote_comm_id;
__be32 local_comm_id;
__be32 remote_comm_id;
u8 private_data[IB_CM_DREP_PRIVATE_DATA_SIZE];
......@@ -643,37 +641,37 @@ struct cm_drep_msg {
struct cm_lap_msg {
struct ib_mad_hdr hdr;
u32 local_comm_id;
u32 remote_comm_id;
__be32 local_comm_id;
__be32 remote_comm_id;
u32 rsvd8;
__be32 rsvd8;
/* remote QPN/EECN:24, remote CM response timeout:5, rsvd:3 */
u32 offset12;
u32 rsvd16;
__be32 offset12;
__be32 rsvd16;
u16 alt_local_lid;
u16 alt_remote_lid;
__be16 alt_local_lid;
__be16 alt_remote_lid;
union ib_gid alt_local_gid;
union ib_gid alt_remote_gid;
/* flow label:20, rsvd:4, traffic class:8 */
u32 offset56;
__be32 offset56;
u8 alt_hop_limit;
/* rsvd:2, packet rate:6 */
uint8_t offset61;
u8 offset61;
/* SL:4, subnet local:1, rsvd:3 */
uint8_t offset62;
u8 offset62;
/* local ACK timeout:5, rsvd:3 */
uint8_t offset63;
u8 offset63;
u8 private_data[IB_CM_LAP_PRIVATE_DATA_SIZE];
} __attribute__ ((packed));
static inline u32 cm_lap_get_remote_qpn(struct cm_lap_msg *lap_msg)
static inline __be32 cm_lap_get_remote_qpn(struct cm_lap_msg *lap_msg)
{
return cpu_to_be32(be32_to_cpu(lap_msg->offset12) >> 8);
}
static inline void cm_lap_set_remote_qpn(struct cm_lap_msg *lap_msg, u32 qpn)
static inline void cm_lap_set_remote_qpn(struct cm_lap_msg *lap_msg, __be32 qpn)
{
lap_msg->offset12 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
(be32_to_cpu(lap_msg->offset12) &
......@@ -693,17 +691,17 @@ static inline void cm_lap_set_remote_resp_timeout(struct cm_lap_msg *lap_msg,
0xFFFFFF07));
}
static inline u32 cm_lap_get_flow_label(struct cm_lap_msg *lap_msg)
static inline __be32 cm_lap_get_flow_label(struct cm_lap_msg *lap_msg)
{
return be32_to_cpu(lap_msg->offset56) >> 12;
return cpu_to_be32(be32_to_cpu(lap_msg->offset56) >> 12);
}
static inline void cm_lap_set_flow_label(struct cm_lap_msg *lap_msg,
u32 flow_label)
__be32 flow_label)
{
lap_msg->offset56 = cpu_to_be32((flow_label << 12) |
(be32_to_cpu(lap_msg->offset56) &
0x00000FFF));
lap_msg->offset56 = cpu_to_be32(
(be32_to_cpu(lap_msg->offset56) & 0x00000FFF) |
(be32_to_cpu(flow_label) << 12));
}
static inline u8 cm_lap_get_traffic_class(struct cm_lap_msg *lap_msg)
......@@ -766,8 +764,8 @@ static inline void cm_lap_set_local_ack_timeout(struct cm_lap_msg *lap_msg,
struct cm_apr_msg {
struct ib_mad_hdr hdr;
u32 local_comm_id;
u32 remote_comm_id;
__be32 local_comm_id;
__be32 remote_comm_id;
u8 info_length;
u8 ap_status;
......@@ -779,10 +777,10 @@ struct cm_apr_msg {
struct cm_sidr_req_msg {
struct ib_mad_hdr hdr;
u32 request_id;
u16 pkey;
u16 rsvd;
u64 service_id;
__be32 request_id;
__be16 pkey;
__be16 rsvd;
__be64 service_id;
u8 private_data[IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE];
} __attribute__ ((packed));
......@@ -790,26 +788,26 @@ struct cm_sidr_req_msg {
struct cm_sidr_rep_msg {
struct ib_mad_hdr hdr;
u32 request_id;
__be32 request_id;
u8 status;
u8 info_length;
u16 rsvd;
__be16 rsvd;
/* QPN:24, rsvd:8 */
u32 offset8;
u64 service_id;
u32 qkey;
__be32 offset8;
__be64 service_id;
__be32 qkey;
u8 info[IB_CM_SIDR_REP_INFO_LENGTH];
u8 private_data[IB_CM_SIDR_REP_PRIVATE_DATA_SIZE];
} __attribute__ ((packed));
static inline u32 cm_sidr_rep_get_qpn(struct cm_sidr_rep_msg *sidr_rep_msg)
static inline __be32 cm_sidr_rep_get_qpn(struct cm_sidr_rep_msg *sidr_rep_msg)
{
return cpu_to_be32(be32_to_cpu(sidr_rep_msg->offset8) >> 8);
}
static inline void cm_sidr_rep_set_qpn(struct cm_sidr_rep_msg *sidr_rep_msg,
u32 qpn)
__be32 qpn)
{
sidr_rep_msg->offset8 = cpu_to_be32((be32_to_cpu(qpn) << 8) |
(be32_to_cpu(sidr_rep_msg->offset8) &
......
......@@ -693,7 +693,8 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
goto out;
}
build_smp_wc(send_wr->wr_id, smp->dr_slid, send_wr->wr.ud.pkey_index,
build_smp_wc(send_wr->wr_id, be16_to_cpu(smp->dr_slid),
send_wr->wr.ud.pkey_index,
send_wr->wr.ud.port_num, &mad_wc);
/* No GRH for DR SMP */
......@@ -1554,7 +1555,7 @@ static int is_data_mad(struct ib_mad_agent_private *mad_agent_priv,
}
struct ib_mad_send_wr_private*
ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, u64 tid)
ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, __be64 tid)
{
struct ib_mad_send_wr_private *mad_send_wr;
......@@ -1597,7 +1598,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
struct ib_mad_send_wr_private *mad_send_wr;
struct ib_mad_send_wc mad_send_wc;
unsigned long flags;
u64 tid;
__be64 tid;
INIT_LIST_HEAD(&mad_recv_wc->rmpp_list);
list_add(&mad_recv_wc->recv_buf.list, &mad_recv_wc->rmpp_list);
......@@ -2165,7 +2166,8 @@ static void local_completions(void *data)
* Defined behavior is to complete response
* before request
*/
build_smp_wc(local->wr_id, IB_LID_PERMISSIVE,
build_smp_wc(local->wr_id,
be16_to_cpu(IB_LID_PERMISSIVE),
0 /* pkey index */,
recv_mad_agent->agent.port_num, &wc);
......
......@@ -121,7 +121,7 @@ struct ib_mad_send_wr_private {
struct ib_send_wr send_wr;
struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG];
u64 wr_id; /* client WR ID */
u64 tid;
__be64 tid;
unsigned long timeout;
int retries;
int retry;
......@@ -144,7 +144,7 @@ struct ib_mad_local_private {
struct ib_send_wr send_wr;
struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG];
u64 wr_id; /* client WR ID */
u64 tid;
__be64 tid;
};
struct ib_mad_mgmt_method_table {
......@@ -210,7 +210,7 @@ extern kmem_cache_t *ib_mad_cache;
int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr);
struct ib_mad_send_wr_private *
ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, u64 tid);
ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, __be64 tid);
void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
struct ib_mad_send_wc *mad_send_wc);
......
......@@ -61,7 +61,7 @@ struct mad_rmpp_recv {
int seg_num;
int newwin;
u64 tid;
__be64 tid;
u32 src_qp;
u16 slid;
u8 mgmt_class;
......
......@@ -255,14 +255,14 @@ static ssize_t show_port_gid(struct ib_port *p, struct port_attribute *attr,
return ret;
return sprintf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
be16_to_cpu(((u16 *) gid.raw)[0]),
be16_to_cpu(((u16 *) gid.raw)[1]),
be16_to_cpu(((u16 *) gid.raw)[2]),
be16_to_cpu(((u16 *) gid.raw)[3]),
be16_to_cpu(((u16 *) gid.raw)[4]),
be16_to_cpu(((u16 *) gid.raw)[5]),
be16_to_cpu(((u16 *) gid.raw)[6]),
be16_to_cpu(((u16 *) gid.raw)[7]));
be16_to_cpu(((__be16 *) gid.raw)[0]),
be16_to_cpu(((__be16 *) gid.raw)[1]),
be16_to_cpu(((__be16 *) gid.raw)[2]),
be16_to_cpu(((__be16 *) gid.raw)[3]),
be16_to_cpu(((__be16 *) gid.raw)[4]),
be16_to_cpu(((__be16 *) gid.raw)[5]),
be16_to_cpu(((__be16 *) gid.raw)[6]),
be16_to_cpu(((__be16 *) gid.raw)[7]));
}
static ssize_t show_port_pkey(struct ib_port *p, struct port_attribute *attr,
......@@ -334,11 +334,11 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
break;
case 16:
ret = sprintf(buf, "%u\n",
be16_to_cpup((u16 *)(out_mad->data + 40 + offset / 8)));
be16_to_cpup((__be16 *)(out_mad->data + 40 + offset / 8)));
break;
case 32:
ret = sprintf(buf, "%u\n",
be32_to_cpup((u32 *)(out_mad->data + 40 + offset / 8)));
be32_to_cpup((__be32 *)(out_mad->data + 40 + offset / 8)));
break;
default:
ret = 0;
......@@ -600,10 +600,10 @@ static ssize_t show_sys_image_guid(struct class_device *cdev, char *buf)
return ret;
return sprintf(buf, "%04x:%04x:%04x:%04x\n",
be16_to_cpu(((u16 *) &attr.sys_image_guid)[0]),
be16_to_cpu(((u16 *) &attr.sys_image_guid)[1]),
be16_to_cpu(((u16 *) &attr.sys_image_guid)[2]),
be16_to_cpu(((u16 *) &attr.sys_image_guid)[3]));
be16_to_cpu(((__be16 *) &attr.sys_image_guid)[0]),
be16_to_cpu(((__be16 *) &attr.sys_image_guid)[1]),
be16_to_cpu(((__be16 *) &attr.sys_image_guid)[2]),
be16_to_cpu(((__be16 *) &attr.sys_image_guid)[3]));
}
static ssize_t show_node_guid(struct class_device *cdev, char *buf)
......@@ -617,10 +617,10 @@ static ssize_t show_node_guid(struct class_device *cdev, char *buf)
return ret;
return sprintf(buf, "%04x:%04x:%04x:%04x\n",
be16_to_cpu(((u16 *) &attr.node_guid)[0]),
be16_to_cpu(((u16 *) &attr.node_guid)[1]),
be16_to_cpu(((u16 *) &attr.node_guid)[2]),
be16_to_cpu(((u16 *) &attr.node_guid)[3]));
be16_to_cpu(((__be16 *) &attr.node_guid)[0]),
be16_to_cpu(((__be16 *) &attr.node_guid)[1]),
be16_to_cpu(((__be16 *) &attr.node_guid)[2]),
be16_to_cpu(((__be16 *) &attr.node_guid)[3]));
}
static CLASS_DEVICE_ATTR(node_type, S_IRUGO, show_node_type, NULL);
......
......@@ -195,6 +195,7 @@ void ib_ud_header_init(int payload_bytes,
struct ib_ud_header *header)
{
int header_len;
u16 packet_length;
memset(header, 0, sizeof *header);
......@@ -209,7 +210,7 @@ void ib_ud_header_init(int payload_bytes,
header->lrh.link_version = 0;
header->lrh.link_next_header =
grh_present ? IB_LNH_IBA_GLOBAL : IB_LNH_IBA_LOCAL;
header->lrh.packet_length = (IB_LRH_BYTES +
packet_length = (IB_LRH_BYTES +
IB_BTH_BYTES +
IB_DETH_BYTES +
payload_bytes +
......@@ -218,8 +219,7 @@ void ib_ud_header_init(int payload_bytes,
header->grh_present = grh_present;
if (grh_present) {
header->lrh.packet_length += IB_GRH_BYTES / 4;
packet_length += IB_GRH_BYTES / 4;
header->grh.ip_version = 6;
header->grh.payload_length =
cpu_to_be16((IB_BTH_BYTES +
......@@ -230,7 +230,7 @@ void ib_ud_header_init(int payload_bytes,
header->grh.next_header = 0x1b;
}
cpu_to_be16s(&header->lrh.packet_length);
header->lrh.packet_length = cpu_to_be16(packet_length);
if (header->immediate_present)
header->bth.opcode = IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE;
......
......@@ -271,7 +271,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
struct ib_send_wr *bad_wr;
struct ib_rmpp_mad *rmpp_mad;
u8 method;
u64 *tid;
__be64 *tid;
int ret, length, hdr_len, data_len, rmpp_hdr_size;
int rmpp_active = 0;
......@@ -316,7 +316,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
if (packet->mad.hdr.grh_present) {
ah_attr.ah_flags = IB_AH_GRH;
memcpy(ah_attr.grh.dgid.raw, packet->mad.hdr.gid, 16);
ah_attr.grh.flow_label = packet->mad.hdr.flow_label;
ah_attr.grh.flow_label = be32_to_cpu(packet->mad.hdr.flow_label);
ah_attr.grh.hop_limit = packet->mad.hdr.hop_limit;
ah_attr.grh.traffic_class = packet->mad.hdr.traffic_class;
}
......
......@@ -41,16 +41,16 @@
#include "mthca_dev.h"
struct mthca_av {
u32 port_pd;
__be32 port_pd;
u8 reserved1;
u8 g_slid;
u16 dlid;
__be16 dlid;
u8 reserved2;
u8 gid_index;
u8 msg_sr;
u8 hop_limit;
u32 sl_tclass_flowlabel;
u32 dgid[4];
__be32 sl_tclass_flowlabel;
__be32 dgid[4];
};
int mthca_create_ah(struct mthca_dev *dev,
......@@ -128,7 +128,7 @@ int mthca_create_ah(struct mthca_dev *dev,
av, (unsigned long) ah->avdma);
for (j = 0; j < 8; ++j)
printk(KERN_DEBUG " [%2x] %08x\n",
j * 4, be32_to_cpu(((u32 *) av)[j]));
j * 4, be32_to_cpu(((__be32 *) av)[j]));
}
if (ah->type == MTHCA_AH_ON_HCA) {
......@@ -169,7 +169,7 @@ int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah,
header->lrh.service_level = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28;
header->lrh.destination_lid = ah->av->dlid;
header->lrh.source_lid = ah->av->g_slid & 0x7f;
header->lrh.source_lid = cpu_to_be16(ah->av->g_slid & 0x7f);
if (ah->av->g_slid & 0x80) {
header->grh_present = 1;
header->grh.traffic_class =
......
......@@ -220,17 +220,17 @@ static int mthca_cmd_post(struct mthca_dev *dev,
* (and some architectures such as ia64 implement memcpy_toio
* in terms of writeb).
*/
__raw_writel(cpu_to_be32(in_param >> 32), dev->hcr + 0 * 4);
__raw_writel(cpu_to_be32(in_param & 0xfffffffful), dev->hcr + 1 * 4);
__raw_writel(cpu_to_be32(in_modifier), dev->hcr + 2 * 4);
__raw_writel(cpu_to_be32(out_param >> 32), dev->hcr + 3 * 4);
__raw_writel(cpu_to_be32(out_param & 0xfffffffful), dev->hcr + 4 * 4);
__raw_writel(cpu_to_be32(token << 16), dev->hcr + 5 * 4);
__raw_writel((__force u32) cpu_to_be32(in_param >> 32), dev->hcr + 0 * 4);
__raw_writel((__force u32) cpu_to_be32(in_param & 0xfffffffful), dev->hcr + 1 * 4);
__raw_writel((__force u32) cpu_to_be32(in_modifier), dev->hcr + 2 * 4);
__raw_writel((__force u32) cpu_to_be32(out_param >> 32), dev->hcr + 3 * 4);
__raw_writel((__force u32) cpu_to_be32(out_param & 0xfffffffful), dev->hcr + 4 * 4);
__raw_writel((__force u32) cpu_to_be32(token << 16), dev->hcr + 5 * 4);
/* __raw_writel may not order writes. */
wmb();
__raw_writel(cpu_to_be32((1 << HCR_GO_BIT) |
__raw_writel((__force u32) cpu_to_be32((1 << HCR_GO_BIT) |
(event ? (1 << HCA_E_BIT) : 0) |
(op_modifier << HCR_OPMOD_SHIFT) |
op), dev->hcr + 6 * 4);
......@@ -274,12 +274,14 @@ static int mthca_cmd_poll(struct mthca_dev *dev,
goto out;
}
if (out_is_imm) {
memcpy_fromio(out_param, dev->hcr + HCR_OUT_PARAM_OFFSET, sizeof (u64));
be64_to_cpus(out_param);
}
if (out_is_imm)
*out_param =
(u64) be32_to_cpu((__force __be32)
__raw_readl(dev->hcr + HCR_OUT_PARAM_OFFSET)) << 32 |
(u64) be32_to_cpu((__force __be32)
__raw_readl(dev->hcr + HCR_OUT_PARAM_OFFSET + 4));
*status = be32_to_cpu(__raw_readl(dev->hcr + HCR_STATUS_OFFSET)) >> 24;
*status = be32_to_cpu((__force __be32) __raw_readl(dev->hcr + HCR_STATUS_OFFSET)) >> 24;
out:
up(&dev->cmd.poll_sem);
......@@ -1122,7 +1124,7 @@ int mthca_INIT_HCA(struct mthca_dev *dev,
u8 *status)
{
struct mthca_mailbox *mailbox;
u32 *inbox;
__be32 *inbox;
int err;
#define INIT_HCA_IN_SIZE 0x200
......@@ -1343,7 +1345,7 @@ int mthca_MAP_ICM(struct mthca_dev *dev, struct mthca_icm *icm, u64 virt, u8 *st
int mthca_MAP_ICM_page(struct mthca_dev *dev, u64 dma_addr, u64 virt, u8 *status)
{
struct mthca_mailbox *mailbox;
u64 *inbox;
__be64 *inbox;
int err;
mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
......@@ -1514,7 +1516,7 @@ int mthca_MODIFY_QP(struct mthca_dev *dev, int trans, u32 num,
if (i % 8 == 0)
printk(" [%02x] ", i * 4);
printk(" %08x",
be32_to_cpu(((u32 *) mailbox->buf)[i + 2]));
be32_to_cpu(((__be32 *) mailbox->buf)[i + 2]));
if ((i + 1) % 8 == 0)
printk("\n");
}
......@@ -1534,7 +1536,7 @@ int mthca_MODIFY_QP(struct mthca_dev *dev, int trans, u32 num,
if (i % 8 == 0)
printk("[%02x] ", i * 4);
printk(" %08x",
be32_to_cpu(((u32 *) mailbox->buf)[i + 2]));
be32_to_cpu(((__be32 *) mailbox->buf)[i + 2]));
if ((i + 1) % 8 == 0)
printk("\n");
}
......
......@@ -57,20 +57,20 @@ enum {
* Must be packed because start is 64 bits but only aligned to 32 bits.
*/
struct mthca_cq_context {
u32 flags;
u64 start;
u32 logsize_usrpage;
u32 error_eqn; /* Tavor only */
u32 comp_eqn;
u32 pd;
u32 lkey;
u32 last_notified_index;
u32 solicit_producer_index;
u32 consumer_index;
u32 producer_index;
u32 cqn;
u32 ci_db; /* Arbel only */
u32 state_db; /* Arbel only */
__be32 flags;
__be64 start;
__be32 logsize_usrpage;
__be32 error_eqn; /* Tavor only */
__be32 comp_eqn;
__be32 pd;
__be32 lkey;
__be32 last_notified_index;
__be32 solicit_producer_index;
__be32 consumer_index;
__be32 producer_index;
__be32 cqn;
__be32 ci_db; /* Arbel only */
__be32 state_db; /* Arbel only */
u32 reserved;
} __attribute__((packed));
......@@ -110,14 +110,14 @@ enum {
};
struct mthca_cqe {
u32 my_qpn;
u32 my_ee;
u32 rqpn;
u16 sl_g_mlpath;
u16 rlid;
u32 imm_etype_pkey_eec;
u32 byte_cnt;
u32 wqe;
__be32 my_qpn;
__be32 my_ee;
__be32 rqpn;
__be16 sl_g_mlpath;
__be16 rlid;
__be32 imm_etype_pkey_eec;
__be32 byte_cnt;
__be32 wqe;
u8 opcode;
u8 is_send;
u8 reserved;
......@@ -125,13 +125,13 @@ struct mthca_cqe {
};
struct mthca_err_cqe {
u32 my_qpn;
__be32 my_qpn;
u32 reserved1[3];
u8 syndrome;
u8 reserved2;
u16 db_cnt;
__be16 db_cnt;
u32 reserved3;
u32 wqe;
__be32 wqe;
u8 opcode;
u8 reserved4[2];
u8 owner;
......@@ -193,7 +193,7 @@ static void dump_cqe(struct mthca_dev *dev, void *cqe_ptr)
static inline void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq,
int incr)
{
u32 doorbell[2];
__be32 doorbell[2];
if (mthca_is_memfree(dev)) {
*cq->set_ci_db = cpu_to_be32(cq->cons_index);
......@@ -293,7 +293,7 @@ static int handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
{
int err;
int dbd;
u32 new_wqe;
__be32 new_wqe;
if (cqe->syndrome == SYNDROME_LOCAL_QP_OP_ERR) {
mthca_dbg(dev, "local QP operation err "
......@@ -586,13 +586,13 @@ int mthca_poll_cq(struct ib_cq *ibcq, int num_entries,
int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify)
{
u32 doorbell[2];
__be32 doorbell[2];
doorbell[0] = cpu_to_be32((notify == IB_CQ_SOLICITED ?
MTHCA_TAVOR_CQ_DB_REQ_NOT_SOL :
MTHCA_TAVOR_CQ_DB_REQ_NOT) |
to_mcq(cq)->cqn);
doorbell[1] = 0xffffffff;
doorbell[1] = (__force __be32) 0xffffffff;
mthca_write64(doorbell,
to_mdev(cq->device)->kar + MTHCA_CQ_DOORBELL,
......@@ -604,9 +604,9 @@ int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify)
int mthca_arbel_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
{
struct mthca_cq *cq = to_mcq(ibcq);
u32 doorbell[2];
__be32 doorbell[2];
u32 sn;
u32 ci;
__be32 ci;
sn = cq->arm_sn & 3;
ci = cpu_to_be32(cq->cons_index);
......@@ -813,7 +813,6 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
cq_context->flags = cpu_to_be32(MTHCA_CQ_STATUS_OK |
MTHCA_CQ_STATE_DISARMED |
MTHCA_CQ_FLAG_TR);
cq_context->start = cpu_to_be64(0);
cq_context->logsize_usrpage = cpu_to_be32((ffs(nent) - 1) << 24);
if (ctx)
cq_context->logsize_usrpage |= cpu_to_be32(ctx->uar.index);
......@@ -906,7 +905,7 @@ void mthca_free_cq(struct mthca_dev *dev,
mthca_warn(dev, "HW2SW_CQ returned status 0x%02x\n", status);
if (0) {
u32 *ctx = mailbox->buf;
__be32 *ctx = mailbox->buf;
int j;
printk(KERN_ERR "context for CQN %x (cons index %x, next sw %d)\n",
......
......@@ -333,13 +333,12 @@ extern void __buggy_use_of_MTHCA_PUT(void);
#define MTHCA_PUT(dest, source, offset) \
do { \
__typeof__(source) *__p = \
(__typeof__(source) *) ((char *) (dest) + (offset)); \
void *__d = ((char *) (dest) + (offset)); \
switch (sizeof(source)) { \
case 1: *__p = (source); break; \
case 2: *__p = cpu_to_be16(source); break; \
case 4: *__p = cpu_to_be32(source); break; \
case 8: *__p = cpu_to_be64(source); break; \
case 1: *(u8 *) __d = (source); break; \
case 2: *(__be16 *) __d = cpu_to_be16(source); break; \
case 4: *(__be32 *) __d = cpu_to_be32(source); break; \
case 8: *(__be64 *) __d = cpu_to_be64(source); break; \
default: __buggy_use_of_MTHCA_PUT(); \
} \
} while (0)
......@@ -435,7 +434,7 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
int mthca_arbel_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
struct ib_recv_wr **bad_wr);
int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
int index, int *dbd, u32 *new_wqe);
int index, int *dbd, __be32 *new_wqe);
int mthca_alloc_qp(struct mthca_dev *dev,
struct mthca_pd *pd,
struct mthca_cq *send_cq,
......
......@@ -58,13 +58,13 @@ static inline void mthca_write64_raw(__be64 val, void __iomem *dest)
__raw_writeq((__force u64) val, dest);
}
static inline void mthca_write64(u32 val[2], void __iomem *dest,
static inline void mthca_write64(__be32 val[2], void __iomem *dest,
spinlock_t *doorbell_lock)
{
__raw_writeq(*(u64 *) val, dest);
}
static inline void mthca_write_db_rec(u32 val[2], u32 *db)
static inline void mthca_write_db_rec(__be32 val[2], __be32 *db)
{
*(u64 *) db = *(u64 *) val;
}
......@@ -87,18 +87,18 @@ static inline void mthca_write64_raw(__be64 val, void __iomem *dest)
__raw_writel(((__force u32 *) &val)[1], dest + 4);
}
static inline void mthca_write64(u32 val[2], void __iomem *dest,
static inline void mthca_write64(__be32 val[2], void __iomem *dest,
spinlock_t *doorbell_lock)
{
unsigned long flags;
spin_lock_irqsave(doorbell_lock, flags);
__raw_writel(val[0], dest);
__raw_writel(val[1], dest + 4);
__raw_writel((__force u32) val[0], dest);
__raw_writel((__force u32) val[1], dest + 4);
spin_unlock_irqrestore(doorbell_lock, flags);
}
static inline void mthca_write_db_rec(u32 val[2], u32 *db)
static inline void mthca_write_db_rec(__be32 val[2], __be32 *db)
{
db[0] = val[0];
wmb();
......
......@@ -52,17 +52,17 @@ enum {
* Must be packed because start is 64 bits but only aligned to 32 bits.
*/
struct mthca_eq_context {
u32 flags;
u64 start;
u32 logsize_usrpage;
u32 tavor_pd; /* reserved for Arbel */
__be32 flags;
__be64 start;
__be32 logsize_usrpage;
__be32 tavor_pd; /* reserved for Arbel */
u8 reserved1[3];
u8 intr;
u32 arbel_pd; /* lost_count for Tavor */
u32 lkey;
__be32 arbel_pd; /* lost_count for Tavor */
__be32 lkey;
u32 reserved2[2];
u32 consumer_index;
u32 producer_index;
__be32 consumer_index;
__be32 producer_index;
u32 reserved3[4];
} __attribute__((packed));
......@@ -128,28 +128,28 @@ struct mthca_eqe {
union {
u32 raw[6];
struct {
u32 cqn;
__be32 cqn;
} __attribute__((packed)) comp;
struct {
u16 reserved1;
u16 token;
__be16 token;
u32 reserved2;
u8 reserved3[3];
u8 status;
u64 out_param;
__be64 out_param;
} __attribute__((packed)) cmd;
struct {
u32 qpn;
__be32 qpn;
} __attribute__((packed)) qp;
struct {
u32 cqn;
__be32 cqn;
u32 reserved1;
u8 reserved2[3];
u8 syndrome;
} __attribute__((packed)) cq_err;
struct {
u32 reserved1[2];
u32 port;
__be32 port;
} __attribute__((packed)) port_change;
} event;
u8 reserved3[3];
......@@ -168,7 +168,7 @@ static inline u64 async_mask(struct mthca_dev *dev)
static inline void tavor_set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u32 ci)
{
u32 doorbell[2];
__be32 doorbell[2];
doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_SET_CI | eq->eqn);
doorbell[1] = cpu_to_be32(ci & (eq->nent - 1));
......@@ -191,8 +191,8 @@ static inline void arbel_set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u
{
/* See comment in tavor_set_eq_ci() above. */
wmb();
__raw_writel(cpu_to_be32(ci), dev->eq_regs.arbel.eq_set_ci_base +
eq->eqn * 8);
__raw_writel((__force u32) cpu_to_be32(ci),
dev->eq_regs.arbel.eq_set_ci_base + eq->eqn * 8);
/* We still want ordering, just not swabbing, so add a barrier */
mb();
}
......@@ -207,7 +207,7 @@ static inline void set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u32 ci)
static inline void tavor_eq_req_not(struct mthca_dev *dev, int eqn)
{
u32 doorbell[2];
__be32 doorbell[2];
doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_REQ_NOT | eqn);
doorbell[1] = 0;
......@@ -225,7 +225,7 @@ static inline void arbel_eq_req_not(struct mthca_dev *dev, u32 eqn_mask)
static inline void disarm_cq(struct mthca_dev *dev, int eqn, int cqn)
{
if (!mthca_is_memfree(dev)) {
u32 doorbell[2];
__be32 doorbell[2];
doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_DISARM_CQ | eqn);
doorbell[1] = cpu_to_be32(cqn);
......
......@@ -194,7 +194,7 @@ int mthca_process_mad(struct ib_device *ibdev,
{
int err;
u8 status;
u16 slid = in_wc ? in_wc->slid : IB_LID_PERMISSIVE;
u16 slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE);
/* Forward locally generated traps to the SM */
if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP &&
......
......@@ -42,10 +42,10 @@ enum {
};
struct mthca_mgm {
u32 next_gid_index;
__be32 next_gid_index;
u32 reserved[3];
u8 gid[16];
u32 qp[MTHCA_QP_PER_MGM];
__be32 qp[MTHCA_QP_PER_MGM];
};
static const u8 zero_gid[16]; /* automatically initialized to 0 */
......@@ -94,10 +94,14 @@ static int find_mgm(struct mthca_dev *dev,
if (0)
mthca_dbg(dev, "Hash for %04x:%04x:%04x:%04x:"
"%04x:%04x:%04x:%04x is %04x\n",
be16_to_cpu(((u16 *) gid)[0]), be16_to_cpu(((u16 *) gid)[1]),
be16_to_cpu(((u16 *) gid)[2]), be16_to_cpu(((u16 *) gid)[3]),
be16_to_cpu(((u16 *) gid)[4]), be16_to_cpu(((u16 *) gid)[5]),
be16_to_cpu(((u16 *) gid)[6]), be16_to_cpu(((u16 *) gid)[7]),
be16_to_cpu(((__be16 *) gid)[0]),
be16_to_cpu(((__be16 *) gid)[1]),
be16_to_cpu(((__be16 *) gid)[2]),
be16_to_cpu(((__be16 *) gid)[3]),
be16_to_cpu(((__be16 *) gid)[4]),
be16_to_cpu(((__be16 *) gid)[5]),
be16_to_cpu(((__be16 *) gid)[6]),
be16_to_cpu(((__be16 *) gid)[7]),
*hash);
*index = *hash;
......@@ -258,14 +262,14 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
if (index == -1) {
mthca_err(dev, "MGID %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x "
"not found\n",
be16_to_cpu(((u16 *) gid->raw)[0]),
be16_to_cpu(((u16 *) gid->raw)[1]),
be16_to_cpu(((u16 *) gid->raw)[2]),
be16_to_cpu(((u16 *) gid->raw)[3]),
be16_to_cpu(((u16 *) gid->raw)[4]),
be16_to_cpu(((u16 *) gid->raw)[5]),
be16_to_cpu(((u16 *) gid->raw)[6]),
be16_to_cpu(((u16 *) gid->raw)[7]));
be16_to_cpu(((__be16 *) gid->raw)[0]),
be16_to_cpu(((__be16 *) gid->raw)[1]),
be16_to_cpu(((__be16 *) gid->raw)[2]),
be16_to_cpu(((__be16 *) gid->raw)[3]),
be16_to_cpu(((__be16 *) gid->raw)[4]),
be16_to_cpu(((__be16 *) gid->raw)[5]),
be16_to_cpu(((__be16 *) gid->raw)[6]),
be16_to_cpu(((__be16 *) gid->raw)[7]));
err = -EINVAL;
goto out;
}
......
......@@ -482,7 +482,7 @@ void mthca_cleanup_user_db_tab(struct mthca_dev *dev, struct mthca_uar *uar,
}
}
int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db)
int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, __be32 **db)
{
int group;
int start, end, dir;
......@@ -565,7 +565,7 @@ int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db)
page->db_rec[j] = cpu_to_be64((qn << 8) | (type << 5));
*db = (u32 *) &page->db_rec[j];
*db = (__be32 *) &page->db_rec[j];
out:
up(&dev->db_tab->mutex);
......
......@@ -138,7 +138,7 @@ enum {
struct mthca_db_page {
DECLARE_BITMAP(used, MTHCA_DB_REC_PER_PAGE);
u64 *db_rec;
__be64 *db_rec;
dma_addr_t mapping;
};
......@@ -173,7 +173,7 @@ void mthca_cleanup_user_db_tab(struct mthca_dev *dev, struct mthca_uar *uar,
int mthca_init_db_tab(struct mthca_dev *dev);
void mthca_cleanup_db_tab(struct mthca_dev *dev);
int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db);
int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, __be32 **db);
void mthca_free_db(struct mthca_dev *dev, int type, int db_index);
#endif /* MTHCA_MEMFREE_H */
......@@ -51,17 +51,17 @@ struct mthca_mtt {
* Must be packed because mtt_seg is 64 bits but only aligned to 32 bits.
*/
struct mthca_mpt_entry {
u32 flags;
u32 page_size;
u32 key;
u32 pd;
u64 start;
u64 length;
u32 lkey;
u32 window_count;
u32 window_count_limit;
u64 mtt_seg;
u32 mtt_sz; /* Arbel only */
__be32 flags;
__be32 page_size;
__be32 key;
__be32 pd;
__be64 start;
__be64 length;
__be32 lkey;
__be32 window_count;
__be32 window_count_limit;
__be64 mtt_seg;
__be32 mtt_sz; /* Arbel only */
u32 reserved[2];
} __attribute__((packed));
......@@ -248,7 +248,7 @@ int mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt,
int start_index, u64 *buffer_list, int list_len)
{
struct mthca_mailbox *mailbox;
u64 *mtt_entry;
__be64 *mtt_entry;
int err = 0;
u8 status;
int i;
......@@ -390,7 +390,7 @@ int mthca_mr_alloc(struct mthca_dev *dev, u32 pd, int buffer_size_shift,
for (i = 0; i < sizeof (struct mthca_mpt_entry) / 4; ++i) {
if (i % 4 == 0)
printk("[%02x] ", i * 4);
printk(" %08x", be32_to_cpu(((u32 *) mpt_entry)[i]));
printk(" %08x", be32_to_cpu(((__be32 *) mpt_entry)[i]));
if ((i + 1) % 4 == 0)
printk("\n");
}
......@@ -563,7 +563,7 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
for (i = 0; i < sizeof (struct mthca_mpt_entry) / 4; ++i) {
if (i % 4 == 0)
printk("[%02x] ", i * 4);
printk(" %08x", be32_to_cpu(((u32 *) mpt_entry)[i]));
printk(" %08x", be32_to_cpu(((__be32 *) mpt_entry)[i]));
if ((i + 1) % 4 == 0)
printk("\n");
}
......@@ -670,7 +670,7 @@ int mthca_tavor_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,
mpt_entry.length = cpu_to_be64(list_len * (1ull << fmr->attr.page_size));
mpt_entry.start = cpu_to_be64(iova);
writel(mpt_entry.lkey, &fmr->mem.tavor.mpt->key);
__raw_writel((__force u32) mpt_entry.lkey, &fmr->mem.tavor.mpt->key);
memcpy_toio(&fmr->mem.tavor.mpt->start, &mpt_entry.start,
offsetof(struct mthca_mpt_entry, window_count) -
offsetof(struct mthca_mpt_entry, start));
......
......@@ -81,10 +81,10 @@ static int mthca_query_device(struct ib_device *ibdev,
}
props->device_cap_flags = mdev->device_cap_flags;
props->vendor_id = be32_to_cpup((u32 *) (out_mad->data + 36)) &
props->vendor_id = be32_to_cpup((__be32 *) (out_mad->data + 36)) &
0xffffff;
props->vendor_part_id = be16_to_cpup((u16 *) (out_mad->data + 30));
props->hw_ver = be16_to_cpup((u16 *) (out_mad->data + 32));
props->vendor_part_id = be16_to_cpup((__be16 *) (out_mad->data + 30));
props->hw_ver = be16_to_cpup((__be16 *) (out_mad->data + 32));
memcpy(&props->sys_image_guid, out_mad->data + 4, 8);
memcpy(&props->node_guid, out_mad->data + 12, 8);
......@@ -138,16 +138,16 @@ static int mthca_query_port(struct ib_device *ibdev,
goto out;
}
props->lid = be16_to_cpup((u16 *) (out_mad->data + 16));
props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16));
props->lmc = out_mad->data[34] & 0x7;
props->sm_lid = be16_to_cpup((u16 *) (out_mad->data + 18));
props->sm_lid = be16_to_cpup((__be16 *) (out_mad->data + 18));
props->sm_sl = out_mad->data[36] & 0xf;
props->state = out_mad->data[32] & 0xf;
props->phys_state = out_mad->data[33] >> 4;
props->port_cap_flags = be32_to_cpup((u32 *) (out_mad->data + 20));
props->port_cap_flags = be32_to_cpup((__be32 *) (out_mad->data + 20));
props->gid_tbl_len = to_mdev(ibdev)->limits.gid_table_len;
props->pkey_tbl_len = to_mdev(ibdev)->limits.pkey_table_len;
props->qkey_viol_cntr = be16_to_cpup((u16 *) (out_mad->data + 48));
props->qkey_viol_cntr = be16_to_cpup((__be16 *) (out_mad->data + 48));
props->active_width = out_mad->data[31] & 0xf;
props->active_speed = out_mad->data[35] >> 4;
......@@ -223,7 +223,7 @@ static int mthca_query_pkey(struct ib_device *ibdev,
goto out;
}
*pkey = be16_to_cpu(((u16 *) out_mad->data)[index % 32]);
*pkey = be16_to_cpu(((__be16 *) out_mad->data)[index % 32]);
out:
kfree(in_mad);
......
......@@ -182,9 +182,9 @@ struct mthca_cq {
/* Next fields are Arbel only */
int set_ci_db_index;
u32 *set_ci_db;
__be32 *set_ci_db;
int arm_db_index;
u32 *arm_db;
__be32 *arm_db;
int arm_sn;
union {
......@@ -207,7 +207,7 @@ struct mthca_wq {
int wqe_shift;
int db_index; /* Arbel only */
u32 *db;
__be32 *db;
};
struct mthca_qp {
......
......@@ -97,59 +97,59 @@ enum {
};
struct mthca_qp_path {
u32 port_pkey;
__be32 port_pkey;
u8 rnr_retry;
u8 g_mylmc;
u16 rlid;
__be16 rlid;
u8 ackto;
u8 mgid_index;
u8 static_rate;
u8 hop_limit;
u32 sl_tclass_flowlabel;
__be32 sl_tclass_flowlabel;
u8 rgid[16];
} __attribute__((packed));
struct mthca_qp_context {
u32 flags;
u32 tavor_sched_queue; /* Reserved on Arbel */
__be32 flags;
__be32 tavor_sched_queue; /* Reserved on Arbel */
u8 mtu_msgmax;
u8 rq_size_stride; /* Reserved on Tavor */
u8 sq_size_stride; /* Reserved on Tavor */
u8 rlkey_arbel_sched_queue; /* Reserved on Tavor */
u32 usr_page;
u32 local_qpn;
u32 remote_qpn;
__be32 usr_page;
__be32 local_qpn;
__be32 remote_qpn;
u32 reserved1[2];
struct mthca_qp_path pri_path;
struct mthca_qp_path alt_path;
u32 rdd;
u32 pd;
u32 wqe_base;
u32 wqe_lkey;
u32 params1;
u32 reserved2;
u32 next_send_psn;
u32 cqn_snd;
u32 snd_wqe_base_l; /* Next send WQE on Tavor */
u32 snd_db_index; /* (debugging only entries) */
u32 last_acked_psn;
u32 ssn;
u32 params2;
u32 rnr_nextrecvpsn;
u32 ra_buff_indx;
u32 cqn_rcv;
u32 rcv_wqe_base_l; /* Next recv WQE on Tavor */
u32 rcv_db_index; /* (debugging only entries) */
u32 qkey;
u32 srqn;
u32 rmsn;
u16 rq_wqe_counter; /* reserved on Tavor */
u16 sq_wqe_counter; /* reserved on Tavor */
__be32 rdd;
__be32 pd;
__be32 wqe_base;
__be32 wqe_lkey;
__be32 params1;
__be32 reserved2;
__be32 next_send_psn;
__be32 cqn_snd;
__be32 snd_wqe_base_l; /* Next send WQE on Tavor */
__be32 snd_db_index; /* (debugging only entries) */
__be32 last_acked_psn;
__be32 ssn;
__be32 params2;
__be32 rnr_nextrecvpsn;
__be32 ra_buff_indx;
__be32 cqn_rcv;
__be32 rcv_wqe_base_l; /* Next recv WQE on Tavor */
__be32 rcv_db_index; /* (debugging only entries) */
__be32 qkey;
__be32 srqn;
__be32 rmsn;
__be16 rq_wqe_counter; /* reserved on Tavor */
__be16 sq_wqe_counter; /* reserved on Tavor */
u32 reserved3[18];
} __attribute__((packed));
struct mthca_qp_param {
u32 opt_param_mask;
__be32 opt_param_mask;
u32 reserved1;
struct mthca_qp_context context;
u32 reserved2[62];
......@@ -191,62 +191,62 @@ enum {
};
struct mthca_next_seg {
u32 nda_op; /* [31:6] next WQE [4:0] next opcode */
u32 ee_nds; /* [31:8] next EE [7] DBD [6] F [5:0] next WQE size */
u32 flags; /* [3] CQ [2] Event [1] Solicit */
u32 imm; /* immediate data */
__be32 nda_op; /* [31:6] next WQE [4:0] next opcode */
__be32 ee_nds; /* [31:8] next EE [7] DBD [6] F [5:0] next WQE size */
__be32 flags; /* [3] CQ [2] Event [1] Solicit */
__be32 imm; /* immediate data */
};
struct mthca_tavor_ud_seg {
u32 reserved1;
u32 lkey;
u64 av_addr;
__be32 lkey;
__be64 av_addr;
u32 reserved2[4];
u32 dqpn;
u32 qkey;
__be32 dqpn;
__be32 qkey;
u32 reserved3[2];
};
struct mthca_arbel_ud_seg {
u32 av[8];
u32 dqpn;
u32 qkey;
__be32 av[8];
__be32 dqpn;
__be32 qkey;
u32 reserved[2];
};
struct mthca_bind_seg {
u32 flags; /* [31] Atomic [30] rem write [29] rem read */
__be32 flags; /* [31] Atomic [30] rem write [29] rem read */
u32 reserved;
u32 new_rkey;
u32 lkey;
u64 addr;
u64 length;
__be32 new_rkey;
__be32 lkey;
__be64 addr;
__be64 length;
};
struct mthca_raddr_seg {
u64 raddr;
u32 rkey;
__be64 raddr;
__be32 rkey;
u32 reserved;
};
struct mthca_atomic_seg {
u64 swap_add;
u64 compare;
__be64 swap_add;
__be64 compare;
};
struct mthca_data_seg {
u32 byte_count;
u32 lkey;
u64 addr;
__be32 byte_count;
__be32 lkey;
__be64 addr;
};
struct mthca_mlx_seg {
u32 nda_op;
u32 nds;
u32 flags; /* [17] VL15 [16] SLR [14:12] static rate
__be32 nda_op;
__be32 nds;
__be32 flags; /* [17] VL15 [16] SLR [14:12] static rate
[11:8] SL [3] C [2] E */
u16 rlid;
u16 vcrc;
__be16 rlid;
__be16 vcrc;
};
static const u8 mthca_opcode[] = {
......@@ -1459,6 +1459,7 @@ static int build_mlx_header(struct mthca_dev *dev, struct mthca_sqp *sqp,
{
int header_size;
int err;
u16 pkey;
ib_ud_header_init(256, /* assume a MAD */
sqp->ud_header.grh_present,
......@@ -1469,8 +1470,8 @@ static int build_mlx_header(struct mthca_dev *dev, struct mthca_sqp *sqp,
return err;
mlx->flags &= ~cpu_to_be32(MTHCA_NEXT_SOLICIT | 1);
mlx->flags |= cpu_to_be32((!sqp->qp.ibqp.qp_num ? MTHCA_MLX_VL15 : 0) |
(sqp->ud_header.lrh.destination_lid == 0xffff ?
MTHCA_MLX_SLR : 0) |
(sqp->ud_header.lrh.destination_lid ==
IB_LID_PERMISSIVE ? MTHCA_MLX_SLR : 0) |
(sqp->ud_header.lrh.service_level << 8));
mlx->rlid = sqp->ud_header.lrh.destination_lid;
mlx->vcrc = 0;
......@@ -1490,18 +1491,16 @@ static int build_mlx_header(struct mthca_dev *dev, struct mthca_sqp *sqp,
}
sqp->ud_header.lrh.virtual_lane = !sqp->qp.ibqp.qp_num ? 15 : 0;
if (sqp->ud_header.lrh.destination_lid == 0xffff)
sqp->ud_header.lrh.source_lid = 0xffff;
if (sqp->ud_header.lrh.destination_lid == IB_LID_PERMISSIVE)
sqp->ud_header.lrh.source_lid = IB_LID_PERMISSIVE;
sqp->ud_header.bth.solicited_event = !!(wr->send_flags & IB_SEND_SOLICITED);
if (!sqp->qp.ibqp.qp_num)
ib_get_cached_pkey(&dev->ib_dev, sqp->port,
sqp->pkey_index,
&sqp->ud_header.bth.pkey);
sqp->pkey_index, &pkey);
else
ib_get_cached_pkey(&dev->ib_dev, sqp->port,
wr->wr.ud.pkey_index,
&sqp->ud_header.bth.pkey);
cpu_to_be16s(&sqp->ud_header.bth.pkey);
wr->wr.ud.pkey_index, &pkey);
sqp->ud_header.bth.pkey = cpu_to_be16(pkey);
sqp->ud_header.bth.destination_qpn = cpu_to_be32(wr->wr.ud.remote_qpn);
sqp->ud_header.bth.psn = cpu_to_be32((sqp->send_psn++) & ((1 << 24) - 1));
sqp->ud_header.deth.qkey = cpu_to_be32(wr->wr.ud.remote_qkey & 0x80000000 ?
......@@ -1744,7 +1743,7 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
out:
if (likely(nreq)) {
u32 doorbell[2];
__be32 doorbell[2];
doorbell[0] = cpu_to_be32(((qp->sq.next_ind << qp->sq.wqe_shift) +
qp->send_wqe_offset) | f0 | op0);
......@@ -1845,7 +1844,7 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
out:
if (likely(nreq)) {
u32 doorbell[2];
__be32 doorbell[2];
doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
doorbell[1] = cpu_to_be32((qp->qpn << 8) | nreq);
......@@ -2066,7 +2065,7 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
out:
if (likely(nreq)) {
u32 doorbell[2];
__be32 doorbell[2];
doorbell[0] = cpu_to_be32((nreq << 24) |
((qp->sq.head & 0xffff) << 8) |
......@@ -2176,7 +2175,7 @@ int mthca_arbel_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
}
int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
int index, int *dbd, u32 *new_wqe)
int index, int *dbd, __be32 *new_wqe)
{
struct mthca_next_seg *next;
......
......@@ -115,7 +115,7 @@ struct ib_cm_req_event_param {
struct ib_sa_path_rec *primary_path;
struct ib_sa_path_rec *alternate_path;
u64 remote_ca_guid;
__be64 remote_ca_guid;
u32 remote_qkey;
u32 remote_qpn;
enum ib_qp_type qp_type;
......@@ -132,7 +132,7 @@ struct ib_cm_req_event_param {
};
struct ib_cm_rep_event_param {
u64 remote_ca_guid;
__be64 remote_ca_guid;
u32 remote_qkey;
u32 remote_qpn;
u32 starting_psn;
......@@ -146,39 +146,39 @@ struct ib_cm_rep_event_param {
};
enum ib_cm_rej_reason {
IB_CM_REJ_NO_QP = __constant_htons(1),
IB_CM_REJ_NO_EEC = __constant_htons(2),
IB_CM_REJ_NO_RESOURCES = __constant_htons(3),
IB_CM_REJ_TIMEOUT = __constant_htons(4),
IB_CM_REJ_UNSUPPORTED = __constant_htons(5),
IB_CM_REJ_INVALID_COMM_ID = __constant_htons(6),
IB_CM_REJ_INVALID_COMM_INSTANCE = __constant_htons(7),
IB_CM_REJ_INVALID_SERVICE_ID = __constant_htons(8),
IB_CM_REJ_INVALID_TRANSPORT_TYPE = __constant_htons(9),
IB_CM_REJ_STALE_CONN = __constant_htons(10),
IB_CM_REJ_RDC_NOT_EXIST = __constant_htons(11),
IB_CM_REJ_INVALID_GID = __constant_htons(12),
IB_CM_REJ_INVALID_LID = __constant_htons(13),
IB_CM_REJ_INVALID_SL = __constant_htons(14),
IB_CM_REJ_INVALID_TRAFFIC_CLASS = __constant_htons(15),
IB_CM_REJ_INVALID_HOP_LIMIT = __constant_htons(16),
IB_CM_REJ_INVALID_PACKET_RATE = __constant_htons(17),
IB_CM_REJ_INVALID_ALT_GID = __constant_htons(18),
IB_CM_REJ_INVALID_ALT_LID = __constant_htons(19),
IB_CM_REJ_INVALID_ALT_SL = __constant_htons(20),
IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS = __constant_htons(21),
IB_CM_REJ_INVALID_ALT_HOP_LIMIT = __constant_htons(22),
IB_CM_REJ_INVALID_ALT_PACKET_RATE = __constant_htons(23),
IB_CM_REJ_PORT_CM_REDIRECT = __constant_htons(24),
IB_CM_REJ_PORT_REDIRECT = __constant_htons(25),
IB_CM_REJ_INVALID_MTU = __constant_htons(26),
IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES = __constant_htons(27),
IB_CM_REJ_CONSUMER_DEFINED = __constant_htons(28),
IB_CM_REJ_INVALID_RNR_RETRY = __constant_htons(29),
IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID = __constant_htons(30),
IB_CM_REJ_INVALID_CLASS_VERSION = __constant_htons(31),
IB_CM_REJ_INVALID_FLOW_LABEL = __constant_htons(32),
IB_CM_REJ_INVALID_ALT_FLOW_LABEL = __constant_htons(33)
IB_CM_REJ_NO_QP = 1,
IB_CM_REJ_NO_EEC = 2,
IB_CM_REJ_NO_RESOURCES = 3,
IB_CM_REJ_TIMEOUT = 4,
IB_CM_REJ_UNSUPPORTED = 5,
IB_CM_REJ_INVALID_COMM_ID = 6,
IB_CM_REJ_INVALID_COMM_INSTANCE = 7,
IB_CM_REJ_INVALID_SERVICE_ID = 8,
IB_CM_REJ_INVALID_TRANSPORT_TYPE = 9,
IB_CM_REJ_STALE_CONN = 10,
IB_CM_REJ_RDC_NOT_EXIST = 11,
IB_CM_REJ_INVALID_GID = 12,
IB_CM_REJ_INVALID_LID = 13,
IB_CM_REJ_INVALID_SL = 14,
IB_CM_REJ_INVALID_TRAFFIC_CLASS = 15,
IB_CM_REJ_INVALID_HOP_LIMIT = 16,
IB_CM_REJ_INVALID_PACKET_RATE = 17,
IB_CM_REJ_INVALID_ALT_GID = 18,
IB_CM_REJ_INVALID_ALT_LID = 19,
IB_CM_REJ_INVALID_ALT_SL = 20,
IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS = 21,
IB_CM_REJ_INVALID_ALT_HOP_LIMIT = 22,
IB_CM_REJ_INVALID_ALT_PACKET_RATE = 23,
IB_CM_REJ_PORT_CM_REDIRECT = 24,
IB_CM_REJ_PORT_REDIRECT = 25,
IB_CM_REJ_INVALID_MTU = 26,
IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES = 27,
IB_CM_REJ_CONSUMER_DEFINED = 28,
IB_CM_REJ_INVALID_RNR_RETRY = 29,
IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID = 30,
IB_CM_REJ_INVALID_CLASS_VERSION = 31,
IB_CM_REJ_INVALID_FLOW_LABEL = 32,
IB_CM_REJ_INVALID_ALT_FLOW_LABEL = 33
};
struct ib_cm_rej_event_param {
......@@ -222,7 +222,6 @@ struct ib_cm_sidr_req_event_param {
struct ib_cm_id *listen_id;
struct ib_device *device;
u8 port;
u16 pkey;
};
......@@ -285,12 +284,12 @@ typedef int (*ib_cm_handler)(struct ib_cm_id *cm_id,
struct ib_cm_id {
ib_cm_handler cm_handler;
void *context;
u64 service_id;
u64 service_mask;
__be64 service_id;
__be64 service_mask;
enum ib_cm_state state; /* internal CM/debug use */
enum ib_cm_lap_state lap_state; /* internal CM/debug use */
u32 local_id;
u32 remote_id;
__be32 local_id;
__be32 remote_id;
};
/**
......@@ -330,13 +329,13 @@ void ib_destroy_cm_id(struct ib_cm_id *cm_id);
* IB_CM_ASSIGN_SERVICE_ID.
*/
int ib_cm_listen(struct ib_cm_id *cm_id,
u64 service_id,
u64 service_mask);
__be64 service_id,
__be64 service_mask);
struct ib_cm_req_param {
struct ib_sa_path_rec *primary_path;
struct ib_sa_path_rec *alternate_path;
u64 service_id;
__be64 service_id;
u32 qp_num;
enum ib_qp_type qp_type;
u32 starting_psn;
......@@ -528,7 +527,7 @@ int ib_send_cm_apr(struct ib_cm_id *cm_id,
struct ib_cm_sidr_req_param {
struct ib_sa_path_rec *path;
u64 service_id;
__be64 service_id;
int timeout_ms;
const void *private_data;
u8 private_data_len;
......
......@@ -111,12 +111,12 @@ struct ib_mad_hdr {
u8 mgmt_class;
u8 class_version;
u8 method;
u16 status;
u16 class_specific;
u64 tid;
u16 attr_id;
u16 resv;
u32 attr_mod;
__be16 status;
__be16 class_specific;
__be64 tid;
__be16 attr_id;
__be16 resv;
__be32 attr_mod;
};
struct ib_rmpp_hdr {
......@@ -124,8 +124,8 @@ struct ib_rmpp_hdr {
u8 rmpp_type;
u8 rmpp_rtime_flags;
u8 rmpp_status;
u32 seg_num;
u32 paylen_newwin;
__be32 seg_num;
__be32 paylen_newwin;
};
typedef u64 __bitwise ib_sa_comp_mask;
......@@ -139,9 +139,9 @@ typedef u64 __bitwise ib_sa_comp_mask;
* the wire so we can't change the layout)
*/
struct ib_sa_hdr {
u64 sm_key;
u16 attr_offset;
u16 reserved;
__be64 sm_key;
__be16 attr_offset;
__be16 reserved;
ib_sa_comp_mask comp_mask;
} __attribute__ ((packed));
......
......@@ -133,16 +133,16 @@ struct ib_sa_path_rec {
/* reserved */
union ib_gid dgid;
union ib_gid sgid;
u16 dlid;
u16 slid;
__be16 dlid;
__be16 slid;
int raw_traffic;
/* reserved */
u32 flow_label;
__be32 flow_label;
u8 hop_limit;
u8 traffic_class;
int reversible;
u8 numb_path;
u16 pkey;
__be16 pkey;
/* reserved */
u8 sl;
u8 mtu_selector;
......@@ -176,18 +176,18 @@ struct ib_sa_path_rec {
struct ib_sa_mcmember_rec {
union ib_gid mgid;
union ib_gid port_gid;
u32 qkey;
u16 mlid;
__be32 qkey;
__be16 mlid;
u8 mtu_selector;
u8 mtu;
u8 traffic_class;
u16 pkey;
__be16 pkey;
u8 rate_selector;
u8 rate;
u8 packet_life_time_selector;
u8 packet_life_time;
u8 sl;
u32 flow_label;
__be32 flow_label;
u8 hop_limit;
u8 scope;
u8 join_state;
......@@ -238,7 +238,7 @@ struct ib_sa_mcmember_rec {
struct ib_sa_service_rec {
u64 id;
union ib_gid gid;
u16 pkey;
__be16 pkey;
/* reserved */
u32 lease;
u8 key[16];
......
......@@ -41,8 +41,6 @@
#include <ib_mad.h>
#define IB_LID_PERMISSIVE 0xFFFF
#define IB_SMP_DATA_SIZE 64
#define IB_SMP_MAX_PATH_HOPS 64
......@@ -51,16 +49,16 @@ struct ib_smp {
u8 mgmt_class;
u8 class_version;
u8 method;
u16 status;
__be16 status;
u8 hop_ptr;
u8 hop_cnt;
u64 tid;
u16 attr_id;
u16 resv;
u32 attr_mod;
u64 mkey;
u16 dr_slid;
u16 dr_dlid;
__be64 tid;
__be16 attr_id;
__be16 resv;
__be32 attr_mod;
__be64 mkey;
__be16 dr_slid;
__be16 dr_dlid;
u8 reserved[28];
u8 data[IB_SMP_DATA_SIZE];
u8 initial_path[IB_SMP_MAX_PATH_HOPS];
......
......@@ -88,15 +88,15 @@ struct ib_ucm_attr_id {
};
struct ib_ucm_attr_id_resp {
__u64 service_id;
__u64 service_mask;
__u32 local_id;
__u32 remote_id;
__be64 service_id;
__be64 service_mask;
__be32 local_id;
__be32 remote_id;
};
struct ib_ucm_listen {
__u64 service_id;
__u64 service_mask;
__be64 service_id;
__be64 service_mask;
__u32 id;
};
......@@ -114,13 +114,13 @@ struct ib_ucm_private_data {
struct ib_ucm_path_rec {
__u8 dgid[16];
__u8 sgid[16];
__u16 dlid;
__u16 slid;
__be16 dlid;
__be16 slid;
__u32 raw_traffic;
__u32 flow_label;
__be32 flow_label;
__u32 reversible;
__u32 mtu;
__u16 pkey;
__be16 pkey;
__u8 hop_limit;
__u8 traffic_class;
__u8 numb_path;
......@@ -138,7 +138,7 @@ struct ib_ucm_req {
__u32 qpn;
__u32 qp_type;
__u32 psn;
__u64 sid;
__be64 sid;
__u64 data;
__u64 primary_path;
__u64 alternate_path;
......@@ -200,7 +200,7 @@ struct ib_ucm_lap {
struct ib_ucm_sidr_req {
__u32 id;
__u32 timeout;
__u64 sid;
__be64 sid;
__u64 data;
__u64 path;
__u16 pkey;
......@@ -237,7 +237,7 @@ struct ib_ucm_req_event_resp {
/* port */
struct ib_ucm_path_rec primary_path;
struct ib_ucm_path_rec alternate_path;
__u64 remote_ca_guid;
__be64 remote_ca_guid;
__u32 remote_qkey;
__u32 remote_qpn;
__u32 qp_type;
......@@ -253,7 +253,7 @@ struct ib_ucm_req_event_resp {
};
struct ib_ucm_rep_event_resp {
__u64 remote_ca_guid;
__be64 remote_ca_guid;
__u32 remote_qkey;
__u32 remote_qpn;
__u32 starting_psn;
......
......@@ -70,8 +70,6 @@
* @traffic_class - Traffic class in GRH
* @gid - Remote GID in GRH
* @flow_label - Flow label in GRH
*
* All multi-byte quantities are stored in network (big endian) byte order.
*/
struct ib_user_mad_hdr {
__u32 id;
......@@ -79,9 +77,9 @@ struct ib_user_mad_hdr {
__u32 timeout_ms;
__u32 retries;
__u32 length;
__u32 qpn;
__u32 qkey;
__u16 lid;
__be32 qpn;
__be32 qkey;
__be16 lid;
__u8 sl;
__u8 path_bits;
__u8 grh_present;
......@@ -89,7 +87,7 @@ struct ib_user_mad_hdr {
__u8 hop_limit;
__u8 traffic_class;
__u8 gid[16];
__u32 flow_label;
__be32 flow_label;
};
/**
......
......@@ -143,8 +143,8 @@ struct ib_uverbs_query_device {
struct ib_uverbs_query_device_resp {
__u64 fw_ver;
__u64 node_guid;
__u64 sys_image_guid;
__be64 node_guid;
__be64 sys_image_guid;
__u64 max_mr_size;
__u64 page_size_cap;
__u32 vendor_id;
......
......@@ -51,8 +51,8 @@
union ib_gid {
u8 raw[16];
struct {
u64 subnet_prefix;
u64 interface_id;
__be64 subnet_prefix;
__be64 interface_id;
} global;
};
......@@ -88,8 +88,8 @@ enum ib_atomic_cap {
struct ib_device_attr {
u64 fw_ver;
u64 node_guid;
u64 sys_image_guid;
__be64 node_guid;
__be64 sys_image_guid;
u64 max_mr_size;
u64 page_size_cap;
u32 vendor_id;
......@@ -291,8 +291,8 @@ struct ib_global_route {
};
struct ib_grh {
u32 version_tclass_flow;
u16 paylen;
__be32 version_tclass_flow;
__be16 paylen;
u8 next_hdr;
u8 hop_limit;
union ib_gid sgid;
......@@ -303,6 +303,8 @@ enum {
IB_MULTICAST_QPN = 0xffffff
};
#define IB_LID_PERMISSIVE __constant_htons(0xFFFF)
enum ib_ah_flags {
IB_AH_GRH = 1
};
......
......@@ -90,7 +90,7 @@ enum {
/* structs */
struct ipoib_header {
u16 proto;
__be16 proto;
u16 reserved;
};
......
......@@ -97,7 +97,7 @@ static int ipoib_mcg_seq_show(struct seq_file *file, void *iter_ptr)
for (n = 0, i = 0; i < sizeof mgid / 2; ++i) {
n += sprintf(gid_buf + n, "%x",
be16_to_cpu(((u16 *)mgid.raw)[i]));
be16_to_cpu(((__be16 *) mgid.raw)[i]));
if (i < sizeof mgid / 2 - 1)
gid_buf[n++] = ':';
}
......
......@@ -609,8 +609,8 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x "
IPOIB_GID_FMT "\n",
skb->dst ? "neigh" : "dst",
be16_to_cpup((u16 *) skb->data),
be32_to_cpup((u32 *) phdr->hwaddr),
be16_to_cpup((__be16 *) skb->data),
be32_to_cpup((__be32 *) phdr->hwaddr),
IPOIB_GID_ARG(*(union ib_gid *) (phdr->hwaddr + 4)));
dev_kfree_skb_any(skb);
++priv->stats.tx_dropped;
......
......@@ -359,7 +359,7 @@ static int ipoib_mcast_sendonly_join(struct ipoib_mcast *mcast)
rec.mgid = mcast->mcmember.mgid;
rec.port_gid = priv->local_gid;
rec.pkey = be16_to_cpu(priv->pkey);
rec.pkey = cpu_to_be16(priv->pkey);
ret = ib_sa_mcmember_rec_set(priv->ca, priv->port, &rec,
IB_SA_MCMEMBER_REC_MGID |
......@@ -459,7 +459,7 @@ static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast,
rec.mgid = mcast->mcmember.mgid;
rec.port_gid = priv->local_gid;
rec.pkey = be16_to_cpu(priv->pkey);
rec.pkey = cpu_to_be16(priv->pkey);
comp_mask =
IB_SA_MCMEMBER_REC_MGID |
......@@ -648,7 +648,7 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
rec.mgid = mcast->mcmember.mgid;
rec.port_gid = priv->local_gid;
rec.pkey = be16_to_cpu(priv->pkey);
rec.pkey = cpu_to_be16(priv->pkey);
/* Remove ourselves from the multicast group */
ret = ipoib_mcast_detach(dev, be16_to_cpu(mcast->mcmember.mlid),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment