net/mlx5: enforce RSS key length limitation
authorShahaf Shuler <shahafs@mellanox.com>
Mon, 26 Mar 2018 10:12:18 +0000 (13:12 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 30 Mar 2018 12:08:44 +0000 (14:08 +0200)
RSS hash key must be 40 Bytes long.

Cc: stable@dpdk.org
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
drivers/net/mlx5/mlx5_ethdev.c
drivers/net/mlx5/mlx5_rss.c

index f5511ce..365101a 100644 (file)
@@ -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;
        }
index c490854..501e492 100644 (file)
@@ -50,6 +50,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 = 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) {