en_ethtool.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. /*
  2. * Copyright (c) 2007 Mellanox Technologies. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. *
  32. */
  33. #include <linux/kernel.h>
  34. #include <linux/ethtool.h>
  35. #include <linux/netdevice.h>
  36. #include <linux/mlx4/driver.h>
  37. #include "mlx4_en.h"
  38. #include "en_port.h"
  39. #define EN_ETHTOOL_QP_ATTACH (1ull << 63)
  40. #define EN_ETHTOOL_SHORT_MASK cpu_to_be16(0xffff)
  41. #define EN_ETHTOOL_WORD_MASK cpu_to_be32(0xffffffff)
  42. static int mlx4_en_moderation_update(struct mlx4_en_priv *priv)
  43. {
  44. int i;
  45. int err = 0;
  46. for (i = 0; i < priv->tx_ring_num; i++) {
  47. priv->tx_cq[i].moder_cnt = priv->tx_frames;
  48. priv->tx_cq[i].moder_time = priv->tx_usecs;
  49. err = mlx4_en_set_cq_moder(priv, &priv->tx_cq[i]);
  50. if (err)
  51. return err;
  52. }
  53. if (priv->adaptive_rx_coal)
  54. return 0;
  55. for (i = 0; i < priv->rx_ring_num; i++) {
  56. priv->rx_cq[i].moder_cnt = priv->rx_frames;
  57. priv->rx_cq[i].moder_time = priv->rx_usecs;
  58. priv->last_moder_time[i] = MLX4_EN_AUTO_CONF;
  59. err = mlx4_en_set_cq_moder(priv, &priv->rx_cq[i]);
  60. if (err)
  61. return err;
  62. }
  63. return err;
  64. }
  65. static void
  66. mlx4_en_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
  67. {
  68. struct mlx4_en_priv *priv = netdev_priv(dev);
  69. struct mlx4_en_dev *mdev = priv->mdev;
  70. strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
  71. strlcpy(drvinfo->version, DRV_VERSION " (" DRV_RELDATE ")",
  72. sizeof(drvinfo->version));
  73. snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
  74. "%d.%d.%d",
  75. (u16) (mdev->dev->caps.fw_ver >> 32),
  76. (u16) ((mdev->dev->caps.fw_ver >> 16) & 0xffff),
  77. (u16) (mdev->dev->caps.fw_ver & 0xffff));
  78. strlcpy(drvinfo->bus_info, pci_name(mdev->dev->pdev),
  79. sizeof(drvinfo->bus_info));
  80. drvinfo->n_stats = 0;
  81. drvinfo->regdump_len = 0;
  82. drvinfo->eedump_len = 0;
  83. }
  84. static const char main_strings[][ETH_GSTRING_LEN] = {
  85. "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors",
  86. "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions",
  87. "rx_length_errors", "rx_over_errors", "rx_crc_errors",
  88. "rx_frame_errors", "rx_fifo_errors", "rx_missed_errors",
  89. "tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors",
  90. "tx_heartbeat_errors", "tx_window_errors",
  91. /* port statistics */
  92. "tso_packets",
  93. "queue_stopped", "wake_queue", "tx_timeout", "rx_alloc_failed",
  94. "rx_csum_good", "rx_csum_none", "tx_chksum_offload",
  95. /* packet statistics */
  96. "broadcast", "rx_prio_0", "rx_prio_1", "rx_prio_2", "rx_prio_3",
  97. "rx_prio_4", "rx_prio_5", "rx_prio_6", "rx_prio_7", "tx_prio_0",
  98. "tx_prio_1", "tx_prio_2", "tx_prio_3", "tx_prio_4", "tx_prio_5",
  99. "tx_prio_6", "tx_prio_7",
  100. };
  101. #define NUM_MAIN_STATS 21
  102. #define NUM_ALL_STATS (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + NUM_PERF_STATS)
  103. static const char mlx4_en_test_names[][ETH_GSTRING_LEN]= {
  104. "Interrupt Test",
  105. "Link Test",
  106. "Speed Test",
  107. "Register Test",
  108. "Loopback Test",
  109. };
  110. static u32 mlx4_en_get_msglevel(struct net_device *dev)
  111. {
  112. return ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable;
  113. }
  114. static void mlx4_en_set_msglevel(struct net_device *dev, u32 val)
  115. {
  116. ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable = val;
  117. }
  118. static void mlx4_en_get_wol(struct net_device *netdev,
  119. struct ethtool_wolinfo *wol)
  120. {
  121. struct mlx4_en_priv *priv = netdev_priv(netdev);
  122. int err = 0;
  123. u64 config = 0;
  124. u64 mask;
  125. if ((priv->port < 1) || (priv->port > 2)) {
  126. en_err(priv, "Failed to get WoL information\n");
  127. return;
  128. }
  129. mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 :
  130. MLX4_DEV_CAP_FLAG_WOL_PORT2;
  131. if (!(priv->mdev->dev->caps.flags & mask)) {
  132. wol->supported = 0;
  133. wol->wolopts = 0;
  134. return;
  135. }
  136. err = mlx4_wol_read(priv->mdev->dev, &config, priv->port);
  137. if (err) {
  138. en_err(priv, "Failed to get WoL information\n");
  139. return;
  140. }
  141. if (config & MLX4_EN_WOL_MAGIC)
  142. wol->supported = WAKE_MAGIC;
  143. else
  144. wol->supported = 0;
  145. if (config & MLX4_EN_WOL_ENABLED)
  146. wol->wolopts = WAKE_MAGIC;
  147. else
  148. wol->wolopts = 0;
  149. }
  150. static int mlx4_en_set_wol(struct net_device *netdev,
  151. struct ethtool_wolinfo *wol)
  152. {
  153. struct mlx4_en_priv *priv = netdev_priv(netdev);
  154. u64 config = 0;
  155. int err = 0;
  156. u64 mask;
  157. if ((priv->port < 1) || (priv->port > 2))
  158. return -EOPNOTSUPP;
  159. mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 :
  160. MLX4_DEV_CAP_FLAG_WOL_PORT2;
  161. if (!(priv->mdev->dev->caps.flags & mask))
  162. return -EOPNOTSUPP;
  163. if (wol->supported & ~WAKE_MAGIC)
  164. return -EINVAL;
  165. err = mlx4_wol_read(priv->mdev->dev, &config, priv->port);
  166. if (err) {
  167. en_err(priv, "Failed to get WoL info, unable to modify\n");
  168. return err;
  169. }
  170. if (wol->wolopts & WAKE_MAGIC) {
  171. config |= MLX4_EN_WOL_DO_MODIFY | MLX4_EN_WOL_ENABLED |
  172. MLX4_EN_WOL_MAGIC;
  173. } else {
  174. config &= ~(MLX4_EN_WOL_ENABLED | MLX4_EN_WOL_MAGIC);
  175. config |= MLX4_EN_WOL_DO_MODIFY;
  176. }
  177. err = mlx4_wol_write(priv->mdev->dev, config, priv->port);
  178. if (err)
  179. en_err(priv, "Failed to set WoL information\n");
  180. return err;
  181. }
  182. static int mlx4_en_get_sset_count(struct net_device *dev, int sset)
  183. {
  184. struct mlx4_en_priv *priv = netdev_priv(dev);
  185. int bit_count = hweight64(priv->stats_bitmap);
  186. switch (sset) {
  187. case ETH_SS_STATS:
  188. return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) +
  189. (priv->tx_ring_num + priv->rx_ring_num) * 2;
  190. case ETH_SS_TEST:
  191. return MLX4_EN_NUM_SELF_TEST - !(priv->mdev->dev->caps.flags
  192. & MLX4_DEV_CAP_FLAG_UC_LOOPBACK) * 2;
  193. default:
  194. return -EOPNOTSUPP;
  195. }
  196. }
  197. static void mlx4_en_get_ethtool_stats(struct net_device *dev,
  198. struct ethtool_stats *stats, uint64_t *data)
  199. {
  200. struct mlx4_en_priv *priv = netdev_priv(dev);
  201. int index = 0;
  202. int i, j = 0;
  203. spin_lock_bh(&priv->stats_lock);
  204. if (!(priv->stats_bitmap)) {
  205. for (i = 0; i < NUM_MAIN_STATS; i++)
  206. data[index++] =
  207. ((unsigned long *) &priv->stats)[i];
  208. for (i = 0; i < NUM_PORT_STATS; i++)
  209. data[index++] =
  210. ((unsigned long *) &priv->port_stats)[i];
  211. for (i = 0; i < NUM_PKT_STATS; i++)
  212. data[index++] =
  213. ((unsigned long *) &priv->pkstats)[i];
  214. } else {
  215. for (i = 0; i < NUM_MAIN_STATS; i++) {
  216. if ((priv->stats_bitmap >> j) & 1)
  217. data[index++] =
  218. ((unsigned long *) &priv->stats)[i];
  219. j++;
  220. }
  221. for (i = 0; i < NUM_PORT_STATS; i++) {
  222. if ((priv->stats_bitmap >> j) & 1)
  223. data[index++] =
  224. ((unsigned long *) &priv->port_stats)[i];
  225. j++;
  226. }
  227. }
  228. for (i = 0; i < priv->tx_ring_num; i++) {
  229. data[index++] = priv->tx_ring[i].packets;
  230. data[index++] = priv->tx_ring[i].bytes;
  231. }
  232. for (i = 0; i < priv->rx_ring_num; i++) {
  233. data[index++] = priv->rx_ring[i].packets;
  234. data[index++] = priv->rx_ring[i].bytes;
  235. }
  236. spin_unlock_bh(&priv->stats_lock);
  237. }
  238. static void mlx4_en_self_test(struct net_device *dev,
  239. struct ethtool_test *etest, u64 *buf)
  240. {
  241. mlx4_en_ex_selftest(dev, &etest->flags, buf);
  242. }
  243. static void mlx4_en_get_strings(struct net_device *dev,
  244. uint32_t stringset, uint8_t *data)
  245. {
  246. struct mlx4_en_priv *priv = netdev_priv(dev);
  247. int index = 0;
  248. int i;
  249. switch (stringset) {
  250. case ETH_SS_TEST:
  251. for (i = 0; i < MLX4_EN_NUM_SELF_TEST - 2; i++)
  252. strcpy(data + i * ETH_GSTRING_LEN, mlx4_en_test_names[i]);
  253. if (priv->mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UC_LOOPBACK)
  254. for (; i < MLX4_EN_NUM_SELF_TEST; i++)
  255. strcpy(data + i * ETH_GSTRING_LEN, mlx4_en_test_names[i]);
  256. break;
  257. case ETH_SS_STATS:
  258. /* Add main counters */
  259. if (!priv->stats_bitmap) {
  260. for (i = 0; i < NUM_MAIN_STATS; i++)
  261. strcpy(data + (index++) * ETH_GSTRING_LEN,
  262. main_strings[i]);
  263. for (i = 0; i < NUM_PORT_STATS; i++)
  264. strcpy(data + (index++) * ETH_GSTRING_LEN,
  265. main_strings[i +
  266. NUM_MAIN_STATS]);
  267. for (i = 0; i < NUM_PKT_STATS; i++)
  268. strcpy(data + (index++) * ETH_GSTRING_LEN,
  269. main_strings[i +
  270. NUM_MAIN_STATS +
  271. NUM_PORT_STATS]);
  272. } else
  273. for (i = 0; i < NUM_MAIN_STATS + NUM_PORT_STATS; i++) {
  274. if ((priv->stats_bitmap >> i) & 1) {
  275. strcpy(data +
  276. (index++) * ETH_GSTRING_LEN,
  277. main_strings[i]);
  278. }
  279. if (!(priv->stats_bitmap >> i))
  280. break;
  281. }
  282. for (i = 0; i < priv->tx_ring_num; i++) {
  283. sprintf(data + (index++) * ETH_GSTRING_LEN,
  284. "tx%d_packets", i);
  285. sprintf(data + (index++) * ETH_GSTRING_LEN,
  286. "tx%d_bytes", i);
  287. }
  288. for (i = 0; i < priv->rx_ring_num; i++) {
  289. sprintf(data + (index++) * ETH_GSTRING_LEN,
  290. "rx%d_packets", i);
  291. sprintf(data + (index++) * ETH_GSTRING_LEN,
  292. "rx%d_bytes", i);
  293. }
  294. break;
  295. }
  296. }
  297. static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
  298. {
  299. struct mlx4_en_priv *priv = netdev_priv(dev);
  300. int trans_type;
  301. cmd->autoneg = AUTONEG_DISABLE;
  302. cmd->supported = SUPPORTED_10000baseT_Full;
  303. cmd->advertising = ADVERTISED_10000baseT_Full;
  304. if (mlx4_en_QUERY_PORT(priv->mdev, priv->port))
  305. return -ENOMEM;
  306. trans_type = priv->port_state.transciver;
  307. if (netif_carrier_ok(dev)) {
  308. ethtool_cmd_speed_set(cmd, priv->port_state.link_speed);
  309. cmd->duplex = DUPLEX_FULL;
  310. } else {
  311. ethtool_cmd_speed_set(cmd, -1);
  312. cmd->duplex = -1;
  313. }
  314. if (trans_type > 0 && trans_type <= 0xC) {
  315. cmd->port = PORT_FIBRE;
  316. cmd->transceiver = XCVR_EXTERNAL;
  317. cmd->supported |= SUPPORTED_FIBRE;
  318. cmd->advertising |= ADVERTISED_FIBRE;
  319. } else if (trans_type == 0x80 || trans_type == 0) {
  320. cmd->port = PORT_TP;
  321. cmd->transceiver = XCVR_INTERNAL;
  322. cmd->supported |= SUPPORTED_TP;
  323. cmd->advertising |= ADVERTISED_TP;
  324. } else {
  325. cmd->port = -1;
  326. cmd->transceiver = -1;
  327. }
  328. return 0;
  329. }
  330. static int mlx4_en_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
  331. {
  332. if ((cmd->autoneg == AUTONEG_ENABLE) ||
  333. (ethtool_cmd_speed(cmd) != SPEED_10000) ||
  334. (cmd->duplex != DUPLEX_FULL))
  335. return -EINVAL;
  336. /* Nothing to change */
  337. return 0;
  338. }
  339. static int mlx4_en_get_coalesce(struct net_device *dev,
  340. struct ethtool_coalesce *coal)
  341. {
  342. struct mlx4_en_priv *priv = netdev_priv(dev);
  343. coal->tx_coalesce_usecs = priv->tx_usecs;
  344. coal->tx_max_coalesced_frames = priv->tx_frames;
  345. coal->rx_coalesce_usecs = priv->rx_usecs;
  346. coal->rx_max_coalesced_frames = priv->rx_frames;
  347. coal->pkt_rate_low = priv->pkt_rate_low;
  348. coal->rx_coalesce_usecs_low = priv->rx_usecs_low;
  349. coal->pkt_rate_high = priv->pkt_rate_high;
  350. coal->rx_coalesce_usecs_high = priv->rx_usecs_high;
  351. coal->rate_sample_interval = priv->sample_interval;
  352. coal->use_adaptive_rx_coalesce = priv->adaptive_rx_coal;
  353. return 0;
  354. }
  355. static int mlx4_en_set_coalesce(struct net_device *dev,
  356. struct ethtool_coalesce *coal)
  357. {
  358. struct mlx4_en_priv *priv = netdev_priv(dev);
  359. priv->rx_frames = (coal->rx_max_coalesced_frames ==
  360. MLX4_EN_AUTO_CONF) ?
  361. MLX4_EN_RX_COAL_TARGET :
  362. coal->rx_max_coalesced_frames;
  363. priv->rx_usecs = (coal->rx_coalesce_usecs ==
  364. MLX4_EN_AUTO_CONF) ?
  365. MLX4_EN_RX_COAL_TIME :
  366. coal->rx_coalesce_usecs;
  367. /* Setting TX coalescing parameters */
  368. if (coal->tx_coalesce_usecs != priv->tx_usecs ||
  369. coal->tx_max_coalesced_frames != priv->tx_frames) {
  370. priv->tx_usecs = coal->tx_coalesce_usecs;
  371. priv->tx_frames = coal->tx_max_coalesced_frames;
  372. }
  373. /* Set adaptive coalescing params */
  374. priv->pkt_rate_low = coal->pkt_rate_low;
  375. priv->rx_usecs_low = coal->rx_coalesce_usecs_low;
  376. priv->pkt_rate_high = coal->pkt_rate_high;
  377. priv->rx_usecs_high = coal->rx_coalesce_usecs_high;
  378. priv->sample_interval = coal->rate_sample_interval;
  379. priv->adaptive_rx_coal = coal->use_adaptive_rx_coalesce;
  380. return mlx4_en_moderation_update(priv);
  381. }
  382. static int mlx4_en_set_pauseparam(struct net_device *dev,
  383. struct ethtool_pauseparam *pause)
  384. {
  385. struct mlx4_en_priv *priv = netdev_priv(dev);
  386. struct mlx4_en_dev *mdev = priv->mdev;
  387. int err;
  388. priv->prof->tx_pause = pause->tx_pause != 0;
  389. priv->prof->rx_pause = pause->rx_pause != 0;
  390. err = mlx4_SET_PORT_general(mdev->dev, priv->port,
  391. priv->rx_skb_size + ETH_FCS_LEN,
  392. priv->prof->tx_pause,
  393. priv->prof->tx_ppp,
  394. priv->prof->rx_pause,
  395. priv->prof->rx_ppp);
  396. if (err)
  397. en_err(priv, "Failed setting pause params\n");
  398. return err;
  399. }
  400. static void mlx4_en_get_pauseparam(struct net_device *dev,
  401. struct ethtool_pauseparam *pause)
  402. {
  403. struct mlx4_en_priv *priv = netdev_priv(dev);
  404. pause->tx_pause = priv->prof->tx_pause;
  405. pause->rx_pause = priv->prof->rx_pause;
  406. }
  407. static int mlx4_en_set_ringparam(struct net_device *dev,
  408. struct ethtool_ringparam *param)
  409. {
  410. struct mlx4_en_priv *priv = netdev_priv(dev);
  411. struct mlx4_en_dev *mdev = priv->mdev;
  412. u32 rx_size, tx_size;
  413. int port_up = 0;
  414. int err = 0;
  415. if (param->rx_jumbo_pending || param->rx_mini_pending)
  416. return -EINVAL;
  417. rx_size = roundup_pow_of_two(param->rx_pending);
  418. rx_size = max_t(u32, rx_size, MLX4_EN_MIN_RX_SIZE);
  419. rx_size = min_t(u32, rx_size, MLX4_EN_MAX_RX_SIZE);
  420. tx_size = roundup_pow_of_two(param->tx_pending);
  421. tx_size = max_t(u32, tx_size, MLX4_EN_MIN_TX_SIZE);
  422. tx_size = min_t(u32, tx_size, MLX4_EN_MAX_TX_SIZE);
  423. if (rx_size == (priv->port_up ? priv->rx_ring[0].actual_size :
  424. priv->rx_ring[0].size) &&
  425. tx_size == priv->tx_ring[0].size)
  426. return 0;
  427. mutex_lock(&mdev->state_lock);
  428. if (priv->port_up) {
  429. port_up = 1;
  430. mlx4_en_stop_port(dev);
  431. }
  432. mlx4_en_free_resources(priv);
  433. priv->prof->tx_ring_size = tx_size;
  434. priv->prof->rx_ring_size = rx_size;
  435. err = mlx4_en_alloc_resources(priv);
  436. if (err) {
  437. en_err(priv, "Failed reallocating port resources\n");
  438. goto out;
  439. }
  440. if (port_up) {
  441. err = mlx4_en_start_port(dev);
  442. if (err)
  443. en_err(priv, "Failed starting port\n");
  444. }
  445. err = mlx4_en_moderation_update(priv);
  446. out:
  447. mutex_unlock(&mdev->state_lock);
  448. return err;
  449. }
  450. static void mlx4_en_get_ringparam(struct net_device *dev,
  451. struct ethtool_ringparam *param)
  452. {
  453. struct mlx4_en_priv *priv = netdev_priv(dev);
  454. memset(param, 0, sizeof(*param));
  455. param->rx_max_pending = MLX4_EN_MAX_RX_SIZE;
  456. param->tx_max_pending = MLX4_EN_MAX_TX_SIZE;
  457. param->rx_pending = priv->port_up ?
  458. priv->rx_ring[0].actual_size : priv->rx_ring[0].size;
  459. param->tx_pending = priv->tx_ring[0].size;
  460. }
  461. static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev)
  462. {
  463. struct mlx4_en_priv *priv = netdev_priv(dev);
  464. return priv->rx_ring_num;
  465. }
  466. static int mlx4_en_get_rxfh_indir(struct net_device *dev, u32 *ring_index)
  467. {
  468. struct mlx4_en_priv *priv = netdev_priv(dev);
  469. struct mlx4_en_rss_map *rss_map = &priv->rss_map;
  470. int rss_rings;
  471. size_t n = priv->rx_ring_num;
  472. int err = 0;
  473. rss_rings = priv->prof->rss_rings ?: priv->rx_ring_num;
  474. while (n--) {
  475. ring_index[n] = rss_map->qps[n % rss_rings].qpn -
  476. rss_map->base_qpn;
  477. }
  478. return err;
  479. }
  480. static int mlx4_en_set_rxfh_indir(struct net_device *dev,
  481. const u32 *ring_index)
  482. {
  483. struct mlx4_en_priv *priv = netdev_priv(dev);
  484. struct mlx4_en_dev *mdev = priv->mdev;
  485. int port_up = 0;
  486. int err = 0;
  487. int i;
  488. int rss_rings = 0;
  489. /* Calculate RSS table size and make sure flows are spread evenly
  490. * between rings
  491. */
  492. for (i = 0; i < priv->rx_ring_num; i++) {
  493. if (i > 0 && !ring_index[i] && !rss_rings)
  494. rss_rings = i;
  495. if (ring_index[i] != (i % (rss_rings ?: priv->rx_ring_num)))
  496. return -EINVAL;
  497. }
  498. if (!rss_rings)
  499. rss_rings = priv->rx_ring_num;
  500. /* RSS table size must be an order of 2 */
  501. if (!is_power_of_2(rss_rings))
  502. return -EINVAL;
  503. mutex_lock(&mdev->state_lock);
  504. if (priv->port_up) {
  505. port_up = 1;
  506. mlx4_en_stop_port(dev);
  507. }
  508. priv->prof->rss_rings = rss_rings;
  509. if (port_up) {
  510. err = mlx4_en_start_port(dev);
  511. if (err)
  512. en_err(priv, "Failed starting port\n");
  513. }
  514. mutex_unlock(&mdev->state_lock);
  515. return err;
  516. }
  517. #define all_zeros_or_all_ones(field) \
  518. ((field) == 0 || (field) == (__force typeof(field))-1)
  519. static int mlx4_en_validate_flow(struct net_device *dev,
  520. struct ethtool_rxnfc *cmd)
  521. {
  522. struct ethtool_usrip4_spec *l3_mask;
  523. struct ethtool_tcpip4_spec *l4_mask;
  524. struct ethhdr *eth_mask;
  525. u64 full_mac = ~0ull;
  526. u64 zero_mac = 0;
  527. if (cmd->fs.location >= MAX_NUM_OF_FS_RULES)
  528. return -EINVAL;
  529. switch (cmd->fs.flow_type & ~FLOW_EXT) {
  530. case TCP_V4_FLOW:
  531. case UDP_V4_FLOW:
  532. if (cmd->fs.m_u.tcp_ip4_spec.tos)
  533. return -EINVAL;
  534. l4_mask = &cmd->fs.m_u.tcp_ip4_spec;
  535. /* don't allow mask which isn't all 0 or 1 */
  536. if (!all_zeros_or_all_ones(l4_mask->ip4src) ||
  537. !all_zeros_or_all_ones(l4_mask->ip4dst) ||
  538. !all_zeros_or_all_ones(l4_mask->psrc) ||
  539. !all_zeros_or_all_ones(l4_mask->pdst))
  540. return -EINVAL;
  541. break;
  542. case IP_USER_FLOW:
  543. l3_mask = &cmd->fs.m_u.usr_ip4_spec;
  544. if (l3_mask->l4_4_bytes || l3_mask->tos || l3_mask->proto ||
  545. cmd->fs.h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4 ||
  546. (!l3_mask->ip4src && !l3_mask->ip4dst) ||
  547. !all_zeros_or_all_ones(l3_mask->ip4src) ||
  548. !all_zeros_or_all_ones(l3_mask->ip4dst))
  549. return -EINVAL;
  550. break;
  551. case ETHER_FLOW:
  552. eth_mask = &cmd->fs.m_u.ether_spec;
  553. /* source mac mask must not be set */
  554. if (memcmp(eth_mask->h_source, &zero_mac, ETH_ALEN))
  555. return -EINVAL;
  556. /* dest mac mask must be ff:ff:ff:ff:ff:ff */
  557. if (memcmp(eth_mask->h_dest, &full_mac, ETH_ALEN))
  558. return -EINVAL;
  559. if (!all_zeros_or_all_ones(eth_mask->h_proto))
  560. return -EINVAL;
  561. break;
  562. default:
  563. return -EINVAL;
  564. }
  565. if ((cmd->fs.flow_type & FLOW_EXT)) {
  566. if (cmd->fs.m_ext.vlan_etype ||
  567. !(cmd->fs.m_ext.vlan_tci == 0 ||
  568. cmd->fs.m_ext.vlan_tci == cpu_to_be16(0xfff)))
  569. return -EINVAL;
  570. }
  571. return 0;
  572. }
  573. static int add_ip_rule(struct mlx4_en_priv *priv,
  574. struct ethtool_rxnfc *cmd,
  575. struct list_head *list_h)
  576. {
  577. struct mlx4_spec_list *spec_l3;
  578. struct ethtool_usrip4_spec *l3_mask = &cmd->fs.m_u.usr_ip4_spec;
  579. spec_l3 = kzalloc(sizeof *spec_l3, GFP_KERNEL);
  580. if (!spec_l3) {
  581. en_err(priv, "Fail to alloc ethtool rule.\n");
  582. return -ENOMEM;
  583. }
  584. spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4;
  585. spec_l3->ipv4.src_ip = cmd->fs.h_u.usr_ip4_spec.ip4src;
  586. if (l3_mask->ip4src)
  587. spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK;
  588. spec_l3->ipv4.dst_ip = cmd->fs.h_u.usr_ip4_spec.ip4dst;
  589. if (l3_mask->ip4dst)
  590. spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK;
  591. list_add_tail(&spec_l3->list, list_h);
  592. return 0;
  593. }
  594. static int add_tcp_udp_rule(struct mlx4_en_priv *priv,
  595. struct ethtool_rxnfc *cmd,
  596. struct list_head *list_h, int proto)
  597. {
  598. struct mlx4_spec_list *spec_l3;
  599. struct mlx4_spec_list *spec_l4;
  600. struct ethtool_tcpip4_spec *l4_mask = &cmd->fs.m_u.tcp_ip4_spec;
  601. spec_l3 = kzalloc(sizeof *spec_l3, GFP_KERNEL);
  602. spec_l4 = kzalloc(sizeof *spec_l4, GFP_KERNEL);
  603. if (!spec_l4 || !spec_l3) {
  604. en_err(priv, "Fail to alloc ethtool rule.\n");
  605. kfree(spec_l3);
  606. kfree(spec_l4);
  607. return -ENOMEM;
  608. }
  609. spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4;
  610. if (proto == TCP_V4_FLOW) {
  611. spec_l4->id = MLX4_NET_TRANS_RULE_ID_TCP;
  612. spec_l3->ipv4.src_ip = cmd->fs.h_u.tcp_ip4_spec.ip4src;
  613. spec_l3->ipv4.dst_ip = cmd->fs.h_u.tcp_ip4_spec.ip4dst;
  614. spec_l4->tcp_udp.src_port = cmd->fs.h_u.tcp_ip4_spec.psrc;
  615. spec_l4->tcp_udp.dst_port = cmd->fs.h_u.tcp_ip4_spec.pdst;
  616. } else {
  617. spec_l4->id = MLX4_NET_TRANS_RULE_ID_UDP;
  618. spec_l3->ipv4.src_ip = cmd->fs.h_u.udp_ip4_spec.ip4src;
  619. spec_l3->ipv4.dst_ip = cmd->fs.h_u.udp_ip4_spec.ip4dst;
  620. spec_l4->tcp_udp.src_port = cmd->fs.h_u.udp_ip4_spec.psrc;
  621. spec_l4->tcp_udp.dst_port = cmd->fs.h_u.udp_ip4_spec.pdst;
  622. }
  623. if (l4_mask->ip4src)
  624. spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK;
  625. if (l4_mask->ip4dst)
  626. spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK;
  627. if (l4_mask->psrc)
  628. spec_l4->tcp_udp.src_port_msk = EN_ETHTOOL_SHORT_MASK;
  629. if (l4_mask->pdst)
  630. spec_l4->tcp_udp.dst_port_msk = EN_ETHTOOL_SHORT_MASK;
  631. list_add_tail(&spec_l3->list, list_h);
  632. list_add_tail(&spec_l4->list, list_h);
  633. return 0;
  634. }
  635. static int mlx4_en_ethtool_to_net_trans_rule(struct net_device *dev,
  636. struct ethtool_rxnfc *cmd,
  637. struct list_head *rule_list_h)
  638. {
  639. int err;
  640. u64 mac;
  641. __be64 be_mac;
  642. struct ethhdr *eth_spec;
  643. struct mlx4_en_priv *priv = netdev_priv(dev);
  644. struct mlx4_spec_list *spec_l2;
  645. __be64 mac_msk = cpu_to_be64(MLX4_MAC_MASK << 16);
  646. err = mlx4_en_validate_flow(dev, cmd);
  647. if (err)
  648. return err;
  649. spec_l2 = kzalloc(sizeof *spec_l2, GFP_KERNEL);
  650. if (!spec_l2)
  651. return -ENOMEM;
  652. mac = priv->mac & MLX4_MAC_MASK;
  653. be_mac = cpu_to_be64(mac << 16);
  654. spec_l2->id = MLX4_NET_TRANS_RULE_ID_ETH;
  655. memcpy(spec_l2->eth.dst_mac_msk, &mac_msk, ETH_ALEN);
  656. if ((cmd->fs.flow_type & ~FLOW_EXT) != ETHER_FLOW)
  657. memcpy(spec_l2->eth.dst_mac, &be_mac, ETH_ALEN);
  658. if ((cmd->fs.flow_type & FLOW_EXT) && cmd->fs.m_ext.vlan_tci) {
  659. spec_l2->eth.vlan_id = cmd->fs.h_ext.vlan_tci;
  660. spec_l2->eth.vlan_id_msk = cpu_to_be16(0xfff);
  661. }
  662. list_add_tail(&spec_l2->list, rule_list_h);
  663. switch (cmd->fs.flow_type & ~FLOW_EXT) {
  664. case ETHER_FLOW:
  665. eth_spec = &cmd->fs.h_u.ether_spec;
  666. memcpy(&spec_l2->eth.dst_mac, eth_spec->h_dest, ETH_ALEN);
  667. spec_l2->eth.ether_type = eth_spec->h_proto;
  668. if (eth_spec->h_proto)
  669. spec_l2->eth.ether_type_enable = 1;
  670. break;
  671. case IP_USER_FLOW:
  672. err = add_ip_rule(priv, cmd, rule_list_h);
  673. break;
  674. case TCP_V4_FLOW:
  675. err = add_tcp_udp_rule(priv, cmd, rule_list_h, TCP_V4_FLOW);
  676. break;
  677. case UDP_V4_FLOW:
  678. err = add_tcp_udp_rule(priv, cmd, rule_list_h, UDP_V4_FLOW);
  679. break;
  680. }
  681. return err;
  682. }
  683. static int mlx4_en_flow_replace(struct net_device *dev,
  684. struct ethtool_rxnfc *cmd)
  685. {
  686. int err;
  687. struct mlx4_en_priv *priv = netdev_priv(dev);
  688. struct ethtool_flow_id *loc_rule;
  689. struct mlx4_spec_list *spec, *tmp_spec;
  690. u32 qpn;
  691. u64 reg_id;
  692. struct mlx4_net_trans_rule rule = {
  693. .queue_mode = MLX4_NET_TRANS_Q_FIFO,
  694. .exclusive = 0,
  695. .allow_loopback = 1,
  696. .promisc_mode = MLX4_FS_PROMISC_NONE,
  697. };
  698. rule.port = priv->port;
  699. rule.priority = MLX4_DOMAIN_ETHTOOL | cmd->fs.location;
  700. INIT_LIST_HEAD(&rule.list);
  701. /* Allow direct QP attaches if the EN_ETHTOOL_QP_ATTACH flag is set */
  702. if (cmd->fs.ring_cookie == RX_CLS_FLOW_DISC)
  703. qpn = priv->drop_qp.qpn;
  704. else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) {
  705. qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1);
  706. } else {
  707. if (cmd->fs.ring_cookie >= priv->rx_ring_num) {
  708. en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist.\n",
  709. cmd->fs.ring_cookie);
  710. return -EINVAL;
  711. }
  712. qpn = priv->rss_map.qps[cmd->fs.ring_cookie].qpn;
  713. if (!qpn) {
  714. en_warn(priv, "rxnfc: RX ring (%llu) is inactive.\n",
  715. cmd->fs.ring_cookie);
  716. return -EINVAL;
  717. }
  718. }
  719. rule.qpn = qpn;
  720. err = mlx4_en_ethtool_to_net_trans_rule(dev, cmd, &rule.list);
  721. if (err)
  722. goto out_free_list;
  723. loc_rule = &priv->ethtool_rules[cmd->fs.location];
  724. if (loc_rule->id) {
  725. err = mlx4_flow_detach(priv->mdev->dev, loc_rule->id);
  726. if (err) {
  727. en_err(priv, "Fail to detach network rule at location %d. registration id = %llx\n",
  728. cmd->fs.location, loc_rule->id);
  729. goto out_free_list;
  730. }
  731. loc_rule->id = 0;
  732. memset(&loc_rule->flow_spec, 0,
  733. sizeof(struct ethtool_rx_flow_spec));
  734. }
  735. err = mlx4_flow_attach(priv->mdev->dev, &rule, &reg_id);
  736. if (err) {
  737. en_err(priv, "Fail to attach network rule at location %d.\n",
  738. cmd->fs.location);
  739. goto out_free_list;
  740. }
  741. loc_rule->id = reg_id;
  742. memcpy(&loc_rule->flow_spec, &cmd->fs,
  743. sizeof(struct ethtool_rx_flow_spec));
  744. out_free_list:
  745. list_for_each_entry_safe(spec, tmp_spec, &rule.list, list) {
  746. list_del(&spec->list);
  747. kfree(spec);
  748. }
  749. return err;
  750. }
  751. static int mlx4_en_flow_detach(struct net_device *dev,
  752. struct ethtool_rxnfc *cmd)
  753. {
  754. int err = 0;
  755. struct ethtool_flow_id *rule;
  756. struct mlx4_en_priv *priv = netdev_priv(dev);
  757. if (cmd->fs.location >= MAX_NUM_OF_FS_RULES)
  758. return -EINVAL;
  759. rule = &priv->ethtool_rules[cmd->fs.location];
  760. if (!rule->id) {
  761. err = -ENOENT;
  762. goto out;
  763. }
  764. err = mlx4_flow_detach(priv->mdev->dev, rule->id);
  765. if (err) {
  766. en_err(priv, "Fail to detach network rule at location %d. registration id = 0x%llx\n",
  767. cmd->fs.location, rule->id);
  768. goto out;
  769. }
  770. rule->id = 0;
  771. memset(&rule->flow_spec, 0, sizeof(struct ethtool_rx_flow_spec));
  772. out:
  773. return err;
  774. }
  775. static int mlx4_en_get_flow(struct net_device *dev, struct ethtool_rxnfc *cmd,
  776. int loc)
  777. {
  778. int err = 0;
  779. struct ethtool_flow_id *rule;
  780. struct mlx4_en_priv *priv = netdev_priv(dev);
  781. if (loc < 0 || loc >= MAX_NUM_OF_FS_RULES)
  782. return -EINVAL;
  783. rule = &priv->ethtool_rules[loc];
  784. if (rule->id)
  785. memcpy(&cmd->fs, &rule->flow_spec,
  786. sizeof(struct ethtool_rx_flow_spec));
  787. else
  788. err = -ENOENT;
  789. return err;
  790. }
  791. static int mlx4_en_get_num_flows(struct mlx4_en_priv *priv)
  792. {
  793. int i, res = 0;
  794. for (i = 0; i < MAX_NUM_OF_FS_RULES; i++) {
  795. if (priv->ethtool_rules[i].id)
  796. res++;
  797. }
  798. return res;
  799. }
  800. static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
  801. u32 *rule_locs)
  802. {
  803. struct mlx4_en_priv *priv = netdev_priv(dev);
  804. struct mlx4_en_dev *mdev = priv->mdev;
  805. int err = 0;
  806. int i = 0, priority = 0;
  807. if ((cmd->cmd == ETHTOOL_GRXCLSRLCNT ||
  808. cmd->cmd == ETHTOOL_GRXCLSRULE ||
  809. cmd->cmd == ETHTOOL_GRXCLSRLALL) &&
  810. mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_DEVICE_MANAGED)
  811. return -EINVAL;
  812. switch (cmd->cmd) {
  813. case ETHTOOL_GRXRINGS:
  814. cmd->data = priv->rx_ring_num;
  815. break;
  816. case ETHTOOL_GRXCLSRLCNT:
  817. cmd->rule_cnt = mlx4_en_get_num_flows(priv);
  818. break;
  819. case ETHTOOL_GRXCLSRULE:
  820. err = mlx4_en_get_flow(dev, cmd, cmd->fs.location);
  821. break;
  822. case ETHTOOL_GRXCLSRLALL:
  823. while ((!err || err == -ENOENT) && priority < cmd->rule_cnt) {
  824. err = mlx4_en_get_flow(dev, cmd, i);
  825. if (!err)
  826. rule_locs[priority++] = i;
  827. i++;
  828. }
  829. err = 0;
  830. break;
  831. default:
  832. err = -EOPNOTSUPP;
  833. break;
  834. }
  835. return err;
  836. }
  837. static int mlx4_en_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
  838. {
  839. int err = 0;
  840. struct mlx4_en_priv *priv = netdev_priv(dev);
  841. struct mlx4_en_dev *mdev = priv->mdev;
  842. if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_DEVICE_MANAGED)
  843. return -EINVAL;
  844. switch (cmd->cmd) {
  845. case ETHTOOL_SRXCLSRLINS:
  846. err = mlx4_en_flow_replace(dev, cmd);
  847. break;
  848. case ETHTOOL_SRXCLSRLDEL:
  849. err = mlx4_en_flow_detach(dev, cmd);
  850. break;
  851. default:
  852. en_warn(priv, "Unsupported ethtool command. (%d)\n", cmd->cmd);
  853. return -EINVAL;
  854. }
  855. return err;
  856. }
  857. static void mlx4_en_get_channels(struct net_device *dev,
  858. struct ethtool_channels *channel)
  859. {
  860. struct mlx4_en_priv *priv = netdev_priv(dev);
  861. memset(channel, 0, sizeof(*channel));
  862. channel->max_rx = MAX_RX_RINGS;
  863. channel->max_tx = MLX4_EN_MAX_TX_RING_P_UP;
  864. channel->rx_count = priv->rx_ring_num;
  865. channel->tx_count = priv->tx_ring_num / MLX4_EN_NUM_UP;
  866. }
  867. static int mlx4_en_set_channels(struct net_device *dev,
  868. struct ethtool_channels *channel)
  869. {
  870. struct mlx4_en_priv *priv = netdev_priv(dev);
  871. struct mlx4_en_dev *mdev = priv->mdev;
  872. int port_up;
  873. int err = 0;
  874. if (channel->other_count || channel->combined_count ||
  875. channel->tx_count > MLX4_EN_MAX_TX_RING_P_UP ||
  876. channel->rx_count > MAX_RX_RINGS ||
  877. !channel->tx_count || !channel->rx_count)
  878. return -EINVAL;
  879. mutex_lock(&mdev->state_lock);
  880. if (priv->port_up) {
  881. port_up = 1;
  882. mlx4_en_stop_port(dev);
  883. }
  884. mlx4_en_free_resources(priv);
  885. priv->num_tx_rings_p_up = channel->tx_count;
  886. priv->tx_ring_num = channel->tx_count * MLX4_EN_NUM_UP;
  887. priv->rx_ring_num = channel->rx_count;
  888. err = mlx4_en_alloc_resources(priv);
  889. if (err) {
  890. en_err(priv, "Failed reallocating port resources\n");
  891. goto out;
  892. }
  893. netif_set_real_num_tx_queues(dev, priv->tx_ring_num);
  894. netif_set_real_num_rx_queues(dev, priv->rx_ring_num);
  895. mlx4_en_setup_tc(dev, MLX4_EN_NUM_UP);
  896. en_warn(priv, "Using %d TX rings\n", priv->tx_ring_num);
  897. en_warn(priv, "Using %d RX rings\n", priv->rx_ring_num);
  898. if (port_up) {
  899. err = mlx4_en_start_port(dev);
  900. if (err)
  901. en_err(priv, "Failed starting port\n");
  902. }
  903. err = mlx4_en_moderation_update(priv);
  904. out:
  905. mutex_unlock(&mdev->state_lock);
  906. return err;
  907. }
  908. const struct ethtool_ops mlx4_en_ethtool_ops = {
  909. .get_drvinfo = mlx4_en_get_drvinfo,
  910. .get_settings = mlx4_en_get_settings,
  911. .set_settings = mlx4_en_set_settings,
  912. .get_link = ethtool_op_get_link,
  913. .get_strings = mlx4_en_get_strings,
  914. .get_sset_count = mlx4_en_get_sset_count,
  915. .get_ethtool_stats = mlx4_en_get_ethtool_stats,
  916. .self_test = mlx4_en_self_test,
  917. .get_wol = mlx4_en_get_wol,
  918. .set_wol = mlx4_en_set_wol,
  919. .get_msglevel = mlx4_en_get_msglevel,
  920. .set_msglevel = mlx4_en_set_msglevel,
  921. .get_coalesce = mlx4_en_get_coalesce,
  922. .set_coalesce = mlx4_en_set_coalesce,
  923. .get_pauseparam = mlx4_en_get_pauseparam,
  924. .set_pauseparam = mlx4_en_set_pauseparam,
  925. .get_ringparam = mlx4_en_get_ringparam,
  926. .set_ringparam = mlx4_en_set_ringparam,
  927. .get_rxnfc = mlx4_en_get_rxnfc,
  928. .set_rxnfc = mlx4_en_set_rxnfc,
  929. .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size,
  930. .get_rxfh_indir = mlx4_en_get_rxfh_indir,
  931. .set_rxfh_indir = mlx4_en_set_rxfh_indir,
  932. .get_channels = mlx4_en_get_channels,
  933. .set_channels = mlx4_en_set_channels,
  934. };