gianfar_ethtool.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. /*
  2. * drivers/net/gianfar_ethtool.c
  3. *
  4. * Gianfar Ethernet Driver
  5. * Ethtool support for Gianfar Enet
  6. * Based on e1000 ethtool support
  7. *
  8. * Author: Andy Fleming
  9. * Maintainer: Kumar Gala
  10. *
  11. * Copyright (c) 2003,2004 Freescale Semiconductor, Inc.
  12. *
  13. * This software may be used and distributed according to
  14. * the terms of the GNU Public License, Version 2, incorporated herein
  15. * by reference.
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/string.h>
  19. #include <linux/errno.h>
  20. #include <linux/slab.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/init.h>
  23. #include <linux/delay.h>
  24. #include <linux/netdevice.h>
  25. #include <linux/etherdevice.h>
  26. #include <linux/skbuff.h>
  27. #include <linux/spinlock.h>
  28. #include <linux/mm.h>
  29. #include <asm/io.h>
  30. #include <asm/irq.h>
  31. #include <asm/uaccess.h>
  32. #include <linux/module.h>
  33. #include <linux/crc32.h>
  34. #include <asm/types.h>
  35. #include <linux/ethtool.h>
  36. #include <linux/mii.h>
  37. #include <linux/phy.h>
  38. #include "gianfar.h"
  39. extern void gfar_start(struct net_device *dev);
  40. extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit);
  41. #define GFAR_MAX_COAL_USECS 0xffff
  42. #define GFAR_MAX_COAL_FRAMES 0xff
  43. static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
  44. u64 * buf);
  45. static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf);
  46. static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals);
  47. static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals);
  48. static void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals);
  49. static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals);
  50. static void gfar_gdrvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo);
  51. static char stat_gstrings[][ETH_GSTRING_LEN] = {
  52. "rx-dropped-by-kernel",
  53. "rx-large-frame-errors",
  54. "rx-short-frame-errors",
  55. "rx-non-octet-errors",
  56. "rx-crc-errors",
  57. "rx-overrun-errors",
  58. "rx-busy-errors",
  59. "rx-babbling-errors",
  60. "rx-truncated-frames",
  61. "ethernet-bus-error",
  62. "tx-babbling-errors",
  63. "tx-underrun-errors",
  64. "rx-skb-missing-errors",
  65. "tx-timeout-errors",
  66. "tx-rx-64-frames",
  67. "tx-rx-65-127-frames",
  68. "tx-rx-128-255-frames",
  69. "tx-rx-256-511-frames",
  70. "tx-rx-512-1023-frames",
  71. "tx-rx-1024-1518-frames",
  72. "tx-rx-1519-1522-good-vlan",
  73. "rx-bytes",
  74. "rx-packets",
  75. "rx-fcs-errors",
  76. "receive-multicast-packet",
  77. "receive-broadcast-packet",
  78. "rx-control-frame-packets",
  79. "rx-pause-frame-packets",
  80. "rx-unknown-op-code",
  81. "rx-alignment-error",
  82. "rx-frame-length-error",
  83. "rx-code-error",
  84. "rx-carrier-sense-error",
  85. "rx-undersize-packets",
  86. "rx-oversize-packets",
  87. "rx-fragmented-frames",
  88. "rx-jabber-frames",
  89. "rx-dropped-frames",
  90. "tx-byte-counter",
  91. "tx-packets",
  92. "tx-multicast-packets",
  93. "tx-broadcast-packets",
  94. "tx-pause-control-frames",
  95. "tx-deferral-packets",
  96. "tx-excessive-deferral-packets",
  97. "tx-single-collision-packets",
  98. "tx-multiple-collision-packets",
  99. "tx-late-collision-packets",
  100. "tx-excessive-collision-packets",
  101. "tx-total-collision",
  102. "reserved",
  103. "tx-dropped-frames",
  104. "tx-jabber-frames",
  105. "tx-fcs-errors",
  106. "tx-control-frames",
  107. "tx-oversize-frames",
  108. "tx-undersize-frames",
  109. "tx-fragmented-frames",
  110. };
  111. /* Fill in a buffer with the strings which correspond to the
  112. * stats */
  113. static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf)
  114. {
  115. struct gfar_private *priv = netdev_priv(dev);
  116. if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON)
  117. memcpy(buf, stat_gstrings, GFAR_STATS_LEN * ETH_GSTRING_LEN);
  118. else
  119. memcpy(buf, stat_gstrings,
  120. GFAR_EXTRA_STATS_LEN * ETH_GSTRING_LEN);
  121. }
  122. /* Fill in an array of 64-bit statistics from various sources.
  123. * This array will be appended to the end of the ethtool_stats
  124. * structure, and returned to user space
  125. */
  126. static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, u64 * buf)
  127. {
  128. int i;
  129. struct gfar_private *priv = netdev_priv(dev);
  130. u64 *extra = (u64 *) & priv->extra_stats;
  131. if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
  132. u32 __iomem *rmon = (u32 __iomem *) & priv->regs->rmon;
  133. struct gfar_stats *stats = (struct gfar_stats *) buf;
  134. for (i = 0; i < GFAR_RMON_LEN; i++)
  135. stats->rmon[i] = (u64) gfar_read(&rmon[i]);
  136. for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++)
  137. stats->extra[i] = extra[i];
  138. } else
  139. for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++)
  140. buf[i] = extra[i];
  141. }
  142. static int gfar_sset_count(struct net_device *dev, int sset)
  143. {
  144. struct gfar_private *priv = netdev_priv(dev);
  145. switch (sset) {
  146. case ETH_SS_STATS:
  147. if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON)
  148. return GFAR_STATS_LEN;
  149. else
  150. return GFAR_EXTRA_STATS_LEN;
  151. default:
  152. return -EOPNOTSUPP;
  153. }
  154. }
  155. /* Fills in the drvinfo structure with some basic info */
  156. static void gfar_gdrvinfo(struct net_device *dev, struct
  157. ethtool_drvinfo *drvinfo)
  158. {
  159. strncpy(drvinfo->driver, DRV_NAME, GFAR_INFOSTR_LEN);
  160. strncpy(drvinfo->version, gfar_driver_version, GFAR_INFOSTR_LEN);
  161. strncpy(drvinfo->fw_version, "N/A", GFAR_INFOSTR_LEN);
  162. strncpy(drvinfo->bus_info, "N/A", GFAR_INFOSTR_LEN);
  163. drvinfo->regdump_len = 0;
  164. drvinfo->eedump_len = 0;
  165. }
  166. static int gfar_ssettings(struct net_device *dev, struct ethtool_cmd *cmd)
  167. {
  168. struct gfar_private *priv = netdev_priv(dev);
  169. struct phy_device *phydev = priv->phydev;
  170. if (NULL == phydev)
  171. return -ENODEV;
  172. return phy_ethtool_sset(phydev, cmd);
  173. }
  174. /* Return the current settings in the ethtool_cmd structure */
  175. static int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd)
  176. {
  177. struct gfar_private *priv = netdev_priv(dev);
  178. struct phy_device *phydev = priv->phydev;
  179. if (NULL == phydev)
  180. return -ENODEV;
  181. cmd->maxtxpkt = get_icft_value(priv->txic);
  182. cmd->maxrxpkt = get_icft_value(priv->rxic);
  183. return phy_ethtool_gset(phydev, cmd);
  184. }
  185. /* Return the length of the register structure */
  186. static int gfar_reglen(struct net_device *dev)
  187. {
  188. return sizeof (struct gfar);
  189. }
  190. /* Return a dump of the GFAR register space */
  191. static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *regbuf)
  192. {
  193. int i;
  194. struct gfar_private *priv = netdev_priv(dev);
  195. u32 __iomem *theregs = (u32 __iomem *) priv->regs;
  196. u32 *buf = (u32 *) regbuf;
  197. for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++)
  198. buf[i] = gfar_read(&theregs[i]);
  199. }
  200. /* Convert microseconds to ethernet clock ticks, which changes
  201. * depending on what speed the controller is running at */
  202. static unsigned int gfar_usecs2ticks(struct gfar_private *priv, unsigned int usecs)
  203. {
  204. unsigned int count;
  205. /* The timer is different, depending on the interface speed */
  206. switch (priv->phydev->speed) {
  207. case SPEED_1000:
  208. count = GFAR_GBIT_TIME;
  209. break;
  210. case SPEED_100:
  211. count = GFAR_100_TIME;
  212. break;
  213. case SPEED_10:
  214. default:
  215. count = GFAR_10_TIME;
  216. break;
  217. }
  218. /* Make sure we return a number greater than 0
  219. * if usecs > 0 */
  220. return ((usecs * 1000 + count - 1) / count);
  221. }
  222. /* Convert ethernet clock ticks to microseconds */
  223. static unsigned int gfar_ticks2usecs(struct gfar_private *priv, unsigned int ticks)
  224. {
  225. unsigned int count;
  226. /* The timer is different, depending on the interface speed */
  227. switch (priv->phydev->speed) {
  228. case SPEED_1000:
  229. count = GFAR_GBIT_TIME;
  230. break;
  231. case SPEED_100:
  232. count = GFAR_100_TIME;
  233. break;
  234. case SPEED_10:
  235. default:
  236. count = GFAR_10_TIME;
  237. break;
  238. }
  239. /* Make sure we return a number greater than 0 */
  240. /* if ticks is > 0 */
  241. return ((ticks * count) / 1000);
  242. }
  243. /* Get the coalescing parameters, and put them in the cvals
  244. * structure. */
  245. static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
  246. {
  247. struct gfar_private *priv = netdev_priv(dev);
  248. unsigned long rxtime;
  249. unsigned long rxcount;
  250. unsigned long txtime;
  251. unsigned long txcount;
  252. if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE))
  253. return -EOPNOTSUPP;
  254. if (NULL == priv->phydev)
  255. return -ENODEV;
  256. rxtime = get_ictt_value(priv->rxic);
  257. rxcount = get_icft_value(priv->rxic);
  258. txtime = get_ictt_value(priv->txic);
  259. txcount = get_icft_value(priv->txic);;
  260. cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, rxtime);
  261. cvals->rx_max_coalesced_frames = rxcount;
  262. cvals->tx_coalesce_usecs = gfar_ticks2usecs(priv, txtime);
  263. cvals->tx_max_coalesced_frames = txcount;
  264. cvals->use_adaptive_rx_coalesce = 0;
  265. cvals->use_adaptive_tx_coalesce = 0;
  266. cvals->pkt_rate_low = 0;
  267. cvals->rx_coalesce_usecs_low = 0;
  268. cvals->rx_max_coalesced_frames_low = 0;
  269. cvals->tx_coalesce_usecs_low = 0;
  270. cvals->tx_max_coalesced_frames_low = 0;
  271. /* When the packet rate is below pkt_rate_high but above
  272. * pkt_rate_low (both measured in packets per second) the
  273. * normal {rx,tx}_* coalescing parameters are used.
  274. */
  275. /* When the packet rate is (measured in packets per second)
  276. * is above pkt_rate_high, the {rx,tx}_*_high parameters are
  277. * used.
  278. */
  279. cvals->pkt_rate_high = 0;
  280. cvals->rx_coalesce_usecs_high = 0;
  281. cvals->rx_max_coalesced_frames_high = 0;
  282. cvals->tx_coalesce_usecs_high = 0;
  283. cvals->tx_max_coalesced_frames_high = 0;
  284. /* How often to do adaptive coalescing packet rate sampling,
  285. * measured in seconds. Must not be zero.
  286. */
  287. cvals->rate_sample_interval = 0;
  288. return 0;
  289. }
  290. /* Change the coalescing values.
  291. * Both cvals->*_usecs and cvals->*_frames have to be > 0
  292. * in order for coalescing to be active
  293. */
  294. static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
  295. {
  296. struct gfar_private *priv = netdev_priv(dev);
  297. if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE))
  298. return -EOPNOTSUPP;
  299. /* Set up rx coalescing */
  300. if ((cvals->rx_coalesce_usecs == 0) ||
  301. (cvals->rx_max_coalesced_frames == 0))
  302. priv->rxcoalescing = 0;
  303. else
  304. priv->rxcoalescing = 1;
  305. if (NULL == priv->phydev)
  306. return -ENODEV;
  307. /* Check the bounds of the values */
  308. if (cvals->rx_coalesce_usecs > GFAR_MAX_COAL_USECS) {
  309. pr_info("Coalescing is limited to %d microseconds\n",
  310. GFAR_MAX_COAL_USECS);
  311. return -EINVAL;
  312. }
  313. if (cvals->rx_max_coalesced_frames > GFAR_MAX_COAL_FRAMES) {
  314. pr_info("Coalescing is limited to %d frames\n",
  315. GFAR_MAX_COAL_FRAMES);
  316. return -EINVAL;
  317. }
  318. priv->rxic = mk_ic_value(
  319. gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs),
  320. cvals->rx_max_coalesced_frames);
  321. /* Set up tx coalescing */
  322. if ((cvals->tx_coalesce_usecs == 0) ||
  323. (cvals->tx_max_coalesced_frames == 0))
  324. priv->txcoalescing = 0;
  325. else
  326. priv->txcoalescing = 1;
  327. /* Check the bounds of the values */
  328. if (cvals->tx_coalesce_usecs > GFAR_MAX_COAL_USECS) {
  329. pr_info("Coalescing is limited to %d microseconds\n",
  330. GFAR_MAX_COAL_USECS);
  331. return -EINVAL;
  332. }
  333. if (cvals->tx_max_coalesced_frames > GFAR_MAX_COAL_FRAMES) {
  334. pr_info("Coalescing is limited to %d frames\n",
  335. GFAR_MAX_COAL_FRAMES);
  336. return -EINVAL;
  337. }
  338. priv->txic = mk_ic_value(
  339. gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs),
  340. cvals->tx_max_coalesced_frames);
  341. gfar_write(&priv->regs->rxic, 0);
  342. if (priv->rxcoalescing)
  343. gfar_write(&priv->regs->rxic, priv->rxic);
  344. gfar_write(&priv->regs->txic, 0);
  345. if (priv->txcoalescing)
  346. gfar_write(&priv->regs->txic, priv->txic);
  347. return 0;
  348. }
  349. /* Fills in rvals with the current ring parameters. Currently,
  350. * rx, rx_mini, and rx_jumbo rings are the same size, as mini and
  351. * jumbo are ignored by the driver */
  352. static void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals)
  353. {
  354. struct gfar_private *priv = netdev_priv(dev);
  355. rvals->rx_max_pending = GFAR_RX_MAX_RING_SIZE;
  356. rvals->rx_mini_max_pending = GFAR_RX_MAX_RING_SIZE;
  357. rvals->rx_jumbo_max_pending = GFAR_RX_MAX_RING_SIZE;
  358. rvals->tx_max_pending = GFAR_TX_MAX_RING_SIZE;
  359. /* Values changeable by the user. The valid values are
  360. * in the range 1 to the "*_max_pending" counterpart above.
  361. */
  362. rvals->rx_pending = priv->rx_ring_size;
  363. rvals->rx_mini_pending = priv->rx_ring_size;
  364. rvals->rx_jumbo_pending = priv->rx_ring_size;
  365. rvals->tx_pending = priv->tx_ring_size;
  366. }
  367. /* Change the current ring parameters, stopping the controller if
  368. * necessary so that we don't mess things up while we're in
  369. * motion. We wait for the ring to be clean before reallocating
  370. * the rings. */
  371. static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals)
  372. {
  373. struct gfar_private *priv = netdev_priv(dev);
  374. int err = 0;
  375. if (rvals->rx_pending > GFAR_RX_MAX_RING_SIZE)
  376. return -EINVAL;
  377. if (!is_power_of_2(rvals->rx_pending)) {
  378. printk("%s: Ring sizes must be a power of 2\n",
  379. dev->name);
  380. return -EINVAL;
  381. }
  382. if (rvals->tx_pending > GFAR_TX_MAX_RING_SIZE)
  383. return -EINVAL;
  384. if (!is_power_of_2(rvals->tx_pending)) {
  385. printk("%s: Ring sizes must be a power of 2\n",
  386. dev->name);
  387. return -EINVAL;
  388. }
  389. if (dev->flags & IFF_UP) {
  390. unsigned long flags;
  391. /* Halt TX and RX, and process the frames which
  392. * have already been received */
  393. spin_lock_irqsave(&priv->txlock, flags);
  394. spin_lock(&priv->rxlock);
  395. gfar_halt(dev);
  396. spin_unlock(&priv->rxlock);
  397. spin_unlock_irqrestore(&priv->txlock, flags);
  398. gfar_clean_rx_ring(dev, priv->rx_ring_size);
  399. /* Now we take down the rings to rebuild them */
  400. stop_gfar(dev);
  401. }
  402. /* Change the size */
  403. priv->rx_ring_size = rvals->rx_pending;
  404. priv->tx_ring_size = rvals->tx_pending;
  405. priv->num_txbdfree = priv->tx_ring_size;
  406. /* Rebuild the rings with the new size */
  407. if (dev->flags & IFF_UP) {
  408. err = startup_gfar(dev);
  409. netif_wake_queue(dev);
  410. }
  411. return err;
  412. }
  413. static int gfar_set_rx_csum(struct net_device *dev, uint32_t data)
  414. {
  415. struct gfar_private *priv = netdev_priv(dev);
  416. unsigned long flags;
  417. int err = 0;
  418. if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
  419. return -EOPNOTSUPP;
  420. if (dev->flags & IFF_UP) {
  421. /* Halt TX and RX, and process the frames which
  422. * have already been received */
  423. spin_lock_irqsave(&priv->txlock, flags);
  424. spin_lock(&priv->rxlock);
  425. gfar_halt(dev);
  426. spin_unlock(&priv->rxlock);
  427. spin_unlock_irqrestore(&priv->txlock, flags);
  428. gfar_clean_rx_ring(dev, priv->rx_ring_size);
  429. /* Now we take down the rings to rebuild them */
  430. stop_gfar(dev);
  431. }
  432. spin_lock_irqsave(&priv->bflock, flags);
  433. priv->rx_csum_enable = data;
  434. spin_unlock_irqrestore(&priv->bflock, flags);
  435. if (dev->flags & IFF_UP) {
  436. err = startup_gfar(dev);
  437. netif_wake_queue(dev);
  438. }
  439. return err;
  440. }
  441. static uint32_t gfar_get_rx_csum(struct net_device *dev)
  442. {
  443. struct gfar_private *priv = netdev_priv(dev);
  444. if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
  445. return 0;
  446. return priv->rx_csum_enable;
  447. }
  448. static int gfar_set_tx_csum(struct net_device *dev, uint32_t data)
  449. {
  450. struct gfar_private *priv = netdev_priv(dev);
  451. if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
  452. return -EOPNOTSUPP;
  453. netif_tx_lock_bh(dev);
  454. if (data)
  455. dev->features |= NETIF_F_IP_CSUM;
  456. else
  457. dev->features &= ~NETIF_F_IP_CSUM;
  458. netif_tx_unlock_bh(dev);
  459. return 0;
  460. }
  461. static uint32_t gfar_get_tx_csum(struct net_device *dev)
  462. {
  463. struct gfar_private *priv = netdev_priv(dev);
  464. if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
  465. return 0;
  466. return (dev->features & NETIF_F_IP_CSUM) != 0;
  467. }
  468. static uint32_t gfar_get_msglevel(struct net_device *dev)
  469. {
  470. struct gfar_private *priv = netdev_priv(dev);
  471. return priv->msg_enable;
  472. }
  473. static void gfar_set_msglevel(struct net_device *dev, uint32_t data)
  474. {
  475. struct gfar_private *priv = netdev_priv(dev);
  476. priv->msg_enable = data;
  477. }
  478. #ifdef CONFIG_PM
  479. static void gfar_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
  480. {
  481. struct gfar_private *priv = netdev_priv(dev);
  482. if (priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET) {
  483. wol->supported = WAKE_MAGIC;
  484. wol->wolopts = priv->wol_en ? WAKE_MAGIC : 0;
  485. } else {
  486. wol->supported = wol->wolopts = 0;
  487. }
  488. }
  489. static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
  490. {
  491. struct gfar_private *priv = netdev_priv(dev);
  492. unsigned long flags;
  493. if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET) &&
  494. wol->wolopts != 0)
  495. return -EINVAL;
  496. if (wol->wolopts & ~WAKE_MAGIC)
  497. return -EINVAL;
  498. spin_lock_irqsave(&priv->bflock, flags);
  499. priv->wol_en = wol->wolopts & WAKE_MAGIC ? 1 : 0;
  500. device_set_wakeup_enable(&dev->dev, priv->wol_en);
  501. spin_unlock_irqrestore(&priv->bflock, flags);
  502. return 0;
  503. }
  504. #endif
  505. const struct ethtool_ops gfar_ethtool_ops = {
  506. .get_settings = gfar_gsettings,
  507. .set_settings = gfar_ssettings,
  508. .get_drvinfo = gfar_gdrvinfo,
  509. .get_regs_len = gfar_reglen,
  510. .get_regs = gfar_get_regs,
  511. .get_link = ethtool_op_get_link,
  512. .get_coalesce = gfar_gcoalesce,
  513. .set_coalesce = gfar_scoalesce,
  514. .get_ringparam = gfar_gringparam,
  515. .set_ringparam = gfar_sringparam,
  516. .get_strings = gfar_gstrings,
  517. .get_sset_count = gfar_sset_count,
  518. .get_ethtool_stats = gfar_fill_stats,
  519. .get_rx_csum = gfar_get_rx_csum,
  520. .get_tx_csum = gfar_get_tx_csum,
  521. .set_rx_csum = gfar_set_rx_csum,
  522. .set_tx_csum = gfar_set_tx_csum,
  523. .set_sg = ethtool_op_set_sg,
  524. .get_msglevel = gfar_get_msglevel,
  525. .set_msglevel = gfar_set_msglevel,
  526. #ifdef CONFIG_PM
  527. .get_wol = gfar_get_wol,
  528. .set_wol = gfar_set_wol,
  529. #endif
  530. };