mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-19 00:16:57 +07:00
dsa: sja1105: dynamically allocate stats structure
The addition of sja1105_port_status_ether structure into the
statistics causes the frame size to go over the warning limit:
drivers/net/dsa/sja1105/sja1105_ethtool.c:421:6: error: stack frame size of 1104 bytes in function 'sja1105_get_ethtool_stats' [-Werror,-Wframe-larger-than=]
Use dynamic allocation to avoid this.
Fixes: 336aa67bd0
("net: dsa: sja1105: show more ethtool statistics counters for P/Q/R/S")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9e330bf469
commit
ae1804de93
@ -421,92 +421,96 @@ static char sja1105pqrs_extra_port_stats[][ETH_GSTRING_LEN] = {
|
||||
void sja1105_get_ethtool_stats(struct dsa_switch *ds, int port, u64 *data)
|
||||
{
|
||||
struct sja1105_private *priv = ds->priv;
|
||||
struct sja1105_port_status status;
|
||||
struct sja1105_port_status *status;
|
||||
int rc, i, k = 0;
|
||||
|
||||
memset(&status, 0, sizeof(status));
|
||||
status = kzalloc(sizeof(*status), GFP_KERNEL);
|
||||
if (!status)
|
||||
goto out;
|
||||
|
||||
rc = sja1105_port_status_get(priv, &status, port);
|
||||
rc = sja1105_port_status_get(priv, status, port);
|
||||
if (rc < 0) {
|
||||
dev_err(ds->dev, "Failed to read port %d counters: %d\n",
|
||||
port, rc);
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
memset(data, 0, ARRAY_SIZE(sja1105_port_stats) * sizeof(u64));
|
||||
data[k++] = status.mac.n_runt;
|
||||
data[k++] = status.mac.n_soferr;
|
||||
data[k++] = status.mac.n_alignerr;
|
||||
data[k++] = status.mac.n_miierr;
|
||||
data[k++] = status.mac.typeerr;
|
||||
data[k++] = status.mac.sizeerr;
|
||||
data[k++] = status.mac.tctimeout;
|
||||
data[k++] = status.mac.priorerr;
|
||||
data[k++] = status.mac.nomaster;
|
||||
data[k++] = status.mac.memov;
|
||||
data[k++] = status.mac.memerr;
|
||||
data[k++] = status.mac.invtyp;
|
||||
data[k++] = status.mac.intcyov;
|
||||
data[k++] = status.mac.domerr;
|
||||
data[k++] = status.mac.pcfbagdrop;
|
||||
data[k++] = status.mac.spcprior;
|
||||
data[k++] = status.mac.ageprior;
|
||||
data[k++] = status.mac.portdrop;
|
||||
data[k++] = status.mac.lendrop;
|
||||
data[k++] = status.mac.bagdrop;
|
||||
data[k++] = status.mac.policeerr;
|
||||
data[k++] = status.mac.drpnona664err;
|
||||
data[k++] = status.mac.spcerr;
|
||||
data[k++] = status.mac.agedrp;
|
||||
data[k++] = status.hl1.n_n664err;
|
||||
data[k++] = status.hl1.n_vlanerr;
|
||||
data[k++] = status.hl1.n_unreleased;
|
||||
data[k++] = status.hl1.n_sizeerr;
|
||||
data[k++] = status.hl1.n_crcerr;
|
||||
data[k++] = status.hl1.n_vlnotfound;
|
||||
data[k++] = status.hl1.n_ctpolerr;
|
||||
data[k++] = status.hl1.n_polerr;
|
||||
data[k++] = status.hl1.n_rxfrm;
|
||||
data[k++] = status.hl1.n_rxbyte;
|
||||
data[k++] = status.hl1.n_txfrm;
|
||||
data[k++] = status.hl1.n_txbyte;
|
||||
data[k++] = status.hl2.n_qfull;
|
||||
data[k++] = status.hl2.n_part_drop;
|
||||
data[k++] = status.hl2.n_egr_disabled;
|
||||
data[k++] = status.hl2.n_not_reach;
|
||||
data[k++] = status->mac.n_runt;
|
||||
data[k++] = status->mac.n_soferr;
|
||||
data[k++] = status->mac.n_alignerr;
|
||||
data[k++] = status->mac.n_miierr;
|
||||
data[k++] = status->mac.typeerr;
|
||||
data[k++] = status->mac.sizeerr;
|
||||
data[k++] = status->mac.tctimeout;
|
||||
data[k++] = status->mac.priorerr;
|
||||
data[k++] = status->mac.nomaster;
|
||||
data[k++] = status->mac.memov;
|
||||
data[k++] = status->mac.memerr;
|
||||
data[k++] = status->mac.invtyp;
|
||||
data[k++] = status->mac.intcyov;
|
||||
data[k++] = status->mac.domerr;
|
||||
data[k++] = status->mac.pcfbagdrop;
|
||||
data[k++] = status->mac.spcprior;
|
||||
data[k++] = status->mac.ageprior;
|
||||
data[k++] = status->mac.portdrop;
|
||||
data[k++] = status->mac.lendrop;
|
||||
data[k++] = status->mac.bagdrop;
|
||||
data[k++] = status->mac.policeerr;
|
||||
data[k++] = status->mac.drpnona664err;
|
||||
data[k++] = status->mac.spcerr;
|
||||
data[k++] = status->mac.agedrp;
|
||||
data[k++] = status->hl1.n_n664err;
|
||||
data[k++] = status->hl1.n_vlanerr;
|
||||
data[k++] = status->hl1.n_unreleased;
|
||||
data[k++] = status->hl1.n_sizeerr;
|
||||
data[k++] = status->hl1.n_crcerr;
|
||||
data[k++] = status->hl1.n_vlnotfound;
|
||||
data[k++] = status->hl1.n_ctpolerr;
|
||||
data[k++] = status->hl1.n_polerr;
|
||||
data[k++] = status->hl1.n_rxfrm;
|
||||
data[k++] = status->hl1.n_rxbyte;
|
||||
data[k++] = status->hl1.n_txfrm;
|
||||
data[k++] = status->hl1.n_txbyte;
|
||||
data[k++] = status->hl2.n_qfull;
|
||||
data[k++] = status->hl2.n_part_drop;
|
||||
data[k++] = status->hl2.n_egr_disabled;
|
||||
data[k++] = status->hl2.n_not_reach;
|
||||
|
||||
if (priv->info->device_id == SJA1105E_DEVICE_ID ||
|
||||
priv->info->device_id == SJA1105T_DEVICE_ID)
|
||||
return;
|
||||
goto out;;
|
||||
|
||||
memset(data + k, 0, ARRAY_SIZE(sja1105pqrs_extra_port_stats) *
|
||||
sizeof(u64));
|
||||
for (i = 0; i < 8; i++) {
|
||||
data[k++] = status.hl2.qlevel_hwm[i];
|
||||
data[k++] = status.hl2.qlevel[i];
|
||||
data[k++] = status->hl2.qlevel_hwm[i];
|
||||
data[k++] = status->hl2.qlevel[i];
|
||||
}
|
||||
data[k++] = status.ether.n_drops_nolearn;
|
||||
data[k++] = status.ether.n_drops_noroute;
|
||||
data[k++] = status.ether.n_drops_ill_dtag;
|
||||
data[k++] = status.ether.n_drops_dtag;
|
||||
data[k++] = status.ether.n_drops_sotag;
|
||||
data[k++] = status.ether.n_drops_sitag;
|
||||
data[k++] = status.ether.n_drops_utag;
|
||||
data[k++] = status.ether.n_tx_bytes_1024_2047;
|
||||
data[k++] = status.ether.n_tx_bytes_512_1023;
|
||||
data[k++] = status.ether.n_tx_bytes_256_511;
|
||||
data[k++] = status.ether.n_tx_bytes_128_255;
|
||||
data[k++] = status.ether.n_tx_bytes_65_127;
|
||||
data[k++] = status.ether.n_tx_bytes_64;
|
||||
data[k++] = status.ether.n_tx_mcast;
|
||||
data[k++] = status.ether.n_tx_bcast;
|
||||
data[k++] = status.ether.n_rx_bytes_1024_2047;
|
||||
data[k++] = status.ether.n_rx_bytes_512_1023;
|
||||
data[k++] = status.ether.n_rx_bytes_256_511;
|
||||
data[k++] = status.ether.n_rx_bytes_128_255;
|
||||
data[k++] = status.ether.n_rx_bytes_65_127;
|
||||
data[k++] = status.ether.n_rx_bytes_64;
|
||||
data[k++] = status.ether.n_rx_mcast;
|
||||
data[k++] = status.ether.n_rx_bcast;
|
||||
data[k++] = status->ether.n_drops_nolearn;
|
||||
data[k++] = status->ether.n_drops_noroute;
|
||||
data[k++] = status->ether.n_drops_ill_dtag;
|
||||
data[k++] = status->ether.n_drops_dtag;
|
||||
data[k++] = status->ether.n_drops_sotag;
|
||||
data[k++] = status->ether.n_drops_sitag;
|
||||
data[k++] = status->ether.n_drops_utag;
|
||||
data[k++] = status->ether.n_tx_bytes_1024_2047;
|
||||
data[k++] = status->ether.n_tx_bytes_512_1023;
|
||||
data[k++] = status->ether.n_tx_bytes_256_511;
|
||||
data[k++] = status->ether.n_tx_bytes_128_255;
|
||||
data[k++] = status->ether.n_tx_bytes_65_127;
|
||||
data[k++] = status->ether.n_tx_bytes_64;
|
||||
data[k++] = status->ether.n_tx_mcast;
|
||||
data[k++] = status->ether.n_tx_bcast;
|
||||
data[k++] = status->ether.n_rx_bytes_1024_2047;
|
||||
data[k++] = status->ether.n_rx_bytes_512_1023;
|
||||
data[k++] = status->ether.n_rx_bytes_256_511;
|
||||
data[k++] = status->ether.n_rx_bytes_128_255;
|
||||
data[k++] = status->ether.n_rx_bytes_65_127;
|
||||
data[k++] = status->ether.n_rx_bytes_64;
|
||||
data[k++] = status->ether.n_rx_mcast;
|
||||
data[k++] = status->ether.n_rx_bcast;
|
||||
out:
|
||||
kfree(status);
|
||||
}
|
||||
|
||||
void sja1105_get_strings(struct dsa_switch *ds, int port,
|
||||
|
Loading…
Reference in New Issue
Block a user