Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] IB: sparse endianness cleanup

Fix sparse warnings. Use __be* where appropriate.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by

Sean Hefty and committed by
Roland Dreier
97f52eb4 92a6b34b

+565 -562
+62 -59
drivers/infiniband/core/cm.c
··· 83 83 struct cm_device { 84 84 struct list_head list; 85 85 struct ib_device *device; 86 - u64 ca_guid; 86 + __be64 ca_guid; 87 87 struct cm_port port[0]; 88 88 }; 89 89 ··· 100 100 struct list_head list; 101 101 struct cm_port *port; 102 102 struct ib_mad_recv_wc *mad_recv_wc; /* Received MADs */ 103 - u32 local_id; /* Established / timewait */ 104 - u32 remote_id; 103 + __be32 local_id; /* Established / timewait */ 104 + __be32 remote_id; 105 105 struct ib_cm_event cm_event; 106 106 struct ib_sa_path_rec path[0]; 107 107 }; ··· 110 110 struct cm_work work; /* Must be first. */ 111 111 struct rb_node remote_qp_node; 112 112 struct rb_node remote_id_node; 113 - u64 remote_ca_guid; 114 - u32 remote_qpn; 113 + __be64 remote_ca_guid; 114 + __be32 remote_qpn; 115 115 u8 inserted_remote_qp; 116 116 u8 inserted_remote_id; 117 117 }; ··· 132 132 struct cm_av alt_av; 133 133 134 134 void *private_data; 135 - u64 tid; 136 - u32 local_qpn; 137 - u32 remote_qpn; 138 - u32 sq_psn; 139 - u32 rq_psn; 135 + __be64 tid; 136 + __be32 local_qpn; 137 + __be32 remote_qpn; 138 + __be32 sq_psn; 139 + __be32 rq_psn; 140 140 int timeout_ms; 141 141 enum ib_mtu path_mtu; 142 142 u8 private_data_len; ··· 253 253 u16 dlid, u8 sl, u16 src_path_bits) 254 254 { 255 255 memset(ah_attr, 0, sizeof ah_attr); 256 - ah_attr->dlid = be16_to_cpu(dlid); 256 + ah_attr->dlid = dlid; 257 257 ah_attr->sl = sl; 258 258 ah_attr->src_path_bits = src_path_bits; 259 259 ah_attr->port_num = port_num; ··· 264 264 { 265 265 av->port = port; 266 266 av->pkey_index = wc->pkey_index; 267 - cm_set_ah_attr(&av->ah_attr, port->port_num, cpu_to_be16(wc->slid), 267 + cm_set_ah_attr(&av->ah_attr, port->port_num, wc->slid, 268 268 wc->sl, wc->dlid_path_bits); 269 269 } 270 270 ··· 295 295 return ret; 296 296 297 297 av->port = port; 298 - cm_set_ah_attr(&av->ah_attr, av->port->port_num, path->dlid, 299 - path->sl, path->slid & 0x7F); 298 + cm_set_ah_attr(&av->ah_attr, av->port->port_num, 299 + be16_to_cpu(path->dlid), path->sl, 300 + be16_to_cpu(path->slid) & 0x7F); 300 301 av->packet_life_time = path->packet_life_time; 301 302 return 0; 302 303 } ··· 310 309 do { 311 310 spin_lock_irqsave(&cm.lock, flags); 312 311 ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, 1, 313 - (int *) &cm_id_priv->id.local_id); 312 + (__force int *) &cm_id_priv->id.local_id); 314 313 spin_unlock_irqrestore(&cm.lock, flags); 315 314 } while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) ); 316 315 return ret; 317 316 } 318 317 319 - static void cm_free_id(u32 local_id) 318 + static void cm_free_id(__be32 local_id) 320 319 { 321 320 unsigned long flags; 322 321 323 322 spin_lock_irqsave(&cm.lock, flags); 324 - idr_remove(&cm.local_id_table, (int) local_id); 323 + idr_remove(&cm.local_id_table, (__force int) local_id); 325 324 spin_unlock_irqrestore(&cm.lock, flags); 326 325 } 327 326 328 - static struct cm_id_private * cm_get_id(u32 local_id, u32 remote_id) 327 + static struct cm_id_private * cm_get_id(__be32 local_id, __be32 remote_id) 329 328 { 330 329 struct cm_id_private *cm_id_priv; 331 330 332 - cm_id_priv = idr_find(&cm.local_id_table, (int) local_id); 331 + cm_id_priv = idr_find(&cm.local_id_table, (__force int) local_id); 333 332 if (cm_id_priv) { 334 333 if (cm_id_priv->id.remote_id == remote_id) 335 334 atomic_inc(&cm_id_priv->refcount); ··· 340 339 return cm_id_priv; 341 340 } 342 341 343 - static struct cm_id_private * cm_acquire_id(u32 local_id, u32 remote_id) 342 + static struct cm_id_private * cm_acquire_id(__be32 local_id, __be32 remote_id) 344 343 { 345 344 struct cm_id_private *cm_id_priv; 346 345 unsigned long flags; ··· 357 356 struct rb_node **link = &cm.listen_service_table.rb_node; 358 357 struct rb_node *parent = NULL; 359 358 struct cm_id_private *cur_cm_id_priv; 360 - u64 service_id = cm_id_priv->id.service_id; 361 - u64 service_mask = cm_id_priv->id.service_mask; 359 + __be64 service_id = cm_id_priv->id.service_id; 360 + __be64 service_mask = cm_id_priv->id.service_mask; 362 361 363 362 while (*link) { 364 363 parent = *link; ··· 377 376 return NULL; 378 377 } 379 378 380 - static struct cm_id_private * cm_find_listen(u64 service_id) 379 + static struct cm_id_private * cm_find_listen(__be64 service_id) 381 380 { 382 381 struct rb_node *node = cm.listen_service_table.rb_node; 383 382 struct cm_id_private *cm_id_priv; ··· 401 400 struct rb_node **link = &cm.remote_id_table.rb_node; 402 401 struct rb_node *parent = NULL; 403 402 struct cm_timewait_info *cur_timewait_info; 404 - u64 remote_ca_guid = timewait_info->remote_ca_guid; 405 - u32 remote_id = timewait_info->work.remote_id; 403 + __be64 remote_ca_guid = timewait_info->remote_ca_guid; 404 + __be32 remote_id = timewait_info->work.remote_id; 406 405 407 406 while (*link) { 408 407 parent = *link; ··· 425 424 return NULL; 426 425 } 427 426 428 - static struct cm_timewait_info * cm_find_remote_id(u64 remote_ca_guid, 429 - u32 remote_id) 427 + static struct cm_timewait_info * cm_find_remote_id(__be64 remote_ca_guid, 428 + __be32 remote_id) 430 429 { 431 430 struct rb_node *node = cm.remote_id_table.rb_node; 432 431 struct cm_timewait_info *timewait_info; ··· 454 453 struct rb_node **link = &cm.remote_qp_table.rb_node; 455 454 struct rb_node *parent = NULL; 456 455 struct cm_timewait_info *cur_timewait_info; 457 - u64 remote_ca_guid = timewait_info->remote_ca_guid; 458 - u32 remote_qpn = timewait_info->remote_qpn; 456 + __be64 remote_ca_guid = timewait_info->remote_ca_guid; 457 + __be32 remote_qpn = timewait_info->remote_qpn; 459 458 460 459 while (*link) { 461 460 parent = *link; ··· 485 484 struct rb_node *parent = NULL; 486 485 struct cm_id_private *cur_cm_id_priv; 487 486 union ib_gid *port_gid = &cm_id_priv->av.dgid; 488 - u32 remote_id = cm_id_priv->id.remote_id; 487 + __be32 remote_id = cm_id_priv->id.remote_id; 489 488 490 489 while (*link) { 491 490 parent = *link; ··· 599 598 spin_unlock_irqrestore(&cm.lock, flags); 600 599 } 601 600 602 - static struct cm_timewait_info * cm_create_timewait_info(u32 local_id) 601 + static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id) 603 602 { 604 603 struct cm_timewait_info *timewait_info; 605 604 ··· 716 715 EXPORT_SYMBOL(ib_destroy_cm_id); 717 716 718 717 int ib_cm_listen(struct ib_cm_id *cm_id, 719 - u64 service_id, 720 - u64 service_mask) 718 + __be64 service_id, 719 + __be64 service_mask) 721 720 { 722 721 struct cm_id_private *cm_id_priv, *cur_cm_id_priv; 723 722 unsigned long flags; 724 723 int ret = 0; 725 724 726 - service_mask = service_mask ? service_mask : ~0ULL; 725 + service_mask = service_mask ? service_mask : 726 + __constant_cpu_to_be64(~0ULL); 727 727 service_id &= service_mask; 728 728 if ((service_id & IB_SERVICE_ID_AGN_MASK) == IB_CM_ASSIGN_SERVICE_ID && 729 729 (service_id != IB_CM_ASSIGN_SERVICE_ID)) ··· 737 735 738 736 spin_lock_irqsave(&cm.lock, flags); 739 737 if (service_id == IB_CM_ASSIGN_SERVICE_ID) { 740 - cm_id->service_id = __cpu_to_be64(cm.listen_service_id++); 741 - cm_id->service_mask = ~0ULL; 738 + cm_id->service_id = cpu_to_be64(cm.listen_service_id++); 739 + cm_id->service_mask = __constant_cpu_to_be64(~0ULL); 742 740 } else { 743 741 cm_id->service_id = service_id; 744 742 cm_id->service_mask = service_mask; ··· 754 752 } 755 753 EXPORT_SYMBOL(ib_cm_listen); 756 754 757 - static u64 cm_form_tid(struct cm_id_private *cm_id_priv, 758 - enum cm_msg_sequence msg_seq) 755 + static __be64 cm_form_tid(struct cm_id_private *cm_id_priv, 756 + enum cm_msg_sequence msg_seq) 759 757 { 760 758 u64 hi_tid, low_tid; 761 759 762 760 hi_tid = ((u64) cm_id_priv->av.port->mad_agent->hi_tid) << 32; 763 - low_tid = (u64) (cm_id_priv->id.local_id | (msg_seq << 30)); 761 + low_tid = (u64) ((__force u32)cm_id_priv->id.local_id | 762 + (msg_seq << 30)); 764 763 return cpu_to_be64(hi_tid | low_tid); 765 764 } 766 765 767 766 static void cm_format_mad_hdr(struct ib_mad_hdr *hdr, 768 - enum cm_msg_attr_id attr_id, u64 tid) 767 + __be16 attr_id, __be64 tid) 769 768 { 770 769 hdr->base_version = IB_MGMT_BASE_VERSION; 771 770 hdr->mgmt_class = IB_MGMT_CLASS_CM; ··· 899 896 goto error1; 900 897 } 901 898 cm_id->service_id = param->service_id; 902 - cm_id->service_mask = ~0ULL; 899 + cm_id->service_mask = __constant_cpu_to_be64(~0ULL); 903 900 cm_id_priv->timeout_ms = cm_convert_to_ms( 904 901 param->primary_path->packet_life_time) * 2 + 905 902 cm_convert_to_ms( ··· 966 963 rej_msg->remote_comm_id = rcv_msg->local_comm_id; 967 964 rej_msg->local_comm_id = rcv_msg->remote_comm_id; 968 965 cm_rej_set_msg_rejected(rej_msg, msg_rejected); 969 - rej_msg->reason = reason; 966 + rej_msg->reason = cpu_to_be16(reason); 970 967 971 968 if (ari && ari_length) { 972 969 cm_rej_set_reject_info_len(rej_msg, ari_length); ··· 980 977 return ret; 981 978 } 982 979 983 - static inline int cm_is_active_peer(u64 local_ca_guid, u64 remote_ca_guid, 984 - u32 local_qpn, u32 remote_qpn) 980 + static inline int cm_is_active_peer(__be64 local_ca_guid, __be64 remote_ca_guid, 981 + __be32 local_qpn, __be32 remote_qpn) 985 982 { 986 983 return (be64_to_cpu(local_ca_guid) > be64_to_cpu(remote_ca_guid) || 987 984 ((local_ca_guid == remote_ca_guid) && ··· 1140 1137 break; 1141 1138 } 1142 1139 1143 - rej_msg->reason = reason; 1140 + rej_msg->reason = cpu_to_be16(reason); 1144 1141 if (ari && ari_length) { 1145 1142 cm_rej_set_reject_info_len(rej_msg, ari_length); 1146 1143 memcpy(rej_msg->ari, ari, ari_length); ··· 1279 1276 cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler; 1280 1277 cm_id_priv->id.context = listen_cm_id_priv->id.context; 1281 1278 cm_id_priv->id.service_id = req_msg->service_id; 1282 - cm_id_priv->id.service_mask = ~0ULL; 1279 + cm_id_priv->id.service_mask = __constant_cpu_to_be64(~0ULL); 1283 1280 1284 1281 cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]); 1285 1282 ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av); ··· 1972 1969 param = &work->cm_event.param.rej_rcvd; 1973 1970 param->ari = rej_msg->ari; 1974 1971 param->ari_length = cm_rej_get_reject_info_len(rej_msg); 1975 - param->reason = rej_msg->reason; 1972 + param->reason = __be16_to_cpu(rej_msg->reason); 1976 1973 work->cm_event.private_data = &rej_msg->private_data; 1977 1974 } 1978 1975 ··· 1981 1978 struct cm_timewait_info *timewait_info; 1982 1979 struct cm_id_private *cm_id_priv; 1983 1980 unsigned long flags; 1984 - u32 remote_id; 1981 + __be32 remote_id; 1985 1982 1986 1983 remote_id = rej_msg->local_comm_id; 1987 1984 1988 - if (rej_msg->reason == IB_CM_REJ_TIMEOUT) { 1985 + if (__be16_to_cpu(rej_msg->reason) == IB_CM_REJ_TIMEOUT) { 1989 1986 spin_lock_irqsave(&cm.lock, flags); 1990 - timewait_info = cm_find_remote_id( *((u64 *) rej_msg->ari), 1987 + timewait_info = cm_find_remote_id( *((__be64 *) rej_msg->ari), 1991 1988 remote_id); 1992 1989 if (!timewait_info) { 1993 1990 spin_unlock_irqrestore(&cm.lock, flags); 1994 1991 return NULL; 1995 1992 } 1996 1993 cm_id_priv = idr_find(&cm.local_id_table, 1997 - (int) timewait_info->work.local_id); 1994 + (__force int) timewait_info->work.local_id); 1998 1995 if (cm_id_priv) { 1999 1996 if (cm_id_priv->id.remote_id == remote_id) 2000 1997 atomic_inc(&cm_id_priv->refcount); ··· 2035 2032 /* fall through */ 2036 2033 case IB_CM_REQ_RCVD: 2037 2034 case IB_CM_MRA_REQ_SENT: 2038 - if (rej_msg->reason == IB_CM_REJ_STALE_CONN) 2035 + if (__be16_to_cpu(rej_msg->reason) == IB_CM_REJ_STALE_CONN) 2039 2036 cm_enter_timewait(cm_id_priv); 2040 2037 else 2041 2038 cm_reset_to_idle(cm_id_priv); ··· 2556 2553 cm_format_mad_hdr(&sidr_req_msg->hdr, CM_SIDR_REQ_ATTR_ID, 2557 2554 cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_SIDR)); 2558 2555 sidr_req_msg->request_id = cm_id_priv->id.local_id; 2559 - sidr_req_msg->pkey = param->pkey; 2556 + sidr_req_msg->pkey = cpu_to_be16(param->pkey); 2560 2557 sidr_req_msg->service_id = param->service_id; 2561 2558 2562 2559 if (param->private_data && param->private_data_len) ··· 2583 2580 goto out; 2584 2581 2585 2582 cm_id->service_id = param->service_id; 2586 - cm_id->service_mask = ~0ULL; 2583 + cm_id->service_mask = __constant_cpu_to_be64(~0ULL); 2587 2584 cm_id_priv->timeout_ms = param->timeout_ms; 2588 2585 cm_id_priv->max_cm_retries = param->max_cm_retries; 2589 2586 ret = cm_alloc_msg(cm_id_priv, &msg); ··· 2624 2621 sidr_req_msg = (struct cm_sidr_req_msg *) 2625 2622 work->mad_recv_wc->recv_buf.mad; 2626 2623 param = &work->cm_event.param.sidr_req_rcvd; 2627 - param->pkey = sidr_req_msg->pkey; 2624 + param->pkey = __be16_to_cpu(sidr_req_msg->pkey); 2628 2625 param->listen_id = listen_id; 2629 2626 param->device = work->port->mad_agent->device; 2630 2627 param->port = work->port->port_num; ··· 2648 2645 sidr_req_msg = (struct cm_sidr_req_msg *) 2649 2646 work->mad_recv_wc->recv_buf.mad; 2650 2647 wc = work->mad_recv_wc->wc; 2651 - cm_id_priv->av.dgid.global.subnet_prefix = wc->slid; 2648 + cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid); 2652 2649 cm_id_priv->av.dgid.global.interface_id = 0; 2653 2650 cm_init_av_for_response(work->port, work->mad_recv_wc->wc, 2654 2651 &cm_id_priv->av); ··· 2676 2673 cm_id_priv->id.cm_handler = cur_cm_id_priv->id.cm_handler; 2677 2674 cm_id_priv->id.context = cur_cm_id_priv->id.context; 2678 2675 cm_id_priv->id.service_id = sidr_req_msg->service_id; 2679 - cm_id_priv->id.service_mask = ~0ULL; 2676 + cm_id_priv->id.service_mask = __constant_cpu_to_be64(~0ULL); 2680 2677 2681 2678 cm_format_sidr_req_event(work, &cur_cm_id_priv->id); 2682 2679 cm_process_work(cm_id_priv, work); ··· 3178 3175 } 3179 3176 EXPORT_SYMBOL(ib_cm_init_qp_attr); 3180 3177 3181 - static u64 cm_get_ca_guid(struct ib_device *device) 3178 + static __be64 cm_get_ca_guid(struct ib_device *device) 3182 3179 { 3183 3180 struct ib_device_attr *device_attr; 3184 - u64 guid; 3181 + __be64 guid; 3185 3182 int ret; 3186 3183 3187 3184 device_attr = kmalloc(sizeof *device_attr, GFP_KERNEL);
+95 -97
drivers/infiniband/core/cm_msgs.h
··· 43 43 44 44 #define IB_CM_CLASS_VERSION 2 /* IB specification 1.2 */ 45 45 46 - enum cm_msg_attr_id { 47 - CM_REQ_ATTR_ID = __constant_htons(0x0010), 48 - CM_MRA_ATTR_ID = __constant_htons(0x0011), 49 - CM_REJ_ATTR_ID = __constant_htons(0x0012), 50 - CM_REP_ATTR_ID = __constant_htons(0x0013), 51 - CM_RTU_ATTR_ID = __constant_htons(0x0014), 52 - CM_DREQ_ATTR_ID = __constant_htons(0x0015), 53 - CM_DREP_ATTR_ID = __constant_htons(0x0016), 54 - CM_SIDR_REQ_ATTR_ID = __constant_htons(0x0017), 55 - CM_SIDR_REP_ATTR_ID = __constant_htons(0x0018), 56 - CM_LAP_ATTR_ID = __constant_htons(0x0019), 57 - CM_APR_ATTR_ID = __constant_htons(0x001A) 58 - }; 46 + #define CM_REQ_ATTR_ID __constant_htons(0x0010) 47 + #define CM_MRA_ATTR_ID __constant_htons(0x0011) 48 + #define CM_REJ_ATTR_ID __constant_htons(0x0012) 49 + #define CM_REP_ATTR_ID __constant_htons(0x0013) 50 + #define CM_RTU_ATTR_ID __constant_htons(0x0014) 51 + #define CM_DREQ_ATTR_ID __constant_htons(0x0015) 52 + #define CM_DREP_ATTR_ID __constant_htons(0x0016) 53 + #define CM_SIDR_REQ_ATTR_ID __constant_htons(0x0017) 54 + #define CM_SIDR_REP_ATTR_ID __constant_htons(0x0018) 55 + #define CM_LAP_ATTR_ID __constant_htons(0x0019) 56 + #define CM_APR_ATTR_ID __constant_htons(0x001A) 59 57 60 58 enum cm_msg_sequence { 61 59 CM_MSG_SEQUENCE_REQ, ··· 65 67 struct cm_req_msg { 66 68 struct ib_mad_hdr hdr; 67 69 68 - u32 local_comm_id; 69 - u32 rsvd4; 70 - u64 service_id; 71 - u64 local_ca_guid; 72 - u32 rsvd24; 73 - u32 local_qkey; 70 + __be32 local_comm_id; 71 + __be32 rsvd4; 72 + __be64 service_id; 73 + __be64 local_ca_guid; 74 + __be32 rsvd24; 75 + __be32 local_qkey; 74 76 /* local QPN:24, responder resources:8 */ 75 - u32 offset32; 77 + __be32 offset32; 76 78 /* local EECN:24, initiator depth:8 */ 77 - u32 offset36; 79 + __be32 offset36; 78 80 /* 79 81 * remote EECN:24, remote CM response timeout:5, 80 82 * transport service type:2, end-to-end flow control:1 81 83 */ 82 - u32 offset40; 84 + __be32 offset40; 83 85 /* starting PSN:24, local CM response timeout:5, retry count:3 */ 84 - u32 offset44; 85 - u16 pkey; 86 + __be32 offset44; 87 + __be16 pkey; 86 88 /* path MTU:4, RDC exists:1, RNR retry count:3. */ 87 89 u8 offset50; 88 90 /* max CM Retries:4, SRQ:1, rsvd:3 */ 89 91 u8 offset51; 90 92 91 - u16 primary_local_lid; 92 - u16 primary_remote_lid; 93 + __be16 primary_local_lid; 94 + __be16 primary_remote_lid; 93 95 union ib_gid primary_local_gid; 94 96 union ib_gid primary_remote_gid; 95 97 /* flow label:20, rsvd:6, packet rate:6 */ 96 - u32 primary_offset88; 98 + __be32 primary_offset88; 97 99 u8 primary_traffic_class; 98 100 u8 primary_hop_limit; 99 101 /* SL:4, subnet local:1, rsvd:3 */ ··· 101 103 /* local ACK timeout:5, rsvd:3 */ 102 104 u8 primary_offset95; 103 105 104 - u16 alt_local_lid; 105 - u16 alt_remote_lid; 106 + __be16 alt_local_lid; 107 + __be16 alt_remote_lid; 106 108 union ib_gid alt_local_gid; 107 109 union ib_gid alt_remote_gid; 108 110 /* flow label:20, rsvd:6, packet rate:6 */ 109 - u32 alt_offset132; 111 + __be32 alt_offset132; 110 112 u8 alt_traffic_class; 111 113 u8 alt_hop_limit; 112 114 /* SL:4, subnet local:1, rsvd:3 */ ··· 118 120 119 121 } __attribute__ ((packed)); 120 122 121 - static inline u32 cm_req_get_local_qpn(struct cm_req_msg *req_msg) 123 + static inline __be32 cm_req_get_local_qpn(struct cm_req_msg *req_msg) 122 124 { 123 125 return cpu_to_be32(be32_to_cpu(req_msg->offset32) >> 8); 124 126 } 125 127 126 - static inline void cm_req_set_local_qpn(struct cm_req_msg *req_msg, u32 qpn) 128 + static inline void cm_req_set_local_qpn(struct cm_req_msg *req_msg, __be32 qpn) 127 129 { 128 130 req_msg->offset32 = cpu_to_be32((be32_to_cpu(qpn) << 8) | 129 131 (be32_to_cpu(req_msg->offset32) & ··· 206 208 0xFFFFFFFE)); 207 209 } 208 210 209 - static inline u32 cm_req_get_starting_psn(struct cm_req_msg *req_msg) 211 + static inline __be32 cm_req_get_starting_psn(struct cm_req_msg *req_msg) 210 212 { 211 213 return cpu_to_be32(be32_to_cpu(req_msg->offset44) >> 8); 212 214 } 213 215 214 216 static inline void cm_req_set_starting_psn(struct cm_req_msg *req_msg, 215 - u32 starting_psn) 217 + __be32 starting_psn) 216 218 { 217 219 req_msg->offset44 = cpu_to_be32((be32_to_cpu(starting_psn) << 8) | 218 220 (be32_to_cpu(req_msg->offset44) & 0x000000FF)); ··· 286 288 ((srq & 0x1) << 3)); 287 289 } 288 290 289 - static inline u32 cm_req_get_primary_flow_label(struct cm_req_msg *req_msg) 291 + static inline __be32 cm_req_get_primary_flow_label(struct cm_req_msg *req_msg) 290 292 { 291 - return cpu_to_be32((be32_to_cpu(req_msg->primary_offset88) >> 12)); 293 + return cpu_to_be32(be32_to_cpu(req_msg->primary_offset88) >> 12); 292 294 } 293 295 294 296 static inline void cm_req_set_primary_flow_label(struct cm_req_msg *req_msg, 295 - u32 flow_label) 297 + __be32 flow_label) 296 298 { 297 299 req_msg->primary_offset88 = cpu_to_be32( 298 300 (be32_to_cpu(req_msg->primary_offset88) & ··· 348 350 (local_ack_timeout << 3)); 349 351 } 350 352 351 - static inline u32 cm_req_get_alt_flow_label(struct cm_req_msg *req_msg) 353 + static inline __be32 cm_req_get_alt_flow_label(struct cm_req_msg *req_msg) 352 354 { 353 - return cpu_to_be32((be32_to_cpu(req_msg->alt_offset132) >> 12)); 355 + return cpu_to_be32(be32_to_cpu(req_msg->alt_offset132) >> 12); 354 356 } 355 357 356 358 static inline void cm_req_set_alt_flow_label(struct cm_req_msg *req_msg, 357 - u32 flow_label) 359 + __be32 flow_label) 358 360 { 359 361 req_msg->alt_offset132 = cpu_to_be32( 360 362 (be32_to_cpu(req_msg->alt_offset132) & ··· 420 422 struct cm_mra_msg { 421 423 struct ib_mad_hdr hdr; 422 424 423 - u32 local_comm_id; 424 - u32 remote_comm_id; 425 + __be32 local_comm_id; 426 + __be32 remote_comm_id; 425 427 /* message MRAed:2, rsvd:6 */ 426 428 u8 offset8; 427 429 /* service timeout:5, rsvd:3 */ ··· 456 458 struct cm_rej_msg { 457 459 struct ib_mad_hdr hdr; 458 460 459 - u32 local_comm_id; 460 - u32 remote_comm_id; 461 + __be32 local_comm_id; 462 + __be32 remote_comm_id; 461 463 /* message REJected:2, rsvd:6 */ 462 464 u8 offset8; 463 465 /* reject info length:7, rsvd:1. */ 464 466 u8 offset9; 465 - u16 reason; 467 + __be16 reason; 466 468 u8 ari[IB_CM_REJ_ARI_LENGTH]; 467 469 468 470 u8 private_data[IB_CM_REJ_PRIVATE_DATA_SIZE]; ··· 493 495 struct cm_rep_msg { 494 496 struct ib_mad_hdr hdr; 495 497 496 - u32 local_comm_id; 497 - u32 remote_comm_id; 498 - u32 local_qkey; 498 + __be32 local_comm_id; 499 + __be32 remote_comm_id; 500 + __be32 local_qkey; 499 501 /* local QPN:24, rsvd:8 */ 500 - u32 offset12; 502 + __be32 offset12; 501 503 /* local EECN:24, rsvd:8 */ 502 - u32 offset16; 504 + __be32 offset16; 503 505 /* starting PSN:24 rsvd:8 */ 504 - u32 offset20; 506 + __be32 offset20; 505 507 u8 resp_resources; 506 508 u8 initiator_depth; 507 509 /* target ACK delay:5, failover accepted:2, end-to-end flow control:1 */ 508 510 u8 offset26; 509 511 /* RNR retry count:3, SRQ:1, rsvd:5 */ 510 512 u8 offset27; 511 - u64 local_ca_guid; 513 + __be64 local_ca_guid; 512 514 513 515 u8 private_data[IB_CM_REP_PRIVATE_DATA_SIZE]; 514 516 515 517 } __attribute__ ((packed)); 516 518 517 - static inline u32 cm_rep_get_local_qpn(struct cm_rep_msg *rep_msg) 519 + static inline __be32 cm_rep_get_local_qpn(struct cm_rep_msg *rep_msg) 518 520 { 519 521 return cpu_to_be32(be32_to_cpu(rep_msg->offset12) >> 8); 520 522 } 521 523 522 - static inline void cm_rep_set_local_qpn(struct cm_rep_msg *rep_msg, u32 qpn) 524 + static inline void cm_rep_set_local_qpn(struct cm_rep_msg *rep_msg, __be32 qpn) 523 525 { 524 526 rep_msg->offset12 = cpu_to_be32((be32_to_cpu(qpn) << 8) | 525 527 (be32_to_cpu(rep_msg->offset12) & 0x000000FF)); 526 528 } 527 529 528 - static inline u32 cm_rep_get_starting_psn(struct cm_rep_msg *rep_msg) 530 + static inline __be32 cm_rep_get_starting_psn(struct cm_rep_msg *rep_msg) 529 531 { 530 532 return cpu_to_be32(be32_to_cpu(rep_msg->offset20) >> 8); 531 533 } 532 534 533 535 static inline void cm_rep_set_starting_psn(struct cm_rep_msg *rep_msg, 534 - u32 starting_psn) 536 + __be32 starting_psn) 535 537 { 536 538 rep_msg->offset20 = cpu_to_be32((be32_to_cpu(starting_psn) << 8) | 537 539 (be32_to_cpu(rep_msg->offset20) & 0x000000FF)); ··· 598 600 struct cm_rtu_msg { 599 601 struct ib_mad_hdr hdr; 600 602 601 - u32 local_comm_id; 602 - u32 remote_comm_id; 603 + __be32 local_comm_id; 604 + __be32 remote_comm_id; 603 605 604 606 u8 private_data[IB_CM_RTU_PRIVATE_DATA_SIZE]; 605 607 ··· 608 610 struct cm_dreq_msg { 609 611 struct ib_mad_hdr hdr; 610 612 611 - u32 local_comm_id; 612 - u32 remote_comm_id; 613 + __be32 local_comm_id; 614 + __be32 remote_comm_id; 613 615 /* remote QPN/EECN:24, rsvd:8 */ 614 - u32 offset8; 616 + __be32 offset8; 615 617 616 618 u8 private_data[IB_CM_DREQ_PRIVATE_DATA_SIZE]; 617 619 618 620 } __attribute__ ((packed)); 619 621 620 - static inline u32 cm_dreq_get_remote_qpn(struct cm_dreq_msg *dreq_msg) 622 + static inline __be32 cm_dreq_get_remote_qpn(struct cm_dreq_msg *dreq_msg) 621 623 { 622 624 return cpu_to_be32(be32_to_cpu(dreq_msg->offset8) >> 8); 623 625 } 624 626 625 - static inline void cm_dreq_set_remote_qpn(struct cm_dreq_msg *dreq_msg, u32 qpn) 627 + static inline void cm_dreq_set_remote_qpn(struct cm_dreq_msg *dreq_msg, __be32 qpn) 626 628 { 627 629 dreq_msg->offset8 = cpu_to_be32((be32_to_cpu(qpn) << 8) | 628 630 (be32_to_cpu(dreq_msg->offset8) & 0x000000FF)); ··· 631 633 struct cm_drep_msg { 632 634 struct ib_mad_hdr hdr; 633 635 634 - u32 local_comm_id; 635 - u32 remote_comm_id; 636 + __be32 local_comm_id; 637 + __be32 remote_comm_id; 636 638 637 639 u8 private_data[IB_CM_DREP_PRIVATE_DATA_SIZE]; 638 640 ··· 641 643 struct cm_lap_msg { 642 644 struct ib_mad_hdr hdr; 643 645 644 - u32 local_comm_id; 645 - u32 remote_comm_id; 646 + __be32 local_comm_id; 647 + __be32 remote_comm_id; 646 648 647 - u32 rsvd8; 649 + __be32 rsvd8; 648 650 /* remote QPN/EECN:24, remote CM response timeout:5, rsvd:3 */ 649 - u32 offset12; 650 - u32 rsvd16; 651 + __be32 offset12; 652 + __be32 rsvd16; 651 653 652 - u16 alt_local_lid; 653 - u16 alt_remote_lid; 654 + __be16 alt_local_lid; 655 + __be16 alt_remote_lid; 654 656 union ib_gid alt_local_gid; 655 657 union ib_gid alt_remote_gid; 656 658 /* flow label:20, rsvd:4, traffic class:8 */ 657 - u32 offset56; 659 + __be32 offset56; 658 660 u8 alt_hop_limit; 659 661 /* rsvd:2, packet rate:6 */ 660 - uint8_t offset61; 662 + u8 offset61; 661 663 /* SL:4, subnet local:1, rsvd:3 */ 662 - uint8_t offset62; 664 + u8 offset62; 663 665 /* local ACK timeout:5, rsvd:3 */ 664 - uint8_t offset63; 666 + u8 offset63; 665 667 666 668 u8 private_data[IB_CM_LAP_PRIVATE_DATA_SIZE]; 667 669 } __attribute__ ((packed)); 668 670 669 - static inline u32 cm_lap_get_remote_qpn(struct cm_lap_msg *lap_msg) 671 + static inline __be32 cm_lap_get_remote_qpn(struct cm_lap_msg *lap_msg) 670 672 { 671 673 return cpu_to_be32(be32_to_cpu(lap_msg->offset12) >> 8); 672 674 } 673 675 674 - static inline void cm_lap_set_remote_qpn(struct cm_lap_msg *lap_msg, u32 qpn) 676 + static inline void cm_lap_set_remote_qpn(struct cm_lap_msg *lap_msg, __be32 qpn) 675 677 { 676 678 lap_msg->offset12 = cpu_to_be32((be32_to_cpu(qpn) << 8) | 677 679 (be32_to_cpu(lap_msg->offset12) & ··· 691 693 0xFFFFFF07)); 692 694 } 693 695 694 - static inline u32 cm_lap_get_flow_label(struct cm_lap_msg *lap_msg) 696 + static inline __be32 cm_lap_get_flow_label(struct cm_lap_msg *lap_msg) 695 697 { 696 - return be32_to_cpu(lap_msg->offset56) >> 12; 698 + return cpu_to_be32(be32_to_cpu(lap_msg->offset56) >> 12); 697 699 } 698 700 699 701 static inline void cm_lap_set_flow_label(struct cm_lap_msg *lap_msg, 700 - u32 flow_label) 702 + __be32 flow_label) 701 703 { 702 - lap_msg->offset56 = cpu_to_be32((flow_label << 12) | 703 - (be32_to_cpu(lap_msg->offset56) & 704 - 0x00000FFF)); 704 + lap_msg->offset56 = cpu_to_be32( 705 + (be32_to_cpu(lap_msg->offset56) & 0x00000FFF) | 706 + (be32_to_cpu(flow_label) << 12)); 705 707 } 706 708 707 709 static inline u8 cm_lap_get_traffic_class(struct cm_lap_msg *lap_msg) ··· 764 766 struct cm_apr_msg { 765 767 struct ib_mad_hdr hdr; 766 768 767 - u32 local_comm_id; 768 - u32 remote_comm_id; 769 + __be32 local_comm_id; 770 + __be32 remote_comm_id; 769 771 770 772 u8 info_length; 771 773 u8 ap_status; ··· 777 779 struct cm_sidr_req_msg { 778 780 struct ib_mad_hdr hdr; 779 781 780 - u32 request_id; 781 - u16 pkey; 782 - u16 rsvd; 783 - u64 service_id; 782 + __be32 request_id; 783 + __be16 pkey; 784 + __be16 rsvd; 785 + __be64 service_id; 784 786 785 787 u8 private_data[IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE]; 786 788 } __attribute__ ((packed)); ··· 788 790 struct cm_sidr_rep_msg { 789 791 struct ib_mad_hdr hdr; 790 792 791 - u32 request_id; 793 + __be32 request_id; 792 794 u8 status; 793 795 u8 info_length; 794 - u16 rsvd; 796 + __be16 rsvd; 795 797 /* QPN:24, rsvd:8 */ 796 - u32 offset8; 797 - u64 service_id; 798 - u32 qkey; 798 + __be32 offset8; 799 + __be64 service_id; 800 + __be32 qkey; 799 801 u8 info[IB_CM_SIDR_REP_INFO_LENGTH]; 800 802 801 803 u8 private_data[IB_CM_SIDR_REP_PRIVATE_DATA_SIZE]; 802 804 } __attribute__ ((packed)); 803 805 804 - static inline u32 cm_sidr_rep_get_qpn(struct cm_sidr_rep_msg *sidr_rep_msg) 806 + static inline __be32 cm_sidr_rep_get_qpn(struct cm_sidr_rep_msg *sidr_rep_msg) 805 807 { 806 808 return cpu_to_be32(be32_to_cpu(sidr_rep_msg->offset8) >> 8); 807 809 } 808 810 809 811 static inline void cm_sidr_rep_set_qpn(struct cm_sidr_rep_msg *sidr_rep_msg, 810 - u32 qpn) 812 + __be32 qpn) 811 813 { 812 814 sidr_rep_msg->offset8 = cpu_to_be32((be32_to_cpu(qpn) << 8) | 813 815 (be32_to_cpu(sidr_rep_msg->offset8) &
+6 -4
drivers/infiniband/core/mad.c
··· 693 693 goto out; 694 694 } 695 695 696 - build_smp_wc(send_wr->wr_id, smp->dr_slid, send_wr->wr.ud.pkey_index, 696 + build_smp_wc(send_wr->wr_id, be16_to_cpu(smp->dr_slid), 697 + send_wr->wr.ud.pkey_index, 697 698 send_wr->wr.ud.port_num, &mad_wc); 698 699 699 700 /* No GRH for DR SMP */ ··· 1555 1554 } 1556 1555 1557 1556 struct ib_mad_send_wr_private* 1558 - ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, u64 tid) 1557 + ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, __be64 tid) 1559 1558 { 1560 1559 struct ib_mad_send_wr_private *mad_send_wr; 1561 1560 ··· 1598 1597 struct ib_mad_send_wr_private *mad_send_wr; 1599 1598 struct ib_mad_send_wc mad_send_wc; 1600 1599 unsigned long flags; 1601 - u64 tid; 1600 + __be64 tid; 1602 1601 1603 1602 INIT_LIST_HEAD(&mad_recv_wc->rmpp_list); 1604 1603 list_add(&mad_recv_wc->recv_buf.list, &mad_recv_wc->rmpp_list); ··· 2166 2165 * Defined behavior is to complete response 2167 2166 * before request 2168 2167 */ 2169 - build_smp_wc(local->wr_id, IB_LID_PERMISSIVE, 2168 + build_smp_wc(local->wr_id, 2169 + be16_to_cpu(IB_LID_PERMISSIVE), 2170 2170 0 /* pkey index */, 2171 2171 recv_mad_agent->agent.port_num, &wc); 2172 2172
+3 -3
drivers/infiniband/core/mad_priv.h
··· 121 121 struct ib_send_wr send_wr; 122 122 struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG]; 123 123 u64 wr_id; /* client WR ID */ 124 - u64 tid; 124 + __be64 tid; 125 125 unsigned long timeout; 126 126 int retries; 127 127 int retry; ··· 144 144 struct ib_send_wr send_wr; 145 145 struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG]; 146 146 u64 wr_id; /* client WR ID */ 147 - u64 tid; 147 + __be64 tid; 148 148 }; 149 149 150 150 struct ib_mad_mgmt_method_table { ··· 210 210 int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr); 211 211 212 212 struct ib_mad_send_wr_private * 213 - ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, u64 tid); 213 + ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv, __be64 tid); 214 214 215 215 void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr, 216 216 struct ib_mad_send_wc *mad_send_wc);
+1 -1
drivers/infiniband/core/mad_rmpp.c
··· 61 61 int seg_num; 62 62 int newwin; 63 63 64 - u64 tid; 64 + __be64 tid; 65 65 u32 src_qp; 66 66 u16 slid; 67 67 u8 mgmt_class;
+18 -18
drivers/infiniband/core/sysfs.c
··· 255 255 return ret; 256 256 257 257 return sprintf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", 258 - be16_to_cpu(((u16 *) gid.raw)[0]), 259 - be16_to_cpu(((u16 *) gid.raw)[1]), 260 - be16_to_cpu(((u16 *) gid.raw)[2]), 261 - be16_to_cpu(((u16 *) gid.raw)[3]), 262 - be16_to_cpu(((u16 *) gid.raw)[4]), 263 - be16_to_cpu(((u16 *) gid.raw)[5]), 264 - be16_to_cpu(((u16 *) gid.raw)[6]), 265 - be16_to_cpu(((u16 *) gid.raw)[7])); 258 + be16_to_cpu(((__be16 *) gid.raw)[0]), 259 + be16_to_cpu(((__be16 *) gid.raw)[1]), 260 + be16_to_cpu(((__be16 *) gid.raw)[2]), 261 + be16_to_cpu(((__be16 *) gid.raw)[3]), 262 + be16_to_cpu(((__be16 *) gid.raw)[4]), 263 + be16_to_cpu(((__be16 *) gid.raw)[5]), 264 + be16_to_cpu(((__be16 *) gid.raw)[6]), 265 + be16_to_cpu(((__be16 *) gid.raw)[7])); 266 266 } 267 267 268 268 static ssize_t show_port_pkey(struct ib_port *p, struct port_attribute *attr, ··· 334 334 break; 335 335 case 16: 336 336 ret = sprintf(buf, "%u\n", 337 - be16_to_cpup((u16 *)(out_mad->data + 40 + offset / 8))); 337 + be16_to_cpup((__be16 *)(out_mad->data + 40 + offset / 8))); 338 338 break; 339 339 case 32: 340 340 ret = sprintf(buf, "%u\n", 341 - be32_to_cpup((u32 *)(out_mad->data + 40 + offset / 8))); 341 + be32_to_cpup((__be32 *)(out_mad->data + 40 + offset / 8))); 342 342 break; 343 343 default: 344 344 ret = 0; ··· 600 600 return ret; 601 601 602 602 return sprintf(buf, "%04x:%04x:%04x:%04x\n", 603 - be16_to_cpu(((u16 *) &attr.sys_image_guid)[0]), 604 - be16_to_cpu(((u16 *) &attr.sys_image_guid)[1]), 605 - be16_to_cpu(((u16 *) &attr.sys_image_guid)[2]), 606 - be16_to_cpu(((u16 *) &attr.sys_image_guid)[3])); 603 + be16_to_cpu(((__be16 *) &attr.sys_image_guid)[0]), 604 + be16_to_cpu(((__be16 *) &attr.sys_image_guid)[1]), 605 + be16_to_cpu(((__be16 *) &attr.sys_image_guid)[2]), 606 + be16_to_cpu(((__be16 *) &attr.sys_image_guid)[3])); 607 607 } 608 608 609 609 static ssize_t show_node_guid(struct class_device *cdev, char *buf) ··· 617 617 return ret; 618 618 619 619 return sprintf(buf, "%04x:%04x:%04x:%04x\n", 620 - be16_to_cpu(((u16 *) &attr.node_guid)[0]), 621 - be16_to_cpu(((u16 *) &attr.node_guid)[1]), 622 - be16_to_cpu(((u16 *) &attr.node_guid)[2]), 623 - be16_to_cpu(((u16 *) &attr.node_guid)[3])); 620 + be16_to_cpu(((__be16 *) &attr.node_guid)[0]), 621 + be16_to_cpu(((__be16 *) &attr.node_guid)[1]), 622 + be16_to_cpu(((__be16 *) &attr.node_guid)[2]), 623 + be16_to_cpu(((__be16 *) &attr.node_guid)[3])); 624 624 } 625 625 626 626 static CLASS_DEVICE_ATTR(node_type, S_IRUGO, show_node_type, NULL);
+4 -4
drivers/infiniband/core/ud_header.c
··· 195 195 struct ib_ud_header *header) 196 196 { 197 197 int header_len; 198 + u16 packet_length; 198 199 199 200 memset(header, 0, sizeof *header); 200 201 ··· 210 209 header->lrh.link_version = 0; 211 210 header->lrh.link_next_header = 212 211 grh_present ? IB_LNH_IBA_GLOBAL : IB_LNH_IBA_LOCAL; 213 - header->lrh.packet_length = (IB_LRH_BYTES + 212 + packet_length = (IB_LRH_BYTES + 214 213 IB_BTH_BYTES + 215 214 IB_DETH_BYTES + 216 215 payload_bytes + ··· 219 218 220 219 header->grh_present = grh_present; 221 220 if (grh_present) { 222 - header->lrh.packet_length += IB_GRH_BYTES / 4; 223 - 221 + packet_length += IB_GRH_BYTES / 4; 224 222 header->grh.ip_version = 6; 225 223 header->grh.payload_length = 226 224 cpu_to_be16((IB_BTH_BYTES + ··· 230 230 header->grh.next_header = 0x1b; 231 231 } 232 232 233 - cpu_to_be16s(&header->lrh.packet_length); 233 + header->lrh.packet_length = cpu_to_be16(packet_length); 234 234 235 235 if (header->immediate_present) 236 236 header->bth.opcode = IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE;
+2 -2
drivers/infiniband/core/user_mad.c
··· 271 271 struct ib_send_wr *bad_wr; 272 272 struct ib_rmpp_mad *rmpp_mad; 273 273 u8 method; 274 - u64 *tid; 274 + __be64 *tid; 275 275 int ret, length, hdr_len, data_len, rmpp_hdr_size; 276 276 int rmpp_active = 0; 277 277 ··· 316 316 if (packet->mad.hdr.grh_present) { 317 317 ah_attr.ah_flags = IB_AH_GRH; 318 318 memcpy(ah_attr.grh.dgid.raw, packet->mad.hdr.gid, 16); 319 - ah_attr.grh.flow_label = packet->mad.hdr.flow_label; 319 + ah_attr.grh.flow_label = be32_to_cpu(packet->mad.hdr.flow_label); 320 320 ah_attr.grh.hop_limit = packet->mad.hdr.hop_limit; 321 321 ah_attr.grh.traffic_class = packet->mad.hdr.traffic_class; 322 322 }
+12 -12
drivers/infiniband/hw/mthca/mthca_av.c
··· 41 41 #include "mthca_dev.h" 42 42 43 43 struct mthca_av { 44 - u32 port_pd; 45 - u8 reserved1; 46 - u8 g_slid; 47 - u16 dlid; 48 - u8 reserved2; 49 - u8 gid_index; 50 - u8 msg_sr; 51 - u8 hop_limit; 52 - u32 sl_tclass_flowlabel; 53 - u32 dgid[4]; 44 + __be32 port_pd; 45 + u8 reserved1; 46 + u8 g_slid; 47 + __be16 dlid; 48 + u8 reserved2; 49 + u8 gid_index; 50 + u8 msg_sr; 51 + u8 hop_limit; 52 + __be32 sl_tclass_flowlabel; 53 + __be32 dgid[4]; 54 54 }; 55 55 56 56 int mthca_create_ah(struct mthca_dev *dev, ··· 128 128 av, (unsigned long) ah->avdma); 129 129 for (j = 0; j < 8; ++j) 130 130 printk(KERN_DEBUG " [%2x] %08x\n", 131 - j * 4, be32_to_cpu(((u32 *) av)[j])); 131 + j * 4, be32_to_cpu(((__be32 *) av)[j])); 132 132 } 133 133 134 134 if (ah->type == MTHCA_AH_ON_HCA) { ··· 169 169 170 170 header->lrh.service_level = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28; 171 171 header->lrh.destination_lid = ah->av->dlid; 172 - header->lrh.source_lid = ah->av->g_slid & 0x7f; 172 + header->lrh.source_lid = cpu_to_be16(ah->av->g_slid & 0x7f); 173 173 if (ah->av->g_slid & 0x80) { 174 174 header->grh_present = 1; 175 175 header->grh.traffic_class =
+21 -19
drivers/infiniband/hw/mthca/mthca_cmd.c
··· 220 220 * (and some architectures such as ia64 implement memcpy_toio 221 221 * in terms of writeb). 222 222 */ 223 - __raw_writel(cpu_to_be32(in_param >> 32), dev->hcr + 0 * 4); 224 - __raw_writel(cpu_to_be32(in_param & 0xfffffffful), dev->hcr + 1 * 4); 225 - __raw_writel(cpu_to_be32(in_modifier), dev->hcr + 2 * 4); 226 - __raw_writel(cpu_to_be32(out_param >> 32), dev->hcr + 3 * 4); 227 - __raw_writel(cpu_to_be32(out_param & 0xfffffffful), dev->hcr + 4 * 4); 228 - __raw_writel(cpu_to_be32(token << 16), dev->hcr + 5 * 4); 223 + __raw_writel((__force u32) cpu_to_be32(in_param >> 32), dev->hcr + 0 * 4); 224 + __raw_writel((__force u32) cpu_to_be32(in_param & 0xfffffffful), dev->hcr + 1 * 4); 225 + __raw_writel((__force u32) cpu_to_be32(in_modifier), dev->hcr + 2 * 4); 226 + __raw_writel((__force u32) cpu_to_be32(out_param >> 32), dev->hcr + 3 * 4); 227 + __raw_writel((__force u32) cpu_to_be32(out_param & 0xfffffffful), dev->hcr + 4 * 4); 228 + __raw_writel((__force u32) cpu_to_be32(token << 16), dev->hcr + 5 * 4); 229 229 230 230 /* __raw_writel may not order writes. */ 231 231 wmb(); 232 232 233 - __raw_writel(cpu_to_be32((1 << HCR_GO_BIT) | 234 - (event ? (1 << HCA_E_BIT) : 0) | 235 - (op_modifier << HCR_OPMOD_SHIFT) | 236 - op), dev->hcr + 6 * 4); 233 + __raw_writel((__force u32) cpu_to_be32((1 << HCR_GO_BIT) | 234 + (event ? (1 << HCA_E_BIT) : 0) | 235 + (op_modifier << HCR_OPMOD_SHIFT) | 236 + op), dev->hcr + 6 * 4); 237 237 238 238 out: 239 239 up(&dev->cmd.hcr_sem); ··· 274 274 goto out; 275 275 } 276 276 277 - if (out_is_imm) { 278 - memcpy_fromio(out_param, dev->hcr + HCR_OUT_PARAM_OFFSET, sizeof (u64)); 279 - be64_to_cpus(out_param); 280 - } 277 + if (out_is_imm) 278 + *out_param = 279 + (u64) be32_to_cpu((__force __be32) 280 + __raw_readl(dev->hcr + HCR_OUT_PARAM_OFFSET)) << 32 | 281 + (u64) be32_to_cpu((__force __be32) 282 + __raw_readl(dev->hcr + HCR_OUT_PARAM_OFFSET + 4)); 281 283 282 - *status = be32_to_cpu(__raw_readl(dev->hcr + HCR_STATUS_OFFSET)) >> 24; 284 + *status = be32_to_cpu((__force __be32) __raw_readl(dev->hcr + HCR_STATUS_OFFSET)) >> 24; 283 285 284 286 out: 285 287 up(&dev->cmd.poll_sem); ··· 1124 1122 u8 *status) 1125 1123 { 1126 1124 struct mthca_mailbox *mailbox; 1127 - u32 *inbox; 1125 + __be32 *inbox; 1128 1126 int err; 1129 1127 1130 1128 #define INIT_HCA_IN_SIZE 0x200 ··· 1345 1343 int mthca_MAP_ICM_page(struct mthca_dev *dev, u64 dma_addr, u64 virt, u8 *status) 1346 1344 { 1347 1345 struct mthca_mailbox *mailbox; 1348 - u64 *inbox; 1346 + __be64 *inbox; 1349 1347 int err; 1350 1348 1351 1349 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); ··· 1516 1514 if (i % 8 == 0) 1517 1515 printk(" [%02x] ", i * 4); 1518 1516 printk(" %08x", 1519 - be32_to_cpu(((u32 *) mailbox->buf)[i + 2])); 1517 + be32_to_cpu(((__be32 *) mailbox->buf)[i + 2])); 1520 1518 if ((i + 1) % 8 == 0) 1521 1519 printk("\n"); 1522 1520 } ··· 1536 1534 if (i % 8 == 0) 1537 1535 printk("[%02x] ", i * 4); 1538 1536 printk(" %08x", 1539 - be32_to_cpu(((u32 *) mailbox->buf)[i + 2])); 1537 + be32_to_cpu(((__be32 *) mailbox->buf)[i + 2])); 1540 1538 if ((i + 1) % 8 == 0) 1541 1539 printk("\n"); 1542 1540 }
+44 -45
drivers/infiniband/hw/mthca/mthca_cq.c
··· 57 57 * Must be packed because start is 64 bits but only aligned to 32 bits. 58 58 */ 59 59 struct mthca_cq_context { 60 - u32 flags; 61 - u64 start; 62 - u32 logsize_usrpage; 63 - u32 error_eqn; /* Tavor only */ 64 - u32 comp_eqn; 65 - u32 pd; 66 - u32 lkey; 67 - u32 last_notified_index; 68 - u32 solicit_producer_index; 69 - u32 consumer_index; 70 - u32 producer_index; 71 - u32 cqn; 72 - u32 ci_db; /* Arbel only */ 73 - u32 state_db; /* Arbel only */ 74 - u32 reserved; 60 + __be32 flags; 61 + __be64 start; 62 + __be32 logsize_usrpage; 63 + __be32 error_eqn; /* Tavor only */ 64 + __be32 comp_eqn; 65 + __be32 pd; 66 + __be32 lkey; 67 + __be32 last_notified_index; 68 + __be32 solicit_producer_index; 69 + __be32 consumer_index; 70 + __be32 producer_index; 71 + __be32 cqn; 72 + __be32 ci_db; /* Arbel only */ 73 + __be32 state_db; /* Arbel only */ 74 + u32 reserved; 75 75 } __attribute__((packed)); 76 76 77 77 #define MTHCA_CQ_STATUS_OK ( 0 << 28) ··· 110 110 }; 111 111 112 112 struct mthca_cqe { 113 - u32 my_qpn; 114 - u32 my_ee; 115 - u32 rqpn; 116 - u16 sl_g_mlpath; 117 - u16 rlid; 118 - u32 imm_etype_pkey_eec; 119 - u32 byte_cnt; 120 - u32 wqe; 121 - u8 opcode; 122 - u8 is_send; 123 - u8 reserved; 124 - u8 owner; 113 + __be32 my_qpn; 114 + __be32 my_ee; 115 + __be32 rqpn; 116 + __be16 sl_g_mlpath; 117 + __be16 rlid; 118 + __be32 imm_etype_pkey_eec; 119 + __be32 byte_cnt; 120 + __be32 wqe; 121 + u8 opcode; 122 + u8 is_send; 123 + u8 reserved; 124 + u8 owner; 125 125 }; 126 126 127 127 struct mthca_err_cqe { 128 - u32 my_qpn; 129 - u32 reserved1[3]; 130 - u8 syndrome; 131 - u8 reserved2; 132 - u16 db_cnt; 133 - u32 reserved3; 134 - u32 wqe; 135 - u8 opcode; 136 - u8 reserved4[2]; 137 - u8 owner; 128 + __be32 my_qpn; 129 + u32 reserved1[3]; 130 + u8 syndrome; 131 + u8 reserved2; 132 + __be16 db_cnt; 133 + u32 reserved3; 134 + __be32 wqe; 135 + u8 opcode; 136 + u8 reserved4[2]; 137 + u8 owner; 138 138 }; 139 139 140 140 #define MTHCA_CQ_ENTRY_OWNER_SW (0 << 7) ··· 193 193 static inline void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq, 194 194 int incr) 195 195 { 196 - u32 doorbell[2]; 196 + __be32 doorbell[2]; 197 197 198 198 if (mthca_is_memfree(dev)) { 199 199 *cq->set_ci_db = cpu_to_be32(cq->cons_index); ··· 293 293 { 294 294 int err; 295 295 int dbd; 296 - u32 new_wqe; 296 + __be32 new_wqe; 297 297 298 298 if (cqe->syndrome == SYNDROME_LOCAL_QP_OP_ERR) { 299 299 mthca_dbg(dev, "local QP operation err " ··· 586 586 587 587 int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify) 588 588 { 589 - u32 doorbell[2]; 589 + __be32 doorbell[2]; 590 590 591 591 doorbell[0] = cpu_to_be32((notify == IB_CQ_SOLICITED ? 592 592 MTHCA_TAVOR_CQ_DB_REQ_NOT_SOL : 593 593 MTHCA_TAVOR_CQ_DB_REQ_NOT) | 594 594 to_mcq(cq)->cqn); 595 - doorbell[1] = 0xffffffff; 595 + doorbell[1] = (__force __be32) 0xffffffff; 596 596 597 597 mthca_write64(doorbell, 598 598 to_mdev(cq->device)->kar + MTHCA_CQ_DOORBELL, ··· 604 604 int mthca_arbel_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify) 605 605 { 606 606 struct mthca_cq *cq = to_mcq(ibcq); 607 - u32 doorbell[2]; 607 + __be32 doorbell[2]; 608 608 u32 sn; 609 - u32 ci; 609 + __be32 ci; 610 610 611 611 sn = cq->arm_sn & 3; 612 612 ci = cpu_to_be32(cq->cons_index); ··· 813 813 cq_context->flags = cpu_to_be32(MTHCA_CQ_STATUS_OK | 814 814 MTHCA_CQ_STATE_DISARMED | 815 815 MTHCA_CQ_FLAG_TR); 816 - cq_context->start = cpu_to_be64(0); 817 816 cq_context->logsize_usrpage = cpu_to_be32((ffs(nent) - 1) << 24); 818 817 if (ctx) 819 818 cq_context->logsize_usrpage |= cpu_to_be32(ctx->uar.index); ··· 905 906 mthca_warn(dev, "HW2SW_CQ returned status 0x%02x\n", status); 906 907 907 908 if (0) { 908 - u32 *ctx = mailbox->buf; 909 + __be32 *ctx = mailbox->buf; 909 910 int j; 910 911 911 912 printk(KERN_ERR "context for CQN %x (cons index %x, next sw %d)\n",
+7 -8
drivers/infiniband/hw/mthca/mthca_dev.h
··· 333 333 334 334 #define MTHCA_PUT(dest, source, offset) \ 335 335 do { \ 336 - __typeof__(source) *__p = \ 337 - (__typeof__(source) *) ((char *) (dest) + (offset)); \ 336 + void *__d = ((char *) (dest) + (offset)); \ 338 337 switch (sizeof(source)) { \ 339 - case 1: *__p = (source); break; \ 340 - case 2: *__p = cpu_to_be16(source); break; \ 341 - case 4: *__p = cpu_to_be32(source); break; \ 342 - case 8: *__p = cpu_to_be64(source); break; \ 343 - default: __buggy_use_of_MTHCA_PUT(); \ 338 + case 1: *(u8 *) __d = (source); break; \ 339 + case 2: *(__be16 *) __d = cpu_to_be16(source); break; \ 340 + case 4: *(__be32 *) __d = cpu_to_be32(source); break; \ 341 + case 8: *(__be64 *) __d = cpu_to_be64(source); break; \ 342 + default: __buggy_use_of_MTHCA_PUT(); \ 344 343 } \ 345 344 } while (0) 346 345 ··· 434 435 int mthca_arbel_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, 435 436 struct ib_recv_wr **bad_wr); 436 437 int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send, 437 - int index, int *dbd, u32 *new_wqe); 438 + int index, int *dbd, __be32 *new_wqe); 438 439 int mthca_alloc_qp(struct mthca_dev *dev, 439 440 struct mthca_pd *pd, 440 441 struct mthca_cq *send_cq,
+6 -6
drivers/infiniband/hw/mthca/mthca_doorbell.h
··· 58 58 __raw_writeq((__force u64) val, dest); 59 59 } 60 60 61 - static inline void mthca_write64(u32 val[2], void __iomem *dest, 61 + static inline void mthca_write64(__be32 val[2], void __iomem *dest, 62 62 spinlock_t *doorbell_lock) 63 63 { 64 64 __raw_writeq(*(u64 *) val, dest); 65 65 } 66 66 67 - static inline void mthca_write_db_rec(u32 val[2], u32 *db) 67 + static inline void mthca_write_db_rec(__be32 val[2], __be32 *db) 68 68 { 69 69 *(u64 *) db = *(u64 *) val; 70 70 } ··· 87 87 __raw_writel(((__force u32 *) &val)[1], dest + 4); 88 88 } 89 89 90 - static inline void mthca_write64(u32 val[2], void __iomem *dest, 90 + static inline void mthca_write64(__be32 val[2], void __iomem *dest, 91 91 spinlock_t *doorbell_lock) 92 92 { 93 93 unsigned long flags; 94 94 95 95 spin_lock_irqsave(doorbell_lock, flags); 96 - __raw_writel(val[0], dest); 97 - __raw_writel(val[1], dest + 4); 96 + __raw_writel((__force u32) val[0], dest); 97 + __raw_writel((__force u32) val[1], dest + 4); 98 98 spin_unlock_irqrestore(doorbell_lock, flags); 99 99 } 100 100 101 - static inline void mthca_write_db_rec(u32 val[2], u32 *db) 101 + static inline void mthca_write_db_rec(__be32 val[2], __be32 *db) 102 102 { 103 103 db[0] = val[0]; 104 104 wmb();
+31 -31
drivers/infiniband/hw/mthca/mthca_eq.c
··· 52 52 * Must be packed because start is 64 bits but only aligned to 32 bits. 53 53 */ 54 54 struct mthca_eq_context { 55 - u32 flags; 56 - u64 start; 57 - u32 logsize_usrpage; 58 - u32 tavor_pd; /* reserved for Arbel */ 59 - u8 reserved1[3]; 60 - u8 intr; 61 - u32 arbel_pd; /* lost_count for Tavor */ 62 - u32 lkey; 63 - u32 reserved2[2]; 64 - u32 consumer_index; 65 - u32 producer_index; 66 - u32 reserved3[4]; 55 + __be32 flags; 56 + __be64 start; 57 + __be32 logsize_usrpage; 58 + __be32 tavor_pd; /* reserved for Arbel */ 59 + u8 reserved1[3]; 60 + u8 intr; 61 + __be32 arbel_pd; /* lost_count for Tavor */ 62 + __be32 lkey; 63 + u32 reserved2[2]; 64 + __be32 consumer_index; 65 + __be32 producer_index; 66 + u32 reserved3[4]; 67 67 } __attribute__((packed)); 68 68 69 69 #define MTHCA_EQ_STATUS_OK ( 0 << 28) ··· 128 128 union { 129 129 u32 raw[6]; 130 130 struct { 131 - u32 cqn; 131 + __be32 cqn; 132 132 } __attribute__((packed)) comp; 133 133 struct { 134 - u16 reserved1; 135 - u16 token; 136 - u32 reserved2; 137 - u8 reserved3[3]; 138 - u8 status; 139 - u64 out_param; 134 + u16 reserved1; 135 + __be16 token; 136 + u32 reserved2; 137 + u8 reserved3[3]; 138 + u8 status; 139 + __be64 out_param; 140 140 } __attribute__((packed)) cmd; 141 141 struct { 142 - u32 qpn; 142 + __be32 qpn; 143 143 } __attribute__((packed)) qp; 144 144 struct { 145 - u32 cqn; 146 - u32 reserved1; 147 - u8 reserved2[3]; 148 - u8 syndrome; 145 + __be32 cqn; 146 + u32 reserved1; 147 + u8 reserved2[3]; 148 + u8 syndrome; 149 149 } __attribute__((packed)) cq_err; 150 150 struct { 151 - u32 reserved1[2]; 152 - u32 port; 151 + u32 reserved1[2]; 152 + __be32 port; 153 153 } __attribute__((packed)) port_change; 154 154 } event; 155 155 u8 reserved3[3]; ··· 168 168 169 169 static inline void tavor_set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u32 ci) 170 170 { 171 - u32 doorbell[2]; 171 + __be32 doorbell[2]; 172 172 173 173 doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_SET_CI | eq->eqn); 174 174 doorbell[1] = cpu_to_be32(ci & (eq->nent - 1)); ··· 191 191 { 192 192 /* See comment in tavor_set_eq_ci() above. */ 193 193 wmb(); 194 - __raw_writel(cpu_to_be32(ci), dev->eq_regs.arbel.eq_set_ci_base + 195 - eq->eqn * 8); 194 + __raw_writel((__force u32) cpu_to_be32(ci), 195 + dev->eq_regs.arbel.eq_set_ci_base + eq->eqn * 8); 196 196 /* We still want ordering, just not swabbing, so add a barrier */ 197 197 mb(); 198 198 } ··· 207 207 208 208 static inline void tavor_eq_req_not(struct mthca_dev *dev, int eqn) 209 209 { 210 - u32 doorbell[2]; 210 + __be32 doorbell[2]; 211 211 212 212 doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_REQ_NOT | eqn); 213 213 doorbell[1] = 0; ··· 225 225 static inline void disarm_cq(struct mthca_dev *dev, int eqn, int cqn) 226 226 { 227 227 if (!mthca_is_memfree(dev)) { 228 - u32 doorbell[2]; 228 + __be32 doorbell[2]; 229 229 230 230 doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_DISARM_CQ | eqn); 231 231 doorbell[1] = cpu_to_be32(cqn);
+1 -1
drivers/infiniband/hw/mthca/mthca_mad.c
··· 194 194 { 195 195 int err; 196 196 u8 status; 197 - u16 slid = in_wc ? in_wc->slid : IB_LID_PERMISSIVE; 197 + u16 slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE); 198 198 199 199 /* Forward locally generated traps to the SM */ 200 200 if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP &&
+20 -16
drivers/infiniband/hw/mthca/mthca_mcg.c
··· 42 42 }; 43 43 44 44 struct mthca_mgm { 45 - u32 next_gid_index; 46 - u32 reserved[3]; 47 - u8 gid[16]; 48 - u32 qp[MTHCA_QP_PER_MGM]; 45 + __be32 next_gid_index; 46 + u32 reserved[3]; 47 + u8 gid[16]; 48 + __be32 qp[MTHCA_QP_PER_MGM]; 49 49 }; 50 50 51 51 static const u8 zero_gid[16]; /* automatically initialized to 0 */ ··· 94 94 if (0) 95 95 mthca_dbg(dev, "Hash for %04x:%04x:%04x:%04x:" 96 96 "%04x:%04x:%04x:%04x is %04x\n", 97 - be16_to_cpu(((u16 *) gid)[0]), be16_to_cpu(((u16 *) gid)[1]), 98 - be16_to_cpu(((u16 *) gid)[2]), be16_to_cpu(((u16 *) gid)[3]), 99 - be16_to_cpu(((u16 *) gid)[4]), be16_to_cpu(((u16 *) gid)[5]), 100 - be16_to_cpu(((u16 *) gid)[6]), be16_to_cpu(((u16 *) gid)[7]), 97 + be16_to_cpu(((__be16 *) gid)[0]), 98 + be16_to_cpu(((__be16 *) gid)[1]), 99 + be16_to_cpu(((__be16 *) gid)[2]), 100 + be16_to_cpu(((__be16 *) gid)[3]), 101 + be16_to_cpu(((__be16 *) gid)[4]), 102 + be16_to_cpu(((__be16 *) gid)[5]), 103 + be16_to_cpu(((__be16 *) gid)[6]), 104 + be16_to_cpu(((__be16 *) gid)[7]), 101 105 *hash); 102 106 103 107 *index = *hash; ··· 262 258 if (index == -1) { 263 259 mthca_err(dev, "MGID %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x " 264 260 "not found\n", 265 - be16_to_cpu(((u16 *) gid->raw)[0]), 266 - be16_to_cpu(((u16 *) gid->raw)[1]), 267 - be16_to_cpu(((u16 *) gid->raw)[2]), 268 - be16_to_cpu(((u16 *) gid->raw)[3]), 269 - be16_to_cpu(((u16 *) gid->raw)[4]), 270 - be16_to_cpu(((u16 *) gid->raw)[5]), 271 - be16_to_cpu(((u16 *) gid->raw)[6]), 272 - be16_to_cpu(((u16 *) gid->raw)[7])); 261 + be16_to_cpu(((__be16 *) gid->raw)[0]), 262 + be16_to_cpu(((__be16 *) gid->raw)[1]), 263 + be16_to_cpu(((__be16 *) gid->raw)[2]), 264 + be16_to_cpu(((__be16 *) gid->raw)[3]), 265 + be16_to_cpu(((__be16 *) gid->raw)[4]), 266 + be16_to_cpu(((__be16 *) gid->raw)[5]), 267 + be16_to_cpu(((__be16 *) gid->raw)[6]), 268 + be16_to_cpu(((__be16 *) gid->raw)[7])); 273 269 err = -EINVAL; 274 270 goto out; 275 271 }
+2 -2
drivers/infiniband/hw/mthca/mthca_memfree.c
··· 482 482 } 483 483 } 484 484 485 - int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db) 485 + int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, __be32 **db) 486 486 { 487 487 int group; 488 488 int start, end, dir; ··· 565 565 566 566 page->db_rec[j] = cpu_to_be64((qn << 8) | (type << 5)); 567 567 568 - *db = (u32 *) &page->db_rec[j]; 568 + *db = (__be32 *) &page->db_rec[j]; 569 569 570 570 out: 571 571 up(&dev->db_tab->mutex);
+2 -2
drivers/infiniband/hw/mthca/mthca_memfree.h
··· 138 138 139 139 struct mthca_db_page { 140 140 DECLARE_BITMAP(used, MTHCA_DB_REC_PER_PAGE); 141 - u64 *db_rec; 141 + __be64 *db_rec; 142 142 dma_addr_t mapping; 143 143 }; 144 144 ··· 173 173 174 174 int mthca_init_db_tab(struct mthca_dev *dev); 175 175 void mthca_cleanup_db_tab(struct mthca_dev *dev); 176 - int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db); 176 + int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, __be32 **db); 177 177 void mthca_free_db(struct mthca_dev *dev, int type, int db_index); 178 178 179 179 #endif /* MTHCA_MEMFREE_H */
+16 -16
drivers/infiniband/hw/mthca/mthca_mr.c
··· 51 51 * Must be packed because mtt_seg is 64 bits but only aligned to 32 bits. 52 52 */ 53 53 struct mthca_mpt_entry { 54 - u32 flags; 55 - u32 page_size; 56 - u32 key; 57 - u32 pd; 58 - u64 start; 59 - u64 length; 60 - u32 lkey; 61 - u32 window_count; 62 - u32 window_count_limit; 63 - u64 mtt_seg; 64 - u32 mtt_sz; /* Arbel only */ 65 - u32 reserved[2]; 54 + __be32 flags; 55 + __be32 page_size; 56 + __be32 key; 57 + __be32 pd; 58 + __be64 start; 59 + __be64 length; 60 + __be32 lkey; 61 + __be32 window_count; 62 + __be32 window_count_limit; 63 + __be64 mtt_seg; 64 + __be32 mtt_sz; /* Arbel only */ 65 + u32 reserved[2]; 66 66 } __attribute__((packed)); 67 67 68 68 #define MTHCA_MPT_FLAG_SW_OWNS (0xfUL << 28) ··· 248 248 int start_index, u64 *buffer_list, int list_len) 249 249 { 250 250 struct mthca_mailbox *mailbox; 251 - u64 *mtt_entry; 251 + __be64 *mtt_entry; 252 252 int err = 0; 253 253 u8 status; 254 254 int i; ··· 390 390 for (i = 0; i < sizeof (struct mthca_mpt_entry) / 4; ++i) { 391 391 if (i % 4 == 0) 392 392 printk("[%02x] ", i * 4); 393 - printk(" %08x", be32_to_cpu(((u32 *) mpt_entry)[i])); 393 + printk(" %08x", be32_to_cpu(((__be32 *) mpt_entry)[i])); 394 394 if ((i + 1) % 4 == 0) 395 395 printk("\n"); 396 396 } ··· 563 563 for (i = 0; i < sizeof (struct mthca_mpt_entry) / 4; ++i) { 564 564 if (i % 4 == 0) 565 565 printk("[%02x] ", i * 4); 566 - printk(" %08x", be32_to_cpu(((u32 *) mpt_entry)[i])); 566 + printk(" %08x", be32_to_cpu(((__be32 *) mpt_entry)[i])); 567 567 if ((i + 1) % 4 == 0) 568 568 printk("\n"); 569 569 } ··· 670 670 mpt_entry.length = cpu_to_be64(list_len * (1ull << fmr->attr.page_size)); 671 671 mpt_entry.start = cpu_to_be64(iova); 672 672 673 - writel(mpt_entry.lkey, &fmr->mem.tavor.mpt->key); 673 + __raw_writel((__force u32) mpt_entry.lkey, &fmr->mem.tavor.mpt->key); 674 674 memcpy_toio(&fmr->mem.tavor.mpt->start, &mpt_entry.start, 675 675 offsetof(struct mthca_mpt_entry, window_count) - 676 676 offsetof(struct mthca_mpt_entry, start));
+8 -8
drivers/infiniband/hw/mthca/mthca_provider.c
··· 81 81 } 82 82 83 83 props->device_cap_flags = mdev->device_cap_flags; 84 - props->vendor_id = be32_to_cpup((u32 *) (out_mad->data + 36)) & 84 + props->vendor_id = be32_to_cpup((__be32 *) (out_mad->data + 36)) & 85 85 0xffffff; 86 - props->vendor_part_id = be16_to_cpup((u16 *) (out_mad->data + 30)); 87 - props->hw_ver = be16_to_cpup((u16 *) (out_mad->data + 32)); 86 + props->vendor_part_id = be16_to_cpup((__be16 *) (out_mad->data + 30)); 87 + props->hw_ver = be16_to_cpup((__be16 *) (out_mad->data + 32)); 88 88 memcpy(&props->sys_image_guid, out_mad->data + 4, 8); 89 89 memcpy(&props->node_guid, out_mad->data + 12, 8); 90 90 ··· 138 138 goto out; 139 139 } 140 140 141 - props->lid = be16_to_cpup((u16 *) (out_mad->data + 16)); 141 + props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16)); 142 142 props->lmc = out_mad->data[34] & 0x7; 143 - props->sm_lid = be16_to_cpup((u16 *) (out_mad->data + 18)); 143 + props->sm_lid = be16_to_cpup((__be16 *) (out_mad->data + 18)); 144 144 props->sm_sl = out_mad->data[36] & 0xf; 145 145 props->state = out_mad->data[32] & 0xf; 146 146 props->phys_state = out_mad->data[33] >> 4; 147 - props->port_cap_flags = be32_to_cpup((u32 *) (out_mad->data + 20)); 147 + props->port_cap_flags = be32_to_cpup((__be32 *) (out_mad->data + 20)); 148 148 props->gid_tbl_len = to_mdev(ibdev)->limits.gid_table_len; 149 149 props->pkey_tbl_len = to_mdev(ibdev)->limits.pkey_table_len; 150 - props->qkey_viol_cntr = be16_to_cpup((u16 *) (out_mad->data + 48)); 150 + props->qkey_viol_cntr = be16_to_cpup((__be16 *) (out_mad->data + 48)); 151 151 props->active_width = out_mad->data[31] & 0xf; 152 152 props->active_speed = out_mad->data[35] >> 4; 153 153 ··· 223 223 goto out; 224 224 } 225 225 226 - *pkey = be16_to_cpu(((u16 *) out_mad->data)[index % 32]); 226 + *pkey = be16_to_cpu(((__be16 *) out_mad->data)[index % 32]); 227 227 228 228 out: 229 229 kfree(in_mad);
+3 -3
drivers/infiniband/hw/mthca/mthca_provider.h
··· 182 182 183 183 /* Next fields are Arbel only */ 184 184 int set_ci_db_index; 185 - u32 *set_ci_db; 185 + __be32 *set_ci_db; 186 186 int arm_db_index; 187 - u32 *arm_db; 187 + __be32 *arm_db; 188 188 int arm_sn; 189 189 190 190 union { ··· 207 207 int wqe_shift; 208 208 209 209 int db_index; /* Arbel only */ 210 - u32 *db; 210 + __be32 *db; 211 211 }; 212 212 213 213 struct mthca_qp {
+93 -94
drivers/infiniband/hw/mthca/mthca_qp.c
··· 97 97 }; 98 98 99 99 struct mthca_qp_path { 100 - u32 port_pkey; 101 - u8 rnr_retry; 102 - u8 g_mylmc; 103 - u16 rlid; 104 - u8 ackto; 105 - u8 mgid_index; 106 - u8 static_rate; 107 - u8 hop_limit; 108 - u32 sl_tclass_flowlabel; 109 - u8 rgid[16]; 100 + __be32 port_pkey; 101 + u8 rnr_retry; 102 + u8 g_mylmc; 103 + __be16 rlid; 104 + u8 ackto; 105 + u8 mgid_index; 106 + u8 static_rate; 107 + u8 hop_limit; 108 + __be32 sl_tclass_flowlabel; 109 + u8 rgid[16]; 110 110 } __attribute__((packed)); 111 111 112 112 struct mthca_qp_context { 113 - u32 flags; 114 - u32 tavor_sched_queue; /* Reserved on Arbel */ 115 - u8 mtu_msgmax; 116 - u8 rq_size_stride; /* Reserved on Tavor */ 117 - u8 sq_size_stride; /* Reserved on Tavor */ 118 - u8 rlkey_arbel_sched_queue; /* Reserved on Tavor */ 119 - u32 usr_page; 120 - u32 local_qpn; 121 - u32 remote_qpn; 122 - u32 reserved1[2]; 113 + __be32 flags; 114 + __be32 tavor_sched_queue; /* Reserved on Arbel */ 115 + u8 mtu_msgmax; 116 + u8 rq_size_stride; /* Reserved on Tavor */ 117 + u8 sq_size_stride; /* Reserved on Tavor */ 118 + u8 rlkey_arbel_sched_queue; /* Reserved on Tavor */ 119 + __be32 usr_page; 120 + __be32 local_qpn; 121 + __be32 remote_qpn; 122 + u32 reserved1[2]; 123 123 struct mthca_qp_path pri_path; 124 124 struct mthca_qp_path alt_path; 125 - u32 rdd; 126 - u32 pd; 127 - u32 wqe_base; 128 - u32 wqe_lkey; 129 - u32 params1; 130 - u32 reserved2; 131 - u32 next_send_psn; 132 - u32 cqn_snd; 133 - u32 snd_wqe_base_l; /* Next send WQE on Tavor */ 134 - u32 snd_db_index; /* (debugging only entries) */ 135 - u32 last_acked_psn; 136 - u32 ssn; 137 - u32 params2; 138 - u32 rnr_nextrecvpsn; 139 - u32 ra_buff_indx; 140 - u32 cqn_rcv; 141 - u32 rcv_wqe_base_l; /* Next recv WQE on Tavor */ 142 - u32 rcv_db_index; /* (debugging only entries) */ 143 - u32 qkey; 144 - u32 srqn; 145 - u32 rmsn; 146 - u16 rq_wqe_counter; /* reserved on Tavor */ 147 - u16 sq_wqe_counter; /* reserved on Tavor */ 148 - u32 reserved3[18]; 125 + __be32 rdd; 126 + __be32 pd; 127 + __be32 wqe_base; 128 + __be32 wqe_lkey; 129 + __be32 params1; 130 + __be32 reserved2; 131 + __be32 next_send_psn; 132 + __be32 cqn_snd; 133 + __be32 snd_wqe_base_l; /* Next send WQE on Tavor */ 134 + __be32 snd_db_index; /* (debugging only entries) */ 135 + __be32 last_acked_psn; 136 + __be32 ssn; 137 + __be32 params2; 138 + __be32 rnr_nextrecvpsn; 139 + __be32 ra_buff_indx; 140 + __be32 cqn_rcv; 141 + __be32 rcv_wqe_base_l; /* Next recv WQE on Tavor */ 142 + __be32 rcv_db_index; /* (debugging only entries) */ 143 + __be32 qkey; 144 + __be32 srqn; 145 + __be32 rmsn; 146 + __be16 rq_wqe_counter; /* reserved on Tavor */ 147 + __be16 sq_wqe_counter; /* reserved on Tavor */ 148 + u32 reserved3[18]; 149 149 } __attribute__((packed)); 150 150 151 151 struct mthca_qp_param { 152 - u32 opt_param_mask; 153 - u32 reserved1; 152 + __be32 opt_param_mask; 153 + u32 reserved1; 154 154 struct mthca_qp_context context; 155 - u32 reserved2[62]; 155 + u32 reserved2[62]; 156 156 } __attribute__((packed)); 157 157 158 158 enum { ··· 191 191 }; 192 192 193 193 struct mthca_next_seg { 194 - u32 nda_op; /* [31:6] next WQE [4:0] next opcode */ 195 - u32 ee_nds; /* [31:8] next EE [7] DBD [6] F [5:0] next WQE size */ 196 - u32 flags; /* [3] CQ [2] Event [1] Solicit */ 197 - u32 imm; /* immediate data */ 194 + __be32 nda_op; /* [31:6] next WQE [4:0] next opcode */ 195 + __be32 ee_nds; /* [31:8] next EE [7] DBD [6] F [5:0] next WQE size */ 196 + __be32 flags; /* [3] CQ [2] Event [1] Solicit */ 197 + __be32 imm; /* immediate data */ 198 198 }; 199 199 200 200 struct mthca_tavor_ud_seg { 201 - u32 reserved1; 202 - u32 lkey; 203 - u64 av_addr; 204 - u32 reserved2[4]; 205 - u32 dqpn; 206 - u32 qkey; 207 - u32 reserved3[2]; 201 + u32 reserved1; 202 + __be32 lkey; 203 + __be64 av_addr; 204 + u32 reserved2[4]; 205 + __be32 dqpn; 206 + __be32 qkey; 207 + u32 reserved3[2]; 208 208 }; 209 209 210 210 struct mthca_arbel_ud_seg { 211 - u32 av[8]; 212 - u32 dqpn; 213 - u32 qkey; 214 - u32 reserved[2]; 211 + __be32 av[8]; 212 + __be32 dqpn; 213 + __be32 qkey; 214 + u32 reserved[2]; 215 215 }; 216 216 217 217 struct mthca_bind_seg { 218 - u32 flags; /* [31] Atomic [30] rem write [29] rem read */ 219 - u32 reserved; 220 - u32 new_rkey; 221 - u32 lkey; 222 - u64 addr; 223 - u64 length; 218 + __be32 flags; /* [31] Atomic [30] rem write [29] rem read */ 219 + u32 reserved; 220 + __be32 new_rkey; 221 + __be32 lkey; 222 + __be64 addr; 223 + __be64 length; 224 224 }; 225 225 226 226 struct mthca_raddr_seg { 227 - u64 raddr; 228 - u32 rkey; 229 - u32 reserved; 227 + __be64 raddr; 228 + __be32 rkey; 229 + u32 reserved; 230 230 }; 231 231 232 232 struct mthca_atomic_seg { 233 - u64 swap_add; 234 - u64 compare; 233 + __be64 swap_add; 234 + __be64 compare; 235 235 }; 236 236 237 237 struct mthca_data_seg { 238 - u32 byte_count; 239 - u32 lkey; 240 - u64 addr; 238 + __be32 byte_count; 239 + __be32 lkey; 240 + __be64 addr; 241 241 }; 242 242 243 243 struct mthca_mlx_seg { 244 - u32 nda_op; 245 - u32 nds; 246 - u32 flags; /* [17] VL15 [16] SLR [14:12] static rate 244 + __be32 nda_op; 245 + __be32 nds; 246 + __be32 flags; /* [17] VL15 [16] SLR [14:12] static rate 247 247 [11:8] SL [3] C [2] E */ 248 - u16 rlid; 249 - u16 vcrc; 248 + __be16 rlid; 249 + __be16 vcrc; 250 250 }; 251 251 252 252 static const u8 mthca_opcode[] = { ··· 1459 1459 { 1460 1460 int header_size; 1461 1461 int err; 1462 + u16 pkey; 1462 1463 1463 1464 ib_ud_header_init(256, /* assume a MAD */ 1464 1465 sqp->ud_header.grh_present, ··· 1470 1469 return err; 1471 1470 mlx->flags &= ~cpu_to_be32(MTHCA_NEXT_SOLICIT | 1); 1472 1471 mlx->flags |= cpu_to_be32((!sqp->qp.ibqp.qp_num ? MTHCA_MLX_VL15 : 0) | 1473 - (sqp->ud_header.lrh.destination_lid == 0xffff ? 1474 - MTHCA_MLX_SLR : 0) | 1472 + (sqp->ud_header.lrh.destination_lid == 1473 + IB_LID_PERMISSIVE ? MTHCA_MLX_SLR : 0) | 1475 1474 (sqp->ud_header.lrh.service_level << 8)); 1476 1475 mlx->rlid = sqp->ud_header.lrh.destination_lid; 1477 1476 mlx->vcrc = 0; ··· 1491 1490 } 1492 1491 1493 1492 sqp->ud_header.lrh.virtual_lane = !sqp->qp.ibqp.qp_num ? 15 : 0; 1494 - if (sqp->ud_header.lrh.destination_lid == 0xffff) 1495 - sqp->ud_header.lrh.source_lid = 0xffff; 1493 + if (sqp->ud_header.lrh.destination_lid == IB_LID_PERMISSIVE) 1494 + sqp->ud_header.lrh.source_lid = IB_LID_PERMISSIVE; 1496 1495 sqp->ud_header.bth.solicited_event = !!(wr->send_flags & IB_SEND_SOLICITED); 1497 1496 if (!sqp->qp.ibqp.qp_num) 1498 1497 ib_get_cached_pkey(&dev->ib_dev, sqp->port, 1499 - sqp->pkey_index, 1500 - &sqp->ud_header.bth.pkey); 1498 + sqp->pkey_index, &pkey); 1501 1499 else 1502 1500 ib_get_cached_pkey(&dev->ib_dev, sqp->port, 1503 - wr->wr.ud.pkey_index, 1504 - &sqp->ud_header.bth.pkey); 1505 - cpu_to_be16s(&sqp->ud_header.bth.pkey); 1501 + wr->wr.ud.pkey_index, &pkey); 1502 + sqp->ud_header.bth.pkey = cpu_to_be16(pkey); 1506 1503 sqp->ud_header.bth.destination_qpn = cpu_to_be32(wr->wr.ud.remote_qpn); 1507 1504 sqp->ud_header.bth.psn = cpu_to_be32((sqp->send_psn++) & ((1 << 24) - 1)); 1508 1505 sqp->ud_header.deth.qkey = cpu_to_be32(wr->wr.ud.remote_qkey & 0x80000000 ? ··· 1743 1744 1744 1745 out: 1745 1746 if (likely(nreq)) { 1746 - u32 doorbell[2]; 1747 + __be32 doorbell[2]; 1747 1748 1748 1749 doorbell[0] = cpu_to_be32(((qp->sq.next_ind << qp->sq.wqe_shift) + 1749 1750 qp->send_wqe_offset) | f0 | op0); ··· 1844 1845 1845 1846 out: 1846 1847 if (likely(nreq)) { 1847 - u32 doorbell[2]; 1848 + __be32 doorbell[2]; 1848 1849 1849 1850 doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0); 1850 1851 doorbell[1] = cpu_to_be32((qp->qpn << 8) | nreq); ··· 2065 2066 2066 2067 out: 2067 2068 if (likely(nreq)) { 2068 - u32 doorbell[2]; 2069 + __be32 doorbell[2]; 2069 2070 2070 2071 doorbell[0] = cpu_to_be32((nreq << 24) | 2071 2072 ((qp->sq.head & 0xffff) << 8) | ··· 2175 2176 } 2176 2177 2177 2178 int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send, 2178 - int index, int *dbd, u32 *new_wqe) 2179 + int index, int *dbd, __be32 *new_wqe) 2179 2180 { 2180 2181 struct mthca_next_seg *next; 2181 2182
+44 -45
drivers/infiniband/include/ib_cm.h
··· 115 115 struct ib_sa_path_rec *primary_path; 116 116 struct ib_sa_path_rec *alternate_path; 117 117 118 - u64 remote_ca_guid; 118 + __be64 remote_ca_guid; 119 119 u32 remote_qkey; 120 120 u32 remote_qpn; 121 121 enum ib_qp_type qp_type; ··· 132 132 }; 133 133 134 134 struct ib_cm_rep_event_param { 135 - u64 remote_ca_guid; 135 + __be64 remote_ca_guid; 136 136 u32 remote_qkey; 137 137 u32 remote_qpn; 138 138 u32 starting_psn; ··· 146 146 }; 147 147 148 148 enum ib_cm_rej_reason { 149 - IB_CM_REJ_NO_QP = __constant_htons(1), 150 - IB_CM_REJ_NO_EEC = __constant_htons(2), 151 - IB_CM_REJ_NO_RESOURCES = __constant_htons(3), 152 - IB_CM_REJ_TIMEOUT = __constant_htons(4), 153 - IB_CM_REJ_UNSUPPORTED = __constant_htons(5), 154 - IB_CM_REJ_INVALID_COMM_ID = __constant_htons(6), 155 - IB_CM_REJ_INVALID_COMM_INSTANCE = __constant_htons(7), 156 - IB_CM_REJ_INVALID_SERVICE_ID = __constant_htons(8), 157 - IB_CM_REJ_INVALID_TRANSPORT_TYPE = __constant_htons(9), 158 - IB_CM_REJ_STALE_CONN = __constant_htons(10), 159 - IB_CM_REJ_RDC_NOT_EXIST = __constant_htons(11), 160 - IB_CM_REJ_INVALID_GID = __constant_htons(12), 161 - IB_CM_REJ_INVALID_LID = __constant_htons(13), 162 - IB_CM_REJ_INVALID_SL = __constant_htons(14), 163 - IB_CM_REJ_INVALID_TRAFFIC_CLASS = __constant_htons(15), 164 - IB_CM_REJ_INVALID_HOP_LIMIT = __constant_htons(16), 165 - IB_CM_REJ_INVALID_PACKET_RATE = __constant_htons(17), 166 - IB_CM_REJ_INVALID_ALT_GID = __constant_htons(18), 167 - IB_CM_REJ_INVALID_ALT_LID = __constant_htons(19), 168 - IB_CM_REJ_INVALID_ALT_SL = __constant_htons(20), 169 - IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS = __constant_htons(21), 170 - IB_CM_REJ_INVALID_ALT_HOP_LIMIT = __constant_htons(22), 171 - IB_CM_REJ_INVALID_ALT_PACKET_RATE = __constant_htons(23), 172 - IB_CM_REJ_PORT_CM_REDIRECT = __constant_htons(24), 173 - IB_CM_REJ_PORT_REDIRECT = __constant_htons(25), 174 - IB_CM_REJ_INVALID_MTU = __constant_htons(26), 175 - IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES = __constant_htons(27), 176 - IB_CM_REJ_CONSUMER_DEFINED = __constant_htons(28), 177 - IB_CM_REJ_INVALID_RNR_RETRY = __constant_htons(29), 178 - IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID = __constant_htons(30), 179 - IB_CM_REJ_INVALID_CLASS_VERSION = __constant_htons(31), 180 - IB_CM_REJ_INVALID_FLOW_LABEL = __constant_htons(32), 181 - IB_CM_REJ_INVALID_ALT_FLOW_LABEL = __constant_htons(33) 149 + IB_CM_REJ_NO_QP = 1, 150 + IB_CM_REJ_NO_EEC = 2, 151 + IB_CM_REJ_NO_RESOURCES = 3, 152 + IB_CM_REJ_TIMEOUT = 4, 153 + IB_CM_REJ_UNSUPPORTED = 5, 154 + IB_CM_REJ_INVALID_COMM_ID = 6, 155 + IB_CM_REJ_INVALID_COMM_INSTANCE = 7, 156 + IB_CM_REJ_INVALID_SERVICE_ID = 8, 157 + IB_CM_REJ_INVALID_TRANSPORT_TYPE = 9, 158 + IB_CM_REJ_STALE_CONN = 10, 159 + IB_CM_REJ_RDC_NOT_EXIST = 11, 160 + IB_CM_REJ_INVALID_GID = 12, 161 + IB_CM_REJ_INVALID_LID = 13, 162 + IB_CM_REJ_INVALID_SL = 14, 163 + IB_CM_REJ_INVALID_TRAFFIC_CLASS = 15, 164 + IB_CM_REJ_INVALID_HOP_LIMIT = 16, 165 + IB_CM_REJ_INVALID_PACKET_RATE = 17, 166 + IB_CM_REJ_INVALID_ALT_GID = 18, 167 + IB_CM_REJ_INVALID_ALT_LID = 19, 168 + IB_CM_REJ_INVALID_ALT_SL = 20, 169 + IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS = 21, 170 + IB_CM_REJ_INVALID_ALT_HOP_LIMIT = 22, 171 + IB_CM_REJ_INVALID_ALT_PACKET_RATE = 23, 172 + IB_CM_REJ_PORT_CM_REDIRECT = 24, 173 + IB_CM_REJ_PORT_REDIRECT = 25, 174 + IB_CM_REJ_INVALID_MTU = 26, 175 + IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES = 27, 176 + IB_CM_REJ_CONSUMER_DEFINED = 28, 177 + IB_CM_REJ_INVALID_RNR_RETRY = 29, 178 + IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID = 30, 179 + IB_CM_REJ_INVALID_CLASS_VERSION = 31, 180 + IB_CM_REJ_INVALID_FLOW_LABEL = 32, 181 + IB_CM_REJ_INVALID_ALT_FLOW_LABEL = 33 182 182 }; 183 183 184 184 struct ib_cm_rej_event_param { ··· 222 222 struct ib_cm_id *listen_id; 223 223 struct ib_device *device; 224 224 u8 port; 225 - 226 - u16 pkey; 225 + u16 pkey; 227 226 }; 228 227 229 228 enum ib_cm_sidr_status { ··· 284 285 struct ib_cm_id { 285 286 ib_cm_handler cm_handler; 286 287 void *context; 287 - u64 service_id; 288 - u64 service_mask; 288 + __be64 service_id; 289 + __be64 service_mask; 289 290 enum ib_cm_state state; /* internal CM/debug use */ 290 291 enum ib_cm_lap_state lap_state; /* internal CM/debug use */ 291 - u32 local_id; 292 - u32 remote_id; 292 + __be32 local_id; 293 + __be32 remote_id; 293 294 }; 294 295 295 296 /** ··· 329 330 * IB_CM_ASSIGN_SERVICE_ID. 330 331 */ 331 332 int ib_cm_listen(struct ib_cm_id *cm_id, 332 - u64 service_id, 333 - u64 service_mask); 333 + __be64 service_id, 334 + __be64 service_mask); 334 335 335 336 struct ib_cm_req_param { 336 337 struct ib_sa_path_rec *primary_path; 337 338 struct ib_sa_path_rec *alternate_path; 338 - u64 service_id; 339 + __be64 service_id; 339 340 u32 qp_num; 340 341 enum ib_qp_type qp_type; 341 342 u32 starting_psn; ··· 527 528 528 529 struct ib_cm_sidr_req_param { 529 530 struct ib_sa_path_rec *path; 530 - u64 service_id; 531 + __be64 service_id; 531 532 int timeout_ms; 532 533 const void *private_data; 533 534 u8 private_data_len;
+11 -11
drivers/infiniband/include/ib_mad.h
··· 111 111 u8 mgmt_class; 112 112 u8 class_version; 113 113 u8 method; 114 - u16 status; 115 - u16 class_specific; 116 - u64 tid; 117 - u16 attr_id; 118 - u16 resv; 119 - u32 attr_mod; 114 + __be16 status; 115 + __be16 class_specific; 116 + __be64 tid; 117 + __be16 attr_id; 118 + __be16 resv; 119 + __be32 attr_mod; 120 120 }; 121 121 122 122 struct ib_rmpp_hdr { ··· 124 124 u8 rmpp_type; 125 125 u8 rmpp_rtime_flags; 126 126 u8 rmpp_status; 127 - u32 seg_num; 128 - u32 paylen_newwin; 127 + __be32 seg_num; 128 + __be32 paylen_newwin; 129 129 }; 130 130 131 131 typedef u64 __bitwise ib_sa_comp_mask; ··· 139 139 * the wire so we can't change the layout) 140 140 */ 141 141 struct ib_sa_hdr { 142 - u64 sm_key; 143 - u16 attr_offset; 144 - u16 reserved; 142 + __be64 sm_key; 143 + __be16 attr_offset; 144 + __be16 reserved; 145 145 ib_sa_comp_mask comp_mask; 146 146 } __attribute__ ((packed)); 147 147
+9 -9
drivers/infiniband/include/ib_sa.h
··· 133 133 /* reserved */ 134 134 union ib_gid dgid; 135 135 union ib_gid sgid; 136 - u16 dlid; 137 - u16 slid; 136 + __be16 dlid; 137 + __be16 slid; 138 138 int raw_traffic; 139 139 /* reserved */ 140 - u32 flow_label; 140 + __be32 flow_label; 141 141 u8 hop_limit; 142 142 u8 traffic_class; 143 143 int reversible; 144 144 u8 numb_path; 145 - u16 pkey; 145 + __be16 pkey; 146 146 /* reserved */ 147 147 u8 sl; 148 148 u8 mtu_selector; ··· 176 176 struct ib_sa_mcmember_rec { 177 177 union ib_gid mgid; 178 178 union ib_gid port_gid; 179 - u32 qkey; 180 - u16 mlid; 179 + __be32 qkey; 180 + __be16 mlid; 181 181 u8 mtu_selector; 182 182 u8 mtu; 183 183 u8 traffic_class; 184 - u16 pkey; 184 + __be16 pkey; 185 185 u8 rate_selector; 186 186 u8 rate; 187 187 u8 packet_life_time_selector; 188 188 u8 packet_life_time; 189 189 u8 sl; 190 - u32 flow_label; 190 + __be32 flow_label; 191 191 u8 hop_limit; 192 192 u8 scope; 193 193 u8 join_state; ··· 238 238 struct ib_sa_service_rec { 239 239 u64 id; 240 240 union ib_gid gid; 241 - u16 pkey; 241 + __be16 pkey; 242 242 /* reserved */ 243 243 u32 lease; 244 244 u8 key[16];
+8 -10
drivers/infiniband/include/ib_smi.h
··· 41 41 42 42 #include <ib_mad.h> 43 43 44 - #define IB_LID_PERMISSIVE 0xFFFF 45 - 46 44 #define IB_SMP_DATA_SIZE 64 47 45 #define IB_SMP_MAX_PATH_HOPS 64 48 46 ··· 49 51 u8 mgmt_class; 50 52 u8 class_version; 51 53 u8 method; 52 - u16 status; 54 + __be16 status; 53 55 u8 hop_ptr; 54 56 u8 hop_cnt; 55 - u64 tid; 56 - u16 attr_id; 57 - u16 resv; 58 - u32 attr_mod; 59 - u64 mkey; 60 - u16 dr_slid; 61 - u16 dr_dlid; 57 + __be64 tid; 58 + __be16 attr_id; 59 + __be16 resv; 60 + __be32 attr_mod; 61 + __be64 mkey; 62 + __be16 dr_slid; 63 + __be16 dr_dlid; 62 64 u8 reserved[28]; 63 65 u8 data[IB_SMP_DATA_SIZE]; 64 66 u8 initial_path[IB_SMP_MAX_PATH_HOPS];
+14 -14
drivers/infiniband/include/ib_user_cm.h
··· 88 88 }; 89 89 90 90 struct ib_ucm_attr_id_resp { 91 - __u64 service_id; 92 - __u64 service_mask; 93 - __u32 local_id; 94 - __u32 remote_id; 91 + __be64 service_id; 92 + __be64 service_mask; 93 + __be32 local_id; 94 + __be32 remote_id; 95 95 }; 96 96 97 97 struct ib_ucm_listen { 98 - __u64 service_id; 99 - __u64 service_mask; 98 + __be64 service_id; 99 + __be64 service_mask; 100 100 __u32 id; 101 101 }; 102 102 ··· 114 114 struct ib_ucm_path_rec { 115 115 __u8 dgid[16]; 116 116 __u8 sgid[16]; 117 - __u16 dlid; 118 - __u16 slid; 117 + __be16 dlid; 118 + __be16 slid; 119 119 __u32 raw_traffic; 120 - __u32 flow_label; 120 + __be32 flow_label; 121 121 __u32 reversible; 122 122 __u32 mtu; 123 - __u16 pkey; 123 + __be16 pkey; 124 124 __u8 hop_limit; 125 125 __u8 traffic_class; 126 126 __u8 numb_path; ··· 138 138 __u32 qpn; 139 139 __u32 qp_type; 140 140 __u32 psn; 141 - __u64 sid; 141 + __be64 sid; 142 142 __u64 data; 143 143 __u64 primary_path; 144 144 __u64 alternate_path; ··· 200 200 struct ib_ucm_sidr_req { 201 201 __u32 id; 202 202 __u32 timeout; 203 - __u64 sid; 203 + __be64 sid; 204 204 __u64 data; 205 205 __u64 path; 206 206 __u16 pkey; ··· 237 237 /* port */ 238 238 struct ib_ucm_path_rec primary_path; 239 239 struct ib_ucm_path_rec alternate_path; 240 - __u64 remote_ca_guid; 240 + __be64 remote_ca_guid; 241 241 __u32 remote_qkey; 242 242 __u32 remote_qpn; 243 243 __u32 qp_type; ··· 253 253 }; 254 254 255 255 struct ib_ucm_rep_event_resp { 256 - __u64 remote_ca_guid; 256 + __be64 remote_ca_guid; 257 257 __u32 remote_qkey; 258 258 __u32 remote_qpn; 259 259 __u32 starting_psn;
+4 -6
drivers/infiniband/include/ib_user_mad.h
··· 70 70 * @traffic_class - Traffic class in GRH 71 71 * @gid - Remote GID in GRH 72 72 * @flow_label - Flow label in GRH 73 - * 74 - * All multi-byte quantities are stored in network (big endian) byte order. 75 73 */ 76 74 struct ib_user_mad_hdr { 77 75 __u32 id; ··· 77 79 __u32 timeout_ms; 78 80 __u32 retries; 79 81 __u32 length; 80 - __u32 qpn; 81 - __u32 qkey; 82 - __u16 lid; 82 + __be32 qpn; 83 + __be32 qkey; 84 + __be16 lid; 83 85 __u8 sl; 84 86 __u8 path_bits; 85 87 __u8 grh_present; ··· 87 89 __u8 hop_limit; 88 90 __u8 traffic_class; 89 91 __u8 gid[16]; 90 - __u32 flow_label; 92 + __be32 flow_label; 91 93 }; 92 94 93 95 /**
+2 -2
drivers/infiniband/include/ib_user_verbs.h
··· 143 143 144 144 struct ib_uverbs_query_device_resp { 145 145 __u64 fw_ver; 146 - __u64 node_guid; 147 - __u64 sys_image_guid; 146 + __be64 node_guid; 147 + __be64 sys_image_guid; 148 148 __u64 max_mr_size; 149 149 __u64 page_size_cap; 150 150 __u32 vendor_id;
+8 -6
drivers/infiniband/include/ib_verbs.h
··· 51 51 union ib_gid { 52 52 u8 raw[16]; 53 53 struct { 54 - u64 subnet_prefix; 55 - u64 interface_id; 54 + __be64 subnet_prefix; 55 + __be64 interface_id; 56 56 } global; 57 57 }; 58 58 ··· 88 88 89 89 struct ib_device_attr { 90 90 u64 fw_ver; 91 - u64 node_guid; 92 - u64 sys_image_guid; 91 + __be64 node_guid; 92 + __be64 sys_image_guid; 93 93 u64 max_mr_size; 94 94 u64 page_size_cap; 95 95 u32 vendor_id; ··· 291 291 }; 292 292 293 293 struct ib_grh { 294 - u32 version_tclass_flow; 295 - u16 paylen; 294 + __be32 version_tclass_flow; 295 + __be16 paylen; 296 296 u8 next_hdr; 297 297 u8 hop_limit; 298 298 union ib_gid sgid; ··· 302 302 enum { 303 303 IB_MULTICAST_QPN = 0xffffff 304 304 }; 305 + 306 + #define IB_LID_PERMISSIVE __constant_htons(0xFFFF) 305 307 306 308 enum ib_ah_flags { 307 309 IB_AH_GRH = 1
+2 -2
drivers/infiniband/ulp/ipoib/ipoib.h
··· 90 90 /* structs */ 91 91 92 92 struct ipoib_header { 93 - u16 proto; 94 - u16 reserved; 93 + __be16 proto; 94 + u16 reserved; 95 95 }; 96 96 97 97 struct ipoib_pseudoheader {
+1 -1
drivers/infiniband/ulp/ipoib/ipoib_fs.c
··· 97 97 98 98 for (n = 0, i = 0; i < sizeof mgid / 2; ++i) { 99 99 n += sprintf(gid_buf + n, "%x", 100 - be16_to_cpu(((u16 *)mgid.raw)[i])); 100 + be16_to_cpu(((__be16 *) mgid.raw)[i])); 101 101 if (i < sizeof mgid / 2 - 1) 102 102 gid_buf[n++] = ':'; 103 103 }
+2 -2
drivers/infiniband/ulp/ipoib/ipoib_main.c
··· 609 609 ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x " 610 610 IPOIB_GID_FMT "\n", 611 611 skb->dst ? "neigh" : "dst", 612 - be16_to_cpup((u16 *) skb->data), 613 - be32_to_cpup((u32 *) phdr->hwaddr), 612 + be16_to_cpup((__be16 *) skb->data), 613 + be32_to_cpup((__be32 *) phdr->hwaddr), 614 614 IPOIB_GID_ARG(*(union ib_gid *) (phdr->hwaddr + 4))); 615 615 dev_kfree_skb_any(skb); 616 616 ++priv->stats.tx_dropped;
+3 -3
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
··· 359 359 360 360 rec.mgid = mcast->mcmember.mgid; 361 361 rec.port_gid = priv->local_gid; 362 - rec.pkey = be16_to_cpu(priv->pkey); 362 + rec.pkey = cpu_to_be16(priv->pkey); 363 363 364 364 ret = ib_sa_mcmember_rec_set(priv->ca, priv->port, &rec, 365 365 IB_SA_MCMEMBER_REC_MGID | ··· 459 459 460 460 rec.mgid = mcast->mcmember.mgid; 461 461 rec.port_gid = priv->local_gid; 462 - rec.pkey = be16_to_cpu(priv->pkey); 462 + rec.pkey = cpu_to_be16(priv->pkey); 463 463 464 464 comp_mask = 465 465 IB_SA_MCMEMBER_REC_MGID | ··· 648 648 649 649 rec.mgid = mcast->mcmember.mgid; 650 650 rec.port_gid = priv->local_gid; 651 - rec.pkey = be16_to_cpu(priv->pkey); 651 + rec.pkey = cpu_to_be16(priv->pkey); 652 652 653 653 /* Remove ourselves from the multicast group */ 654 654 ret = ipoib_mcast_detach(dev, be16_to_cpu(mcast->mcmember.mlid),