Path: blob/main/sys/ofed/include/uapi/rdma/mlx5-abi.h
39488 views
/*-1* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.02*3* Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.4*5* This software is available to you under a choice of one of two6* licenses. You may choose to be licensed under the terms of the GNU7* General Public License (GPL) Version 2, available from the file8* COPYING in the main directory of this source tree, or the9* OpenIB.org BSD license below:10*11* Redistribution and use in source and binary forms, with or12* without modification, are permitted provided that the following13* conditions are met:14*15* - Redistributions of source code must retain the above16* copyright notice, this list of conditions and the following17* disclaimer.18*19* - Redistributions in binary form must reproduce the above20* copyright notice, this list of conditions and the following21* disclaimer in the documentation and/or other materials22* 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 OF26* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND27* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS28* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN29* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN30* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE31* SOFTWARE.32*/3334#ifndef MLX5_ABI_USER_H35#define MLX5_ABI_USER_H3637#ifdef _KERNEL38#include <linux/types.h>39#else40#include <infiniband/types.h>41#endif4243enum {44MLX5_QP_FLAG_SIGNATURE = 1 << 0,45MLX5_QP_FLAG_SCATTER_CQE = 1 << 1,46MLX5_QP_FLAG_BFREG_INDEX = 1 << 3,47MLX5_QP_FLAG_UAR_PAGE_INDEX = 1 << 10,48};4950enum {51MLX5_SRQ_FLAG_SIGNATURE = 1 << 0,52};5354enum {55MLX5_WQ_FLAG_SIGNATURE = 1 << 0,56};5758/* Increment this value if any changes that break userspace ABI59* compatibility are made.60*/61#define MLX5_IB_UVERBS_ABI_VERSION 16263/* Make sure that all structs defined in this file remain laid out so64* that they pack the same way on 32-bit and 64-bit architectures (to65* avoid incompatibility between 32-bit userspace and 64-bit kernels).66* In particular do not use pointer types -- pass pointers in __u6467* instead.68*/6970struct mlx5_ib_alloc_ucontext_req {71__u32 total_num_bfregs;72__u32 num_low_latency_bfregs;73};7475enum mlx5_lib_caps {76MLX5_LIB_CAP_4K_UAR = (__u64)1 << 0,77MLX5_LIB_CAP_DYN_UAR = (__u64)1 << 1,78};7980enum mlx5_ib_alloc_uctx_v2_flags {81MLX5_IB_ALLOC_UCTX_DEVX = 1 << 0,82};83struct mlx5_ib_alloc_ucontext_req_v2 {84__u32 total_num_bfregs;85__u32 num_low_latency_bfregs;86__u32 flags;87__u32 comp_mask;88__u8 max_cqe_version;89__u8 reserved0;90__u16 reserved1;91__u32 reserved2;92__aligned_u64 lib_caps;93};9495enum mlx5_ib_alloc_ucontext_resp_mask {96MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0,97};9899enum mlx5_user_cmds_supp_uhw {100MLX5_USER_CMDS_SUPP_UHW_QUERY_DEVICE = 1 << 0,101MLX5_USER_CMDS_SUPP_UHW_CREATE_AH = 1 << 1,102};103104struct mlx5_ib_alloc_ucontext_resp {105__u32 qp_tab_size;106__u32 bf_reg_size;107__u32 tot_bfregs;108__u32 cache_line_size;109__u16 max_sq_desc_sz;110__u16 max_rq_desc_sz;111__u32 max_send_wqebb;112__u32 max_recv_wr;113__u32 max_srq_recv_wr;114__u16 num_ports;115__u16 reserved1;116__u32 comp_mask;117__u32 response_length;118__u8 cqe_version;119__u8 cmds_supp_uhw;120__u16 reserved2;121__u64 hca_core_clock_offset;122__u32 log_uar_size;123__u32 num_uars_per_page;124__u32 num_dyn_bfregs;125};126127struct mlx5_ib_alloc_pd_resp {128__u32 pdn;129};130131struct mlx5_ib_tso_caps {132__u32 max_tso; /* Maximum tso payload size in bytes */133134/* Corresponding bit will be set if qp type from135* 'enum ib_qp_type' is supported, e.g.136* supported_qpts |= 1 << IB_QPT_UD137*/138__u32 supported_qpts;139};140141struct mlx5_ib_rss_caps {142__u64 rx_hash_fields_mask; /* enum mlx5_rx_hash_fields */143__u8 rx_hash_function; /* enum mlx5_rx_hash_function_flags */144__u8 reserved[7];145};146147struct mlx5_ib_query_device_resp {148__u32 comp_mask;149__u32 response_length;150struct mlx5_ib_tso_caps tso_caps;151struct mlx5_ib_rss_caps rss_caps;152};153154enum mlx5_ib_create_cq_flags {155MLX5_IB_CREATE_CQ_FLAGS_CQE_128B_PAD = 1 << 0,156MLX5_IB_CREATE_CQ_FLAGS_UAR_PAGE_INDEX = 1 << 1,157};158159struct mlx5_ib_create_cq {160__u64 buf_addr;161__u64 db_addr;162__u32 cqe_size;163__u16 flags;164__u16 uar_page_index;165};166167struct mlx5_ib_create_cq_resp {168__u32 cqn;169__u32 reserved;170};171172struct mlx5_ib_resize_cq {173__u64 buf_addr;174__u16 cqe_size;175__u16 reserved0;176__u32 reserved1;177};178179struct mlx5_ib_create_srq {180__u64 buf_addr;181__u64 db_addr;182__u32 flags;183__u32 reserved0; /* explicit padding (optional on i386) */184__u32 uidx;185__u32 reserved1;186};187188struct mlx5_ib_create_srq_resp {189__u32 srqn;190__u32 reserved;191};192193struct mlx5_ib_create_qp {194__u64 buf_addr;195__u64 db_addr;196__u32 sq_wqe_count;197__u32 rq_wqe_count;198__u32 rq_wqe_shift;199__u32 flags;200__u32 uidx;201__u32 bfreg_index;202__u64 sq_buf_addr;203};204205/* RX Hash function flags */206enum mlx5_rx_hash_function_flags {207MLX5_RX_HASH_FUNC_TOEPLITZ = 1 << 0,208};209210/*211* RX Hash flags, these flags allows to set which incoming packet's field should212* participates in RX Hash. Each flag represent certain packet's field,213* when the flag is set the field that is represented by the flag will214* participate in RX Hash calculation.215* Note: *IPV4 and *IPV6 flags can't be enabled together on the same QP216* and *TCP and *UDP flags can't be enabled together on the same QP.217*/218enum mlx5_rx_hash_fields {219MLX5_RX_HASH_SRC_IPV4 = 1 << 0,220MLX5_RX_HASH_DST_IPV4 = 1 << 1,221MLX5_RX_HASH_SRC_IPV6 = 1 << 2,222MLX5_RX_HASH_DST_IPV6 = 1 << 3,223MLX5_RX_HASH_SRC_PORT_TCP = 1 << 4,224MLX5_RX_HASH_DST_PORT_TCP = 1 << 5,225MLX5_RX_HASH_SRC_PORT_UDP = 1 << 6,226MLX5_RX_HASH_DST_PORT_UDP = 1 << 7227};228229struct mlx5_ib_create_qp_rss {230__u64 rx_hash_fields_mask; /* enum mlx5_rx_hash_fields */231__u8 rx_hash_function; /* enum mlx5_rx_hash_function_flags */232__u8 rx_key_len; /* valid only for Toeplitz */233__u8 reserved[6];234__u8 rx_hash_key[128]; /* valid only for Toeplitz */235__u32 comp_mask;236__u32 reserved1;237};238239struct mlx5_ib_create_qp_resp {240__u32 bfreg_index;241};242243struct mlx5_ib_alloc_mw {244__u32 comp_mask;245__u8 num_klms;246__u8 reserved1;247__u16 reserved2;248};249250struct mlx5_ib_create_wq {251__u64 buf_addr;252__u64 db_addr;253__u32 rq_wqe_count;254__u32 rq_wqe_shift;255__u32 user_index;256__u32 flags;257__u32 comp_mask;258__u32 reserved;259};260261struct mlx5_ib_create_ah_resp {262__u32 response_length;263__u8 dmac[ETH_ALEN];264__u8 reserved[6];265};266267struct mlx5_ib_create_wq_resp {268__u32 response_length;269__u32 reserved;270};271272struct mlx5_ib_create_rwq_ind_tbl_resp {273__u32 response_length;274__u32 reserved;275};276277struct mlx5_ib_modify_wq {278__u32 comp_mask;279__u32 reserved;280};281282enum mlx5_ib_mmap_cmd {283MLX5_IB_MMAP_REGULAR_PAGE = 0,284MLX5_IB_MMAP_GET_CONTIGUOUS_PAGES = 1,285MLX5_IB_MMAP_WC_PAGE = 2,286MLX5_IB_MMAP_NC_PAGE = 3,287/* 5 is chosen in order to be compatible with old versions of libmlx5 */288MLX5_IB_MMAP_CORE_CLOCK = 5,289MLX5_IB_MMAP_ALLOC_WC = 6,290MLX5_IB_MMAP_CLOCK_INFO = 7,291MLX5_IB_MMAP_DEVICE_MEM = 8,292};293294/* Bit indexes for the mlx5_alloc_ucontext_resp.clock_info_versions bitmap */295enum {296MLX5_IB_CLOCK_INFO_V1 = 0,297};298299struct mlx5_ib_flow_counters_desc {300__u32 description;301__u32 index;302};303304struct mlx5_ib_flow_counters_data {305RDMA_UAPI_PTR(struct mlx5_ib_flow_counters_desc *, counters_data);306__u32 ncounters;307__u32 reserved;308};309310struct mlx5_ib_create_flow {311__u32 ncounters_data;312__u32 reserved;313/*314* Following are counters data based on ncounters_data, each315* entry in the data[] should match a corresponding counter object316* that was pointed by a counters spec upon the flow creation317*/318struct mlx5_ib_flow_counters_data data[];319};320321#endif /* MLX5_ABI_USER_H */322323324