On Fri, 16 Aug 2024 03:48:23 -0700 Shradha Gupta wrote: > + 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); You can min(), the max side of clam is unnecessary. Core code won't let user requests above max provided by "get" thru. > + if (!is_power_of_2(new_tx)) { > + netdev_err(ndev, "%s:Tx:%d not supported. Needs to be a power of 2\n", > + __func__, new_tx); > + return -EINVAL; > + } The power of 2 vs clamp is a bit odd. On one hand you clamp the values to what's supported automatically. On the other you hard reject values which are not power of 2. Why not round them up? IDK whether checking or auto-correction is better, but mixing the two is odd. > + if (!is_power_of_2(new_rx)) { > + netdev_err(ndev, "%s:Rx:%d not supported. Needs to be a power of 2\n", > + __func__, new_rx); Instead of printing please use the extack passed in as an argument. -- pw-bot: cr