18 #include <linux/kernel.h>
20 #include <linux/errno.h>
21 #include <linux/stddef.h>
23 #include <linux/netdevice.h>
30 #include <linux/ethtool.h>
31 #include <linux/mii.h>
36 #include <asm/uaccess.h>
37 #include <asm/types.h>
50 "tx-multicast-frames",
51 "tx-broadcast-frames",
55 "rx-multicast-frames",
56 "rx-broadcast-frames",
57 "stats-counter-carry",
63 "tx-single-collision",
64 "tx-multiple-collision",
68 "tx-carrier-sense-errors",
70 "tx-excessive-differ-frames",
73 "tx-1024-1518-frames",
79 "rx-alignment-errors",
80 "rx-in-range-length-errors",
81 "rx-out-of-range-length-errors",
86 "rx-busy-drop-frames",
89 "rx-mismatch-drop-frames",
93 "rx-1024-1518-frames",
101 "rx-ip-checksum-errors",
104 #define UEC_HW_STATS_LEN ARRAY_SIZE(hw_stat_gstrings)
105 #define UEC_TX_FW_STATS_LEN ARRAY_SIZE(tx_fw_stat_gstrings)
106 #define UEC_RX_FW_STATS_LEN ARRAY_SIZE(rx_fw_stat_gstrings)
144 if (ugeth->
ug_info->receiveFlowControl)
146 if (ugeth->
ug_info->transmitFlowControl)
160 if (ugeth->
phydev->autoneg) {
161 if (netif_running(netdev)) {
164 "Please re-open the interface.\n");
174 &ugeth->
uccf->uf_regs->upsmr,
212 buff[i] =
in_be32(&ug_regs[i]);
240 int queue = 0, ret = 0;
243 printk(
"%s: RxBD ring size must be no smaller than %d.\n",
248 printk(
"%s: RxBD ring size must be multiple of %d.\n",
253 printk(
"%s: TxBD ring size must be no smaller than %d.\n",
261 if (netif_running(netdev)) {
264 "Please re-open the interface.\n");
270 static int uec_get_sset_count(
struct net_device *netdev,
int sset)
273 u32 stats_mode = ugeth->
ug_info->statisticsMode;
295 u32 stats_mode = ugeth->
ug_info->statisticsMode;
297 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) {
312 static void uec_get_ethtool_stats(
struct net_device *netdev,
316 u32 stats_mode = ugeth->
ug_info->statisticsMode;
320 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) {
327 data[j++] = base ?
in_be32(&base[i]) : 0;
329 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) {
332 data[j++] = base ?
in_be32(&base[i]) : 0;
337 data[j++] = base ?
in_be32(&base[i]) : 0;
341 static int uec_nway_reset(
struct net_device *netdev)
368 if (phydev && phydev->
irq)
370 if (qe_alive_during_sleep())
395 #define uec_get_wol NULL
396 #define uec_set_wol NULL
399 static const struct ethtool_ops uec_ethtool_ops = {
400 .get_settings = uec_get_settings,
401 .set_settings = uec_set_settings,
402 .get_drvinfo = uec_get_drvinfo,
403 .get_regs_len = uec_get_regs_len,
404 .get_regs = uec_get_regs,
405 .get_msglevel = uec_get_msglevel,
406 .set_msglevel = uec_set_msglevel,
407 .nway_reset = uec_nway_reset,
409 .get_ringparam = uec_get_ringparam,
410 .set_ringparam = uec_set_ringparam,
411 .get_pauseparam = uec_get_pauseparam,
412 .set_pauseparam = uec_set_pauseparam,
413 .get_sset_count = uec_get_sset_count,
414 .get_strings = uec_get_strings,
415 .get_ethtool_stats = uec_get_ethtool_stats,