Path: blob/master/drivers/infiniband/hw/ehca/ehca_qes.h
15112 views
/*1* IBM eServer eHCA Infiniband device driver for Linux on POWER2*3* Hardware request structures4*5* Authors: Waleri Fomin <[email protected]>6* Reinhard Ernst <[email protected]>7* Christoph Raisch <[email protected]>8*9* Copyright (c) 2005 IBM Corporation10*11* All rights reserved.12*13* This source code is distributed under a dual license of GPL v2.0 and OpenIB14* BSD.15*16* OpenIB BSD License17*18* Redistribution and use in source and binary forms, with or without19* modification, are permitted provided that the following conditions are met:20*21* Redistributions of source code must retain the above copyright notice, this22* list of conditions and the following disclaimer.23*24* Redistributions in binary form must reproduce the above copyright notice,25* this list of conditions and the following disclaimer in the documentation26* and/or other materials27* provided with the distribution.28*29* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"30* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE31* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE32* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE33* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR34* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF35* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR36* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER37* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)38* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE39* POSSIBILITY OF SUCH DAMAGE.40*/414243#ifndef _EHCA_QES_H_44#define _EHCA_QES_H_4546#include "ehca_tools.h"4748/* virtual scatter gather entry to specify remote addresses with length */49struct ehca_vsgentry {50u64 vaddr;51u32 lkey;52u32 length;53};5455#define GRH_FLAG_MASK EHCA_BMASK_IBM( 7, 7)56#define GRH_IPVERSION_MASK EHCA_BMASK_IBM( 0, 3)57#define GRH_TCLASS_MASK EHCA_BMASK_IBM( 4, 12)58#define GRH_FLOWLABEL_MASK EHCA_BMASK_IBM(13, 31)59#define GRH_PAYLEN_MASK EHCA_BMASK_IBM(32, 47)60#define GRH_NEXTHEADER_MASK EHCA_BMASK_IBM(48, 55)61#define GRH_HOPLIMIT_MASK EHCA_BMASK_IBM(56, 63)6263/*64* Unreliable Datagram Address Vector Format65* see IBTA Vol1 chapter 8.3 Global Routing Header66*/67struct ehca_ud_av {68u8 sl;69u8 lnh;70u16 dlid;71u8 reserved1;72u8 reserved2;73u8 reserved3;74u8 slid_path_bits;75u8 reserved4;76u8 ipd;77u8 reserved5;78u8 pmtu;79u32 reserved6;80u64 reserved7;81union {82struct {83u64 word_0; /* always set to 6 */84/*should be 0x1B for IB transport */85u64 word_1;86u64 word_2;87u64 word_3;88u64 word_4;89} grh;90struct {91u32 wd_0;92u32 wd_1;93/* DWord_1 --> SGID */9495u32 sgid_wd3;96u32 sgid_wd2;9798u32 sgid_wd1;99u32 sgid_wd0;100/* DWord_3 --> DGID */101102u32 dgid_wd3;103u32 dgid_wd2;104105u32 dgid_wd1;106u32 dgid_wd0;107} grh_l;108};109};110111/* maximum number of sg entries allowed in a WQE */112#define MAX_WQE_SG_ENTRIES 252113114#define WQE_OPTYPE_SEND 0x80115#define WQE_OPTYPE_RDMAREAD 0x40116#define WQE_OPTYPE_RDMAWRITE 0x20117#define WQE_OPTYPE_CMPSWAP 0x10118#define WQE_OPTYPE_FETCHADD 0x08119#define WQE_OPTYPE_BIND 0x04120121#define WQE_WRFLAG_REQ_SIGNAL_COM 0x80122#define WQE_WRFLAG_FENCE 0x40123#define WQE_WRFLAG_IMM_DATA_PRESENT 0x20124#define WQE_WRFLAG_SOLIC_EVENT 0x10125126#define WQEF_CACHE_HINT 0x80127#define WQEF_CACHE_HINT_RD_WR 0x40128#define WQEF_TIMED_WQE 0x20129#define WQEF_PURGE 0x08130#define WQEF_HIGH_NIBBLE 0xF0131132#define MW_BIND_ACCESSCTRL_R_WRITE 0x40133#define MW_BIND_ACCESSCTRL_R_READ 0x20134#define MW_BIND_ACCESSCTRL_R_ATOMIC 0x10135136struct ehca_wqe {137u64 work_request_id;138u8 optype;139u8 wr_flag;140u16 pkeyi;141u8 wqef;142u8 nr_of_data_seg;143u16 wqe_provided_slid;144u32 destination_qp_number;145u32 resync_psn_sqp;146u32 local_ee_context_qkey;147u32 immediate_data;148union {149struct {150u64 remote_virtual_address;151u32 rkey;152u32 reserved;153u64 atomic_1st_op_dma_len;154u64 atomic_2nd_op;155struct ehca_vsgentry sg_list[MAX_WQE_SG_ENTRIES];156157} nud;158struct {159u64 ehca_ud_av_ptr;160u64 reserved1;161u64 reserved2;162u64 reserved3;163struct ehca_vsgentry sg_list[MAX_WQE_SG_ENTRIES];164} ud_avp;165struct {166struct ehca_ud_av ud_av;167struct ehca_vsgentry sg_list[MAX_WQE_SG_ENTRIES -1682];169} ud_av;170struct {171u64 reserved0;172u64 reserved1;173u64 reserved2;174u64 reserved3;175struct ehca_vsgentry sg_list[MAX_WQE_SG_ENTRIES];176} all_rcv;177178struct {179u64 reserved;180u32 rkey;181u32 old_rkey;182u64 reserved1;183u64 reserved2;184u64 virtual_address;185u32 reserved3;186u32 length;187u32 reserved4;188u16 reserved5;189u8 reserved6;190u8 lr_ctl;191u32 lkey;192u32 reserved7;193u64 reserved8;194u64 reserved9;195u64 reserved10;196u64 reserved11;197} bind;198struct {199u64 reserved12;200u64 reserved13;201u32 size;202u32 start;203} inline_data;204} u;205206};207208#define WC_SEND_RECEIVE EHCA_BMASK_IBM(0, 0)209#define WC_IMM_DATA EHCA_BMASK_IBM(1, 1)210#define WC_GRH_PRESENT EHCA_BMASK_IBM(2, 2)211#define WC_SE_BIT EHCA_BMASK_IBM(3, 3)212#define WC_STATUS_ERROR_BIT 0x80000000213#define WC_STATUS_REMOTE_ERROR_FLAGS 0x0000F800214#define WC_STATUS_PURGE_BIT 0x10215#define WC_SEND_RECEIVE_BIT 0x80216217struct ehca_cqe {218u64 work_request_id;219u8 optype;220u8 w_completion_flags;221u16 reserved1;222u32 nr_bytes_transferred;223u32 immediate_data;224u32 local_qp_number;225u8 freed_resource_count;226u8 service_level;227u16 wqe_count;228u32 qp_token;229u32 qkey_ee_token;230u32 remote_qp_number;231u16 dlid;232u16 rlid;233u16 reserved2;234u16 pkey_index;235u32 cqe_timestamp;236u32 wqe_timestamp;237u8 wqe_timestamp_valid;238u8 reserved3;239u8 reserved4;240u8 cqe_flags;241u32 status;242};243244struct ehca_eqe {245u64 entry;246};247248struct ehca_mrte {249u64 starting_va;250u64 length; /* length of memory region in bytes*/251u32 pd;252u8 key_instance;253u8 pagesize;254u8 mr_control;255u8 local_remote_access_ctrl;256u8 reserved[0x20 - 0x18];257u64 at_pointer[4];258};259#endif /*_EHCA_QES_H_*/260261262