def wrapper(instance): cmd_in = struct.pack('!HIH8s', MLX5_CMD_OP_QUERY_HCA_CAP, 0, MLX5_CMD_MOD_DEVICE_MEMORY_CAP << 1 | 0x1, bytes(8)) cmd_out = Mlx5Context.devx_general_cmd( instance.ctx, cmd_in, MLX5_CMD_OP_QUERY_HCA_CAP_OUT_LEN) cmd_view = memoryview(cmd_out) status = cmd_view[0] if status: raise PyverbsRDMAError( 'Query Device Memory CAPs failed with status' f' ({status})') memic_op_support = int.from_bytes(cmd_view[80:84], 'big') increment_size_sup = cmd_view[20] test_and_set_size_sup = cmd_view[22] # Verify that MEMIC atomic operations (both increment and test_and_set) # are supported with write/read size of 1 Byte. if memic_op_support & 0x3 != 0x3: raise unittest.SkipTest( 'MEMIC atomic operations are not supported') if not increment_size_sup & test_and_set_size_sup & 0x1: raise unittest.SkipTest( 'MEMIC atomic operations are not supported with 1 Bytes read/write sizes' ) return func(instance)
def func_wrapper(instance): try: ctx = Mlx5Context(Mlx5DVContextAttr(), instance.dev_name) except PyverbsUserError as ex: raise unittest.SkipTest(f'Could not open mlx5 context ({ex})') except PyverbsRDMAError: raise unittest.SkipTest('Opening mlx5 context is not supported') # Query NIC Flow Table capabilities cmd_in = struct.pack('!HIH8s', MLX5_CMD_OP_QUERY_HCA_CAP, 0, MLX5_CMD_MOD_NIC_FLOW_TABLE_CAP << 1 | 0x1, bytes(8)) try: cmd_out = Mlx5Context.devx_general_cmd( ctx, cmd_in, MLX5_CMD_OP_QUERY_HCA_CAP_OUT_LEN) except PyverbsRDMAError as ex: if ex.error_code in [errno.EOPNOTSUPP, errno.EPROTONOSUPPORT]: raise unittest.SkipTest( 'DevX general command is not supported') raise ex cmd_view = memoryview(cmd_out) status = cmd_view[0] if status: raise PyverbsRDMAError( 'Query NIC Flow Table CAPs failed with status' f' ({status})') # Verify that both NIC RX and TX support reformat actions by checking # the following PRM fields: encap_general_header, # log_max_packet_reformat, and reformat (for both RX and TX). if not (cmd_view[20] & 0x80 and cmd_view[21] & 0x1f and cmd_view[80] & 0x1 and cmd_view[272] & 0x1): raise unittest.SkipTest('NIC flow table does not support reformat') return func(instance)
def func_wrapper(instance): try: ctx = Mlx5Context(Mlx5DVContextAttr(), instance.dev_name) except PyverbsUserError as ex: raise unittest.SkipTest(f'Could not open mlx5 context ({ex})') except PyverbsRDMAError: raise unittest.SkipTest('Opening mlx5 context is not supported') # Query NIC Flow Table capabilities cmd_in = struct.pack('!HIH8s', MLX5_CMD_OP_QUERY_HCA_CAP, 0, MLX5_CMD_MOD_NIC_FLOW_TABLE_CAP << 1 | 0x1, bytes(8)) cmd_out = Mlx5Context.devx_general_cmd( ctx, cmd_in, MLX5_CMD_OP_QUERY_HCA_CAP_OUT_LEN) cmd_view = memoryview(cmd_out) status = cmd_view[0] if status: raise PyverbsRDMAError( 'Query NIC Flow Table CAPs failed with status' f' ({status})') # Verify that both NIC RX and TX support reformat actions if not (cmd_view[80] & 0x1 and cmd_view[272] & 0x1): raise unittest.SkipTest('NIC flow table does not support reformat') return func(instance)