aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx5/qp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mlx5/qp.c')
-rw-r--r--drivers/infiniband/hw/mlx5/qp.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 290e97bc065c..38413dcaf4cf 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -1752,7 +1752,33 @@ static int ib_rate_to_mlx5(struct mlx5_ib_dev *dev, u8 rate)
1752 return rate + MLX5_STAT_RATE_OFFSET; 1752 return rate + MLX5_STAT_RATE_OFFSET;
1753} 1753}
1754 1754
1755static int mlx5_set_path(struct mlx5_ib_dev *dev, const struct ib_ah_attr *ah, 1755static int modify_raw_packet_eth_prio(struct mlx5_core_dev *dev,
1756 struct mlx5_ib_sq *sq, u8 sl)
1757{
1758 void *in;
1759 void *tisc;
1760 int inlen;
1761 int err;
1762
1763 inlen = MLX5_ST_SZ_BYTES(modify_tis_in);
1764 in = mlx5_vzalloc(inlen);
1765 if (!in)
1766 return -ENOMEM;
1767
1768 MLX5_SET(modify_tis_in, in, bitmask.prio, 1);
1769
1770 tisc = MLX5_ADDR_OF(modify_tis_in, in, ctx);
1771 MLX5_SET(tisc, tisc, prio, ((sl & 0x7) << 1));
1772
1773 err = mlx5_core_modify_tis(dev, sq->tisn, in, inlen);
1774
1775 kvfree(in);
1776
1777 return err;
1778}
1779
1780static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
1781 const struct ib_ah_attr *ah,
1756 struct mlx5_qp_path *path, u8 port, int attr_mask, 1782 struct mlx5_qp_path *path, u8 port, int attr_mask,
1757 u32 path_flags, const struct ib_qp_attr *attr) 1783 u32 path_flags, const struct ib_qp_attr *attr)
1758{ 1784{
@@ -1808,6 +1834,11 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, const struct ib_ah_attr *ah,
1808 if (attr_mask & IB_QP_TIMEOUT) 1834 if (attr_mask & IB_QP_TIMEOUT)
1809 path->ackto_lt = attr->timeout << 3; 1835 path->ackto_lt = attr->timeout << 3;
1810 1836
1837 if ((qp->ibqp.qp_type == IB_QPT_RAW_PACKET) && qp->sq.wqe_cnt)
1838 return modify_raw_packet_eth_prio(dev->mdev,
1839 &qp->raw_packet_qp.sq,
1840 ah->sl & 0xf);
1841
1811 return 0; 1842 return 0;
1812} 1843}
1813 1844
@@ -2029,7 +2060,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
2029 context->pri_path.port = attr->port_num; 2060 context->pri_path.port = attr->port_num;
2030 2061
2031 if (attr_mask & IB_QP_AV) { 2062 if (attr_mask & IB_QP_AV) {
2032 err = mlx5_set_path(dev, &attr->ah_attr, &context->pri_path, 2063 err = mlx5_set_path(dev, qp, &attr->ah_attr, &context->pri_path,
2033 attr_mask & IB_QP_PORT ? attr->port_num : qp->port, 2064 attr_mask & IB_QP_PORT ? attr->port_num : qp->port,
2034 attr_mask, 0, attr); 2065 attr_mask, 0, attr);
2035 if (err) 2066 if (err)
@@ -2040,7 +2071,8 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
2040 context->pri_path.ackto_lt |= attr->timeout << 3; 2071 context->pri_path.ackto_lt |= attr->timeout << 3;
2041 2072
2042 if (attr_mask & IB_QP_ALT_PATH) { 2073 if (attr_mask & IB_QP_ALT_PATH) {
2043 err = mlx5_set_path(dev, &attr->alt_ah_attr, &context->alt_path, 2074 err = mlx5_set_path(dev, qp, &attr->alt_ah_attr,
2075 &context->alt_path,
2044 attr->alt_port_num, attr_mask, 0, attr); 2076 attr->alt_port_num, attr_mask, 0, attr);
2045 if (err) 2077 if (err)
2046 goto out; 2078 goto out;