1/* 2 * Copyright (c) 2004 Topspin Communications. All rights reserved. 3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved. 4 * 5 * This software is available to you under a choice of one of two 6 * licenses. You may choose to be licensed under the terms of the GNU 7 * General Public License (GPL) Version 2, available from the file 8 * COPYING in the main directory of this source tree, or the 9 * OpenIB.org BSD license below: 10 * 11 * Redistribution and use in source and binary forms, with or 12 * without modification, are permitted provided that the following 13 * conditions are met: 14 * 15 * - Redistributions of source code must retain the above 16 * copyright notice, this list of conditions and the following 17 * disclaimer. 18 * 19 * - Redistributions in binary form must reproduce the above 20 * copyright notice, this list of conditions and the following 21 * disclaimer in the documentation and/or other materials 22 * provided with the distribution. 23 * 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 * SOFTWARE. 32 */ 33 34#ifndef INFINIBAND_SA_H 35#define INFINIBAND_SA_H 36 37#include <infiniband/verbs.h> 38 39struct ibv_sa_path_rec { 40 /* reserved */ 41 /* reserved */ 42 union ibv_gid dgid; 43 union ibv_gid sgid; 44 uint16_t dlid; 45 uint16_t slid; 46 int raw_traffic; 47 /* reserved */ 48 uint32_t flow_label; 49 uint8_t hop_limit; 50 uint8_t traffic_class; 51 int reversible; 52 uint8_t numb_path; 53 uint16_t pkey; 54 /* reserved */ 55 uint8_t sl; 56 uint8_t mtu_selector; 57 uint8_t mtu; 58 uint8_t rate_selector; 59 uint8_t rate; 60 uint8_t packet_life_time_selector; 61 uint8_t packet_life_time; 62 uint8_t preference; 63}; 64 65struct ibv_sa_mcmember_rec { 66 union ibv_gid mgid; 67 union ibv_gid port_gid; 68 uint32_t qkey; 69 uint16_t mlid; 70 uint8_t mtu_selector; 71 uint8_t mtu; 72 uint8_t traffic_class; 73 uint16_t pkey; 74 uint8_t rate_selector; 75 uint8_t rate; 76 uint8_t packet_life_time_selector; 77 uint8_t packet_life_time; 78 uint8_t sl; 79 uint32_t flow_label; 80 uint8_t hop_limit; 81 uint8_t scope; 82 uint8_t join_state; 83 int proxy_join; 84}; 85 86struct ibv_sa_service_rec { 87 uint64_t id; 88 union ibv_gid gid; 89 uint16_t pkey; 90 /* uint16_t resv; */ 91 uint32_t lease; 92 uint8_t key[16]; 93 uint8_t name[64]; 94 uint8_t data8[16]; 95 uint16_t data16[8]; 96 uint32_t data32[4]; 97 uint64_t data64[2]; 98}; 99 100#define IBV_PATH_RECORD_REVERSIBLE 0x80 101 102struct ibv_path_record { 103 uint64_t service_id; 104 union ibv_gid dgid; 105 union ibv_gid sgid; 106 uint16_t dlid; 107 uint16_t slid; 108 uint32_t flowlabel_hoplimit; /* resv-31:28 flow label-27:8 hop limit-7:0*/ 109 uint8_t tclass; 110 uint8_t reversible_numpath; /* reversible-7:7 num path-6:0 */ 111 uint16_t pkey; 112 uint16_t qosclass_sl; /* qos class-15:4 sl-3:0 */ 113 uint8_t mtu; /* mtu selector-7:6 mtu-5:0 */ 114 uint8_t rate; /* rate selector-7:6 rate-5:0 */ 115 uint8_t packetlifetime; /* lifetime selector-7:6 lifetime-5:0 */ 116 uint8_t preference; 117 uint8_t reserved[6]; 118}; 119 120#define IBV_PATH_FLAG_GMP (1<<0) 121#define IBV_PATH_FLAG_PRIMARY (1<<1) 122#define IBV_PATH_FLAG_ALTERNATE (1<<2) 123#define IBV_PATH_FLAG_OUTBOUND (1<<3) 124#define IBV_PATH_FLAG_INBOUND (1<<4) 125#define IBV_PATH_FLAG_INBOUND_REVERSE (1<<5) 126#define IBV_PATH_FLAG_BIDIRECTIONAL (IBV_PATH_FLAG_OUTBOUND | \ 127 IBV_PATH_FLAG_INBOUND_REVERSE) 128 129struct ibv_path_data { 130 uint32_t flags; 131 uint32_t reserved; 132 struct ibv_path_record path; 133}; 134 135#endif /* INFINIBAND_SA_H */ 136