cxgb4_ethtool.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. /*
  2. * Copyright (C) 2013-2015 Chelsio Communications. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * The full GNU General Public License is included in this distribution in
  14. * the file called "COPYING".
  15. *
  16. */
  17. #include <linux/firmware.h>
  18. #include <linux/mdio.h>
  19. #include "cxgb4.h"
  20. #include "t4_regs.h"
  21. #include "t4fw_api.h"
  22. #define EEPROM_MAGIC 0x38E2F10C
  23. static u32 get_msglevel(struct net_device *dev)
  24. {
  25. return netdev2adap(dev)->msg_enable;
  26. }
  27. static void set_msglevel(struct net_device *dev, u32 val)
  28. {
  29. netdev2adap(dev)->msg_enable = val;
  30. }
  31. static const char stats_strings[][ETH_GSTRING_LEN] = {
  32. "tx_octets_ok ",
  33. "tx_frames_ok ",
  34. "tx_broadcast_frames ",
  35. "tx_multicast_frames ",
  36. "tx_unicast_frames ",
  37. "tx_error_frames ",
  38. "tx_frames_64 ",
  39. "tx_frames_65_to_127 ",
  40. "tx_frames_128_to_255 ",
  41. "tx_frames_256_to_511 ",
  42. "tx_frames_512_to_1023 ",
  43. "tx_frames_1024_to_1518 ",
  44. "tx_frames_1519_to_max ",
  45. "tx_frames_dropped ",
  46. "tx_pause_frames ",
  47. "tx_ppp0_frames ",
  48. "tx_ppp1_frames ",
  49. "tx_ppp2_frames ",
  50. "tx_ppp3_frames ",
  51. "tx_ppp4_frames ",
  52. "tx_ppp5_frames ",
  53. "tx_ppp6_frames ",
  54. "tx_ppp7_frames ",
  55. "rx_octets_ok ",
  56. "rx_frames_ok ",
  57. "rx_broadcast_frames ",
  58. "rx_multicast_frames ",
  59. "rx_unicast_frames ",
  60. "rx_frames_too_long ",
  61. "rx_jabber_errors ",
  62. "rx_fcs_errors ",
  63. "rx_length_errors ",
  64. "rx_symbol_errors ",
  65. "rx_runt_frames ",
  66. "rx_frames_64 ",
  67. "rx_frames_65_to_127 ",
  68. "rx_frames_128_to_255 ",
  69. "rx_frames_256_to_511 ",
  70. "rx_frames_512_to_1023 ",
  71. "rx_frames_1024_to_1518 ",
  72. "rx_frames_1519_to_max ",
  73. "rx_pause_frames ",
  74. "rx_ppp0_frames ",
  75. "rx_ppp1_frames ",
  76. "rx_ppp2_frames ",
  77. "rx_ppp3_frames ",
  78. "rx_ppp4_frames ",
  79. "rx_ppp5_frames ",
  80. "rx_ppp6_frames ",
  81. "rx_ppp7_frames ",
  82. "rx_bg0_frames_dropped ",
  83. "rx_bg1_frames_dropped ",
  84. "rx_bg2_frames_dropped ",
  85. "rx_bg3_frames_dropped ",
  86. "rx_bg0_frames_trunc ",
  87. "rx_bg1_frames_trunc ",
  88. "rx_bg2_frames_trunc ",
  89. "rx_bg3_frames_trunc ",
  90. "tso ",
  91. "tx_csum_offload ",
  92. "rx_csum_good ",
  93. "vlan_extractions ",
  94. "vlan_insertions ",
  95. "gro_packets ",
  96. "gro_merged ",
  97. };
  98. static char adapter_stats_strings[][ETH_GSTRING_LEN] = {
  99. "db_drop ",
  100. "db_full ",
  101. "db_empty ",
  102. "tcp_ipv4_out_rsts ",
  103. "tcp_ipv4_in_segs ",
  104. "tcp_ipv4_out_segs ",
  105. "tcp_ipv4_retrans_segs ",
  106. "tcp_ipv6_out_rsts ",
  107. "tcp_ipv6_in_segs ",
  108. "tcp_ipv6_out_segs ",
  109. "tcp_ipv6_retrans_segs ",
  110. "usm_ddp_frames ",
  111. "usm_ddp_octets ",
  112. "usm_ddp_drops ",
  113. "rdma_no_rqe_mod_defer ",
  114. "rdma_no_rqe_pkt_defer ",
  115. "tp_err_ofld_no_neigh ",
  116. "tp_err_ofld_cong_defer ",
  117. "write_coal_success ",
  118. "write_coal_fail ",
  119. };
  120. static char channel_stats_strings[][ETH_GSTRING_LEN] = {
  121. "--------Channel--------- ",
  122. "tp_cpl_requests ",
  123. "tp_cpl_responses ",
  124. "tp_mac_in_errs ",
  125. "tp_hdr_in_errs ",
  126. "tp_tcp_in_errs ",
  127. "tp_tcp6_in_errs ",
  128. "tp_tnl_cong_drops ",
  129. "tp_tnl_tx_drops ",
  130. "tp_ofld_vlan_drops ",
  131. "tp_ofld_chan_drops ",
  132. "fcoe_octets_ddp ",
  133. "fcoe_frames_ddp ",
  134. "fcoe_frames_drop ",
  135. };
  136. static char loopback_stats_strings[][ETH_GSTRING_LEN] = {
  137. "-------Loopback----------- ",
  138. "octets_ok ",
  139. "frames_ok ",
  140. "bcast_frames ",
  141. "mcast_frames ",
  142. "ucast_frames ",
  143. "error_frames ",
  144. "frames_64 ",
  145. "frames_65_to_127 ",
  146. "frames_128_to_255 ",
  147. "frames_256_to_511 ",
  148. "frames_512_to_1023 ",
  149. "frames_1024_to_1518 ",
  150. "frames_1519_to_max ",
  151. "frames_dropped ",
  152. "bg0_frames_dropped ",
  153. "bg1_frames_dropped ",
  154. "bg2_frames_dropped ",
  155. "bg3_frames_dropped ",
  156. "bg0_frames_trunc ",
  157. "bg1_frames_trunc ",
  158. "bg2_frames_trunc ",
  159. "bg3_frames_trunc ",
  160. };
  161. static int get_sset_count(struct net_device *dev, int sset)
  162. {
  163. switch (sset) {
  164. case ETH_SS_STATS:
  165. return ARRAY_SIZE(stats_strings) +
  166. ARRAY_SIZE(adapter_stats_strings) +
  167. ARRAY_SIZE(channel_stats_strings) +
  168. ARRAY_SIZE(loopback_stats_strings);
  169. default:
  170. return -EOPNOTSUPP;
  171. }
  172. }
  173. static int get_regs_len(struct net_device *dev)
  174. {
  175. struct adapter *adap = netdev2adap(dev);
  176. return t4_get_regs_len(adap);
  177. }
  178. static int get_eeprom_len(struct net_device *dev)
  179. {
  180. return EEPROMSIZE;
  181. }
  182. static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
  183. {
  184. struct adapter *adapter = netdev2adap(dev);
  185. u32 exprom_vers;
  186. strlcpy(info->driver, cxgb4_driver_name, sizeof(info->driver));
  187. strlcpy(info->version, cxgb4_driver_version,
  188. sizeof(info->version));
  189. strlcpy(info->bus_info, pci_name(adapter->pdev),
  190. sizeof(info->bus_info));
  191. info->regdump_len = get_regs_len(dev);
  192. if (!adapter->params.fw_vers)
  193. strcpy(info->fw_version, "N/A");
  194. else
  195. snprintf(info->fw_version, sizeof(info->fw_version),
  196. "%u.%u.%u.%u, TP %u.%u.%u.%u",
  197. FW_HDR_FW_VER_MAJOR_G(adapter->params.fw_vers),
  198. FW_HDR_FW_VER_MINOR_G(adapter->params.fw_vers),
  199. FW_HDR_FW_VER_MICRO_G(adapter->params.fw_vers),
  200. FW_HDR_FW_VER_BUILD_G(adapter->params.fw_vers),
  201. FW_HDR_FW_VER_MAJOR_G(adapter->params.tp_vers),
  202. FW_HDR_FW_VER_MINOR_G(adapter->params.tp_vers),
  203. FW_HDR_FW_VER_MICRO_G(adapter->params.tp_vers),
  204. FW_HDR_FW_VER_BUILD_G(adapter->params.tp_vers));
  205. if (!t4_get_exprom_version(adapter, &exprom_vers))
  206. snprintf(info->erom_version, sizeof(info->erom_version),
  207. "%u.%u.%u.%u",
  208. FW_HDR_FW_VER_MAJOR_G(exprom_vers),
  209. FW_HDR_FW_VER_MINOR_G(exprom_vers),
  210. FW_HDR_FW_VER_MICRO_G(exprom_vers),
  211. FW_HDR_FW_VER_BUILD_G(exprom_vers));
  212. }
  213. static void get_strings(struct net_device *dev, u32 stringset, u8 *data)
  214. {
  215. if (stringset == ETH_SS_STATS) {
  216. memcpy(data, stats_strings, sizeof(stats_strings));
  217. data += sizeof(stats_strings);
  218. memcpy(data, adapter_stats_strings,
  219. sizeof(adapter_stats_strings));
  220. data += sizeof(adapter_stats_strings);
  221. memcpy(data, channel_stats_strings,
  222. sizeof(channel_stats_strings));
  223. data += sizeof(channel_stats_strings);
  224. memcpy(data, loopback_stats_strings,
  225. sizeof(loopback_stats_strings));
  226. }
  227. }
  228. /* port stats maintained per queue of the port. They should be in the same
  229. * order as in stats_strings above.
  230. */
  231. struct queue_port_stats {
  232. u64 tso;
  233. u64 tx_csum;
  234. u64 rx_csum;
  235. u64 vlan_ex;
  236. u64 vlan_ins;
  237. u64 gro_pkts;
  238. u64 gro_merged;
  239. };
  240. struct adapter_stats {
  241. u64 db_drop;
  242. u64 db_full;
  243. u64 db_empty;
  244. u64 tcp_v4_out_rsts;
  245. u64 tcp_v4_in_segs;
  246. u64 tcp_v4_out_segs;
  247. u64 tcp_v4_retrans_segs;
  248. u64 tcp_v6_out_rsts;
  249. u64 tcp_v6_in_segs;
  250. u64 tcp_v6_out_segs;
  251. u64 tcp_v6_retrans_segs;
  252. u64 frames;
  253. u64 octets;
  254. u64 drops;
  255. u64 rqe_dfr_mod;
  256. u64 rqe_dfr_pkt;
  257. u64 ofld_no_neigh;
  258. u64 ofld_cong_defer;
  259. u64 wc_success;
  260. u64 wc_fail;
  261. };
  262. struct channel_stats {
  263. u64 cpl_req;
  264. u64 cpl_rsp;
  265. u64 mac_in_errs;
  266. u64 hdr_in_errs;
  267. u64 tcp_in_errs;
  268. u64 tcp6_in_errs;
  269. u64 tnl_cong_drops;
  270. u64 tnl_tx_drops;
  271. u64 ofld_vlan_drops;
  272. u64 ofld_chan_drops;
  273. u64 octets_ddp;
  274. u64 frames_ddp;
  275. u64 frames_drop;
  276. };
  277. static void collect_sge_port_stats(const struct adapter *adap,
  278. const struct port_info *p,
  279. struct queue_port_stats *s)
  280. {
  281. int i;
  282. const struct sge_eth_txq *tx = &adap->sge.ethtxq[p->first_qset];
  283. const struct sge_eth_rxq *rx = &adap->sge.ethrxq[p->first_qset];
  284. memset(s, 0, sizeof(*s));
  285. for (i = 0; i < p->nqsets; i++, rx++, tx++) {
  286. s->tso += tx->tso;
  287. s->tx_csum += tx->tx_cso;
  288. s->rx_csum += rx->stats.rx_cso;
  289. s->vlan_ex += rx->stats.vlan_ex;
  290. s->vlan_ins += tx->vlan_ins;
  291. s->gro_pkts += rx->stats.lro_pkts;
  292. s->gro_merged += rx->stats.lro_merged;
  293. }
  294. }
  295. static void collect_adapter_stats(struct adapter *adap, struct adapter_stats *s)
  296. {
  297. struct tp_tcp_stats v4, v6;
  298. struct tp_rdma_stats rdma_stats;
  299. struct tp_err_stats err_stats;
  300. struct tp_usm_stats usm_stats;
  301. u64 val1, val2;
  302. memset(s, 0, sizeof(*s));
  303. spin_lock(&adap->stats_lock);
  304. t4_tp_get_tcp_stats(adap, &v4, &v6);
  305. t4_tp_get_rdma_stats(adap, &rdma_stats);
  306. t4_get_usm_stats(adap, &usm_stats);
  307. t4_tp_get_err_stats(adap, &err_stats);
  308. spin_unlock(&adap->stats_lock);
  309. s->db_drop = adap->db_stats.db_drop;
  310. s->db_full = adap->db_stats.db_full;
  311. s->db_empty = adap->db_stats.db_empty;
  312. s->tcp_v4_out_rsts = v4.tcp_out_rsts;
  313. s->tcp_v4_in_segs = v4.tcp_in_segs;
  314. s->tcp_v4_out_segs = v4.tcp_out_segs;
  315. s->tcp_v4_retrans_segs = v4.tcp_retrans_segs;
  316. s->tcp_v6_out_rsts = v6.tcp_out_rsts;
  317. s->tcp_v6_in_segs = v6.tcp_in_segs;
  318. s->tcp_v6_out_segs = v6.tcp_out_segs;
  319. s->tcp_v6_retrans_segs = v6.tcp_retrans_segs;
  320. if (is_offload(adap)) {
  321. s->frames = usm_stats.frames;
  322. s->octets = usm_stats.octets;
  323. s->drops = usm_stats.drops;
  324. s->rqe_dfr_mod = rdma_stats.rqe_dfr_mod;
  325. s->rqe_dfr_pkt = rdma_stats.rqe_dfr_pkt;
  326. }
  327. s->ofld_no_neigh = err_stats.ofld_no_neigh;
  328. s->ofld_cong_defer = err_stats.ofld_cong_defer;
  329. if (!is_t4(adap->params.chip)) {
  330. int v;
  331. v = t4_read_reg(adap, SGE_STAT_CFG_A);
  332. if (STATSOURCE_T5_G(v) == 7) {
  333. val2 = t4_read_reg(adap, SGE_STAT_MATCH_A);
  334. val1 = t4_read_reg(adap, SGE_STAT_TOTAL_A);
  335. s->wc_success = val1 - val2;
  336. s->wc_fail = val2;
  337. }
  338. }
  339. }
  340. static void collect_channel_stats(struct adapter *adap, struct channel_stats *s,
  341. u8 i)
  342. {
  343. struct tp_cpl_stats cpl_stats;
  344. struct tp_err_stats err_stats;
  345. struct tp_fcoe_stats fcoe_stats;
  346. memset(s, 0, sizeof(*s));
  347. spin_lock(&adap->stats_lock);
  348. t4_tp_get_cpl_stats(adap, &cpl_stats);
  349. t4_tp_get_err_stats(adap, &err_stats);
  350. t4_get_fcoe_stats(adap, i, &fcoe_stats);
  351. spin_unlock(&adap->stats_lock);
  352. s->cpl_req = cpl_stats.req[i];
  353. s->cpl_rsp = cpl_stats.rsp[i];
  354. s->mac_in_errs = err_stats.mac_in_errs[i];
  355. s->hdr_in_errs = err_stats.hdr_in_errs[i];
  356. s->tcp_in_errs = err_stats.tcp_in_errs[i];
  357. s->tcp6_in_errs = err_stats.tcp6_in_errs[i];
  358. s->tnl_cong_drops = err_stats.tnl_cong_drops[i];
  359. s->tnl_tx_drops = err_stats.tnl_tx_drops[i];
  360. s->ofld_vlan_drops = err_stats.ofld_vlan_drops[i];
  361. s->ofld_chan_drops = err_stats.ofld_chan_drops[i];
  362. s->octets_ddp = fcoe_stats.octets_ddp;
  363. s->frames_ddp = fcoe_stats.frames_ddp;
  364. s->frames_drop = fcoe_stats.frames_drop;
  365. }
  366. static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
  367. u64 *data)
  368. {
  369. struct port_info *pi = netdev_priv(dev);
  370. struct adapter *adapter = pi->adapter;
  371. struct lb_port_stats s;
  372. int i;
  373. u64 *p0;
  374. t4_get_port_stats_offset(adapter, pi->tx_chan,
  375. (struct port_stats *)data,
  376. &pi->stats_base);
  377. data += sizeof(struct port_stats) / sizeof(u64);
  378. collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data);
  379. data += sizeof(struct queue_port_stats) / sizeof(u64);
  380. collect_adapter_stats(adapter, (struct adapter_stats *)data);
  381. data += sizeof(struct adapter_stats) / sizeof(u64);
  382. *data++ = (u64)pi->port_id;
  383. collect_channel_stats(adapter, (struct channel_stats *)data,
  384. pi->port_id);
  385. data += sizeof(struct channel_stats) / sizeof(u64);
  386. *data++ = (u64)pi->port_id;
  387. memset(&s, 0, sizeof(s));
  388. t4_get_lb_stats(adapter, pi->port_id, &s);
  389. p0 = &s.octets;
  390. for (i = 0; i < ARRAY_SIZE(loopback_stats_strings) - 1; i++)
  391. *data++ = (unsigned long long)*p0++;
  392. }
  393. static void get_regs(struct net_device *dev, struct ethtool_regs *regs,
  394. void *buf)
  395. {
  396. struct adapter *adap = netdev2adap(dev);
  397. size_t buf_size;
  398. buf_size = t4_get_regs_len(adap);
  399. regs->version = mk_adap_vers(adap);
  400. t4_get_regs(adap, buf, buf_size);
  401. }
  402. static int restart_autoneg(struct net_device *dev)
  403. {
  404. struct port_info *p = netdev_priv(dev);
  405. if (!netif_running(dev))
  406. return -EAGAIN;
  407. if (p->link_cfg.autoneg != AUTONEG_ENABLE)
  408. return -EINVAL;
  409. t4_restart_aneg(p->adapter, p->adapter->pf, p->tx_chan);
  410. return 0;
  411. }
  412. static int identify_port(struct net_device *dev,
  413. enum ethtool_phys_id_state state)
  414. {
  415. unsigned int val;
  416. struct adapter *adap = netdev2adap(dev);
  417. if (state == ETHTOOL_ID_ACTIVE)
  418. val = 0xffff;
  419. else if (state == ETHTOOL_ID_INACTIVE)
  420. val = 0;
  421. else
  422. return -EINVAL;
  423. return t4_identify_port(adap, adap->pf, netdev2pinfo(dev)->viid, val);
  424. }
  425. static unsigned int from_fw_linkcaps(enum fw_port_type type, unsigned int caps)
  426. {
  427. unsigned int v = 0;
  428. if (type == FW_PORT_TYPE_BT_SGMII || type == FW_PORT_TYPE_BT_XFI ||
  429. type == FW_PORT_TYPE_BT_XAUI) {
  430. v |= SUPPORTED_TP;
  431. if (caps & FW_PORT_CAP_SPEED_100M)
  432. v |= SUPPORTED_100baseT_Full;
  433. if (caps & FW_PORT_CAP_SPEED_1G)
  434. v |= SUPPORTED_1000baseT_Full;
  435. if (caps & FW_PORT_CAP_SPEED_10G)
  436. v |= SUPPORTED_10000baseT_Full;
  437. } else if (type == FW_PORT_TYPE_KX4 || type == FW_PORT_TYPE_KX) {
  438. v |= SUPPORTED_Backplane;
  439. if (caps & FW_PORT_CAP_SPEED_1G)
  440. v |= SUPPORTED_1000baseKX_Full;
  441. if (caps & FW_PORT_CAP_SPEED_10G)
  442. v |= SUPPORTED_10000baseKX4_Full;
  443. } else if (type == FW_PORT_TYPE_KR) {
  444. v |= SUPPORTED_Backplane | SUPPORTED_10000baseKR_Full;
  445. } else if (type == FW_PORT_TYPE_BP_AP) {
  446. v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC |
  447. SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full;
  448. } else if (type == FW_PORT_TYPE_BP4_AP) {
  449. v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC |
  450. SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full |
  451. SUPPORTED_10000baseKX4_Full;
  452. } else if (type == FW_PORT_TYPE_FIBER_XFI ||
  453. type == FW_PORT_TYPE_FIBER_XAUI ||
  454. type == FW_PORT_TYPE_SFP ||
  455. type == FW_PORT_TYPE_QSFP_10G ||
  456. type == FW_PORT_TYPE_QSA) {
  457. v |= SUPPORTED_FIBRE;
  458. if (caps & FW_PORT_CAP_SPEED_1G)
  459. v |= SUPPORTED_1000baseT_Full;
  460. if (caps & FW_PORT_CAP_SPEED_10G)
  461. v |= SUPPORTED_10000baseT_Full;
  462. } else if (type == FW_PORT_TYPE_BP40_BA ||
  463. type == FW_PORT_TYPE_QSFP) {
  464. v |= SUPPORTED_40000baseSR4_Full;
  465. v |= SUPPORTED_FIBRE;
  466. }
  467. if (caps & FW_PORT_CAP_ANEG)
  468. v |= SUPPORTED_Autoneg;
  469. return v;
  470. }
  471. static unsigned int to_fw_linkcaps(unsigned int caps)
  472. {
  473. unsigned int v = 0;
  474. if (caps & ADVERTISED_100baseT_Full)
  475. v |= FW_PORT_CAP_SPEED_100M;
  476. if (caps & ADVERTISED_1000baseT_Full)
  477. v |= FW_PORT_CAP_SPEED_1G;
  478. if (caps & ADVERTISED_10000baseT_Full)
  479. v |= FW_PORT_CAP_SPEED_10G;
  480. if (caps & ADVERTISED_40000baseSR4_Full)
  481. v |= FW_PORT_CAP_SPEED_40G;
  482. return v;
  483. }
  484. static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
  485. {
  486. const struct port_info *p = netdev_priv(dev);
  487. if (p->port_type == FW_PORT_TYPE_BT_SGMII ||
  488. p->port_type == FW_PORT_TYPE_BT_XFI ||
  489. p->port_type == FW_PORT_TYPE_BT_XAUI) {
  490. cmd->port = PORT_TP;
  491. } else if (p->port_type == FW_PORT_TYPE_FIBER_XFI ||
  492. p->port_type == FW_PORT_TYPE_FIBER_XAUI) {
  493. cmd->port = PORT_FIBRE;
  494. } else if (p->port_type == FW_PORT_TYPE_SFP ||
  495. p->port_type == FW_PORT_TYPE_QSFP_10G ||
  496. p->port_type == FW_PORT_TYPE_QSA ||
  497. p->port_type == FW_PORT_TYPE_QSFP) {
  498. if (p->mod_type == FW_PORT_MOD_TYPE_LR ||
  499. p->mod_type == FW_PORT_MOD_TYPE_SR ||
  500. p->mod_type == FW_PORT_MOD_TYPE_ER ||
  501. p->mod_type == FW_PORT_MOD_TYPE_LRM)
  502. cmd->port = PORT_FIBRE;
  503. else if (p->mod_type == FW_PORT_MOD_TYPE_TWINAX_PASSIVE ||
  504. p->mod_type == FW_PORT_MOD_TYPE_TWINAX_ACTIVE)
  505. cmd->port = PORT_DA;
  506. else
  507. cmd->port = PORT_OTHER;
  508. } else {
  509. cmd->port = PORT_OTHER;
  510. }
  511. if (p->mdio_addr >= 0) {
  512. cmd->phy_address = p->mdio_addr;
  513. cmd->transceiver = XCVR_EXTERNAL;
  514. cmd->mdio_support = p->port_type == FW_PORT_TYPE_BT_SGMII ?
  515. MDIO_SUPPORTS_C22 : MDIO_SUPPORTS_C45;
  516. } else {
  517. cmd->phy_address = 0; /* not really, but no better option */
  518. cmd->transceiver = XCVR_INTERNAL;
  519. cmd->mdio_support = 0;
  520. }
  521. cmd->supported = from_fw_linkcaps(p->port_type, p->link_cfg.supported);
  522. cmd->advertising = from_fw_linkcaps(p->port_type,
  523. p->link_cfg.advertising);
  524. ethtool_cmd_speed_set(cmd,
  525. netif_carrier_ok(dev) ? p->link_cfg.speed : 0);
  526. cmd->duplex = DUPLEX_FULL;
  527. cmd->autoneg = p->link_cfg.autoneg;
  528. cmd->maxtxpkt = 0;
  529. cmd->maxrxpkt = 0;
  530. return 0;
  531. }
  532. static unsigned int speed_to_caps(int speed)
  533. {
  534. if (speed == 100)
  535. return FW_PORT_CAP_SPEED_100M;
  536. if (speed == 1000)
  537. return FW_PORT_CAP_SPEED_1G;
  538. if (speed == 10000)
  539. return FW_PORT_CAP_SPEED_10G;
  540. if (speed == 40000)
  541. return FW_PORT_CAP_SPEED_40G;
  542. return 0;
  543. }
  544. static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
  545. {
  546. unsigned int cap;
  547. struct port_info *p = netdev_priv(dev);
  548. struct link_config *lc = &p->link_cfg;
  549. u32 speed = ethtool_cmd_speed(cmd);
  550. struct link_config old_lc;
  551. int ret;
  552. if (cmd->duplex != DUPLEX_FULL) /* only full-duplex supported */
  553. return -EINVAL;
  554. if (!(lc->supported & FW_PORT_CAP_ANEG)) {
  555. /* PHY offers a single speed. See if that's what's
  556. * being requested.
  557. */
  558. if (cmd->autoneg == AUTONEG_DISABLE &&
  559. (lc->supported & speed_to_caps(speed)))
  560. return 0;
  561. return -EINVAL;
  562. }
  563. old_lc = *lc;
  564. if (cmd->autoneg == AUTONEG_DISABLE) {
  565. cap = speed_to_caps(speed);
  566. if (!(lc->supported & cap))
  567. return -EINVAL;
  568. lc->requested_speed = cap;
  569. lc->advertising = 0;
  570. } else {
  571. cap = to_fw_linkcaps(cmd->advertising);
  572. if (!(lc->supported & cap))
  573. return -EINVAL;
  574. lc->requested_speed = 0;
  575. lc->advertising = cap | FW_PORT_CAP_ANEG;
  576. }
  577. lc->autoneg = cmd->autoneg;
  578. /* If the firmware rejects the Link Configuration request, back out
  579. * the changes and report the error.
  580. */
  581. ret = t4_link_l1cfg(p->adapter, p->adapter->mbox, p->tx_chan, lc);
  582. if (ret)
  583. *lc = old_lc;
  584. return ret;
  585. }
  586. static void get_pauseparam(struct net_device *dev,
  587. struct ethtool_pauseparam *epause)
  588. {
  589. struct port_info *p = netdev_priv(dev);
  590. epause->autoneg = (p->link_cfg.requested_fc & PAUSE_AUTONEG) != 0;
  591. epause->rx_pause = (p->link_cfg.fc & PAUSE_RX) != 0;
  592. epause->tx_pause = (p->link_cfg.fc & PAUSE_TX) != 0;
  593. }
  594. static int set_pauseparam(struct net_device *dev,
  595. struct ethtool_pauseparam *epause)
  596. {
  597. struct port_info *p = netdev_priv(dev);
  598. struct link_config *lc = &p->link_cfg;
  599. if (epause->autoneg == AUTONEG_DISABLE)
  600. lc->requested_fc = 0;
  601. else if (lc->supported & FW_PORT_CAP_ANEG)
  602. lc->requested_fc = PAUSE_AUTONEG;
  603. else
  604. return -EINVAL;
  605. if (epause->rx_pause)
  606. lc->requested_fc |= PAUSE_RX;
  607. if (epause->tx_pause)
  608. lc->requested_fc |= PAUSE_TX;
  609. if (netif_running(dev))
  610. return t4_link_l1cfg(p->adapter, p->adapter->pf, p->tx_chan,
  611. lc);
  612. return 0;
  613. }
  614. static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
  615. {
  616. const struct port_info *pi = netdev_priv(dev);
  617. const struct sge *s = &pi->adapter->sge;
  618. e->rx_max_pending = MAX_RX_BUFFERS;
  619. e->rx_mini_max_pending = MAX_RSPQ_ENTRIES;
  620. e->rx_jumbo_max_pending = 0;
  621. e->tx_max_pending = MAX_TXQ_ENTRIES;
  622. e->rx_pending = s->ethrxq[pi->first_qset].fl.size - 8;
  623. e->rx_mini_pending = s->ethrxq[pi->first_qset].rspq.size;
  624. e->rx_jumbo_pending = 0;
  625. e->tx_pending = s->ethtxq[pi->first_qset].q.size;
  626. }
  627. static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
  628. {
  629. int i;
  630. const struct port_info *pi = netdev_priv(dev);
  631. struct adapter *adapter = pi->adapter;
  632. struct sge *s = &adapter->sge;
  633. if (e->rx_pending > MAX_RX_BUFFERS || e->rx_jumbo_pending ||
  634. e->tx_pending > MAX_TXQ_ENTRIES ||
  635. e->rx_mini_pending > MAX_RSPQ_ENTRIES ||
  636. e->rx_mini_pending < MIN_RSPQ_ENTRIES ||
  637. e->rx_pending < MIN_FL_ENTRIES || e->tx_pending < MIN_TXQ_ENTRIES)
  638. return -EINVAL;
  639. if (adapter->flags & FULL_INIT_DONE)
  640. return -EBUSY;
  641. for (i = 0; i < pi->nqsets; ++i) {
  642. s->ethtxq[pi->first_qset + i].q.size = e->tx_pending;
  643. s->ethrxq[pi->first_qset + i].fl.size = e->rx_pending + 8;
  644. s->ethrxq[pi->first_qset + i].rspq.size = e->rx_mini_pending;
  645. }
  646. return 0;
  647. }
  648. /**
  649. * set_rx_intr_params - set a net devices's RX interrupt holdoff paramete!
  650. * @dev: the network device
  651. * @us: the hold-off time in us, or 0 to disable timer
  652. * @cnt: the hold-off packet count, or 0 to disable counter
  653. *
  654. * Set the RX interrupt hold-off parameters for a network device.
  655. */
  656. static int set_rx_intr_params(struct net_device *dev,
  657. unsigned int us, unsigned int cnt)
  658. {
  659. int i, err;
  660. struct port_info *pi = netdev_priv(dev);
  661. struct adapter *adap = pi->adapter;
  662. struct sge_eth_rxq *q = &adap->sge.ethrxq[pi->first_qset];
  663. for (i = 0; i < pi->nqsets; i++, q++) {
  664. err = cxgb4_set_rspq_intr_params(&q->rspq, us, cnt);
  665. if (err)
  666. return err;
  667. }
  668. return 0;
  669. }
  670. static int set_adaptive_rx_setting(struct net_device *dev, int adaptive_rx)
  671. {
  672. int i;
  673. struct port_info *pi = netdev_priv(dev);
  674. struct adapter *adap = pi->adapter;
  675. struct sge_eth_rxq *q = &adap->sge.ethrxq[pi->first_qset];
  676. for (i = 0; i < pi->nqsets; i++, q++)
  677. q->rspq.adaptive_rx = adaptive_rx;
  678. return 0;
  679. }
  680. static int get_adaptive_rx_setting(struct net_device *dev)
  681. {
  682. struct port_info *pi = netdev_priv(dev);
  683. struct adapter *adap = pi->adapter;
  684. struct sge_eth_rxq *q = &adap->sge.ethrxq[pi->first_qset];
  685. return q->rspq.adaptive_rx;
  686. }
  687. static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
  688. {
  689. set_adaptive_rx_setting(dev, c->use_adaptive_rx_coalesce);
  690. return set_rx_intr_params(dev, c->rx_coalesce_usecs,
  691. c->rx_max_coalesced_frames);
  692. }
  693. static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
  694. {
  695. const struct port_info *pi = netdev_priv(dev);
  696. const struct adapter *adap = pi->adapter;
  697. const struct sge_rspq *rq = &adap->sge.ethrxq[pi->first_qset].rspq;
  698. c->rx_coalesce_usecs = qtimer_val(adap, rq);
  699. c->rx_max_coalesced_frames = (rq->intr_params & QINTR_CNT_EN_F) ?
  700. adap->sge.counter_val[rq->pktcnt_idx] : 0;
  701. c->use_adaptive_rx_coalesce = get_adaptive_rx_setting(dev);
  702. return 0;
  703. }
  704. /**
  705. * eeprom_ptov - translate a physical EEPROM address to virtual
  706. * @phys_addr: the physical EEPROM address
  707. * @fn: the PCI function number
  708. * @sz: size of function-specific area
  709. *
  710. * Translate a physical EEPROM address to virtual. The first 1K is
  711. * accessed through virtual addresses starting at 31K, the rest is
  712. * accessed through virtual addresses starting at 0.
  713. *
  714. * The mapping is as follows:
  715. * [0..1K) -> [31K..32K)
  716. * [1K..1K+A) -> [31K-A..31K)
  717. * [1K+A..ES) -> [0..ES-A-1K)
  718. *
  719. * where A = @fn * @sz, and ES = EEPROM size.
  720. */
  721. static int eeprom_ptov(unsigned int phys_addr, unsigned int fn, unsigned int sz)
  722. {
  723. fn *= sz;
  724. if (phys_addr < 1024)
  725. return phys_addr + (31 << 10);
  726. if (phys_addr < 1024 + fn)
  727. return 31744 - fn + phys_addr - 1024;
  728. if (phys_addr < EEPROMSIZE)
  729. return phys_addr - 1024 - fn;
  730. return -EINVAL;
  731. }
  732. /* The next two routines implement eeprom read/write from physical addresses.
  733. */
  734. static int eeprom_rd_phys(struct adapter *adap, unsigned int phys_addr, u32 *v)
  735. {
  736. int vaddr = eeprom_ptov(phys_addr, adap->pf, EEPROMPFSIZE);
  737. if (vaddr >= 0)
  738. vaddr = pci_read_vpd(adap->pdev, vaddr, sizeof(u32), v);
  739. return vaddr < 0 ? vaddr : 0;
  740. }
  741. static int eeprom_wr_phys(struct adapter *adap, unsigned int phys_addr, u32 v)
  742. {
  743. int vaddr = eeprom_ptov(phys_addr, adap->pf, EEPROMPFSIZE);
  744. if (vaddr >= 0)
  745. vaddr = pci_write_vpd(adap->pdev, vaddr, sizeof(u32), &v);
  746. return vaddr < 0 ? vaddr : 0;
  747. }
  748. #define EEPROM_MAGIC 0x38E2F10C
  749. static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e,
  750. u8 *data)
  751. {
  752. int i, err = 0;
  753. struct adapter *adapter = netdev2adap(dev);
  754. u8 *buf = t4_alloc_mem(EEPROMSIZE);
  755. if (!buf)
  756. return -ENOMEM;
  757. e->magic = EEPROM_MAGIC;
  758. for (i = e->offset & ~3; !err && i < e->offset + e->len; i += 4)
  759. err = eeprom_rd_phys(adapter, i, (u32 *)&buf[i]);
  760. if (!err)
  761. memcpy(data, buf + e->offset, e->len);
  762. t4_free_mem(buf);
  763. return err;
  764. }
  765. static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
  766. u8 *data)
  767. {
  768. u8 *buf;
  769. int err = 0;
  770. u32 aligned_offset, aligned_len, *p;
  771. struct adapter *adapter = netdev2adap(dev);
  772. if (eeprom->magic != EEPROM_MAGIC)
  773. return -EINVAL;
  774. aligned_offset = eeprom->offset & ~3;
  775. aligned_len = (eeprom->len + (eeprom->offset & 3) + 3) & ~3;
  776. if (adapter->pf > 0) {
  777. u32 start = 1024 + adapter->pf * EEPROMPFSIZE;
  778. if (aligned_offset < start ||
  779. aligned_offset + aligned_len > start + EEPROMPFSIZE)
  780. return -EPERM;
  781. }
  782. if (aligned_offset != eeprom->offset || aligned_len != eeprom->len) {
  783. /* RMW possibly needed for first or last words.
  784. */
  785. buf = t4_alloc_mem(aligned_len);
  786. if (!buf)
  787. return -ENOMEM;
  788. err = eeprom_rd_phys(adapter, aligned_offset, (u32 *)buf);
  789. if (!err && aligned_len > 4)
  790. err = eeprom_rd_phys(adapter,
  791. aligned_offset + aligned_len - 4,
  792. (u32 *)&buf[aligned_len - 4]);
  793. if (err)
  794. goto out;
  795. memcpy(buf + (eeprom->offset & 3), data, eeprom->len);
  796. } else {
  797. buf = data;
  798. }
  799. err = t4_seeprom_wp(adapter, false);
  800. if (err)
  801. goto out;
  802. for (p = (u32 *)buf; !err && aligned_len; aligned_len -= 4, p++) {
  803. err = eeprom_wr_phys(adapter, aligned_offset, *p);
  804. aligned_offset += 4;
  805. }
  806. if (!err)
  807. err = t4_seeprom_wp(adapter, true);
  808. out:
  809. if (buf != data)
  810. t4_free_mem(buf);
  811. return err;
  812. }
  813. static int set_flash(struct net_device *netdev, struct ethtool_flash *ef)
  814. {
  815. int ret;
  816. const struct firmware *fw;
  817. struct adapter *adap = netdev2adap(netdev);
  818. unsigned int mbox = PCIE_FW_MASTER_M + 1;
  819. u32 pcie_fw;
  820. unsigned int master;
  821. u8 master_vld = 0;
  822. pcie_fw = t4_read_reg(adap, PCIE_FW_A);
  823. master = PCIE_FW_MASTER_G(pcie_fw);
  824. if (pcie_fw & PCIE_FW_MASTER_VLD_F)
  825. master_vld = 1;
  826. /* if csiostor is the master return */
  827. if (master_vld && (master != adap->pf)) {
  828. dev_warn(adap->pdev_dev,
  829. "cxgb4 driver needs to be loaded as MASTER to support FW flash\n");
  830. return -EOPNOTSUPP;
  831. }
  832. ef->data[sizeof(ef->data) - 1] = '\0';
  833. ret = request_firmware(&fw, ef->data, adap->pdev_dev);
  834. if (ret < 0)
  835. return ret;
  836. /* If the adapter has been fully initialized then we'll go ahead and
  837. * try to get the firmware's cooperation in upgrading to the new
  838. * firmware image otherwise we'll try to do the entire job from the
  839. * host ... and we always "force" the operation in this path.
  840. */
  841. if (adap->flags & FULL_INIT_DONE)
  842. mbox = adap->mbox;
  843. ret = t4_fw_upgrade(adap, mbox, fw->data, fw->size, 1);
  844. release_firmware(fw);
  845. if (!ret)
  846. dev_info(adap->pdev_dev,
  847. "loaded firmware %s, reload cxgb4 driver\n", ef->data);
  848. return ret;
  849. }
  850. static int get_ts_info(struct net_device *dev, struct ethtool_ts_info *ts_info)
  851. {
  852. ts_info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
  853. SOF_TIMESTAMPING_RX_SOFTWARE |
  854. SOF_TIMESTAMPING_SOFTWARE;
  855. ts_info->so_timestamping |= SOF_TIMESTAMPING_RX_HARDWARE |
  856. SOF_TIMESTAMPING_RAW_HARDWARE;
  857. ts_info->phc_index = -1;
  858. return 0;
  859. }
  860. static u32 get_rss_table_size(struct net_device *dev)
  861. {
  862. const struct port_info *pi = netdev_priv(dev);
  863. return pi->rss_size;
  864. }
  865. static int get_rss_table(struct net_device *dev, u32 *p, u8 *key, u8 *hfunc)
  866. {
  867. const struct port_info *pi = netdev_priv(dev);
  868. unsigned int n = pi->rss_size;
  869. if (hfunc)
  870. *hfunc = ETH_RSS_HASH_TOP;
  871. if (!p)
  872. return 0;
  873. while (n--)
  874. p[n] = pi->rss[n];
  875. return 0;
  876. }
  877. static int set_rss_table(struct net_device *dev, const u32 *p, const u8 *key,
  878. const u8 hfunc)
  879. {
  880. unsigned int i;
  881. struct port_info *pi = netdev_priv(dev);
  882. /* We require at least one supported parameter to be changed and no
  883. * change in any of the unsupported parameters
  884. */
  885. if (key ||
  886. (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
  887. return -EOPNOTSUPP;
  888. if (!p)
  889. return 0;
  890. /* Interface must be brought up atleast once */
  891. if (pi->adapter->flags & FULL_INIT_DONE) {
  892. for (i = 0; i < pi->rss_size; i++)
  893. pi->rss[i] = p[i];
  894. return cxgb4_write_rss(pi, pi->rss);
  895. }
  896. return -EPERM;
  897. }
  898. static int get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
  899. u32 *rules)
  900. {
  901. const struct port_info *pi = netdev_priv(dev);
  902. switch (info->cmd) {
  903. case ETHTOOL_GRXFH: {
  904. unsigned int v = pi->rss_mode;
  905. info->data = 0;
  906. switch (info->flow_type) {
  907. case TCP_V4_FLOW:
  908. if (v & FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F)
  909. info->data = RXH_IP_SRC | RXH_IP_DST |
  910. RXH_L4_B_0_1 | RXH_L4_B_2_3;
  911. else if (v & FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F)
  912. info->data = RXH_IP_SRC | RXH_IP_DST;
  913. break;
  914. case UDP_V4_FLOW:
  915. if ((v & FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F) &&
  916. (v & FW_RSS_VI_CONFIG_CMD_UDPEN_F))
  917. info->data = RXH_IP_SRC | RXH_IP_DST |
  918. RXH_L4_B_0_1 | RXH_L4_B_2_3;
  919. else if (v & FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F)
  920. info->data = RXH_IP_SRC | RXH_IP_DST;
  921. break;
  922. case SCTP_V4_FLOW:
  923. case AH_ESP_V4_FLOW:
  924. case IPV4_FLOW:
  925. if (v & FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F)
  926. info->data = RXH_IP_SRC | RXH_IP_DST;
  927. break;
  928. case TCP_V6_FLOW:
  929. if (v & FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F)
  930. info->data = RXH_IP_SRC | RXH_IP_DST |
  931. RXH_L4_B_0_1 | RXH_L4_B_2_3;
  932. else if (v & FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F)
  933. info->data = RXH_IP_SRC | RXH_IP_DST;
  934. break;
  935. case UDP_V6_FLOW:
  936. if ((v & FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F) &&
  937. (v & FW_RSS_VI_CONFIG_CMD_UDPEN_F))
  938. info->data = RXH_IP_SRC | RXH_IP_DST |
  939. RXH_L4_B_0_1 | RXH_L4_B_2_3;
  940. else if (v & FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F)
  941. info->data = RXH_IP_SRC | RXH_IP_DST;
  942. break;
  943. case SCTP_V6_FLOW:
  944. case AH_ESP_V6_FLOW:
  945. case IPV6_FLOW:
  946. if (v & FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F)
  947. info->data = RXH_IP_SRC | RXH_IP_DST;
  948. break;
  949. }
  950. return 0;
  951. }
  952. case ETHTOOL_GRXRINGS:
  953. info->data = pi->nqsets;
  954. return 0;
  955. }
  956. return -EOPNOTSUPP;
  957. }
  958. static const struct ethtool_ops cxgb_ethtool_ops = {
  959. .get_settings = get_settings,
  960. .set_settings = set_settings,
  961. .get_drvinfo = get_drvinfo,
  962. .get_msglevel = get_msglevel,
  963. .set_msglevel = set_msglevel,
  964. .get_ringparam = get_sge_param,
  965. .set_ringparam = set_sge_param,
  966. .get_coalesce = get_coalesce,
  967. .set_coalesce = set_coalesce,
  968. .get_eeprom_len = get_eeprom_len,
  969. .get_eeprom = get_eeprom,
  970. .set_eeprom = set_eeprom,
  971. .get_pauseparam = get_pauseparam,
  972. .set_pauseparam = set_pauseparam,
  973. .get_link = ethtool_op_get_link,
  974. .get_strings = get_strings,
  975. .set_phys_id = identify_port,
  976. .nway_reset = restart_autoneg,
  977. .get_sset_count = get_sset_count,
  978. .get_ethtool_stats = get_stats,
  979. .get_regs_len = get_regs_len,
  980. .get_regs = get_regs,
  981. .get_rxnfc = get_rxnfc,
  982. .get_rxfh_indir_size = get_rss_table_size,
  983. .get_rxfh = get_rss_table,
  984. .set_rxfh = set_rss_table,
  985. .flash_device = set_flash,
  986. .get_ts_info = get_ts_info
  987. };
  988. void cxgb4_set_ethtool_ops(struct net_device *netdev)
  989. {
  990. netdev->ethtool_ops = &cxgb_ethtool_ops;
  991. }