[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0cdbc7079c5640ad9cfd2ea8a36eb54c@AcuMS.aculab.com>
Date: Tue, 18 Jun 2024 08:16:15 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Brett Creeley' <bcreeley@....com>, 'Shannon Nelson'
<shannon.nelson@....com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>, "kuba@...nel.org"
<kuba@...nel.org>, "edumazet@...gle.com" <edumazet@...gle.com>,
"pabeni@...hat.com" <pabeni@...hat.com>
CC: "brett.creeley@....com" <brett.creeley@....com>, "drivers@...sando.io"
<drivers@...sando.io>
Subject: RE: [PATCH net-next 7/8] ionic: Use an u16 for rx_copybreak
From: Brett Creeley
> Sent: 17 June 2024 17:25
>
> On 6/15/2024 2:20 PM, David Laight wrote:
> >
> > From: Shannon Nelson
> >> Sent: 11 June 2024 00:07
> >>
> >> From: Brett Creeley <brett.creeley@....com>
> >>
> >> To make space for other data members on the first cache line reduce
> >> rx_copybreak from an u32 to u16. The max Rx buffer size we support
> >> is (u16)-1 anyway so this makes sense.
> >>
> >> Signed-off-by: Brett Creeley <brett.creeley@....com>
> >> Signed-off-by: Shannon Nelson <shannon.nelson@....com>
> >> ---
> >> drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 10 +++++++++-
> >> drivers/net/ethernet/pensando/ionic/ionic_lif.h | 2 +-
> >> 2 files changed, 10 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> >> b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> >> index 91183965a6b7..26acd82cf6bc 100644
> >> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> >> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> >> @@ -872,10 +872,18 @@ static int ionic_set_tunable(struct net_device *dev,
> >> const void *data)
> >> {
> >> struct ionic_lif *lif = netdev_priv(dev);
> >> + u32 rx_copybreak, max_rx_copybreak;
> >>
> >> switch (tuna->id) {
> >> case ETHTOOL_RX_COPYBREAK:
> >> - lif->rx_copybreak = *(u32 *)data;
> >> + rx_copybreak = *(u32 *)data;
> >> + max_rx_copybreak = min_t(u32, U16_MAX, IONIC_MAX_BUF_LEN);
> >
> > I doubt that needs to be min_t() or that you really need the temporary.
>
> IMHO the temporary variable here makes it more readable than comparing
> directly to the casted/de-referenced opaque data pointer and then
> assigning to the rx_copybreak member if it's a valid value.
...
I was thinking of the temporary for the result of min().
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists