IB/mlx5: Add Scatter FCS support for Raw Packet QP
authorMajd Dibbiny <majd@mellanox.com>
Sun, 17 Apr 2016 14:19:37 +0000 (17:19 +0300)
committerDoug Ledford <dledford@redhat.com>
Fri, 13 May 2016 23:40:28 +0000 (19:40 -0400)
Enable Scatter FCS in the RQ context when the user passes
Scatter FCS create flag.

Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/qp.c

index b46c25542a7c6285d6c5088f2006889d59eaf10f..fb0a110b66c0b3ad4dc5b845a8668c7373d0366b 100644 (file)
@@ -356,6 +356,7 @@ enum mlx5_ib_qp_flags {
        MLX5_IB_QP_SIGNATURE_HANDLING           = 1 << 5,
        /* QP uses 1 as its source QP number */
        MLX5_IB_QP_SQPN_QP1                     = 1 << 6,
+       MLX5_IB_QP_CAP_SCATTER_FCS              = 1 << 7,
 };
 
 struct mlx5_umr_wr {
index 8dee8bc1e0fe9aa7139cfbd7aa4d9415127e52ca..504117657d41ffccd9d65467b748bede40fb1054 100644 (file)
@@ -1028,6 +1028,7 @@ static int get_rq_pas_size(void *qpc)
 static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev,
                                   struct mlx5_ib_rq *rq, void *qpin)
 {
+       struct mlx5_ib_qp *mqp = rq->base.container_mibqp;
        __be64 *pas;
        __be64 *qp_pas;
        void *in;
@@ -1051,6 +1052,9 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev,
        MLX5_SET(rqc, rqc, user_index, MLX5_GET(qpc, qpc, user_index));
        MLX5_SET(rqc, rqc, cqn, MLX5_GET(qpc, qpc, cqn_rcv));
 
+       if (mqp->flags & MLX5_IB_QP_CAP_SCATTER_FCS)
+               MLX5_SET(rqc, rqc, scatter_fcs, 1);
+
        wq = MLX5_ADDR_OF(rqc, rqc, wq);
        MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_CYCLIC);
        MLX5_SET(wq, wq, end_padding_mode,
@@ -1136,11 +1140,12 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
        }
 
        if (qp->rq.wqe_cnt) {
+               rq->base.container_mibqp = qp;
+
                err = create_raw_packet_qp_rq(dev, rq, in);
                if (err)
                        goto err_destroy_sq;
 
-               rq->base.container_mibqp = qp;
 
                err = create_raw_packet_qp_tir(dev, rq, tdn);
                if (err)
@@ -1252,6 +1257,19 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
                        return -EOPNOTSUPP;
                }
 
+       if (init_attr->create_flags & IB_QP_CREATE_SCATTER_FCS) {
+               if (init_attr->qp_type != IB_QPT_RAW_PACKET) {
+                       mlx5_ib_dbg(dev, "Scatter FCS is supported only for Raw Packet QPs");
+                       return -EOPNOTSUPP;
+               }
+               if (!MLX5_CAP_GEN(dev->mdev, eth_net_offloads) ||
+                   !MLX5_CAP_ETH(dev->mdev, scatter_fcs)) {
+                       mlx5_ib_dbg(dev, "Scatter FCS isn't supported\n");
+                       return -EOPNOTSUPP;
+               }
+               qp->flags |= MLX5_IB_QP_CAP_SCATTER_FCS;
+       }
+
        if (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR)
                qp->sq_signal_bits = MLX5_WQE_CTRL_CQ_UPDATE;