lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1cfefa13c8f34ccca322639a05122d6d@AcuMS.aculab.com>
Date: Sat, 15 Jun 2024 21:20:17 +0000
From: David Laight <David.Laight@...LAB.COM>
To: '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: 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.

> +		if (rx_copybreak > max_rx_copybreak) {
> +			netdev_err(dev, "Max supported rx_copybreak size: %u\n",
> +				   max_rx_copybreak);
> +			return -EINVAL;
> +		}
> +		lif->rx_copybreak = (u16)rx_copybreak;
>  		break;
>  	default:
>  		return -EOPNOTSUPP;
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h
> b/drivers/net/ethernet/pensando/ionic/ionic_lif.h
> index 40b28d0b858f..50fda9bdc4b8 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h
> @@ -206,7 +206,7 @@ struct ionic_lif {
>  	unsigned int nxqs;
>  	unsigned int ntxq_descs;
>  	unsigned int nrxq_descs;
> -	u32 rx_copybreak;
> +	u16 rx_copybreak;
>  	u64 rxq_features;
>  	u16 rx_mode;

There seem to be 6 pad bytes here - why not just use them??

>  	u64 hw_features;

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ