RSS hash key must be 40 Bytes long.

Cc: sta...@dpdk.org

Signed-off-by: Shahaf Shuler <shah...@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 3 ++-
 drivers/net/mlx5/mlx5_rss.c    | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index f5511ce70..365101af9 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -329,7 +329,8 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
        if (use_app_rss_key &&
            (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len !=
             rss_hash_default_key_len)) {
-               /* MLX5 RSS only support 40bytes key. */
+               DRV_LOG(ERR, "port %u RSS key len must be %zu Bytes long",
+                       dev->data->port_id, rss_hash_default_key_len);
                rte_errno = EINVAL;
                return -rte_errno;
        }
diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c
index 5ac650163..ceaa570ef 100644
--- a/drivers/net/mlx5/mlx5_rss.c
+++ b/drivers/net/mlx5/mlx5_rss.c
@@ -48,6 +48,13 @@ mlx5_rss_hash_update(struct rte_eth_dev *dev,
                return -rte_errno;
        }
        if (rss_conf->rss_key && rss_conf->rss_key_len) {
+               if (rss_conf->rss_key_len != rss_hash_default_key_len) {
+                       DRV_LOG(ERR,
+                               "port %u RSS key len must be %zu Bytes long",
+                               dev->data->port_id, rss_hash_default_key_len);
+                       rte_errno = ENOTSUP;
+                       return -rte_errno;
+               }
                priv->rss_conf.rss_key = rte_realloc(priv->rss_conf.rss_key,
                                                     rss_conf->rss_key_len, 0);
                if (!priv->rss_conf.rss_key) {
-- 
2.12.0

Reply via email to