IB/mlx4: Use flow counters on IBoE ports
[linux-2.6-block.git] / drivers / infiniband / hw / mlx4 / qp.c
index 2001f20a43618e74b927733d8d54b410af084979..3a91d9d8dc518fc278b819e594978477aaeeff56 100644 (file)
@@ -893,7 +893,6 @@ static int mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_ah_attr *ah,
                        --path->static_rate;
        } else
                path->static_rate = 0;
-       path->counter_index = 0xff;
 
        if (ah->ah_flags & IB_AH_GRH) {
                if (ah->grh.sgid_index >= dev->dev->caps.gid_table_len[port]) {
@@ -1034,6 +1033,15 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
                }
        }
 
+       if (cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) {
+               if (dev->counters[qp->port - 1] != -1) {
+                       context->pri_path.counter_index =
+                                               dev->counters[qp->port - 1];
+                       optpar |= MLX4_QP_OPTPAR_COUNTER_INDEX;
+               } else
+                       context->pri_path.counter_index = 0xff;
+       }
+
        if (attr_mask & IB_QP_PKEY_INDEX) {
                context->pri_path.pkey_index = attr->pkey_index;
                optpar |= MLX4_QP_OPTPAR_PKEY_INDEX;