Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Linux driver for VMware's vmxnet3 ethernet NIC. |
| 3 | * |
Shrikrishna Khare | 190af10 | 2016-06-16 10:51:53 -0700 | [diff] [blame] | 4 | * Copyright (C) 2008-2016, VMware, Inc. All Rights Reserved. |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; version 2 of the License and no later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
| 13 | * NON INFRINGEMENT. See the GNU General Public License for more |
| 14 | * details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | * |
| 20 | * The full GNU General Public License is included in this distribution in |
| 21 | * the file called "COPYING". |
| 22 | * |
Shrikrishna Khare | 190af10 | 2016-06-16 10:51:53 -0700 | [diff] [blame] | 23 | * Maintained by: pv-drivers@vmware.com |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 24 | * |
| 25 | */ |
| 26 | |
| 27 | |
| 28 | #include "vmxnet3_int.h" |
| 29 | |
| 30 | struct vmxnet3_stat_desc { |
| 31 | char desc[ETH_GSTRING_LEN]; |
| 32 | int offset; |
| 33 | }; |
| 34 | |
| 35 | |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 36 | /* per tq stats maintained by the device */ |
| 37 | static const struct vmxnet3_stat_desc |
| 38 | vmxnet3_tq_dev_stats[] = { |
| 39 | /* description, offset */ |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 40 | { "Tx Queue#", 0 }, |
| 41 | { " TSO pkts tx", offsetof(struct UPT1_TxStats, TSOPktsTxOK) }, |
| 42 | { " TSO bytes tx", offsetof(struct UPT1_TxStats, TSOBytesTxOK) }, |
| 43 | { " ucast pkts tx", offsetof(struct UPT1_TxStats, ucastPktsTxOK) }, |
| 44 | { " ucast bytes tx", offsetof(struct UPT1_TxStats, ucastBytesTxOK) }, |
| 45 | { " mcast pkts tx", offsetof(struct UPT1_TxStats, mcastPktsTxOK) }, |
| 46 | { " mcast bytes tx", offsetof(struct UPT1_TxStats, mcastBytesTxOK) }, |
| 47 | { " bcast pkts tx", offsetof(struct UPT1_TxStats, bcastPktsTxOK) }, |
| 48 | { " bcast bytes tx", offsetof(struct UPT1_TxStats, bcastBytesTxOK) }, |
| 49 | { " pkts tx err", offsetof(struct UPT1_TxStats, pktsTxError) }, |
| 50 | { " pkts tx discard", offsetof(struct UPT1_TxStats, pktsTxDiscard) }, |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | /* per tq stats maintained by the driver */ |
| 54 | static const struct vmxnet3_stat_desc |
| 55 | vmxnet3_tq_driver_stats[] = { |
| 56 | /* description, offset */ |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 57 | {" drv dropped tx total", offsetof(struct vmxnet3_tq_driver_stats, |
| 58 | drop_total) }, |
| 59 | { " too many frags", offsetof(struct vmxnet3_tq_driver_stats, |
| 60 | drop_too_many_frags) }, |
| 61 | { " giant hdr", offsetof(struct vmxnet3_tq_driver_stats, |
| 62 | drop_oversized_hdr) }, |
| 63 | { " hdr err", offsetof(struct vmxnet3_tq_driver_stats, |
| 64 | drop_hdr_inspect_err) }, |
| 65 | { " tso", offsetof(struct vmxnet3_tq_driver_stats, |
| 66 | drop_tso) }, |
| 67 | { " ring full", offsetof(struct vmxnet3_tq_driver_stats, |
| 68 | tx_ring_full) }, |
| 69 | { " pkts linearized", offsetof(struct vmxnet3_tq_driver_stats, |
| 70 | linearized) }, |
| 71 | { " hdr cloned", offsetof(struct vmxnet3_tq_driver_stats, |
| 72 | copy_skb_header) }, |
| 73 | { " giant hdr", offsetof(struct vmxnet3_tq_driver_stats, |
| 74 | oversized_hdr) }, |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 75 | }; |
| 76 | |
| 77 | /* per rq stats maintained by the device */ |
| 78 | static const struct vmxnet3_stat_desc |
| 79 | vmxnet3_rq_dev_stats[] = { |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 80 | { "Rx Queue#", 0 }, |
| 81 | { " LRO pkts rx", offsetof(struct UPT1_RxStats, LROPktsRxOK) }, |
| 82 | { " LRO byte rx", offsetof(struct UPT1_RxStats, LROBytesRxOK) }, |
| 83 | { " ucast pkts rx", offsetof(struct UPT1_RxStats, ucastPktsRxOK) }, |
| 84 | { " ucast bytes rx", offsetof(struct UPT1_RxStats, ucastBytesRxOK) }, |
| 85 | { " mcast pkts rx", offsetof(struct UPT1_RxStats, mcastPktsRxOK) }, |
| 86 | { " mcast bytes rx", offsetof(struct UPT1_RxStats, mcastBytesRxOK) }, |
| 87 | { " bcast pkts rx", offsetof(struct UPT1_RxStats, bcastPktsRxOK) }, |
| 88 | { " bcast bytes rx", offsetof(struct UPT1_RxStats, bcastBytesRxOK) }, |
| 89 | { " pkts rx OOB", offsetof(struct UPT1_RxStats, pktsRxOutOfBuf) }, |
| 90 | { " pkts rx err", offsetof(struct UPT1_RxStats, pktsRxError) }, |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | /* per rq stats maintained by the driver */ |
| 94 | static const struct vmxnet3_stat_desc |
| 95 | vmxnet3_rq_driver_stats[] = { |
| 96 | /* description, offset */ |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 97 | { " drv dropped rx total", offsetof(struct vmxnet3_rq_driver_stats, |
| 98 | drop_total) }, |
| 99 | { " err", offsetof(struct vmxnet3_rq_driver_stats, |
| 100 | drop_err) }, |
| 101 | { " fcs", offsetof(struct vmxnet3_rq_driver_stats, |
| 102 | drop_fcs) }, |
| 103 | { " rx buf alloc fail", offsetof(struct vmxnet3_rq_driver_stats, |
| 104 | rx_buf_alloc_failure) }, |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 105 | }; |
| 106 | |
stephen hemminger | 7887456 | 2015-04-01 15:33:08 -0700 | [diff] [blame] | 107 | /* global stats maintained by the driver */ |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 108 | static const struct vmxnet3_stat_desc |
| 109 | vmxnet3_global_stats[] = { |
| 110 | /* description, offset */ |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 111 | { "tx timeout count", offsetof(struct vmxnet3_adapter, |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 112 | tx_timeout_count) } |
| 113 | }; |
| 114 | |
| 115 | |
stephen hemminger | bc1f447 | 2017-01-06 19:12:52 -0800 | [diff] [blame] | 116 | void |
stephen hemminger | 95305f6 | 2011-06-08 14:53:57 +0000 | [diff] [blame] | 117 | vmxnet3_get_stats64(struct net_device *netdev, |
| 118 | struct rtnl_link_stats64 *stats) |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 119 | { |
| 120 | struct vmxnet3_adapter *adapter; |
| 121 | struct vmxnet3_tq_driver_stats *drvTxStats; |
| 122 | struct vmxnet3_rq_driver_stats *drvRxStats; |
| 123 | struct UPT1_TxStats *devTxStats; |
| 124 | struct UPT1_RxStats *devRxStats; |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 125 | unsigned long flags; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 126 | int i; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 127 | |
| 128 | adapter = netdev_priv(netdev); |
| 129 | |
| 130 | /* Collect the dev stats into the shared area */ |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 131 | spin_lock_irqsave(&adapter->cmd_lock, flags); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 132 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 133 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 134 | |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 135 | for (i = 0; i < adapter->num_tx_queues; i++) { |
| 136 | devTxStats = &adapter->tqd_start[i].stats; |
| 137 | drvTxStats = &adapter->tx_queue[i].stats; |
stephen hemminger | 95305f6 | 2011-06-08 14:53:57 +0000 | [diff] [blame] | 138 | stats->tx_packets += devTxStats->ucastPktsTxOK + |
| 139 | devTxStats->mcastPktsTxOK + |
| 140 | devTxStats->bcastPktsTxOK; |
| 141 | stats->tx_bytes += devTxStats->ucastBytesTxOK + |
| 142 | devTxStats->mcastBytesTxOK + |
| 143 | devTxStats->bcastBytesTxOK; |
| 144 | stats->tx_errors += devTxStats->pktsTxError; |
| 145 | stats->tx_dropped += drvTxStats->drop_total; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 146 | } |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 147 | |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 148 | for (i = 0; i < adapter->num_rx_queues; i++) { |
| 149 | devRxStats = &adapter->rqd_start[i].stats; |
| 150 | drvRxStats = &adapter->rx_queue[i].stats; |
stephen hemminger | 95305f6 | 2011-06-08 14:53:57 +0000 | [diff] [blame] | 151 | stats->rx_packets += devRxStats->ucastPktsRxOK + |
| 152 | devRxStats->mcastPktsRxOK + |
| 153 | devRxStats->bcastPktsRxOK; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 154 | |
stephen hemminger | 95305f6 | 2011-06-08 14:53:57 +0000 | [diff] [blame] | 155 | stats->rx_bytes += devRxStats->ucastBytesRxOK + |
| 156 | devRxStats->mcastBytesRxOK + |
| 157 | devRxStats->bcastBytesRxOK; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 158 | |
stephen hemminger | 95305f6 | 2011-06-08 14:53:57 +0000 | [diff] [blame] | 159 | stats->rx_errors += devRxStats->pktsRxError; |
| 160 | stats->rx_dropped += drvRxStats->drop_total; |
| 161 | stats->multicast += devRxStats->mcastPktsRxOK; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 162 | } |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | static int |
| 166 | vmxnet3_get_sset_count(struct net_device *netdev, int sset) |
| 167 | { |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 168 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 169 | switch (sset) { |
| 170 | case ETH_SS_STATS: |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 171 | return (ARRAY_SIZE(vmxnet3_tq_dev_stats) + |
| 172 | ARRAY_SIZE(vmxnet3_tq_driver_stats)) * |
| 173 | adapter->num_tx_queues + |
| 174 | (ARRAY_SIZE(vmxnet3_rq_dev_stats) + |
| 175 | ARRAY_SIZE(vmxnet3_rq_driver_stats)) * |
| 176 | adapter->num_rx_queues + |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 177 | ARRAY_SIZE(vmxnet3_global_stats); |
| 178 | default: |
| 179 | return -EOPNOTSUPP; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 184 | /* This is a version 2 of the vmxnet3 ethtool_regs which goes hand in hand with |
| 185 | * the version 2 of the vmxnet3 support for ethtool(8) --register-dump. |
| 186 | * Therefore, if any registers are added, removed or modified, then a version |
| 187 | * bump and a corresponding change in the vmxnet3 support for ethtool(8) |
| 188 | * --register-dump would be required. |
| 189 | */ |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 190 | static int |
| 191 | vmxnet3_get_regs_len(struct net_device *netdev) |
| 192 | { |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 193 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 194 | |
| 195 | return ((9 /* BAR1 registers */ + |
| 196 | (1 + adapter->intr.num_intrs) + |
| 197 | (1 + adapter->num_tx_queues * 17 /* Tx queue registers */) + |
| 198 | (1 + adapter->num_rx_queues * 23 /* Rx queue registers */)) * |
| 199 | sizeof(u32)); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | |
| 203 | static void |
| 204 | vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) |
| 205 | { |
| 206 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 207 | |
| 208 | strlcpy(drvinfo->driver, vmxnet3_driver_name, sizeof(drvinfo->driver)); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 209 | |
| 210 | strlcpy(drvinfo->version, VMXNET3_DRIVER_VERSION_REPORT, |
| 211 | sizeof(drvinfo->version)); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 212 | |
| 213 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
Jiri Pirko | 7826d43 | 2013-01-06 00:44:26 +0000 | [diff] [blame] | 214 | sizeof(drvinfo->bus_info)); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | |
| 218 | static void |
| 219 | vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) |
| 220 | { |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 221 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 222 | if (stringset == ETH_SS_STATS) { |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 223 | int i, j; |
| 224 | for (j = 0; j < adapter->num_tx_queues; j++) { |
| 225 | for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) { |
| 226 | memcpy(buf, vmxnet3_tq_dev_stats[i].desc, |
| 227 | ETH_GSTRING_LEN); |
| 228 | buf += ETH_GSTRING_LEN; |
| 229 | } |
| 230 | for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); |
| 231 | i++) { |
| 232 | memcpy(buf, vmxnet3_tq_driver_stats[i].desc, |
| 233 | ETH_GSTRING_LEN); |
| 234 | buf += ETH_GSTRING_LEN; |
| 235 | } |
| 236 | } |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 237 | |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 238 | for (j = 0; j < adapter->num_rx_queues; j++) { |
| 239 | for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) { |
| 240 | memcpy(buf, vmxnet3_rq_dev_stats[i].desc, |
| 241 | ETH_GSTRING_LEN); |
| 242 | buf += ETH_GSTRING_LEN; |
| 243 | } |
| 244 | for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); |
| 245 | i++) { |
| 246 | memcpy(buf, vmxnet3_rq_driver_stats[i].desc, |
| 247 | ETH_GSTRING_LEN); |
| 248 | buf += ETH_GSTRING_LEN; |
| 249 | } |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 250 | } |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 251 | |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 252 | for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) { |
| 253 | memcpy(buf, vmxnet3_global_stats[i].desc, |
| 254 | ETH_GSTRING_LEN); |
| 255 | buf += ETH_GSTRING_LEN; |
| 256 | } |
| 257 | } |
| 258 | } |
| 259 | |
Michał Mirosław | c8f44af | 2011-11-15 15:29:55 +0000 | [diff] [blame] | 260 | int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features) |
Stanislaw Gruszka | d92be4b | 2010-06-27 23:29:42 +0000 | [diff] [blame] | 261 | { |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 262 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 263 | unsigned long flags; |
Michał Mirosław | c8f44af | 2011-11-15 15:29:55 +0000 | [diff] [blame] | 264 | netdev_features_t changed = features ^ netdev->features; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 265 | |
Patrick McHardy | f646968 | 2013-04-19 02:04:27 +0000 | [diff] [blame] | 266 | if (changed & (NETIF_F_RXCSUM | NETIF_F_LRO | |
| 267 | NETIF_F_HW_VLAN_CTAG_RX)) { |
Michał Mirosław | a0d2730 | 2011-04-18 13:31:21 +0000 | [diff] [blame] | 268 | if (features & NETIF_F_RXCSUM) |
| 269 | adapter->shared->devRead.misc.uptFeatures |= |
| 270 | UPT1_F_RXCSUM; |
| 271 | else |
| 272 | adapter->shared->devRead.misc.uptFeatures &= |
| 273 | ~UPT1_F_RXCSUM; |
Stanislaw Gruszka | d92be4b | 2010-06-27 23:29:42 +0000 | [diff] [blame] | 274 | |
stephen hemminger | 7887456 | 2015-04-01 15:33:08 -0700 | [diff] [blame] | 275 | /* update hardware LRO capability accordingly */ |
Michał Mirosław | a0d2730 | 2011-04-18 13:31:21 +0000 | [diff] [blame] | 276 | if (features & NETIF_F_LRO) |
Shreyas Bhatewara | ca80244 | 2010-07-15 22:17:29 -0700 | [diff] [blame] | 277 | adapter->shared->devRead.misc.uptFeatures |= |
Harvey Harrison | 3843e51 | 2010-10-21 18:05:32 +0000 | [diff] [blame] | 278 | UPT1_F_LRO; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 279 | else |
| 280 | adapter->shared->devRead.misc.uptFeatures &= |
Harvey Harrison | 3843e51 | 2010-10-21 18:05:32 +0000 | [diff] [blame] | 281 | ~UPT1_F_LRO; |
Michał Mirosław | a0d2730 | 2011-04-18 13:31:21 +0000 | [diff] [blame] | 282 | |
Patrick McHardy | f646968 | 2013-04-19 02:04:27 +0000 | [diff] [blame] | 283 | if (features & NETIF_F_HW_VLAN_CTAG_RX) |
Jesse Gross | 72e85c4 | 2011-06-23 13:04:39 +0000 | [diff] [blame] | 284 | adapter->shared->devRead.misc.uptFeatures |= |
| 285 | UPT1_F_RXVLAN; |
| 286 | else |
| 287 | adapter->shared->devRead.misc.uptFeatures &= |
| 288 | ~UPT1_F_RXVLAN; |
| 289 | |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 290 | spin_lock_irqsave(&adapter->cmd_lock, flags); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 291 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, |
| 292 | VMXNET3_CMD_UPDATE_FEATURE); |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 293 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 294 | } |
| 295 | return 0; |
| 296 | } |
| 297 | |
| 298 | static void |
| 299 | vmxnet3_get_ethtool_stats(struct net_device *netdev, |
| 300 | struct ethtool_stats *stats, u64 *buf) |
| 301 | { |
| 302 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 303 | unsigned long flags; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 304 | u8 *base; |
| 305 | int i; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 306 | int j = 0; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 307 | |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 308 | spin_lock_irqsave(&adapter->cmd_lock, flags); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 309 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 310 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 311 | |
| 312 | /* this does assume each counter is 64-bit wide */ |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 313 | for (j = 0; j < adapter->num_tx_queues; j++) { |
| 314 | base = (u8 *)&adapter->tqd_start[j].stats; |
| 315 | *buf++ = (u64)j; |
| 316 | for (i = 1; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) |
| 317 | *buf++ = *(u64 *)(base + |
| 318 | vmxnet3_tq_dev_stats[i].offset); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 319 | |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 320 | base = (u8 *)&adapter->tx_queue[j].stats; |
| 321 | for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++) |
| 322 | *buf++ = *(u64 *)(base + |
| 323 | vmxnet3_tq_driver_stats[i].offset); |
| 324 | } |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 325 | |
Shrikrishna Khare | 331b9ab | 2015-01-15 11:54:30 -0800 | [diff] [blame] | 326 | for (j = 0; j < adapter->num_rx_queues; j++) { |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 327 | base = (u8 *)&adapter->rqd_start[j].stats; |
| 328 | *buf++ = (u64) j; |
| 329 | for (i = 1; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) |
| 330 | *buf++ = *(u64 *)(base + |
| 331 | vmxnet3_rq_dev_stats[i].offset); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 332 | |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 333 | base = (u8 *)&adapter->rx_queue[j].stats; |
| 334 | for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++) |
| 335 | *buf++ = *(u64 *)(base + |
| 336 | vmxnet3_rq_driver_stats[i].offset); |
| 337 | } |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 338 | |
| 339 | base = (u8 *)adapter; |
| 340 | for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) |
| 341 | *buf++ = *(u64 *)(base + vmxnet3_global_stats[i].offset); |
| 342 | } |
| 343 | |
| 344 | |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 345 | /* This is a version 2 of the vmxnet3 ethtool_regs which goes hand in hand with |
| 346 | * the version 2 of the vmxnet3 support for ethtool(8) --register-dump. |
| 347 | * Therefore, if any registers are added, removed or modified, then a version |
| 348 | * bump and a corresponding change in the vmxnet3 support for ethtool(8) |
| 349 | * --register-dump would be required. |
| 350 | */ |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 351 | static void |
| 352 | vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p) |
| 353 | { |
| 354 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 355 | u32 *buf = p; |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 356 | int i = 0, j = 0; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 357 | |
| 358 | memset(p, 0, vmxnet3_get_regs_len(netdev)); |
| 359 | |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 360 | regs->version = 2; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 361 | |
| 362 | /* Update vmxnet3_get_regs_len if we want to dump more registers */ |
| 363 | |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 364 | buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_VRRS); |
| 365 | buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_UVRS); |
| 366 | buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_DSAL); |
| 367 | buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_DSAH); |
| 368 | buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); |
| 369 | buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_MACL); |
| 370 | buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_MACH); |
| 371 | buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_ICR); |
| 372 | buf[j++] = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_ECR); |
| 373 | |
| 374 | buf[j++] = adapter->intr.num_intrs; |
| 375 | for (i = 0; i < adapter->intr.num_intrs; i++) { |
| 376 | buf[j++] = VMXNET3_READ_BAR0_REG(adapter, VMXNET3_REG_IMR |
| 377 | + i * VMXNET3_REG_ALIGN); |
| 378 | } |
| 379 | |
| 380 | buf[j++] = adapter->num_tx_queues; |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 381 | for (i = 0; i < adapter->num_tx_queues; i++) { |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 382 | struct vmxnet3_tx_queue *tq = &adapter->tx_queue[i]; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 383 | |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 384 | buf[j++] = VMXNET3_READ_BAR0_REG(adapter, VMXNET3_REG_TXPROD + |
| 385 | i * VMXNET3_REG_ALIGN); |
| 386 | |
| 387 | buf[j++] = VMXNET3_GET_ADDR_LO(tq->tx_ring.basePA); |
| 388 | buf[j++] = VMXNET3_GET_ADDR_HI(tq->tx_ring.basePA); |
| 389 | buf[j++] = tq->tx_ring.size; |
| 390 | buf[j++] = tq->tx_ring.next2fill; |
| 391 | buf[j++] = tq->tx_ring.next2comp; |
| 392 | buf[j++] = tq->tx_ring.gen; |
| 393 | |
| 394 | buf[j++] = VMXNET3_GET_ADDR_LO(tq->data_ring.basePA); |
| 395 | buf[j++] = VMXNET3_GET_ADDR_HI(tq->data_ring.basePA); |
| 396 | buf[j++] = tq->data_ring.size; |
Shrikrishna Khare | 3c8b3ef | 2016-06-16 10:51:55 -0700 | [diff] [blame] | 397 | buf[j++] = tq->txdata_desc_size; |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 398 | |
| 399 | buf[j++] = VMXNET3_GET_ADDR_LO(tq->comp_ring.basePA); |
| 400 | buf[j++] = VMXNET3_GET_ADDR_HI(tq->comp_ring.basePA); |
| 401 | buf[j++] = tq->comp_ring.size; |
| 402 | buf[j++] = tq->comp_ring.next2proc; |
| 403 | buf[j++] = tq->comp_ring.gen; |
| 404 | |
| 405 | buf[j++] = tq->stopped; |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 406 | } |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 407 | |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 408 | buf[j++] = adapter->num_rx_queues; |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 409 | for (i = 0; i < adapter->num_rx_queues; i++) { |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 410 | struct vmxnet3_rx_queue *rq = &adapter->rx_queue[i]; |
| 411 | |
| 412 | buf[j++] = VMXNET3_READ_BAR0_REG(adapter, VMXNET3_REG_RXPROD + |
| 413 | i * VMXNET3_REG_ALIGN); |
| 414 | buf[j++] = VMXNET3_READ_BAR0_REG(adapter, VMXNET3_REG_RXPROD2 + |
| 415 | i * VMXNET3_REG_ALIGN); |
| 416 | |
| 417 | buf[j++] = VMXNET3_GET_ADDR_LO(rq->rx_ring[0].basePA); |
| 418 | buf[j++] = VMXNET3_GET_ADDR_HI(rq->rx_ring[0].basePA); |
| 419 | buf[j++] = rq->rx_ring[0].size; |
| 420 | buf[j++] = rq->rx_ring[0].next2fill; |
| 421 | buf[j++] = rq->rx_ring[0].next2comp; |
| 422 | buf[j++] = rq->rx_ring[0].gen; |
| 423 | |
| 424 | buf[j++] = VMXNET3_GET_ADDR_LO(rq->rx_ring[1].basePA); |
| 425 | buf[j++] = VMXNET3_GET_ADDR_HI(rq->rx_ring[1].basePA); |
| 426 | buf[j++] = rq->rx_ring[1].size; |
| 427 | buf[j++] = rq->rx_ring[1].next2fill; |
| 428 | buf[j++] = rq->rx_ring[1].next2comp; |
| 429 | buf[j++] = rq->rx_ring[1].gen; |
| 430 | |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 431 | buf[j++] = VMXNET3_GET_ADDR_LO(rq->data_ring.basePA); |
| 432 | buf[j++] = VMXNET3_GET_ADDR_HI(rq->data_ring.basePA); |
| 433 | buf[j++] = rq->rx_ring[0].size; |
| 434 | buf[j++] = rq->data_ring.desc_size; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 435 | |
Shrikrishna Khare | b6bd9b5 | 2015-09-21 20:01:29 -0700 | [diff] [blame] | 436 | buf[j++] = VMXNET3_GET_ADDR_LO(rq->comp_ring.basePA); |
| 437 | buf[j++] = VMXNET3_GET_ADDR_HI(rq->comp_ring.basePA); |
| 438 | buf[j++] = rq->comp_ring.size; |
| 439 | buf[j++] = rq->comp_ring.next2proc; |
| 440 | buf[j++] = rq->comp_ring.gen; |
Shreyas Bhatewara | 76d39da | 2011-01-14 14:59:47 +0000 | [diff] [blame] | 441 | } |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | |
| 445 | static void |
| 446 | vmxnet3_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) |
| 447 | { |
| 448 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 449 | |
| 450 | wol->supported = WAKE_UCAST | WAKE_ARP | WAKE_MAGIC; |
| 451 | wol->wolopts = adapter->wol; |
| 452 | } |
| 453 | |
| 454 | |
| 455 | static int |
| 456 | vmxnet3_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) |
| 457 | { |
| 458 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 459 | |
| 460 | if (wol->wolopts & (WAKE_PHY | WAKE_MCAST | WAKE_BCAST | |
| 461 | WAKE_MAGICSECURE)) { |
| 462 | return -EOPNOTSUPP; |
| 463 | } |
| 464 | |
| 465 | adapter->wol = wol->wolopts; |
| 466 | |
| 467 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); |
| 468 | |
| 469 | return 0; |
| 470 | } |
| 471 | |
| 472 | |
| 473 | static int |
Philippe Reynes | 3426bd7 | 2017-03-22 08:27:57 +0100 | [diff] [blame] | 474 | vmxnet3_get_link_ksettings(struct net_device *netdev, |
| 475 | struct ethtool_link_ksettings *ecmd) |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 476 | { |
| 477 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 478 | |
Philippe Reynes | 3426bd7 | 2017-03-22 08:27:57 +0100 | [diff] [blame] | 479 | ethtool_link_ksettings_zero_link_mode(ecmd, supported); |
| 480 | ethtool_link_ksettings_add_link_mode(ecmd, supported, 10000baseT_Full); |
| 481 | ethtool_link_ksettings_add_link_mode(ecmd, supported, 1000baseT_Full); |
| 482 | ethtool_link_ksettings_add_link_mode(ecmd, supported, TP); |
| 483 | ethtool_link_ksettings_zero_link_mode(ecmd, advertising); |
| 484 | ethtool_link_ksettings_add_link_mode(ecmd, advertising, TP); |
| 485 | ecmd->base.port = PORT_TP; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 486 | |
| 487 | if (adapter->link_speed) { |
Philippe Reynes | 3426bd7 | 2017-03-22 08:27:57 +0100 | [diff] [blame] | 488 | ecmd->base.speed = adapter->link_speed; |
| 489 | ecmd->base.duplex = DUPLEX_FULL; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 490 | } else { |
Philippe Reynes | 3426bd7 | 2017-03-22 08:27:57 +0100 | [diff] [blame] | 491 | ecmd->base.speed = SPEED_UNKNOWN; |
| 492 | ecmd->base.duplex = DUPLEX_UNKNOWN; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 493 | } |
| 494 | return 0; |
| 495 | } |
| 496 | |
| 497 | |
| 498 | static void |
| 499 | vmxnet3_get_ringparam(struct net_device *netdev, |
| 500 | struct ethtool_ringparam *param) |
| 501 | { |
| 502 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 503 | |
| 504 | param->rx_max_pending = VMXNET3_RX_RING_MAX_SIZE; |
| 505 | param->tx_max_pending = VMXNET3_TX_RING_MAX_SIZE; |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 506 | param->rx_mini_max_pending = VMXNET3_VERSION_GE_3(adapter) ? |
| 507 | VMXNET3_RXDATA_DESC_MAX_SIZE : 0; |
Shrikrishna Khare | 53831aa | 2015-01-06 09:20:15 -0800 | [diff] [blame] | 508 | param->rx_jumbo_max_pending = VMXNET3_RX_RING2_MAX_SIZE; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 509 | |
Neil Horman | f00e2b0 | 2014-06-13 10:03:21 -0400 | [diff] [blame] | 510 | param->rx_pending = adapter->rx_ring_size; |
| 511 | param->tx_pending = adapter->tx_ring_size; |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 512 | param->rx_mini_pending = VMXNET3_VERSION_GE_3(adapter) ? |
| 513 | adapter->rxdata_desc_size : 0; |
Shrikrishna Khare | 53831aa | 2015-01-06 09:20:15 -0800 | [diff] [blame] | 514 | param->rx_jumbo_pending = adapter->rx_ring2_size; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 515 | } |
| 516 | |
| 517 | |
| 518 | static int |
| 519 | vmxnet3_set_ringparam(struct net_device *netdev, |
| 520 | struct ethtool_ringparam *param) |
| 521 | { |
| 522 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
Shrikrishna Khare | 53831aa | 2015-01-06 09:20:15 -0800 | [diff] [blame] | 523 | u32 new_tx_ring_size, new_rx_ring_size, new_rx_ring2_size; |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 524 | u16 new_rxdata_desc_size; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 525 | u32 sz; |
| 526 | int err = 0; |
| 527 | |
| 528 | if (param->tx_pending == 0 || param->tx_pending > |
| 529 | VMXNET3_TX_RING_MAX_SIZE) |
| 530 | return -EINVAL; |
| 531 | |
| 532 | if (param->rx_pending == 0 || param->rx_pending > |
| 533 | VMXNET3_RX_RING_MAX_SIZE) |
| 534 | return -EINVAL; |
| 535 | |
Shrikrishna Khare | 53831aa | 2015-01-06 09:20:15 -0800 | [diff] [blame] | 536 | if (param->rx_jumbo_pending == 0 || |
| 537 | param->rx_jumbo_pending > VMXNET3_RX_RING2_MAX_SIZE) |
| 538 | return -EINVAL; |
| 539 | |
Bhavesh Davda | e4fabf2 | 2013-03-06 12:04:53 +0000 | [diff] [blame] | 540 | /* if adapter not yet initialized, do nothing */ |
| 541 | if (adapter->rx_buf_per_pkt == 0) { |
| 542 | netdev_err(netdev, "adapter not completely initialized, " |
| 543 | "ring size cannot be changed yet\n"); |
| 544 | return -EOPNOTSUPP; |
| 545 | } |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 546 | |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 547 | if (VMXNET3_VERSION_GE_3(adapter)) { |
| 548 | if (param->rx_mini_pending < 0 || |
| 549 | param->rx_mini_pending > VMXNET3_RXDATA_DESC_MAX_SIZE) { |
| 550 | return -EINVAL; |
| 551 | } |
| 552 | } else if (param->rx_mini_pending != 0) { |
| 553 | return -EINVAL; |
| 554 | } |
| 555 | |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 556 | /* round it up to a multiple of VMXNET3_RING_SIZE_ALIGN */ |
| 557 | new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) & |
| 558 | ~VMXNET3_RING_SIZE_MASK; |
| 559 | new_tx_ring_size = min_t(u32, new_tx_ring_size, |
| 560 | VMXNET3_TX_RING_MAX_SIZE); |
| 561 | if (new_tx_ring_size > VMXNET3_TX_RING_MAX_SIZE || (new_tx_ring_size % |
| 562 | VMXNET3_RING_SIZE_ALIGN) != 0) |
| 563 | return -EINVAL; |
| 564 | |
| 565 | /* ring0 has to be a multiple of |
| 566 | * rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN |
| 567 | */ |
| 568 | sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN; |
| 569 | new_rx_ring_size = (param->rx_pending + sz - 1) / sz * sz; |
| 570 | new_rx_ring_size = min_t(u32, new_rx_ring_size, |
| 571 | VMXNET3_RX_RING_MAX_SIZE / sz * sz); |
| 572 | if (new_rx_ring_size > VMXNET3_RX_RING_MAX_SIZE || (new_rx_ring_size % |
| 573 | sz) != 0) |
| 574 | return -EINVAL; |
| 575 | |
Shrikrishna Khare | 53831aa | 2015-01-06 09:20:15 -0800 | [diff] [blame] | 576 | /* ring2 has to be a multiple of VMXNET3_RING_SIZE_ALIGN */ |
| 577 | new_rx_ring2_size = (param->rx_jumbo_pending + VMXNET3_RING_SIZE_MASK) & |
| 578 | ~VMXNET3_RING_SIZE_MASK; |
| 579 | new_rx_ring2_size = min_t(u32, new_rx_ring2_size, |
| 580 | VMXNET3_RX_RING2_MAX_SIZE); |
| 581 | |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 582 | /* rx data ring buffer size has to be a multiple of |
| 583 | * VMXNET3_RXDATA_DESC_SIZE_ALIGN |
| 584 | */ |
| 585 | new_rxdata_desc_size = |
| 586 | (param->rx_mini_pending + VMXNET3_RXDATA_DESC_SIZE_MASK) & |
| 587 | ~VMXNET3_RXDATA_DESC_SIZE_MASK; |
| 588 | new_rxdata_desc_size = min_t(u16, new_rxdata_desc_size, |
| 589 | VMXNET3_RXDATA_DESC_MAX_SIZE); |
| 590 | |
Shrikrishna Khare | 53831aa | 2015-01-06 09:20:15 -0800 | [diff] [blame] | 591 | if (new_tx_ring_size == adapter->tx_ring_size && |
| 592 | new_rx_ring_size == adapter->rx_ring_size && |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 593 | new_rx_ring2_size == adapter->rx_ring2_size && |
| 594 | new_rxdata_desc_size == adapter->rxdata_desc_size) { |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 595 | return 0; |
| 596 | } |
| 597 | |
| 598 | /* |
| 599 | * Reset_work may be in the middle of resetting the device, wait for its |
| 600 | * completion. |
| 601 | */ |
| 602 | while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state)) |
YueHaibing | 93c65d1 | 2018-05-17 11:46:41 +0800 | [diff] [blame] | 603 | usleep_range(1000, 2000); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 604 | |
| 605 | if (netif_running(netdev)) { |
| 606 | vmxnet3_quiesce_dev(adapter); |
| 607 | vmxnet3_reset_dev(adapter); |
| 608 | |
| 609 | /* recreate the rx queue and the tx queue based on the |
| 610 | * new sizes */ |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 611 | vmxnet3_tq_destroy_all(adapter); |
| 612 | vmxnet3_rq_destroy_all(adapter); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 613 | |
| 614 | err = vmxnet3_create_queues(adapter, new_tx_ring_size, |
Shrikrishna Khare | 3c8b3ef | 2016-06-16 10:51:55 -0700 | [diff] [blame] | 615 | new_rx_ring_size, new_rx_ring2_size, |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 616 | adapter->txdata_desc_size, |
| 617 | new_rxdata_desc_size); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 618 | if (err) { |
| 619 | /* failed, most likely because of OOM, try default |
| 620 | * size */ |
Stephen Hemminger | 204a6e6 | 2013-01-15 07:28:30 +0000 | [diff] [blame] | 621 | netdev_err(netdev, "failed to apply new sizes, " |
| 622 | "try the default ones\n"); |
Neil Horman | f00e2b0 | 2014-06-13 10:03:21 -0400 | [diff] [blame] | 623 | new_rx_ring_size = VMXNET3_DEF_RX_RING_SIZE; |
Shrikrishna Khare | 53831aa | 2015-01-06 09:20:15 -0800 | [diff] [blame] | 624 | new_rx_ring2_size = VMXNET3_DEF_RX_RING2_SIZE; |
Neil Horman | f00e2b0 | 2014-06-13 10:03:21 -0400 | [diff] [blame] | 625 | new_tx_ring_size = VMXNET3_DEF_TX_RING_SIZE; |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 626 | new_rxdata_desc_size = VMXNET3_VERSION_GE_3(adapter) ? |
| 627 | VMXNET3_DEF_RXDATA_DESC_SIZE : 0; |
| 628 | |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 629 | err = vmxnet3_create_queues(adapter, |
Neil Horman | f00e2b0 | 2014-06-13 10:03:21 -0400 | [diff] [blame] | 630 | new_tx_ring_size, |
| 631 | new_rx_ring_size, |
Shrikrishna Khare | 3c8b3ef | 2016-06-16 10:51:55 -0700 | [diff] [blame] | 632 | new_rx_ring2_size, |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 633 | adapter->txdata_desc_size, |
| 634 | new_rxdata_desc_size); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 635 | if (err) { |
Stephen Hemminger | 204a6e6 | 2013-01-15 07:28:30 +0000 | [diff] [blame] | 636 | netdev_err(netdev, "failed to create queues " |
| 637 | "with default sizes. Closing it\n"); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 638 | goto out; |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | err = vmxnet3_activate_dev(adapter); |
| 643 | if (err) |
Stephen Hemminger | 204a6e6 | 2013-01-15 07:28:30 +0000 | [diff] [blame] | 644 | netdev_err(netdev, "failed to re-activate, error %d." |
| 645 | " Closing it\n", err); |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 646 | } |
Neil Horman | f00e2b0 | 2014-06-13 10:03:21 -0400 | [diff] [blame] | 647 | adapter->tx_ring_size = new_tx_ring_size; |
| 648 | adapter->rx_ring_size = new_rx_ring_size; |
Shrikrishna Khare | 53831aa | 2015-01-06 09:20:15 -0800 | [diff] [blame] | 649 | adapter->rx_ring2_size = new_rx_ring2_size; |
Shrikrishna Khare | 50a5ce3 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 650 | adapter->rxdata_desc_size = new_rxdata_desc_size; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 651 | |
| 652 | out: |
| 653 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); |
| 654 | if (err) |
| 655 | vmxnet3_force_close(adapter); |
| 656 | |
| 657 | return err; |
| 658 | } |
| 659 | |
| 660 | |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 661 | static int |
| 662 | vmxnet3_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info, |
Ben Hutchings | 815c7db | 2011-09-06 13:49:12 +0000 | [diff] [blame] | 663 | u32 *rules) |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 664 | { |
| 665 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 666 | switch (info->cmd) { |
| 667 | case ETHTOOL_GRXRINGS: |
| 668 | info->data = adapter->num_rx_queues; |
| 669 | return 0; |
| 670 | } |
| 671 | return -EOPNOTSUPP; |
| 672 | } |
| 673 | |
Scott J. Goldman | e9248fb | 2010-11-27 10:33:55 +0000 | [diff] [blame] | 674 | #ifdef VMXNET3_RSS |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 675 | static u32 |
| 676 | vmxnet3_get_rss_indir_size(struct net_device *netdev) |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 677 | { |
| 678 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 679 | struct UPT1_RSSConf *rssConf = adapter->rss_conf; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 680 | |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 681 | return rssConf->indTableSize; |
| 682 | } |
| 683 | |
| 684 | static int |
Eyal Perry | 892311f | 2014-12-02 18:12:10 +0200 | [diff] [blame] | 685 | vmxnet3_get_rss(struct net_device *netdev, u32 *p, u8 *key, u8 *hfunc) |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 686 | { |
| 687 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 688 | struct UPT1_RSSConf *rssConf = adapter->rss_conf; |
| 689 | unsigned int n = rssConf->indTableSize; |
| 690 | |
Eyal Perry | 892311f | 2014-12-02 18:12:10 +0200 | [diff] [blame] | 691 | if (hfunc) |
| 692 | *hfunc = ETH_RSS_HASH_TOP; |
| 693 | if (!p) |
| 694 | return 0; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 695 | while (n--) |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 696 | p[n] = rssConf->indTable[n]; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 697 | return 0; |
| 698 | |
| 699 | } |
| 700 | |
| 701 | static int |
Eyal Perry | 892311f | 2014-12-02 18:12:10 +0200 | [diff] [blame] | 702 | vmxnet3_set_rss(struct net_device *netdev, const u32 *p, const u8 *key, |
| 703 | const u8 hfunc) |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 704 | { |
| 705 | unsigned int i; |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 706 | unsigned long flags; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 707 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 708 | struct UPT1_RSSConf *rssConf = adapter->rss_conf; |
| 709 | |
Eyal Perry | 892311f | 2014-12-02 18:12:10 +0200 | [diff] [blame] | 710 | /* We do not allow change in unsupported parameters */ |
| 711 | if (key || |
| 712 | (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)) |
| 713 | return -EOPNOTSUPP; |
| 714 | if (!p) |
| 715 | return 0; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 716 | for (i = 0; i < rssConf->indTableSize; i++) |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 717 | rssConf->indTable[i] = p[i]; |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 718 | |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 719 | spin_lock_irqsave(&adapter->cmd_lock, flags); |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 720 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, |
| 721 | VMXNET3_CMD_UPDATE_RSSIDT); |
Shreyas Bhatewara | 83d0fef | 2011-01-14 14:59:57 +0000 | [diff] [blame] | 722 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 723 | |
| 724 | return 0; |
| 725 | |
| 726 | } |
Scott J. Goldman | e9248fb | 2010-11-27 10:33:55 +0000 | [diff] [blame] | 727 | #endif |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 728 | |
Shrikrishna Khare | 4edef40e | 2016-06-16 10:51:57 -0700 | [diff] [blame] | 729 | static int |
| 730 | vmxnet3_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec) |
| 731 | { |
| 732 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 733 | |
| 734 | if (!VMXNET3_VERSION_GE_3(adapter)) |
| 735 | return -EOPNOTSUPP; |
| 736 | |
| 737 | switch (adapter->coal_conf->coalMode) { |
| 738 | case VMXNET3_COALESCE_DISABLED: |
| 739 | /* struct ethtool_coalesce is already initialized to 0 */ |
| 740 | break; |
| 741 | case VMXNET3_COALESCE_ADAPT: |
| 742 | ec->use_adaptive_rx_coalesce = true; |
| 743 | break; |
| 744 | case VMXNET3_COALESCE_STATIC: |
| 745 | ec->tx_max_coalesced_frames = |
| 746 | adapter->coal_conf->coalPara.coalStatic.tx_comp_depth; |
| 747 | ec->rx_max_coalesced_frames = |
| 748 | adapter->coal_conf->coalPara.coalStatic.rx_depth; |
| 749 | break; |
| 750 | case VMXNET3_COALESCE_RBC: { |
| 751 | u32 rbc_rate; |
| 752 | |
| 753 | rbc_rate = adapter->coal_conf->coalPara.coalRbc.rbc_rate; |
| 754 | ec->rx_coalesce_usecs = VMXNET3_COAL_RBC_USECS(rbc_rate); |
| 755 | } |
| 756 | break; |
| 757 | default: |
| 758 | return -EOPNOTSUPP; |
| 759 | } |
| 760 | |
| 761 | return 0; |
| 762 | } |
| 763 | |
| 764 | static int |
| 765 | vmxnet3_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec) |
| 766 | { |
| 767 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
| 768 | struct Vmxnet3_DriverShared *shared = adapter->shared; |
| 769 | union Vmxnet3_CmdInfo *cmdInfo = &shared->cu.cmdInfo; |
| 770 | unsigned long flags; |
| 771 | |
| 772 | if (!VMXNET3_VERSION_GE_3(adapter)) |
| 773 | return -EOPNOTSUPP; |
| 774 | |
| 775 | if (ec->rx_coalesce_usecs_irq || |
| 776 | ec->rx_max_coalesced_frames_irq || |
| 777 | ec->tx_coalesce_usecs || |
| 778 | ec->tx_coalesce_usecs_irq || |
| 779 | ec->tx_max_coalesced_frames_irq || |
| 780 | ec->stats_block_coalesce_usecs || |
| 781 | ec->use_adaptive_tx_coalesce || |
| 782 | ec->pkt_rate_low || |
| 783 | ec->rx_coalesce_usecs_low || |
| 784 | ec->rx_max_coalesced_frames_low || |
| 785 | ec->tx_coalesce_usecs_low || |
| 786 | ec->tx_max_coalesced_frames_low || |
| 787 | ec->pkt_rate_high || |
| 788 | ec->rx_coalesce_usecs_high || |
| 789 | ec->rx_max_coalesced_frames_high || |
| 790 | ec->tx_coalesce_usecs_high || |
| 791 | ec->tx_max_coalesced_frames_high || |
| 792 | ec->rate_sample_interval) { |
| 793 | return -EINVAL; |
| 794 | } |
| 795 | |
| 796 | if ((ec->rx_coalesce_usecs == 0) && |
| 797 | (ec->use_adaptive_rx_coalesce == 0) && |
| 798 | (ec->tx_max_coalesced_frames == 0) && |
| 799 | (ec->rx_max_coalesced_frames == 0)) { |
| 800 | memset(adapter->coal_conf, 0, sizeof(*adapter->coal_conf)); |
| 801 | adapter->coal_conf->coalMode = VMXNET3_COALESCE_DISABLED; |
| 802 | goto done; |
| 803 | } |
| 804 | |
| 805 | if (ec->rx_coalesce_usecs != 0) { |
| 806 | u32 rbc_rate; |
| 807 | |
| 808 | if ((ec->use_adaptive_rx_coalesce != 0) || |
| 809 | (ec->tx_max_coalesced_frames != 0) || |
| 810 | (ec->rx_max_coalesced_frames != 0)) { |
| 811 | return -EINVAL; |
| 812 | } |
| 813 | |
| 814 | rbc_rate = VMXNET3_COAL_RBC_RATE(ec->rx_coalesce_usecs); |
| 815 | if (rbc_rate < VMXNET3_COAL_RBC_MIN_RATE || |
| 816 | rbc_rate > VMXNET3_COAL_RBC_MAX_RATE) { |
| 817 | return -EINVAL; |
| 818 | } |
| 819 | |
| 820 | memset(adapter->coal_conf, 0, sizeof(*adapter->coal_conf)); |
| 821 | adapter->coal_conf->coalMode = VMXNET3_COALESCE_RBC; |
| 822 | adapter->coal_conf->coalPara.coalRbc.rbc_rate = rbc_rate; |
| 823 | goto done; |
| 824 | } |
| 825 | |
| 826 | if (ec->use_adaptive_rx_coalesce != 0) { |
| 827 | if ((ec->rx_coalesce_usecs != 0) || |
| 828 | (ec->tx_max_coalesced_frames != 0) || |
| 829 | (ec->rx_max_coalesced_frames != 0)) { |
| 830 | return -EINVAL; |
| 831 | } |
| 832 | memset(adapter->coal_conf, 0, sizeof(*adapter->coal_conf)); |
| 833 | adapter->coal_conf->coalMode = VMXNET3_COALESCE_ADAPT; |
| 834 | goto done; |
| 835 | } |
| 836 | |
| 837 | if ((ec->tx_max_coalesced_frames != 0) || |
| 838 | (ec->rx_max_coalesced_frames != 0)) { |
| 839 | if ((ec->rx_coalesce_usecs != 0) || |
| 840 | (ec->use_adaptive_rx_coalesce != 0)) { |
| 841 | return -EINVAL; |
| 842 | } |
| 843 | |
| 844 | if ((ec->tx_max_coalesced_frames > |
| 845 | VMXNET3_COAL_STATIC_MAX_DEPTH) || |
| 846 | (ec->rx_max_coalesced_frames > |
| 847 | VMXNET3_COAL_STATIC_MAX_DEPTH)) { |
| 848 | return -EINVAL; |
| 849 | } |
| 850 | |
| 851 | memset(adapter->coal_conf, 0, sizeof(*adapter->coal_conf)); |
| 852 | adapter->coal_conf->coalMode = VMXNET3_COALESCE_STATIC; |
| 853 | |
| 854 | adapter->coal_conf->coalPara.coalStatic.tx_comp_depth = |
| 855 | (ec->tx_max_coalesced_frames ? |
| 856 | ec->tx_max_coalesced_frames : |
| 857 | VMXNET3_COAL_STATIC_DEFAULT_DEPTH); |
| 858 | |
| 859 | adapter->coal_conf->coalPara.coalStatic.rx_depth = |
| 860 | (ec->rx_max_coalesced_frames ? |
| 861 | ec->rx_max_coalesced_frames : |
| 862 | VMXNET3_COAL_STATIC_DEFAULT_DEPTH); |
| 863 | |
| 864 | adapter->coal_conf->coalPara.coalStatic.tx_depth = |
| 865 | VMXNET3_COAL_STATIC_DEFAULT_DEPTH; |
| 866 | goto done; |
| 867 | } |
| 868 | |
| 869 | done: |
| 870 | adapter->default_coal_mode = false; |
| 871 | if (netif_running(netdev)) { |
| 872 | spin_lock_irqsave(&adapter->cmd_lock, flags); |
| 873 | cmdInfo->varConf.confVer = 1; |
| 874 | cmdInfo->varConf.confLen = |
| 875 | cpu_to_le32(sizeof(*adapter->coal_conf)); |
| 876 | cmdInfo->varConf.confPA = cpu_to_le64(adapter->coal_conf_pa); |
| 877 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, |
| 878 | VMXNET3_CMD_SET_COALESCE); |
| 879 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
| 880 | } |
| 881 | |
| 882 | return 0; |
| 883 | } |
| 884 | |
stephen hemminger | c8b88ef | 2012-01-04 11:58:13 +0000 | [diff] [blame] | 885 | static const struct ethtool_ops vmxnet3_ethtool_ops = { |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 886 | .get_drvinfo = vmxnet3_get_drvinfo, |
| 887 | .get_regs_len = vmxnet3_get_regs_len, |
| 888 | .get_regs = vmxnet3_get_regs, |
| 889 | .get_wol = vmxnet3_get_wol, |
| 890 | .set_wol = vmxnet3_set_wol, |
| 891 | .get_link = ethtool_op_get_link, |
Shrikrishna Khare | 4edef40e | 2016-06-16 10:51:57 -0700 | [diff] [blame] | 892 | .get_coalesce = vmxnet3_get_coalesce, |
| 893 | .set_coalesce = vmxnet3_set_coalesce, |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 894 | .get_strings = vmxnet3_get_strings, |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 895 | .get_sset_count = vmxnet3_get_sset_count, |
| 896 | .get_ethtool_stats = vmxnet3_get_ethtool_stats, |
| 897 | .get_ringparam = vmxnet3_get_ringparam, |
| 898 | .set_ringparam = vmxnet3_set_ringparam, |
Shreyas Bhatewara | 09c5088 | 2010-11-19 10:55:24 +0000 | [diff] [blame] | 899 | .get_rxnfc = vmxnet3_get_rxnfc, |
Scott J. Goldman | e9248fb | 2010-11-27 10:33:55 +0000 | [diff] [blame] | 900 | #ifdef VMXNET3_RSS |
Ben Hutchings | 7850f63 | 2011-12-15 13:55:01 +0000 | [diff] [blame] | 901 | .get_rxfh_indir_size = vmxnet3_get_rss_indir_size, |
Ben Hutchings | fe62d00 | 2014-05-15 01:25:27 +0100 | [diff] [blame] | 902 | .get_rxfh = vmxnet3_get_rss, |
| 903 | .set_rxfh = vmxnet3_set_rss, |
Scott J. Goldman | e9248fb | 2010-11-27 10:33:55 +0000 | [diff] [blame] | 904 | #endif |
Philippe Reynes | 3426bd7 | 2017-03-22 08:27:57 +0100 | [diff] [blame] | 905 | .get_link_ksettings = vmxnet3_get_link_ksettings, |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 906 | }; |
| 907 | |
| 908 | void vmxnet3_set_ethtool_ops(struct net_device *netdev) |
| 909 | { |
Wilfried Klaebe | 7ad24ea | 2014-05-11 00:12:32 +0000 | [diff] [blame] | 910 | netdev->ethtool_ops = &vmxnet3_ethtool_ops; |
Shreyas Bhatewara | d1a890fa | 2009-10-13 00:15:51 -0700 | [diff] [blame] | 911 | } |