2007-05-09 05:00:38 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* 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 MLX4_QP_H
|
|
|
|
#define MLX4_QP_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
2013-08-02 03:17:48 +04:00
|
|
|
#include <linux/if_ether.h>
|
2007-05-09 05:00:38 +04:00
|
|
|
|
|
|
|
#include <linux/mlx4/device.h>
|
|
|
|
|
|
|
|
#define MLX4_INVALID_LKEY 0x100
|
|
|
|
|
|
|
|
enum mlx4_qp_optpar {
|
|
|
|
MLX4_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
|
|
|
|
MLX4_QP_OPTPAR_RRE = 1 << 1,
|
|
|
|
MLX4_QP_OPTPAR_RAE = 1 << 2,
|
|
|
|
MLX4_QP_OPTPAR_RWE = 1 << 3,
|
|
|
|
MLX4_QP_OPTPAR_PKEY_INDEX = 1 << 4,
|
|
|
|
MLX4_QP_OPTPAR_Q_KEY = 1 << 5,
|
|
|
|
MLX4_QP_OPTPAR_RNR_TIMEOUT = 1 << 6,
|
|
|
|
MLX4_QP_OPTPAR_PRIMARY_ADDR_PATH = 1 << 7,
|
|
|
|
MLX4_QP_OPTPAR_SRA_MAX = 1 << 8,
|
|
|
|
MLX4_QP_OPTPAR_RRA_MAX = 1 << 9,
|
|
|
|
MLX4_QP_OPTPAR_PM_STATE = 1 << 10,
|
|
|
|
MLX4_QP_OPTPAR_RETRY_COUNT = 1 << 12,
|
|
|
|
MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13,
|
|
|
|
MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14,
|
2011-06-15 18:49:57 +04:00
|
|
|
MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16,
|
2014-09-10 17:41:56 +04:00
|
|
|
MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20,
|
|
|
|
MLX4_QP_OPTPAR_VLAN_STRIPPING = 1 << 21,
|
2007-05-09 05:00:38 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum mlx4_qp_state {
|
|
|
|
MLX4_QP_STATE_RST = 0,
|
|
|
|
MLX4_QP_STATE_INIT = 1,
|
|
|
|
MLX4_QP_STATE_RTR = 2,
|
|
|
|
MLX4_QP_STATE_RTS = 3,
|
|
|
|
MLX4_QP_STATE_SQER = 4,
|
|
|
|
MLX4_QP_STATE_SQD = 5,
|
|
|
|
MLX4_QP_STATE_ERR = 6,
|
|
|
|
MLX4_QP_STATE_SQ_DRAINING = 7,
|
|
|
|
MLX4_QP_NUM_STATE
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX4_QP_ST_RC = 0x0,
|
|
|
|
MLX4_QP_ST_UC = 0x1,
|
|
|
|
MLX4_QP_ST_RD = 0x2,
|
|
|
|
MLX4_QP_ST_UD = 0x3,
|
2011-06-02 22:32:15 +04:00
|
|
|
MLX4_QP_ST_XRC = 0x6,
|
2007-05-09 05:00:38 +04:00
|
|
|
MLX4_QP_ST_MLX = 0x7
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX4_QP_PM_MIGRATED = 0x3,
|
|
|
|
MLX4_QP_PM_ARMED = 0x0,
|
|
|
|
MLX4_QP_PM_REARM = 0x1
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
/* params1 */
|
|
|
|
MLX4_QP_BIT_SRE = 1 << 15,
|
|
|
|
MLX4_QP_BIT_SWE = 1 << 14,
|
|
|
|
MLX4_QP_BIT_SAE = 1 << 13,
|
|
|
|
/* params2 */
|
|
|
|
MLX4_QP_BIT_RRE = 1 << 15,
|
|
|
|
MLX4_QP_BIT_RWE = 1 << 14,
|
|
|
|
MLX4_QP_BIT_RAE = 1 << 13,
|
2015-02-03 17:48:32 +03:00
|
|
|
MLX4_QP_BIT_FPP = 1 << 3,
|
2007-05-09 05:00:38 +04:00
|
|
|
MLX4_QP_BIT_RIC = 1 << 4,
|
|
|
|
};
|
|
|
|
|
2011-11-26 23:54:58 +04:00
|
|
|
enum {
|
|
|
|
MLX4_RSS_HASH_XOR = 0,
|
|
|
|
MLX4_RSS_HASH_TOP = 1,
|
|
|
|
|
|
|
|
MLX4_RSS_UDP_IPV6 = 1 << 0,
|
|
|
|
MLX4_RSS_UDP_IPV4 = 1 << 1,
|
|
|
|
MLX4_RSS_TCP_IPV6 = 1 << 2,
|
|
|
|
MLX4_RSS_IPV6 = 1 << 3,
|
|
|
|
MLX4_RSS_TCP_IPV4 = 1 << 4,
|
|
|
|
MLX4_RSS_IPV4 = 1 << 5,
|
|
|
|
|
2013-12-23 18:09:43 +04:00
|
|
|
MLX4_RSS_BY_OUTER_HEADERS = 0 << 6,
|
|
|
|
MLX4_RSS_BY_INNER_HEADERS = 2 << 6,
|
|
|
|
MLX4_RSS_BY_INNER_HEADERS_IPONLY = 3 << 6,
|
|
|
|
|
2011-11-26 23:54:58 +04:00
|
|
|
/* offset of mlx4_rss_context within mlx4_qp_context.pri_path */
|
|
|
|
MLX4_RSS_OFFSET_IN_QPC_PRI_PATH = 0x24,
|
|
|
|
/* offset of being RSS indirection QP within mlx4_qp_context.flags */
|
|
|
|
MLX4_RSS_QPC_FLAG_OFFSET = 13,
|
|
|
|
};
|
|
|
|
|
2014-11-16 17:23:16 +03:00
|
|
|
#define MLX4_EN_RSS_KEY_SIZE 40
|
|
|
|
|
2011-11-26 23:54:58 +04:00
|
|
|
struct mlx4_rss_context {
|
|
|
|
__be32 base_qpn;
|
|
|
|
__be32 default_qpn;
|
|
|
|
u16 reserved;
|
|
|
|
u8 hash_fn;
|
|
|
|
u8 flags;
|
2014-11-16 17:23:16 +03:00
|
|
|
__be32 rss_key[MLX4_EN_RSS_KEY_SIZE / sizeof(__be32)];
|
2011-11-26 23:54:58 +04:00
|
|
|
__be32 base_qpn_udp;
|
|
|
|
};
|
|
|
|
|
2007-05-09 05:00:38 +04:00
|
|
|
struct mlx4_qp_path {
|
|
|
|
u8 fl;
|
2015-10-15 14:44:38 +03:00
|
|
|
union {
|
|
|
|
u8 vlan_control;
|
|
|
|
u8 control;
|
|
|
|
};
|
2012-08-03 12:40:40 +04:00
|
|
|
u8 disable_pkey_check;
|
2007-05-09 05:00:38 +04:00
|
|
|
u8 pkey_index;
|
2011-06-15 18:43:43 +04:00
|
|
|
u8 counter_index;
|
2007-05-09 05:00:38 +04:00
|
|
|
u8 grh_mylmc;
|
|
|
|
__be16 rlid;
|
|
|
|
u8 ackto;
|
|
|
|
u8 mgid_index;
|
|
|
|
u8 static_rate;
|
|
|
|
u8 hop_limit;
|
|
|
|
__be32 tclass_flowlabel;
|
|
|
|
u8 rgid[16];
|
|
|
|
u8 sched_queue;
|
2010-08-26 18:19:22 +04:00
|
|
|
u8 vlan_index;
|
2012-04-05 01:33:24 +04:00
|
|
|
u8 feup;
|
2013-05-09 02:22:35 +04:00
|
|
|
u8 fvl_rx;
|
2011-06-15 18:43:43 +04:00
|
|
|
u8 reserved4[2];
|
2013-08-02 03:17:48 +04:00
|
|
|
u8 dmac[ETH_ALEN];
|
2007-05-09 05:00:38 +04:00
|
|
|
};
|
|
|
|
|
2013-05-09 02:22:35 +04:00
|
|
|
enum { /* fl */
|
2015-10-15 14:44:38 +03:00
|
|
|
MLX4_FL_CV = 1 << 6,
|
2016-09-22 12:11:13 +03:00
|
|
|
MLX4_FL_SV = 1 << 5,
|
2015-10-15 14:44:38 +03:00
|
|
|
MLX4_FL_ETH_HIDE_CQE_VLAN = 1 << 2,
|
|
|
|
MLX4_FL_ETH_SRC_CHECK_MC_LB = 1 << 1,
|
|
|
|
MLX4_FL_ETH_SRC_CHECK_UC_LB = 1 << 0,
|
2013-05-09 02:22:35 +04:00
|
|
|
};
|
2015-10-15 14:44:38 +03:00
|
|
|
|
|
|
|
enum { /* control */
|
|
|
|
MLX4_CTRL_ETH_SRC_CHECK_IF_COUNTER = 1 << 7,
|
|
|
|
};
|
|
|
|
|
2013-05-09 02:22:35 +04:00
|
|
|
enum { /* vlan_control */
|
|
|
|
MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6,
|
2013-06-27 20:05:22 +04:00
|
|
|
MLX4_VLAN_CTRL_ETH_TX_BLOCK_PRIO_TAGGED = 1 << 5, /* 802.1p priority tag */
|
|
|
|
MLX4_VLAN_CTRL_ETH_TX_BLOCK_UNTAGGED = 1 << 4,
|
2013-05-09 02:22:35 +04:00
|
|
|
MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2,
|
|
|
|
MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */
|
|
|
|
MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0
|
|
|
|
};
|
|
|
|
|
|
|
|
enum { /* feup */
|
|
|
|
MLX4_FEUP_FORCE_ETH_UP = 1 << 6, /* force Eth UP */
|
|
|
|
MLX4_FSM_FORCE_ETH_SRC_MAC = 1 << 5, /* force Source MAC */
|
|
|
|
MLX4_FVL_FORCE_ETH_VLAN = 1 << 3 /* force Eth vlan */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum { /* fvl_rx */
|
|
|
|
MLX4_FVL_RX_FORCE_ETH_VLAN = 1 << 0 /* enforce Eth rx vlan */
|
|
|
|
};
|
|
|
|
|
2007-05-09 05:00:38 +04:00
|
|
|
struct mlx4_qp_context {
|
|
|
|
__be32 flags;
|
|
|
|
__be32 pd;
|
|
|
|
u8 mtu_msgmax;
|
|
|
|
u8 rq_size_stride;
|
|
|
|
u8 sq_size_stride;
|
2016-01-14 18:50:39 +03:00
|
|
|
u8 rlkey_roce_mode;
|
2007-05-09 05:00:38 +04:00
|
|
|
__be32 usr_page;
|
|
|
|
__be32 local_qpn;
|
|
|
|
__be32 remote_qpn;
|
|
|
|
struct mlx4_qp_path pri_path;
|
|
|
|
struct mlx4_qp_path alt_path;
|
|
|
|
__be32 params1;
|
|
|
|
u32 reserved1;
|
|
|
|
__be32 next_send_psn;
|
|
|
|
__be32 cqn_send;
|
2016-01-14 18:50:37 +03:00
|
|
|
__be16 roce_entropy;
|
|
|
|
__be16 reserved2[3];
|
2007-05-09 05:00:38 +04:00
|
|
|
__be32 last_acked_psn;
|
|
|
|
__be32 ssn;
|
|
|
|
__be32 params2;
|
|
|
|
__be32 rnr_nextrecvpsn;
|
2011-06-02 22:32:15 +04:00
|
|
|
__be32 xrcd;
|
2007-05-09 05:00:38 +04:00
|
|
|
__be32 cqn_recv;
|
|
|
|
__be64 db_rec_addr;
|
|
|
|
__be32 qkey;
|
|
|
|
__be32 srqn;
|
|
|
|
__be32 msn;
|
|
|
|
__be16 rq_wqe_counter;
|
|
|
|
__be16 sq_wqe_counter;
|
2015-03-18 15:57:34 +03:00
|
|
|
u32 reserved3;
|
|
|
|
__be16 rate_limit_params;
|
2015-04-02 16:31:15 +03:00
|
|
|
u8 reserved4;
|
|
|
|
u8 qos_vport;
|
2007-05-09 05:00:38 +04:00
|
|
|
__be32 param3;
|
|
|
|
__be32 nummmcpeers_basemkey;
|
|
|
|
u8 log_page_size;
|
2015-03-18 15:57:34 +03:00
|
|
|
u8 reserved5[2];
|
2007-05-09 05:00:38 +04:00
|
|
|
u8 mtt_base_addr_h;
|
|
|
|
__be32 mtt_base_addr_l;
|
2015-03-18 15:57:34 +03:00
|
|
|
u32 reserved6[10];
|
2007-05-09 05:00:38 +04:00
|
|
|
};
|
|
|
|
|
2013-06-27 20:05:21 +04:00
|
|
|
struct mlx4_update_qp_context {
|
|
|
|
__be64 qp_mask;
|
|
|
|
__be64 primary_addr_path_mask;
|
|
|
|
__be64 secondary_addr_path_mask;
|
|
|
|
u64 reserved1;
|
|
|
|
struct mlx4_qp_context qp_context;
|
|
|
|
u64 reserved2[58];
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX4_UPD_QP_MASK_PM_STATE = 32,
|
|
|
|
MLX4_UPD_QP_MASK_VSD = 33,
|
2015-04-02 16:31:15 +03:00
|
|
|
MLX4_UPD_QP_MASK_QOS_VPP = 34,
|
2015-03-18 15:57:34 +03:00
|
|
|
MLX4_UPD_QP_MASK_RATE_LIMIT = 35,
|
2013-06-27 20:05:21 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX4_UPD_QP_PATH_MASK_PKEY_INDEX = 0 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_FSM = 1 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_MAC_INDEX = 2 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_FVL = 3 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_CV = 4 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_VLAN_INDEX = 5 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_ETH_HIDE_CQE_VLAN = 6 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_UNTAGGED = 7 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_1P = 8 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_TAGGED = 9 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_UNTAGGED = 10 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_1P = 11 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_TAGGED = 12 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_FEUP = 13 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_SCHED_QUEUE = 14 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_IF_COUNTER_INDEX = 15 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_FVL_RX = 16 + 32,
|
2015-10-15 14:44:38 +03:00
|
|
|
MLX4_UPD_QP_PATH_MASK_ETH_SRC_CHECK_UC_LB = 18 + 32,
|
|
|
|
MLX4_UPD_QP_PATH_MASK_ETH_SRC_CHECK_MC_LB = 19 + 32,
|
2016-09-22 12:11:13 +03:00
|
|
|
MLX4_UPD_QP_PATH_MASK_SV = 22 + 32,
|
2013-06-27 20:05:21 +04:00
|
|
|
};
|
|
|
|
|
2013-05-09 02:22:35 +04:00
|
|
|
enum { /* param3 */
|
|
|
|
MLX4_STRIP_VLAN = 1 << 30
|
|
|
|
};
|
|
|
|
|
IB/mlx4: Use multiple WQ blocks to post smaller send WQEs
ConnectX HCA supports shrinking WQEs, so that a single work request
can be made of multiple units of wqe_shift. This way, WRs can differ
in size, and do not have to be a power of 2 in size, saving memory and
speeding up send WR posting. Unfortunately, if we do this then the
wqe_index field in CQEs can't be used to look up the WR ID anymore, so
our implementation does this only if selective signaling is off.
Further, on 32-bit platforms, we can't use vmap() to make the QP
buffer virtually contigious. Thus we have to use constant-sized WRs to
make sure a WR is always fully within a single page-sized chunk.
Finally, we use WRs with the NOP opcode to avoid wrapping around the
queue buffer in the middle of posting a WR, and we set the
NoErrorCompletion bit to avoid getting completions with error for NOP
WRs. However, NEC is only supported starting with firmware 2.2.232,
so we use constant-sized WRs for older firmware. And, since MLX QPs
only support SEND, we use constant-sized WRs in this case.
When stamping during NOP posting, do stamping following setting of the
NOP WQE valid bit.
Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2008-01-28 11:40:59 +03:00
|
|
|
/* Which firmware version adds support for NEC (NoErrorCompletion) bit */
|
|
|
|
#define MLX4_FW_VER_WQE_CTRL_NEC mlx4_fw_ver(2, 2, 232)
|
|
|
|
|
2007-05-09 05:00:38 +04:00
|
|
|
enum {
|
2008-04-17 08:01:10 +04:00
|
|
|
MLX4_WQE_CTRL_NEC = 1 << 29,
|
2013-12-23 18:09:43 +04:00
|
|
|
MLX4_WQE_CTRL_IIP = 1 << 28,
|
|
|
|
MLX4_WQE_CTRL_ILP = 1 << 27,
|
2008-04-17 08:01:10 +04:00
|
|
|
MLX4_WQE_CTRL_FENCE = 1 << 6,
|
|
|
|
MLX4_WQE_CTRL_CQ_UPDATE = 3 << 2,
|
|
|
|
MLX4_WQE_CTRL_SOLICITED = 1 << 1,
|
|
|
|
MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
|
|
|
|
MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
|
2015-07-27 14:46:33 +03:00
|
|
|
MLX4_WQE_CTRL_INS_CVLAN = 1 << 6,
|
2015-07-27 14:46:34 +03:00
|
|
|
MLX4_WQE_CTRL_INS_SVLAN = 1 << 7,
|
2009-06-05 21:36:24 +04:00
|
|
|
MLX4_WQE_CTRL_STRONG_ORDER = 1 << 7,
|
2010-10-21 08:57:02 +04:00
|
|
|
MLX4_WQE_CTRL_FORCE_LOOPBACK = 1 << 0,
|
2007-05-09 05:00:38 +04:00
|
|
|
};
|
|
|
|
|
2016-07-19 22:16:54 +03:00
|
|
|
union mlx4_wqe_qpn_vlan {
|
|
|
|
struct {
|
|
|
|
__be16 vlan_tag;
|
|
|
|
u8 ins_vlan;
|
|
|
|
u8 fence_size;
|
|
|
|
};
|
|
|
|
__be32 bf_qpn;
|
|
|
|
};
|
|
|
|
|
2007-05-09 05:00:38 +04:00
|
|
|
struct mlx4_wqe_ctrl_seg {
|
|
|
|
__be32 owner_opcode;
|
2016-07-19 22:16:54 +03:00
|
|
|
union mlx4_wqe_qpn_vlan qpn_vlan;
|
2007-05-09 05:00:38 +04:00
|
|
|
/*
|
|
|
|
* High 24 bits are SRC remote buffer; low 8 bits are flags:
|
|
|
|
* [7] SO (strong ordering)
|
|
|
|
* [5] TCP/UDP checksum
|
|
|
|
* [4] IP checksum
|
|
|
|
* [3:2] C (generate completion queue entry)
|
|
|
|
* [1] SE (solicited event)
|
2011-11-26 23:55:19 +04:00
|
|
|
* [0] FL (force loopback)
|
2007-05-09 05:00:38 +04:00
|
|
|
*/
|
2012-02-25 04:51:05 +04:00
|
|
|
union {
|
|
|
|
__be32 srcrb_flags;
|
|
|
|
__be16 srcrb_flags16[2];
|
|
|
|
};
|
2007-05-09 05:00:38 +04:00
|
|
|
/*
|
|
|
|
* imm is immediate data for send/RDMA write w/ immediate;
|
|
|
|
* also invalidation key for send with invalidate; input
|
|
|
|
* modifier for WQEs on CCQs.
|
|
|
|
*/
|
|
|
|
__be32 imm;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MLX4_WQE_MLX_VL15 = 1 << 17,
|
|
|
|
MLX4_WQE_MLX_SLR = 1 << 16
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx4_wqe_mlx_seg {
|
|
|
|
u8 owner;
|
|
|
|
u8 reserved1[2];
|
|
|
|
u8 opcode;
|
2012-04-29 18:04:24 +04:00
|
|
|
__be16 sched_prio;
|
|
|
|
u8 reserved2;
|
2007-05-09 05:00:38 +04:00
|
|
|
u8 size;
|
|
|
|
/*
|
|
|
|
* [17] VL15
|
|
|
|
* [16] SLR
|
|
|
|
* [15:12] static rate
|
|
|
|
* [11:8] SL
|
|
|
|
* [4] ICRC
|
|
|
|
* [3:2] C
|
|
|
|
* [0] FL (force loopback)
|
|
|
|
*/
|
|
|
|
__be32 flags;
|
|
|
|
__be16 rlid;
|
|
|
|
u16 reserved3;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx4_wqe_datagram_seg {
|
|
|
|
__be32 av[8];
|
|
|
|
__be32 dqpn;
|
|
|
|
__be32 qkey;
|
2010-10-21 08:57:02 +04:00
|
|
|
__be16 vlan;
|
2013-08-02 03:17:48 +04:00
|
|
|
u8 mac[ETH_ALEN];
|
2007-05-09 05:00:38 +04:00
|
|
|
};
|
|
|
|
|
2008-07-23 01:19:39 +04:00
|
|
|
struct mlx4_wqe_lso_seg {
|
2008-04-17 08:09:27 +04:00
|
|
|
__be32 mss_hdr_size;
|
2020-05-07 21:59:21 +03:00
|
|
|
__be32 header[];
|
2008-04-17 08:09:27 +04:00
|
|
|
};
|
|
|
|
|
2013-02-06 20:19:15 +04:00
|
|
|
enum mlx4_wqe_bind_seg_flags2 {
|
|
|
|
MLX4_WQE_BIND_ZERO_BASED = (1 << 30),
|
|
|
|
MLX4_WQE_BIND_TYPE_2 = (1 << 31),
|
|
|
|
};
|
|
|
|
|
2007-05-09 05:00:38 +04:00
|
|
|
struct mlx4_wqe_bind_seg {
|
|
|
|
__be32 flags1;
|
|
|
|
__be32 flags2;
|
|
|
|
__be32 new_rkey;
|
|
|
|
__be32 lkey;
|
|
|
|
__be64 addr;
|
|
|
|
__be64 length;
|
|
|
|
};
|
|
|
|
|
2008-07-23 19:12:26 +04:00
|
|
|
enum {
|
|
|
|
MLX4_WQE_FMR_PERM_LOCAL_READ = 1 << 27,
|
|
|
|
MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28,
|
2013-02-06 20:19:15 +04:00
|
|
|
MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_READ = 1 << 29,
|
|
|
|
MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_WRITE = 1 << 30,
|
|
|
|
MLX4_WQE_FMR_AND_BIND_PERM_ATOMIC = 1 << 31
|
2008-07-23 19:12:26 +04:00
|
|
|
};
|
|
|
|
|
2007-05-09 05:00:38 +04:00
|
|
|
struct mlx4_wqe_fmr_seg {
|
|
|
|
__be32 flags;
|
|
|
|
__be32 mem_key;
|
|
|
|
__be64 buf_list;
|
|
|
|
__be64 start_addr;
|
|
|
|
__be64 reg_len;
|
|
|
|
__be32 offset;
|
|
|
|
__be32 page_size;
|
|
|
|
u32 reserved[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx4_wqe_fmr_ext_seg {
|
|
|
|
u8 flags;
|
|
|
|
u8 reserved;
|
|
|
|
__be16 app_mask;
|
|
|
|
__be16 wire_app_tag;
|
|
|
|
__be16 mem_app_tag;
|
|
|
|
__be32 wire_ref_tag_base;
|
|
|
|
__be32 mem_ref_tag_base;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx4_wqe_local_inval_seg {
|
2013-02-06 20:19:07 +04:00
|
|
|
u64 reserved1;
|
2007-05-09 05:00:38 +04:00
|
|
|
__be32 mem_key;
|
2013-02-06 20:19:07 +04:00
|
|
|
u32 reserved2;
|
|
|
|
u64 reserved3[2];
|
2007-05-09 05:00:38 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx4_wqe_raddr_seg {
|
|
|
|
__be64 raddr;
|
|
|
|
__be32 rkey;
|
|
|
|
u32 reserved;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx4_wqe_atomic_seg {
|
|
|
|
__be64 swap_add;
|
|
|
|
__be64 compare;
|
|
|
|
};
|
|
|
|
|
2010-04-14 18:23:39 +04:00
|
|
|
struct mlx4_wqe_masked_atomic_seg {
|
|
|
|
__be64 swap_add;
|
|
|
|
__be64 compare;
|
|
|
|
__be64 swap_add_mask;
|
|
|
|
__be64 compare_mask;
|
|
|
|
};
|
|
|
|
|
2007-05-09 05:00:38 +04:00
|
|
|
struct mlx4_wqe_data_seg {
|
|
|
|
__be32 byte_count;
|
|
|
|
__be32 lkey;
|
|
|
|
__be64 addr;
|
|
|
|
};
|
|
|
|
|
2007-06-18 20:23:47 +04:00
|
|
|
enum {
|
|
|
|
MLX4_INLINE_ALIGN = 64,
|
2011-03-23 01:38:41 +03:00
|
|
|
MLX4_INLINE_SEG = 1 << 31,
|
2007-06-18 20:23:47 +04:00
|
|
|
};
|
|
|
|
|
2007-05-09 05:00:38 +04:00
|
|
|
struct mlx4_wqe_inline_seg {
|
|
|
|
__be32 byte_count;
|
net/mlx4_en: Introduce flexible array to silence overflow warning
The call "skb_copy_from_linear_data(skb, inl + 1, spc)" triggers a FORTIFY
memcpy() warning on ppc64 platform:
In function ‘fortify_memcpy_chk’,
inlined from ‘skb_copy_from_linear_data’ at ./include/linux/skbuff.h:4029:2,
inlined from ‘build_inline_wqe’ at drivers/net/ethernet/mellanox/mlx4/en_tx.c:722:4,
inlined from ‘mlx4_en_xmit’ at drivers/net/ethernet/mellanox/mlx4/en_tx.c:1066:3:
./include/linux/fortify-string.h:513:25: error: call to ‘__write_overflow_field’ declared with
attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()?
[-Werror=attribute-warning]
513 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Same behaviour on x86 you can get if you use "__always_inline" instead of
"inline" for skb_copy_from_linear_data() in skbuff.h
The call here copies data into inlined tx destricptor, which has 104
bytes (MAX_INLINE) space for data payload. In this case "spc" is known
in compile-time but the destination is used with hidden knowledge
(real structure of destination is different from that the compiler
can see). That cause the fortify warning because compiler can check
bounds, but the real bounds are different. "spc" can't be bigger than
64 bytes (MLX4_INLINE_ALIGN), so the data can always fit into inlined
tx descriptor. The fact that "inl" points into inlined tx descriptor is
determined earlier in mlx4_en_xmit().
Avoid confusing the compiler with "inl + 1" constructions to get to past
the inl header by introducing a flexible array "data" to the struct so
that the compiler can see that we are not dealing with an array of inl
structs, but rather, arbitrary data following the structure. There are
no changes to the structure layout reported by pahole, and the resulting
machine code is actually smaller.
Reported-by: Josef Oskera <joskera@redhat.com>
Link: https://lore.kernel.org/lkml/20230217094541.2362873-1-joskera@redhat.com
Fixes: f68f2ff91512 ("fortify: Detect struct member overflows in memcpy() at compile-time")
Cc: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/20230218183842.never.954-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-02-18 21:38:50 +03:00
|
|
|
__u8 data[];
|
2007-05-09 05:00:38 +04:00
|
|
|
};
|
|
|
|
|
2014-05-15 16:29:27 +04:00
|
|
|
enum mlx4_update_qp_attr {
|
|
|
|
MLX4_UPDATE_QP_SMAC = 1 << 0,
|
2015-03-02 19:22:15 +03:00
|
|
|
MLX4_UPDATE_QP_VSD = 1 << 1,
|
2015-03-18 15:57:34 +03:00
|
|
|
MLX4_UPDATE_QP_RATE_LIMIT = 1 << 2,
|
2015-04-02 16:31:15 +03:00
|
|
|
MLX4_UPDATE_QP_QOS_VPORT = 1 << 3,
|
2015-10-15 14:44:38 +03:00
|
|
|
MLX4_UPDATE_QP_ETH_SRC_CHECK_MC_LB = 1 << 4,
|
|
|
|
MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 5) - 1
|
2014-09-10 17:41:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum mlx4_update_qp_params_flags {
|
2015-10-15 14:44:38 +03:00
|
|
|
MLX4_UPDATE_QP_PARAMS_FLAGS_ETH_CHECK_MC_LB = 1 << 0,
|
|
|
|
MLX4_UPDATE_QP_PARAMS_FLAGS_VSD_ENABLE = 1 << 1,
|
2014-05-15 16:29:27 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mlx4_update_qp_params {
|
|
|
|
u8 smac_index;
|
2015-04-02 16:31:15 +03:00
|
|
|
u8 qos_vport;
|
2014-09-10 17:41:56 +04:00
|
|
|
u32 flags;
|
2015-03-18 15:57:34 +03:00
|
|
|
u16 rate_unit;
|
|
|
|
u16 rate_val;
|
2014-05-15 16:29:27 +04:00
|
|
|
};
|
|
|
|
|
2017-06-04 14:30:07 +03:00
|
|
|
struct mlx4_qp *mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn);
|
2014-09-10 17:41:56 +04:00
|
|
|
int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
|
2014-05-15 16:29:27 +04:00
|
|
|
enum mlx4_update_qp_attr attr,
|
|
|
|
struct mlx4_update_qp_params *params);
|
2007-05-09 05:00:38 +04:00
|
|
|
int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
|
|
|
|
enum mlx4_qp_state cur_state, enum mlx4_qp_state new_state,
|
|
|
|
struct mlx4_qp_context *context, enum mlx4_qp_optpar optpar,
|
|
|
|
int sqd_event, struct mlx4_qp *qp);
|
|
|
|
|
2007-06-21 13:27:47 +04:00
|
|
|
int mlx4_qp_query(struct mlx4_dev *dev, struct mlx4_qp *qp,
|
|
|
|
struct mlx4_qp_context *context);
|
|
|
|
|
2008-04-26 01:52:32 +04:00
|
|
|
int mlx4_qp_to_ready(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
|
|
|
|
struct mlx4_qp_context *context,
|
|
|
|
struct mlx4_qp *qp, enum mlx4_qp_state *qp_state);
|
|
|
|
|
2007-05-09 05:00:38 +04:00
|
|
|
static inline struct mlx4_qp *__mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn)
|
|
|
|
{
|
|
|
|
return radix_tree_lookup(&dev->qp_table_tree, qpn & (dev->caps.num_qps - 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void mlx4_qp_remove(struct mlx4_dev *dev, struct mlx4_qp *qp);
|
|
|
|
|
2016-01-14 18:50:37 +03:00
|
|
|
static inline u16 folded_qp(u32 q)
|
|
|
|
{
|
|
|
|
u16 res;
|
|
|
|
|
|
|
|
res = ((q & 0xff) ^ ((q & 0xff0000) >> 16)) | (q & 0xff00);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
u16 mlx4_qp_roce_entropy(struct mlx4_dev *dev, u32 qpn);
|
|
|
|
|
2023-01-04 12:43:34 +03:00
|
|
|
void mlx4_put_qp(struct mlx4_qp *qp);
|
2007-05-09 05:00:38 +04:00
|
|
|
#endif /* MLX4_QP_H */
|