2020-08-27 09:54:40 -05:00
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2016-06-16 16:45:23 +03:00
/*
* Copyright ( c ) 2016 Mellanox Technologies Ltd . All rights reserved .
* Copyright ( c ) 2015 System Fabric Works , Inc . All rights reserved .
*/
# ifndef RXE_PARAM_H
# define RXE_PARAM_H
2020-01-13 16:41:19 -08:00
# include <uapi/rdma/rdma_user_rxe.h>
2016-06-16 16:45:23 +03:00
static inline enum ib_mtu rxe_mtu_int_to_enum ( int mtu )
{
if ( mtu < 256 )
return 0 ;
else if ( mtu < 512 )
return IB_MTU_256 ;
else if ( mtu < 1024 )
return IB_MTU_512 ;
else if ( mtu < 2048 )
return IB_MTU_1024 ;
else if ( mtu < 4096 )
return IB_MTU_2048 ;
else
return IB_MTU_4096 ;
}
/* Find the IB mtu for a given network MTU. */
static inline enum ib_mtu eth_mtu_int_to_enum ( int mtu )
{
mtu - = RXE_MAX_HDR_LENGTH ;
return rxe_mtu_int_to_enum ( mtu ) ;
}
/* default/initial rxe device parameter settings */
enum rxe_device_param {
RXE_MAX_MR_SIZE = - 1ull ,
RXE_PAGE_SIZE_CAP = 0xfffff000 ,
RXE_MAX_QP = 0x10000 ,
RXE_MAX_QP_WR = 0x4000 ,
RXE_DEVICE_CAP_FLAGS = IB_DEVICE_BAD_PKEY_CNTR
| IB_DEVICE_BAD_QKEY_CNTR
| IB_DEVICE_AUTO_PATH_MIG
| IB_DEVICE_CHANGE_PHY_PORT
| IB_DEVICE_UD_AV_PORT_ENFORCE
| IB_DEVICE_PORT_ACTIVE_EVENT
| IB_DEVICE_SYS_IMAGE_GUID
| IB_DEVICE_RC_RNR_NAK_GEN
| IB_DEVICE_SRQ_RESIZE
2019-02-15 11:03:57 -08:00
| IB_DEVICE_MEM_MGT_EXTENSIONS
| IB_DEVICE_ALLOW_USER_UNREG ,
2016-06-16 16:45:23 +03:00
RXE_MAX_SGE = 32 ,
2020-01-13 16:41:19 -08:00
RXE_MAX_WQE_SIZE = sizeof ( struct rxe_send_wqe ) +
sizeof ( struct ib_sge ) * RXE_MAX_SGE ,
RXE_MAX_INLINE_DATA = RXE_MAX_WQE_SIZE -
sizeof ( struct rxe_send_wqe ) ,
2016-06-16 16:45:23 +03:00
RXE_MAX_SGE_RD = 32 ,
RXE_MAX_CQ = 16384 ,
2016-11-16 10:39:16 +02:00
RXE_MAX_LOG_CQE = 15 ,
2018-06-13 18:48:37 -07:00
RXE_MAX_MR = 256 * 1024 ,
2016-06-16 16:45:23 +03:00
RXE_MAX_PD = 0x7ffc ,
RXE_MAX_QP_RD_ATOM = 128 ,
RXE_MAX_RES_RD_ATOM = 0x3f000 ,
RXE_MAX_QP_INIT_RD_ATOM = 128 ,
RXE_MAX_MCAST_GRP = 8192 ,
RXE_MAX_MCAST_QP_ATTACH = 56 ,
RXE_MAX_TOT_MCAST_QP_ATTACH = 0x70000 ,
RXE_MAX_AH = 100 ,
RXE_MAX_SRQ = 960 ,
RXE_MAX_SRQ_WR = 0x4000 ,
RXE_MIN_SRQ_WR = 1 ,
RXE_MAX_SRQ_SGE = 27 ,
RXE_MIN_SRQ_SGE = 1 ,
RXE_MAX_FMR_PAGE_LIST_LEN = 512 ,
2020-07-21 13:16:18 +03:00
RXE_MAX_PKEYS = 1 ,
2016-06-16 16:45:23 +03:00
RXE_LOCAL_CA_ACK_DELAY = 15 ,
RXE_MAX_UCONTEXT = 512 ,
RXE_NUM_PORT = 1 ,
RXE_MIN_QP_INDEX = 16 ,
RXE_MAX_QP_INDEX = 0x00020000 ,
RXE_MIN_SRQ_INDEX = 0x00020001 ,
RXE_MAX_SRQ_INDEX = 0x00040000 ,
RXE_MIN_MR_INDEX = 0x00000001 ,
RXE_MAX_MR_INDEX = 0x00040000 ,
RXE_MIN_MW_INDEX = 0x00040001 ,
RXE_MAX_MW_INDEX = 0x00060000 ,
RXE_MAX_PKT_PER_ACK = 64 ,
RXE_MAX_UNACKED_PSNS = 128 ,
/* Max inflight SKBs per queue pair */
RXE_INFLIGHT_SKBS_PER_QP_HIGH = 64 ,
RXE_INFLIGHT_SKBS_PER_QP_LOW = 16 ,
/* Delay before calling arbiter timer */
RXE_NSEC_ARB_TIMER_DELAY = 200 ,
RDMA/rxe: Set default vendor ID
The RXE driver doesn't set vendor_id and user space applications see
zeros. This causes to pyverbs tests to fail with the following traceback,
because the expectation is to have valid vendor_id.
Traceback (most recent call last):
File "tests/test_device.py", line 51, in test_query_device
self.verify_device_attr(attr)
File "tests/test_device.py", line 77, in verify_device_attr
assert attr.vendor_id != 0
In order to fix it, we will set vendor_id 0XFFFFFF, according to the IBTA
v1.4 A3.3.1 VENDOR INFORMATION section.
"""
A vendor that produces a generic controller (i.e., one that supports a
standard I/O protocol such as SRP), which does not have vendor specific
device drivers, may use the value of 0xFFFFFF in the VendorID field.
"""
Before:
hca_id: rxe0
transport: InfiniBand (0)
fw_ver: 0.0.0
node_guid: 5054:00ff:feaa:5363
sys_image_guid: 5054:00ff:feaa:5363
vendor_id: 0x0000
After:
hca_id: rxe0
transport: InfiniBand (0)
fw_ver: 0.0.0
node_guid: 5054:00ff:feaa:5363
sys_image_guid: 5054:00ff:feaa:5363
vendor_id: 0xffffff
Fixes: 8700e3e7c485 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20200406173501.1466273-1-leon@kernel.org
Signed-off-by: Zhu Yanjun <yanjunz@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2020-04-06 20:35:01 +03:00
/* IBTA v1.4 A3.3.1 VENDOR INFORMATION section */
RXE_VENDOR_ID = 0 XFFFFFF ,
2016-06-16 16:45:23 +03:00
} ;
/* default/initial rxe port parameters */
enum rxe_port_param {
RXE_PORT_GID_TBL_LEN = 1024 ,
RXE_PORT_PORT_CAP_FLAGS = RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP ,
RXE_PORT_MAX_MSG_SZ = 0x800000 ,
RXE_PORT_BAD_PKEY_CNTR = 0 ,
RXE_PORT_QKEY_VIOL_CNTR = 0 ,
RXE_PORT_LID = 0 ,
RXE_PORT_SM_LID = 0 ,
RXE_PORT_SM_SL = 0 ,
RXE_PORT_LMC = 0 ,
RXE_PORT_MAX_VL_NUM = 1 ,
RXE_PORT_SUBNET_TIMEOUT = 0 ,
RXE_PORT_INIT_TYPE_REPLY = 0 ,
RXE_PORT_ACTIVE_WIDTH = IB_WIDTH_1X ,
RXE_PORT_ACTIVE_SPEED = 1 ,
2020-07-21 13:16:18 +03:00
RXE_PORT_PKEY_TBL_LEN = 1 ,
2019-08-07 13:31:35 +03:00
RXE_PORT_PHYS_STATE = IB_PORT_PHYS_STATE_POLLING ,
2016-06-16 16:45:23 +03:00
RXE_PORT_SUBNET_PREFIX = 0xfe80000000000000ULL ,
} ;
/* default/initial port info parameters */
enum rxe_port_info_param {
RXE_PORT_INFO_VL_CAP = 4 , /* 1-8 */
RXE_PORT_INFO_MTU_CAP = 5 , /* 4096 */
RXE_PORT_INFO_OPER_VL = 1 , /* 1 */
} ;
# endif /* RXE_PARAM_H */