📄 c2_wr.h
字号:
/* * Copyright (c) 2005 Ammasso, Inc. All rights reserved. * Copyright (c) 2005 Open Grid Computing, Inc. 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 in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */#ifndef _C2_WR_H_#define _C2_WR_H_#ifdef CCDEBUG#define CCWR_MAGIC 0xb07700b0#endif#define C2_QP_NO_ATTR_CHANGE 0xFFFFFFFF/* Maximum allowed size in bytes of private_data exchange * on connect. */#define C2_MAX_PRIVATE_DATA_SIZE 200/* * These types are shared among the adapter, host, and CCIL consumer. */enum c2_cq_notification_type { C2_CQ_NOTIFICATION_TYPE_NONE = 1, C2_CQ_NOTIFICATION_TYPE_NEXT, C2_CQ_NOTIFICATION_TYPE_NEXT_SE};enum c2_setconfig_cmd { C2_CFG_ADD_ADDR = 1, C2_CFG_DEL_ADDR = 2, C2_CFG_ADD_ROUTE = 3, C2_CFG_DEL_ROUTE = 4};enum c2_getconfig_cmd { C2_GETCONFIG_ROUTES = 1, C2_GETCONFIG_ADDRS};/* * CCIL Work Request Identifiers */enum c2wr_ids { CCWR_RNIC_OPEN = 1, CCWR_RNIC_QUERY, CCWR_RNIC_SETCONFIG, CCWR_RNIC_GETCONFIG, CCWR_RNIC_CLOSE, CCWR_CQ_CREATE, CCWR_CQ_QUERY, CCWR_CQ_MODIFY, CCWR_CQ_DESTROY, CCWR_QP_CONNECT, CCWR_PD_ALLOC, CCWR_PD_DEALLOC, CCWR_SRQ_CREATE, CCWR_SRQ_QUERY, CCWR_SRQ_MODIFY, CCWR_SRQ_DESTROY, CCWR_QP_CREATE, CCWR_QP_QUERY, CCWR_QP_MODIFY, CCWR_QP_DESTROY, CCWR_NSMR_STAG_ALLOC, CCWR_NSMR_REGISTER, CCWR_NSMR_PBL, CCWR_STAG_DEALLOC, CCWR_NSMR_REREGISTER, CCWR_SMR_REGISTER, CCWR_MR_QUERY, CCWR_MW_ALLOC, CCWR_MW_QUERY, CCWR_EP_CREATE, CCWR_EP_GETOPT, CCWR_EP_SETOPT, CCWR_EP_DESTROY, CCWR_EP_BIND, CCWR_EP_CONNECT, CCWR_EP_LISTEN, CCWR_EP_SHUTDOWN, CCWR_EP_LISTEN_CREATE, CCWR_EP_LISTEN_DESTROY, CCWR_EP_QUERY, CCWR_CR_ACCEPT, CCWR_CR_REJECT, CCWR_CONSOLE, CCWR_TERM, CCWR_FLASH_INIT, CCWR_FLASH, CCWR_BUF_ALLOC, CCWR_BUF_FREE, CCWR_FLASH_WRITE, CCWR_INIT, /* WARNING: Don't move this ever again! */ /* Add new IDs here */ /* * WARNING: CCWR_LAST must always be the last verbs id defined! * All the preceding IDs are fixed, and must not change. * You can add new IDs, but must not remove or reorder * any IDs. If you do, YOU will ruin any hope of * compatability between versions. */ CCWR_LAST, /* * Start over at 1 so that arrays indexed by user wr id's * begin at 1. This is OK since the verbs and user wr id's * are always used on disjoint sets of queues. */ /* * The order of the CCWR_SEND_XX verbs must * match the order of the RDMA_OPs */ CCWR_SEND = 1, CCWR_SEND_INV, CCWR_SEND_SE, CCWR_SEND_SE_INV, CCWR_RDMA_WRITE, CCWR_RDMA_READ, CCWR_RDMA_READ_INV, CCWR_MW_BIND, CCWR_NSMR_FASTREG, CCWR_STAG_INVALIDATE, CCWR_RECV, CCWR_NOP, CCWR_UNIMPL,/* WARNING: This must always be the last user wr id defined! */};#define RDMA_SEND_OPCODE_FROM_WR_ID(x) (x+2)/* * SQ/RQ Work Request Types */enum c2_wr_type { C2_WR_TYPE_SEND = CCWR_SEND, C2_WR_TYPE_SEND_SE = CCWR_SEND_SE, C2_WR_TYPE_SEND_INV = CCWR_SEND_INV, C2_WR_TYPE_SEND_SE_INV = CCWR_SEND_SE_INV, C2_WR_TYPE_RDMA_WRITE = CCWR_RDMA_WRITE, C2_WR_TYPE_RDMA_READ = CCWR_RDMA_READ, C2_WR_TYPE_RDMA_READ_INV_STAG = CCWR_RDMA_READ_INV, C2_WR_TYPE_BIND_MW = CCWR_MW_BIND, C2_WR_TYPE_FASTREG_NSMR = CCWR_NSMR_FASTREG, C2_WR_TYPE_INV_STAG = CCWR_STAG_INVALIDATE, C2_WR_TYPE_RECV = CCWR_RECV, C2_WR_TYPE_NOP = CCWR_NOP,};struct c2_netaddr { u32 ip_addr; u32 netmask; u32 mtu;};struct c2_route { u32 ip_addr; /* 0 indicates the default route */ u32 netmask; /* netmask associated with dst */ u32 flags; union { u32 ipaddr; /* address of the nexthop interface */ u8 enaddr[6]; } nexthop;};/* * A Scatter Gather Entry. */struct c2_data_addr { u32 stag; u32 length; u64 to;};/* * MR and MW flags used by the consumer, RI, and RNIC. */enum c2_mm_flags { MEM_REMOTE = 0x0001, /* allow mw binds with remote access. */ MEM_VA_BASED = 0x0002, /* Not Zero-based */ MEM_PBL_COMPLETE = 0x0004, /* PBL array is complete in this msg */ MEM_LOCAL_READ = 0x0008, /* allow local reads */ MEM_LOCAL_WRITE = 0x0010, /* allow local writes */ MEM_REMOTE_READ = 0x0020, /* allow remote reads */ MEM_REMOTE_WRITE = 0x0040, /* allow remote writes */ MEM_WINDOW_BIND = 0x0080, /* binds allowed */ MEM_SHARED = 0x0100, /* set if MR is shared */ MEM_STAG_VALID = 0x0200 /* set if STAG is in valid state */};/* * CCIL API ACF flags defined in terms of the low level mem flags. * This minimizes translation needed in the user API */enum c2_acf { C2_ACF_LOCAL_READ = MEM_LOCAL_READ, C2_ACF_LOCAL_WRITE = MEM_LOCAL_WRITE, C2_ACF_REMOTE_READ = MEM_REMOTE_READ, C2_ACF_REMOTE_WRITE = MEM_REMOTE_WRITE, C2_ACF_WINDOW_BIND = MEM_WINDOW_BIND};/* * Image types of objects written to flash */#define C2_FLASH_IMG_BITFILE 1#define C2_FLASH_IMG_OPTION_ROM 2#define C2_FLASH_IMG_VPD 3/* * to fix bug 1815 we define the max size allowable of the * terminate message (per the IETF spec).Refer to the IETF * protocal specification, section 12.1.6, page 64) * The message is prefixed by 20 types of DDP info. * * Then the message has 6 bytes for the terminate control * and DDP segment length info plus a DDP header (either * 14 or 18 byts) plus 28 bytes for the RDMA header. * Thus the max size in: * 20 + (6 + 18 + 28) = 72 */#define C2_MAX_TERMINATE_MESSAGE_SIZE (72)/* * Build String Length. It must be the same as C2_BUILD_STR_LEN in ccil_api.h */#define WR_BUILD_STR_LEN 64/* * WARNING: All of these structs need to align any 64bit types on * 64 bit boundaries! 64bit types include u64 and u64. *//* * Clustercore Work Request Header. Be sensitive to field layout * and alignment. */struct c2wr_hdr { /* wqe_count is part of the cqe. It is put here so the * adapter can write to it while the wr is pending without * clobbering part of the wr. This word need not be dma'd * from the host to adapter by libccil, but we copy it anyway * to make the memcpy to the adapter better aligned. */ u32 wqe_count; /* Put these fields next so that later 32- and 64-bit * quantities are naturally aligned. */ u8 id; u8 result; /* adapter -> host */ u8 sge_count; /* host -> adapter */ u8 flags; /* host -> adapter */ u64 context;#ifdef CCMSGMAGIC u32 magic; u32 pad;#endif} __attribute__((packed));/* *------------------------ RNIC ------------------------ *//* * WR_RNIC_OPEN *//* * Flags for the RNIC WRs */enum c2_rnic_flags { RNIC_IRD_STATIC = 0x0001, RNIC_ORD_STATIC = 0x0002, RNIC_QP_STATIC = 0x0004, RNIC_SRQ_SUPPORTED = 0x0008, RNIC_PBL_BLOCK_MODE = 0x0010, RNIC_SRQ_MODEL_ARRIVAL = 0x0020, RNIC_CQ_OVF_DETECTED = 0x0040, RNIC_PRIV_MODE = 0x0080};struct c2wr_rnic_open_req { struct c2wr_hdr hdr; u64 user_context; u16 flags; /* See enum c2_rnic_flags */ u16 port_num;} __attribute__((packed));struct c2wr_rnic_open_rep { struct c2wr_hdr hdr; u32 rnic_handle;} __attribute__((packed));union c2wr_rnic_open { struct c2wr_rnic_open_req req; struct c2wr_rnic_open_rep rep;} __attribute__((packed));struct c2wr_rnic_query_req { struct c2wr_hdr hdr; u32 rnic_handle;} __attribute__((packed));/* * WR_RNIC_QUERY */struct c2wr_rnic_query_rep { struct c2wr_hdr hdr; u64 user_context; u32 vendor_id; u32 part_number; u32 hw_version; u32 fw_ver_major; u32 fw_ver_minor; u32 fw_ver_patch; char fw_ver_build_str[WR_BUILD_STR_LEN]; u32 max_qps; u32 max_qp_depth; u32 max_srq_depth; u32 max_send_sgl_depth; u32 max_rdma_sgl_depth; u32 max_cqs; u32 max_cq_depth; u32 max_cq_event_handlers; u32 max_mrs; u32 max_pbl_depth; u32 max_pds; u32 max_global_ird; u32 max_global_ord; u32 max_qp_ird; u32 max_qp_ord; u32 flags; u32 max_mws; u32 pbe_range_low; u32 pbe_range_high; u32 max_srqs; u32 page_size;} __attribute__((packed));union c2wr_rnic_query { struct c2wr_rnic_query_req req; struct c2wr_rnic_query_rep rep;} __attribute__((packed));/* * WR_RNIC_GETCONFIG */struct c2wr_rnic_getconfig_req { struct c2wr_hdr hdr; u32 rnic_handle; u32 option; /* see c2_getconfig_cmd_t */ u64 reply_buf; u32 reply_buf_len;} __attribute__((packed)) ;struct c2wr_rnic_getconfig_rep { struct c2wr_hdr hdr; u32 option; /* see c2_getconfig_cmd_t */ u32 count_len; /* length of the number of addresses configured */} __attribute__((packed)) ;union c2wr_rnic_getconfig { struct c2wr_rnic_getconfig_req req; struct c2wr_rnic_getconfig_rep rep;} __attribute__((packed)) ;/* * WR_RNIC_SETCONFIG */struct c2wr_rnic_setconfig_req { struct c2wr_hdr hdr; u32 rnic_handle; u32 option; /* See c2_setconfig_cmd_t */ /* variable data and pad. See c2_netaddr and c2_route */ u8 data[0];} __attribute__((packed)) ;struct c2wr_rnic_setconfig_rep { struct c2wr_hdr hdr;} __attribute__((packed)) ;union c2wr_rnic_setconfig { struct c2wr_rnic_setconfig_req req; struct c2wr_rnic_setconfig_rep rep;} __attribute__((packed)) ;/* * WR_RNIC_CLOSE */struct c2wr_rnic_close_req { struct c2wr_hdr hdr; u32 rnic_handle;} __attribute__((packed)) ;struct c2wr_rnic_close_rep { struct c2wr_hdr hdr;} __attribute__((packed)) ;union c2wr_rnic_close { struct c2wr_rnic_close_req req; struct c2wr_rnic_close_rep rep;} __attribute__((packed)) ;/* *------------------------ CQ ------------------------ */struct c2wr_cq_create_req { struct c2wr_hdr hdr; u64 shared_ht; u64 user_context; u64 msg_pool; u32 rnic_handle; u32 msg_size; u32 depth;} __attribute__((packed)) ;struct c2wr_cq_create_rep { struct c2wr_hdr hdr; u32 mq_index; u32 adapter_shared; u32 cq_handle;} __attribute__((packed)) ;union c2wr_cq_create { struct c2wr_cq_create_req req; struct c2wr_cq_create_rep rep;} __attribute__((packed)) ;struct c2wr_cq_modify_req { struct c2wr_hdr hdr; u32 rnic_handle; u32 cq_handle; u32 new_depth; u64 new_msg_pool;} __attribute__((packed)) ;struct c2wr_cq_modify_rep { struct c2wr_hdr hdr;} __attribute__((packed)) ;union c2wr_cq_modify { struct c2wr_cq_modify_req req; struct c2wr_cq_modify_rep rep;} __attribute__((packed)) ;struct c2wr_cq_destroy_req { struct c2wr_hdr hdr; u32 rnic_handle; u32 cq_handle;} __attribute__((packed)) ;struct c2wr_cq_destroy_rep { struct c2wr_hdr hdr;} __attribute__((packed)) ;union c2wr_cq_destroy { struct c2wr_cq_destroy_req req; struct c2wr_cq_destroy_rep rep;} __attribute__((packed)) ;/* *------------------------ PD ------------------------ */struct c2wr_pd_alloc_req { struct c2wr_hdr hdr; u32 rnic_handle; u32 pd_id;} __attribute__((packed)) ;struct c2wr_pd_alloc_rep { struct c2wr_hdr hdr;} __attribute__((packed)) ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -