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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 16, 2024 at 06:58:05PM -0700, Jakub Kicinski wrote:
> 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.
>
oh okay, got it. Will change this 
> > +	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.
> 
That seems right. I will round up the value to nearest power of two, in
the range. Thanks
> > +	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.
sure, working on it.
> -- 
> pw-bot: cr




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux