aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vmxnet3/vmxnet3_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/vmxnet3/vmxnet3_ethtool.c')
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index dc959fe27aa5..27400edeef55 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -113,15 +113,15 @@ vmxnet3_global_stats[] = {
113}; 113};
114 114
115 115
116struct net_device_stats * 116struct rtnl_link_stats64 *
117vmxnet3_get_stats(struct net_device *netdev) 117vmxnet3_get_stats64(struct net_device *netdev,
118 struct rtnl_link_stats64 *stats)
118{ 119{
119 struct vmxnet3_adapter *adapter; 120 struct vmxnet3_adapter *adapter;
120 struct vmxnet3_tq_driver_stats *drvTxStats; 121 struct vmxnet3_tq_driver_stats *drvTxStats;
121 struct vmxnet3_rq_driver_stats *drvRxStats; 122 struct vmxnet3_rq_driver_stats *drvRxStats;
122 struct UPT1_TxStats *devTxStats; 123 struct UPT1_TxStats *devTxStats;
123 struct UPT1_RxStats *devRxStats; 124 struct UPT1_RxStats *devRxStats;
124 struct net_device_stats *net_stats = &netdev->stats;
125 unsigned long flags; 125 unsigned long flags;
126 int i; 126 int i;
127 127
@@ -132,36 +132,36 @@ vmxnet3_get_stats(struct net_device *netdev)
132 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); 132 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
133 spin_unlock_irqrestore(&adapter->cmd_lock, flags); 133 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
134 134
135 memset(net_stats, 0, sizeof(*net_stats));
136 for (i = 0; i < adapter->num_tx_queues; i++) { 135 for (i = 0; i < adapter->num_tx_queues; i++) {
137 devTxStats = &adapter->tqd_start[i].stats; 136 devTxStats = &adapter->tqd_start[i].stats;
138 drvTxStats = &adapter->tx_queue[i].stats; 137 drvTxStats = &adapter->tx_queue[i].stats;
139 net_stats->tx_packets += devTxStats->ucastPktsTxOK + 138 stats->tx_packets += devTxStats->ucastPktsTxOK +
140 devTxStats->mcastPktsTxOK + 139 devTxStats->mcastPktsTxOK +
141 devTxStats->bcastPktsTxOK; 140 devTxStats->bcastPktsTxOK;
142 net_stats->tx_bytes += devTxStats->ucastBytesTxOK + 141 stats->tx_bytes += devTxStats->ucastBytesTxOK +
143 devTxStats->mcastBytesTxOK + 142 devTxStats->mcastBytesTxOK +
144 devTxStats->bcastBytesTxOK; 143 devTxStats->bcastBytesTxOK;
145 net_stats->tx_errors += devTxStats->pktsTxError; 144 stats->tx_errors += devTxStats->pktsTxError;
146 net_stats->tx_dropped += drvTxStats->drop_total; 145 stats->tx_dropped += drvTxStats->drop_total;
147 } 146 }
148 147
149 for (i = 0; i < adapter->num_rx_queues; i++) { 148 for (i = 0; i < adapter->num_rx_queues; i++) {
150 devRxStats = &adapter->rqd_start[i].stats; 149 devRxStats = &adapter->rqd_start[i].stats;
151 drvRxStats = &adapter->rx_queue[i].stats; 150 drvRxStats = &adapter->rx_queue[i].stats;
152 net_stats->rx_packets += devRxStats->ucastPktsRxOK + 151 stats->rx_packets += devRxStats->ucastPktsRxOK +
153 devRxStats->mcastPktsRxOK + 152 devRxStats->mcastPktsRxOK +
154 devRxStats->bcastPktsRxOK; 153 devRxStats->bcastPktsRxOK;
155 154
156 net_stats->rx_bytes += devRxStats->ucastBytesRxOK + 155 stats->rx_bytes += devRxStats->ucastBytesRxOK +
157 devRxStats->mcastBytesRxOK + 156 devRxStats->mcastBytesRxOK +
158 devRxStats->bcastBytesRxOK; 157 devRxStats->bcastBytesRxOK;
159 158
160 net_stats->rx_errors += devRxStats->pktsRxError; 159 stats->rx_errors += devRxStats->pktsRxError;
161 net_stats->rx_dropped += drvRxStats->drop_total; 160 stats->rx_dropped += drvRxStats->drop_total;
162 net_stats->multicast += devRxStats->mcastPktsRxOK; 161 stats->multicast += devRxStats->mcastPktsRxOK;
163 } 162 }
164 return net_stats; 163
164 return stats;
165} 165}
166 166
167static int 167static int
@@ -268,7 +268,7 @@ int vmxnet3_set_features(struct net_device *netdev, u32 features)
268 unsigned long flags; 268 unsigned long flags;
269 u32 changed = features ^ netdev->features; 269 u32 changed = features ^ netdev->features;
270 270
271 if (changed & (NETIF_F_RXCSUM|NETIF_F_LRO)) { 271 if (changed & (NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_HW_VLAN_RX)) {
272 if (features & NETIF_F_RXCSUM) 272 if (features & NETIF_F_RXCSUM)
273 adapter->shared->devRead.misc.uptFeatures |= 273 adapter->shared->devRead.misc.uptFeatures |=
274 UPT1_F_RXCSUM; 274 UPT1_F_RXCSUM;
@@ -284,6 +284,13 @@ int vmxnet3_set_features(struct net_device *netdev, u32 features)
284 adapter->shared->devRead.misc.uptFeatures &= 284 adapter->shared->devRead.misc.uptFeatures &=
285 ~UPT1_F_LRO; 285 ~UPT1_F_LRO;
286 286
287 if (features & NETIF_F_HW_VLAN_RX)
288 adapter->shared->devRead.misc.uptFeatures |=
289 UPT1_F_RXVLAN;
290 else
291 adapter->shared->devRead.misc.uptFeatures &=
292 ~UPT1_F_RXVLAN;
293
287 spin_lock_irqsave(&adapter->cmd_lock, flags); 294 spin_lock_irqsave(&adapter->cmd_lock, flags);
288 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 295 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
289 VMXNET3_CMD_UPDATE_FEATURE); 296 VMXNET3_CMD_UPDATE_FEATURE);