1 /*******************************************************************************
3 * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
4 * Copyright(c) 2013 - 2016 Intel Corporation.
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.
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
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/>.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
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
25 ******************************************************************************/
27 /* ethtool support for i40evf */
30 #include <linux/uaccess.h>
33 char stat_string[ETH_GSTRING_LEN];
37 #define I40EVF_STAT(_name, _stat) { \
38 .stat_string = _name, \
39 .stat_offset = offsetof(struct i40evf_adapter, _stat) \
42 /* All stats are u64, so we don't need to track the size of the field. */
43 static 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),
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))
66 /* For now we have one and only one private flag and it is only defined
67 * when we have support for the SKIP_CPU_SYNC DMA attribute. Instead
68 * of leaving all this code sitting around empty we will strip it unless
69 * our one private flag is actually available.
71 struct i40evf_priv_flags {
72 char flag_string[ETH_GSTRING_LEN];
77 #define I40EVF_PRIV_FLAG(_name, _flag, _read_only) { \
78 .flag_string = _name, \
80 .read_only = _read_only, \
83 static const struct i40evf_priv_flags i40evf_gstrings_priv_flags[] = {
84 I40EVF_PRIV_FLAG("legacy-rx", I40EVF_FLAG_LEGACY_RX, 0),
87 #define I40EVF_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40evf_gstrings_priv_flags)
90 * i40evf_get_link_ksettings - Get Link Speed and Duplex settings
91 * @netdev: network interface device structure
92 * @cmd: ethtool command
94 * Reports speed/duplex settings. Because this is a VF, we don't know what
95 * kind of link we really have, so we fake it.
97 static int i40evf_get_link_ksettings(struct net_device *netdev,
98 struct ethtool_link_ksettings *cmd)
100 struct i40evf_adapter *adapter = netdev_priv(netdev);
102 ethtool_link_ksettings_zero_link_mode(cmd, supported);
103 cmd->base.autoneg = AUTONEG_DISABLE;
104 cmd->base.port = PORT_NONE;
105 /* Set speed and duplex */
106 switch (adapter->link_speed) {
107 case I40E_LINK_SPEED_40GB:
108 cmd->base.speed = SPEED_40000;
110 case I40E_LINK_SPEED_25GB:
112 cmd->base.speed = SPEED_25000;
115 "Speed is 25G, display not supported by this version of ethtool.\n");
118 case I40E_LINK_SPEED_20GB:
119 cmd->base.speed = SPEED_20000;
121 case I40E_LINK_SPEED_10GB:
122 cmd->base.speed = SPEED_10000;
124 case I40E_LINK_SPEED_1GB:
125 cmd->base.speed = SPEED_1000;
127 case I40E_LINK_SPEED_100MB:
128 cmd->base.speed = SPEED_100;
133 cmd->base.duplex = DUPLEX_FULL;
139 * i40evf_get_sset_count - Get length of string set
140 * @netdev: network interface device structure
141 * @sset: id of string set
143 * Reports size of string table. This driver only supports
144 * strings for statistics.
146 static int i40evf_get_sset_count(struct net_device *netdev, int sset)
148 if (sset == ETH_SS_STATS)
149 return I40EVF_STATS_LEN(netdev);
150 else if (sset == ETH_SS_PRIV_FLAGS)
151 return I40EVF_PRIV_FLAGS_STR_LEN;
157 * i40evf_get_ethtool_stats - report device statistics
158 * @netdev: network interface device structure
159 * @stats: ethtool statistics structure
160 * @data: pointer to data buffer
162 * All statistics are added to the data buffer as an array of u64.
164 static void i40evf_get_ethtool_stats(struct net_device *netdev,
165 struct ethtool_stats *stats, u64 *data)
167 struct i40evf_adapter *adapter = netdev_priv(netdev);
171 for (i = 0; i < I40EVF_GLOBAL_STATS_LEN; i++) {
172 p = (char *)adapter + i40evf_gstrings_stats[i].stat_offset;
175 for (j = 0; j < adapter->num_active_queues; j++) {
176 data[i++] = adapter->tx_rings[j].stats.packets;
177 data[i++] = adapter->tx_rings[j].stats.bytes;
179 for (j = 0; j < adapter->num_active_queues; j++) {
180 data[i++] = adapter->rx_rings[j].stats.packets;
181 data[i++] = adapter->rx_rings[j].stats.bytes;
186 * i40evf_get_strings - Get string set
187 * @netdev: network interface device structure
188 * @sset: id of string set
189 * @data: buffer for string data
191 * Builds stats string table.
193 static void i40evf_get_strings(struct net_device *netdev, u32 sset, u8 *data)
195 struct i40evf_adapter *adapter = netdev_priv(netdev);
199 if (sset == ETH_SS_STATS) {
200 for (i = 0; i < (int)I40EVF_GLOBAL_STATS_LEN; i++) {
201 memcpy(p, i40evf_gstrings_stats[i].stat_string,
203 p += ETH_GSTRING_LEN;
205 for (i = 0; i < adapter->num_active_queues; i++) {
206 snprintf(p, ETH_GSTRING_LEN, "tx-%u.packets", i);
207 p += ETH_GSTRING_LEN;
208 snprintf(p, ETH_GSTRING_LEN, "tx-%u.bytes", i);
209 p += ETH_GSTRING_LEN;
211 for (i = 0; i < adapter->num_active_queues; i++) {
212 snprintf(p, ETH_GSTRING_LEN, "rx-%u.packets", i);
213 p += ETH_GSTRING_LEN;
214 snprintf(p, ETH_GSTRING_LEN, "rx-%u.bytes", i);
215 p += ETH_GSTRING_LEN;
217 } else if (sset == ETH_SS_PRIV_FLAGS) {
218 for (i = 0; i < I40EVF_PRIV_FLAGS_STR_LEN; i++) {
219 snprintf(p, ETH_GSTRING_LEN, "%s",
220 i40evf_gstrings_priv_flags[i].flag_string);
221 p += ETH_GSTRING_LEN;
227 * i40evf_get_priv_flags - report device private flags
228 * @dev: network interface device structure
230 * The get string set count and the string set should be matched for each
231 * flag returned. Add new strings for each flag to the i40e_gstrings_priv_flags
234 * Returns a u32 bitmap of flags.
236 static u32 i40evf_get_priv_flags(struct net_device *netdev)
238 struct i40evf_adapter *adapter = netdev_priv(netdev);
239 u32 i, ret_flags = 0;
241 for (i = 0; i < I40EVF_PRIV_FLAGS_STR_LEN; i++) {
242 const struct i40evf_priv_flags *priv_flags;
244 priv_flags = &i40evf_gstrings_priv_flags[i];
246 if (priv_flags->flag & adapter->flags)
254 * i40evf_set_priv_flags - set private flags
255 * @dev: network interface device structure
256 * @flags: bit flags to be set
258 static int i40evf_set_priv_flags(struct net_device *netdev, u32 flags)
260 struct i40evf_adapter *adapter = netdev_priv(netdev);
261 u32 orig_flags, new_flags, changed_flags;
264 orig_flags = READ_ONCE(adapter->flags);
265 new_flags = orig_flags;
267 for (i = 0; i < I40EVF_PRIV_FLAGS_STR_LEN; i++) {
268 const struct i40evf_priv_flags *priv_flags;
270 priv_flags = &i40evf_gstrings_priv_flags[i];
273 new_flags |= priv_flags->flag;
275 new_flags &= ~(priv_flags->flag);
277 if (priv_flags->read_only &&
278 ((orig_flags ^ new_flags) & ~BIT(i)))
282 /* Before we finalize any flag changes, any checks which we need to
283 * perform to determine if the new flags will be supported should go
287 /* Compare and exchange the new flags into place. If we failed, that
288 * is if cmpxchg returns anything but the old value, this means
289 * something else must have modified the flags variable since we
290 * copied it. We'll just punt with an error and log something in the
293 if (cmpxchg(&adapter->flags, orig_flags, new_flags) != orig_flags) {
294 dev_warn(&adapter->pdev->dev,
295 "Unable to update adapter->flags as it was modified by another thread...\n");
299 changed_flags = orig_flags ^ new_flags;
301 /* Process any additional changes needed as a result of flag changes.
302 * The changed_flags value reflects the list of bits that were changed
306 /* issue a reset to force legacy-rx change to take effect */
307 if (changed_flags & I40EVF_FLAG_LEGACY_RX) {
308 if (netif_running(netdev)) {
309 adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
310 schedule_work(&adapter->reset_task);
318 * i40evf_get_msglevel - Get debug message level
319 * @netdev: network interface device structure
321 * Returns current debug message level.
323 static u32 i40evf_get_msglevel(struct net_device *netdev)
325 struct i40evf_adapter *adapter = netdev_priv(netdev);
327 return adapter->msg_enable;
331 * i40evf_set_msglevel - Set debug message level
332 * @netdev: network interface device structure
333 * @data: message level
335 * Set current debug message level. Higher values cause the driver to
338 static void i40evf_set_msglevel(struct net_device *netdev, u32 data)
340 struct i40evf_adapter *adapter = netdev_priv(netdev);
342 if (I40E_DEBUG_USER & data)
343 adapter->hw.debug_mask = data;
344 adapter->msg_enable = data;
348 * i40evf_get_drvinfo - Get driver info
349 * @netdev: network interface device structure
350 * @drvinfo: ethool driver info structure
352 * Returns information about the driver and device for display to the user.
354 static void i40evf_get_drvinfo(struct net_device *netdev,
355 struct ethtool_drvinfo *drvinfo)
357 struct i40evf_adapter *adapter = netdev_priv(netdev);
359 strlcpy(drvinfo->driver, i40evf_driver_name, 32);
360 strlcpy(drvinfo->version, i40evf_driver_version, 32);
361 strlcpy(drvinfo->fw_version, "N/A", 4);
362 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
363 drvinfo->n_priv_flags = I40EVF_PRIV_FLAGS_STR_LEN;
367 * i40evf_get_ringparam - Get ring parameters
368 * @netdev: network interface device structure
369 * @ring: ethtool ringparam structure
371 * Returns current ring parameters. TX and RX rings are reported separately,
372 * but the number of rings is not reported.
374 static void i40evf_get_ringparam(struct net_device *netdev,
375 struct ethtool_ringparam *ring)
377 struct i40evf_adapter *adapter = netdev_priv(netdev);
379 ring->rx_max_pending = I40EVF_MAX_RXD;
380 ring->tx_max_pending = I40EVF_MAX_TXD;
381 ring->rx_pending = adapter->rx_desc_count;
382 ring->tx_pending = adapter->tx_desc_count;
386 * i40evf_set_ringparam - Set ring parameters
387 * @netdev: network interface device structure
388 * @ring: ethtool ringparam structure
390 * Sets ring parameters. TX and RX rings are controlled separately, but the
391 * number of rings is not specified, so all rings get the same settings.
393 static int i40evf_set_ringparam(struct net_device *netdev,
394 struct ethtool_ringparam *ring)
396 struct i40evf_adapter *adapter = netdev_priv(netdev);
397 u32 new_rx_count, new_tx_count;
399 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
402 new_tx_count = clamp_t(u32, ring->tx_pending,
405 new_tx_count = ALIGN(new_tx_count, I40EVF_REQ_DESCRIPTOR_MULTIPLE);
407 new_rx_count = clamp_t(u32, ring->rx_pending,
410 new_rx_count = ALIGN(new_rx_count, I40EVF_REQ_DESCRIPTOR_MULTIPLE);
412 /* if nothing to do return success */
413 if ((new_tx_count == adapter->tx_desc_count) &&
414 (new_rx_count == adapter->rx_desc_count))
417 adapter->tx_desc_count = new_tx_count;
418 adapter->rx_desc_count = new_rx_count;
420 if (netif_running(netdev)) {
421 adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
422 schedule_work(&adapter->reset_task);
429 * __i40evf_get_coalesce - get per-queue coalesce settings
430 * @netdev: the netdev to check
431 * @ec: ethtool coalesce data structure
432 * @queue: which queue to pick
434 * Gets the per-queue settings for coalescence. Specifically Rx and Tx usecs
435 * are per queue. If queue is <0 then we default to queue 0 as the
436 * representative value.
438 static int __i40evf_get_coalesce(struct net_device *netdev,
439 struct ethtool_coalesce *ec,
442 struct i40evf_adapter *adapter = netdev_priv(netdev);
443 struct i40e_vsi *vsi = &adapter->vsi;
444 struct i40e_ring *rx_ring, *tx_ring;
446 ec->tx_max_coalesced_frames = vsi->work_limit;
447 ec->rx_max_coalesced_frames = vsi->work_limit;
449 /* Rx and Tx usecs per queue value. If user doesn't specify the
450 * queue, return queue 0's value to represent.
454 else if (queue >= adapter->num_active_queues)
457 rx_ring = &adapter->rx_rings[queue];
458 tx_ring = &adapter->tx_rings[queue];
460 if (ITR_IS_DYNAMIC(rx_ring->rx_itr_setting))
461 ec->use_adaptive_rx_coalesce = 1;
463 if (ITR_IS_DYNAMIC(tx_ring->tx_itr_setting))
464 ec->use_adaptive_tx_coalesce = 1;
466 ec->rx_coalesce_usecs = rx_ring->rx_itr_setting & ~I40E_ITR_DYNAMIC;
467 ec->tx_coalesce_usecs = tx_ring->tx_itr_setting & ~I40E_ITR_DYNAMIC;
473 * i40evf_get_coalesce - Get interrupt coalescing settings
474 * @netdev: network interface device structure
475 * @ec: ethtool coalesce structure
477 * Returns current coalescing settings. This is referred to elsewhere in the
478 * driver as Interrupt Throttle Rate, as this is how the hardware describes
479 * this functionality. Note that if per-queue settings have been modified this
480 * only represents the settings of queue 0.
482 static int i40evf_get_coalesce(struct net_device *netdev,
483 struct ethtool_coalesce *ec)
485 return __i40evf_get_coalesce(netdev, ec, -1);
489 * i40evf_get_per_queue_coalesce - get coalesce values for specific queue
490 * @netdev: netdev to read
491 * @ec: coalesce settings from ethtool
492 * @queue: the queue to read
494 * Read specific queue's coalesce settings.
496 static int i40evf_get_per_queue_coalesce(struct net_device *netdev,
498 struct ethtool_coalesce *ec)
500 return __i40evf_get_coalesce(netdev, ec, queue);
504 * i40evf_set_itr_per_queue - set ITR values for specific queue
505 * @vsi: the VSI to set values for
506 * @ec: coalesce settings from ethtool
507 * @queue: the queue to modify
509 * Change the ITR settings for a specific queue.
511 static void i40evf_set_itr_per_queue(struct i40evf_adapter *adapter,
512 struct ethtool_coalesce *ec,
515 struct i40e_vsi *vsi = &adapter->vsi;
516 struct i40e_hw *hw = &adapter->hw;
517 struct i40e_q_vector *q_vector;
520 adapter->rx_rings[queue].rx_itr_setting = ec->rx_coalesce_usecs;
521 adapter->tx_rings[queue].tx_itr_setting = ec->tx_coalesce_usecs;
523 if (ec->use_adaptive_rx_coalesce)
524 adapter->rx_rings[queue].rx_itr_setting |= I40E_ITR_DYNAMIC;
526 adapter->rx_rings[queue].rx_itr_setting &= ~I40E_ITR_DYNAMIC;
528 if (ec->use_adaptive_tx_coalesce)
529 adapter->tx_rings[queue].tx_itr_setting |= I40E_ITR_DYNAMIC;
531 adapter->tx_rings[queue].tx_itr_setting &= ~I40E_ITR_DYNAMIC;
533 q_vector = adapter->rx_rings[queue].q_vector;
534 q_vector->rx.itr = ITR_TO_REG(adapter->rx_rings[queue].rx_itr_setting);
535 vector = vsi->base_vector + q_vector->v_idx;
536 wr32(hw, I40E_VFINT_ITRN1(I40E_RX_ITR, vector - 1), q_vector->rx.itr);
538 q_vector = adapter->tx_rings[queue].q_vector;
539 q_vector->tx.itr = ITR_TO_REG(adapter->tx_rings[queue].tx_itr_setting);
540 vector = vsi->base_vector + q_vector->v_idx;
541 wr32(hw, I40E_VFINT_ITRN1(I40E_TX_ITR, vector - 1), q_vector->tx.itr);
547 * __i40evf_set_coalesce - set coalesce settings for particular queue
548 * @netdev: the netdev to change
549 * @ec: ethtool coalesce settings
550 * @queue: the queue to change
552 * Sets the coalesce settings for a particular queue.
554 static int __i40evf_set_coalesce(struct net_device *netdev,
555 struct ethtool_coalesce *ec,
558 struct i40evf_adapter *adapter = netdev_priv(netdev);
559 struct i40e_vsi *vsi = &adapter->vsi;
562 if (ec->tx_max_coalesced_frames_irq || ec->rx_max_coalesced_frames_irq)
563 vsi->work_limit = ec->tx_max_coalesced_frames_irq;
565 if (ec->rx_coalesce_usecs == 0) {
566 if (ec->use_adaptive_rx_coalesce)
567 netif_info(adapter, drv, netdev, "rx-usecs=0, need to disable adaptive-rx for a complete disable\n");
568 } else if ((ec->rx_coalesce_usecs < (I40E_MIN_ITR << 1)) ||
569 (ec->rx_coalesce_usecs > (I40E_MAX_ITR << 1))) {
570 netif_info(adapter, drv, netdev, "Invalid value, rx-usecs range is 0-8160\n");
575 if (ec->tx_coalesce_usecs == 0) {
576 if (ec->use_adaptive_tx_coalesce)
577 netif_info(adapter, drv, netdev, "tx-usecs=0, need to disable adaptive-tx for a complete disable\n");
578 } else if ((ec->tx_coalesce_usecs < (I40E_MIN_ITR << 1)) ||
579 (ec->tx_coalesce_usecs > (I40E_MAX_ITR << 1))) {
580 netif_info(adapter, drv, netdev, "Invalid value, tx-usecs range is 0-8160\n");
584 /* Rx and Tx usecs has per queue value. If user doesn't specify the
585 * queue, apply to all queues.
588 for (i = 0; i < adapter->num_active_queues; i++)
589 i40evf_set_itr_per_queue(adapter, ec, i);
590 } else if (queue < adapter->num_active_queues) {
591 i40evf_set_itr_per_queue(adapter, ec, queue);
593 netif_info(adapter, drv, netdev, "Invalid queue value, queue range is 0 - %d\n",
594 adapter->num_active_queues - 1);
602 * i40evf_set_coalesce - Set interrupt coalescing settings
603 * @netdev: network interface device structure
604 * @ec: ethtool coalesce structure
606 * Change current coalescing settings for every queue.
608 static int i40evf_set_coalesce(struct net_device *netdev,
609 struct ethtool_coalesce *ec)
611 return __i40evf_set_coalesce(netdev, ec, -1);
615 * i40evf_set_per_queue_coalesce - set specific queue's coalesce settings
616 * @netdev: the netdev to change
617 * @ec: ethtool's coalesce settings
618 * @queue: the queue to modify
620 * Modifies a specific queue's coalesce settings.
622 static int i40evf_set_per_queue_coalesce(struct net_device *netdev,
624 struct ethtool_coalesce *ec)
626 return __i40evf_set_coalesce(netdev, ec, queue);
630 * i40evf_get_rxnfc - command to get RX flow classification rules
631 * @netdev: network interface device structure
632 * @cmd: ethtool rxnfc command
634 * Returns Success if the command is supported.
636 static int i40evf_get_rxnfc(struct net_device *netdev,
637 struct ethtool_rxnfc *cmd,
640 struct i40evf_adapter *adapter = netdev_priv(netdev);
641 int ret = -EOPNOTSUPP;
644 case ETHTOOL_GRXRINGS:
645 cmd->data = adapter->num_active_queues;
650 "RSS hash info is not available to vf, use pf.\n");
659 * i40evf_get_channels: get the number of channels supported by the device
660 * @netdev: network interface device structure
661 * @ch: channel information structure
663 * For the purposes of our device, we only use combined channels, i.e. a tx/rx
664 * queue pair. Report one extra channel to match our "other" MSI-X vector.
666 static void i40evf_get_channels(struct net_device *netdev,
667 struct ethtool_channels *ch)
669 struct i40evf_adapter *adapter = netdev_priv(netdev);
671 /* Report maximum channels */
672 ch->max_combined = adapter->num_active_queues;
674 ch->max_other = NONQ_VECS;
675 ch->other_count = NONQ_VECS;
677 ch->combined_count = adapter->num_active_queues;
681 * i40evf_get_rxfh_key_size - get the RSS hash key size
682 * @netdev: network interface device structure
684 * Returns the table size.
686 static u32 i40evf_get_rxfh_key_size(struct net_device *netdev)
688 struct i40evf_adapter *adapter = netdev_priv(netdev);
690 return adapter->rss_key_size;
694 * i40evf_get_rxfh_indir_size - get the rx flow hash indirection table size
695 * @netdev: network interface device structure
697 * Returns the table size.
699 static u32 i40evf_get_rxfh_indir_size(struct net_device *netdev)
701 struct i40evf_adapter *adapter = netdev_priv(netdev);
703 return adapter->rss_lut_size;
707 * i40evf_get_rxfh - get the rx flow hash indirection table
708 * @netdev: network interface device structure
709 * @indir: indirection table
712 * Reads the indirection table directly from the hardware. Always returns 0.
714 static int i40evf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
717 struct i40evf_adapter *adapter = netdev_priv(netdev);
721 *hfunc = ETH_RSS_HASH_TOP;
725 memcpy(key, adapter->rss_key, adapter->rss_key_size);
727 /* Each 32 bits pointed by 'indir' is stored with a lut entry */
728 for (i = 0; i < adapter->rss_lut_size; i++)
729 indir[i] = (u32)adapter->rss_lut[i];
735 * i40evf_set_rxfh - set the rx flow hash indirection table
736 * @netdev: network interface device structure
737 * @indir: indirection table
740 * Returns -EINVAL if the table specifies an inavlid queue id, otherwise
741 * returns 0 after programming the table.
743 static int i40evf_set_rxfh(struct net_device *netdev, const u32 *indir,
744 const u8 *key, const u8 hfunc)
746 struct i40evf_adapter *adapter = netdev_priv(netdev);
749 /* We do not allow change in unsupported parameters */
751 (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
757 memcpy(adapter->rss_key, key, adapter->rss_key_size);
760 /* Each 32 bits pointed by 'indir' is stored with a lut entry */
761 for (i = 0; i < adapter->rss_lut_size; i++)
762 adapter->rss_lut[i] = (u8)(indir[i]);
764 return i40evf_config_rss(adapter);
767 static const struct ethtool_ops i40evf_ethtool_ops = {
768 .get_drvinfo = i40evf_get_drvinfo,
769 .get_link = ethtool_op_get_link,
770 .get_ringparam = i40evf_get_ringparam,
771 .set_ringparam = i40evf_set_ringparam,
772 .get_strings = i40evf_get_strings,
773 .get_ethtool_stats = i40evf_get_ethtool_stats,
774 .get_sset_count = i40evf_get_sset_count,
775 .get_priv_flags = i40evf_get_priv_flags,
776 .set_priv_flags = i40evf_set_priv_flags,
777 .get_msglevel = i40evf_get_msglevel,
778 .set_msglevel = i40evf_set_msglevel,
779 .get_coalesce = i40evf_get_coalesce,
780 .set_coalesce = i40evf_set_coalesce,
781 .get_per_queue_coalesce = i40evf_get_per_queue_coalesce,
782 .set_per_queue_coalesce = i40evf_set_per_queue_coalesce,
783 .get_rxnfc = i40evf_get_rxnfc,
784 .get_rxfh_indir_size = i40evf_get_rxfh_indir_size,
785 .get_rxfh = i40evf_get_rxfh,
786 .set_rxfh = i40evf_set_rxfh,
787 .get_channels = i40evf_get_channels,
788 .get_rxfh_key_size = i40evf_get_rxfh_key_size,
789 .get_link_ksettings = i40evf_get_link_ksettings,
793 * i40evf_set_ethtool_ops - Initialize ethtool ops struct
794 * @netdev: network interface device structure
796 * Sets ethtool ops struct in our netdev so that ethtool can call
799 void i40evf_set_ethtool_ops(struct net_device *netdev)
801 netdev->ethtool_ops = &i40evf_ethtool_ops;