netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Shannon Nelson' <shannon.nelson@amd.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"edumazet@google.com" <edumazet@google.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>
Cc: "brett.creeley@amd.com" <brett.creeley@amd.com>,
	"drivers@pensando.io" <drivers@pensando.io>
Subject: RE: [PATCH net-next 7/8] ionic: Use an u16 for rx_copybreak
Date: Sat, 15 Jun 2024 21:20:17 +0000	[thread overview]
Message-ID: <1cfefa13c8f34ccca322639a05122d6d@AcuMS.aculab.com> (raw)
In-Reply-To: <20240610230706.34883-8-shannon.nelson@amd.com>

From: Shannon Nelson
> Sent: 11 June 2024 00:07
> 
> From: Brett Creeley <brett.creeley@amd.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@amd.com>
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.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)


  reply	other threads:[~2024-06-15 21:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10 23:06 [PATCH net-next 0/8] ionic: rework fix for doorbell miss Shannon Nelson
2024-06-10 23:06 ` [PATCH net-next 1/8] ionic: remove missed doorbell per-queue timer Shannon Nelson
2024-06-10 23:07 ` [PATCH net-next 2/8] ionic: Keep interrupt affinity up to date Shannon Nelson
2024-06-10 23:07 ` [PATCH net-next 3/8] ionic: add private workqueue per-device Shannon Nelson
2024-06-13  1:08   ` Jakub Kicinski
2024-06-13 20:38     ` Nelson, Shannon
2024-06-13 22:19       ` Jakub Kicinski
2024-06-13 22:40         ` Nelson, Shannon
2024-06-10 23:07 ` [PATCH net-next 4/8] ionic: add work item for missed-doorbell check Shannon Nelson
2024-06-13  1:19   ` Jakub Kicinski
2024-06-13 20:38     ` Nelson, Shannon
2024-06-14  1:26       ` Przemek Kitszel
2024-06-10 23:07 ` [PATCH net-next 5/8] ionic: add per-queue napi_schedule for doorbell check Shannon Nelson
2024-06-10 23:07 ` [PATCH net-next 6/8] ionic: check for queue deadline in doorbell_napi_work Shannon Nelson
2024-06-10 23:07 ` [PATCH net-next 7/8] ionic: Use an u16 for rx_copybreak Shannon Nelson
2024-06-15 21:20   ` David Laight [this message]
2024-06-16  1:28     ` Andrew Lunn
2024-06-16 10:27       ` David Laight
2024-06-17 16:24     ` Brett Creeley
2024-06-18  8:16       ` David Laight
2024-06-18 16:11         ` Brett Creeley
2024-06-10 23:07 ` [PATCH net-next 8/8] ionic: Only run the doorbell workaround for certain asic_type Shannon Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1cfefa13c8f34ccca322639a05122d6d@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=drivers@pensando.io \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shannon.nelson@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).