c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This file contains definitions used in OFED defined user/kernel
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * interfaces. These are imported from the OFED header ib_user_mad.h. Oracle
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * elects to have and use the contents of ib_user_mad.h under and governed
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * by the OpenIB.org BSD license (see below for full license text). However,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * the following notice accompanied the original version of this file:
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2004 Topspin Communications. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This software is available to you under a choice of one of two
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * licenses. You may choose to be licensed under the terms of the GNU
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * General Public License (GPL) Version 2, available from the file
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * COPYING in the main directory of this source tree, or the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * OpenIB.org BSD license below:
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Redistribution and use in source and binary forms, with or
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * without modification, are permitted provided that the following
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * conditions are met:
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * - Redistributions of source code must retain the above
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * copyright notice, this list of conditions and the following
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * disclaimer.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * - Redistributions in binary form must reproduce the above
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * copyright notice, this list of conditions and the following
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * disclaimer in the documentation and/or other materials
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * provided with the distribution.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * SOFTWARE.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifndef _SYS_IB_CLIENTS_OF_RDMA_IB_USER_MAD_H
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define _SYS_IB_CLIENTS_OF_RDMA_IB_USER_MAD_H
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef __cplusplus
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern "C" {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Increment this value if any changes that break userspace ABI
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * compatibility are made.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define IB_USER_MAD_ABI_VERSION 5
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Make sure that all structs defined in this file remain laid out so
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * that they pack the same way on 32-bit and 64-bit architectures (to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * avoid incompatibility between 32-bit userspace and 64-bit kernels).
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * ib_user_mad_hdr_old - Old version of MAD packet header without pkey_index
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id - ID of agent MAD received with/to be sent with
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @status - 0 on successful receive, ETIMEDOUT if no response
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * received (transaction ID in data[] will be set to TID of original
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * request) (ignored on send)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @timeout_ms - Milliseconds to wait for response (unset on receive)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @retries - Number of automatic retries to attempt
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @qpn - Remote QP number received from/to be sent to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @qkey - Remote Q_Key to be sent with (unset on receive)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @lid - Remote lid received from/to be sent to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @sl - Service level received with/to be sent with
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @path_bits - Local path bits received with/to be sent with
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @grh_present - If set, GRH was received/should be sent
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @gid_index - Local GID index to send with (unset on receive)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @hop_limit - Hop limit in GRH
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @traffic_class - Traffic class in GRH
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @gid - Remote GID in GRH
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @flow_label - Flow label in GRH
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * ib_user_mad_hdr - MAD packet header
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This layout allows specifying/receiving the P_Key index. To use
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * this capability, an application must call the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * IB_USER_MAD_ENABLE_PKEY ioctl on the user MAD file handle before
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * any other actions with the file handle.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id - ID of agent MAD received with/to be sent with
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @status - 0 on successful receive, ETIMEDOUT if no response
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * received (transaction ID in data[] will be set to TID of original
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * request) (ignored on send)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @timeout_ms - Milliseconds to wait for response (unset on receive)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @retries - Number of automatic retries to attempt
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @qpn - Remote QP number received from/to be sent to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @qkey - Remote Q_Key to be sent with (unset on receive)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @lid - Remote lid received from/to be sent to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @sl - Service level received with/to be sent with
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @path_bits - Local path bits received with/to be sent with
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @grh_present - If set, GRH was received/should be sent
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @gid_index - Local GID index to send with (unset on receive)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @hop_limit - Hop limit in GRH
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @traffic_class - Traffic class in GRH
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @gid - Remote GID in GRH
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @flow_label - Flow label in GRH
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_user_mad_hdr {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t status;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t timeout_ms;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t retries;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t length;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t qpn;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t qkey;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t lid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t sl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t path_bits;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t grh_present;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t gid_index;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t hop_limit;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t traffic_class;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t gid[16];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t flow_label;
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn uint16_t pkey_index;
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn uint8_t reserved[6];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * ib_user_mad - MAD packet
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @hdr - MAD packet header
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @data - Contents of MAD
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_user_mad {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_user_mad_hdr hdr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t data[];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * ib_user_mad_reg_req - MAD registration request
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id - Set by the kernel; used to identify agent in future requests.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @qpn - Queue pair number; must be 0 or 1.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @method_mask - The caller will receive unsolicited MADs for any method
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * where @method_mask = 1.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @mgmt_class - Indicates which management class of MADs should be receive
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * by the caller. This field is only required if the user wishes to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * receive unsolicited MADs, otherwise it should be 0.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @mgmt_class_version - Indicates which version of MADs for the given
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * management class to receive.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @oui: Indicates IEEE OUI when mgmt_class is a vendor class
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * in the range from 0x30 to 0x4f. Otherwise not used.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @rmpp_version: If set, indicates the RMPP version used.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_user_mad_reg_req {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t method_mask[4];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t qpn;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t mgmt_class;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t mgmt_class_version;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t oui[3];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t rmpp_version;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define IB_IOCTL_MAGIC 0x1b
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_user_mad_reg_req)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, uint32_t)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3)
448bf8594153765bb5fce82a8888e01e3f6c3badLida.Horn
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef __cplusplus
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar}
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif /* _SYS_IB_CLIENTS_OF_RDMA_IB_USER_MAD_H */