blob: ae83da9cd18a3f870ab51bc3ff9cb207b6f0432e [file] [log] [blame]
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -07001/*
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
34#include <linux/kernel.h>
35#include <linux/ethtool.h>
36#include <linux/netdevice.h>
Amir Vadaiaf22d9d2012-07-18 22:33:49 +000037#include <linux/mlx4/driver.h>
Hadar Hen Zionf90a3672013-01-30 23:07:04 +000038#include <linux/in.h>
39#include <net/ip.h>
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -070040
41#include "mlx4_en.h"
42#include "en_port.h"
43
Hadar Hen Zion82067282012-07-05 04:03:49 +000044#define EN_ETHTOOL_QP_ATTACH (1ull << 63)
Hadar Hen Zion82067282012-07-05 04:03:49 +000045#define EN_ETHTOOL_SHORT_MASK cpu_to_be16(0xffff)
46#define EN_ETHTOOL_WORD_MASK cpu_to_be32(0xffffffff)
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -070047
Amir Vadai79c54b62012-12-02 03:49:22 +000048static int mlx4_en_moderation_update(struct mlx4_en_priv *priv)
49{
50 int i;
51 int err = 0;
52
53 for (i = 0; i < priv->tx_ring_num; i++) {
Eugenia Emantayev41d942d2013-11-07 12:19:52 +020054 priv->tx_cq[i]->moder_cnt = priv->tx_frames;
55 priv->tx_cq[i]->moder_time = priv->tx_usecs;
Eugenia Emantayev38463e22013-09-12 18:11:20 +030056 if (priv->port_up) {
Eugenia Emantayev41d942d2013-11-07 12:19:52 +020057 err = mlx4_en_set_cq_moder(priv, priv->tx_cq[i]);
Eugenia Emantayev38463e22013-09-12 18:11:20 +030058 if (err)
59 return err;
60 }
Amir Vadai79c54b62012-12-02 03:49:22 +000061 }
62
63 if (priv->adaptive_rx_coal)
64 return 0;
65
66 for (i = 0; i < priv->rx_ring_num; i++) {
Eugenia Emantayev41d942d2013-11-07 12:19:52 +020067 priv->rx_cq[i]->moder_cnt = priv->rx_frames;
68 priv->rx_cq[i]->moder_time = priv->rx_usecs;
Amir Vadai79c54b62012-12-02 03:49:22 +000069 priv->last_moder_time[i] = MLX4_EN_AUTO_CONF;
Eugenia Emantayev38463e22013-09-12 18:11:20 +030070 if (priv->port_up) {
Eugenia Emantayev41d942d2013-11-07 12:19:52 +020071 err = mlx4_en_set_cq_moder(priv, priv->rx_cq[i]);
Eugenia Emantayev38463e22013-09-12 18:11:20 +030072 if (err)
73 return err;
74 }
Amir Vadai79c54b62012-12-02 03:49:22 +000075 }
76
77 return err;
78}
79
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -070080static void
81mlx4_en_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
82{
83 struct mlx4_en_priv *priv = netdev_priv(dev);
84 struct mlx4_en_dev *mdev = priv->mdev;
85
Rick Jones612a94d2011-11-14 08:13:25 +000086 strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
87 strlcpy(drvinfo->version, DRV_VERSION " (" DRV_RELDATE ")",
88 sizeof(drvinfo->version));
89 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
90 "%d.%d.%d",
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -070091 (u16) (mdev->dev->caps.fw_ver >> 32),
92 (u16) ((mdev->dev->caps.fw_ver >> 16) & 0xffff),
93 (u16) (mdev->dev->caps.fw_ver & 0xffff));
Rick Jones612a94d2011-11-14 08:13:25 +000094 strlcpy(drvinfo->bus_info, pci_name(mdev->dev->pdev),
95 sizeof(drvinfo->bus_info));
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -070096 drvinfo->n_stats = 0;
97 drvinfo->regdump_len = 0;
98 drvinfo->eedump_len = 0;
99}
100
Amir Vadai0fef9d02014-07-22 15:44:10 +0300101static const char mlx4_en_priv_flags[][ETH_GSTRING_LEN] = {
102 "blueflame",
103};
104
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700105static const char main_strings[][ETH_GSTRING_LEN] = {
106 "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors",
107 "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions",
108 "rx_length_errors", "rx_over_errors", "rx_crc_errors",
109 "rx_frame_errors", "rx_fifo_errors", "rx_missed_errors",
110 "tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors",
111 "tx_heartbeat_errors", "tx_window_errors",
112
113 /* port statistics */
Yevgeny Petrilinfa37a952010-08-24 03:46:46 +0000114 "tso_packets",
Eric Dumazet9fab4262014-10-02 08:24:21 -0700115 "xmit_more",
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700116 "queue_stopped", "wake_queue", "tx_timeout", "rx_alloc_failed",
117 "rx_csum_good", "rx_csum_none", "tx_chksum_offload",
118
119 /* packet statistics */
120 "broadcast", "rx_prio_0", "rx_prio_1", "rx_prio_2", "rx_prio_3",
121 "rx_prio_4", "rx_prio_5", "rx_prio_6", "rx_prio_7", "tx_prio_0",
122 "tx_prio_1", "tx_prio_2", "tx_prio_3", "tx_prio_4", "tx_prio_5",
123 "tx_prio_6", "tx_prio_7",
124};
Yevgeny Petrilind61702f2010-09-05 22:20:24 +0000125#define NUM_MAIN_STATS 21
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700126#define NUM_ALL_STATS (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + NUM_PERF_STATS)
127
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000128static const char mlx4_en_test_names[][ETH_GSTRING_LEN]= {
Masanari Iidafd9071e2012-04-13 04:33:20 +0000129 "Interrupt Test",
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000130 "Link Test",
131 "Speed Test",
132 "Register Test",
133 "Loopback Test",
134};
135
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700136static u32 mlx4_en_get_msglevel(struct net_device *dev)
137{
138 return ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable;
139}
140
141static void mlx4_en_set_msglevel(struct net_device *dev, u32 val)
142{
143 ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable = val;
144}
145
146static void mlx4_en_get_wol(struct net_device *netdev,
147 struct ethtool_wolinfo *wol)
148{
Yevgeny Petrilin14c07b12011-03-22 22:37:59 +0000149 struct mlx4_en_priv *priv = netdev_priv(netdev);
150 int err = 0;
151 u64 config = 0;
Oren Duer559a9f12011-11-26 19:55:15 +0000152 u64 mask;
Yevgeny Petrilin14c07b12011-03-22 22:37:59 +0000153
Oren Duer559a9f12011-11-26 19:55:15 +0000154 if ((priv->port < 1) || (priv->port > 2)) {
155 en_err(priv, "Failed to get WoL information\n");
156 return;
157 }
158
159 mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 :
160 MLX4_DEV_CAP_FLAG_WOL_PORT2;
161
162 if (!(priv->mdev->dev->caps.flags & mask)) {
Yevgeny Petrilin14c07b12011-03-22 22:37:59 +0000163 wol->supported = 0;
164 wol->wolopts = 0;
165 return;
166 }
167
168 err = mlx4_wol_read(priv->mdev->dev, &config, priv->port);
169 if (err) {
170 en_err(priv, "Failed to get WoL information\n");
171 return;
172 }
173
174 if (config & MLX4_EN_WOL_MAGIC)
175 wol->supported = WAKE_MAGIC;
176 else
177 wol->supported = 0;
178
179 if (config & MLX4_EN_WOL_ENABLED)
180 wol->wolopts = WAKE_MAGIC;
181 else
182 wol->wolopts = 0;
183}
184
185static int mlx4_en_set_wol(struct net_device *netdev,
186 struct ethtool_wolinfo *wol)
187{
188 struct mlx4_en_priv *priv = netdev_priv(netdev);
189 u64 config = 0;
190 int err = 0;
Oren Duer559a9f12011-11-26 19:55:15 +0000191 u64 mask;
Yevgeny Petrilin14c07b12011-03-22 22:37:59 +0000192
Oren Duer559a9f12011-11-26 19:55:15 +0000193 if ((priv->port < 1) || (priv->port > 2))
194 return -EOPNOTSUPP;
195
196 mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 :
197 MLX4_DEV_CAP_FLAG_WOL_PORT2;
198
199 if (!(priv->mdev->dev->caps.flags & mask))
Yevgeny Petrilin14c07b12011-03-22 22:37:59 +0000200 return -EOPNOTSUPP;
201
202 if (wol->supported & ~WAKE_MAGIC)
203 return -EINVAL;
204
205 err = mlx4_wol_read(priv->mdev->dev, &config, priv->port);
206 if (err) {
207 en_err(priv, "Failed to get WoL info, unable to modify\n");
208 return err;
209 }
210
211 if (wol->wolopts & WAKE_MAGIC) {
212 config |= MLX4_EN_WOL_DO_MODIFY | MLX4_EN_WOL_ENABLED |
213 MLX4_EN_WOL_MAGIC;
214 } else {
215 config &= ~(MLX4_EN_WOL_ENABLED | MLX4_EN_WOL_MAGIC);
216 config |= MLX4_EN_WOL_DO_MODIFY;
217 }
218
219 err = mlx4_wol_write(priv->mdev->dev, config, priv->port);
220 if (err)
221 en_err(priv, "Failed to set WoL information\n");
222
223 return err;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700224}
225
226static int mlx4_en_get_sset_count(struct net_device *dev, int sset)
227{
228 struct mlx4_en_priv *priv = netdev_priv(dev);
Eugenia Emantayev93ece0c2012-01-19 09:45:05 +0000229 int bit_count = hweight64(priv->stats_bitmap);
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700230
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000231 switch (sset) {
232 case ETH_SS_STATS:
Eugenia Emantayev93ece0c2012-01-19 09:45:05 +0000233 return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) +
Amir Vadai85018412013-06-18 16:18:28 +0300234 (priv->tx_ring_num * 2) +
Cong Wange0d10952013-08-01 11:10:25 +0800235#ifdef CONFIG_NET_RX_BUSY_POLL
Amir Vadai85018412013-06-18 16:18:28 +0300236 (priv->rx_ring_num * 5);
237#else
238 (priv->rx_ring_num * 2);
239#endif
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000240 case ETH_SS_TEST:
Or Gerlitzccf86322011-07-07 19:19:29 +0000241 return MLX4_EN_NUM_SELF_TEST - !(priv->mdev->dev->caps.flags
242 & MLX4_DEV_CAP_FLAG_UC_LOOPBACK) * 2;
Amir Vadai0fef9d02014-07-22 15:44:10 +0300243 case ETH_SS_PRIV_FLAGS:
244 return ARRAY_SIZE(mlx4_en_priv_flags);
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000245 default:
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700246 return -EOPNOTSUPP;
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000247 }
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700248}
249
250static void mlx4_en_get_ethtool_stats(struct net_device *dev,
251 struct ethtool_stats *stats, uint64_t *data)
252{
253 struct mlx4_en_priv *priv = netdev_priv(dev);
254 int index = 0;
Eugenia Emantayev93ece0c2012-01-19 09:45:05 +0000255 int i, j = 0;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700256
257 spin_lock_bh(&priv->stats_lock);
258
Eugenia Emantayev93ece0c2012-01-19 09:45:05 +0000259 if (!(priv->stats_bitmap)) {
260 for (i = 0; i < NUM_MAIN_STATS; i++)
261 data[index++] =
262 ((unsigned long *) &priv->stats)[i];
263 for (i = 0; i < NUM_PORT_STATS; i++)
264 data[index++] =
265 ((unsigned long *) &priv->port_stats)[i];
266 for (i = 0; i < NUM_PKT_STATS; i++)
267 data[index++] =
268 ((unsigned long *) &priv->pkstats)[i];
269 } else {
270 for (i = 0; i < NUM_MAIN_STATS; i++) {
271 if ((priv->stats_bitmap >> j) & 1)
272 data[index++] =
273 ((unsigned long *) &priv->stats)[i];
274 j++;
275 }
276 for (i = 0; i < NUM_PORT_STATS; i++) {
277 if ((priv->stats_bitmap >> j) & 1)
278 data[index++] =
279 ((unsigned long *) &priv->port_stats)[i];
280 j++;
281 }
282 }
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700283 for (i = 0; i < priv->tx_ring_num; i++) {
Eugenia Emantayev41d942d2013-11-07 12:19:52 +0200284 data[index++] = priv->tx_ring[i]->packets;
285 data[index++] = priv->tx_ring[i]->bytes;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700286 }
287 for (i = 0; i < priv->rx_ring_num; i++) {
Eugenia Emantayev41d942d2013-11-07 12:19:52 +0200288 data[index++] = priv->rx_ring[i]->packets;
289 data[index++] = priv->rx_ring[i]->bytes;
Cong Wange0d10952013-08-01 11:10:25 +0800290#ifdef CONFIG_NET_RX_BUSY_POLL
Eugenia Emantayev41d942d2013-11-07 12:19:52 +0200291 data[index++] = priv->rx_ring[i]->yields;
292 data[index++] = priv->rx_ring[i]->misses;
293 data[index++] = priv->rx_ring[i]->cleaned;
Amir Vadai85018412013-06-18 16:18:28 +0300294#endif
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700295 }
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700296 spin_unlock_bh(&priv->stats_lock);
297
298}
299
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000300static void mlx4_en_self_test(struct net_device *dev,
301 struct ethtool_test *etest, u64 *buf)
302{
303 mlx4_en_ex_selftest(dev, &etest->flags, buf);
304}
305
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700306static void mlx4_en_get_strings(struct net_device *dev,
307 uint32_t stringset, uint8_t *data)
308{
309 struct mlx4_en_priv *priv = netdev_priv(dev);
310 int index = 0;
311 int i;
312
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000313 switch (stringset) {
314 case ETH_SS_TEST:
315 for (i = 0; i < MLX4_EN_NUM_SELF_TEST - 2; i++)
316 strcpy(data + i * ETH_GSTRING_LEN, mlx4_en_test_names[i]);
Or Gerlitzccf86322011-07-07 19:19:29 +0000317 if (priv->mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UC_LOOPBACK)
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000318 for (; i < MLX4_EN_NUM_SELF_TEST; i++)
319 strcpy(data + i * ETH_GSTRING_LEN, mlx4_en_test_names[i]);
320 break;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700321
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000322 case ETH_SS_STATS:
323 /* Add main counters */
Eugenia Emantayev93ece0c2012-01-19 09:45:05 +0000324 if (!priv->stats_bitmap) {
325 for (i = 0; i < NUM_MAIN_STATS; i++)
326 strcpy(data + (index++) * ETH_GSTRING_LEN,
327 main_strings[i]);
328 for (i = 0; i < NUM_PORT_STATS; i++)
329 strcpy(data + (index++) * ETH_GSTRING_LEN,
330 main_strings[i +
331 NUM_MAIN_STATS]);
332 for (i = 0; i < NUM_PKT_STATS; i++)
333 strcpy(data + (index++) * ETH_GSTRING_LEN,
334 main_strings[i +
335 NUM_MAIN_STATS +
336 NUM_PORT_STATS]);
337 } else
338 for (i = 0; i < NUM_MAIN_STATS + NUM_PORT_STATS; i++) {
339 if ((priv->stats_bitmap >> i) & 1) {
340 strcpy(data +
341 (index++) * ETH_GSTRING_LEN,
342 main_strings[i]);
343 }
344 if (!(priv->stats_bitmap >> i))
345 break;
346 }
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000347 for (i = 0; i < priv->tx_ring_num; i++) {
348 sprintf(data + (index++) * ETH_GSTRING_LEN,
349 "tx%d_packets", i);
350 sprintf(data + (index++) * ETH_GSTRING_LEN,
351 "tx%d_bytes", i);
352 }
353 for (i = 0; i < priv->rx_ring_num; i++) {
354 sprintf(data + (index++) * ETH_GSTRING_LEN,
355 "rx%d_packets", i);
356 sprintf(data + (index++) * ETH_GSTRING_LEN,
357 "rx%d_bytes", i);
Cong Wange0d10952013-08-01 11:10:25 +0800358#ifdef CONFIG_NET_RX_BUSY_POLL
Amir Vadai85018412013-06-18 16:18:28 +0300359 sprintf(data + (index++) * ETH_GSTRING_LEN,
360 "rx%d_napi_yield", i);
361 sprintf(data + (index++) * ETH_GSTRING_LEN,
362 "rx%d_misses", i);
363 sprintf(data + (index++) * ETH_GSTRING_LEN,
364 "rx%d_cleaned", i);
365#endif
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000366 }
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000367 break;
Amir Vadai0fef9d02014-07-22 15:44:10 +0300368 case ETH_SS_PRIV_FLAGS:
369 for (i = 0; i < ARRAY_SIZE(mlx4_en_priv_flags); i++)
370 strcpy(data + i * ETH_GSTRING_LEN,
371 mlx4_en_priv_flags[i]);
372 break;
373
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +0000374 }
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700375}
376
377static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
378{
Yevgeny Petrilin76995172010-08-24 03:46:23 +0000379 struct mlx4_en_priv *priv = netdev_priv(dev);
380 int trans_type;
381
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700382 cmd->autoneg = AUTONEG_DISABLE;
383 cmd->supported = SUPPORTED_10000baseT_Full;
Yevgeny Petrilin76995172010-08-24 03:46:23 +0000384 cmd->advertising = ADVERTISED_10000baseT_Full;
385
386 if (mlx4_en_QUERY_PORT(priv->mdev, priv->port))
387 return -ENOMEM;
388
389 trans_type = priv->port_state.transciver;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700390 if (netif_carrier_ok(dev)) {
David Decotigny70739492011-04-27 18:32:40 +0000391 ethtool_cmd_speed_set(cmd, priv->port_state.link_speed);
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700392 cmd->duplex = DUPLEX_FULL;
393 } else {
Jiri Pirko537fae02014-06-06 14:17:00 +0200394 ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
395 cmd->duplex = DUPLEX_UNKNOWN;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700396 }
Yevgeny Petrilin76995172010-08-24 03:46:23 +0000397
398 if (trans_type > 0 && trans_type <= 0xC) {
399 cmd->port = PORT_FIBRE;
400 cmd->transceiver = XCVR_EXTERNAL;
401 cmd->supported |= SUPPORTED_FIBRE;
402 cmd->advertising |= ADVERTISED_FIBRE;
403 } else if (trans_type == 0x80 || trans_type == 0) {
404 cmd->port = PORT_TP;
405 cmd->transceiver = XCVR_INTERNAL;
406 cmd->supported |= SUPPORTED_TP;
407 cmd->advertising |= ADVERTISED_TP;
408 } else {
409 cmd->port = -1;
410 cmd->transceiver = -1;
411 }
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700412 return 0;
413}
414
415static int mlx4_en_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
416{
417 if ((cmd->autoneg == AUTONEG_ENABLE) ||
David Decotigny25db0332011-04-27 18:32:39 +0000418 (ethtool_cmd_speed(cmd) != SPEED_10000) ||
419 (cmd->duplex != DUPLEX_FULL))
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700420 return -EINVAL;
421
422 /* Nothing to change */
423 return 0;
424}
425
426static int mlx4_en_get_coalesce(struct net_device *dev,
427 struct ethtool_coalesce *coal)
428{
429 struct mlx4_en_priv *priv = netdev_priv(dev);
430
Yevgeny Petrilina19a8482012-04-23 02:18:33 +0000431 coal->tx_coalesce_usecs = priv->tx_usecs;
432 coal->tx_max_coalesced_frames = priv->tx_frames;
Amir Vadaifbc6daf2014-07-08 11:28:12 +0300433 coal->tx_max_coalesced_frames_irq = priv->tx_work_limit;
434
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700435 coal->rx_coalesce_usecs = priv->rx_usecs;
436 coal->rx_max_coalesced_frames = priv->rx_frames;
437
438 coal->pkt_rate_low = priv->pkt_rate_low;
439 coal->rx_coalesce_usecs_low = priv->rx_usecs_low;
440 coal->pkt_rate_high = priv->pkt_rate_high;
441 coal->rx_coalesce_usecs_high = priv->rx_usecs_high;
442 coal->rate_sample_interval = priv->sample_interval;
443 coal->use_adaptive_rx_coalesce = priv->adaptive_rx_coal;
Amir Vadaifbc6daf2014-07-08 11:28:12 +0300444
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700445 return 0;
446}
447
448static int mlx4_en_set_coalesce(struct net_device *dev,
449 struct ethtool_coalesce *coal)
450{
451 struct mlx4_en_priv *priv = netdev_priv(dev);
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700452
Amir Vadaifbc6daf2014-07-08 11:28:12 +0300453 if (!coal->tx_max_coalesced_frames_irq)
454 return -EINVAL;
455
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700456 priv->rx_frames = (coal->rx_max_coalesced_frames ==
457 MLX4_EN_AUTO_CONF) ?
Yevgeny Petrilin3db36fb2009-06-01 23:23:13 +0000458 MLX4_EN_RX_COAL_TARGET :
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700459 coal->rx_max_coalesced_frames;
460 priv->rx_usecs = (coal->rx_coalesce_usecs ==
461 MLX4_EN_AUTO_CONF) ?
462 MLX4_EN_RX_COAL_TIME :
463 coal->rx_coalesce_usecs;
464
Yevgeny Petrilina19a8482012-04-23 02:18:33 +0000465 /* Setting TX coalescing parameters */
466 if (coal->tx_coalesce_usecs != priv->tx_usecs ||
467 coal->tx_max_coalesced_frames != priv->tx_frames) {
468 priv->tx_usecs = coal->tx_coalesce_usecs;
469 priv->tx_frames = coal->tx_max_coalesced_frames;
Yevgeny Petrilina19a8482012-04-23 02:18:33 +0000470 }
471
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700472 /* Set adaptive coalescing params */
473 priv->pkt_rate_low = coal->pkt_rate_low;
474 priv->rx_usecs_low = coal->rx_coalesce_usecs_low;
475 priv->pkt_rate_high = coal->pkt_rate_high;
476 priv->rx_usecs_high = coal->rx_coalesce_usecs_high;
477 priv->sample_interval = coal->rate_sample_interval;
478 priv->adaptive_rx_coal = coal->use_adaptive_rx_coalesce;
Amir Vadaifbc6daf2014-07-08 11:28:12 +0300479 priv->tx_work_limit = coal->tx_max_coalesced_frames_irq;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700480
Amir Vadai79c54b62012-12-02 03:49:22 +0000481 return mlx4_en_moderation_update(priv);
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700482}
483
484static int mlx4_en_set_pauseparam(struct net_device *dev,
485 struct ethtool_pauseparam *pause)
486{
487 struct mlx4_en_priv *priv = netdev_priv(dev);
488 struct mlx4_en_dev *mdev = priv->mdev;
489 int err;
490
Ivan Vecera278d4362014-09-08 18:46:53 +0200491 if (pause->autoneg)
492 return -EINVAL;
493
Yevgeny Petrilind53b93f2008-11-05 04:48:36 +0000494 priv->prof->tx_pause = pause->tx_pause != 0;
495 priv->prof->rx_pause = pause->rx_pause != 0;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700496 err = mlx4_SET_PORT_general(mdev->dev, priv->port,
497 priv->rx_skb_size + ETH_FCS_LEN,
Yevgeny Petrilind53b93f2008-11-05 04:48:36 +0000498 priv->prof->tx_pause,
499 priv->prof->tx_ppp,
500 priv->prof->rx_pause,
501 priv->prof->rx_ppp);
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700502 if (err)
Yevgeny Petrilin453a6082009-06-01 20:27:13 +0000503 en_err(priv, "Failed setting pause params\n");
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700504
505 return err;
506}
507
508static void mlx4_en_get_pauseparam(struct net_device *dev,
509 struct ethtool_pauseparam *pause)
510{
511 struct mlx4_en_priv *priv = netdev_priv(dev);
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700512
Yevgeny Petrilind53b93f2008-11-05 04:48:36 +0000513 pause->tx_pause = priv->prof->tx_pause;
514 pause->rx_pause = priv->prof->rx_pause;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700515}
516
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -0800517static int mlx4_en_set_ringparam(struct net_device *dev,
518 struct ethtool_ringparam *param)
519{
520 struct mlx4_en_priv *priv = netdev_priv(dev);
521 struct mlx4_en_dev *mdev = priv->mdev;
522 u32 rx_size, tx_size;
523 int port_up = 0;
524 int err = 0;
525
526 if (param->rx_jumbo_pending || param->rx_mini_pending)
527 return -EINVAL;
528
529 rx_size = roundup_pow_of_two(param->rx_pending);
530 rx_size = max_t(u32, rx_size, MLX4_EN_MIN_RX_SIZE);
Yevgeny Petrilinbd531e32009-01-08 10:57:37 -0800531 rx_size = min_t(u32, rx_size, MLX4_EN_MAX_RX_SIZE);
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -0800532 tx_size = roundup_pow_of_two(param->tx_pending);
533 tx_size = max_t(u32, tx_size, MLX4_EN_MIN_TX_SIZE);
Yevgeny Petrilinbd531e32009-01-08 10:57:37 -0800534 tx_size = min_t(u32, tx_size, MLX4_EN_MAX_TX_SIZE);
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -0800535
Eugenia Emantayev41d942d2013-11-07 12:19:52 +0200536 if (rx_size == (priv->port_up ? priv->rx_ring[0]->actual_size :
537 priv->rx_ring[0]->size) &&
538 tx_size == priv->tx_ring[0]->size)
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -0800539 return 0;
540
541 mutex_lock(&mdev->state_lock);
542 if (priv->port_up) {
543 port_up = 1;
Amir Vadai3484aac2013-01-30 23:07:11 +0000544 mlx4_en_stop_port(dev, 1);
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -0800545 }
546
Alexander Gullerfe0af032011-10-09 05:26:46 +0000547 mlx4_en_free_resources(priv);
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -0800548
549 priv->prof->tx_ring_size = tx_size;
550 priv->prof->rx_ring_size = rx_size;
551
552 err = mlx4_en_alloc_resources(priv);
553 if (err) {
Yevgeny Petrilin453a6082009-06-01 20:27:13 +0000554 en_err(priv, "Failed reallocating port resources\n");
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -0800555 goto out;
556 }
557 if (port_up) {
558 err = mlx4_en_start_port(dev);
559 if (err)
Yevgeny Petrilin453a6082009-06-01 20:27:13 +0000560 en_err(priv, "Failed starting port\n");
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -0800561 }
562
Amir Vadai79c54b62012-12-02 03:49:22 +0000563 err = mlx4_en_moderation_update(priv);
Alexander Guller6b4d8d92011-10-09 05:38:23 +0000564
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -0800565out:
566 mutex_unlock(&mdev->state_lock);
567 return err;
568}
569
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700570static void mlx4_en_get_ringparam(struct net_device *dev,
571 struct ethtool_ringparam *param)
572{
573 struct mlx4_en_priv *priv = netdev_priv(dev);
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700574
575 memset(param, 0, sizeof(*param));
Yevgeny Petrilinbd531e32009-01-08 10:57:37 -0800576 param->rx_max_pending = MLX4_EN_MAX_RX_SIZE;
577 param->tx_max_pending = MLX4_EN_MAX_TX_SIZE;
Yevgeny Petrilinbc081ce2010-08-24 03:46:34 +0000578 param->rx_pending = priv->port_up ?
Eugenia Emantayev41d942d2013-11-07 12:19:52 +0200579 priv->rx_ring[0]->actual_size : priv->rx_ring[0]->size;
580 param->tx_pending = priv->tx_ring[0]->size;
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -0700581}
582
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +0000583static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev)
584{
585 struct mlx4_en_priv *priv = netdev_priv(dev);
586
587 return priv->rx_ring_num;
588}
589
Ben Hutchingsfe62d002014-05-15 01:25:27 +0100590static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key)
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +0000591{
592 struct mlx4_en_priv *priv = netdev_priv(dev);
593 struct mlx4_en_rss_map *rss_map = &priv->rss_map;
594 int rss_rings;
595 size_t n = priv->rx_ring_num;
596 int err = 0;
597
598 rss_rings = priv->prof->rss_rings ?: priv->rx_ring_num;
599
600 while (n--) {
601 ring_index[n] = rss_map->qps[n % rss_rings].qpn -
602 rss_map->base_qpn;
603 }
604
605 return err;
606}
607
Ben Hutchingsfe62d002014-05-15 01:25:27 +0100608static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
609 const u8 *key)
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +0000610{
611 struct mlx4_en_priv *priv = netdev_priv(dev);
612 struct mlx4_en_dev *mdev = priv->mdev;
613 int port_up = 0;
614 int err = 0;
615 int i;
616 int rss_rings = 0;
617
618 /* Calculate RSS table size and make sure flows are spread evenly
619 * between rings
620 */
621 for (i = 0; i < priv->rx_ring_num; i++) {
622 if (i > 0 && !ring_index[i] && !rss_rings)
623 rss_rings = i;
624
625 if (ring_index[i] != (i % (rss_rings ?: priv->rx_ring_num)))
626 return -EINVAL;
627 }
628
629 if (!rss_rings)
630 rss_rings = priv->rx_ring_num;
631
632 /* RSS table size must be an order of 2 */
633 if (!is_power_of_2(rss_rings))
634 return -EINVAL;
635
636 mutex_lock(&mdev->state_lock);
637 if (priv->port_up) {
638 port_up = 1;
Amir Vadai3484aac2013-01-30 23:07:11 +0000639 mlx4_en_stop_port(dev, 1);
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +0000640 }
641
642 priv->prof->rss_rings = rss_rings;
643
644 if (port_up) {
645 err = mlx4_en_start_port(dev);
646 if (err)
647 en_err(priv, "Failed starting port\n");
648 }
649
650 mutex_unlock(&mdev->state_lock);
651 return err;
652}
653
Hadar Hen Zion82067282012-07-05 04:03:49 +0000654#define all_zeros_or_all_ones(field) \
655 ((field) == 0 || (field) == (__force typeof(field))-1)
656
657static int mlx4_en_validate_flow(struct net_device *dev,
658 struct ethtool_rxnfc *cmd)
659{
660 struct ethtool_usrip4_spec *l3_mask;
661 struct ethtool_tcpip4_spec *l4_mask;
662 struct ethhdr *eth_mask;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000663
664 if (cmd->fs.location >= MAX_NUM_OF_FS_RULES)
665 return -EINVAL;
666
Yan Burman520dfe32012-12-12 02:13:19 +0000667 if (cmd->fs.flow_type & FLOW_MAC_EXT) {
668 /* dest mac mask must be ff:ff:ff:ff:ff:ff */
669 if (!is_broadcast_ether_addr(cmd->fs.m_ext.h_dest))
670 return -EINVAL;
671 }
672
673 switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) {
Hadar Hen Zion82067282012-07-05 04:03:49 +0000674 case TCP_V4_FLOW:
675 case UDP_V4_FLOW:
676 if (cmd->fs.m_u.tcp_ip4_spec.tos)
677 return -EINVAL;
678 l4_mask = &cmd->fs.m_u.tcp_ip4_spec;
679 /* don't allow mask which isn't all 0 or 1 */
680 if (!all_zeros_or_all_ones(l4_mask->ip4src) ||
681 !all_zeros_or_all_ones(l4_mask->ip4dst) ||
682 !all_zeros_or_all_ones(l4_mask->psrc) ||
683 !all_zeros_or_all_ones(l4_mask->pdst))
684 return -EINVAL;
685 break;
686 case IP_USER_FLOW:
687 l3_mask = &cmd->fs.m_u.usr_ip4_spec;
688 if (l3_mask->l4_4_bytes || l3_mask->tos || l3_mask->proto ||
689 cmd->fs.h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4 ||
690 (!l3_mask->ip4src && !l3_mask->ip4dst) ||
691 !all_zeros_or_all_ones(l3_mask->ip4src) ||
692 !all_zeros_or_all_ones(l3_mask->ip4dst))
693 return -EINVAL;
694 break;
695 case ETHER_FLOW:
696 eth_mask = &cmd->fs.m_u.ether_spec;
697 /* source mac mask must not be set */
Yan Burmanc402b942012-12-12 02:13:18 +0000698 if (!is_zero_ether_addr(eth_mask->h_source))
Hadar Hen Zion82067282012-07-05 04:03:49 +0000699 return -EINVAL;
700
701 /* dest mac mask must be ff:ff:ff:ff:ff:ff */
Yan Burmanc402b942012-12-12 02:13:18 +0000702 if (!is_broadcast_ether_addr(eth_mask->h_dest))
Hadar Hen Zion82067282012-07-05 04:03:49 +0000703 return -EINVAL;
704
705 if (!all_zeros_or_all_ones(eth_mask->h_proto))
706 return -EINVAL;
707 break;
708 default:
709 return -EINVAL;
710 }
711
712 if ((cmd->fs.flow_type & FLOW_EXT)) {
713 if (cmd->fs.m_ext.vlan_etype ||
Hadar Hen Zion8258bd22013-01-30 23:07:06 +0000714 !((cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) ==
715 0 ||
716 (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) ==
717 cpu_to_be16(VLAN_VID_MASK)))
Hadar Hen Zion82067282012-07-05 04:03:49 +0000718 return -EINVAL;
Hadar Hen Zion8258bd22013-01-30 23:07:06 +0000719
Hadar Hen Zion69d71262013-01-30 23:07:05 +0000720 if (cmd->fs.m_ext.vlan_tci) {
721 if (be16_to_cpu(cmd->fs.h_ext.vlan_tci) >= VLAN_N_VID)
722 return -EINVAL;
Hadar Hen Zion8258bd22013-01-30 23:07:06 +0000723
Hadar Hen Zion69d71262013-01-30 23:07:05 +0000724 }
Hadar Hen Zion82067282012-07-05 04:03:49 +0000725 }
726
727 return 0;
728}
729
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000730static int mlx4_en_ethtool_add_mac_rule(struct ethtool_rxnfc *cmd,
731 struct list_head *rule_list_h,
732 struct mlx4_spec_list *spec_l2,
733 unsigned char *mac)
Hadar Hen Zion82067282012-07-05 04:03:49 +0000734{
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000735 int err = 0;
736 __be64 mac_msk = cpu_to_be64(MLX4_MAC_MASK << 16);
737
738 spec_l2->id = MLX4_NET_TRANS_RULE_ID_ETH;
739 memcpy(spec_l2->eth.dst_mac_msk, &mac_msk, ETH_ALEN);
740 memcpy(spec_l2->eth.dst_mac, mac, ETH_ALEN);
741
Hadar Hen Zion8258bd22013-01-30 23:07:06 +0000742 if ((cmd->fs.flow_type & FLOW_EXT) &&
743 (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK))) {
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000744 spec_l2->eth.vlan_id = cmd->fs.h_ext.vlan_tci;
Hadar Hen Zion8258bd22013-01-30 23:07:06 +0000745 spec_l2->eth.vlan_id_msk = cpu_to_be16(VLAN_VID_MASK);
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000746 }
747
748 list_add_tail(&spec_l2->list, rule_list_h);
749
750 return err;
751}
752
753static int mlx4_en_ethtool_add_mac_rule_by_ipv4(struct mlx4_en_priv *priv,
754 struct ethtool_rxnfc *cmd,
755 struct list_head *rule_list_h,
756 struct mlx4_spec_list *spec_l2,
757 __be32 ipv4_dst)
758{
Hadar Hen Zionf9d96862013-02-04 03:01:21 +0000759#ifdef CONFIG_INET
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000760 unsigned char mac[ETH_ALEN];
761
762 if (!ipv4_is_multicast(ipv4_dst)) {
Yan Burman6bbb6d92013-02-07 02:25:20 +0000763 if (cmd->fs.flow_type & FLOW_MAC_EXT)
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000764 memcpy(&mac, cmd->fs.h_ext.h_dest, ETH_ALEN);
Yan Burman6bbb6d92013-02-07 02:25:20 +0000765 else
766 memcpy(&mac, priv->dev->dev_addr, ETH_ALEN);
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000767 } else {
768 ip_eth_mc_map(ipv4_dst, mac);
769 }
770
771 return mlx4_en_ethtool_add_mac_rule(cmd, rule_list_h, spec_l2, &mac[0]);
Hadar Hen Zionf9d96862013-02-04 03:01:21 +0000772#else
773 return -EINVAL;
774#endif
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000775}
776
777static int add_ip_rule(struct mlx4_en_priv *priv,
778 struct ethtool_rxnfc *cmd,
779 struct list_head *list_h)
780{
Hadar Hen Zion377d9732013-02-04 03:01:20 +0000781 int err;
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000782 struct mlx4_spec_list *spec_l2 = NULL;
783 struct mlx4_spec_list *spec_l3 = NULL;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000784 struct ethtool_usrip4_spec *l3_mask = &cmd->fs.m_u.usr_ip4_spec;
785
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000786 spec_l3 = kzalloc(sizeof(*spec_l3), GFP_KERNEL);
787 spec_l2 = kzalloc(sizeof(*spec_l2), GFP_KERNEL);
788 if (!spec_l2 || !spec_l3) {
Hadar Hen Zion377d9732013-02-04 03:01:20 +0000789 err = -ENOMEM;
790 goto free_spec;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000791 }
792
Hadar Hen Zion377d9732013-02-04 03:01:20 +0000793 err = mlx4_en_ethtool_add_mac_rule_by_ipv4(priv, cmd, list_h, spec_l2,
794 cmd->fs.h_u.
795 usr_ip4_spec.ip4dst);
796 if (err)
797 goto free_spec;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000798 spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4;
799 spec_l3->ipv4.src_ip = cmd->fs.h_u.usr_ip4_spec.ip4src;
800 if (l3_mask->ip4src)
801 spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK;
802 spec_l3->ipv4.dst_ip = cmd->fs.h_u.usr_ip4_spec.ip4dst;
803 if (l3_mask->ip4dst)
804 spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK;
805 list_add_tail(&spec_l3->list, list_h);
806
807 return 0;
Hadar Hen Zion377d9732013-02-04 03:01:20 +0000808
809free_spec:
810 kfree(spec_l2);
811 kfree(spec_l3);
812 return err;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000813}
814
815static int add_tcp_udp_rule(struct mlx4_en_priv *priv,
816 struct ethtool_rxnfc *cmd,
817 struct list_head *list_h, int proto)
818{
Hadar Hen Zion377d9732013-02-04 03:01:20 +0000819 int err;
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000820 struct mlx4_spec_list *spec_l2 = NULL;
821 struct mlx4_spec_list *spec_l3 = NULL;
822 struct mlx4_spec_list *spec_l4 = NULL;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000823 struct ethtool_tcpip4_spec *l4_mask = &cmd->fs.m_u.tcp_ip4_spec;
824
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000825 spec_l2 = kzalloc(sizeof(*spec_l2), GFP_KERNEL);
826 spec_l3 = kzalloc(sizeof(*spec_l3), GFP_KERNEL);
827 spec_l4 = kzalloc(sizeof(*spec_l4), GFP_KERNEL);
828 if (!spec_l2 || !spec_l3 || !spec_l4) {
Hadar Hen Zion377d9732013-02-04 03:01:20 +0000829 err = -ENOMEM;
830 goto free_spec;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000831 }
832
833 spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4;
834
835 if (proto == TCP_V4_FLOW) {
Hadar Hen Zion377d9732013-02-04 03:01:20 +0000836 err = mlx4_en_ethtool_add_mac_rule_by_ipv4(priv, cmd, list_h,
837 spec_l2,
838 cmd->fs.h_u.
839 tcp_ip4_spec.ip4dst);
840 if (err)
841 goto free_spec;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000842 spec_l4->id = MLX4_NET_TRANS_RULE_ID_TCP;
843 spec_l3->ipv4.src_ip = cmd->fs.h_u.tcp_ip4_spec.ip4src;
844 spec_l3->ipv4.dst_ip = cmd->fs.h_u.tcp_ip4_spec.ip4dst;
845 spec_l4->tcp_udp.src_port = cmd->fs.h_u.tcp_ip4_spec.psrc;
846 spec_l4->tcp_udp.dst_port = cmd->fs.h_u.tcp_ip4_spec.pdst;
847 } else {
Hadar Hen Zion377d9732013-02-04 03:01:20 +0000848 err = mlx4_en_ethtool_add_mac_rule_by_ipv4(priv, cmd, list_h,
849 spec_l2,
850 cmd->fs.h_u.
851 udp_ip4_spec.ip4dst);
852 if (err)
853 goto free_spec;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000854 spec_l4->id = MLX4_NET_TRANS_RULE_ID_UDP;
855 spec_l3->ipv4.src_ip = cmd->fs.h_u.udp_ip4_spec.ip4src;
856 spec_l3->ipv4.dst_ip = cmd->fs.h_u.udp_ip4_spec.ip4dst;
857 spec_l4->tcp_udp.src_port = cmd->fs.h_u.udp_ip4_spec.psrc;
858 spec_l4->tcp_udp.dst_port = cmd->fs.h_u.udp_ip4_spec.pdst;
859 }
860
861 if (l4_mask->ip4src)
862 spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK;
863 if (l4_mask->ip4dst)
864 spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK;
865
866 if (l4_mask->psrc)
867 spec_l4->tcp_udp.src_port_msk = EN_ETHTOOL_SHORT_MASK;
868 if (l4_mask->pdst)
869 spec_l4->tcp_udp.dst_port_msk = EN_ETHTOOL_SHORT_MASK;
870
871 list_add_tail(&spec_l3->list, list_h);
872 list_add_tail(&spec_l4->list, list_h);
873
874 return 0;
Hadar Hen Zion377d9732013-02-04 03:01:20 +0000875
876free_spec:
877 kfree(spec_l2);
878 kfree(spec_l3);
879 kfree(spec_l4);
880 return err;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000881}
882
883static int mlx4_en_ethtool_to_net_trans_rule(struct net_device *dev,
884 struct ethtool_rxnfc *cmd,
885 struct list_head *rule_list_h)
886{
887 int err;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000888 struct ethhdr *eth_spec;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000889 struct mlx4_spec_list *spec_l2;
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000890 struct mlx4_en_priv *priv = netdev_priv(dev);
Hadar Hen Zion82067282012-07-05 04:03:49 +0000891
892 err = mlx4_en_validate_flow(dev, cmd);
893 if (err)
894 return err;
895
Yan Burman520dfe32012-12-12 02:13:19 +0000896 switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) {
Hadar Hen Zion82067282012-07-05 04:03:49 +0000897 case ETHER_FLOW:
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000898 spec_l2 = kzalloc(sizeof(*spec_l2), GFP_KERNEL);
899 if (!spec_l2)
900 return -ENOMEM;
901
Hadar Hen Zion82067282012-07-05 04:03:49 +0000902 eth_spec = &cmd->fs.h_u.ether_spec;
Hadar Hen Zionf90a3672013-01-30 23:07:04 +0000903 mlx4_en_ethtool_add_mac_rule(cmd, rule_list_h, spec_l2,
904 &eth_spec->h_dest[0]);
Hadar Hen Zion82067282012-07-05 04:03:49 +0000905 spec_l2->eth.ether_type = eth_spec->h_proto;
906 if (eth_spec->h_proto)
907 spec_l2->eth.ether_type_enable = 1;
908 break;
909 case IP_USER_FLOW:
910 err = add_ip_rule(priv, cmd, rule_list_h);
911 break;
912 case TCP_V4_FLOW:
913 err = add_tcp_udp_rule(priv, cmd, rule_list_h, TCP_V4_FLOW);
914 break;
915 case UDP_V4_FLOW:
916 err = add_tcp_udp_rule(priv, cmd, rule_list_h, UDP_V4_FLOW);
917 break;
918 }
919
920 return err;
921}
922
923static int mlx4_en_flow_replace(struct net_device *dev,
924 struct ethtool_rxnfc *cmd)
925{
926 int err;
927 struct mlx4_en_priv *priv = netdev_priv(dev);
928 struct ethtool_flow_id *loc_rule;
929 struct mlx4_spec_list *spec, *tmp_spec;
930 u32 qpn;
931 u64 reg_id;
932
933 struct mlx4_net_trans_rule rule = {
934 .queue_mode = MLX4_NET_TRANS_Q_FIFO,
935 .exclusive = 0,
936 .allow_loopback = 1,
Hadar Hen Zionf9162532013-04-24 13:58:45 +0000937 .promisc_mode = MLX4_FS_REGULAR,
Hadar Hen Zion82067282012-07-05 04:03:49 +0000938 };
939
940 rule.port = priv->port;
941 rule.priority = MLX4_DOMAIN_ETHTOOL | cmd->fs.location;
942 INIT_LIST_HEAD(&rule.list);
943
944 /* Allow direct QP attaches if the EN_ETHTOOL_QP_ATTACH flag is set */
945 if (cmd->fs.ring_cookie == RX_CLS_FLOW_DISC)
Hadar Hen Zioncabdc8ee2012-07-05 04:03:50 +0000946 qpn = priv->drop_qp.qpn;
Hadar Hen Zion82067282012-07-05 04:03:49 +0000947 else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) {
948 qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1);
949 } else {
950 if (cmd->fs.ring_cookie >= priv->rx_ring_num) {
Joe Perches1a91de22014-05-07 12:52:57 -0700951 en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n",
Hadar Hen Zion82067282012-07-05 04:03:49 +0000952 cmd->fs.ring_cookie);
953 return -EINVAL;
954 }
955 qpn = priv->rss_map.qps[cmd->fs.ring_cookie].qpn;
956 if (!qpn) {
Joe Perches1a91de22014-05-07 12:52:57 -0700957 en_warn(priv, "rxnfc: RX ring (%llu) is inactive\n",
Hadar Hen Zion82067282012-07-05 04:03:49 +0000958 cmd->fs.ring_cookie);
959 return -EINVAL;
960 }
961 }
962 rule.qpn = qpn;
963 err = mlx4_en_ethtool_to_net_trans_rule(dev, cmd, &rule.list);
964 if (err)
965 goto out_free_list;
966
967 loc_rule = &priv->ethtool_rules[cmd->fs.location];
968 if (loc_rule->id) {
969 err = mlx4_flow_detach(priv->mdev->dev, loc_rule->id);
970 if (err) {
971 en_err(priv, "Fail to detach network rule at location %d. registration id = %llx\n",
972 cmd->fs.location, loc_rule->id);
973 goto out_free_list;
974 }
975 loc_rule->id = 0;
976 memset(&loc_rule->flow_spec, 0,
977 sizeof(struct ethtool_rx_flow_spec));
Hadar Hen Zion0d256c02013-01-30 23:07:08 +0000978 list_del(&loc_rule->list);
Hadar Hen Zion82067282012-07-05 04:03:49 +0000979 }
980 err = mlx4_flow_attach(priv->mdev->dev, &rule, &reg_id);
981 if (err) {
Joe Perches1a91de22014-05-07 12:52:57 -0700982 en_err(priv, "Fail to attach network rule at location %d\n",
Hadar Hen Zion82067282012-07-05 04:03:49 +0000983 cmd->fs.location);
984 goto out_free_list;
985 }
986 loc_rule->id = reg_id;
987 memcpy(&loc_rule->flow_spec, &cmd->fs,
988 sizeof(struct ethtool_rx_flow_spec));
Hadar Hen Zion0d256c02013-01-30 23:07:08 +0000989 list_add_tail(&loc_rule->list, &priv->ethtool_list);
Hadar Hen Zion82067282012-07-05 04:03:49 +0000990
991out_free_list:
992 list_for_each_entry_safe(spec, tmp_spec, &rule.list, list) {
993 list_del(&spec->list);
994 kfree(spec);
995 }
996 return err;
997}
998
999static int mlx4_en_flow_detach(struct net_device *dev,
1000 struct ethtool_rxnfc *cmd)
1001{
1002 int err = 0;
1003 struct ethtool_flow_id *rule;
1004 struct mlx4_en_priv *priv = netdev_priv(dev);
1005
1006 if (cmd->fs.location >= MAX_NUM_OF_FS_RULES)
1007 return -EINVAL;
1008
1009 rule = &priv->ethtool_rules[cmd->fs.location];
1010 if (!rule->id) {
1011 err = -ENOENT;
1012 goto out;
1013 }
1014
1015 err = mlx4_flow_detach(priv->mdev->dev, rule->id);
1016 if (err) {
1017 en_err(priv, "Fail to detach network rule at location %d. registration id = 0x%llx\n",
1018 cmd->fs.location, rule->id);
1019 goto out;
1020 }
1021 rule->id = 0;
1022 memset(&rule->flow_spec, 0, sizeof(struct ethtool_rx_flow_spec));
Hadar Hen Zion0d256c02013-01-30 23:07:08 +00001023 list_del(&rule->list);
Hadar Hen Zion82067282012-07-05 04:03:49 +00001024out:
1025 return err;
1026
1027}
1028
1029static int mlx4_en_get_flow(struct net_device *dev, struct ethtool_rxnfc *cmd,
1030 int loc)
1031{
1032 int err = 0;
1033 struct ethtool_flow_id *rule;
1034 struct mlx4_en_priv *priv = netdev_priv(dev);
1035
1036 if (loc < 0 || loc >= MAX_NUM_OF_FS_RULES)
1037 return -EINVAL;
1038
1039 rule = &priv->ethtool_rules[loc];
1040 if (rule->id)
1041 memcpy(&cmd->fs, &rule->flow_spec,
1042 sizeof(struct ethtool_rx_flow_spec));
1043 else
1044 err = -ENOENT;
1045
1046 return err;
1047}
1048
1049static int mlx4_en_get_num_flows(struct mlx4_en_priv *priv)
1050{
1051
1052 int i, res = 0;
1053 for (i = 0; i < MAX_NUM_OF_FS_RULES; i++) {
1054 if (priv->ethtool_rules[i].id)
1055 res++;
1056 }
1057 return res;
1058
1059}
1060
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +00001061static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
1062 u32 *rule_locs)
1063{
1064 struct mlx4_en_priv *priv = netdev_priv(dev);
Hadar Hen Zion82067282012-07-05 04:03:49 +00001065 struct mlx4_en_dev *mdev = priv->mdev;
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +00001066 int err = 0;
Hadar Hen Zion82067282012-07-05 04:03:49 +00001067 int i = 0, priority = 0;
1068
1069 if ((cmd->cmd == ETHTOOL_GRXCLSRLCNT ||
1070 cmd->cmd == ETHTOOL_GRXCLSRULE ||
1071 cmd->cmd == ETHTOOL_GRXCLSRLALL) &&
Hadar Hen Zion280fce12013-01-30 23:07:07 +00001072 (mdev->dev->caps.steering_mode !=
1073 MLX4_STEERING_MODE_DEVICE_MANAGED || !priv->port_up))
Hadar Hen Zion82067282012-07-05 04:03:49 +00001074 return -EINVAL;
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +00001075
1076 switch (cmd->cmd) {
1077 case ETHTOOL_GRXRINGS:
1078 cmd->data = priv->rx_ring_num;
1079 break;
Hadar Hen Zion82067282012-07-05 04:03:49 +00001080 case ETHTOOL_GRXCLSRLCNT:
1081 cmd->rule_cnt = mlx4_en_get_num_flows(priv);
1082 break;
1083 case ETHTOOL_GRXCLSRULE:
1084 err = mlx4_en_get_flow(dev, cmd, cmd->fs.location);
1085 break;
1086 case ETHTOOL_GRXCLSRLALL:
1087 while ((!err || err == -ENOENT) && priority < cmd->rule_cnt) {
1088 err = mlx4_en_get_flow(dev, cmd, i);
1089 if (!err)
1090 rule_locs[priority++] = i;
1091 i++;
1092 }
1093 err = 0;
1094 break;
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +00001095 default:
1096 err = -EOPNOTSUPP;
1097 break;
1098 }
1099
1100 return err;
1101}
1102
Hadar Hen Zion82067282012-07-05 04:03:49 +00001103static int mlx4_en_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
1104{
1105 int err = 0;
1106 struct mlx4_en_priv *priv = netdev_priv(dev);
1107 struct mlx4_en_dev *mdev = priv->mdev;
1108
Hadar Hen Zion280fce12013-01-30 23:07:07 +00001109 if (mdev->dev->caps.steering_mode !=
1110 MLX4_STEERING_MODE_DEVICE_MANAGED || !priv->port_up)
Hadar Hen Zion82067282012-07-05 04:03:49 +00001111 return -EINVAL;
1112
1113 switch (cmd->cmd) {
1114 case ETHTOOL_SRXCLSRLINS:
1115 err = mlx4_en_flow_replace(dev, cmd);
1116 break;
1117 case ETHTOOL_SRXCLSRLDEL:
1118 err = mlx4_en_flow_detach(dev, cmd);
1119 break;
1120 default:
1121 en_warn(priv, "Unsupported ethtool command. (%d)\n", cmd->cmd);
1122 return -EINVAL;
1123 }
1124
1125 return err;
1126}
1127
Amir Vadaid3179662012-12-02 03:49:23 +00001128static void mlx4_en_get_channels(struct net_device *dev,
1129 struct ethtool_channels *channel)
1130{
1131 struct mlx4_en_priv *priv = netdev_priv(dev);
1132
1133 memset(channel, 0, sizeof(*channel));
1134
1135 channel->max_rx = MAX_RX_RINGS;
1136 channel->max_tx = MLX4_EN_MAX_TX_RING_P_UP;
1137
1138 channel->rx_count = priv->rx_ring_num;
1139 channel->tx_count = priv->tx_ring_num / MLX4_EN_NUM_UP;
1140}
1141
1142static int mlx4_en_set_channels(struct net_device *dev,
1143 struct ethtool_channels *channel)
1144{
1145 struct mlx4_en_priv *priv = netdev_priv(dev);
1146 struct mlx4_en_dev *mdev = priv->mdev;
Christian Engelmayerda26a622014-05-17 23:52:03 +02001147 int port_up = 0;
Amir Vadaid3179662012-12-02 03:49:23 +00001148 int err = 0;
1149
1150 if (channel->other_count || channel->combined_count ||
1151 channel->tx_count > MLX4_EN_MAX_TX_RING_P_UP ||
1152 channel->rx_count > MAX_RX_RINGS ||
1153 !channel->tx_count || !channel->rx_count)
1154 return -EINVAL;
1155
1156 mutex_lock(&mdev->state_lock);
1157 if (priv->port_up) {
1158 port_up = 1;
Amir Vadai3484aac2013-01-30 23:07:11 +00001159 mlx4_en_stop_port(dev, 1);
Amir Vadaid3179662012-12-02 03:49:23 +00001160 }
1161
1162 mlx4_en_free_resources(priv);
1163
1164 priv->num_tx_rings_p_up = channel->tx_count;
1165 priv->tx_ring_num = channel->tx_count * MLX4_EN_NUM_UP;
1166 priv->rx_ring_num = channel->rx_count;
1167
1168 err = mlx4_en_alloc_resources(priv);
1169 if (err) {
1170 en_err(priv, "Failed reallocating port resources\n");
1171 goto out;
1172 }
1173
1174 netif_set_real_num_tx_queues(dev, priv->tx_ring_num);
1175 netif_set_real_num_rx_queues(dev, priv->rx_ring_num);
1176
Ido Shamayf5b63452014-05-14 12:15:11 +03001177 if (dev->num_tc)
1178 mlx4_en_setup_tc(dev, MLX4_EN_NUM_UP);
Amir Vadaid3179662012-12-02 03:49:23 +00001179
1180 en_warn(priv, "Using %d TX rings\n", priv->tx_ring_num);
1181 en_warn(priv, "Using %d RX rings\n", priv->rx_ring_num);
1182
1183 if (port_up) {
1184 err = mlx4_en_start_port(dev);
1185 if (err)
1186 en_err(priv, "Failed starting port\n");
1187 }
1188
1189 err = mlx4_en_moderation_update(priv);
1190
1191out:
1192 mutex_unlock(&mdev->state_lock);
1193 return err;
1194}
1195
Amir Vadaiec693d42013-04-23 06:06:49 +00001196static int mlx4_en_get_ts_info(struct net_device *dev,
1197 struct ethtool_ts_info *info)
1198{
1199 struct mlx4_en_priv *priv = netdev_priv(dev);
1200 struct mlx4_en_dev *mdev = priv->mdev;
1201 int ret;
1202
1203 ret = ethtool_op_get_ts_info(dev, info);
1204 if (ret)
1205 return ret;
1206
1207 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) {
1208 info->so_timestamping |=
1209 SOF_TIMESTAMPING_TX_HARDWARE |
1210 SOF_TIMESTAMPING_RX_HARDWARE |
1211 SOF_TIMESTAMPING_RAW_HARDWARE;
1212
1213 info->tx_types =
1214 (1 << HWTSTAMP_TX_OFF) |
1215 (1 << HWTSTAMP_TX_ON);
1216
1217 info->rx_filters =
1218 (1 << HWTSTAMP_FILTER_NONE) |
1219 (1 << HWTSTAMP_FILTER_ALL);
Shawn Bohrerad7d4ea2013-12-31 11:39:39 -06001220
1221 if (mdev->ptp_clock)
1222 info->phc_index = ptp_clock_index(mdev->ptp_clock);
Amir Vadaiec693d42013-04-23 06:06:49 +00001223 }
1224
1225 return ret;
1226}
1227
Fengguang Wu3f6148e2014-07-24 09:11:46 +03001228static int mlx4_en_set_priv_flags(struct net_device *dev, u32 flags)
Amir Vadai0fef9d02014-07-22 15:44:10 +03001229{
1230 struct mlx4_en_priv *priv = netdev_priv(dev);
1231 bool bf_enabled_new = !!(flags & MLX4_EN_PRIV_FLAGS_BLUEFLAME);
1232 bool bf_enabled_old = !!(priv->pflags & MLX4_EN_PRIV_FLAGS_BLUEFLAME);
1233 int i;
1234
1235 if (bf_enabled_new == bf_enabled_old)
1236 return 0; /* Nothing to do */
1237
1238 if (bf_enabled_new) {
1239 bool bf_supported = true;
1240
1241 for (i = 0; i < priv->tx_ring_num; i++)
1242 bf_supported &= priv->tx_ring[i]->bf_alloced;
1243
1244 if (!bf_supported) {
1245 en_err(priv, "BlueFlame is not supported\n");
1246 return -EINVAL;
1247 }
1248
1249 priv->pflags |= MLX4_EN_PRIV_FLAGS_BLUEFLAME;
1250 } else {
1251 priv->pflags &= ~MLX4_EN_PRIV_FLAGS_BLUEFLAME;
1252 }
1253
1254 for (i = 0; i < priv->tx_ring_num; i++)
1255 priv->tx_ring[i]->bf_enabled = bf_enabled_new;
1256
1257 en_info(priv, "BlueFlame %s\n",
1258 bf_enabled_new ? "Enabled" : "Disabled");
1259
1260 return 0;
1261}
1262
Fengguang Wu3f6148e2014-07-24 09:11:46 +03001263static u32 mlx4_en_get_priv_flags(struct net_device *dev)
Amir Vadai0fef9d02014-07-22 15:44:10 +03001264{
1265 struct mlx4_en_priv *priv = netdev_priv(dev);
1266
1267 return priv->pflags;
1268}
1269
Eric Dumazet1556b872014-10-05 12:35:22 +03001270static int mlx4_en_get_tunable(struct net_device *dev,
1271 const struct ethtool_tunable *tuna,
1272 void *data)
1273{
1274 const struct mlx4_en_priv *priv = netdev_priv(dev);
1275 int ret = 0;
1276
1277 switch (tuna->id) {
1278 case ETHTOOL_TX_COPYBREAK:
1279 *(u32 *)data = priv->prof->inline_thold;
1280 break;
1281 default:
1282 ret = -EINVAL;
1283 break;
1284 }
1285
1286 return ret;
1287}
1288
1289static int mlx4_en_set_tunable(struct net_device *dev,
1290 const struct ethtool_tunable *tuna,
1291 const void *data)
1292{
1293 struct mlx4_en_priv *priv = netdev_priv(dev);
1294 int val, ret = 0;
1295
1296 switch (tuna->id) {
1297 case ETHTOOL_TX_COPYBREAK:
1298 val = *(u32 *)data;
1299 if (val < MIN_PKT_LEN || val > MAX_INLINE)
1300 ret = -EINVAL;
1301 else
1302 priv->prof->inline_thold = val;
1303 break;
1304 default:
1305 ret = -EINVAL;
1306 break;
1307 }
1308
1309 return ret;
1310}
1311
Amir Vadai0fef9d02014-07-22 15:44:10 +03001312
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -07001313const struct ethtool_ops mlx4_en_ethtool_ops = {
1314 .get_drvinfo = mlx4_en_get_drvinfo,
1315 .get_settings = mlx4_en_get_settings,
1316 .set_settings = mlx4_en_set_settings,
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -07001317 .get_link = ethtool_op_get_link,
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -07001318 .get_strings = mlx4_en_get_strings,
1319 .get_sset_count = mlx4_en_get_sset_count,
1320 .get_ethtool_stats = mlx4_en_get_ethtool_stats,
Yevgeny Petriline7c1c2c42010-08-24 03:46:18 +00001321 .self_test = mlx4_en_self_test,
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -07001322 .get_wol = mlx4_en_get_wol,
Yevgeny Petrilin14c07b12011-03-22 22:37:59 +00001323 .set_wol = mlx4_en_set_wol,
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -07001324 .get_msglevel = mlx4_en_get_msglevel,
1325 .set_msglevel = mlx4_en_set_msglevel,
1326 .get_coalesce = mlx4_en_get_coalesce,
1327 .set_coalesce = mlx4_en_set_coalesce,
1328 .get_pauseparam = mlx4_en_get_pauseparam,
1329 .set_pauseparam = mlx4_en_set_pauseparam,
1330 .get_ringparam = mlx4_en_get_ringparam,
Yevgeny Petrilin18cc42a2008-12-29 18:39:20 -08001331 .set_ringparam = mlx4_en_set_ringparam,
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +00001332 .get_rxnfc = mlx4_en_get_rxnfc,
Hadar Hen Zion82067282012-07-05 04:03:49 +00001333 .set_rxnfc = mlx4_en_set_rxnfc,
Yevgeny Petrilin93d3e362012-01-17 22:54:55 +00001334 .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size,
Ben Hutchingsfe62d002014-05-15 01:25:27 +01001335 .get_rxfh = mlx4_en_get_rxfh,
1336 .set_rxfh = mlx4_en_set_rxfh,
Amir Vadaid3179662012-12-02 03:49:23 +00001337 .get_channels = mlx4_en_get_channels,
1338 .set_channels = mlx4_en_set_channels,
Amir Vadaiec693d42013-04-23 06:06:49 +00001339 .get_ts_info = mlx4_en_get_ts_info,
Amir Vadai0fef9d02014-07-22 15:44:10 +03001340 .set_priv_flags = mlx4_en_set_priv_flags,
1341 .get_priv_flags = mlx4_en_get_priv_flags,
Eric Dumazet1556b872014-10-05 12:35:22 +03001342 .get_tunable = mlx4_en_get_tunable,
1343 .set_tunable = mlx4_en_set_tunable,
Yevgeny Petrilinc27a02c2008-10-22 15:47:49 -07001344};
1345
1346
1347
1348
1349