Commit f703d56c authored by Brett Creeley's avatar Brett Creeley Committed by Jakub Kicinski
Browse files

ionic: Use an u16 for rx_copybreak



We only support (u16)-1 size for rx_copybreak, so we can reduce the
field size and move a couple other fields around to save a little
space in the ionic_lif struct.

Before:
	/* size: 17440, cachelines: 273, members: 56 */
	/* sum members: 17403, holes: 9, sum holes: 37 */
	/* last cacheline: 32 bytes */

After:
	/* size: 17424, cachelines: 273, members: 56 */
	/* sum members: 17401, holes: 7, sum holes: 23 */
	/* last cacheline: 16 bytes */

Signed-off-by: default avatarBrett Creeley <brett.creeley@amd.com>
Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Link: https://lore.kernel.org/r/20240619003257.6138-8-shannon.nelson@amd.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 55a3982e
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@
#include "ionic_ethtool.h"
#include "ionic_stats.h"

#define IONIC_MAX_RX_COPYBREAK	min(U16_MAX, IONIC_MAX_BUF_LEN)

static void ionic_get_stats_strings(struct ionic_lif *lif, u8 *buf)
{
	u32 i;
@@ -872,10 +874,17 @@ static int ionic_set_tunable(struct net_device *dev,
			     const void *data)
{
	struct ionic_lif *lif = netdev_priv(dev);
	u32 rx_copybreak;

	switch (tuna->id) {
	case ETHTOOL_RX_COPYBREAK:
		lif->rx_copybreak = *(u32 *)data;
		rx_copybreak = *(u32 *)data;
		if (rx_copybreak > IONIC_MAX_RX_COPYBREAK) {
			netdev_err(dev, "Max supported rx_copybreak size: %u\n",
				   IONIC_MAX_RX_COPYBREAK);
			return -EINVAL;
		}
		lif->rx_copybreak = (u16)rx_copybreak;
		break;
	default:
		return -EOPNOTSUPP;
+3 −3
Original line number Diff line number Diff line
@@ -206,10 +206,10 @@ struct ionic_lif {
	unsigned int nxqs;
	unsigned int ntxq_descs;
	unsigned int nrxq_descs;
	u32 rx_copybreak;
	u64 rxq_features;
	u16 rx_mode;
	u64 hw_features;
	u16 rx_copybreak;
	u16 rx_mode;
	bool registered;
	u16 lif_type;
	unsigned int link_down_count;
@@ -225,11 +225,11 @@ struct ionic_lif {
	u32 info_sz;
	struct ionic_qtype_info qtype_info[IONIC_QTYPE_MAX];

	u16 rss_types;
	u8 rss_hash_key[IONIC_RSS_HASH_KEY_SIZE];
	u8 *rss_ind_tbl;
	dma_addr_t rss_ind_tbl_pa;
	u32 rss_ind_tbl_sz;
	u16 rss_types;

	struct ionic_rx_filters rx_filters;
	u32 rx_coalesce_usecs;		/* what the user asked for */