1219820Sjeff/* 2219820Sjeff * Copyright (c) 2005 Cisco Systems. All rights reserved. 3219820Sjeff * 4219820Sjeff * This software is available to you under a choice of one of two 5219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 6219820Sjeff * General Public License (GPL) Version 2, available from the file 7219820Sjeff * COPYING in the main directory of this source tree, or the 8219820Sjeff * OpenIB.org BSD license below: 9219820Sjeff * 10219820Sjeff * Redistribution and use in source and binary forms, with or 11219820Sjeff * without modification, are permitted provided that the following 12219820Sjeff * conditions are met: 13219820Sjeff * 14219820Sjeff * - Redistributions of source code must retain the above 15219820Sjeff * copyright notice, this list of conditions and the following 16219820Sjeff * disclaimer. 17219820Sjeff * 18219820Sjeff * - Redistributions in binary form must reproduce the above 19219820Sjeff * copyright notice, this list of conditions and the following 20219820Sjeff * disclaimer in the documentation and/or other materials 21219820Sjeff * provided with the distribution. 22219820Sjeff * 23219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30219820Sjeff * SOFTWARE. 31219820Sjeff */ 32219820Sjeff 33219820Sjeff#ifndef MTHCA_WQE_H 34219820Sjeff#define MTHCA_WQE_H 35219820Sjeff 36219820Sjeff#include <linux/types.h> 37219820Sjeff 38219820Sjeffenum { 39219820Sjeff MTHCA_NEXT_DBD = 1 << 7, 40219820Sjeff MTHCA_NEXT_FENCE = 1 << 6, 41219820Sjeff MTHCA_NEXT_CQ_UPDATE = 1 << 3, 42219820Sjeff MTHCA_NEXT_EVENT_GEN = 1 << 2, 43219820Sjeff MTHCA_NEXT_SOLICIT = 1 << 1, 44219820Sjeff MTHCA_NEXT_IP_CSUM = 1 << 4, 45219820Sjeff MTHCA_NEXT_TCP_UDP_CSUM = 1 << 5, 46219820Sjeff 47219820Sjeff MTHCA_MLX_VL15 = 1 << 17, 48219820Sjeff MTHCA_MLX_SLR = 1 << 16 49219820Sjeff}; 50219820Sjeff 51219820Sjeffenum { 52219820Sjeff MTHCA_INVAL_LKEY = 0x100, 53219820Sjeff MTHCA_TAVOR_MAX_WQES_PER_RECV_DB = 256, 54219820Sjeff MTHCA_ARBEL_MAX_WQES_PER_SEND_DB = 255 55219820Sjeff}; 56219820Sjeff 57219820Sjeffstruct mthca_next_seg { 58219820Sjeff __be32 nda_op; /* [31:6] next WQE [4:0] next opcode */ 59219820Sjeff __be32 ee_nds; /* [31:8] next EE [7] DBD [6] F [5:0] next WQE size */ 60219820Sjeff __be32 flags; /* [3] CQ [2] Event [1] Solicit */ 61219820Sjeff __be32 imm; /* immediate data */ 62219820Sjeff}; 63219820Sjeff 64219820Sjeffstruct mthca_tavor_ud_seg { 65219820Sjeff u32 reserved1; 66219820Sjeff __be32 lkey; 67219820Sjeff __be64 av_addr; 68219820Sjeff u32 reserved2[4]; 69219820Sjeff __be32 dqpn; 70219820Sjeff __be32 qkey; 71219820Sjeff u32 reserved3[2]; 72219820Sjeff}; 73219820Sjeff 74219820Sjeffstruct mthca_arbel_ud_seg { 75219820Sjeff __be32 av[8]; 76219820Sjeff __be32 dqpn; 77219820Sjeff __be32 qkey; 78219820Sjeff u32 reserved[2]; 79219820Sjeff}; 80219820Sjeff 81219820Sjeffstruct mthca_bind_seg { 82219820Sjeff __be32 flags; /* [31] Atomic [30] rem write [29] rem read */ 83219820Sjeff u32 reserved; 84219820Sjeff __be32 new_rkey; 85219820Sjeff __be32 lkey; 86219820Sjeff __be64 addr; 87219820Sjeff __be64 length; 88219820Sjeff}; 89219820Sjeff 90219820Sjeffstruct mthca_raddr_seg { 91219820Sjeff __be64 raddr; 92219820Sjeff __be32 rkey; 93219820Sjeff u32 reserved; 94219820Sjeff}; 95219820Sjeff 96219820Sjeffstruct mthca_atomic_seg { 97219820Sjeff __be64 swap_add; 98219820Sjeff __be64 compare; 99219820Sjeff}; 100219820Sjeff 101219820Sjeffstruct mthca_data_seg { 102219820Sjeff __be32 byte_count; 103219820Sjeff __be32 lkey; 104219820Sjeff __be64 addr; 105219820Sjeff}; 106219820Sjeff 107219820Sjeffstruct mthca_mlx_seg { 108219820Sjeff __be32 nda_op; 109219820Sjeff __be32 nds; 110219820Sjeff __be32 flags; /* [17] VL15 [16] SLR [14:12] static rate 111219820Sjeff [11:8] SL [3] C [2] E */ 112219820Sjeff __be16 rlid; 113219820Sjeff __be16 vcrc; 114219820Sjeff}; 115219820Sjeff 116219820Sjeffstatic __always_inline void mthca_set_data_seg(struct mthca_data_seg *dseg, 117219820Sjeff struct ib_sge *sg) 118219820Sjeff{ 119219820Sjeff dseg->byte_count = cpu_to_be32(sg->length); 120219820Sjeff dseg->lkey = cpu_to_be32(sg->lkey); 121219820Sjeff dseg->addr = cpu_to_be64(sg->addr); 122219820Sjeff} 123219820Sjeff 124219820Sjeffstatic __always_inline void mthca_set_data_seg_inval(struct mthca_data_seg *dseg) 125219820Sjeff{ 126219820Sjeff dseg->byte_count = 0; 127219820Sjeff dseg->lkey = cpu_to_be32(MTHCA_INVAL_LKEY); 128219820Sjeff dseg->addr = 0; 129219820Sjeff} 130219820Sjeff 131219820Sjeff#endif /* MTHCA_WQE_H */ 132