2013-07-07 22:25:49 +08:00
|
|
|
/*
|
2015-04-02 22:07:29 +08:00
|
|
|
* Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
|
2013-07-07 22:25:49 +08:00
|
|
|
*
|
|
|
|
* This software is available to you under a choice of one of two
|
|
|
|
* licenses. You may choose to be licensed under the terms of the GNU
|
|
|
|
* General Public License (GPL) Version 2, available from the file
|
|
|
|
* COPYING in the main directory of this source tree, or the
|
|
|
|
* OpenIB.org BSD license below:
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or
|
|
|
|
* without modification, are permitted provided that the following
|
|
|
|
* conditions are met:
|
|
|
|
*
|
|
|
|
* - Redistributions of source code must retain the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer.
|
|
|
|
*
|
|
|
|
* - Redistributions in binary form must reproduce the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer in the documentation and/or other materials
|
|
|
|
* provided with the distribution.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MLX5_DEVICE_H
|
|
|
|
#define MLX5_DEVICE_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <rdma/ib_verbs.h>
|
2015-05-29 03:28:40 +08:00
|
|
|
#include <linux/mlx5/mlx5_ifc.h>
|
2013-07-07 22:25:49 +08:00
|
|
|
|
|
|
|
#if defined(__LITTLE_ENDIAN)
|
|
|
|
#define MLX5_SET_HOST_ENDIANNESS 0
|
|
|
|
#elif defined(__BIG_ENDIAN)
|
|
|
|
#define MLX5_SET_HOST_ENDIANNESS 0x80
|
|
|
|
#else
|
|
|
|
#error Host endianness not defined
|
|
|
|
#endif
|
|
|
|
|
2014-10-02 17:19:43 +08:00
|
|
|
/* helper macros */
|
|
|
|
#define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)
|
|
|
|
#define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
|
2017-08-07 16:14:11 +08:00
|
|
|
#define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
|
2017-08-03 10:36:23 +08:00
|
|
|
#define __mlx5_16_off(typ, fld) (__mlx5_bit_off(typ, fld) / 16)
|
2014-10-02 17:19:43 +08:00
|
|
|
#define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
|
|
|
|
#define __mlx5_64_off(typ, fld) (__mlx5_bit_off(typ, fld) / 64)
|
2017-08-03 10:36:23 +08:00
|
|
|
#define __mlx5_16_bit_off(typ, fld) (16 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0xf))
|
2014-10-02 17:19:43 +08:00
|
|
|
#define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
|
|
|
|
#define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
|
|
|
|
#define __mlx5_dw_mask(typ, fld) (__mlx5_mask(typ, fld) << __mlx5_dw_bit_off(typ, fld))
|
2017-08-03 10:36:23 +08:00
|
|
|
#define __mlx5_mask16(typ, fld) ((u16)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
|
|
|
|
#define __mlx5_16_mask(typ, fld) (__mlx5_mask16(typ, fld) << __mlx5_16_bit_off(typ, fld))
|
2014-10-02 17:19:43 +08:00
|
|
|
#define __mlx5_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits)
|
|
|
|
|
|
|
|
#define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8)
|
|
|
|
#define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
|
|
|
|
#define MLX5_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32)
|
2016-04-25 03:51:47 +08:00
|
|
|
#define MLX5_ST_SZ_QW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 64)
|
2015-05-29 03:28:41 +08:00
|
|
|
#define MLX5_UN_SZ_BYTES(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 8)
|
|
|
|
#define MLX5_UN_SZ_DW(typ) (sizeof(union mlx5_ifc_##typ##_bits) / 32)
|
2014-10-02 17:19:43 +08:00
|
|
|
#define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
|
|
|
|
#define MLX5_ADDR_OF(typ, p, fld) ((char *)(p) + MLX5_BYTE_OFF(typ, fld))
|
|
|
|
|
|
|
|
/* insert a value to a struct */
|
|
|
|
#define MLX5_SET(typ, p, fld, v) do { \
|
2016-12-08 18:58:45 +08:00
|
|
|
u32 _v = v; \
|
2014-10-02 17:19:43 +08:00
|
|
|
BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \
|
|
|
|
*((__be32 *)(p) + __mlx5_dw_off(typ, fld)) = \
|
|
|
|
cpu_to_be32((be32_to_cpu(*((__be32 *)(p) + __mlx5_dw_off(typ, fld))) & \
|
2016-12-08 18:58:45 +08:00
|
|
|
(~__mlx5_dw_mask(typ, fld))) | (((_v) & __mlx5_mask(typ, fld)) \
|
2014-10-02 17:19:43 +08:00
|
|
|
<< __mlx5_dw_bit_off(typ, fld))); \
|
|
|
|
} while (0)
|
|
|
|
|
2018-01-04 23:25:32 +08:00
|
|
|
#define MLX5_ARRAY_SET(typ, p, fld, idx, v) do { \
|
|
|
|
BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 32); \
|
|
|
|
MLX5_SET(typ, p, fld[idx], v); \
|
|
|
|
} while (0)
|
|
|
|
|
2015-05-29 03:28:40 +08:00
|
|
|
#define MLX5_SET_TO_ONES(typ, p, fld) do { \
|
|
|
|
BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \
|
|
|
|
*((__be32 *)(p) + __mlx5_dw_off(typ, fld)) = \
|
|
|
|
cpu_to_be32((be32_to_cpu(*((__be32 *)(p) + __mlx5_dw_off(typ, fld))) & \
|
|
|
|
(~__mlx5_dw_mask(typ, fld))) | ((__mlx5_mask(typ, fld)) \
|
|
|
|
<< __mlx5_dw_bit_off(typ, fld))); \
|
|
|
|
} while (0)
|
|
|
|
|
2014-10-02 17:19:43 +08:00
|
|
|
#define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
|
|
|
|
__mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
|
|
|
|
__mlx5_mask(typ, fld))
|
|
|
|
|
|
|
|
#define MLX5_GET_PR(typ, p, fld) ({ \
|
|
|
|
u32 ___t = MLX5_GET(typ, p, fld); \
|
|
|
|
pr_debug(#fld " = 0x%x\n", ___t); \
|
|
|
|
___t; \
|
|
|
|
})
|
|
|
|
|
2016-10-12 09:57:10 +08:00
|
|
|
#define __MLX5_SET64(typ, p, fld, v) do { \
|
2014-10-02 17:19:43 +08:00
|
|
|
BUILD_BUG_ON(__mlx5_bit_sz(typ, fld) != 64); \
|
|
|
|
*((__be64 *)(p) + __mlx5_64_off(typ, fld)) = cpu_to_be64(v); \
|
|
|
|
} while (0)
|
|
|
|
|
2016-10-12 09:57:10 +08:00
|
|
|
#define MLX5_SET64(typ, p, fld, v) do { \
|
|
|
|
BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \
|
|
|
|
__MLX5_SET64(typ, p, fld, v); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define MLX5_ARRAY_SET64(typ, p, fld, idx, v) do { \
|
|
|
|
BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \
|
|
|
|
__MLX5_SET64(typ, p, fld[idx], v); \
|
|
|
|
} while (0)
|
|
|
|
|
2014-10-02 17:19:43 +08:00
|
|
|
#define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld)))
|
|
|
|
|
2015-06-05 00:30:41 +08:00
|
|
|
#define MLX5_GET64_PR(typ, p, fld) ({ \
|
|
|
|
u64 ___t = MLX5_GET64(typ, p, fld); \
|
|
|
|
pr_debug(#fld " = 0x%llx\n", ___t); \
|
|
|
|
___t; \
|
|
|
|
})
|
|
|
|
|
2017-08-03 10:36:23 +08:00
|
|
|
#define MLX5_GET16(typ, p, fld) ((be16_to_cpu(*((__be16 *)(p) +\
|
|
|
|
__mlx5_16_off(typ, fld))) >> __mlx5_16_bit_off(typ, fld)) & \
|
|
|
|
__mlx5_mask16(typ, fld))
|
|
|
|
|
|
|
|
#define MLX5_SET16(typ, p, fld, v) do { \
|
|
|
|
u16 _v = v; \
|
|
|
|
BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 16); \
|
|
|
|
*((__be16 *)(p) + __mlx5_16_off(typ, fld)) = \
|
|
|
|
cpu_to_be16((be16_to_cpu(*((__be16 *)(p) + __mlx5_16_off(typ, fld))) & \
|
|
|
|
(~__mlx5_16_mask(typ, fld))) | (((_v) & __mlx5_mask16(typ, fld)) \
|
|
|
|
<< __mlx5_16_bit_off(typ, fld))); \
|
|
|
|
} while (0)
|
|
|
|
|
2016-02-19 00:15:01 +08:00
|
|
|
/* Big endian getters */
|
|
|
|
#define MLX5_GET64_BE(typ, p, fld) (*((__be64 *)(p) +\
|
|
|
|
__mlx5_64_off(typ, fld)))
|
|
|
|
|
|
|
|
#define MLX5_GET_BE(type_t, typ, p, fld) ({ \
|
|
|
|
type_t tmp; \
|
|
|
|
switch (sizeof(tmp)) { \
|
|
|
|
case sizeof(u8): \
|
|
|
|
tmp = (__force type_t)MLX5_GET(typ, p, fld); \
|
|
|
|
break; \
|
|
|
|
case sizeof(u16): \
|
|
|
|
tmp = (__force type_t)cpu_to_be16(MLX5_GET(typ, p, fld)); \
|
|
|
|
break; \
|
|
|
|
case sizeof(u32): \
|
|
|
|
tmp = (__force type_t)cpu_to_be32(MLX5_GET(typ, p, fld)); \
|
|
|
|
break; \
|
|
|
|
case sizeof(u64): \
|
|
|
|
tmp = (__force type_t)MLX5_GET64_BE(typ, p, fld); \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
tmp; \
|
|
|
|
})
|
|
|
|
|
2016-07-24 21:12:39 +08:00
|
|
|
enum mlx5_inline_modes {
|
|
|
|
MLX5_INLINE_MODE_NONE,
|
|
|
|
MLX5_INLINE_MODE_L2,
|
|
|
|
MLX5_INLINE_MODE_IP,
|
|
|
|
MLX5_INLINE_MODE_TCP_UDP,
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
enum {
|
|
|
|
MLX5_MAX_COMMANDS = 32,
|
|
|
|
MLX5_CMD_DATA_BLOCK_SIZE = 512,
|
|
|
|
MLX5_PCI_CMD_XPORT = 7,
|
2014-02-23 20:19:06 +08:00
|
|
|
MLX5_MKEY_BSF_OCTO_SIZE = 4,
|
|
|
|
MLX5_MAX_PSVS = 4,
|
2013-07-07 22:25:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_EXTENDED_UD_AV = 0x80000000,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_CQ_STATE_ARMED = 9,
|
|
|
|
MLX5_CQ_STATE_ALWAYS_ARMED = 0xb,
|
|
|
|
MLX5_CQ_STATE_FIRED = 0xa,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_STAT_RATE_OFFSET = 5,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_INLINE_SEG = 0x80000000,
|
|
|
|
};
|
|
|
|
|
2015-06-11 19:47:28 +08:00
|
|
|
enum {
|
|
|
|
MLX5_HW_START_PADDING = MLX5_INLINE_SEG,
|
|
|
|
};
|
|
|
|
|
2014-10-02 17:19:42 +08:00
|
|
|
enum {
|
|
|
|
MLX5_MIN_PKEY_TABLE_SIZE = 128,
|
|
|
|
MLX5_MAX_LOG_PKEY_TABLE = 5,
|
|
|
|
};
|
|
|
|
|
2014-12-11 23:04:19 +08:00
|
|
|
enum {
|
|
|
|
MLX5_MKEY_INBOX_PG_ACCESS = 1 << 31
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_PFAULT_SUBTYPE_WQE = 0,
|
|
|
|
MLX5_PFAULT_SUBTYPE_RDMA = 1,
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
enum {
|
|
|
|
MLX5_PERM_LOCAL_READ = 1 << 2,
|
|
|
|
MLX5_PERM_LOCAL_WRITE = 1 << 3,
|
|
|
|
MLX5_PERM_REMOTE_READ = 1 << 4,
|
|
|
|
MLX5_PERM_REMOTE_WRITE = 1 << 5,
|
|
|
|
MLX5_PERM_ATOMIC = 1 << 6,
|
|
|
|
MLX5_PERM_UMR_EN = 1 << 7,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_PCIE_CTRL_SMALL_FENCE = 1 << 0,
|
|
|
|
MLX5_PCIE_CTRL_RELAXED_ORDERING = 1 << 2,
|
|
|
|
MLX5_PCIE_CTRL_NO_SNOOP = 1 << 3,
|
|
|
|
MLX5_PCIE_CTRL_TLP_PROCE_EN = 1 << 6,
|
|
|
|
MLX5_PCIE_CTRL_TPH_MASK = 3 << 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_EN_RD = (u64)1,
|
|
|
|
MLX5_EN_WR = (u64)2
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2017-01-04 05:55:26 +08:00
|
|
|
MLX5_ADAPTER_PAGE_SHIFT = 12,
|
|
|
|
MLX5_ADAPTER_PAGE_SIZE = 1 << MLX5_ADAPTER_PAGE_SHIFT,
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
enum {
|
2017-01-04 05:55:21 +08:00
|
|
|
MLX5_BFREGS_PER_UAR = 4,
|
|
|
|
MLX5_MAX_UARS = 1 << 8,
|
|
|
|
MLX5_NON_FP_BFREGS_PER_UAR = 2,
|
2017-01-04 05:55:23 +08:00
|
|
|
MLX5_FP_BFREGS_PER_UAR = MLX5_BFREGS_PER_UAR -
|
|
|
|
MLX5_NON_FP_BFREGS_PER_UAR,
|
2017-01-04 05:55:21 +08:00
|
|
|
MLX5_MAX_BFREGS = MLX5_MAX_UARS *
|
|
|
|
MLX5_NON_FP_BFREGS_PER_UAR,
|
2017-01-04 05:55:26 +08:00
|
|
|
MLX5_UARS_IN_PAGE = PAGE_SIZE / MLX5_ADAPTER_PAGE_SIZE,
|
|
|
|
MLX5_NON_FP_BFREGS_IN_PAGE = MLX5_NON_FP_BFREGS_PER_UAR * MLX5_UARS_IN_PAGE,
|
2017-12-24 22:31:34 +08:00
|
|
|
MLX5_MIN_DYN_BFREGS = 512,
|
|
|
|
MLX5_MAX_DYN_BFREGS = 1024,
|
2013-07-07 22:25:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_MKEY_MASK_LEN = 1ull << 0,
|
|
|
|
MLX5_MKEY_MASK_PAGE_SIZE = 1ull << 1,
|
|
|
|
MLX5_MKEY_MASK_START_ADDR = 1ull << 6,
|
|
|
|
MLX5_MKEY_MASK_PD = 1ull << 7,
|
|
|
|
MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8,
|
2014-02-23 20:19:12 +08:00
|
|
|
MLX5_MKEY_MASK_EN_SIGERR = 1ull << 9,
|
2013-07-07 22:25:49 +08:00
|
|
|
MLX5_MKEY_MASK_BSF_EN = 1ull << 12,
|
|
|
|
MLX5_MKEY_MASK_KEY = 1ull << 13,
|
|
|
|
MLX5_MKEY_MASK_QPN = 1ull << 14,
|
|
|
|
MLX5_MKEY_MASK_LR = 1ull << 17,
|
|
|
|
MLX5_MKEY_MASK_LW = 1ull << 18,
|
|
|
|
MLX5_MKEY_MASK_RR = 1ull << 19,
|
|
|
|
MLX5_MKEY_MASK_RW = 1ull << 20,
|
|
|
|
MLX5_MKEY_MASK_A = 1ull << 21,
|
|
|
|
MLX5_MKEY_MASK_SMALL_FENCE = 1ull << 23,
|
|
|
|
MLX5_MKEY_MASK_FREE = 1ull << 29,
|
|
|
|
};
|
|
|
|
|
2014-12-11 23:04:11 +08:00
|
|
|
enum {
|
|
|
|
MLX5_UMR_TRANSLATION_OFFSET_EN = (1 << 4),
|
|
|
|
|
|
|
|
MLX5_UMR_CHECK_NOT_FREE = (1 << 5),
|
|
|
|
MLX5_UMR_CHECK_FREE = (2 << 5),
|
|
|
|
|
|
|
|
MLX5_UMR_INLINE = (1 << 7),
|
|
|
|
};
|
|
|
|
|
2014-12-11 23:04:21 +08:00
|
|
|
#define MLX5_UMR_MTT_ALIGNMENT 0x40
|
|
|
|
#define MLX5_UMR_MTT_MASK (MLX5_UMR_MTT_ALIGNMENT - 1)
|
2014-12-11 23:04:22 +08:00
|
|
|
#define MLX5_UMR_MTT_MIN_CHUNK_SIZE MLX5_UMR_MTT_ALIGNMENT
|
2014-12-11 23:04:21 +08:00
|
|
|
|
2016-01-15 01:13:00 +08:00
|
|
|
#define MLX5_USER_INDEX_LEN (MLX5_FLD_SZ_BYTES(qpc, user_index) * 8)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_EVENT_QUEUE_TYPE_QP = 0,
|
|
|
|
MLX5_EVENT_QUEUE_TYPE_RQ = 1,
|
|
|
|
MLX5_EVENT_QUEUE_TYPE_SQ = 2,
|
2018-01-02 22:19:28 +08:00
|
|
|
MLX5_EVENT_QUEUE_TYPE_DCT = 6,
|
2016-01-15 01:13:00 +08:00
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
enum mlx5_event {
|
|
|
|
MLX5_EVENT_TYPE_COMP = 0x0,
|
|
|
|
|
|
|
|
MLX5_EVENT_TYPE_PATH_MIG = 0x01,
|
|
|
|
MLX5_EVENT_TYPE_COMM_EST = 0x02,
|
|
|
|
MLX5_EVENT_TYPE_SQ_DRAINED = 0x03,
|
|
|
|
MLX5_EVENT_TYPE_SRQ_LAST_WQE = 0x13,
|
|
|
|
MLX5_EVENT_TYPE_SRQ_RQ_LIMIT = 0x14,
|
|
|
|
|
|
|
|
MLX5_EVENT_TYPE_CQ_ERROR = 0x04,
|
|
|
|
MLX5_EVENT_TYPE_WQ_CATAS_ERROR = 0x05,
|
|
|
|
MLX5_EVENT_TYPE_PATH_MIG_FAILED = 0x07,
|
|
|
|
MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR = 0x10,
|
|
|
|
MLX5_EVENT_TYPE_WQ_ACCESS_ERROR = 0x11,
|
|
|
|
MLX5_EVENT_TYPE_SRQ_CATAS_ERROR = 0x12,
|
|
|
|
|
|
|
|
MLX5_EVENT_TYPE_INTERNAL_ERROR = 0x08,
|
|
|
|
MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
|
|
|
|
MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
|
2016-11-17 19:45:56 +08:00
|
|
|
MLX5_EVENT_TYPE_PORT_MODULE_EVENT = 0x16,
|
2018-05-31 01:59:49 +08:00
|
|
|
MLX5_EVENT_TYPE_TEMP_WARN_EVENT = 0x17,
|
2013-07-07 22:25:49 +08:00
|
|
|
MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
|
2017-05-30 15:29:12 +08:00
|
|
|
MLX5_EVENT_TYPE_GENERAL_EVENT = 0x22,
|
2016-10-10 21:05:53 +08:00
|
|
|
MLX5_EVENT_TYPE_PPS_EVENT = 0x25,
|
2013-07-07 22:25:49 +08:00
|
|
|
|
|
|
|
MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a,
|
|
|
|
MLX5_EVENT_TYPE_STALL_EVENT = 0x1b,
|
|
|
|
|
|
|
|
MLX5_EVENT_TYPE_CMD = 0x0a,
|
|
|
|
MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb,
|
2014-12-11 23:04:19 +08:00
|
|
|
|
|
|
|
MLX5_EVENT_TYPE_PAGE_FAULT = 0xc,
|
2015-12-02 00:03:18 +08:00
|
|
|
MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd,
|
2017-03-14 02:05:45 +08:00
|
|
|
|
2018-01-02 22:19:28 +08:00
|
|
|
MLX5_EVENT_TYPE_DCT_DRAINED = 0x1c,
|
|
|
|
|
2017-03-14 02:05:45 +08:00
|
|
|
MLX5_EVENT_TYPE_FPGA_ERROR = 0x20,
|
2018-05-31 01:59:50 +08:00
|
|
|
MLX5_EVENT_TYPE_FPGA_QP_ERROR = 0x21,
|
net/mlx5: FW tracer, events handling
The tracer has one event, event 0x26, with two subtypes:
- Subtype 0: Ownership change
- Subtype 1: Traces available
An ownership change occurs in the following cases:
1- Owner releases his ownership, in this case, an event will be
sent to inform others to reattempt acquire ownership.
2- Ownership was taken by a higher priority tool, in this case
the owner should understand that it lost ownership, and go through
tear down flow.
The second subtype indicates that there are traces in the trace buffer,
in this case, the driver polls the tracer buffer for new traces, parse
them and prepares the messages for printing.
The HW starts tracing from the first address in the tracer buffer.
Driver receives an event notifying that new trace block exists.
HW posts a timestamp event at the last 8B of every 256B block.
Comparing the timestamp to the last handled timestamp would indicate
that this is a new trace block. Once the new timestamp is detected,
the entire block is considered valid.
Block validation and parsing, should be done after copying the current
block to a different location, in order to avoid block overwritten
during processing.
Signed-off-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
2018-02-07 17:08:56 +08:00
|
|
|
|
|
|
|
MLX5_EVENT_TYPE_DEVICE_TRACER = 0x26,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_TRACER_SUBTYPE_OWNERSHIP_CHANGE = 0x0,
|
|
|
|
MLX5_TRACER_SUBTYPE_TRACES_AVAILABLE = 0x1,
|
2013-07-07 22:25:49 +08:00
|
|
|
};
|
|
|
|
|
2017-05-30 15:29:12 +08:00
|
|
|
enum {
|
|
|
|
MLX5_GENERAL_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1,
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
enum {
|
|
|
|
MLX5_PORT_CHANGE_SUBTYPE_DOWN = 1,
|
|
|
|
MLX5_PORT_CHANGE_SUBTYPE_ACTIVE = 4,
|
|
|
|
MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED = 5,
|
|
|
|
MLX5_PORT_CHANGE_SUBTYPE_LID = 6,
|
|
|
|
MLX5_PORT_CHANGE_SUBTYPE_PKEY = 7,
|
|
|
|
MLX5_PORT_CHANGE_SUBTYPE_GUID = 8,
|
|
|
|
MLX5_PORT_CHANGE_SUBTYPE_CLIENT_REREG = 9,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_DEV_CAP_FLAG_XRC = 1LL << 3,
|
|
|
|
MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
|
|
|
|
MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
|
|
|
|
MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
|
|
|
|
MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
|
2014-04-02 05:10:16 +08:00
|
|
|
MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23,
|
2014-12-16 10:17:17 +08:00
|
|
|
MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
|
2014-01-14 23:45:17 +08:00
|
|
|
MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29,
|
2014-01-14 23:45:18 +08:00
|
|
|
MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
|
2014-10-02 17:19:42 +08:00
|
|
|
MLX5_DEV_CAP_FLAG_DCT = 1LL << 37,
|
2013-07-07 22:25:49 +08:00
|
|
|
MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
|
2013-09-11 21:35:25 +08:00
|
|
|
MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
|
2013-07-07 22:25:49 +08:00
|
|
|
};
|
|
|
|
|
2015-12-24 00:47:23 +08:00
|
|
|
enum {
|
|
|
|
MLX5_ROCE_VERSION_1 = 0,
|
|
|
|
MLX5_ROCE_VERSION_2 = 2,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_ROCE_VERSION_1_CAP = 1 << MLX5_ROCE_VERSION_1,
|
|
|
|
MLX5_ROCE_VERSION_2_CAP = 1 << MLX5_ROCE_VERSION_2,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_ROCE_L3_TYPE_IPV4 = 0,
|
|
|
|
MLX5_ROCE_L3_TYPE_IPV6 = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_ROCE_L3_TYPE_IPV4_CAP = 1 << 1,
|
|
|
|
MLX5_ROCE_L3_TYPE_IPV6_CAP = 1 << 2,
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
enum {
|
|
|
|
MLX5_OPCODE_NOP = 0x00,
|
|
|
|
MLX5_OPCODE_SEND_INVAL = 0x01,
|
|
|
|
MLX5_OPCODE_RDMA_WRITE = 0x08,
|
|
|
|
MLX5_OPCODE_RDMA_WRITE_IMM = 0x09,
|
|
|
|
MLX5_OPCODE_SEND = 0x0a,
|
|
|
|
MLX5_OPCODE_SEND_IMM = 0x0b,
|
2015-05-29 03:28:40 +08:00
|
|
|
MLX5_OPCODE_LSO = 0x0e,
|
2013-07-07 22:25:49 +08:00
|
|
|
MLX5_OPCODE_RDMA_READ = 0x10,
|
|
|
|
MLX5_OPCODE_ATOMIC_CS = 0x11,
|
|
|
|
MLX5_OPCODE_ATOMIC_FA = 0x12,
|
|
|
|
MLX5_OPCODE_ATOMIC_MASKED_CS = 0x14,
|
|
|
|
MLX5_OPCODE_ATOMIC_MASKED_FA = 0x15,
|
|
|
|
MLX5_OPCODE_BIND_MW = 0x18,
|
|
|
|
MLX5_OPCODE_CONFIG_CMD = 0x1f,
|
|
|
|
|
|
|
|
MLX5_RECV_OPCODE_RDMA_WRITE_IMM = 0x00,
|
|
|
|
MLX5_RECV_OPCODE_SEND = 0x01,
|
|
|
|
MLX5_RECV_OPCODE_SEND_IMM = 0x02,
|
|
|
|
MLX5_RECV_OPCODE_SEND_INVAL = 0x03,
|
|
|
|
|
|
|
|
MLX5_CQE_OPCODE_ERROR = 0x1e,
|
|
|
|
MLX5_CQE_OPCODE_RESIZE = 0x16,
|
|
|
|
|
|
|
|
MLX5_OPCODE_SET_PSV = 0x20,
|
|
|
|
MLX5_OPCODE_GET_PSV = 0x21,
|
|
|
|
MLX5_OPCODE_CHECK_PSV = 0x22,
|
|
|
|
MLX5_OPCODE_RGET_PSV = 0x26,
|
|
|
|
MLX5_OPCODE_RCHECK_PSV = 0x27,
|
|
|
|
|
|
|
|
MLX5_OPCODE_UMR = 0x25,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_SET_PORT_RESET_QKEY = 0,
|
|
|
|
MLX5_SET_PORT_GUID0 = 16,
|
|
|
|
MLX5_SET_PORT_NODE_GUID = 17,
|
|
|
|
MLX5_SET_PORT_SYS_GUID = 18,
|
|
|
|
MLX5_SET_PORT_GID_TABLE = 19,
|
|
|
|
MLX5_SET_PORT_PKEY_TABLE = 20,
|
|
|
|
};
|
|
|
|
|
2016-02-23 00:17:28 +08:00
|
|
|
enum {
|
|
|
|
MLX5_BW_NO_LIMIT = 0,
|
|
|
|
MLX5_100_MBPS_UNIT = 3,
|
|
|
|
MLX5_GBPS_UNIT = 4,
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
enum {
|
|
|
|
MLX5_MAX_PAGE_SHIFT = 31
|
|
|
|
};
|
|
|
|
|
2013-10-23 14:53:20 +08:00
|
|
|
enum {
|
|
|
|
MLX5_CAP_OFF_CMDIF_CSUM = 46,
|
|
|
|
};
|
|
|
|
|
2016-04-01 00:03:25 +08:00
|
|
|
enum {
|
|
|
|
/*
|
|
|
|
* Max wqe size for rdma read is 512 bytes, so this
|
|
|
|
* limits our max_sge_rd as the wqe needs to fit:
|
|
|
|
* - ctrl segment (16 bytes)
|
|
|
|
* - rdma segment (16 bytes)
|
|
|
|
* - scatter elements (16 bytes each)
|
|
|
|
*/
|
|
|
|
MLX5_MAX_SGE_RD = (512 - 16 - 16) / 16
|
|
|
|
};
|
|
|
|
|
2014-12-11 23:04:19 +08:00
|
|
|
enum mlx5_odp_transport_cap_bits {
|
|
|
|
MLX5_ODP_SUPPORT_SEND = 1 << 31,
|
|
|
|
MLX5_ODP_SUPPORT_RECV = 1 << 30,
|
|
|
|
MLX5_ODP_SUPPORT_WRITE = 1 << 29,
|
|
|
|
MLX5_ODP_SUPPORT_READ = 1 << 28,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_odp_caps {
|
|
|
|
char reserved[0x10];
|
|
|
|
struct {
|
|
|
|
__be32 rc_odp_caps;
|
|
|
|
__be32 uc_odp_caps;
|
|
|
|
__be32 ud_odp_caps;
|
|
|
|
} per_transport_caps;
|
|
|
|
char reserved2[0xe4];
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
struct mlx5_cmd_layout {
|
|
|
|
u8 type;
|
|
|
|
u8 rsvd0[3];
|
|
|
|
__be32 inlen;
|
|
|
|
__be64 in_ptr;
|
|
|
|
__be32 in[4];
|
|
|
|
__be32 out[4];
|
|
|
|
__be64 out_ptr;
|
|
|
|
__be32 outlen;
|
|
|
|
u8 token;
|
|
|
|
u8 sig;
|
|
|
|
u8 rsvd1;
|
|
|
|
u8 status_own;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct health_buffer {
|
|
|
|
__be32 assert_var[5];
|
|
|
|
__be32 rsvd0[3];
|
|
|
|
__be32 assert_exit_ptr;
|
|
|
|
__be32 assert_callra;
|
|
|
|
__be32 rsvd1[2];
|
|
|
|
__be32 fw_ver;
|
|
|
|
__be32 hw_id;
|
|
|
|
__be32 rsvd2;
|
|
|
|
u8 irisc_index;
|
|
|
|
u8 synd;
|
2015-09-25 15:49:15 +08:00
|
|
|
__be16 ext_synd;
|
2013-07-07 22:25:49 +08:00
|
|
|
};
|
|
|
|
|
2018-08-09 14:55:21 +08:00
|
|
|
enum mlx5_cmd_addr_l_sz_offset {
|
|
|
|
MLX5_NIC_IFC_OFFSET = 8,
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
struct mlx5_init_seg {
|
|
|
|
__be32 fw_rev;
|
|
|
|
__be32 cmdif_rev_fw_sub;
|
|
|
|
__be32 rsvd0[2];
|
|
|
|
__be32 cmdq_addr_h;
|
|
|
|
__be32 cmdq_addr_l_sz;
|
|
|
|
__be32 cmd_dbell;
|
2015-10-14 22:43:47 +08:00
|
|
|
__be32 rsvd1[120];
|
|
|
|
__be32 initializing;
|
2013-07-07 22:25:49 +08:00
|
|
|
struct health_buffer health;
|
2015-12-29 20:58:30 +08:00
|
|
|
__be32 rsvd2[880];
|
|
|
|
__be32 internal_timer_h;
|
|
|
|
__be32 internal_timer_l;
|
2015-12-16 02:30:12 +08:00
|
|
|
__be32 rsvd3[2];
|
2013-07-07 22:25:49 +08:00
|
|
|
__be32 health_counter;
|
2015-12-29 20:58:30 +08:00
|
|
|
__be32 rsvd4[1019];
|
2013-07-07 22:25:49 +08:00
|
|
|
__be64 ieee1588_clk;
|
|
|
|
__be32 ieee1588_clk_type;
|
|
|
|
__be32 clr_intx;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_eqe_comp {
|
|
|
|
__be32 reserved[6];
|
|
|
|
__be32 cqn;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_eqe_qp_srq {
|
2016-01-15 01:13:00 +08:00
|
|
|
__be32 reserved1[5];
|
|
|
|
u8 type;
|
|
|
|
u8 reserved2[3];
|
2013-07-07 22:25:49 +08:00
|
|
|
__be32 qp_srq_n;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_eqe_cq_err {
|
|
|
|
__be32 cqn;
|
|
|
|
u8 reserved1[7];
|
|
|
|
u8 syndrome;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_eqe_port_state {
|
|
|
|
u8 reserved0[8];
|
|
|
|
u8 port;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_eqe_gpio {
|
|
|
|
__be32 reserved0[2];
|
|
|
|
__be64 gpio_event;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_eqe_congestion {
|
|
|
|
u8 type;
|
|
|
|
u8 rsvd0;
|
|
|
|
u8 congestion_level;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_eqe_stall_vl {
|
|
|
|
u8 rsvd0[3];
|
|
|
|
u8 port_vl;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_eqe_cmd {
|
|
|
|
__be32 vector;
|
|
|
|
__be32 rsvd[6];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_eqe_page_req {
|
|
|
|
u8 rsvd0[2];
|
|
|
|
__be16 func_id;
|
2013-08-14 22:46:48 +08:00
|
|
|
__be32 num_pages;
|
|
|
|
__be32 rsvd1[5];
|
2013-07-07 22:25:49 +08:00
|
|
|
};
|
|
|
|
|
2014-12-11 23:04:19 +08:00
|
|
|
struct mlx5_eqe_page_fault {
|
|
|
|
__be32 bytes_committed;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
u16 reserved1;
|
|
|
|
__be16 wqe_index;
|
|
|
|
u16 reserved2;
|
|
|
|
__be16 packet_length;
|
2017-01-02 17:37:46 +08:00
|
|
|
__be32 token;
|
|
|
|
u8 reserved4[8];
|
|
|
|
__be32 pftype_wq;
|
2014-12-11 23:04:19 +08:00
|
|
|
} __packed wqe;
|
|
|
|
struct {
|
|
|
|
__be32 r_key;
|
|
|
|
u16 reserved1;
|
|
|
|
__be16 packet_length;
|
|
|
|
__be32 rdma_op_len;
|
|
|
|
__be64 rdma_va;
|
2017-01-02 17:37:46 +08:00
|
|
|
__be32 pftype_token;
|
2014-12-11 23:04:19 +08:00
|
|
|
} __packed rdma;
|
|
|
|
} __packed;
|
|
|
|
} __packed;
|
|
|
|
|
2015-12-02 00:03:18 +08:00
|
|
|
struct mlx5_eqe_vport_change {
|
|
|
|
u8 rsvd0[2];
|
|
|
|
__be16 vport_num;
|
|
|
|
__be32 rsvd1[6];
|
|
|
|
} __packed;
|
|
|
|
|
2016-11-17 19:45:56 +08:00
|
|
|
struct mlx5_eqe_port_module {
|
|
|
|
u8 reserved_at_0[1];
|
|
|
|
u8 module;
|
|
|
|
u8 reserved_at_2[1];
|
|
|
|
u8 module_status;
|
|
|
|
u8 reserved_at_4[2];
|
|
|
|
u8 error_type;
|
|
|
|
} __packed;
|
|
|
|
|
2016-10-10 21:05:53 +08:00
|
|
|
struct mlx5_eqe_pps {
|
|
|
|
u8 rsvd0[3];
|
|
|
|
u8 pin;
|
|
|
|
u8 rsvd1[4];
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
__be32 time_sec;
|
|
|
|
__be32 time_nsec;
|
|
|
|
};
|
|
|
|
struct {
|
|
|
|
__be64 time_stamp;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
u8 rsvd2[12];
|
|
|
|
} __packed;
|
|
|
|
|
2018-01-02 22:19:28 +08:00
|
|
|
struct mlx5_eqe_dct {
|
|
|
|
__be32 reserved[6];
|
|
|
|
__be32 dctn;
|
|
|
|
};
|
|
|
|
|
2018-05-31 01:59:49 +08:00
|
|
|
struct mlx5_eqe_temp_warning {
|
|
|
|
__be64 sensor_warning_msb;
|
|
|
|
__be64 sensor_warning_lsb;
|
|
|
|
} __packed;
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
union ev_data {
|
|
|
|
__be32 raw[7];
|
|
|
|
struct mlx5_eqe_cmd cmd;
|
|
|
|
struct mlx5_eqe_comp comp;
|
|
|
|
struct mlx5_eqe_qp_srq qp_srq;
|
|
|
|
struct mlx5_eqe_cq_err cq_err;
|
|
|
|
struct mlx5_eqe_port_state port;
|
|
|
|
struct mlx5_eqe_gpio gpio;
|
|
|
|
struct mlx5_eqe_congestion cong;
|
|
|
|
struct mlx5_eqe_stall_vl stall_vl;
|
|
|
|
struct mlx5_eqe_page_req req_pages;
|
2014-12-11 23:04:19 +08:00
|
|
|
struct mlx5_eqe_page_fault page_fault;
|
2015-12-02 00:03:18 +08:00
|
|
|
struct mlx5_eqe_vport_change vport_change;
|
2016-11-17 19:45:56 +08:00
|
|
|
struct mlx5_eqe_port_module port_module;
|
2016-10-10 21:05:53 +08:00
|
|
|
struct mlx5_eqe_pps pps;
|
2018-01-02 22:19:28 +08:00
|
|
|
struct mlx5_eqe_dct dct;
|
2018-05-31 01:59:49 +08:00
|
|
|
struct mlx5_eqe_temp_warning temp_warning;
|
2013-07-07 22:25:49 +08:00
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct mlx5_eqe {
|
|
|
|
u8 rsvd0;
|
|
|
|
u8 type;
|
|
|
|
u8 rsvd1;
|
|
|
|
u8 sub_type;
|
|
|
|
__be32 rsvd2[7];
|
|
|
|
union ev_data data;
|
|
|
|
__be16 rsvd3;
|
|
|
|
u8 signature;
|
|
|
|
u8 owner;
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct mlx5_cmd_prot_block {
|
|
|
|
u8 data[MLX5_CMD_DATA_BLOCK_SIZE];
|
|
|
|
u8 rsvd0[48];
|
|
|
|
__be64 next;
|
|
|
|
__be32 block_num;
|
|
|
|
u8 rsvd1;
|
|
|
|
u8 token;
|
|
|
|
u8 ctrl_sig;
|
|
|
|
u8 sig;
|
|
|
|
};
|
|
|
|
|
2015-05-29 03:28:40 +08:00
|
|
|
enum {
|
|
|
|
MLX5_CQE_SYND_FLUSHED_IN_ERROR = 5,
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
struct mlx5_err_cqe {
|
|
|
|
u8 rsvd0[32];
|
|
|
|
__be32 srqn;
|
|
|
|
u8 rsvd1[18];
|
|
|
|
u8 vendor_err_synd;
|
|
|
|
u8 syndrome;
|
|
|
|
__be32 s_wqe_opcode_qpn;
|
|
|
|
__be16 wqe_counter;
|
|
|
|
u8 signature;
|
|
|
|
u8 op_own;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_cqe64 {
|
2016-04-25 03:51:56 +08:00
|
|
|
u8 outer_l3_tunneled;
|
|
|
|
u8 rsvd0;
|
|
|
|
__be16 wqe_id;
|
2015-05-29 03:28:40 +08:00
|
|
|
u8 lro_tcppsh_abort_dupack;
|
|
|
|
u8 lro_min_ttl;
|
|
|
|
__be16 lro_tcp_win;
|
|
|
|
__be32 lro_ack_seq_num;
|
|
|
|
__be32 rss_hash_result;
|
|
|
|
u8 rss_hash_type;
|
2013-07-07 22:25:49 +08:00
|
|
|
u8 ml_path;
|
2015-05-29 03:28:40 +08:00
|
|
|
u8 rsvd20[2];
|
|
|
|
__be16 check_sum;
|
2013-07-07 22:25:49 +08:00
|
|
|
__be16 slid;
|
|
|
|
__be32 flags_rqpn;
|
2015-05-29 03:28:40 +08:00
|
|
|
u8 hds_ip_ext;
|
2016-04-25 03:51:56 +08:00
|
|
|
u8 l4_l3_hdr_type;
|
2015-05-29 03:28:40 +08:00
|
|
|
__be16 vlan_info;
|
|
|
|
__be32 srqn; /* [31:24]: lro_num_seg, [23:0]: srqn */
|
2013-07-07 22:25:49 +08:00
|
|
|
__be32 imm_inval_pkey;
|
|
|
|
u8 rsvd40[4];
|
|
|
|
__be32 byte_cnt;
|
2015-12-29 20:58:30 +08:00
|
|
|
__be32 timestamp_h;
|
|
|
|
__be32 timestamp_l;
|
2013-07-07 22:25:49 +08:00
|
|
|
__be32 sop_drop_qpn;
|
|
|
|
__be16 wqe_counter;
|
|
|
|
u8 signature;
|
|
|
|
u8 op_own;
|
|
|
|
};
|
|
|
|
|
2016-05-11 05:29:14 +08:00
|
|
|
struct mlx5_mini_cqe8 {
|
|
|
|
union {
|
|
|
|
__be32 rx_hash_result;
|
|
|
|
struct {
|
|
|
|
__be16 checksum;
|
|
|
|
__be16 rsvd;
|
|
|
|
};
|
|
|
|
struct {
|
|
|
|
__be16 wqe_counter;
|
|
|
|
u8 s_wqe_opcode;
|
|
|
|
u8 reserved;
|
|
|
|
} s_wqe_info;
|
|
|
|
};
|
|
|
|
__be32 byte_cnt;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_NO_INLINE_DATA,
|
|
|
|
MLX5_INLINE_DATA32_SEG,
|
|
|
|
MLX5_INLINE_DATA64_SEG,
|
|
|
|
MLX5_COMPRESSED,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_CQE_FORMAT_CSUM = 0x1,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MLX5_MINI_CQE_ARRAY_SIZE 8
|
|
|
|
|
2018-07-17 09:35:36 +08:00
|
|
|
static inline u8 mlx5_get_cqe_format(struct mlx5_cqe64 *cqe)
|
2016-05-11 05:29:14 +08:00
|
|
|
{
|
|
|
|
return (cqe->op_own >> 2) & 0x3;
|
|
|
|
}
|
|
|
|
|
2017-06-05 16:17:20 +08:00
|
|
|
static inline u8 get_cqe_lro_tcppsh(struct mlx5_cqe64 *cqe)
|
2015-05-29 03:28:40 +08:00
|
|
|
{
|
|
|
|
return (cqe->lro_tcppsh_abort_dupack >> 6) & 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u8 get_cqe_l4_hdr_type(struct mlx5_cqe64 *cqe)
|
|
|
|
{
|
2016-04-25 03:51:56 +08:00
|
|
|
return (cqe->l4_l3_hdr_type >> 4) & 0x7;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u8 get_cqe_l3_hdr_type(struct mlx5_cqe64 *cqe)
|
|
|
|
{
|
|
|
|
return (cqe->l4_l3_hdr_type >> 2) & 0x3;
|
|
|
|
}
|
|
|
|
|
2018-07-17 09:35:36 +08:00
|
|
|
static inline bool cqe_is_tunneled(struct mlx5_cqe64 *cqe)
|
2016-04-25 03:51:56 +08:00
|
|
|
{
|
|
|
|
return cqe->outer_l3_tunneled & 0x1;
|
2015-05-29 03:28:40 +08:00
|
|
|
}
|
|
|
|
|
2018-07-17 09:35:36 +08:00
|
|
|
static inline bool cqe_has_vlan(struct mlx5_cqe64 *cqe)
|
2015-05-29 03:28:40 +08:00
|
|
|
{
|
2018-07-17 09:35:36 +08:00
|
|
|
return cqe->l4_l3_hdr_type & 0x1;
|
2015-05-29 03:28:40 +08:00
|
|
|
}
|
|
|
|
|
2015-12-29 20:58:30 +08:00
|
|
|
static inline u64 get_cqe_ts(struct mlx5_cqe64 *cqe)
|
|
|
|
{
|
|
|
|
u32 hi, lo;
|
|
|
|
|
|
|
|
hi = be32_to_cpu(cqe->timestamp_h);
|
|
|
|
lo = be32_to_cpu(cqe->timestamp_l);
|
|
|
|
|
|
|
|
return (u64)lo | ((u64)hi << 32);
|
|
|
|
}
|
|
|
|
|
net/mlx5e: Use linear SKB in Striding RQ
Current Striding RQ HW feature utilizes the RX buffers so that
there is no wasted room between the strides. This maximises
the memory utilization.
This prevents the use of build_skb() (which requires headroom
and tailroom), and demands to memcpy the packets headers into
the skb linear part.
In this patch, whenever a set of conditions holds, we apply
an RQ configuration that allows combining the use of linear SKB
on top of a Striding RQ.
To use build_skb() with Striding RQ, the following must hold:
1. packet does not cross a page boundary.
2. there is enough headroom and tailroom surrounding the packet.
We can satisfy 1 and 2 by configuring:
stride size = MTU + headroom + tailoom.
This is possible only when:
a. (MTU - headroom - tailoom) does not exceed PAGE_SIZE.
b. HW LRO is turned off.
Using linear SKB has many advantages:
- Saves a memcpy of the headers.
- No page-boundary checks in datapath.
- No filler CQEs.
- Significantly smaller CQ.
- SKB data continuously resides in linear part, and not split to
small amount (linear part) and large amount (fragment).
This saves datapath cycles in driver and improves utilization
of SKB fragments in GRO.
- The fragments of a resulting GRO SKB follow the IP forwarding
assumption of equal-size fragments.
Some implementation details:
HW writes the packets to the beginning of a stride,
i.e. does not keep headroom. To overcome this we make sure we can
extend backwards and use the last bytes of stride i-1.
Extra care is needed for stride 0 as it has no preceding stride.
We make sure headroom bytes are available by shifting the buffer
pointer passed to HW by headroom bytes.
This configuration now becomes default, whenever capable.
Of course, this implies turning LRO off.
Performance testing:
ConnectX-5, single core, single RX ring, default MTU.
UDP packet rate, early drop in TC layer:
--------------------------------------------
| pkt size | before | after | ratio |
--------------------------------------------
| 1500byte | 4.65 Mpps | 5.96 Mpps | 1.28x |
| 500byte | 5.23 Mpps | 5.97 Mpps | 1.14x |
| 64byte | 5.94 Mpps | 5.96 Mpps | 1.00x |
--------------------------------------------
TCP streams: ~20% gain
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
2018-02-07 20:41:25 +08:00
|
|
|
#define MLX5_MPWQE_LOG_NUM_STRIDES_BASE (9)
|
|
|
|
#define MLX5_MPWQE_LOG_STRIDE_SZ_BASE (6)
|
|
|
|
|
net/mlx5e: Support RX multi-packet WQE (Striding RQ)
Introduce the feature of multi-packet WQE (RX Work Queue Element)
referred to as (MPWQE or Striding RQ), in which WQEs are larger
and serve multiple packets each.
Every WQE consists of many strides of the same size, every received
packet is aligned to a beginning of a stride and is written to
consecutive strides within a WQE.
In the regular approach, each regular WQE is big enough to be capable
of serving one received packet of any size up to MTU or 64K in case of
device LRO is enabled, making it very wasteful when dealing with
small packets or device LRO is enabled.
For its flexibility, MPWQE allows a better memory utilization
(implying improvements in CPU utilization and packet rate) as packets
consume strides according to their size, preserving the rest of
the WQE to be available for other packets.
MPWQE default configuration:
Num of WQEs = 16
Strides Per WQE = 2048
Stride Size = 64 byte
The default WQEs memory footprint went from 1024*mtu (~1.5MB) to
16 * 2048 * 64 = 2MB per ring.
However, HW LRO can now be supported at no additional cost in memory
footprint, and hence we turn it on by default and get an even better
performance.
Performance tested on ConnectX4-Lx 50G.
To isolate the feature under test, the numbers below were measured with
HW LRO turned off. We verified that the performance just improves when
LRO is turned back on.
* Netperf single TCP stream:
- BW raised by 10-15% for representative packet sizes:
default, 64B, 1024B, 1478B, 65536B.
* Netperf multi TCP stream:
- No degradation, line rate reached.
* Pktgen: packet rate raised by 2-10% for traffic of different message
sizes: 64B, 128B, 256B, 1024B, and 1500B.
* Pktgen: packet loss in bursts of small messages (64byte),
single stream:
- | num packets | packets loss before | packets loss after
| 2K | ~ 1K | 0
| 8K | ~ 6K | 0
| 16K | ~13K | 0
| 32K | ~28K | 0
| 64K | ~57K | ~24K
As expected as the driver can receive as many small packets (<=64B) as
the number of total strides in the ring (default = 2048 * 16) vs. 1024
(default ring size regardless of packets size) before this feature.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-04-21 03:02:13 +08:00
|
|
|
struct mpwrq_cqe_bc {
|
|
|
|
__be16 filler_consumed_strides;
|
|
|
|
__be16 byte_cnt;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline u16 mpwrq_get_cqe_byte_cnt(struct mlx5_cqe64 *cqe)
|
|
|
|
{
|
|
|
|
struct mpwrq_cqe_bc *bc = (struct mpwrq_cqe_bc *)&cqe->byte_cnt;
|
|
|
|
|
|
|
|
return be16_to_cpu(bc->byte_cnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u16 mpwrq_get_cqe_bc_consumed_strides(struct mpwrq_cqe_bc *bc)
|
|
|
|
{
|
|
|
|
return 0x7fff & be16_to_cpu(bc->filler_consumed_strides);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u16 mpwrq_get_cqe_consumed_strides(struct mlx5_cqe64 *cqe)
|
|
|
|
{
|
|
|
|
struct mpwrq_cqe_bc *bc = (struct mpwrq_cqe_bc *)&cqe->byte_cnt;
|
|
|
|
|
|
|
|
return mpwrq_get_cqe_bc_consumed_strides(bc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool mpwrq_is_filler_cqe(struct mlx5_cqe64 *cqe)
|
|
|
|
{
|
|
|
|
struct mpwrq_cqe_bc *bc = (struct mpwrq_cqe_bc *)&cqe->byte_cnt;
|
|
|
|
|
|
|
|
return 0x8000 & be16_to_cpu(bc->filler_consumed_strides);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u16 mpwrq_get_cqe_stride_index(struct mlx5_cqe64 *cqe)
|
|
|
|
{
|
|
|
|
return be16_to_cpu(cqe->wqe_counter);
|
|
|
|
}
|
|
|
|
|
2015-05-29 03:28:40 +08:00
|
|
|
enum {
|
|
|
|
CQE_L4_HDR_TYPE_NONE = 0x0,
|
|
|
|
CQE_L4_HDR_TYPE_TCP_NO_ACK = 0x1,
|
|
|
|
CQE_L4_HDR_TYPE_UDP = 0x2,
|
|
|
|
CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA = 0x3,
|
|
|
|
CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA = 0x4,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2017-05-23 02:13:07 +08:00
|
|
|
CQE_RSS_HTYPE_IP = 0x3 << 2,
|
|
|
|
/* cqe->rss_hash_type[3:2] - IP destination selected for hash
|
|
|
|
* (00 = none, 01 = IPv4, 10 = IPv6, 11 = Reserved)
|
|
|
|
*/
|
|
|
|
CQE_RSS_HTYPE_L4 = 0x3 << 6,
|
|
|
|
/* cqe->rss_hash_type[7:6] - L4 destination selected for hash
|
|
|
|
* (00 = none, 01 = TCP. 10 = UDP, 11 = IPSEC.SPI
|
|
|
|
*/
|
2015-05-29 03:28:40 +08:00
|
|
|
};
|
|
|
|
|
2015-12-24 00:47:22 +08:00
|
|
|
enum {
|
|
|
|
MLX5_CQE_ROCE_L3_HEADER_TYPE_GRH = 0x0,
|
|
|
|
MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV6 = 0x1,
|
|
|
|
MLX5_CQE_ROCE_L3_HEADER_TYPE_IPV4 = 0x2,
|
|
|
|
};
|
|
|
|
|
2015-05-29 03:28:40 +08:00
|
|
|
enum {
|
|
|
|
CQE_L2_OK = 1 << 0,
|
|
|
|
CQE_L3_OK = 1 << 1,
|
|
|
|
CQE_L4_OK = 1 << 2,
|
|
|
|
};
|
|
|
|
|
2014-02-23 20:19:12 +08:00
|
|
|
struct mlx5_sig_err_cqe {
|
|
|
|
u8 rsvd0[16];
|
|
|
|
__be32 expected_trans_sig;
|
|
|
|
__be32 actual_trans_sig;
|
|
|
|
__be32 expected_reftag;
|
|
|
|
__be32 actual_reftag;
|
|
|
|
__be16 syndrome;
|
|
|
|
u8 rsvd22[2];
|
|
|
|
__be32 mkey;
|
|
|
|
__be64 err_offset;
|
|
|
|
u8 rsvd30[8];
|
|
|
|
__be32 qpn;
|
|
|
|
u8 rsvd38[2];
|
|
|
|
u8 signature;
|
|
|
|
u8 op_own;
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
struct mlx5_wqe_srq_next_seg {
|
|
|
|
u8 rsvd0[2];
|
|
|
|
__be16 next_wqe_index;
|
|
|
|
u8 signature;
|
|
|
|
u8 rsvd1[11];
|
|
|
|
};
|
|
|
|
|
|
|
|
union mlx5_ext_cqe {
|
|
|
|
struct ib_grh grh;
|
|
|
|
u8 inl[64];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx5_cqe128 {
|
|
|
|
union mlx5_ext_cqe inl_grh;
|
|
|
|
struct mlx5_cqe64 cqe64;
|
|
|
|
};
|
|
|
|
|
2014-12-11 23:04:11 +08:00
|
|
|
enum {
|
|
|
|
MLX5_MKEY_STATUS_FREE = 1 << 6,
|
|
|
|
};
|
|
|
|
|
2016-07-16 11:28:36 +08:00
|
|
|
enum {
|
|
|
|
MLX5_MKEY_REMOTE_INVAL = 1 << 24,
|
|
|
|
MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29,
|
|
|
|
MLX5_MKEY_BSF_EN = 1 << 30,
|
|
|
|
MLX5_MKEY_LEN64 = 1 << 31,
|
|
|
|
};
|
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
struct mlx5_mkey_seg {
|
|
|
|
/* This is a two bit field occupying bits 31-30.
|
|
|
|
* bit 31 is always 0,
|
|
|
|
* bit 30 is zero for regular MRs and 1 (e.g free) for UMRs that do not have tanslation
|
|
|
|
*/
|
|
|
|
u8 status;
|
|
|
|
u8 pcie_control;
|
|
|
|
u8 flags;
|
|
|
|
u8 version;
|
|
|
|
__be32 qpn_mkey7_0;
|
|
|
|
u8 rsvd1[4];
|
|
|
|
__be32 flags_pd;
|
|
|
|
__be64 start_addr;
|
|
|
|
__be64 len;
|
|
|
|
__be32 bsfs_octo_size;
|
|
|
|
u8 rsvd2[16];
|
|
|
|
__be32 xlt_oct_size;
|
|
|
|
u8 rsvd3[3];
|
|
|
|
u8 log2_page_size;
|
|
|
|
u8 rsvd4[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MLX5_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
|
|
|
|
};
|
|
|
|
|
2015-05-29 03:28:40 +08:00
|
|
|
enum {
|
|
|
|
VPORT_STATE_DOWN = 0x0,
|
|
|
|
VPORT_STATE_UP = 0x1,
|
|
|
|
};
|
|
|
|
|
2015-12-02 00:03:20 +08:00
|
|
|
enum {
|
2018-08-09 07:23:49 +08:00
|
|
|
MLX5_VPORT_ADMIN_STATE_DOWN = 0x0,
|
|
|
|
MLX5_VPORT_ADMIN_STATE_UP = 0x1,
|
|
|
|
MLX5_VPORT_ADMIN_STATE_AUTO = 0x2,
|
2015-12-02 00:03:20 +08:00
|
|
|
};
|
|
|
|
|
2015-05-29 03:28:40 +08:00
|
|
|
enum {
|
|
|
|
MLX5_L3_PROT_TYPE_IPV4 = 0,
|
|
|
|
MLX5_L3_PROT_TYPE_IPV6 = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_L4_PROT_TYPE_TCP = 0,
|
|
|
|
MLX5_L4_PROT_TYPE_UDP = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_HASH_FIELD_SEL_SRC_IP = 1 << 0,
|
|
|
|
MLX5_HASH_FIELD_SEL_DST_IP = 1 << 1,
|
|
|
|
MLX5_HASH_FIELD_SEL_L4_SPORT = 1 << 2,
|
|
|
|
MLX5_HASH_FIELD_SEL_L4_DPORT = 1 << 3,
|
|
|
|
MLX5_HASH_FIELD_SEL_IPSEC_SPI = 1 << 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_MATCH_OUTER_HEADERS = 1 << 0,
|
|
|
|
MLX5_MATCH_MISC_PARAMETERS = 1 << 1,
|
|
|
|
MLX5_MATCH_INNER_HEADERS = 1 << 2,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_FLOW_TABLE_TYPE_NIC_RCV = 0,
|
|
|
|
MLX5_FLOW_TABLE_TYPE_ESWITCH = 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX5_FLOW_CONTEXT_DEST_TYPE_VPORT = 0,
|
|
|
|
MLX5_FLOW_CONTEXT_DEST_TYPE_FLOW_TABLE = 1,
|
|
|
|
MLX5_FLOW_CONTEXT_DEST_TYPE_TIR = 2,
|
|
|
|
};
|
|
|
|
|
2015-12-02 00:03:12 +08:00
|
|
|
enum mlx5_list_type {
|
|
|
|
MLX5_NVPRT_LIST_TYPE_UC = 0x0,
|
|
|
|
MLX5_NVPRT_LIST_TYPE_MC = 0x1,
|
|
|
|
MLX5_NVPRT_LIST_TYPE_VLAN = 0x2,
|
|
|
|
};
|
|
|
|
|
2015-05-29 03:28:40 +08:00
|
|
|
enum {
|
|
|
|
MLX5_RQC_RQ_TYPE_MEMORY_RQ_INLINE = 0x0,
|
|
|
|
MLX5_RQC_RQ_TYPE_MEMORY_RQ_RPM = 0x1,
|
|
|
|
};
|
|
|
|
|
2016-02-23 00:17:29 +08:00
|
|
|
enum mlx5_wol_mode {
|
|
|
|
MLX5_WOL_DISABLE = 0,
|
|
|
|
MLX5_WOL_SECURED_MAGIC = 1 << 1,
|
|
|
|
MLX5_WOL_MAGIC = 1 << 2,
|
|
|
|
MLX5_WOL_ARP = 1 << 3,
|
|
|
|
MLX5_WOL_BROADCAST = 1 << 4,
|
|
|
|
MLX5_WOL_MULTICAST = 1 << 5,
|
|
|
|
MLX5_WOL_UNICAST = 1 << 6,
|
|
|
|
MLX5_WOL_PHY_ACTIVITY = 1 << 7,
|
|
|
|
};
|
|
|
|
|
2018-05-13 19:33:34 +08:00
|
|
|
enum mlx5_mpls_supported_fields {
|
|
|
|
MLX5_FIELD_SUPPORT_MPLS_LABEL = 1 << 0,
|
|
|
|
MLX5_FIELD_SUPPORT_MPLS_EXP = 1 << 1,
|
|
|
|
MLX5_FIELD_SUPPORT_MPLS_S_BOS = 1 << 2,
|
|
|
|
MLX5_FIELD_SUPPORT_MPLS_TTL = 1 << 3
|
|
|
|
};
|
|
|
|
|
2018-05-13 19:33:35 +08:00
|
|
|
enum mlx5_flex_parser_protos {
|
|
|
|
MLX5_FLEX_PROTO_CW_MPLS_GRE = 1 << 4,
|
|
|
|
MLX5_FLEX_PROTO_CW_MPLS_UDP = 1 << 5,
|
|
|
|
};
|
|
|
|
|
2015-05-29 03:28:41 +08:00
|
|
|
/* MLX5 DEV CAPs */
|
|
|
|
|
|
|
|
/* TODO: EAT.ME */
|
|
|
|
enum mlx5_cap_mode {
|
|
|
|
HCA_CAP_OPMOD_GET_MAX = 0,
|
|
|
|
HCA_CAP_OPMOD_GET_CUR = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum mlx5_cap_type {
|
|
|
|
MLX5_CAP_GENERAL = 0,
|
|
|
|
MLX5_CAP_ETHERNET_OFFLOADS,
|
|
|
|
MLX5_CAP_ODP,
|
|
|
|
MLX5_CAP_ATOMIC,
|
|
|
|
MLX5_CAP_ROCE,
|
|
|
|
MLX5_CAP_IPOIB_OFFLOADS,
|
2017-06-08 21:15:10 +08:00
|
|
|
MLX5_CAP_IPOIB_ENHANCED_OFFLOADS,
|
2015-05-29 03:28:41 +08:00
|
|
|
MLX5_CAP_FLOW_TABLE,
|
2015-12-02 00:03:19 +08:00
|
|
|
MLX5_CAP_ESWITCH_FLOW_TABLE,
|
2015-12-02 00:03:22 +08:00
|
|
|
MLX5_CAP_ESWITCH,
|
2016-02-23 16:25:23 +08:00
|
|
|
MLX5_CAP_RESERVED,
|
|
|
|
MLX5_CAP_VECTOR_CALC,
|
2016-06-23 22:02:37 +08:00
|
|
|
MLX5_CAP_QOS,
|
2017-08-17 21:39:47 +08:00
|
|
|
MLX5_CAP_DEBUG,
|
2018-04-05 23:53:26 +08:00
|
|
|
MLX5_CAP_RESERVED_14,
|
|
|
|
MLX5_CAP_DEV_MEM,
|
2015-05-29 03:28:41 +08:00
|
|
|
/* NUM OF CAP Types */
|
|
|
|
MLX5_CAP_NUM
|
|
|
|
};
|
|
|
|
|
2016-12-08 21:52:00 +08:00
|
|
|
enum mlx5_pcam_reg_groups {
|
|
|
|
MLX5_PCAM_REGS_5000_TO_507F = 0x0,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum mlx5_pcam_feature_groups {
|
|
|
|
MLX5_PCAM_FEATURE_ENHANCED_FEATURES = 0x0,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum mlx5_mcam_reg_groups {
|
|
|
|
MLX5_MCAM_REGS_FIRST_128 = 0x0,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum mlx5_mcam_feature_groups {
|
|
|
|
MLX5_MCAM_FEATURE_ENHANCED_FEATURES = 0x0,
|
|
|
|
};
|
|
|
|
|
2017-07-19 05:03:17 +08:00
|
|
|
enum mlx5_qcam_reg_groups {
|
|
|
|
MLX5_QCAM_REGS_FIRST_128 = 0x0,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum mlx5_qcam_feature_groups {
|
|
|
|
MLX5_QCAM_FEATURE_ENHANCED_FEATURES = 0x0,
|
|
|
|
};
|
|
|
|
|
2015-05-29 03:28:41 +08:00
|
|
|
/* GET Dev Caps macros */
|
|
|
|
#define MLX5_CAP_GEN(mdev, cap) \
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(cmd_hca_cap, mdev->caps.hca_cur[MLX5_CAP_GENERAL], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
2018-03-08 20:36:27 +08:00
|
|
|
#define MLX5_CAP_GEN_64(mdev, cap) \
|
|
|
|
MLX5_GET64(cmd_hca_cap, mdev->caps.hca_cur[MLX5_CAP_GENERAL], cap)
|
|
|
|
|
2015-05-29 03:28:41 +08:00
|
|
|
#define MLX5_CAP_GEN_MAX(mdev, cap) \
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(cmd_hca_cap, mdev->caps.hca_max[MLX5_CAP_GENERAL], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_ETH(mdev, cap) \
|
|
|
|
MLX5_GET(per_protocol_networking_offload_caps,\
|
2016-12-14 23:40:41 +08:00
|
|
|
mdev->caps.hca_cur[MLX5_CAP_ETHERNET_OFFLOADS], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_ETH_MAX(mdev, cap) \
|
|
|
|
MLX5_GET(per_protocol_networking_offload_caps,\
|
2016-12-14 23:40:41 +08:00
|
|
|
mdev->caps.hca_max[MLX5_CAP_ETHERNET_OFFLOADS], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
2017-06-08 21:15:10 +08:00
|
|
|
#define MLX5_CAP_IPOIB_ENHANCED(mdev, cap) \
|
|
|
|
MLX5_GET(per_protocol_networking_offload_caps,\
|
|
|
|
mdev->caps.hca_cur[MLX5_CAP_IPOIB_ENHANCED_OFFLOADS], cap)
|
|
|
|
|
2015-05-29 03:28:41 +08:00
|
|
|
#define MLX5_CAP_ROCE(mdev, cap) \
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(roce_cap, mdev->caps.hca_cur[MLX5_CAP_ROCE], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_ROCE_MAX(mdev, cap) \
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(roce_cap, mdev->caps.hca_max[MLX5_CAP_ROCE], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_ATOMIC(mdev, cap) \
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(atomic_caps, mdev->caps.hca_cur[MLX5_CAP_ATOMIC], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_ATOMIC_MAX(mdev, cap) \
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(atomic_caps, mdev->caps.hca_max[MLX5_CAP_ATOMIC], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_FLOWTABLE(mdev, cap) \
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(flow_table_nic_cap, mdev->caps.hca_cur[MLX5_CAP_FLOW_TABLE], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_FLOWTABLE_MAX(mdev, cap) \
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(flow_table_nic_cap, mdev->caps.hca_max[MLX5_CAP_FLOW_TABLE], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
2016-06-10 05:07:32 +08:00
|
|
|
#define MLX5_CAP_FLOWTABLE_NIC_RX(mdev, cap) \
|
|
|
|
MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP_FLOWTABLE_NIC_RX_MAX(mdev, cap) \
|
|
|
|
MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive.cap)
|
|
|
|
|
2018-08-28 19:18:41 +08:00
|
|
|
#define MLX5_CAP_FLOWTABLE_NIC_TX(mdev, cap) \
|
|
|
|
MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_transmit.cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP_FLOWTABLE_NIC_TX_MAX(mdev, cap) \
|
|
|
|
MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_transmit.cap)
|
|
|
|
|
2016-05-31 19:09:09 +08:00
|
|
|
#define MLX5_CAP_FLOWTABLE_SNIFFER_RX(mdev, cap) \
|
|
|
|
MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive_sniffer.cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP_FLOWTABLE_SNIFFER_RX_MAX(mdev, cap) \
|
|
|
|
MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive_sniffer.cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP_FLOWTABLE_SNIFFER_TX(mdev, cap) \
|
|
|
|
MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_transmit_sniffer.cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP_FLOWTABLE_SNIFFER_TX_MAX(mdev, cap) \
|
|
|
|
MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_transmit_sniffer.cap)
|
|
|
|
|
2015-12-02 00:03:19 +08:00
|
|
|
#define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \
|
|
|
|
MLX5_GET(flow_table_eswitch_cap, \
|
2016-12-14 23:40:41 +08:00
|
|
|
mdev->caps.hca_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
|
2015-12-02 00:03:19 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_ESW_FLOWTABLE_MAX(mdev, cap) \
|
|
|
|
MLX5_GET(flow_table_eswitch_cap, \
|
2016-12-14 23:40:41 +08:00
|
|
|
mdev->caps.hca_max[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
|
2015-12-02 00:03:19 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, cap) \
|
|
|
|
MLX5_CAP_ESW_FLOWTABLE(mdev, flow_table_properties_nic_esw_fdb.cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP_ESW_FLOWTABLE_FDB_MAX(mdev, cap) \
|
|
|
|
MLX5_CAP_ESW_FLOWTABLE_MAX(mdev, flow_table_properties_nic_esw_fdb.cap)
|
|
|
|
|
2016-05-03 22:13:54 +08:00
|
|
|
#define MLX5_CAP_ESW_EGRESS_ACL(mdev, cap) \
|
|
|
|
MLX5_CAP_ESW_FLOWTABLE(mdev, flow_table_properties_esw_acl_egress.cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP_ESW_EGRESS_ACL_MAX(mdev, cap) \
|
|
|
|
MLX5_CAP_ESW_FLOWTABLE_MAX(mdev, flow_table_properties_esw_acl_egress.cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP_ESW_INGRESS_ACL(mdev, cap) \
|
|
|
|
MLX5_CAP_ESW_FLOWTABLE(mdev, flow_table_properties_esw_acl_ingress.cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP_ESW_INGRESS_ACL_MAX(mdev, cap) \
|
|
|
|
MLX5_CAP_ESW_FLOWTABLE_MAX(mdev, flow_table_properties_esw_acl_ingress.cap)
|
|
|
|
|
2015-12-02 00:03:22 +08:00
|
|
|
#define MLX5_CAP_ESW(mdev, cap) \
|
|
|
|
MLX5_GET(e_switch_cap, \
|
2016-12-14 23:40:41 +08:00
|
|
|
mdev->caps.hca_cur[MLX5_CAP_ESWITCH], cap)
|
2015-12-02 00:03:22 +08:00
|
|
|
|
|
|
|
#define MLX5_CAP_ESW_MAX(mdev, cap) \
|
|
|
|
MLX5_GET(e_switch_cap, \
|
2016-12-14 23:40:41 +08:00
|
|
|
mdev->caps.hca_max[MLX5_CAP_ESWITCH], cap)
|
2015-12-02 00:03:22 +08:00
|
|
|
|
2015-05-29 03:28:41 +08:00
|
|
|
#define MLX5_CAP_ODP(mdev, cap)\
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(odp_cap, mdev->caps.hca_cur[MLX5_CAP_ODP], cap)
|
2015-05-29 03:28:41 +08:00
|
|
|
|
2016-02-23 16:25:23 +08:00
|
|
|
#define MLX5_CAP_VECTOR_CALC(mdev, cap) \
|
|
|
|
MLX5_GET(vector_calc_cap, \
|
2016-12-14 23:40:41 +08:00
|
|
|
mdev->caps.hca_cur[MLX5_CAP_VECTOR_CALC], cap)
|
2016-02-23 16:25:23 +08:00
|
|
|
|
2016-06-23 22:02:37 +08:00
|
|
|
#define MLX5_CAP_QOS(mdev, cap)\
|
2016-12-14 23:40:41 +08:00
|
|
|
MLX5_GET(qos_cap, mdev->caps.hca_cur[MLX5_CAP_QOS], cap)
|
2016-06-23 22:02:37 +08:00
|
|
|
|
2017-08-17 21:39:47 +08:00
|
|
|
#define MLX5_CAP_DEBUG(mdev, cap)\
|
|
|
|
MLX5_GET(debug_cap, mdev->caps.hca_cur[MLX5_CAP_DEBUG], cap)
|
|
|
|
|
2016-12-08 22:03:31 +08:00
|
|
|
#define MLX5_CAP_PCAM_FEATURE(mdev, fld) \
|
|
|
|
MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld)
|
|
|
|
|
2018-03-01 04:16:47 +08:00
|
|
|
#define MLX5_CAP_PCAM_REG(mdev, reg) \
|
|
|
|
MLX5_GET(pcam_reg, (mdev)->caps.pcam, port_access_reg_cap_mask.regs_5000_to_507f.reg)
|
|
|
|
|
2017-06-11 20:25:38 +08:00
|
|
|
#define MLX5_CAP_MCAM_REG(mdev, reg) \
|
|
|
|
MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_access_reg_cap_mask.access_regs.reg)
|
|
|
|
|
2016-12-08 22:03:31 +08:00
|
|
|
#define MLX5_CAP_MCAM_FEATURE(mdev, fld) \
|
|
|
|
MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld)
|
|
|
|
|
2017-07-19 05:03:17 +08:00
|
|
|
#define MLX5_CAP_QCAM_REG(mdev, fld) \
|
|
|
|
MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_access_reg_cap_mask.reg_cap.fld)
|
|
|
|
|
|
|
|
#define MLX5_CAP_QCAM_FEATURE(mdev, fld) \
|
|
|
|
MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_feature_cap_mask.feature_cap.fld)
|
|
|
|
|
2017-03-14 02:05:45 +08:00
|
|
|
#define MLX5_CAP_FPGA(mdev, cap) \
|
2017-08-24 22:21:44 +08:00
|
|
|
MLX5_GET(fpga_cap, (mdev)->caps.fpga, cap)
|
2017-03-14 02:05:45 +08:00
|
|
|
|
2017-04-18 18:10:41 +08:00
|
|
|
#define MLX5_CAP64_FPGA(mdev, cap) \
|
2017-08-24 22:21:44 +08:00
|
|
|
MLX5_GET64(fpga_cap, (mdev)->caps.fpga, cap)
|
2017-04-18 18:10:41 +08:00
|
|
|
|
2018-04-05 23:53:26 +08:00
|
|
|
#define MLX5_CAP_DEV_MEM(mdev, cap)\
|
|
|
|
MLX5_GET(device_mem_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_MEM], cap)
|
|
|
|
|
|
|
|
#define MLX5_CAP64_DEV_MEM(mdev, cap)\
|
|
|
|
MLX5_GET64(device_mem_cap, mdev->caps.hca_cur[MLX5_CAP_DEV_MEM], cap)
|
|
|
|
|
2015-05-29 03:28:48 +08:00
|
|
|
enum {
|
|
|
|
MLX5_CMD_STAT_OK = 0x0,
|
|
|
|
MLX5_CMD_STAT_INT_ERR = 0x1,
|
|
|
|
MLX5_CMD_STAT_BAD_OP_ERR = 0x2,
|
|
|
|
MLX5_CMD_STAT_BAD_PARAM_ERR = 0x3,
|
|
|
|
MLX5_CMD_STAT_BAD_SYS_STATE_ERR = 0x4,
|
|
|
|
MLX5_CMD_STAT_BAD_RES_ERR = 0x5,
|
|
|
|
MLX5_CMD_STAT_RES_BUSY = 0x6,
|
|
|
|
MLX5_CMD_STAT_LIM_ERR = 0x8,
|
|
|
|
MLX5_CMD_STAT_BAD_RES_STATE_ERR = 0x9,
|
|
|
|
MLX5_CMD_STAT_IX_ERR = 0xa,
|
|
|
|
MLX5_CMD_STAT_NO_RES_ERR = 0xf,
|
|
|
|
MLX5_CMD_STAT_BAD_INP_LEN_ERR = 0x50,
|
|
|
|
MLX5_CMD_STAT_BAD_OUTP_LEN_ERR = 0x51,
|
|
|
|
MLX5_CMD_STAT_BAD_QP_STATE_ERR = 0x10,
|
|
|
|
MLX5_CMD_STAT_BAD_PKT_ERR = 0x30,
|
|
|
|
MLX5_CMD_STAT_BAD_SIZE_OUTS_CQES_ERR = 0x40,
|
|
|
|
};
|
|
|
|
|
2015-08-04 19:05:47 +08:00
|
|
|
enum {
|
|
|
|
MLX5_IEEE_802_3_COUNTERS_GROUP = 0x0,
|
|
|
|
MLX5_RFC_2863_COUNTERS_GROUP = 0x1,
|
|
|
|
MLX5_RFC_2819_COUNTERS_GROUP = 0x2,
|
|
|
|
MLX5_RFC_3635_COUNTERS_GROUP = 0x3,
|
|
|
|
MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP = 0x5,
|
|
|
|
MLX5_PER_PRIORITY_COUNTERS_GROUP = 0x10,
|
2016-02-19 00:15:00 +08:00
|
|
|
MLX5_PER_TRAFFIC_CLASS_COUNTERS_GROUP = 0x11,
|
2016-04-25 03:51:50 +08:00
|
|
|
MLX5_PHYSICAL_LAYER_COUNTERS_GROUP = 0x12,
|
2016-09-27 22:04:51 +08:00
|
|
|
MLX5_PHYSICAL_LAYER_STATISTICAL_GROUP = 0x16,
|
2016-02-19 00:15:00 +08:00
|
|
|
MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20,
|
2015-08-04 19:05:47 +08:00
|
|
|
};
|
|
|
|
|
2016-11-17 19:46:01 +08:00
|
|
|
enum {
|
|
|
|
MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP = 0x0,
|
|
|
|
};
|
|
|
|
|
2015-06-05 00:30:41 +08:00
|
|
|
static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz)
|
|
|
|
{
|
|
|
|
if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE)
|
|
|
|
return 0;
|
|
|
|
return MLX5_MIN_PKEY_TABLE_SIZE << pkey_sz;
|
|
|
|
}
|
|
|
|
|
2018-03-13 21:18:46 +08:00
|
|
|
#define MLX5_BY_PASS_NUM_REGULAR_PRIOS 16
|
|
|
|
#define MLX5_BY_PASS_NUM_DONT_TRAP_PRIOS 16
|
2016-03-08 00:51:47 +08:00
|
|
|
#define MLX5_BY_PASS_NUM_MULTICAST_PRIOS 1
|
|
|
|
#define MLX5_BY_PASS_NUM_PRIOS (MLX5_BY_PASS_NUM_REGULAR_PRIOS +\
|
|
|
|
MLX5_BY_PASS_NUM_DONT_TRAP_PRIOS +\
|
|
|
|
MLX5_BY_PASS_NUM_MULTICAST_PRIOS)
|
2016-01-11 16:26:04 +08:00
|
|
|
|
2013-07-07 22:25:49 +08:00
|
|
|
#endif /* MLX5_DEVICE_H */
|