net/mlx5: use a macro for the RSS key size
[dpdk.git] / drivers / net / mlx5 / mlx5_rss.c
index c490854..b95778a 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2015 6WIND S.A.
- * Copyright 2015 Mellanox.
+ * Copyright 2015 Mellanox Technologies, Ltd
  */
 
 #include <stddef.h>
@@ -50,6 +50,14 @@ 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 != MLX5_RSS_HASH_KEY_LEN) {
+                       DRV_LOG(ERR,
+                               "port %u RSS key len must be %s Bytes long",
+                               dev->data->port_id,
+                               RTE_STR(MLX5_RSS_HASH_KEY_LEN));
+                       rte_errno = EINVAL;
+                       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) {