Re: [PATCH net-next] net: mana: Implement get_ringparam/set_ringparam for mana

From: Jakub Kicinski
Date: Mon Jul 15 2024 - 09:46:03 EST


On Sun, 14 Jul 2024 20:40:20 -0700 Shradha Gupta wrote:
> + if (ring->rx_jumbo_pending) {
> + netdev_err(ndev, "%s: rx_jumbo_pending not supported\n", __func__);
> + return -EINVAL;
> + }
> + if (ring->rx_mini_pending) {
> + netdev_err(ndev, "%s: rx_mini_pending not supported\n", __func__);
> + return -EINVAL;
> + }

I think that core already checks this

> + if (!apc)
> + return -EINVAL;

Provably impossible, apc is netdev + sizeof(netdev) so it'd have to
wrap a 64b integer to be NULL :|

> + old_tx = apc->tx_queue_size;
> + old_rx = apc->rx_queue_size;
> + new_tx = clamp_t(u32, ring->tx_pending, MIN_TX_BUFFERS_PER_QUEUE, MAX_TX_BUFFERS_PER_QUEUE);
> + new_rx = clamp_t(u32, ring->rx_pending, MIN_RX_BUFFERS_PER_QUEUE, MAX_RX_BUFFERS_PER_QUEUE);
> +
> + if (new_tx == old_tx && new_rx == old_rx)
> + return 0;

Pretty sure core will also not call you if there's no change.
If it does please update core instead of catching this in the driver.

Please keep in mind that net-next will be closed for the duration
of the merge window.
--
pw-bot: cr