📄 cxio_wr.h
字号:
/* * Copyright (c) 2006 Chelsio, 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 __CXIO_WR_H__#define __CXIO_WR_H__#include <asm/io.h>#include <linux/pci.h>#include <linux/timer.h>#include "firmware_exports.h"#define T3_MAX_SGE 4#define T3_MAX_INLINE 64#define Q_EMPTY(rptr,wptr) ((rptr)==(wptr))#define Q_FULL(rptr,wptr,size_log2) ( (((wptr)-(rptr))>>(size_log2)) && \ ((rptr)!=(wptr)) )#define Q_GENBIT(ptr,size_log2) (!(((ptr)>>size_log2)&0x1))#define Q_FREECNT(rptr,wptr,size_log2) ((1UL<<size_log2)-((wptr)-(rptr)))#define Q_COUNT(rptr,wptr) ((wptr)-(rptr))#define Q_PTR2IDX(ptr,size_log2) (ptr & ((1UL<<size_log2)-1))static inline void ring_doorbell(void __iomem *doorbell, u32 qpid){ writel(((1<<31) | qpid), doorbell);}#define SEQ32_GE(x,y) (!( (((u32) (x)) - ((u32) (y))) & 0x80000000 ))enum t3_wr_flags { T3_COMPLETION_FLAG = 0x01, T3_NOTIFY_FLAG = 0x02, T3_SOLICITED_EVENT_FLAG = 0x04, T3_READ_FENCE_FLAG = 0x08, T3_LOCAL_FENCE_FLAG = 0x10} __attribute__ ((packed));enum t3_wr_opcode { T3_WR_BP = FW_WROPCODE_RI_BYPASS, T3_WR_SEND = FW_WROPCODE_RI_SEND, T3_WR_WRITE = FW_WROPCODE_RI_RDMA_WRITE, T3_WR_READ = FW_WROPCODE_RI_RDMA_READ, T3_WR_INV_STAG = FW_WROPCODE_RI_LOCAL_INV, T3_WR_BIND = FW_WROPCODE_RI_BIND_MW, T3_WR_RCV = FW_WROPCODE_RI_RECEIVE, T3_WR_INIT = FW_WROPCODE_RI_RDMA_INIT, T3_WR_QP_MOD = FW_WROPCODE_RI_MODIFY_QP} __attribute__ ((packed));enum t3_rdma_opcode { T3_RDMA_WRITE, /* IETF RDMAP v1.0 ... */ T3_READ_REQ, T3_READ_RESP, T3_SEND, T3_SEND_WITH_INV, T3_SEND_WITH_SE, T3_SEND_WITH_SE_INV, T3_TERMINATE, T3_RDMA_INIT, /* CHELSIO RI specific ... */ T3_BIND_MW, T3_FAST_REGISTER, T3_LOCAL_INV, T3_QP_MOD, T3_BYPASS} __attribute__ ((packed));static inline enum t3_rdma_opcode wr2opcode(enum t3_wr_opcode wrop){ switch (wrop) { case T3_WR_BP: return T3_BYPASS; case T3_WR_SEND: return T3_SEND; case T3_WR_WRITE: return T3_RDMA_WRITE; case T3_WR_READ: return T3_READ_REQ; case T3_WR_INV_STAG: return T3_LOCAL_INV; case T3_WR_BIND: return T3_BIND_MW; case T3_WR_INIT: return T3_RDMA_INIT; case T3_WR_QP_MOD: return T3_QP_MOD; default: break; } return -1;}/* Work request id */union t3_wrid { struct { u32 hi; u32 low; } id0; u64 id1;};#define WRID(wrid) (wrid.id1)#define WRID_GEN(wrid) (wrid.id0.wr_gen)#define WRID_IDX(wrid) (wrid.id0.wr_idx)#define WRID_LO(wrid) (wrid.id0.wr_lo)struct fw_riwrh { __be32 op_seop_flags; __be32 gen_tid_len;};#define S_FW_RIWR_OP 24#define M_FW_RIWR_OP 0xff#define V_FW_RIWR_OP(x) ((x) << S_FW_RIWR_OP)#define G_FW_RIWR_OP(x) ((((x) >> S_FW_RIWR_OP)) & M_FW_RIWR_OP)#define S_FW_RIWR_SOPEOP 22#define M_FW_RIWR_SOPEOP 0x3#define V_FW_RIWR_SOPEOP(x) ((x) << S_FW_RIWR_SOPEOP)#define S_FW_RIWR_FLAGS 8#define M_FW_RIWR_FLAGS 0x3fffff#define V_FW_RIWR_FLAGS(x) ((x) << S_FW_RIWR_FLAGS)#define G_FW_RIWR_FLAGS(x) ((((x) >> S_FW_RIWR_FLAGS)) & M_FW_RIWR_FLAGS)#define S_FW_RIWR_TID 8#define V_FW_RIWR_TID(x) ((x) << S_FW_RIWR_TID)#define S_FW_RIWR_LEN 0#define V_FW_RIWR_LEN(x) ((x) << S_FW_RIWR_LEN)#define S_FW_RIWR_GEN 31#define V_FW_RIWR_GEN(x) ((x) << S_FW_RIWR_GEN)struct t3_sge { __be32 stag; __be32 len; __be64 to;};/* If num_sgle is zero, flit 5+ contains immediate data.*/struct t3_send_wr { struct fw_riwrh wrh; /* 0 */ union t3_wrid wrid; /* 1 */ u8 rdmaop; /* 2 */ u8 reserved[3]; __be32 rem_stag; __be32 plen; /* 3 */ __be32 num_sgle; struct t3_sge sgl[T3_MAX_SGE]; /* 4+ */};struct t3_local_inv_wr { struct fw_riwrh wrh; /* 0 */ union t3_wrid wrid; /* 1 */ __be32 stag; /* 2 */ __be32 reserved3;};struct t3_rdma_write_wr { struct fw_riwrh wrh; /* 0 */ union t3_wrid wrid; /* 1 */ u8 rdmaop; /* 2 */ u8 reserved[3]; __be32 stag_sink; __be64 to_sink; /* 3 */ __be32 plen; /* 4 */ __be32 num_sgle; struct t3_sge sgl[T3_MAX_SGE]; /* 5+ */};struct t3_rdma_read_wr { struct fw_riwrh wrh; /* 0 */ union t3_wrid wrid; /* 1 */ u8 rdmaop; /* 2 */ u8 reserved[3]; __be32 rem_stag; __be64 rem_to; /* 3 */ __be32 local_stag; /* 4 */ __be32 local_len; __be64 local_to; /* 5 */};enum t3_addr_type { T3_VA_BASED_TO = 0x0, T3_ZERO_BASED_TO = 0x1} __attribute__ ((packed));enum t3_mem_perms { T3_MEM_ACCESS_LOCAL_READ = 0x1, T3_MEM_ACCESS_LOCAL_WRITE = 0x2, T3_MEM_ACCESS_REM_READ = 0x4, T3_MEM_ACCESS_REM_WRITE = 0x8} __attribute__ ((packed));struct t3_bind_mw_wr { struct fw_riwrh wrh; /* 0 */ union t3_wrid wrid; /* 1 */ u16 reserved; /* 2 */ u8 type; u8 perms; __be32 mr_stag; __be32 mw_stag; /* 3 */ __be32 mw_len; __be64 mw_va; /* 4 */ __be32 mr_pbl_addr; /* 5 */ u8 reserved2[3]; u8 mr_pagesz;};struct t3_receive_wr { struct fw_riwrh wrh; /* 0 */ union t3_wrid wrid; /* 1 */ u8 pagesz[T3_MAX_SGE]; __be32 num_sgle; /* 2 */ struct t3_sge sgl[T3_MAX_SGE]; /* 3+ */ __be32 pbl_addr[T3_MAX_SGE];};struct t3_bypass_wr { struct fw_riwrh wrh; union t3_wrid wrid; /* 1 */};struct t3_modify_qp_wr { struct fw_riwrh wrh; /* 0 */ union t3_wrid wrid; /* 1 */ __be32 flags; /* 2 */ __be32 quiesce; /* 2 */ __be32 max_ird; /* 3 */ __be32 max_ord; /* 3 */ __be64 sge_cmd; /* 4 */ __be64 ctx1; /* 5 */ __be64 ctx0; /* 6 */};enum t3_modify_qp_flags { MODQP_QUIESCE = 0x01, MODQP_MAX_IRD = 0x02, MODQP_MAX_ORD = 0x04, MODQP_WRITE_EC = 0x08, MODQP_READ_EC = 0x10,};enum t3_mpa_attrs { uP_RI_MPA_RX_MARKER_ENABLE = 0x1, uP_RI_MPA_TX_MARKER_ENABLE = 0x2, uP_RI_MPA_CRC_ENABLE = 0x4, uP_RI_MPA_IETF_ENABLE = 0x8} __attribute__ ((packed));enum t3_qp_caps { uP_RI_QP_RDMA_READ_ENABLE = 0x01, uP_RI_QP_RDMA_WRITE_ENABLE = 0x02, uP_RI_QP_BIND_ENABLE = 0x04, uP_RI_QP_FAST_REGISTER_ENABLE = 0x08, uP_RI_QP_STAG0_ENABLE = 0x10} __attribute__ ((packed));struct t3_rdma_init_attr { u32 tid; u32 qpid; u32 pdid; u32 scqid; u32 rcqid; u32 rq_addr; u32 rq_size; enum t3_mpa_attrs mpaattrs; enum t3_qp_caps qpcaps; u16 tcp_emss; u32 ord; u32 ird; u64 qp_dma_addr; u32 qp_dma_size; u32 flags; u32 irs;};struct t3_rdma_init_wr { struct fw_riwrh wrh; /* 0 */ union t3_wrid wrid; /* 1 */ __be32 qpid; /* 2 */ __be32 pdid; __be32 scqid; /* 3 */ __be32 rcqid; __be32 rq_addr; /* 4 */ __be32 rq_size; u8 mpaattrs; /* 5 */ u8 qpcaps; __be16 ulpdu_size; __be32 flags; /* bits 31-1 - reservered */ /* bit 0 - set if RECV posted */ __be32 ord; /* 6 */ __be32 ird; __be64 qp_dma_addr; /* 7 */ __be32 qp_dma_size; /* 8 */ u32 irs;};struct t3_genbit { u64 flit[15]; __be64 genbit;};enum rdma_init_wr_flags { RECVS_POSTED = 1,};union t3_wr { struct t3_send_wr send; struct t3_rdma_write_wr write; struct t3_rdma_read_wr read; struct t3_receive_wr recv; struct t3_local_inv_wr local_inv; struct t3_bind_mw_wr bind; struct t3_bypass_wr bypass; struct t3_rdma_init_wr init; struct t3_modify_qp_wr qp_mod; struct t3_genbit genbit; u64 flit[16];};#define T3_SQ_CQE_FLIT 13
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -