Re: [PATCH v2 4/4] net: ethoc: implement ethtool operations

Ben Hutchings
2014-01-30T14:05:04Z

[-- Attachment #1: Type: text/plain, Size: 994 bytes --]

On Thu, 2014-01-30 at 07:04 +0400, Max Filippov wrote:
> On Thu, Jan 30, 2014 at 5:59 AM, Ben Hutchings <ben@decadent.org.uk> wrote:
> > On Wed, 2014-01-29 at 10:00 +0400, Max Filippov wrote:
[...]
> >> + priv->num_tx = rounddown_pow_of_two(ring->tx_pending);
> >
> > Range check?
>
> May there be requested more than ring->tx_max_pending that we
> indicated in the get_ringparam?

Yes, the ethtool core doesn't check that for you.

> >> + priv->num_rx = priv->num_bd - priv->num_tx;
> >> + if (priv->num_rx > ring->rx_pending)
> >> + priv->num_rx = ring->rx_pending;
> >
> > So the RX ring may only ever be shrunk?! Did you mean to compare with
> > priv->num_bd instead?
>
> First all non-TX descriptors are made RX, and if that's more than user
> requested I trim it.
[...]

OK, I get it. But it would be clearer if you used min().

Ben.

--
Ben Hutchings
It is a miracle that curiosity survives formal education. - Albert Einstein

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]