kfree(cm_dev);
}
-/*
- * Check at compile time that the byte offset and length of field old_name in
- * the struct matches the byte offset and length in the new macro.
- */
-#define _IBA_CHECK_OFF(old_name, field_struct, field_offset, mask, bits) \
- static_assert(offsetof(field_struct, old_name) == (field_offset)); \
- static_assert(bits == sizeof(((field_struct *)0)->old_name) * 8)
-#define IBA_CHECK_OFF(field, old_name) _IBA_CHECK_OFF(old_name, field)
-
-IBA_CHECK_OFF(CM_REQ_LOCAL_COMM_ID, local_comm_id);
-IBA_CHECK_OFF(CM_REQ_SERVICE_ID, service_id);
-IBA_CHECK_OFF(CM_REQ_LOCAL_CA_GUID, local_ca_guid);
-IBA_CHECK_OFF(CM_REQ_LOCAL_Q_KEY, local_qkey);
-IBA_CHECK_OFF(CM_REQ_PARTITION_KEY, pkey);
-IBA_CHECK_OFF(CM_REQ_PRIMARY_LOCAL_PORT_LID, primary_local_lid);
-IBA_CHECK_OFF(CM_REQ_PRIMARY_REMOTE_PORT_LID, primary_remote_lid);
-IBA_CHECK_OFF(CM_REQ_PRIMARY_LOCAL_PORT_GID, primary_local_gid);
-IBA_CHECK_OFF(CM_REQ_PRIMARY_REMOTE_PORT_GID, primary_remote_gid);
-IBA_CHECK_OFF(CM_REQ_PRIMARY_TRAFFIC_CLASS, primary_traffic_class);
-IBA_CHECK_OFF(CM_REQ_PRIMARY_HOP_LIMIT, primary_hop_limit);
-IBA_CHECK_OFF(CM_REQ_ALTERNATE_LOCAL_PORT_LID, alt_local_lid);
-IBA_CHECK_OFF(CM_REQ_ALTERNATE_REMOTE_PORT_LID, alt_remote_lid);
-IBA_CHECK_OFF(CM_REQ_ALTERNATE_LOCAL_PORT_GID, alt_local_gid);
-IBA_CHECK_OFF(CM_REQ_ALTERNATE_REMOTE_PORT_GID, alt_remote_gid);
-IBA_CHECK_OFF(CM_REQ_ALTERNATE_TRAFFIC_CLASS, alt_traffic_class);
-IBA_CHECK_OFF(CM_REQ_ALTERNATE_HOP_LIMIT, alt_hop_limit);
-IBA_CHECK_OFF(CM_REQ_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_MRA_LOCAL_COMM_ID, local_comm_id);
-IBA_CHECK_OFF(CM_MRA_REMOTE_COMM_ID, remote_comm_id);
-IBA_CHECK_OFF(CM_MRA_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_REJ_LOCAL_COMM_ID, local_comm_id);
-IBA_CHECK_OFF(CM_REJ_REMOTE_COMM_ID, remote_comm_id);
-IBA_CHECK_OFF(CM_REJ_REASON, reason);
-IBA_CHECK_OFF(CM_REJ_ARI, ari);
-IBA_CHECK_OFF(CM_REJ_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_REP_LOCAL_COMM_ID, local_comm_id);
-IBA_CHECK_OFF(CM_REP_REMOTE_COMM_ID, remote_comm_id);
-IBA_CHECK_OFF(CM_REP_LOCAL_Q_KEY, local_qkey);
-IBA_CHECK_OFF(CM_REP_RESPONDER_RESOURCES, resp_resources);
-IBA_CHECK_OFF(CM_REP_INITIATOR_DEPTH, initiator_depth);
-IBA_CHECK_OFF(CM_REP_LOCAL_CA_GUID, local_ca_guid);
-IBA_CHECK_OFF(CM_REP_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_RTU_LOCAL_COMM_ID, local_comm_id);
-IBA_CHECK_OFF(CM_RTU_REMOTE_COMM_ID, remote_comm_id);
-IBA_CHECK_OFF(CM_RTU_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_DREQ_LOCAL_COMM_ID, local_comm_id);
-IBA_CHECK_OFF(CM_DREQ_REMOTE_COMM_ID, remote_comm_id);
-IBA_CHECK_OFF(CM_DREQ_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_DREP_LOCAL_COMM_ID, local_comm_id);
-IBA_CHECK_OFF(CM_DREP_REMOTE_COMM_ID, remote_comm_id);
-IBA_CHECK_OFF(CM_DREP_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_LAP_LOCAL_COMM_ID, local_comm_id);
-IBA_CHECK_OFF(CM_LAP_REMOTE_COMM_ID, remote_comm_id);
-IBA_CHECK_OFF(CM_LAP_ALTERNATE_LOCAL_PORT_LID, alt_local_lid);
-IBA_CHECK_OFF(CM_LAP_ALTERNATE_REMOTE_PORT_LID, alt_remote_lid);
-IBA_CHECK_OFF(CM_LAP_ALTERNATE_LOCAL_PORT_GID, alt_local_gid);
-IBA_CHECK_OFF(CM_LAP_ALTERNATE_REMOTE_PORT_GID, alt_remote_gid);
-IBA_CHECK_OFF(CM_LAP_ALTERNATE_HOP_LIMIT, alt_hop_limit);
-IBA_CHECK_OFF(CM_LAP_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_APR_LOCAL_COMM_ID, local_comm_id);
-IBA_CHECK_OFF(CM_APR_REMOTE_COMM_ID, remote_comm_id);
-IBA_CHECK_OFF(CM_APR_ADDITIONAL_INFORMATION_LENGTH, info_length);
-IBA_CHECK_OFF(CM_APR_AR_STATUS, ap_status);
-IBA_CHECK_OFF(CM_APR_ADDITIONAL_INFORMATION, info);
-IBA_CHECK_OFF(CM_APR_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_SIDR_REQ_REQUESTID, request_id);
-IBA_CHECK_OFF(CM_SIDR_REQ_PARTITION_KEY, pkey);
-IBA_CHECK_OFF(CM_SIDR_REQ_SERVICEID, service_id);
-IBA_CHECK_OFF(CM_SIDR_REQ_PRIVATE_DATA, private_data);
-IBA_CHECK_OFF(CM_SIDR_REP_REQUESTID, request_id);
-IBA_CHECK_OFF(CM_SIDR_REP_STATUS, status);
-IBA_CHECK_OFF(CM_SIDR_REP_ADDITIONAL_INFORMATION_LENGTH, info_length);
-IBA_CHECK_OFF(CM_SIDR_REP_SERVICEID, service_id);
-IBA_CHECK_OFF(CM_SIDR_REP_Q_KEY, qkey);
-IBA_CHECK_OFF(CM_SIDR_REP_ADDITIONAL_INFORMATION, info);
-IBA_CHECK_OFF(CM_SIDR_REP_PRIVATE_DATA, private_data);
-
static int __init ib_cm_init(void)
{
int ret;
#define IB_CM_CLASS_VERSION 2 /* IB specification 1.2 */
-struct cm_req_msg {
- struct ib_mad_hdr hdr;
-
- __be32 local_comm_id;
- __be32 rsvd4;
- __be64 service_id;
- __be64 local_ca_guid;
- __be32 rsvd24;
- __be32 local_qkey;
- /* local QPN:24, responder resources:8 */
- __be32 offset32;
- /* local EECN:24, initiator depth:8 */
- __be32 offset36;
- /*
- * remote EECN:24, remote CM response timeout:5,
- * transport service type:2, end-to-end flow control:1
- */
- __be32 offset40;
- /* starting PSN:24, local CM response timeout:5, retry count:3 */
- __be32 offset44;
- __be16 pkey;
- /* path MTU:4, RDC exists:1, RNR retry count:3. */
- u8 offset50;
- /* max CM Retries:4, SRQ:1, extended transport type:3 */
- u8 offset51;
-
- __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 */
- __be32 primary_offset88;
- u8 primary_traffic_class;
- u8 primary_hop_limit;
- /* SL:4, subnet local:1, rsvd:3 */
- u8 primary_offset94;
- /* local ACK timeout:5, rsvd:3 */
- u8 primary_offset95;
-
- __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 */
- __be32 alt_offset132;
- u8 alt_traffic_class;
- u8 alt_hop_limit;
- /* SL:4, subnet local:1, rsvd:3 */
- u8 alt_offset138;
- /* local ACK timeout:5, rsvd:3 */
- u8 alt_offset139;
-
- u32 private_data[IB_CM_REQ_PRIVATE_DATA_SIZE / sizeof(u32)];
-
-} __packed;
-
static inline enum ib_qp_type cm_req_get_qp_type(struct cm_req_msg *req_msg)
{
u8 transport_type = IBA_GET(CM_REQ_TRANSPORT_SERVICE_TYPE, req_msg);
CM_MSG_RESPONSE_OTHER = 0x2
};
- struct cm_mra_msg {
- struct ib_mad_hdr hdr;
-
- __be32 local_comm_id;
- __be32 remote_comm_id;
- /* message MRAed:2, rsvd:6 */
- u8 offset8;
- /* service timeout:5, rsvd:3 */
- u8 offset9;
-
- u8 private_data[IB_CM_MRA_PRIVATE_DATA_SIZE];
-
-} __packed;
-
-struct cm_rej_msg {
- struct ib_mad_hdr hdr;
-
- __be32 local_comm_id;
- __be32 remote_comm_id;
- /* message REJected:2, rsvd:6 */
- u8 offset8;
- /* reject info length:7, rsvd:1. */
- u8 offset9;
- __be16 reason;
- u8 ari[IB_CM_REJ_ARI_LENGTH];
-
- u8 private_data[IB_CM_REJ_PRIVATE_DATA_SIZE];
-
-} __packed;
-
-struct cm_rep_msg {
- struct ib_mad_hdr hdr;
-
- __be32 local_comm_id;
- __be32 remote_comm_id;
- __be32 local_qkey;
- /* local QPN:24, rsvd:8 */
- __be32 offset12;
- /* local EECN:24, rsvd:8 */
- __be32 offset16;
- /* starting PSN:24 rsvd:8 */
- __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;
- __be64 local_ca_guid;
-
- u8 private_data[IB_CM_REP_PRIVATE_DATA_SIZE];
-
-} __packed;
-
static inline __be32 cm_rep_get_qpn(struct cm_rep_msg *rep_msg, enum ib_qp_type qp_type)
{
return (qp_type == IB_QPT_XRC_INI) ?
cpu_to_be32(IBA_GET(CM_REP_LOCAL_QPN, rep_msg));
}
-struct cm_rtu_msg {
- struct ib_mad_hdr hdr;
-
- __be32 local_comm_id;
- __be32 remote_comm_id;
-
- u8 private_data[IB_CM_RTU_PRIVATE_DATA_SIZE];
-
-} __packed;
-
-struct cm_dreq_msg {
- struct ib_mad_hdr hdr;
-
- __be32 local_comm_id;
- __be32 remote_comm_id;
- /* remote QPN/EECN:24, rsvd:8 */
- __be32 offset8;
-
- u8 private_data[IB_CM_DREQ_PRIVATE_DATA_SIZE];
-
-} __packed;
-
-struct cm_drep_msg {
- struct ib_mad_hdr hdr;
-
- __be32 local_comm_id;
- __be32 remote_comm_id;
-
- u8 private_data[IB_CM_DREP_PRIVATE_DATA_SIZE];
-
-} __packed;
-
-struct cm_lap_msg {
- struct ib_mad_hdr hdr;
-
- __be32 local_comm_id;
- __be32 remote_comm_id;
-
- __be32 rsvd8;
- /* remote QPN/EECN:24, remote CM response timeout:5, rsvd:3 */
- __be32 offset12;
- __be32 rsvd16;
-
- __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 */
- __be32 offset56;
- u8 alt_hop_limit;
- /* rsvd:2, packet rate:6 */
- u8 offset61;
- /* SL:4, subnet local:1, rsvd:3 */
- u8 offset62;
- /* local ACK timeout:5, rsvd:3 */
- u8 offset63;
-
- u8 private_data[IB_CM_LAP_PRIVATE_DATA_SIZE];
-} __packed;
-
-struct cm_apr_msg {
- struct ib_mad_hdr hdr;
-
- __be32 local_comm_id;
- __be32 remote_comm_id;
-
- u8 info_length;
- u8 ap_status;
- __be16 rsvd;
- u8 info[IB_CM_APR_INFO_LENGTH];
-
- u8 private_data[IB_CM_APR_PRIVATE_DATA_SIZE];
-} __packed;
-
-struct cm_sidr_req_msg {
- struct ib_mad_hdr hdr;
-
- __be32 request_id;
- __be16 pkey;
- __be16 rsvd;
- __be64 service_id;
-
- u32 private_data[IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE / sizeof(u32)];
-} __packed;
-
-struct cm_sidr_rep_msg {
- struct ib_mad_hdr hdr;
-
- __be32 request_id;
- u8 status;
- u8 info_length;
- __be16 rsvd;
- /* QPN:24, rsvd:8 */
- __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];
-} __packed;
-
#endif /* CM_MSGS_H */