mlx4: ensure number of Rx queues is a power of 2

In the documentation it is specified that the hardware only supports a
number of RX queues if it is a power of 2.

Since ibv_exp_create_qp may not return an error when the number of
queues is unsupported by hardware, sanitize the value in dev_configure.

Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
This commit is contained in:
Robin Jarry 2016-03-03 15:27:40 +01:00 committed by Thomas Monjalon
parent 3b32a6b417
commit bda501616c

View File

@ -733,6 +733,12 @@ dev_configure(struct rte_eth_dev *dev)
}
if (rxqs_n == priv->rxqs_n)
return 0;
if ((rxqs_n & (rxqs_n - 1)) != 0) {
ERROR("%p: invalid number of RX queues (%u),"
" must be a power of 2",
(void *)dev, rxqs_n);
return EINVAL;
}
INFO("%p: RX queues number update: %u -> %u",
(void *)dev, priv->rxqs_n, rxqs_n);
/* If RSS is enabled, disable it first. */