aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mlx4
diff options
context:
space:
mode:
authorEugenia Emantayev <eugenia@mellanox.co.il>2014-12-11 03:57:54 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-11 14:47:35 -0500
commitddae0349fdb78bcc5e7219061847012aa1a29069 (patch)
tree1159aa411fdc49c7ec3aeb93aa999c90cb2ac224 /include/linux/mlx4
parent3dca0f42c7baaa4e01699629da13d6556f001ebe (diff)
net/mlx4: Change QP allocation scheme
When using BF (Blue-Flame), the QPN overrides the VLAN, CV, and SV fields in the WQE. Thus, BF may only be used for QPNs with bits 6,7 unset. The current Ethernet driver code reserves a Tx QP range with 256b alignment. This is wrong because if there are more than 64 Tx QPs in use, QPNs >= base + 65 will have bits 6/7 set. This problem is not specific for the Ethernet driver, any entity that tries to reserve more than 64 BF-enabled QPs should fail. Also, using ranges is not necessary here and is wasteful. The new mechanism introduced here will support reservation for "Eth QPs eligible for BF" for all drivers: bare-metal, multi-PF, and VFs (when hypervisors support WC in VMs). The flow we use is: 1. In mlx4_en, allocate Tx QPs one by one instead of a range allocation, and request "BF enabled QPs" if BF is supported for the function 2. In the ALLOC_RES FW command, change param1 to: a. param1[23:0] - number of QPs b. param1[31-24] - flags controlling QPs reservation Bit 31 refers to Eth blueflame supported QPs. Those QPs must have bits 6 and 7 unset in order to be used in Ethernet. Bits 24-30 of the flags are currently reserved. When a function tries to allocate a QP, it states the required attributes for this QP. Those attributes are considered "best-effort". If an attribute, such as Ethernet BF enabled QP, is a must-have attribute, the function has to check that attribute is supported before trying to do the allocation. In a lower layer of the code, mlx4_qp_reserve_range masks out the bits which are unsupported. If SRIOV is used, the PF validates those attributes and masks out unsupported attributes as well. In order to notify VFs which attributes are supported, the VF uses QUERY_FUNC_CAP command. This command's mailbox is filled by the PF, which notifies which QP allocation attributes it supports. Signed-off-by: Eugenia Emantayev <eugenia@mellanox.co.il> Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mlx4')
-rw-r--r--include/linux/mlx4/device.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 3951b5368d7e..272aa258c036 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -195,6 +195,22 @@ enum {
195}; 195};
196 196
197enum { 197enum {
198 MLX4_QUERY_FUNC_FLAGS_BF_RES_QP = 1LL << 0
199};
200
201/* bit enums for an 8-bit flags field indicating special use
202 * QPs which require special handling in qp_reserve_range.
203 * Currently, this only includes QPs used by the ETH interface,
204 * where we expect to use blueflame. These QPs must not have
205 * bits 6 and 7 set in their qp number.
206 *
207 * This enum may use only bits 0..7.
208 */
209enum {
210 MLX4_RESERVE_ETH_BF_QP = 1 << 7,
211};
212
213enum {
198 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0, 214 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0,
199 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1, 215 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1,
200 MLX4_DEV_CAP_CQE_STRIDE_ENABLED = 1LL << 2, 216 MLX4_DEV_CAP_CQE_STRIDE_ENABLED = 1LL << 2,
@@ -501,6 +517,7 @@ struct mlx4_caps {
501 u64 phys_port_id[MLX4_MAX_PORTS + 1]; 517 u64 phys_port_id[MLX4_MAX_PORTS + 1];
502 int tunnel_offload_mode; 518 int tunnel_offload_mode;
503 u8 rx_checksum_flags_port[MLX4_MAX_PORTS + 1]; 519 u8 rx_checksum_flags_port[MLX4_MAX_PORTS + 1];
520 u8 alloc_res_qp_mask;
504}; 521};
505 522
506struct mlx4_buf_list { 523struct mlx4_buf_list {
@@ -950,8 +967,8 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
950 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, 967 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
951 unsigned vector, int collapsed, int timestamp_en); 968 unsigned vector, int collapsed, int timestamp_en);
952void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 969void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
953 970int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align,
954int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); 971 int *base, u8 flags);
955void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); 972void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);
956 973
957int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, 974int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp,