diff options
author | Eugenia Emantayev <eugenia@mellanox.co.il> | 2014-12-11 03:57:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-11 14:47:35 -0500 |
commit | ddae0349fdb78bcc5e7219061847012aa1a29069 (patch) | |
tree | 1159aa411fdc49c7ec3aeb93aa999c90cb2ac224 /drivers/infiniband | |
parent | 3dca0f42c7baaa4e01699629da13d6556f001ebe (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 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/qp.c | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 0c3375524a64..57ecc5b204f3 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -2227,7 +2227,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
2227 | ibdev->steer_qpn_count = MLX4_IB_UC_MAX_NUM_QPS; | 2227 | ibdev->steer_qpn_count = MLX4_IB_UC_MAX_NUM_QPS; |
2228 | err = mlx4_qp_reserve_range(dev, ibdev->steer_qpn_count, | 2228 | err = mlx4_qp_reserve_range(dev, ibdev->steer_qpn_count, |
2229 | MLX4_IB_UC_STEER_QPN_ALIGN, | 2229 | MLX4_IB_UC_STEER_QPN_ALIGN, |
2230 | &ibdev->steer_qpn_base); | 2230 | &ibdev->steer_qpn_base, 0); |
2231 | if (err) | 2231 | if (err) |
2232 | goto err_counter; | 2232 | goto err_counter; |
2233 | 2233 | ||
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 9c5150c3cb31..506d1bdad227 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -802,16 +802,19 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, | |||
802 | } | 802 | } |
803 | } | 803 | } |
804 | } else { | 804 | } else { |
805 | /* Raw packet QPNs must be aligned to 8 bits. If not, the WQE | 805 | /* Raw packet QPNs may not have bits 6,7 set in their qp_num; |
806 | * BlueFlame setup flow wrongly causes VLAN insertion. */ | 806 | * otherwise, the WQE BlueFlame setup flow wrongly causes |
807 | * VLAN insertion. */ | ||
807 | if (init_attr->qp_type == IB_QPT_RAW_PACKET) | 808 | if (init_attr->qp_type == IB_QPT_RAW_PACKET) |
808 | err = mlx4_qp_reserve_range(dev->dev, 1, 1 << 8, &qpn); | 809 | err = mlx4_qp_reserve_range(dev->dev, 1, 1, &qpn, |
810 | init_attr->cap.max_send_wr ? | ||
811 | MLX4_RESERVE_ETH_BF_QP : 0); | ||
809 | else | 812 | else |
810 | if (qp->flags & MLX4_IB_QP_NETIF) | 813 | if (qp->flags & MLX4_IB_QP_NETIF) |
811 | err = mlx4_ib_steer_qp_alloc(dev, 1, &qpn); | 814 | err = mlx4_ib_steer_qp_alloc(dev, 1, &qpn); |
812 | else | 815 | else |
813 | err = mlx4_qp_reserve_range(dev->dev, 1, 1, | 816 | err = mlx4_qp_reserve_range(dev->dev, 1, 1, |
814 | &qpn); | 817 | &qpn, 0); |
815 | if (err) | 818 | if (err) |
816 | goto err_proxy; | 819 | goto err_proxy; |
817 | } | 820 | } |