@@ -991,6 +991,7 @@ enum ravb_chip_id {
struct ravb_hw_info {
enum ravb_chip_id chip_id;
+ int stats_len;
size_t max_rx_len;
unsigned aligned_tx: 1;
};
@@ -1131,13 +1131,14 @@ static const char ravb_gstrings_stats[][ETH_GSTRING_LEN] = {
"rx_queue_1_over_errors",
};
-#define RAVB_STATS_LEN ARRAY_SIZE(ravb_gstrings_stats)
-
static int ravb_get_sset_count(struct net_device *netdev, int sset)
{
+ struct ravb_private *priv = netdev_priv(netdev);
+ const struct ravb_hw_info *info = priv->info;
+
switch (sset) {
case ETH_SS_STATS:
- return RAVB_STATS_LEN;
+ return info->stats_len;
default:
return -EOPNOTSUPP;
}
@@ -1924,11 +1925,13 @@ static int ravb_mdio_release(struct ravb_private *priv)
static const struct ravb_hw_info ravb_gen3_hw_info = {
.chip_id = RCAR_GEN3,
+ .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
};
static const struct ravb_hw_info ravb_gen2_hw_info = {
.chip_id = RCAR_GEN2,
+ .stats_len = ARRAY_SIZE(ravb_gstrings_stats),
.max_rx_len = RX_BUF_SZ + RAVB_ALIGN - 1,
.aligned_tx = 1,
};