mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
modules/mqnic: Implement ethtool channels API
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
parent
3302c1f832
commit
a6da3a41cb
@ -146,6 +146,57 @@ static int mqnic_set_ringparam(struct net_device *ndev,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mqnic_get_channels(struct net_device *ndev,
|
||||||
|
struct ethtool_channels *channel)
|
||||||
|
{
|
||||||
|
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||||
|
|
||||||
|
channel->max_rx = mqnic_res_get_count(priv->interface->rxq_res);
|
||||||
|
channel->max_tx = mqnic_res_get_count(priv->interface->txq_res);
|
||||||
|
|
||||||
|
channel->rx_count = priv->rxq_count;
|
||||||
|
channel->tx_count = priv->txq_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mqnic_set_channels(struct net_device *ndev,
|
||||||
|
struct ethtool_channels *channel)
|
||||||
|
{
|
||||||
|
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||||
|
u32 txq_count, rxq_count;
|
||||||
|
int port_up = priv->port_up;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
rxq_count = channel->rx_count;
|
||||||
|
txq_count = channel->tx_count;
|
||||||
|
|
||||||
|
if (rxq_count == priv->rxq_count &&
|
||||||
|
txq_count == priv->txq_count)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
dev_info(priv->dev, "New TX channel count: %d", txq_count);
|
||||||
|
dev_info(priv->dev, "New RX channel count: %d", rxq_count);
|
||||||
|
|
||||||
|
mutex_lock(&priv->mdev->state_lock);
|
||||||
|
|
||||||
|
if (port_up)
|
||||||
|
mqnic_stop_port(ndev);
|
||||||
|
|
||||||
|
priv->txq_count = txq_count;
|
||||||
|
priv->rxq_count = rxq_count;
|
||||||
|
|
||||||
|
if (port_up) {
|
||||||
|
ret = mqnic_start_port(ndev);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
dev_err(priv->dev, "%s: Failed to start port on interface %d netdev %d: %d",
|
||||||
|
__func__, priv->interface->index, priv->index, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&priv->mdev->state_lock);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int mqnic_get_ts_info(struct net_device *ndev,
|
static int mqnic_get_ts_info(struct net_device *ndev,
|
||||||
struct ethtool_ts_info *info)
|
struct ethtool_ts_info *info)
|
||||||
{
|
{
|
||||||
@ -433,6 +484,8 @@ const struct ethtool_ops mqnic_ethtool_ops = {
|
|||||||
.get_link = ethtool_op_get_link,
|
.get_link = ethtool_op_get_link,
|
||||||
.get_ringparam = mqnic_get_ringparam,
|
.get_ringparam = mqnic_get_ringparam,
|
||||||
.set_ringparam = mqnic_set_ringparam,
|
.set_ringparam = mqnic_set_ringparam,
|
||||||
|
.get_channels = mqnic_get_channels,
|
||||||
|
.set_channels = mqnic_set_channels,
|
||||||
.get_ts_info = mqnic_get_ts_info,
|
.get_ts_info = mqnic_get_ts_info,
|
||||||
.get_module_info = mqnic_get_module_info,
|
.get_module_info = mqnic_get_module_info,
|
||||||
.get_module_eeprom = mqnic_get_module_eeprom,
|
.get_module_eeprom = mqnic_get_module_eeprom,
|
||||||
|
@ -53,6 +53,9 @@ int mqnic_start_port(struct net_device *ndev)
|
|||||||
dev_info(mdev->dev, "%s on interface %d netdev %d", __func__,
|
dev_info(mdev->dev, "%s on interface %d netdev %d", __func__,
|
||||||
priv->interface->index, priv->index);
|
priv->interface->index, priv->index);
|
||||||
|
|
||||||
|
netif_set_real_num_tx_queues(ndev, priv->txq_count);
|
||||||
|
netif_set_real_num_rx_queues(ndev, priv->rxq_count);
|
||||||
|
|
||||||
desc_block_size = min_t(u32, priv->interface->max_desc_block_size, 4);
|
desc_block_size = min_t(u32, priv->interface->max_desc_block_size, 4);
|
||||||
|
|
||||||
// set up RX queues
|
// set up RX queues
|
||||||
|
Loading…
x
Reference in New Issue
Block a user