mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
modules/mqnic: Add some additional range enforcement
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
parent
7cd40a8e1e
commit
eecaef6e6f
@ -161,6 +161,15 @@ static int mqnic_set_channels(struct net_device *ndev,
|
||||
int port_up = priv->port_up;
|
||||
int ret = 0;
|
||||
|
||||
if (channel->combined_count || channel->other_count)
|
||||
return -EINVAL;
|
||||
|
||||
if (priv->rxq_count > mqnic_res_get_count(priv->interface->rxq_res))
|
||||
return -EINVAL;
|
||||
|
||||
if (priv->txq_count > mqnic_res_get_count(priv->interface->txq_res))
|
||||
return -EINVAL;
|
||||
|
||||
rxq_count = channel->rx_count;
|
||||
txq_count = channel->tx_count;
|
||||
|
||||
|
@ -570,8 +570,10 @@ struct net_device *mqnic_create_netdev(struct mqnic_if *interface, int index, in
|
||||
priv->txq_count = min_t(u32, mqnic_res_get_count(interface->txq_res), 256);
|
||||
priv->rxq_count = min_t(u32, mqnic_res_get_count(interface->rxq_res), num_online_cpus());
|
||||
|
||||
priv->tx_ring_size = mqnic_num_txq_entries;
|
||||
priv->rx_ring_size = mqnic_num_rxq_entries;
|
||||
priv->tx_ring_size = roundup_pow_of_two(clamp_t(u32, mqnic_num_txq_entries,
|
||||
MQNIC_MIN_TX_RING_SZ, MQNIC_MAX_TX_RING_SZ));
|
||||
priv->rx_ring_size = roundup_pow_of_two(clamp_t(u32, mqnic_num_rxq_entries,
|
||||
MQNIC_MIN_RX_RING_SZ, MQNIC_MAX_RX_RING_SZ));
|
||||
|
||||
init_rwsem(&priv->txq_table_sem);
|
||||
INIT_RADIX_TREE(&priv->txq_table, GFP_KERNEL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user