Loading...
Note: File does not exist in v6.8.
1/*******************************************************************************
2 *
3 * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
4 * Copyright(c) 2013 - 2016 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
20 *
21 * Contact Information:
22 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24 *
25 ******************************************************************************/
26
27/* ethtool support for i40evf */
28#include "i40evf.h"
29
30#include <linux/uaccess.h>
31
32struct i40evf_stats {
33 char stat_string[ETH_GSTRING_LEN];
34 int stat_offset;
35};
36
37#define I40EVF_STAT(_name, _stat) { \
38 .stat_string = _name, \
39 .stat_offset = offsetof(struct i40evf_adapter, _stat) \
40}
41
42/* All stats are u64, so we don't need to track the size of the field. */
43static const struct i40evf_stats i40evf_gstrings_stats[] = {
44 I40EVF_STAT("rx_bytes", current_stats.rx_bytes),
45 I40EVF_STAT("rx_unicast", current_stats.rx_unicast),
46 I40EVF_STAT("rx_multicast", current_stats.rx_multicast),
47 I40EVF_STAT("rx_broadcast", current_stats.rx_broadcast),
48 I40EVF_STAT("rx_discards", current_stats.rx_discards),
49 I40EVF_STAT("rx_unknown_protocol", current_stats.rx_unknown_protocol),
50 I40EVF_STAT("tx_bytes", current_stats.tx_bytes),
51 I40EVF_STAT("tx_unicast", current_stats.tx_unicast),
52 I40EVF_STAT("tx_multicast", current_stats.tx_multicast),
53 I40EVF_STAT("tx_broadcast", current_stats.tx_broadcast),
54 I40EVF_STAT("tx_discards", current_stats.tx_discards),
55 I40EVF_STAT("tx_errors", current_stats.tx_errors),
56};
57
58#define I40EVF_GLOBAL_STATS_LEN ARRAY_SIZE(i40evf_gstrings_stats)
59#define I40EVF_QUEUE_STATS_LEN(_dev) \
60 (((struct i40evf_adapter *)\
61 netdev_priv(_dev))->num_active_queues \
62 * 2 * (sizeof(struct i40e_queue_stats) / sizeof(u64)))
63#define I40EVF_STATS_LEN(_dev) \
64 (I40EVF_GLOBAL_STATS_LEN + I40EVF_QUEUE_STATS_LEN(_dev))
65
66/**
67 * i40evf_get_settings - Get Link Speed and Duplex settings
68 * @netdev: network interface device structure
69 * @ecmd: ethtool command
70 *
71 * Reports speed/duplex settings. Because this is a VF, we don't know what
72 * kind of link we really have, so we fake it.
73 **/
74static int i40evf_get_settings(struct net_device *netdev,
75 struct ethtool_cmd *ecmd)
76{
77 struct i40evf_adapter *adapter = netdev_priv(netdev);
78
79 ecmd->supported = 0;
80 ecmd->autoneg = AUTONEG_DISABLE;
81 ecmd->transceiver = XCVR_DUMMY1;
82 ecmd->port = PORT_NONE;
83 /* Set speed and duplex */
84 switch (adapter->link_speed) {
85 case I40E_LINK_SPEED_40GB:
86 ethtool_cmd_speed_set(ecmd, SPEED_40000);
87 break;
88 case I40E_LINK_SPEED_25GB:
89#ifdef SPEED_25000
90 ethtool_cmd_speed_set(ecmd, SPEED_25000);
91#else
92 netdev_info(netdev,
93 "Speed is 25G, display not supported by this version of ethtool.\n");
94#endif
95 break;
96 case I40E_LINK_SPEED_20GB:
97 ethtool_cmd_speed_set(ecmd, SPEED_20000);
98 break;
99 case I40E_LINK_SPEED_10GB:
100 ethtool_cmd_speed_set(ecmd, SPEED_10000);
101 break;
102 case I40E_LINK_SPEED_1GB:
103 ethtool_cmd_speed_set(ecmd, SPEED_1000);
104 break;
105 case I40E_LINK_SPEED_100MB:
106 ethtool_cmd_speed_set(ecmd, SPEED_100);
107 break;
108 default:
109 break;
110 }
111 ecmd->duplex = DUPLEX_FULL;
112
113 return 0;
114}
115
116/**
117 * i40evf_get_sset_count - Get length of string set
118 * @netdev: network interface device structure
119 * @sset: id of string set
120 *
121 * Reports size of string table. This driver only supports
122 * strings for statistics.
123 **/
124static int i40evf_get_sset_count(struct net_device *netdev, int sset)
125{
126 if (sset == ETH_SS_STATS)
127 return I40EVF_STATS_LEN(netdev);
128 else
129 return -EINVAL;
130}
131
132/**
133 * i40evf_get_ethtool_stats - report device statistics
134 * @netdev: network interface device structure
135 * @stats: ethtool statistics structure
136 * @data: pointer to data buffer
137 *
138 * All statistics are added to the data buffer as an array of u64.
139 **/
140static void i40evf_get_ethtool_stats(struct net_device *netdev,
141 struct ethtool_stats *stats, u64 *data)
142{
143 struct i40evf_adapter *adapter = netdev_priv(netdev);
144 int i, j;
145 char *p;
146
147 for (i = 0; i < I40EVF_GLOBAL_STATS_LEN; i++) {
148 p = (char *)adapter + i40evf_gstrings_stats[i].stat_offset;
149 data[i] = *(u64 *)p;
150 }
151 for (j = 0; j < adapter->num_active_queues; j++) {
152 data[i++] = adapter->tx_rings[j].stats.packets;
153 data[i++] = adapter->tx_rings[j].stats.bytes;
154 }
155 for (j = 0; j < adapter->num_active_queues; j++) {
156 data[i++] = adapter->rx_rings[j].stats.packets;
157 data[i++] = adapter->rx_rings[j].stats.bytes;
158 }
159}
160
161/**
162 * i40evf_get_strings - Get string set
163 * @netdev: network interface device structure
164 * @sset: id of string set
165 * @data: buffer for string data
166 *
167 * Builds stats string table.
168 **/
169static void i40evf_get_strings(struct net_device *netdev, u32 sset, u8 *data)
170{
171 struct i40evf_adapter *adapter = netdev_priv(netdev);
172 u8 *p = data;
173 int i;
174
175 if (sset == ETH_SS_STATS) {
176 for (i = 0; i < I40EVF_GLOBAL_STATS_LEN; i++) {
177 memcpy(p, i40evf_gstrings_stats[i].stat_string,
178 ETH_GSTRING_LEN);
179 p += ETH_GSTRING_LEN;
180 }
181 for (i = 0; i < adapter->num_active_queues; i++) {
182 snprintf(p, ETH_GSTRING_LEN, "tx-%u.packets", i);
183 p += ETH_GSTRING_LEN;
184 snprintf(p, ETH_GSTRING_LEN, "tx-%u.bytes", i);
185 p += ETH_GSTRING_LEN;
186 }
187 for (i = 0; i < adapter->num_active_queues; i++) {
188 snprintf(p, ETH_GSTRING_LEN, "rx-%u.packets", i);
189 p += ETH_GSTRING_LEN;
190 snprintf(p, ETH_GSTRING_LEN, "rx-%u.bytes", i);
191 p += ETH_GSTRING_LEN;
192 }
193 }
194}
195
196/**
197 * i40evf_get_msglevel - Get debug message level
198 * @netdev: network interface device structure
199 *
200 * Returns current debug message level.
201 **/
202static u32 i40evf_get_msglevel(struct net_device *netdev)
203{
204 struct i40evf_adapter *adapter = netdev_priv(netdev);
205
206 return adapter->msg_enable;
207}
208
209/**
210 * i40evf_set_msglevel - Set debug message level
211 * @netdev: network interface device structure
212 * @data: message level
213 *
214 * Set current debug message level. Higher values cause the driver to
215 * be noisier.
216 **/
217static void i40evf_set_msglevel(struct net_device *netdev, u32 data)
218{
219 struct i40evf_adapter *adapter = netdev_priv(netdev);
220
221 if (I40E_DEBUG_USER & data)
222 adapter->hw.debug_mask = data;
223 adapter->msg_enable = data;
224}
225
226/**
227 * i40evf_get_drvinfo - Get driver info
228 * @netdev: network interface device structure
229 * @drvinfo: ethool driver info structure
230 *
231 * Returns information about the driver and device for display to the user.
232 **/
233static void i40evf_get_drvinfo(struct net_device *netdev,
234 struct ethtool_drvinfo *drvinfo)
235{
236 struct i40evf_adapter *adapter = netdev_priv(netdev);
237
238 strlcpy(drvinfo->driver, i40evf_driver_name, 32);
239 strlcpy(drvinfo->version, i40evf_driver_version, 32);
240 strlcpy(drvinfo->fw_version, "N/A", 4);
241 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
242}
243
244/**
245 * i40evf_get_ringparam - Get ring parameters
246 * @netdev: network interface device structure
247 * @ring: ethtool ringparam structure
248 *
249 * Returns current ring parameters. TX and RX rings are reported separately,
250 * but the number of rings is not reported.
251 **/
252static void i40evf_get_ringparam(struct net_device *netdev,
253 struct ethtool_ringparam *ring)
254{
255 struct i40evf_adapter *adapter = netdev_priv(netdev);
256
257 ring->rx_max_pending = I40EVF_MAX_RXD;
258 ring->tx_max_pending = I40EVF_MAX_TXD;
259 ring->rx_pending = adapter->rx_desc_count;
260 ring->tx_pending = adapter->tx_desc_count;
261}
262
263/**
264 * i40evf_set_ringparam - Set ring parameters
265 * @netdev: network interface device structure
266 * @ring: ethtool ringparam structure
267 *
268 * Sets ring parameters. TX and RX rings are controlled separately, but the
269 * number of rings is not specified, so all rings get the same settings.
270 **/
271static int i40evf_set_ringparam(struct net_device *netdev,
272 struct ethtool_ringparam *ring)
273{
274 struct i40evf_adapter *adapter = netdev_priv(netdev);
275 u32 new_rx_count, new_tx_count;
276
277 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
278 return -EINVAL;
279
280 new_tx_count = clamp_t(u32, ring->tx_pending,
281 I40EVF_MIN_TXD,
282 I40EVF_MAX_TXD);
283 new_tx_count = ALIGN(new_tx_count, I40EVF_REQ_DESCRIPTOR_MULTIPLE);
284
285 new_rx_count = clamp_t(u32, ring->rx_pending,
286 I40EVF_MIN_RXD,
287 I40EVF_MAX_RXD);
288 new_rx_count = ALIGN(new_rx_count, I40EVF_REQ_DESCRIPTOR_MULTIPLE);
289
290 /* if nothing to do return success */
291 if ((new_tx_count == adapter->tx_desc_count) &&
292 (new_rx_count == adapter->rx_desc_count))
293 return 0;
294
295 adapter->tx_desc_count = new_tx_count;
296 adapter->rx_desc_count = new_rx_count;
297
298 if (netif_running(netdev)) {
299 adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
300 schedule_work(&adapter->reset_task);
301 }
302
303 return 0;
304}
305
306/**
307 * __i40evf_get_coalesce - get per-queue coalesce settings
308 * @netdev: the netdev to check
309 * @ec: ethtool coalesce data structure
310 * @queue: which queue to pick
311 *
312 * Gets the per-queue settings for coalescence. Specifically Rx and Tx usecs
313 * are per queue. If queue is <0 then we default to queue 0 as the
314 * representative value.
315 **/
316static int __i40evf_get_coalesce(struct net_device *netdev,
317 struct ethtool_coalesce *ec,
318 int queue)
319{
320 struct i40evf_adapter *adapter = netdev_priv(netdev);
321 struct i40e_vsi *vsi = &adapter->vsi;
322 struct i40e_ring *rx_ring, *tx_ring;
323
324 ec->tx_max_coalesced_frames = vsi->work_limit;
325 ec->rx_max_coalesced_frames = vsi->work_limit;
326
327 /* Rx and Tx usecs per queue value. If user doesn't specify the
328 * queue, return queue 0's value to represent.
329 */
330 if (queue < 0)
331 queue = 0;
332 else if (queue >= adapter->num_active_queues)
333 return -EINVAL;
334
335 rx_ring = &adapter->rx_rings[queue];
336 tx_ring = &adapter->tx_rings[queue];
337
338 if (ITR_IS_DYNAMIC(rx_ring->rx_itr_setting))
339 ec->use_adaptive_rx_coalesce = 1;
340
341 if (ITR_IS_DYNAMIC(tx_ring->tx_itr_setting))
342 ec->use_adaptive_tx_coalesce = 1;
343
344 ec->rx_coalesce_usecs = rx_ring->rx_itr_setting & ~I40E_ITR_DYNAMIC;
345 ec->tx_coalesce_usecs = tx_ring->tx_itr_setting & ~I40E_ITR_DYNAMIC;
346
347 return 0;
348}
349
350/**
351 * i40evf_get_coalesce - Get interrupt coalescing settings
352 * @netdev: network interface device structure
353 * @ec: ethtool coalesce structure
354 *
355 * Returns current coalescing settings. This is referred to elsewhere in the
356 * driver as Interrupt Throttle Rate, as this is how the hardware describes
357 * this functionality. Note that if per-queue settings have been modified this
358 * only represents the settings of queue 0.
359 **/
360static int i40evf_get_coalesce(struct net_device *netdev,
361 struct ethtool_coalesce *ec)
362{
363 return __i40evf_get_coalesce(netdev, ec, -1);
364}
365
366/**
367 * i40evf_get_per_queue_coalesce - get coalesce values for specific queue
368 * @netdev: netdev to read
369 * @ec: coalesce settings from ethtool
370 * @queue: the queue to read
371 *
372 * Read specific queue's coalesce settings.
373 **/
374static int i40evf_get_per_queue_coalesce(struct net_device *netdev,
375 u32 queue,
376 struct ethtool_coalesce *ec)
377{
378 return __i40evf_get_coalesce(netdev, ec, queue);
379}
380
381/**
382 * i40evf_set_itr_per_queue - set ITR values for specific queue
383 * @vsi: the VSI to set values for
384 * @ec: coalesce settings from ethtool
385 * @queue: the queue to modify
386 *
387 * Change the ITR settings for a specific queue.
388 **/
389static void i40evf_set_itr_per_queue(struct i40evf_adapter *adapter,
390 struct ethtool_coalesce *ec,
391 int queue)
392{
393 struct i40e_vsi *vsi = &adapter->vsi;
394 struct i40e_hw *hw = &adapter->hw;
395 struct i40e_q_vector *q_vector;
396 u16 vector;
397
398 adapter->rx_rings[queue].rx_itr_setting = ec->rx_coalesce_usecs;
399 adapter->tx_rings[queue].tx_itr_setting = ec->tx_coalesce_usecs;
400
401 if (ec->use_adaptive_rx_coalesce)
402 adapter->rx_rings[queue].rx_itr_setting |= I40E_ITR_DYNAMIC;
403 else
404 adapter->rx_rings[queue].rx_itr_setting &= ~I40E_ITR_DYNAMIC;
405
406 if (ec->use_adaptive_tx_coalesce)
407 adapter->tx_rings[queue].tx_itr_setting |= I40E_ITR_DYNAMIC;
408 else
409 adapter->tx_rings[queue].tx_itr_setting &= ~I40E_ITR_DYNAMIC;
410
411 q_vector = adapter->rx_rings[queue].q_vector;
412 q_vector->rx.itr = ITR_TO_REG(adapter->rx_rings[queue].rx_itr_setting);
413 vector = vsi->base_vector + q_vector->v_idx;
414 wr32(hw, I40E_VFINT_ITRN1(I40E_RX_ITR, vector - 1), q_vector->rx.itr);
415
416 q_vector = adapter->tx_rings[queue].q_vector;
417 q_vector->tx.itr = ITR_TO_REG(adapter->tx_rings[queue].tx_itr_setting);
418 vector = vsi->base_vector + q_vector->v_idx;
419 wr32(hw, I40E_VFINT_ITRN1(I40E_TX_ITR, vector - 1), q_vector->tx.itr);
420
421 i40e_flush(hw);
422}
423
424/**
425 * __i40evf_set_coalesce - set coalesce settings for particular queue
426 * @netdev: the netdev to change
427 * @ec: ethtool coalesce settings
428 * @queue: the queue to change
429 *
430 * Sets the coalesce settings for a particular queue.
431 **/
432static int __i40evf_set_coalesce(struct net_device *netdev,
433 struct ethtool_coalesce *ec,
434 int queue)
435{
436 struct i40evf_adapter *adapter = netdev_priv(netdev);
437 struct i40e_vsi *vsi = &adapter->vsi;
438 int i;
439
440 if (ec->tx_max_coalesced_frames_irq || ec->rx_max_coalesced_frames_irq)
441 vsi->work_limit = ec->tx_max_coalesced_frames_irq;
442
443 if (ec->rx_coalesce_usecs == 0) {
444 if (ec->use_adaptive_rx_coalesce)
445 netif_info(adapter, drv, netdev, "rx-usecs=0, need to disable adaptive-rx for a complete disable\n");
446 } else if ((ec->rx_coalesce_usecs < (I40E_MIN_ITR << 1)) ||
447 (ec->rx_coalesce_usecs > (I40E_MAX_ITR << 1))) {
448 netif_info(adapter, drv, netdev, "Invalid value, rx-usecs range is 0-8160\n");
449 return -EINVAL;
450 }
451
452 else
453 if (ec->tx_coalesce_usecs == 0) {
454 if (ec->use_adaptive_tx_coalesce)
455 netif_info(adapter, drv, netdev, "tx-usecs=0, need to disable adaptive-tx for a complete disable\n");
456 } else if ((ec->tx_coalesce_usecs < (I40E_MIN_ITR << 1)) ||
457 (ec->tx_coalesce_usecs > (I40E_MAX_ITR << 1))) {
458 netif_info(adapter, drv, netdev, "Invalid value, tx-usecs range is 0-8160\n");
459 return -EINVAL;
460 }
461
462 /* Rx and Tx usecs has per queue value. If user doesn't specify the
463 * queue, apply to all queues.
464 */
465 if (queue < 0) {
466 for (i = 0; i < adapter->num_active_queues; i++)
467 i40evf_set_itr_per_queue(adapter, ec, i);
468 } else if (queue < adapter->num_active_queues) {
469 i40evf_set_itr_per_queue(adapter, ec, queue);
470 } else {
471 netif_info(adapter, drv, netdev, "Invalid queue value, queue range is 0 - %d\n",
472 adapter->num_active_queues - 1);
473 return -EINVAL;
474 }
475
476 return 0;
477}
478
479/**
480 * i40evf_set_coalesce - Set interrupt coalescing settings
481 * @netdev: network interface device structure
482 * @ec: ethtool coalesce structure
483 *
484 * Change current coalescing settings for every queue.
485 **/
486static int i40evf_set_coalesce(struct net_device *netdev,
487 struct ethtool_coalesce *ec)
488{
489 return __i40evf_set_coalesce(netdev, ec, -1);
490}
491
492/**
493 * i40evf_set_per_queue_coalesce - set specific queue's coalesce settings
494 * @netdev: the netdev to change
495 * @ec: ethtool's coalesce settings
496 * @queue: the queue to modify
497 *
498 * Modifies a specific queue's coalesce settings.
499 */
500static int i40evf_set_per_queue_coalesce(struct net_device *netdev,
501 u32 queue,
502 struct ethtool_coalesce *ec)
503{
504 return __i40evf_set_coalesce(netdev, ec, queue);
505}
506
507/**
508 * i40evf_get_rxnfc - command to get RX flow classification rules
509 * @netdev: network interface device structure
510 * @cmd: ethtool rxnfc command
511 *
512 * Returns Success if the command is supported.
513 **/
514static int i40evf_get_rxnfc(struct net_device *netdev,
515 struct ethtool_rxnfc *cmd,
516 u32 *rule_locs)
517{
518 struct i40evf_adapter *adapter = netdev_priv(netdev);
519 int ret = -EOPNOTSUPP;
520
521 switch (cmd->cmd) {
522 case ETHTOOL_GRXRINGS:
523 cmd->data = adapter->num_active_queues;
524 ret = 0;
525 break;
526 case ETHTOOL_GRXFH:
527 netdev_info(netdev,
528 "RSS hash info is not available to vf, use pf.\n");
529 break;
530 default:
531 break;
532 }
533
534 return ret;
535}
536/**
537 * i40evf_get_channels: get the number of channels supported by the device
538 * @netdev: network interface device structure
539 * @ch: channel information structure
540 *
541 * For the purposes of our device, we only use combined channels, i.e. a tx/rx
542 * queue pair. Report one extra channel to match our "other" MSI-X vector.
543 **/
544static void i40evf_get_channels(struct net_device *netdev,
545 struct ethtool_channels *ch)
546{
547 struct i40evf_adapter *adapter = netdev_priv(netdev);
548
549 /* Report maximum channels */
550 ch->max_combined = adapter->num_active_queues;
551
552 ch->max_other = NONQ_VECS;
553 ch->other_count = NONQ_VECS;
554
555 ch->combined_count = adapter->num_active_queues;
556}
557
558/**
559 * i40evf_get_rxfh_key_size - get the RSS hash key size
560 * @netdev: network interface device structure
561 *
562 * Returns the table size.
563 **/
564static u32 i40evf_get_rxfh_key_size(struct net_device *netdev)
565{
566 struct i40evf_adapter *adapter = netdev_priv(netdev);
567
568 return adapter->rss_key_size;
569}
570
571/**
572 * i40evf_get_rxfh_indir_size - get the rx flow hash indirection table size
573 * @netdev: network interface device structure
574 *
575 * Returns the table size.
576 **/
577static u32 i40evf_get_rxfh_indir_size(struct net_device *netdev)
578{
579 struct i40evf_adapter *adapter = netdev_priv(netdev);
580
581 return adapter->rss_lut_size;
582}
583
584/**
585 * i40evf_get_rxfh - get the rx flow hash indirection table
586 * @netdev: network interface device structure
587 * @indir: indirection table
588 * @key: hash key
589 *
590 * Reads the indirection table directly from the hardware. Always returns 0.
591 **/
592static int i40evf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
593 u8 *hfunc)
594{
595 struct i40evf_adapter *adapter = netdev_priv(netdev);
596 u16 i;
597
598 if (hfunc)
599 *hfunc = ETH_RSS_HASH_TOP;
600 if (!indir)
601 return 0;
602
603 memcpy(key, adapter->rss_key, adapter->rss_key_size);
604
605 /* Each 32 bits pointed by 'indir' is stored with a lut entry */
606 for (i = 0; i < adapter->rss_lut_size; i++)
607 indir[i] = (u32)adapter->rss_lut[i];
608
609 return 0;
610}
611
612/**
613 * i40evf_set_rxfh - set the rx flow hash indirection table
614 * @netdev: network interface device structure
615 * @indir: indirection table
616 * @key: hash key
617 *
618 * Returns -EINVAL if the table specifies an inavlid queue id, otherwise
619 * returns 0 after programming the table.
620 **/
621static int i40evf_set_rxfh(struct net_device *netdev, const u32 *indir,
622 const u8 *key, const u8 hfunc)
623{
624 struct i40evf_adapter *adapter = netdev_priv(netdev);
625 u16 i;
626
627 /* We do not allow change in unsupported parameters */
628 if (key ||
629 (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
630 return -EOPNOTSUPP;
631 if (!indir)
632 return 0;
633
634 if (key) {
635 memcpy(adapter->rss_key, key, adapter->rss_key_size);
636 }
637
638 /* Each 32 bits pointed by 'indir' is stored with a lut entry */
639 for (i = 0; i < adapter->rss_lut_size; i++)
640 adapter->rss_lut[i] = (u8)(indir[i]);
641
642 return i40evf_config_rss(adapter);
643}
644
645static const struct ethtool_ops i40evf_ethtool_ops = {
646 .get_settings = i40evf_get_settings,
647 .get_drvinfo = i40evf_get_drvinfo,
648 .get_link = ethtool_op_get_link,
649 .get_ringparam = i40evf_get_ringparam,
650 .set_ringparam = i40evf_set_ringparam,
651 .get_strings = i40evf_get_strings,
652 .get_ethtool_stats = i40evf_get_ethtool_stats,
653 .get_sset_count = i40evf_get_sset_count,
654 .get_msglevel = i40evf_get_msglevel,
655 .set_msglevel = i40evf_set_msglevel,
656 .get_coalesce = i40evf_get_coalesce,
657 .set_coalesce = i40evf_set_coalesce,
658 .get_per_queue_coalesce = i40evf_get_per_queue_coalesce,
659 .set_per_queue_coalesce = i40evf_set_per_queue_coalesce,
660 .get_rxnfc = i40evf_get_rxnfc,
661 .get_rxfh_indir_size = i40evf_get_rxfh_indir_size,
662 .get_rxfh = i40evf_get_rxfh,
663 .set_rxfh = i40evf_set_rxfh,
664 .get_channels = i40evf_get_channels,
665 .get_rxfh_key_size = i40evf_get_rxfh_key_size,
666};
667
668/**
669 * i40evf_set_ethtool_ops - Initialize ethtool ops struct
670 * @netdev: network interface device structure
671 *
672 * Sets ethtool ops struct in our netdev so that ethtool can call
673 * our functions.
674 **/
675void i40evf_set_ethtool_ops(struct net_device *netdev)
676{
677 netdev->ethtool_ops = &i40evf_ethtool_ops;
678}