aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igbvf/ethtool.c
diff options
context:
space:
mode:
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-01-21 04:57:50 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-02-23 20:11:54 -0500
commit0340501b1cf7dc67bc53dcbe26d3c7d678157606 (patch)
tree3106bdf3de249daf9136a2e2d3f6c2c3cfc66e0b /drivers/net/ethernet/intel/igbvf/ethtool.c
parent79849ebc0e06d775f53d160bb1a63b000fa0947b (diff)
igbvf: Fix code comments and whitespace
Fix the code comments to align with the drivers/net/ commenting style. Also fix other checkpatch errors such as using tabs where possible and properly wrap lines to conform to the 80 char limit (unless it is a string). Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igbvf/ethtool.c')
-rw-r--r--drivers/net/ethernet/intel/igbvf/ethtool.c73
1 files changed, 35 insertions, 38 deletions
diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c
index 2178f87e9f61..91a1190990ae 100644
--- a/drivers/net/ethernet/intel/igbvf/ethtool.c
+++ b/drivers/net/ethernet/intel/igbvf/ethtool.c
@@ -13,8 +13,7 @@
13 more details. 13 more details.
14 14
15 You should have received a copy of the GNU General Public License along with 15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc., 16 this program; if not, see <http://www.gnu.org/licenses/>.
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 17
19 The full GNU General Public License is included in this distribution in 18 The full GNU General Public License is included in this distribution in
20 the file called "COPYING". 19 the file called "COPYING".
@@ -36,7 +35,6 @@
36#include "igbvf.h" 35#include "igbvf.h"
37#include <linux/if_vlan.h> 36#include <linux/if_vlan.h>
38 37
39
40struct igbvf_stats { 38struct igbvf_stats {
41 char stat_string[ETH_GSTRING_LEN]; 39 char stat_string[ETH_GSTRING_LEN];
42 int sizeof_stat; 40 int sizeof_stat;
@@ -74,7 +72,7 @@ static const char igbvf_gstrings_test[][ETH_GSTRING_LEN] = {
74#define IGBVF_TEST_LEN ARRAY_SIZE(igbvf_gstrings_test) 72#define IGBVF_TEST_LEN ARRAY_SIZE(igbvf_gstrings_test)
75 73
76static int igbvf_get_settings(struct net_device *netdev, 74static int igbvf_get_settings(struct net_device *netdev,
77 struct ethtool_cmd *ecmd) 75 struct ethtool_cmd *ecmd)
78{ 76{
79 struct igbvf_adapter *adapter = netdev_priv(netdev); 77 struct igbvf_adapter *adapter = netdev_priv(netdev);
80 struct e1000_hw *hw = &adapter->hw; 78 struct e1000_hw *hw = &adapter->hw;
@@ -111,18 +109,18 @@ static int igbvf_get_settings(struct net_device *netdev,
111} 109}
112 110
113static int igbvf_set_settings(struct net_device *netdev, 111static int igbvf_set_settings(struct net_device *netdev,
114 struct ethtool_cmd *ecmd) 112 struct ethtool_cmd *ecmd)
115{ 113{
116 return -EOPNOTSUPP; 114 return -EOPNOTSUPP;
117} 115}
118 116
119static void igbvf_get_pauseparam(struct net_device *netdev, 117static void igbvf_get_pauseparam(struct net_device *netdev,
120 struct ethtool_pauseparam *pause) 118 struct ethtool_pauseparam *pause)
121{ 119{
122} 120}
123 121
124static int igbvf_set_pauseparam(struct net_device *netdev, 122static int igbvf_set_pauseparam(struct net_device *netdev,
125 struct ethtool_pauseparam *pause) 123 struct ethtool_pauseparam *pause)
126{ 124{
127 return -EOPNOTSUPP; 125 return -EOPNOTSUPP;
128} 126}
@@ -130,12 +128,14 @@ static int igbvf_set_pauseparam(struct net_device *netdev,
130static u32 igbvf_get_msglevel(struct net_device *netdev) 128static u32 igbvf_get_msglevel(struct net_device *netdev)
131{ 129{
132 struct igbvf_adapter *adapter = netdev_priv(netdev); 130 struct igbvf_adapter *adapter = netdev_priv(netdev);
131
133 return adapter->msg_enable; 132 return adapter->msg_enable;
134} 133}
135 134
136static void igbvf_set_msglevel(struct net_device *netdev, u32 data) 135static void igbvf_set_msglevel(struct net_device *netdev, u32 data)
137{ 136{
138 struct igbvf_adapter *adapter = netdev_priv(netdev); 137 struct igbvf_adapter *adapter = netdev_priv(netdev);
138
139 adapter->msg_enable = data; 139 adapter->msg_enable = data;
140} 140}
141 141
@@ -146,7 +146,7 @@ static int igbvf_get_regs_len(struct net_device *netdev)
146} 146}
147 147
148static void igbvf_get_regs(struct net_device *netdev, 148static void igbvf_get_regs(struct net_device *netdev,
149 struct ethtool_regs *regs, void *p) 149 struct ethtool_regs *regs, void *p)
150{ 150{
151 struct igbvf_adapter *adapter = netdev_priv(netdev); 151 struct igbvf_adapter *adapter = netdev_priv(netdev);
152 struct e1000_hw *hw = &adapter->hw; 152 struct e1000_hw *hw = &adapter->hw;
@@ -175,19 +175,19 @@ static int igbvf_get_eeprom_len(struct net_device *netdev)
175} 175}
176 176
177static int igbvf_get_eeprom(struct net_device *netdev, 177static int igbvf_get_eeprom(struct net_device *netdev,
178 struct ethtool_eeprom *eeprom, u8 *bytes) 178 struct ethtool_eeprom *eeprom, u8 *bytes)
179{ 179{
180 return -EOPNOTSUPP; 180 return -EOPNOTSUPP;
181} 181}
182 182
183static int igbvf_set_eeprom(struct net_device *netdev, 183static int igbvf_set_eeprom(struct net_device *netdev,
184 struct ethtool_eeprom *eeprom, u8 *bytes) 184 struct ethtool_eeprom *eeprom, u8 *bytes)
185{ 185{
186 return -EOPNOTSUPP; 186 return -EOPNOTSUPP;
187} 187}
188 188
189static void igbvf_get_drvinfo(struct net_device *netdev, 189static void igbvf_get_drvinfo(struct net_device *netdev,
190 struct ethtool_drvinfo *drvinfo) 190 struct ethtool_drvinfo *drvinfo)
191{ 191{
192 struct igbvf_adapter *adapter = netdev_priv(netdev); 192 struct igbvf_adapter *adapter = netdev_priv(netdev);
193 193
@@ -201,7 +201,7 @@ static void igbvf_get_drvinfo(struct net_device *netdev,
201} 201}
202 202
203static void igbvf_get_ringparam(struct net_device *netdev, 203static void igbvf_get_ringparam(struct net_device *netdev,
204 struct ethtool_ringparam *ring) 204 struct ethtool_ringparam *ring)
205{ 205{
206 struct igbvf_adapter *adapter = netdev_priv(netdev); 206 struct igbvf_adapter *adapter = netdev_priv(netdev);
207 struct igbvf_ring *tx_ring = adapter->tx_ring; 207 struct igbvf_ring *tx_ring = adapter->tx_ring;
@@ -214,7 +214,7 @@ static void igbvf_get_ringparam(struct net_device *netdev,
214} 214}
215 215
216static int igbvf_set_ringparam(struct net_device *netdev, 216static int igbvf_set_ringparam(struct net_device *netdev,
217 struct ethtool_ringparam *ring) 217 struct ethtool_ringparam *ring)
218{ 218{
219 struct igbvf_adapter *adapter = netdev_priv(netdev); 219 struct igbvf_adapter *adapter = netdev_priv(netdev);
220 struct igbvf_ring *temp_ring; 220 struct igbvf_ring *temp_ring;
@@ -255,10 +255,9 @@ static int igbvf_set_ringparam(struct net_device *netdev,
255 255
256 igbvf_down(adapter); 256 igbvf_down(adapter);
257 257
258 /* 258 /* We can't just free everything and then setup again,
259 * We can't just free everything and then setup again,
260 * because the ISRs in MSI-X mode get passed pointers 259 * because the ISRs in MSI-X mode get passed pointers
261 * to the tx and rx ring structs. 260 * to the Tx and Rx ring structs.
262 */ 261 */
263 if (new_tx_count != adapter->tx_ring->count) { 262 if (new_tx_count != adapter->tx_ring->count) {
264 memcpy(temp_ring, adapter->tx_ring, sizeof(struct igbvf_ring)); 263 memcpy(temp_ring, adapter->tx_ring, sizeof(struct igbvf_ring));
@@ -283,7 +282,7 @@ static int igbvf_set_ringparam(struct net_device *netdev,
283 282
284 igbvf_free_rx_resources(adapter->rx_ring); 283 igbvf_free_rx_resources(adapter->rx_ring);
285 284
286 memcpy(adapter->rx_ring, temp_ring,sizeof(struct igbvf_ring)); 285 memcpy(adapter->rx_ring, temp_ring, sizeof(struct igbvf_ring));
287 } 286 }
288err_setup: 287err_setup:
289 igbvf_up(adapter); 288 igbvf_up(adapter);
@@ -307,14 +306,13 @@ static int igbvf_link_test(struct igbvf_adapter *adapter, u64 *data)
307} 306}
308 307
309static void igbvf_diag_test(struct net_device *netdev, 308static void igbvf_diag_test(struct net_device *netdev,
310 struct ethtool_test *eth_test, u64 *data) 309 struct ethtool_test *eth_test, u64 *data)
311{ 310{
312 struct igbvf_adapter *adapter = netdev_priv(netdev); 311 struct igbvf_adapter *adapter = netdev_priv(netdev);
313 312
314 set_bit(__IGBVF_TESTING, &adapter->state); 313 set_bit(__IGBVF_TESTING, &adapter->state);
315 314
316 /* 315 /* Link test performed before hardware reset so autoneg doesn't
317 * Link test performed before hardware reset so autoneg doesn't
318 * interfere with test result 316 * interfere with test result
319 */ 317 */
320 if (igbvf_link_test(adapter, &data[0])) 318 if (igbvf_link_test(adapter, &data[0]))
@@ -325,20 +323,20 @@ static void igbvf_diag_test(struct net_device *netdev,
325} 323}
326 324
327static void igbvf_get_wol(struct net_device *netdev, 325static void igbvf_get_wol(struct net_device *netdev,
328 struct ethtool_wolinfo *wol) 326 struct ethtool_wolinfo *wol)
329{ 327{
330 wol->supported = 0; 328 wol->supported = 0;
331 wol->wolopts = 0; 329 wol->wolopts = 0;
332} 330}
333 331
334static int igbvf_set_wol(struct net_device *netdev, 332static int igbvf_set_wol(struct net_device *netdev,
335 struct ethtool_wolinfo *wol) 333 struct ethtool_wolinfo *wol)
336{ 334{
337 return -EOPNOTSUPP; 335 return -EOPNOTSUPP;
338} 336}
339 337
340static int igbvf_get_coalesce(struct net_device *netdev, 338static int igbvf_get_coalesce(struct net_device *netdev,
341 struct ethtool_coalesce *ec) 339 struct ethtool_coalesce *ec)
342{ 340{
343 struct igbvf_adapter *adapter = netdev_priv(netdev); 341 struct igbvf_adapter *adapter = netdev_priv(netdev);
344 342
@@ -351,13 +349,13 @@ static int igbvf_get_coalesce(struct net_device *netdev,
351} 349}
352 350
353static int igbvf_set_coalesce(struct net_device *netdev, 351static int igbvf_set_coalesce(struct net_device *netdev,
354 struct ethtool_coalesce *ec) 352 struct ethtool_coalesce *ec)
355{ 353{
356 struct igbvf_adapter *adapter = netdev_priv(netdev); 354 struct igbvf_adapter *adapter = netdev_priv(netdev);
357 struct e1000_hw *hw = &adapter->hw; 355 struct e1000_hw *hw = &adapter->hw;
358 356
359 if ((ec->rx_coalesce_usecs >= IGBVF_MIN_ITR_USECS) && 357 if ((ec->rx_coalesce_usecs >= IGBVF_MIN_ITR_USECS) &&
360 (ec->rx_coalesce_usecs <= IGBVF_MAX_ITR_USECS)) { 358 (ec->rx_coalesce_usecs <= IGBVF_MAX_ITR_USECS)) {
361 adapter->current_itr = ec->rx_coalesce_usecs << 2; 359 adapter->current_itr = ec->rx_coalesce_usecs << 2;
362 adapter->requested_itr = 1000000000 / 360 adapter->requested_itr = 1000000000 /
363 (adapter->current_itr * 256); 361 (adapter->current_itr * 256);
@@ -366,8 +364,7 @@ static int igbvf_set_coalesce(struct net_device *netdev,
366 adapter->current_itr = IGBVF_START_ITR; 364 adapter->current_itr = IGBVF_START_ITR;
367 adapter->requested_itr = ec->rx_coalesce_usecs; 365 adapter->requested_itr = ec->rx_coalesce_usecs;
368 } else if (ec->rx_coalesce_usecs == 0) { 366 } else if (ec->rx_coalesce_usecs == 0) {
369 /* 367 /* The user's desire is to turn off interrupt throttling
370 * The user's desire is to turn off interrupt throttling
371 * altogether, but due to HW limitations, we can't do that. 368 * altogether, but due to HW limitations, we can't do that.
372 * Instead we set a very small value in EITR, which would 369 * Instead we set a very small value in EITR, which would
373 * allow ~967k interrupts per second, but allow the adapter's 370 * allow ~967k interrupts per second, but allow the adapter's
@@ -376,8 +373,9 @@ static int igbvf_set_coalesce(struct net_device *netdev,
376 adapter->current_itr = 4; 373 adapter->current_itr = 4;
377 adapter->requested_itr = 1000000000 / 374 adapter->requested_itr = 1000000000 /
378 (adapter->current_itr * 256); 375 (adapter->current_itr * 256);
379 } else 376 } else {
380 return -EINVAL; 377 return -EINVAL;
378 }
381 379
382 writel(adapter->current_itr, 380 writel(adapter->current_itr,
383 hw->hw_addr + adapter->rx_ring->itr_register); 381 hw->hw_addr + adapter->rx_ring->itr_register);
@@ -388,15 +386,15 @@ static int igbvf_set_coalesce(struct net_device *netdev,
388static int igbvf_nway_reset(struct net_device *netdev) 386static int igbvf_nway_reset(struct net_device *netdev)
389{ 387{
390 struct igbvf_adapter *adapter = netdev_priv(netdev); 388 struct igbvf_adapter *adapter = netdev_priv(netdev);
389
391 if (netif_running(netdev)) 390 if (netif_running(netdev))
392 igbvf_reinit_locked(adapter); 391 igbvf_reinit_locked(adapter);
393 return 0; 392 return 0;
394} 393}
395 394
396
397static void igbvf_get_ethtool_stats(struct net_device *netdev, 395static void igbvf_get_ethtool_stats(struct net_device *netdev,
398 struct ethtool_stats *stats, 396 struct ethtool_stats *stats,
399 u64 *data) 397 u64 *data)
400{ 398{
401 struct igbvf_adapter *adapter = netdev_priv(netdev); 399 struct igbvf_adapter *adapter = netdev_priv(netdev);
402 int i; 400 int i;
@@ -404,19 +402,18 @@ static void igbvf_get_ethtool_stats(struct net_device *netdev,
404 igbvf_update_stats(adapter); 402 igbvf_update_stats(adapter);
405 for (i = 0; i < IGBVF_GLOBAL_STATS_LEN; i++) { 403 for (i = 0; i < IGBVF_GLOBAL_STATS_LEN; i++) {
406 char *p = (char *)adapter + 404 char *p = (char *)adapter +
407 igbvf_gstrings_stats[i].stat_offset; 405 igbvf_gstrings_stats[i].stat_offset;
408 char *b = (char *)adapter + 406 char *b = (char *)adapter +
409 igbvf_gstrings_stats[i].base_stat_offset; 407 igbvf_gstrings_stats[i].base_stat_offset;
410 data[i] = ((igbvf_gstrings_stats[i].sizeof_stat == 408 data[i] = ((igbvf_gstrings_stats[i].sizeof_stat ==
411 sizeof(u64)) ? (*(u64 *)p - *(u64 *)b) : 409 sizeof(u64)) ? (*(u64 *)p - *(u64 *)b) :
412 (*(u32 *)p - *(u32 *)b)); 410 (*(u32 *)p - *(u32 *)b));
413 } 411 }
414
415} 412}
416 413
417static int igbvf_get_sset_count(struct net_device *dev, int stringset) 414static int igbvf_get_sset_count(struct net_device *dev, int stringset)
418{ 415{
419 switch(stringset) { 416 switch (stringset) {
420 case ETH_SS_TEST: 417 case ETH_SS_TEST:
421 return IGBVF_TEST_LEN; 418 return IGBVF_TEST_LEN;
422 case ETH_SS_STATS: 419 case ETH_SS_STATS:
@@ -427,7 +424,7 @@ static int igbvf_get_sset_count(struct net_device *dev, int stringset)
427} 424}
428 425
429static void igbvf_get_strings(struct net_device *netdev, u32 stringset, 426static void igbvf_get_strings(struct net_device *netdev, u32 stringset,
430 u8 *data) 427 u8 *data)
431{ 428{
432 u8 *p = data; 429 u8 *p = data;
433 int i; 430 int i;