Skip to content

Commit 4d02ebd

Browse files
Guy Levidledford
authored andcommitted
IB/mlx4: Fix RSS hash fields restrictions
Mistakenly the driver didn't allow RSS hash fields combinations which involve both IPv4 and IPv6 protocols. This bug caused to failures for user's use cases for RSS. Consequently, this patch fixes this bug and allows any combination that the HW can support. Additionally, the patch fixes the driver to return an error in case the user provides an unsupported mask for RSS hash fields. Fixes: 3078f5f ("IB/mlx4: Add support for RSS QP") Signed-off-by: Guy Levi <[email protected]> Reviewed-by: Yishai Hadas <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 0fbe8f5 commit 4d02ebd

File tree

1 file changed

+19
-7
lines changed
  • drivers/infiniband/hw/mlx4

1 file changed

+19
-7
lines changed

drivers/infiniband/hw/mlx4/qp.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,19 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
666666
return (-EOPNOTSUPP);
667667
}
668668

669+
if (ucmd->rx_hash_fields_mask & ~(MLX4_IB_RX_HASH_SRC_IPV4 |
670+
MLX4_IB_RX_HASH_DST_IPV4 |
671+
MLX4_IB_RX_HASH_SRC_IPV6 |
672+
MLX4_IB_RX_HASH_DST_IPV6 |
673+
MLX4_IB_RX_HASH_SRC_PORT_TCP |
674+
MLX4_IB_RX_HASH_DST_PORT_TCP |
675+
MLX4_IB_RX_HASH_SRC_PORT_UDP |
676+
MLX4_IB_RX_HASH_DST_PORT_UDP)) {
677+
pr_debug("RX Hash fields_mask has unsupported mask (0x%llx)\n",
678+
ucmd->rx_hash_fields_mask);
679+
return (-EOPNOTSUPP);
680+
}
681+
669682
if ((ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_SRC_IPV4) &&
670683
(ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_DST_IPV4)) {
671684
rss_ctx->flags = MLX4_RSS_IPV4;
@@ -691,11 +704,11 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
691704
return (-EOPNOTSUPP);
692705
}
693706

694-
if (rss_ctx->flags & MLX4_RSS_IPV4) {
707+
if (rss_ctx->flags & MLX4_RSS_IPV4)
695708
rss_ctx->flags |= MLX4_RSS_UDP_IPV4;
696-
} else if (rss_ctx->flags & MLX4_RSS_IPV6) {
709+
if (rss_ctx->flags & MLX4_RSS_IPV6)
697710
rss_ctx->flags |= MLX4_RSS_UDP_IPV6;
698-
} else {
711+
if (!(rss_ctx->flags & (MLX4_RSS_IPV6 | MLX4_RSS_IPV4))) {
699712
pr_debug("RX Hash fields_mask is not supported - UDP must be set with IPv4 or IPv6\n");
700713
return (-EOPNOTSUPP);
701714
}
@@ -707,15 +720,14 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
707720

708721
if ((ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_SRC_PORT_TCP) &&
709722
(ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_DST_PORT_TCP)) {
710-
if (rss_ctx->flags & MLX4_RSS_IPV4) {
723+
if (rss_ctx->flags & MLX4_RSS_IPV4)
711724
rss_ctx->flags |= MLX4_RSS_TCP_IPV4;
712-
} else if (rss_ctx->flags & MLX4_RSS_IPV6) {
725+
if (rss_ctx->flags & MLX4_RSS_IPV6)
713726
rss_ctx->flags |= MLX4_RSS_TCP_IPV6;
714-
} else {
727+
if (!(rss_ctx->flags & (MLX4_RSS_IPV6 | MLX4_RSS_IPV4))) {
715728
pr_debug("RX Hash fields_mask is not supported - TCP must be set with IPv4 or IPv6\n");
716729
return (-EOPNOTSUPP);
717730
}
718-
719731
} else if ((ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_SRC_PORT_TCP) ||
720732
(ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_DST_PORT_TCP)) {
721733
pr_debug("RX Hash fields_mask is not supported - both TCP SRC and DST must be set\n");

0 commit comments

Comments
 (0)