⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cm_msgs.h

📁 linux-2.6.15.6
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 2004 Intel Corporation.  All rights reserved. * Copyright (c) 2004 Topspin Corporation.  All rights reserved. * Copyright (c) 2004 Voltaire Corporation.  All rights reserved. * * This software is available to you under a choice of one of two * licenses.  You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING the madirectory of this source tree, or the * OpenIB.org BSD license below: * *     Redistribution and use source and binary forms, with or *     withmodification, are permitted provided that the following *     conditions are met: * *      - Redistributions of source code must retathe above *        copyright notice, this list of conditions and the following *        disclaimer. * *      - Redistributions binary form must reproduce the above *        copyright notice, this list of conditions and the following *        disclaimer the documentation and/or other materials *        provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHWARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS THE * SOFTWARE. */#if !defined(CM_MSGS_H)#define CM_MSGS_H#include <rdma/ib_mad.h>/* * Parameters to routines below should be in network-byte order, and values * are returned in network-byte order. */#define IB_CM_CLASS_VERSION	2 /* IB specification 1.2 */#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,	CM_MSG_SEQUENCE_LAP,	CM_MSG_SEQUENCE_DREQ,	CM_MSG_SEQUENCE_SIDR};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, rsvd: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;	u8 private_data[IB_CM_REQ_PRIVATE_DATA_SIZE];} __attribute__ ((packed));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, __be32 qpn){	req_msg->offset32 = cpu_to_be32((be32_to_cpu(qpn) << 8) |					 (be32_to_cpu(req_msg->offset32) &					  0x000000FF));}static inline u8 cm_req_get_resp_res(struct cm_req_msg *req_msg){	return (u8) be32_to_cpu(req_msg->offset32);}static inline void cm_req_set_resp_res(struct cm_req_msg *req_msg, u8 resp_res){	req_msg->offset32 = cpu_to_be32(resp_res |					(be32_to_cpu(req_msg->offset32) &					 0xFFFFFF00));}static inline u8 cm_req_get_init_depth(struct cm_req_msg *req_msg){	return (u8) be32_to_cpu(req_msg->offset36);}static inline void cm_req_set_init_depth(struct cm_req_msg *req_msg,					 u8 init_depth){	req_msg->offset36 = cpu_to_be32(init_depth |					(be32_to_cpu(req_msg->offset36) &					 0xFFFFFF00));}static inline u8 cm_req_get_remote_resp_timeout(struct cm_req_msg *req_msg){	return (u8) ((be32_to_cpu(req_msg->offset40) & 0xF8) >> 3);}static inline void cm_req_set_remote_resp_timeout(struct cm_req_msg *req_msg,						  u8 resp_timeout){	req_msg->offset40 = cpu_to_be32((resp_timeout << 3) |					 (be32_to_cpu(req_msg->offset40) &					  0xFFFFFF07));}static inline enum ib_qp_type cm_req_get_qp_type(struct cm_req_msg *req_msg){	u8 transport_type = (u8) (be32_to_cpu(req_msg->offset40) & 0x06) >> 1;	switch(transport_type) {	case 0: return IB_QPT_RC;	case 1: return IB_QPT_UC;	default: return 0;	}}static inline void cm_req_set_qp_type(struct cm_req_msg *req_msg,				      enum ib_qp_type qp_type){	switch(qp_type) {	case IB_QPT_UC:		req_msg->offset40 = cpu_to_be32((be32_to_cpu(						  req_msg->offset40) &						   0xFFFFFFF9) | 0x2);		break;	default:		req_msg->offset40 = cpu_to_be32(be32_to_cpu(						 req_msg->offset40) &						  0xFFFFFFF9);	}}static inline u8 cm_req_get_flow_ctrl(struct cm_req_msg *req_msg){	return be32_to_cpu(req_msg->offset40) & 0x1;}static inline void cm_req_set_flow_ctrl(struct cm_req_msg *req_msg,					u8 flow_ctrl){	req_msg->offset40 = cpu_to_be32((flow_ctrl & 0x1) |					 (be32_to_cpu(req_msg->offset40) &					  0xFFFFFFFE));}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,					   __be32 starting_psn){	req_msg->offset44 = cpu_to_be32((be32_to_cpu(starting_psn) << 8) |			    (be32_to_cpu(req_msg->offset44) & 0x000000FF));}static inline u8 cm_req_get_local_resp_timeout(struct cm_req_msg *req_msg){	return (u8) ((be32_to_cpu(req_msg->offset44) & 0xF8) >> 3);}static inline void cm_req_set_local_resp_timeout(struct cm_req_msg *req_msg,						 u8 resp_timeout){	req_msg->offset44 = cpu_to_be32((resp_timeout << 3) |			    (be32_to_cpu(req_msg->offset44) & 0xFFFFFF07));}static inline u8 cm_req_get_retry_count(struct cm_req_msg *req_msg){	return (u8) (be32_to_cpu(req_msg->offset44) & 0x7);}static inline void cm_req_set_retry_count(struct cm_req_msg *req_msg,					  u8 retry_count){	req_msg->offset44 = cpu_to_be32((retry_count & 0x7) |			    (be32_to_cpu(req_msg->offset44) & 0xFFFFFFF8));}static inline u8 cm_req_get_path_mtu(struct cm_req_msg *req_msg){	return req_msg->offset50 >> 4;}static inline void cm_req_set_path_mtu(struct cm_req_msg *req_msg, u8 path_mtu){	req_msg->offset50 = (u8) ((req_msg->offset50 & 0xF) | (path_mtu << 4));}static inline u8 cm_req_get_rnr_retry_count(struct cm_req_msg *req_msg){	return req_msg->offset50 & 0x7;}static inline void cm_req_set_rnr_retry_count(struct cm_req_msg *req_msg,					      u8 rnr_retry_count){	req_msg->offset50 = (u8) ((req_msg->offset50 & 0xF8) |				  (rnr_retry_count & 0x7));}static inline u8 cm_req_get_max_cm_retries(struct cm_req_msg *req_msg){	return req_msg->offset51 >> 4;}static inline void cm_req_set_max_cm_retries(struct cm_req_msg *req_msg,					     u8 retries){	req_msg->offset51 = (u8) ((req_msg->offset51 & 0xF) | (retries << 4));}static inline u8 cm_req_get_srq(struct cm_req_msg *req_msg){	return (req_msg->offset51 & 0x8) >> 3;}static inline void cm_req_set_srq(struct cm_req_msg *req_msg, u8 srq){	req_msg->offset51 = (u8) ((req_msg->offset51 & 0xF7) |				  ((srq & 0x1) << 3));}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);}static inline void cm_req_set_primary_flow_label(struct cm_req_msg *req_msg,						 __be32 flow_label){	req_msg->primary_offset88 = cpu_to_be32(				    (be32_to_cpu(req_msg->primary_offset88) &				     0x00000FFF) |				     (be32_to_cpu(flow_label) << 12));}static inline u8 cm_req_get_primary_packet_rate(struct cm_req_msg *req_msg){	return (u8) (be32_to_cpu(req_msg->primary_offset88) & 0x3F);}static inline void cm_req_set_primary_packet_rate(struct cm_req_msg *req_msg,						  u8 rate){	req_msg->primary_offset88 = cpu_to_be32(				    (be32_to_cpu(req_msg->primary_offset88) &				     0xFFFFFFC0) | (rate & 0x3F));}static inline u8 cm_req_get_primary_sl(struct cm_req_msg *req_msg){	return (u8) (req_msg->primary_offset94 >> 4);}static inline void cm_req_set_primary_sl(struct cm_req_msg *req_msg, u8 sl){	req_msg->primary_offset94 = (u8) ((req_msg->primary_offset94 & 0x0F) |					  (sl << 4));}static inline u8 cm_req_get_primary_subnet_local(struct cm_req_msg *req_msg){	return (u8) ((req_msg->primary_offset94 & 0x08) >> 3);}static inline void cm_req_set_primary_subnet_local(struct cm_req_msg *req_msg,						   u8 subnet_local){	req_msg->primary_offset94 = (u8) ((req_msg->primary_offset94 & 0xF7) |					  ((subnet_local & 0x1) << 3));}static inline u8 cm_req_get_primary_local_ack_timeout(struct cm_req_msg *req_msg){	return (u8) (req_msg->primary_offset95 >> 3);}static inline void cm_req_set_primary_local_ack_timeout(struct cm_req_msg *req_msg,							u8 local_ack_timeout){	req_msg->primary_offset95 = (u8) ((req_msg->primary_offset95 & 0x07) |					  (local_ack_timeout << 3));}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);}static inline void cm_req_set_alt_flow_label(struct cm_req_msg *req_msg,					     __be32 flow_label){	req_msg->alt_offset132 = cpu_to_be32(				 (be32_to_cpu(req_msg->alt_offset132) &				  0x00000FFF) |				  (be32_to_cpu(flow_label) << 12));}static inline u8 cm_req_get_alt_packet_rate(struct cm_req_msg *req_msg){	return (u8) (be32_to_cpu(req_msg->alt_offset132) & 0x3F);}static inline void cm_req_set_alt_packet_rate(struct cm_req_msg *req_msg,					      u8 rate){	req_msg->alt_offset132 = cpu_to_be32(				 (be32_to_cpu(req_msg->alt_offset132) &				  0xFFFFFFC0) | (rate & 0x3F));}static inline u8 cm_req_get_alt_sl(struct cm_req_msg *req_msg){	return (u8) (req_msg->alt_offset138 >> 4);}static inline void cm_req_set_alt_sl(struct cm_req_msg *req_msg, u8 sl){	req_msg->alt_offset138 = (u8) ((req_msg->alt_offset138 & 0x0F) |				       (sl << 4));}static inline u8 cm_req_get_alt_subnet_local(struct cm_req_msg *req_msg){	return (u8) ((req_msg->alt_offset138 & 0x08) >> 3);}static inline void cm_req_set_alt_subnet_local(struct cm_req_msg *req_msg,					       u8 subnet_local){	req_msg->alt_offset138 = (u8) ((req_msg->alt_offset138 & 0xF7) |				       ((subnet_local & 0x1) << 3));}static inline u8 cm_req_get_alt_local_ack_timeout(struct cm_req_msg *req_msg){	return (u8) (req_msg->alt_offset139 >> 3);}static inline void cm_req_set_alt_local_ack_timeout(struct cm_req_msg *req_msg,						    u8 local_ack_timeout){	req_msg->alt_offset139 = (u8) ((req_msg->alt_offset139 & 0x07) |

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -