@@ -604,6 +604,14 @@ fec_restart(struct net_device *ndev, int duplex)
604
604
if (fep -> bufdesc_ex )
605
605
ecntl |= (1 << 4 );
606
606
607
+ #ifndef CONFIG_M5272
608
+ /* Disable, clear, and enable the MIB */
609
+ writel (1 << 31 , fep -> hwp + FEC_MIB_CTRLSTAT );
610
+ for (i = RMON_T_DROP ; i < IEEE_R_OCTETS_OK ; i ++ )
611
+ writel (0 , fep -> hwp + i );
612
+ writel (0 , fep -> hwp + FEC_MIB_CTRLSTAT );
613
+ #endif
614
+
607
615
/* And last, enable the transmit and receive processing */
608
616
writel (ecntl , fep -> hwp + FEC_ECNTRL );
609
617
writel (0 , fep -> hwp + FEC_R_DES_ACTIVE );
@@ -1435,6 +1443,107 @@ static int fec_enet_set_pauseparam(struct net_device *ndev,
1435
1443
return 0 ;
1436
1444
}
1437
1445
1446
+ #ifndef CONFIG_M5272
1447
+ static const struct fec_stat {
1448
+ char name [ETH_GSTRING_LEN ];
1449
+ u16 offset ;
1450
+ } fec_stats [] = {
1451
+ /* RMON TX */
1452
+ { "tx_dropped" , RMON_T_DROP },
1453
+ { "tx_packets" , RMON_T_PACKETS },
1454
+ { "tx_broadcast" , RMON_T_BC_PKT },
1455
+ { "tx_multicast" , RMON_T_MC_PKT },
1456
+ { "tx_crc_errors" , RMON_T_CRC_ALIGN },
1457
+ { "tx_undersize" , RMON_T_UNDERSIZE },
1458
+ { "tx_oversize" , RMON_T_OVERSIZE },
1459
+ { "tx_fragment" , RMON_T_FRAG },
1460
+ { "tx_jabber" , RMON_T_JAB },
1461
+ { "tx_collision" , RMON_T_COL },
1462
+ { "tx_64byte" , RMON_T_P64 },
1463
+ { "tx_65to127byte" , RMON_T_P65TO127 },
1464
+ { "tx_128to255byte" , RMON_T_P128TO255 },
1465
+ { "tx_256to511byte" , RMON_T_P256TO511 },
1466
+ { "tx_512to1023byte" , RMON_T_P512TO1023 },
1467
+ { "tx_1024to2047byte" , RMON_T_P1024TO2047 },
1468
+ { "tx_GTE2048byte" , RMON_T_P_GTE2048 },
1469
+ { "tx_octets" , RMON_T_OCTETS },
1470
+
1471
+ /* IEEE TX */
1472
+ { "IEEE_tx_drop" , IEEE_T_DROP },
1473
+ { "IEEE_tx_frame_ok" , IEEE_T_FRAME_OK },
1474
+ { "IEEE_tx_1col" , IEEE_T_1COL },
1475
+ { "IEEE_tx_mcol" , IEEE_T_MCOL },
1476
+ { "IEEE_tx_def" , IEEE_T_DEF },
1477
+ { "IEEE_tx_lcol" , IEEE_T_LCOL },
1478
+ { "IEEE_tx_excol" , IEEE_T_EXCOL },
1479
+ { "IEEE_tx_macerr" , IEEE_T_MACERR },
1480
+ { "IEEE_tx_cserr" , IEEE_T_CSERR },
1481
+ { "IEEE_tx_sqe" , IEEE_T_SQE },
1482
+ { "IEEE_tx_fdxfc" , IEEE_T_FDXFC },
1483
+ { "IEEE_tx_octets_ok" , IEEE_T_OCTETS_OK },
1484
+
1485
+ /* RMON RX */
1486
+ { "rx_packets" , RMON_R_PACKETS },
1487
+ { "rx_broadcast" , RMON_R_BC_PKT },
1488
+ { "rx_multicast" , RMON_R_MC_PKT },
1489
+ { "rx_crc_errors" , RMON_R_CRC_ALIGN },
1490
+ { "rx_undersize" , RMON_R_UNDERSIZE },
1491
+ { "rx_oversize" , RMON_R_OVERSIZE },
1492
+ { "rx_fragment" , RMON_R_FRAG },
1493
+ { "rx_jabber" , RMON_R_JAB },
1494
+ { "rx_64byte" , RMON_R_P64 },
1495
+ { "rx_65to127byte" , RMON_R_P65TO127 },
1496
+ { "rx_128to255byte" , RMON_R_P128TO255 },
1497
+ { "rx_256to511byte" , RMON_R_P256TO511 },
1498
+ { "rx_512to1023byte" , RMON_R_P512TO1023 },
1499
+ { "rx_1024to2047byte" , RMON_R_P1024TO2047 },
1500
+ { "rx_GTE2048byte" , RMON_R_P_GTE2048 },
1501
+ { "rx_octets" , RMON_R_OCTETS },
1502
+
1503
+ /* IEEE RX */
1504
+ { "IEEE_rx_drop" , IEEE_R_DROP },
1505
+ { "IEEE_rx_frame_ok" , IEEE_R_FRAME_OK },
1506
+ { "IEEE_rx_crc" , IEEE_R_CRC },
1507
+ { "IEEE_rx_align" , IEEE_R_ALIGN },
1508
+ { "IEEE_rx_macerr" , IEEE_R_MACERR },
1509
+ { "IEEE_rx_fdxfc" , IEEE_R_FDXFC },
1510
+ { "IEEE_rx_octets_ok" , IEEE_R_OCTETS_OK },
1511
+ };
1512
+
1513
+ static void fec_enet_get_ethtool_stats (struct net_device * dev ,
1514
+ struct ethtool_stats * stats , u64 * data )
1515
+ {
1516
+ struct fec_enet_private * fep = netdev_priv (dev );
1517
+ int i ;
1518
+
1519
+ for (i = 0 ; i < ARRAY_SIZE (fec_stats ); i ++ )
1520
+ data [i ] = readl (fep -> hwp + fec_stats [i ].offset );
1521
+ }
1522
+
1523
+ static void fec_enet_get_strings (struct net_device * netdev ,
1524
+ u32 stringset , u8 * data )
1525
+ {
1526
+ int i ;
1527
+ switch (stringset ) {
1528
+ case ETH_SS_STATS :
1529
+ for (i = 0 ; i < ARRAY_SIZE (fec_stats ); i ++ )
1530
+ memcpy (data + i * ETH_GSTRING_LEN ,
1531
+ fec_stats [i ].name , ETH_GSTRING_LEN );
1532
+ break ;
1533
+ }
1534
+ }
1535
+
1536
+ static int fec_enet_get_sset_count (struct net_device * dev , int sset )
1537
+ {
1538
+ switch (sset ) {
1539
+ case ETH_SS_STATS :
1540
+ return ARRAY_SIZE (fec_stats );
1541
+ default :
1542
+ return - EOPNOTSUPP ;
1543
+ }
1544
+ }
1545
+ #endif
1546
+
1438
1547
static int fec_enet_nway_reset (struct net_device * dev )
1439
1548
{
1440
1549
struct fec_enet_private * fep = netdev_priv (dev );
@@ -1455,6 +1564,11 @@ static const struct ethtool_ops fec_enet_ethtool_ops = {
1455
1564
.get_link = ethtool_op_get_link ,
1456
1565
.get_ts_info = fec_enet_get_ts_info ,
1457
1566
.nway_reset = fec_enet_nway_reset ,
1567
+ #ifndef CONFIG_M5272
1568
+ .get_ethtool_stats = fec_enet_get_ethtool_stats ,
1569
+ .get_strings = fec_enet_get_strings ,
1570
+ .get_sset_count = fec_enet_get_sset_count ,
1571
+ #endif
1458
1572
};
1459
1573
1460
1574
static int fec_enet_ioctl (struct net_device * ndev , struct ifreq * rq , int cmd )
0 commit comments