summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2015-04-01 22:06:38 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-01 22:55:41 -0400
commite413e7e1f7493910274c552d7f70ae396c93199a (patch)
treecc658c267c3efd5c11fc15873c2255863c7e1e81 /drivers/net/dsa
parent2f40c6981ac0adcaa2b3fc64e6ae81f80809aec8 (diff)
net: dsa: Consolidate getting the statistics
Reading the statistics from the hardware is the same for all chips. What differs is the number of available statistics. Have just one copy of the code in the shared mv88e6xxx. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r--drivers/net/dsa/mv88e6123_61_65.c62
-rw-r--r--drivers/net/dsa/mv88e6131.c59
-rw-r--r--drivers/net/dsa/mv88e6171.c59
-rw-r--r--drivers/net/dsa/mv88e6352.c61
-rw-r--r--drivers/net/dsa/mv88e6xxx.c99
-rw-r--r--drivers/net/dsa/mv88e6xxx.h11
6 files changed, 110 insertions, 241 deletions
diff --git a/drivers/net/dsa/mv88e6123_61_65.c b/drivers/net/dsa/mv88e6123_61_65.c
index 5f536722f7c7..81cc24448164 100644
--- a/drivers/net/dsa/mv88e6123_61_65.c
+++ b/drivers/net/dsa/mv88e6123_61_65.c
@@ -277,62 +277,6 @@ static int mv88e6123_61_65_setup(struct dsa_switch *ds)
277 return 0; 277 return 0;
278} 278}
279 279
280static struct mv88e6xxx_hw_stat mv88e6123_61_65_hw_stats[] = {
281 { "in_good_octets", 8, 0x00, },
282 { "in_bad_octets", 4, 0x02, },
283 { "in_unicast", 4, 0x04, },
284 { "in_broadcasts", 4, 0x06, },
285 { "in_multicasts", 4, 0x07, },
286 { "in_pause", 4, 0x16, },
287 { "in_undersize", 4, 0x18, },
288 { "in_fragments", 4, 0x19, },
289 { "in_oversize", 4, 0x1a, },
290 { "in_jabber", 4, 0x1b, },
291 { "in_rx_error", 4, 0x1c, },
292 { "in_fcs_error", 4, 0x1d, },
293 { "out_octets", 8, 0x0e, },
294 { "out_unicast", 4, 0x10, },
295 { "out_broadcasts", 4, 0x13, },
296 { "out_multicasts", 4, 0x12, },
297 { "out_pause", 4, 0x15, },
298 { "excessive", 4, 0x11, },
299 { "collisions", 4, 0x1e, },
300 { "deferred", 4, 0x05, },
301 { "single", 4, 0x14, },
302 { "multiple", 4, 0x17, },
303 { "out_fcs_error", 4, 0x03, },
304 { "late", 4, 0x1f, },
305 { "hist_64bytes", 4, 0x08, },
306 { "hist_65_127bytes", 4, 0x09, },
307 { "hist_128_255bytes", 4, 0x0a, },
308 { "hist_256_511bytes", 4, 0x0b, },
309 { "hist_512_1023bytes", 4, 0x0c, },
310 { "hist_1024_max_bytes", 4, 0x0d, },
311 { "sw_in_discards", 4, 0x110, },
312 { "sw_in_filtered", 2, 0x112, },
313 { "sw_out_filtered", 2, 0x113, },
314};
315
316static void
317mv88e6123_61_65_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
318{
319 mv88e6xxx_get_strings(ds, ARRAY_SIZE(mv88e6123_61_65_hw_stats),
320 mv88e6123_61_65_hw_stats, port, data);
321}
322
323static void
324mv88e6123_61_65_get_ethtool_stats(struct dsa_switch *ds,
325 int port, uint64_t *data)
326{
327 mv88e6xxx_get_ethtool_stats(ds, ARRAY_SIZE(mv88e6123_61_65_hw_stats),
328 mv88e6123_61_65_hw_stats, port, data);
329}
330
331static int mv88e6123_61_65_get_sset_count(struct dsa_switch *ds)
332{
333 return ARRAY_SIZE(mv88e6123_61_65_hw_stats);
334}
335
336struct dsa_switch_driver mv88e6123_61_65_switch_driver = { 280struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
337 .tag_protocol = DSA_TAG_PROTO_EDSA, 281 .tag_protocol = DSA_TAG_PROTO_EDSA,
338 .priv_size = sizeof(struct mv88e6xxx_priv_state), 282 .priv_size = sizeof(struct mv88e6xxx_priv_state),
@@ -342,9 +286,9 @@ struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
342 .phy_read = mv88e6xxx_phy_read, 286 .phy_read = mv88e6xxx_phy_read,
343 .phy_write = mv88e6xxx_phy_write, 287 .phy_write = mv88e6xxx_phy_write,
344 .poll_link = mv88e6xxx_poll_link, 288 .poll_link = mv88e6xxx_poll_link,
345 .get_strings = mv88e6123_61_65_get_strings, 289 .get_strings = mv88e6xxx_get_strings,
346 .get_ethtool_stats = mv88e6123_61_65_get_ethtool_stats, 290 .get_ethtool_stats = mv88e6xxx_get_ethtool_stats,
347 .get_sset_count = mv88e6123_61_65_get_sset_count, 291 .get_sset_count = mv88e6xxx_get_sset_count,
348#ifdef CONFIG_NET_DSA_HWMON 292#ifdef CONFIG_NET_DSA_HWMON
349 .get_temp = mv88e6xxx_get_temp, 293 .get_temp = mv88e6xxx_get_temp,
350#endif 294#endif
diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
index 534a8f0b1c28..5bec7a60b476 100644
--- a/drivers/net/dsa/mv88e6131.c
+++ b/drivers/net/dsa/mv88e6131.c
@@ -299,59 +299,6 @@ mv88e6131_phy_write(struct dsa_switch *ds,
299 return mv88e6xxx_phy_write_ppu(ds, addr, regnum, val); 299 return mv88e6xxx_phy_write_ppu(ds, addr, regnum, val);
300} 300}
301 301
302static struct mv88e6xxx_hw_stat mv88e6131_hw_stats[] = {
303 { "in_good_octets", 8, 0x00, },
304 { "in_bad_octets", 4, 0x02, },
305 { "in_unicast", 4, 0x04, },
306 { "in_broadcasts", 4, 0x06, },
307 { "in_multicasts", 4, 0x07, },
308 { "in_pause", 4, 0x16, },
309 { "in_undersize", 4, 0x18, },
310 { "in_fragments", 4, 0x19, },
311 { "in_oversize", 4, 0x1a, },
312 { "in_jabber", 4, 0x1b, },
313 { "in_rx_error", 4, 0x1c, },
314 { "in_fcs_error", 4, 0x1d, },
315 { "out_octets", 8, 0x0e, },
316 { "out_unicast", 4, 0x10, },
317 { "out_broadcasts", 4, 0x13, },
318 { "out_multicasts", 4, 0x12, },
319 { "out_pause", 4, 0x15, },
320 { "excessive", 4, 0x11, },
321 { "collisions", 4, 0x1e, },
322 { "deferred", 4, 0x05, },
323 { "single", 4, 0x14, },
324 { "multiple", 4, 0x17, },
325 { "out_fcs_error", 4, 0x03, },
326 { "late", 4, 0x1f, },
327 { "hist_64bytes", 4, 0x08, },
328 { "hist_65_127bytes", 4, 0x09, },
329 { "hist_128_255bytes", 4, 0x0a, },
330 { "hist_256_511bytes", 4, 0x0b, },
331 { "hist_512_1023bytes", 4, 0x0c, },
332 { "hist_1024_max_bytes", 4, 0x0d, },
333};
334
335static void
336mv88e6131_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
337{
338 mv88e6xxx_get_strings(ds, ARRAY_SIZE(mv88e6131_hw_stats),
339 mv88e6131_hw_stats, port, data);
340}
341
342static void
343mv88e6131_get_ethtool_stats(struct dsa_switch *ds,
344 int port, uint64_t *data)
345{
346 mv88e6xxx_get_ethtool_stats(ds, ARRAY_SIZE(mv88e6131_hw_stats),
347 mv88e6131_hw_stats, port, data);
348}
349
350static int mv88e6131_get_sset_count(struct dsa_switch *ds)
351{
352 return ARRAY_SIZE(mv88e6131_hw_stats);
353}
354
355struct dsa_switch_driver mv88e6131_switch_driver = { 302struct dsa_switch_driver mv88e6131_switch_driver = {
356 .tag_protocol = DSA_TAG_PROTO_DSA, 303 .tag_protocol = DSA_TAG_PROTO_DSA,
357 .priv_size = sizeof(struct mv88e6xxx_priv_state), 304 .priv_size = sizeof(struct mv88e6xxx_priv_state),
@@ -361,9 +308,9 @@ struct dsa_switch_driver mv88e6131_switch_driver = {
361 .phy_read = mv88e6131_phy_read, 308 .phy_read = mv88e6131_phy_read,
362 .phy_write = mv88e6131_phy_write, 309 .phy_write = mv88e6131_phy_write,
363 .poll_link = mv88e6xxx_poll_link, 310 .poll_link = mv88e6xxx_poll_link,
364 .get_strings = mv88e6131_get_strings, 311 .get_strings = mv88e6xxx_get_strings,
365 .get_ethtool_stats = mv88e6131_get_ethtool_stats, 312 .get_ethtool_stats = mv88e6xxx_get_ethtool_stats,
366 .get_sset_count = mv88e6131_get_sset_count, 313 .get_sset_count = mv88e6xxx_get_sset_count,
367}; 314};
368 315
369MODULE_ALIAS("platform:mv88e6085"); 316MODULE_ALIAS("platform:mv88e6085");
diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c
index 4d6038991a59..7314e7d71a67 100644
--- a/drivers/net/dsa/mv88e6171.c
+++ b/drivers/net/dsa/mv88e6171.c
@@ -258,59 +258,6 @@ static int mv88e6171_setup(struct dsa_switch *ds)
258 return 0; 258 return 0;
259} 259}
260 260
261static struct mv88e6xxx_hw_stat mv88e6171_hw_stats[] = {
262 { "in_good_octets", 8, 0x00, },
263 { "in_bad_octets", 4, 0x02, },
264 { "in_unicast", 4, 0x04, },
265 { "in_broadcasts", 4, 0x06, },
266 { "in_multicasts", 4, 0x07, },
267 { "in_pause", 4, 0x16, },
268 { "in_undersize", 4, 0x18, },
269 { "in_fragments", 4, 0x19, },
270 { "in_oversize", 4, 0x1a, },
271 { "in_jabber", 4, 0x1b, },
272 { "in_rx_error", 4, 0x1c, },
273 { "in_fcs_error", 4, 0x1d, },
274 { "out_octets", 8, 0x0e, },
275 { "out_unicast", 4, 0x10, },
276 { "out_broadcasts", 4, 0x13, },
277 { "out_multicasts", 4, 0x12, },
278 { "out_pause", 4, 0x15, },
279 { "excessive", 4, 0x11, },
280 { "collisions", 4, 0x1e, },
281 { "deferred", 4, 0x05, },
282 { "single", 4, 0x14, },
283 { "multiple", 4, 0x17, },
284 { "out_fcs_error", 4, 0x03, },
285 { "late", 4, 0x1f, },
286 { "hist_64bytes", 4, 0x08, },
287 { "hist_65_127bytes", 4, 0x09, },
288 { "hist_128_255bytes", 4, 0x0a, },
289 { "hist_256_511bytes", 4, 0x0b, },
290 { "hist_512_1023bytes", 4, 0x0c, },
291 { "hist_1024_max_bytes", 4, 0x0d, },
292};
293
294static void
295mv88e6171_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
296{
297 mv88e6xxx_get_strings(ds, ARRAY_SIZE(mv88e6171_hw_stats),
298 mv88e6171_hw_stats, port, data);
299}
300
301static void
302mv88e6171_get_ethtool_stats(struct dsa_switch *ds,
303 int port, uint64_t *data)
304{
305 mv88e6xxx_get_ethtool_stats(ds, ARRAY_SIZE(mv88e6171_hw_stats),
306 mv88e6171_hw_stats, port, data);
307}
308
309static int mv88e6171_get_sset_count(struct dsa_switch *ds)
310{
311 return ARRAY_SIZE(mv88e6171_hw_stats);
312}
313
314static int mv88e6171_get_eee(struct dsa_switch *ds, int port, 261static int mv88e6171_get_eee(struct dsa_switch *ds, int port,
315 struct ethtool_eee *e) 262 struct ethtool_eee *e)
316{ 263{
@@ -342,9 +289,9 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
342 .phy_read = mv88e6xxx_phy_read_indirect, 289 .phy_read = mv88e6xxx_phy_read_indirect,
343 .phy_write = mv88e6xxx_phy_write_indirect, 290 .phy_write = mv88e6xxx_phy_write_indirect,
344 .poll_link = mv88e6xxx_poll_link, 291 .poll_link = mv88e6xxx_poll_link,
345 .get_strings = mv88e6171_get_strings, 292 .get_strings = mv88e6xxx_get_strings,
346 .get_ethtool_stats = mv88e6171_get_ethtool_stats, 293 .get_ethtool_stats = mv88e6xxx_get_ethtool_stats,
347 .get_sset_count = mv88e6171_get_sset_count, 294 .get_sset_count = mv88e6xxx_get_sset_count,
348 .set_eee = mv88e6171_set_eee, 295 .set_eee = mv88e6171_set_eee,
349 .get_eee = mv88e6171_get_eee, 296 .get_eee = mv88e6171_get_eee,
350#ifdef CONFIG_NET_DSA_HWMON 297#ifdef CONFIG_NET_DSA_HWMON
diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c
index 3806ff1aaa9c..a1be6e3c0351 100644
--- a/drivers/net/dsa/mv88e6352.c
+++ b/drivers/net/dsa/mv88e6352.c
@@ -321,42 +321,6 @@ static int mv88e6352_setup(struct dsa_switch *ds)
321 return 0; 321 return 0;
322} 322}
323 323
324static struct mv88e6xxx_hw_stat mv88e6352_hw_stats[] = {
325 { "in_good_octets", 8, 0x00, },
326 { "in_bad_octets", 4, 0x02, },
327 { "in_unicast", 4, 0x04, },
328 { "in_broadcasts", 4, 0x06, },
329 { "in_multicasts", 4, 0x07, },
330 { "in_pause", 4, 0x16, },
331 { "in_undersize", 4, 0x18, },
332 { "in_fragments", 4, 0x19, },
333 { "in_oversize", 4, 0x1a, },
334 { "in_jabber", 4, 0x1b, },
335 { "in_rx_error", 4, 0x1c, },
336 { "in_fcs_error", 4, 0x1d, },
337 { "out_octets", 8, 0x0e, },
338 { "out_unicast", 4, 0x10, },
339 { "out_broadcasts", 4, 0x13, },
340 { "out_multicasts", 4, 0x12, },
341 { "out_pause", 4, 0x15, },
342 { "excessive", 4, 0x11, },
343 { "collisions", 4, 0x1e, },
344 { "deferred", 4, 0x05, },
345 { "single", 4, 0x14, },
346 { "multiple", 4, 0x17, },
347 { "out_fcs_error", 4, 0x03, },
348 { "late", 4, 0x1f, },
349 { "hist_64bytes", 4, 0x08, },
350 { "hist_65_127bytes", 4, 0x09, },
351 { "hist_128_255bytes", 4, 0x0a, },
352 { "hist_256_511bytes", 4, 0x0b, },
353 { "hist_512_1023bytes", 4, 0x0c, },
354 { "hist_1024_max_bytes", 4, 0x0d, },
355 { "sw_in_discards", 4, 0x110, },
356 { "sw_in_filtered", 2, 0x112, },
357 { "sw_out_filtered", 2, 0x113, },
358};
359
360static int mv88e6352_read_eeprom_word(struct dsa_switch *ds, int addr) 324static int mv88e6352_read_eeprom_word(struct dsa_switch *ds, int addr)
361{ 325{
362 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 326 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
@@ -555,25 +519,6 @@ static int mv88e6352_set_eeprom(struct dsa_switch *ds,
555 return 0; 519 return 0;
556} 520}
557 521
558static void
559mv88e6352_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
560{
561 mv88e6xxx_get_strings(ds, ARRAY_SIZE(mv88e6352_hw_stats),
562 mv88e6352_hw_stats, port, data);
563}
564
565static void
566mv88e6352_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data)
567{
568 mv88e6xxx_get_ethtool_stats(ds, ARRAY_SIZE(mv88e6352_hw_stats),
569 mv88e6352_hw_stats, port, data);
570}
571
572static int mv88e6352_get_sset_count(struct dsa_switch *ds)
573{
574 return ARRAY_SIZE(mv88e6352_hw_stats);
575}
576
577struct dsa_switch_driver mv88e6352_switch_driver = { 522struct dsa_switch_driver mv88e6352_switch_driver = {
578 .tag_protocol = DSA_TAG_PROTO_EDSA, 523 .tag_protocol = DSA_TAG_PROTO_EDSA,
579 .priv_size = sizeof(struct mv88e6xxx_priv_state), 524 .priv_size = sizeof(struct mv88e6xxx_priv_state),
@@ -583,9 +528,9 @@ struct dsa_switch_driver mv88e6352_switch_driver = {
583 .phy_read = mv88e6xxx_phy_read_indirect, 528 .phy_read = mv88e6xxx_phy_read_indirect,
584 .phy_write = mv88e6xxx_phy_write_indirect, 529 .phy_write = mv88e6xxx_phy_write_indirect,
585 .poll_link = mv88e6xxx_poll_link, 530 .poll_link = mv88e6xxx_poll_link,
586 .get_strings = mv88e6352_get_strings, 531 .get_strings = mv88e6xxx_get_strings,
587 .get_ethtool_stats = mv88e6352_get_ethtool_stats, 532 .get_ethtool_stats = mv88e6xxx_get_ethtool_stats,
588 .get_sset_count = mv88e6352_get_sset_count, 533 .get_sset_count = mv88e6xxx_get_sset_count,
589 .set_eee = mv88e6xxx_set_eee, 534 .set_eee = mv88e6xxx_set_eee,
590 .get_eee = mv88e6xxx_get_eee, 535 .get_eee = mv88e6xxx_get_eee,
591#ifdef CONFIG_NET_DSA_HWMON 536#ifdef CONFIG_NET_DSA_HWMON
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index d9a78c71a4bb..b360fe5346d3 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -484,9 +484,62 @@ static void mv88e6xxx_stats_read(struct dsa_switch *ds, int stat, u32 *val)
484 *val = _val | ret; 484 *val = _val | ret;
485} 485}
486 486
487void mv88e6xxx_get_strings(struct dsa_switch *ds, 487static struct mv88e6xxx_hw_stat mv88e6xxx_hw_stats[] = {
488 int nr_stats, struct mv88e6xxx_hw_stat *stats, 488 { "in_good_octets", 8, 0x00, },
489 int port, uint8_t *data) 489 { "in_bad_octets", 4, 0x02, },
490 { "in_unicast", 4, 0x04, },
491 { "in_broadcasts", 4, 0x06, },
492 { "in_multicasts", 4, 0x07, },
493 { "in_pause", 4, 0x16, },
494 { "in_undersize", 4, 0x18, },
495 { "in_fragments", 4, 0x19, },
496 { "in_oversize", 4, 0x1a, },
497 { "in_jabber", 4, 0x1b, },
498 { "in_rx_error", 4, 0x1c, },
499 { "in_fcs_error", 4, 0x1d, },
500 { "out_octets", 8, 0x0e, },
501 { "out_unicast", 4, 0x10, },
502 { "out_broadcasts", 4, 0x13, },
503 { "out_multicasts", 4, 0x12, },
504 { "out_pause", 4, 0x15, },
505 { "excessive", 4, 0x11, },
506 { "collisions", 4, 0x1e, },
507 { "deferred", 4, 0x05, },
508 { "single", 4, 0x14, },
509 { "multiple", 4, 0x17, },
510 { "out_fcs_error", 4, 0x03, },
511 { "late", 4, 0x1f, },
512 { "hist_64bytes", 4, 0x08, },
513 { "hist_65_127bytes", 4, 0x09, },
514 { "hist_128_255bytes", 4, 0x0a, },
515 { "hist_256_511bytes", 4, 0x0b, },
516 { "hist_512_1023bytes", 4, 0x0c, },
517 { "hist_1024_max_bytes", 4, 0x0d, },
518 /* Not all devices have the following counters */
519 { "sw_in_discards", 4, 0x110, },
520 { "sw_in_filtered", 2, 0x112, },
521 { "sw_out_filtered", 2, 0x113, },
522
523};
524
525static bool have_sw_in_discards(struct dsa_switch *ds)
526{
527 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
528
529 switch (ps->id) {
530 case ID_6095: case ID_6161: case ID_6165:
531 case ID_6171: case ID_6172: case ID_6176:
532 case ID_6182: case ID_6185: case ID_6352:
533 return true;
534 default:
535 return false;
536 }
537}
538
539static void _mv88e6xxx_get_strings(struct dsa_switch *ds,
540 int nr_stats,
541 struct mv88e6xxx_hw_stat *stats,
542 int port, uint8_t *data)
490{ 543{
491 int i; 544 int i;
492 545
@@ -496,9 +549,10 @@ void mv88e6xxx_get_strings(struct dsa_switch *ds,
496 } 549 }
497} 550}
498 551
499void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, 552static void _mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
500 int nr_stats, struct mv88e6xxx_hw_stat *stats, 553 int nr_stats,
501 int port, uint64_t *data) 554 struct mv88e6xxx_hw_stat *stats,
555 int port, uint64_t *data)
502{ 556{
503 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 557 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
504 int ret; 558 int ret;
@@ -546,6 +600,39 @@ error:
546 mutex_unlock(&ps->stats_mutex); 600 mutex_unlock(&ps->stats_mutex);
547} 601}
548 602
603/* All the statistics in the table */
604void
605mv88e6xxx_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
606{
607 if (have_sw_in_discards(ds))
608 _mv88e6xxx_get_strings(ds, ARRAY_SIZE(mv88e6xxx_hw_stats),
609 mv88e6xxx_hw_stats, port, data);
610 else
611 _mv88e6xxx_get_strings(ds, ARRAY_SIZE(mv88e6xxx_hw_stats) - 3,
612 mv88e6xxx_hw_stats, port, data);
613}
614
615int mv88e6xxx_get_sset_count(struct dsa_switch *ds)
616{
617 if (have_sw_in_discards(ds))
618 return ARRAY_SIZE(mv88e6xxx_hw_stats);
619 return ARRAY_SIZE(mv88e6xxx_hw_stats) - 3;
620}
621
622void
623mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
624 int port, uint64_t *data)
625{
626 if (have_sw_in_discards(ds))
627 _mv88e6xxx_get_ethtool_stats(
628 ds, ARRAY_SIZE(mv88e6xxx_hw_stats),
629 mv88e6xxx_hw_stats, port, data);
630 else
631 _mv88e6xxx_get_ethtool_stats(
632 ds, ARRAY_SIZE(mv88e6xxx_hw_stats) - 3,
633 mv88e6xxx_hw_stats, port, data);
634}
635
549int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port) 636int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port)
550{ 637{
551 return 32 * sizeof(u16); 638 return 32 * sizeof(u16);
diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
index 44b0ec79cc6b..fbbedc07754f 100644
--- a/drivers/net/dsa/mv88e6xxx.h
+++ b/drivers/net/dsa/mv88e6xxx.h
@@ -150,12 +150,11 @@ int mv88e6xxx_phy_read_ppu(struct dsa_switch *ds, int addr, int regnum);
150int mv88e6xxx_phy_write_ppu(struct dsa_switch *ds, int addr, 150int mv88e6xxx_phy_write_ppu(struct dsa_switch *ds, int addr,
151 int regnum, u16 val); 151 int regnum, u16 val);
152void mv88e6xxx_poll_link(struct dsa_switch *ds); 152void mv88e6xxx_poll_link(struct dsa_switch *ds);
153void mv88e6xxx_get_strings(struct dsa_switch *ds, 153void mv88e6xxx_get_strings(struct dsa_switch *ds, int port, uint8_t *data);
154 int nr_stats, struct mv88e6xxx_hw_stat *stats, 154void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port,
155 int port, uint8_t *data); 155 uint64_t *data);
156void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, 156int mv88e6xxx_get_sset_count(struct dsa_switch *ds);
157 int nr_stats, struct mv88e6xxx_hw_stat *stats, 157int mv88e6xxx_get_sset_count_basic(struct dsa_switch *ds);
158 int port, uint64_t *data);
159int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port); 158int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port);
160void mv88e6xxx_get_regs(struct dsa_switch *ds, int port, 159void mv88e6xxx_get_regs(struct dsa_switch *ds, int port,
161 struct ethtool_regs *regs, void *_p); 160 struct ethtool_regs *regs, void *_p);