xgbe-ethtool.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. /*
  2. * AMD 10Gb Ethernet driver
  3. *
  4. * This file is available to you under your choice of the following two
  5. * licenses:
  6. *
  7. * License 1: GPLv2
  8. *
  9. * Copyright (c) 2014 Advanced Micro Devices, Inc.
  10. *
  11. * This file is free software; you may copy, redistribute and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation, either version 2 of the License, or (at
  14. * your option) any later version.
  15. *
  16. * This file is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. * This file incorporates work covered by the following copyright and
  25. * permission notice:
  26. * The Synopsys DWC ETHER XGMAC Software Driver and documentation
  27. * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
  28. * Inc. unless otherwise expressly agreed to in writing between Synopsys
  29. * and you.
  30. *
  31. * The Software IS NOT an item of Licensed Software or Licensed Product
  32. * under any End User Software License Agreement or Agreement for Licensed
  33. * Product with Synopsys or any supplement thereto. Permission is hereby
  34. * granted, free of charge, to any person obtaining a copy of this software
  35. * annotated with this license and the Software, to deal in the Software
  36. * without restriction, including without limitation the rights to use,
  37. * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  38. * of the Software, and to permit persons to whom the Software is furnished
  39. * to do so, subject to the following conditions:
  40. *
  41. * The above copyright notice and this permission notice shall be included
  42. * in all copies or substantial portions of the Software.
  43. *
  44. * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
  45. * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  46. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  47. * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
  48. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  49. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  50. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  51. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  52. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  53. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  54. * THE POSSIBILITY OF SUCH DAMAGE.
  55. *
  56. *
  57. * License 2: Modified BSD
  58. *
  59. * Copyright (c) 2014 Advanced Micro Devices, Inc.
  60. * All rights reserved.
  61. *
  62. * Redistribution and use in source and binary forms, with or without
  63. * modification, are permitted provided that the following conditions are met:
  64. * * Redistributions of source code must retain the above copyright
  65. * notice, this list of conditions and the following disclaimer.
  66. * * Redistributions in binary form must reproduce the above copyright
  67. * notice, this list of conditions and the following disclaimer in the
  68. * documentation and/or other materials provided with the distribution.
  69. * * Neither the name of Advanced Micro Devices, Inc. nor the
  70. * names of its contributors may be used to endorse or promote products
  71. * derived from this software without specific prior written permission.
  72. *
  73. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  74. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  75. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  76. * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  77. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  78. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  79. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  80. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  81. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  82. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  83. *
  84. * This file incorporates work covered by the following copyright and
  85. * permission notice:
  86. * The Synopsys DWC ETHER XGMAC Software Driver and documentation
  87. * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
  88. * Inc. unless otherwise expressly agreed to in writing between Synopsys
  89. * and you.
  90. *
  91. * The Software IS NOT an item of Licensed Software or Licensed Product
  92. * under any End User Software License Agreement or Agreement for Licensed
  93. * Product with Synopsys or any supplement thereto. Permission is hereby
  94. * granted, free of charge, to any person obtaining a copy of this software
  95. * annotated with this license and the Software, to deal in the Software
  96. * without restriction, including without limitation the rights to use,
  97. * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  98. * of the Software, and to permit persons to whom the Software is furnished
  99. * to do so, subject to the following conditions:
  100. *
  101. * The above copyright notice and this permission notice shall be included
  102. * in all copies or substantial portions of the Software.
  103. *
  104. * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
  105. * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  106. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  107. * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
  108. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  109. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  110. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  111. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  112. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  113. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  114. * THE POSSIBILITY OF SUCH DAMAGE.
  115. */
  116. #include <linux/spinlock.h>
  117. #include <linux/phy.h>
  118. #include "xgbe.h"
  119. #include "xgbe-common.h"
  120. struct xgbe_stats {
  121. char stat_string[ETH_GSTRING_LEN];
  122. int stat_size;
  123. int stat_offset;
  124. };
  125. #define XGMAC_MMC_STAT(_string, _var) \
  126. { _string, \
  127. FIELD_SIZEOF(struct xgbe_mmc_stats, _var), \
  128. offsetof(struct xgbe_prv_data, mmc_stats._var), \
  129. }
  130. static const struct xgbe_stats xgbe_gstring_stats[] = {
  131. XGMAC_MMC_STAT("tx_bytes", txoctetcount_gb),
  132. XGMAC_MMC_STAT("tx_packets", txframecount_gb),
  133. XGMAC_MMC_STAT("tx_unicast_packets", txunicastframes_gb),
  134. XGMAC_MMC_STAT("tx_broadcast_packets", txbroadcastframes_gb),
  135. XGMAC_MMC_STAT("tx_multicast_packets", txmulticastframes_gb),
  136. XGMAC_MMC_STAT("tx_vlan_packets", txvlanframes_g),
  137. XGMAC_MMC_STAT("tx_64_byte_packets", tx64octets_gb),
  138. XGMAC_MMC_STAT("tx_65_to_127_byte_packets", tx65to127octets_gb),
  139. XGMAC_MMC_STAT("tx_128_to_255_byte_packets", tx128to255octets_gb),
  140. XGMAC_MMC_STAT("tx_256_to_511_byte_packets", tx256to511octets_gb),
  141. XGMAC_MMC_STAT("tx_512_to_1023_byte_packets", tx512to1023octets_gb),
  142. XGMAC_MMC_STAT("tx_1024_to_max_byte_packets", tx1024tomaxoctets_gb),
  143. XGMAC_MMC_STAT("tx_underflow_errors", txunderflowerror),
  144. XGMAC_MMC_STAT("tx_pause_frames", txpauseframes),
  145. XGMAC_MMC_STAT("rx_bytes", rxoctetcount_gb),
  146. XGMAC_MMC_STAT("rx_packets", rxframecount_gb),
  147. XGMAC_MMC_STAT("rx_unicast_packets", rxunicastframes_g),
  148. XGMAC_MMC_STAT("rx_broadcast_packets", rxbroadcastframes_g),
  149. XGMAC_MMC_STAT("rx_multicast_packets", rxmulticastframes_g),
  150. XGMAC_MMC_STAT("rx_vlan_packets", rxvlanframes_gb),
  151. XGMAC_MMC_STAT("rx_64_byte_packets", rx64octets_gb),
  152. XGMAC_MMC_STAT("rx_65_to_127_byte_packets", rx65to127octets_gb),
  153. XGMAC_MMC_STAT("rx_128_to_255_byte_packets", rx128to255octets_gb),
  154. XGMAC_MMC_STAT("rx_256_to_511_byte_packets", rx256to511octets_gb),
  155. XGMAC_MMC_STAT("rx_512_to_1023_byte_packets", rx512to1023octets_gb),
  156. XGMAC_MMC_STAT("rx_1024_to_max_byte_packets", rx1024tomaxoctets_gb),
  157. XGMAC_MMC_STAT("rx_undersize_packets", rxundersize_g),
  158. XGMAC_MMC_STAT("rx_oversize_packets", rxoversize_g),
  159. XGMAC_MMC_STAT("rx_crc_errors", rxcrcerror),
  160. XGMAC_MMC_STAT("rx_crc_errors_small_packets", rxrunterror),
  161. XGMAC_MMC_STAT("rx_crc_errors_giant_packets", rxjabbererror),
  162. XGMAC_MMC_STAT("rx_length_errors", rxlengtherror),
  163. XGMAC_MMC_STAT("rx_out_of_range_errors", rxoutofrangetype),
  164. XGMAC_MMC_STAT("rx_fifo_overflow_errors", rxfifooverflow),
  165. XGMAC_MMC_STAT("rx_watchdog_errors", rxwatchdogerror),
  166. XGMAC_MMC_STAT("rx_pause_frames", rxpauseframes),
  167. };
  168. #define XGBE_STATS_COUNT ARRAY_SIZE(xgbe_gstring_stats)
  169. static void xgbe_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
  170. {
  171. int i;
  172. DBGPR("-->%s\n", __func__);
  173. switch (stringset) {
  174. case ETH_SS_STATS:
  175. for (i = 0; i < XGBE_STATS_COUNT; i++) {
  176. memcpy(data, xgbe_gstring_stats[i].stat_string,
  177. ETH_GSTRING_LEN);
  178. data += ETH_GSTRING_LEN;
  179. }
  180. break;
  181. }
  182. DBGPR("<--%s\n", __func__);
  183. }
  184. static void xgbe_get_ethtool_stats(struct net_device *netdev,
  185. struct ethtool_stats *stats, u64 *data)
  186. {
  187. struct xgbe_prv_data *pdata = netdev_priv(netdev);
  188. u8 *stat;
  189. int i;
  190. DBGPR("-->%s\n", __func__);
  191. pdata->hw_if.read_mmc_stats(pdata);
  192. for (i = 0; i < XGBE_STATS_COUNT; i++) {
  193. stat = (u8 *)pdata + xgbe_gstring_stats[i].stat_offset;
  194. *data++ = *(u64 *)stat;
  195. }
  196. DBGPR("<--%s\n", __func__);
  197. }
  198. static int xgbe_get_sset_count(struct net_device *netdev, int stringset)
  199. {
  200. int ret;
  201. DBGPR("-->%s\n", __func__);
  202. switch (stringset) {
  203. case ETH_SS_STATS:
  204. ret = XGBE_STATS_COUNT;
  205. break;
  206. default:
  207. ret = -EOPNOTSUPP;
  208. }
  209. DBGPR("<--%s\n", __func__);
  210. return ret;
  211. }
  212. static void xgbe_get_pauseparam(struct net_device *netdev,
  213. struct ethtool_pauseparam *pause)
  214. {
  215. struct xgbe_prv_data *pdata = netdev_priv(netdev);
  216. DBGPR("-->xgbe_get_pauseparam\n");
  217. pause->autoneg = pdata->pause_autoneg;
  218. pause->tx_pause = pdata->tx_pause;
  219. pause->rx_pause = pdata->rx_pause;
  220. DBGPR("<--xgbe_get_pauseparam\n");
  221. }
  222. static int xgbe_set_pauseparam(struct net_device *netdev,
  223. struct ethtool_pauseparam *pause)
  224. {
  225. struct xgbe_prv_data *pdata = netdev_priv(netdev);
  226. struct phy_device *phydev = pdata->phydev;
  227. int ret = 0;
  228. DBGPR("-->xgbe_set_pauseparam\n");
  229. DBGPR(" autoneg = %d, tx_pause = %d, rx_pause = %d\n",
  230. pause->autoneg, pause->tx_pause, pause->rx_pause);
  231. pdata->pause_autoneg = pause->autoneg;
  232. if (pause->autoneg) {
  233. phydev->advertising |= ADVERTISED_Pause;
  234. phydev->advertising |= ADVERTISED_Asym_Pause;
  235. } else {
  236. phydev->advertising &= ~ADVERTISED_Pause;
  237. phydev->advertising &= ~ADVERTISED_Asym_Pause;
  238. pdata->tx_pause = pause->tx_pause;
  239. pdata->rx_pause = pause->rx_pause;
  240. }
  241. if (netif_running(netdev))
  242. ret = phy_start_aneg(phydev);
  243. DBGPR("<--xgbe_set_pauseparam\n");
  244. return ret;
  245. }
  246. static int xgbe_get_settings(struct net_device *netdev,
  247. struct ethtool_cmd *cmd)
  248. {
  249. struct xgbe_prv_data *pdata = netdev_priv(netdev);
  250. int ret;
  251. DBGPR("-->xgbe_get_settings\n");
  252. if (!pdata->phydev)
  253. return -ENODEV;
  254. spin_lock_irq(&pdata->lock);
  255. ret = phy_ethtool_gset(pdata->phydev, cmd);
  256. cmd->transceiver = XCVR_EXTERNAL;
  257. spin_unlock_irq(&pdata->lock);
  258. DBGPR("<--xgbe_get_settings\n");
  259. return ret;
  260. }
  261. static int xgbe_set_settings(struct net_device *netdev,
  262. struct ethtool_cmd *cmd)
  263. {
  264. struct xgbe_prv_data *pdata = netdev_priv(netdev);
  265. struct phy_device *phydev = pdata->phydev;
  266. u32 speed;
  267. int ret;
  268. DBGPR("-->xgbe_set_settings\n");
  269. if (!pdata->phydev)
  270. return -ENODEV;
  271. spin_lock_irq(&pdata->lock);
  272. speed = ethtool_cmd_speed(cmd);
  273. ret = -EINVAL;
  274. if (cmd->phy_address != phydev->addr)
  275. goto unlock;
  276. if ((cmd->autoneg != AUTONEG_ENABLE) &&
  277. (cmd->autoneg != AUTONEG_DISABLE))
  278. goto unlock;
  279. if ((cmd->autoneg == AUTONEG_DISABLE) &&
  280. (((speed != SPEED_10000) && (speed != SPEED_1000)) ||
  281. (cmd->duplex != DUPLEX_FULL)))
  282. goto unlock;
  283. if (cmd->autoneg == AUTONEG_ENABLE) {
  284. /* Clear settings needed to force speeds */
  285. phydev->supported &= ~SUPPORTED_1000baseT_Full;
  286. phydev->supported &= ~SUPPORTED_10000baseT_Full;
  287. } else {
  288. /* Add settings needed to force speed */
  289. phydev->supported |= SUPPORTED_1000baseT_Full;
  290. phydev->supported |= SUPPORTED_10000baseT_Full;
  291. }
  292. cmd->advertising &= phydev->supported;
  293. if ((cmd->autoneg == AUTONEG_ENABLE) && !cmd->advertising)
  294. goto unlock;
  295. ret = 0;
  296. phydev->autoneg = cmd->autoneg;
  297. phydev->speed = speed;
  298. phydev->duplex = cmd->duplex;
  299. phydev->advertising = cmd->advertising;
  300. if (cmd->autoneg == AUTONEG_ENABLE)
  301. phydev->advertising |= ADVERTISED_Autoneg;
  302. else
  303. phydev->advertising &= ~ADVERTISED_Autoneg;
  304. if (netif_running(netdev))
  305. ret = phy_start_aneg(phydev);
  306. unlock:
  307. spin_unlock_irq(&pdata->lock);
  308. DBGPR("<--xgbe_set_settings\n");
  309. return ret;
  310. }
  311. static void xgbe_get_drvinfo(struct net_device *netdev,
  312. struct ethtool_drvinfo *drvinfo)
  313. {
  314. struct xgbe_prv_data *pdata = netdev_priv(netdev);
  315. strlcpy(drvinfo->driver, XGBE_DRV_NAME, sizeof(drvinfo->driver));
  316. strlcpy(drvinfo->version, XGBE_DRV_VERSION, sizeof(drvinfo->version));
  317. strlcpy(drvinfo->bus_info, dev_name(pdata->dev),
  318. sizeof(drvinfo->bus_info));
  319. snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d.%d.%d",
  320. XGMAC_IOREAD_BITS(pdata, MAC_VR, USERVER),
  321. XGMAC_IOREAD_BITS(pdata, MAC_VR, DEVID),
  322. XGMAC_IOREAD_BITS(pdata, MAC_VR, SNPSVER));
  323. drvinfo->n_stats = XGBE_STATS_COUNT;
  324. }
  325. static int xgbe_get_coalesce(struct net_device *netdev,
  326. struct ethtool_coalesce *ec)
  327. {
  328. struct xgbe_prv_data *pdata = netdev_priv(netdev);
  329. struct xgbe_hw_if *hw_if = &pdata->hw_if;
  330. unsigned int riwt;
  331. DBGPR("-->xgbe_get_coalesce\n");
  332. memset(ec, 0, sizeof(struct ethtool_coalesce));
  333. riwt = pdata->rx_riwt;
  334. ec->rx_coalesce_usecs = hw_if->riwt_to_usec(pdata, riwt);
  335. ec->rx_max_coalesced_frames = pdata->rx_frames;
  336. ec->tx_coalesce_usecs = pdata->tx_usecs;
  337. ec->tx_max_coalesced_frames = pdata->tx_frames;
  338. DBGPR("<--xgbe_get_coalesce\n");
  339. return 0;
  340. }
  341. static int xgbe_set_coalesce(struct net_device *netdev,
  342. struct ethtool_coalesce *ec)
  343. {
  344. struct xgbe_prv_data *pdata = netdev_priv(netdev);
  345. struct xgbe_hw_if *hw_if = &pdata->hw_if;
  346. unsigned int rx_frames, rx_riwt, rx_usecs;
  347. unsigned int tx_frames, tx_usecs;
  348. DBGPR("-->xgbe_set_coalesce\n");
  349. /* Check for not supported parameters */
  350. if ((ec->rx_coalesce_usecs_irq) ||
  351. (ec->rx_max_coalesced_frames_irq) ||
  352. (ec->tx_coalesce_usecs_irq) ||
  353. (ec->tx_max_coalesced_frames_irq) ||
  354. (ec->stats_block_coalesce_usecs) ||
  355. (ec->use_adaptive_rx_coalesce) ||
  356. (ec->use_adaptive_tx_coalesce) ||
  357. (ec->pkt_rate_low) ||
  358. (ec->rx_coalesce_usecs_low) ||
  359. (ec->rx_max_coalesced_frames_low) ||
  360. (ec->tx_coalesce_usecs_low) ||
  361. (ec->tx_max_coalesced_frames_low) ||
  362. (ec->pkt_rate_high) ||
  363. (ec->rx_coalesce_usecs_high) ||
  364. (ec->rx_max_coalesced_frames_high) ||
  365. (ec->tx_coalesce_usecs_high) ||
  366. (ec->tx_max_coalesced_frames_high) ||
  367. (ec->rate_sample_interval))
  368. return -EOPNOTSUPP;
  369. /* Can only change rx-frames when interface is down (see
  370. * rx_descriptor_init in xgbe-dev.c)
  371. */
  372. rx_frames = pdata->rx_frames;
  373. if (rx_frames != ec->rx_max_coalesced_frames && netif_running(netdev)) {
  374. netdev_alert(netdev,
  375. "interface must be down to change rx-frames\n");
  376. return -EINVAL;
  377. }
  378. rx_riwt = hw_if->usec_to_riwt(pdata, ec->rx_coalesce_usecs);
  379. rx_frames = ec->rx_max_coalesced_frames;
  380. /* Use smallest possible value if conversion resulted in zero */
  381. if (ec->rx_coalesce_usecs && !rx_riwt)
  382. rx_riwt = 1;
  383. /* Check the bounds of values for Rx */
  384. if (rx_riwt > XGMAC_MAX_DMA_RIWT) {
  385. rx_usecs = hw_if->riwt_to_usec(pdata, XGMAC_MAX_DMA_RIWT);
  386. netdev_alert(netdev, "rx-usec is limited to %d usecs\n",
  387. rx_usecs);
  388. return -EINVAL;
  389. }
  390. if (rx_frames > pdata->channel->rx_ring->rdesc_count) {
  391. netdev_alert(netdev, "rx-frames is limited to %d frames\n",
  392. pdata->channel->rx_ring->rdesc_count);
  393. return -EINVAL;
  394. }
  395. tx_usecs = ec->tx_coalesce_usecs;
  396. tx_frames = ec->tx_max_coalesced_frames;
  397. /* Check the bounds of values for Tx */
  398. if (tx_frames > pdata->channel->tx_ring->rdesc_count) {
  399. netdev_alert(netdev, "tx-frames is limited to %d frames\n",
  400. pdata->channel->tx_ring->rdesc_count);
  401. return -EINVAL;
  402. }
  403. pdata->rx_riwt = rx_riwt;
  404. pdata->rx_frames = rx_frames;
  405. hw_if->config_rx_coalesce(pdata);
  406. pdata->tx_usecs = tx_usecs;
  407. pdata->tx_frames = tx_frames;
  408. hw_if->config_tx_coalesce(pdata);
  409. DBGPR("<--xgbe_set_coalesce\n");
  410. return 0;
  411. }
  412. static const struct ethtool_ops xgbe_ethtool_ops = {
  413. .get_settings = xgbe_get_settings,
  414. .set_settings = xgbe_set_settings,
  415. .get_drvinfo = xgbe_get_drvinfo,
  416. .get_link = ethtool_op_get_link,
  417. .get_coalesce = xgbe_get_coalesce,
  418. .set_coalesce = xgbe_set_coalesce,
  419. .get_pauseparam = xgbe_get_pauseparam,
  420. .set_pauseparam = xgbe_set_pauseparam,
  421. .get_strings = xgbe_get_strings,
  422. .get_ethtool_stats = xgbe_get_ethtool_stats,
  423. .get_sset_count = xgbe_get_sset_count,
  424. };
  425. struct ethtool_ops *xgbe_get_ethtool_ops(void)
  426. {
  427. return (struct ethtool_ops *)&xgbe_ethtool_ops;
  428. }