aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/ixgb
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/ixgb')
-rw-r--r--drivers/net/ixgb/ixgb.h5
-rw-r--r--drivers/net/ixgb/ixgb_ee.c32
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c94
-rw-r--r--drivers/net/ixgb/ixgb_hw.c14
-rw-r--r--drivers/net/ixgb/ixgb_main.c121
-rw-r--r--drivers/net/ixgb/ixgb_param.c21
6 files changed, 142 insertions, 145 deletions
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 521c0c732998..49e8408f05fc 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -149,7 +149,7 @@ struct ixgb_desc_ring {
149 149
150struct ixgb_adapter { 150struct ixgb_adapter {
151 struct timer_list watchdog_timer; 151 struct timer_list watchdog_timer;
152 struct vlan_group *vlgrp; 152 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
153 u32 bd_number; 153 u32 bd_number;
154 u32 rx_buffer_len; 154 u32 rx_buffer_len;
155 u32 part_num; 155 u32 part_num;
@@ -157,9 +157,6 @@ struct ixgb_adapter {
157 u16 link_duplex; 157 u16 link_duplex;
158 struct work_struct tx_timeout_task; 158 struct work_struct tx_timeout_task;
159 159
160 struct timer_list blink_timer;
161 unsigned long led_status;
162
163 /* TX */ 160 /* TX */
164 struct ixgb_desc_ring tx_ring ____cacheline_aligned_in_smp; 161 struct ixgb_desc_ring tx_ring ____cacheline_aligned_in_smp;
165 unsigned int restart_queue; 162 unsigned int restart_queue;
diff --git a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
index 813993f9c65c..c982ab9f9005 100644
--- a/drivers/net/ixgb/ixgb_ee.c
+++ b/drivers/net/ixgb/ixgb_ee.c
@@ -296,12 +296,12 @@ ixgb_wait_eeprom_command(struct ixgb_hw *hw)
296 eecd_reg = IXGB_READ_REG(hw, EECD); 296 eecd_reg = IXGB_READ_REG(hw, EECD);
297 297
298 if (eecd_reg & IXGB_EECD_DO) 298 if (eecd_reg & IXGB_EECD_DO)
299 return (true); 299 return true;
300 300
301 udelay(50); 301 udelay(50);
302 } 302 }
303 ASSERT(0); 303 ASSERT(0);
304 return (false); 304 return false;
305} 305}
306 306
307/****************************************************************************** 307/******************************************************************************
@@ -327,9 +327,9 @@ ixgb_validate_eeprom_checksum(struct ixgb_hw *hw)
327 checksum += ixgb_read_eeprom(hw, i); 327 checksum += ixgb_read_eeprom(hw, i);
328 328
329 if (checksum == (u16) EEPROM_SUM) 329 if (checksum == (u16) EEPROM_SUM)
330 return (true); 330 return true;
331 else 331 else
332 return (false); 332 return false;
333} 333}
334 334
335/****************************************************************************** 335/******************************************************************************
@@ -439,7 +439,7 @@ ixgb_read_eeprom(struct ixgb_hw *hw,
439 /* End this read operation */ 439 /* End this read operation */
440 ixgb_standby_eeprom(hw); 440 ixgb_standby_eeprom(hw);
441 441
442 return (data); 442 return data;
443} 443}
444 444
445/****************************************************************************** 445/******************************************************************************
@@ -476,16 +476,16 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
476 /* clear the init_ctrl_reg_1 to signify that the cache is 476 /* clear the init_ctrl_reg_1 to signify that the cache is
477 * invalidated */ 477 * invalidated */
478 ee_map->init_ctrl_reg_1 = cpu_to_le16(EEPROM_ICW1_SIGNATURE_CLEAR); 478 ee_map->init_ctrl_reg_1 = cpu_to_le16(EEPROM_ICW1_SIGNATURE_CLEAR);
479 return (false); 479 return false;
480 } 480 }
481 481
482 if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK)) 482 if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK))
483 != cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) { 483 != cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) {
484 pr_debug("Signature invalid\n"); 484 pr_debug("Signature invalid\n");
485 return(false); 485 return false;
486 } 486 }
487 487
488 return(true); 488 return true;
489} 489}
490 490
491/****************************************************************************** 491/******************************************************************************
@@ -505,7 +505,7 @@ ixgb_check_and_get_eeprom_data (struct ixgb_hw* hw)
505 505
506 if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK)) 506 if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK))
507 == cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) { 507 == cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) {
508 return (true); 508 return true;
509 } else { 509 } else {
510 return ixgb_get_eeprom_data(hw); 510 return ixgb_get_eeprom_data(hw);
511 } 511 }
@@ -526,10 +526,10 @@ ixgb_get_eeprom_word(struct ixgb_hw *hw, u16 index)
526 526
527 if ((index < IXGB_EEPROM_SIZE) && 527 if ((index < IXGB_EEPROM_SIZE) &&
528 (ixgb_check_and_get_eeprom_data(hw) == true)) { 528 (ixgb_check_and_get_eeprom_data(hw) == true)) {
529 return(hw->eeprom[index]); 529 return hw->eeprom[index];
530 } 530 }
531 531
532 return(0); 532 return 0;
533} 533}
534 534
535/****************************************************************************** 535/******************************************************************************
@@ -570,10 +570,10 @@ u32
570ixgb_get_ee_pba_number(struct ixgb_hw *hw) 570ixgb_get_ee_pba_number(struct ixgb_hw *hw)
571{ 571{
572 if (ixgb_check_and_get_eeprom_data(hw) == true) 572 if (ixgb_check_and_get_eeprom_data(hw) == true)
573 return (le16_to_cpu(hw->eeprom[EEPROM_PBA_1_2_REG]) 573 return le16_to_cpu(hw->eeprom[EEPROM_PBA_1_2_REG])
574 | (le16_to_cpu(hw->eeprom[EEPROM_PBA_3_4_REG])<<16)); 574 | (le16_to_cpu(hw->eeprom[EEPROM_PBA_3_4_REG])<<16);
575 575
576 return(0); 576 return 0;
577} 577}
578 578
579 579
@@ -591,8 +591,8 @@ ixgb_get_ee_device_id(struct ixgb_hw *hw)
591 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 591 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
592 592
593 if (ixgb_check_and_get_eeprom_data(hw) == true) 593 if (ixgb_check_and_get_eeprom_data(hw) == true)
594 return (le16_to_cpu(ee_map->device_id)); 594 return le16_to_cpu(ee_map->device_id);
595 595
596 return (0); 596 return 0;
597} 597}
598 598
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index a4ed96caae69..6da890b9534c 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -104,10 +104,10 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
104 ecmd->transceiver = XCVR_EXTERNAL; 104 ecmd->transceiver = XCVR_EXTERNAL;
105 105
106 if (netif_carrier_ok(adapter->netdev)) { 106 if (netif_carrier_ok(adapter->netdev)) {
107 ecmd->speed = SPEED_10000; 107 ethtool_cmd_speed_set(ecmd, SPEED_10000);
108 ecmd->duplex = DUPLEX_FULL; 108 ecmd->duplex = DUPLEX_FULL;
109 } else { 109 } else {
110 ecmd->speed = -1; 110 ethtool_cmd_speed_set(ecmd, -1);
111 ecmd->duplex = -1; 111 ecmd->duplex = -1;
112 } 112 }
113 113
@@ -129,9 +129,10 @@ static int
129ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) 129ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
130{ 130{
131 struct ixgb_adapter *adapter = netdev_priv(netdev); 131 struct ixgb_adapter *adapter = netdev_priv(netdev);
132 u32 speed = ethtool_cmd_speed(ecmd);
132 133
133 if (ecmd->autoneg == AUTONEG_ENABLE || 134 if (ecmd->autoneg == AUTONEG_ENABLE ||
134 ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL) 135 (speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL))
135 return -EINVAL; 136 return -EINVAL;
136 137
137 if (netif_running(adapter->netdev)) { 138 if (netif_running(adapter->netdev)) {
@@ -410,7 +411,7 @@ static int
410ixgb_get_eeprom_len(struct net_device *netdev) 411ixgb_get_eeprom_len(struct net_device *netdev)
411{ 412{
412 /* return size in bytes */ 413 /* return size in bytes */
413 return (IXGB_EEPROM_SIZE << 1); 414 return IXGB_EEPROM_SIZE << 1;
414} 415}
415 416
416static int 417static int
@@ -610,45 +611,23 @@ err_setup_rx:
610 return err; 611 return err;
611} 612}
612 613
613/* toggle LED 4 times per second = 2 "blinks" per second */
614#define IXGB_ID_INTERVAL (HZ/4)
615
616/* bit defines for adapter->led_status */
617#define IXGB_LED_ON 0
618
619static void
620ixgb_led_blink_callback(unsigned long data)
621{
622 struct ixgb_adapter *adapter = (struct ixgb_adapter *)data;
623
624 if (test_and_change_bit(IXGB_LED_ON, &adapter->led_status))
625 ixgb_led_off(&adapter->hw);
626 else
627 ixgb_led_on(&adapter->hw);
628
629 mod_timer(&adapter->blink_timer, jiffies + IXGB_ID_INTERVAL);
630}
631
632static int 614static int
633ixgb_phys_id(struct net_device *netdev, u32 data) 615ixgb_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state)
634{ 616{
635 struct ixgb_adapter *adapter = netdev_priv(netdev); 617 struct ixgb_adapter *adapter = netdev_priv(netdev);
636 618
637 if (!data) 619 switch (state) {
638 data = INT_MAX; 620 case ETHTOOL_ID_ACTIVE:
639 621 return 2;
640 if (!adapter->blink_timer.function) {
641 init_timer(&adapter->blink_timer);
642 adapter->blink_timer.function = ixgb_led_blink_callback;
643 adapter->blink_timer.data = (unsigned long)adapter;
644 }
645 622
646 mod_timer(&adapter->blink_timer, jiffies); 623 case ETHTOOL_ID_ON:
624 ixgb_led_on(&adapter->hw);
625 break;
647 626
648 msleep_interruptible(data * 1000); 627 case ETHTOOL_ID_OFF:
649 del_timer_sync(&adapter->blink_timer); 628 case ETHTOOL_ID_INACTIVE:
650 ixgb_led_off(&adapter->hw); 629 ixgb_led_off(&adapter->hw);
651 clear_bit(IXGB_LED_ON, &adapter->led_status); 630 }
652 631
653 return 0; 632 return 0;
654} 633}
@@ -706,6 +685,43 @@ ixgb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
706 } 685 }
707} 686}
708 687
688static int ixgb_set_flags(struct net_device *netdev, u32 data)
689{
690 struct ixgb_adapter *adapter = netdev_priv(netdev);
691 bool need_reset;
692 int rc;
693
694 /*
695 * Tx VLAN insertion does not work per HW design when Rx stripping is
696 * disabled. Disable txvlan when rxvlan is turned off, and enable
697 * rxvlan when txvlan is turned on.
698 */
699 if (!(data & ETH_FLAG_RXVLAN) &&
700 (netdev->features & NETIF_F_HW_VLAN_TX))
701 data &= ~ETH_FLAG_TXVLAN;
702 else if (data & ETH_FLAG_TXVLAN)
703 data |= ETH_FLAG_RXVLAN;
704
705 need_reset = (data & ETH_FLAG_RXVLAN) !=
706 (netdev->features & NETIF_F_HW_VLAN_RX);
707
708 rc = ethtool_op_set_flags(netdev, data, ETH_FLAG_RXVLAN |
709 ETH_FLAG_TXVLAN);
710 if (rc)
711 return rc;
712
713 if (need_reset) {
714 if (netif_running(netdev)) {
715 ixgb_down(adapter, true);
716 ixgb_up(adapter);
717 ixgb_set_speed_duplex(netdev);
718 } else
719 ixgb_reset(adapter);
720 }
721
722 return 0;
723}
724
709static const struct ethtool_ops ixgb_ethtool_ops = { 725static const struct ethtool_ops ixgb_ethtool_ops = {
710 .get_settings = ixgb_get_settings, 726 .get_settings = ixgb_get_settings,
711 .set_settings = ixgb_set_settings, 727 .set_settings = ixgb_set_settings,
@@ -729,9 +745,11 @@ static const struct ethtool_ops ixgb_ethtool_ops = {
729 .set_msglevel = ixgb_set_msglevel, 745 .set_msglevel = ixgb_set_msglevel,
730 .set_tso = ixgb_set_tso, 746 .set_tso = ixgb_set_tso,
731 .get_strings = ixgb_get_strings, 747 .get_strings = ixgb_get_strings,
732 .phys_id = ixgb_phys_id, 748 .set_phys_id = ixgb_set_phys_id,
733 .get_sset_count = ixgb_get_sset_count, 749 .get_sset_count = ixgb_get_sset_count,
734 .get_ethtool_stats = ixgb_get_ethtool_stats, 750 .get_ethtool_stats = ixgb_get_ethtool_stats,
751 .get_flags = ethtool_op_get_flags,
752 .set_flags = ixgb_set_flags,
735}; 753};
736 754
737void ixgb_set_ethtool_ops(struct net_device *netdev) 755void ixgb_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index 397acabccab6..6cb2e42ff4c1 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -167,7 +167,7 @@ ixgb_adapter_stop(struct ixgb_hw *hw)
167 /* Clear any pending interrupt events. */ 167 /* Clear any pending interrupt events. */
168 icr_reg = IXGB_READ_REG(hw, ICR); 168 icr_reg = IXGB_READ_REG(hw, ICR);
169 169
170 return (ctrl_reg & IXGB_CTRL0_RST); 170 return ctrl_reg & IXGB_CTRL0_RST;
171} 171}
172 172
173 173
@@ -209,7 +209,7 @@ ixgb_identify_xpak_vendor(struct ixgb_hw *hw)
209 xpak_vendor = ixgb_xpak_vendor_infineon; 209 xpak_vendor = ixgb_xpak_vendor_infineon;
210 } 210 }
211 211
212 return (xpak_vendor); 212 return xpak_vendor;
213} 213}
214 214
215/****************************************************************************** 215/******************************************************************************
@@ -273,7 +273,7 @@ ixgb_identify_phy(struct ixgb_hw *hw)
273 if (hw->subsystem_vendor_id == SUN_SUBVENDOR_ID) 273 if (hw->subsystem_vendor_id == SUN_SUBVENDOR_ID)
274 phy_type = ixgb_phy_type_bcm; 274 phy_type = ixgb_phy_type_bcm;
275 275
276 return (phy_type); 276 return phy_type;
277} 277}
278 278
279/****************************************************************************** 279/******************************************************************************
@@ -366,7 +366,7 @@ ixgb_init_hw(struct ixgb_hw *hw)
366 /* 82597EX errata: Call check-for-link in case lane deskew is locked */ 366 /* 82597EX errata: Call check-for-link in case lane deskew is locked */
367 ixgb_check_for_link(hw); 367 ixgb_check_for_link(hw);
368 368
369 return (status); 369 return status;
370} 370}
371 371
372/****************************************************************************** 372/******************************************************************************
@@ -531,7 +531,7 @@ ixgb_hash_mc_addr(struct ixgb_hw *hw,
531 } 531 }
532 532
533 hash_value &= 0xFFF; 533 hash_value &= 0xFFF;
534 return (hash_value); 534 return hash_value;
535} 535}
536 536
537/****************************************************************************** 537/******************************************************************************
@@ -715,7 +715,7 @@ ixgb_setup_fc(struct ixgb_hw *hw)
715 } 715 }
716 IXGB_WRITE_REG(hw, FCRTH, hw->fc.high_water); 716 IXGB_WRITE_REG(hw, FCRTH, hw->fc.high_water);
717 } 717 }
718 return (status); 718 return status;
719} 719}
720 720
721/****************************************************************************** 721/******************************************************************************
@@ -1140,7 +1140,7 @@ mac_addr_valid(u8 *mac_addr)
1140 pr_debug("MAC address is all zeros\n"); 1140 pr_debug("MAC address is all zeros\n");
1141 is_valid = false; 1141 is_valid = false;
1142 } 1142 }
1143 return (is_valid); 1143 return is_valid;
1144} 1144}
1145 1145
1146/****************************************************************************** 1146/******************************************************************************
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 45fc89b9ba64..6a130eb51cfa 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -28,6 +28,7 @@
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30 30
31#include <linux/prefetch.h>
31#include "ixgb.h" 32#include "ixgb.h"
32 33
33char ixgb_driver_name[] = "ixgb"; 34char ixgb_driver_name[] = "ixgb";
@@ -98,8 +99,8 @@ static void ixgb_alloc_rx_buffers(struct ixgb_adapter *, int);
98static void ixgb_tx_timeout(struct net_device *dev); 99static void ixgb_tx_timeout(struct net_device *dev);
99static void ixgb_tx_timeout_task(struct work_struct *work); 100static void ixgb_tx_timeout_task(struct work_struct *work);
100 101
101static void ixgb_vlan_rx_register(struct net_device *netdev, 102static void ixgb_vlan_strip_enable(struct ixgb_adapter *adapter);
102 struct vlan_group *grp); 103static void ixgb_vlan_strip_disable(struct ixgb_adapter *adapter);
103static void ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid); 104static void ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
104static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); 105static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
105static void ixgb_restore_vlan(struct ixgb_adapter *adapter); 106static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
@@ -334,7 +335,6 @@ static const struct net_device_ops ixgb_netdev_ops = {
334 .ndo_set_mac_address = ixgb_set_mac, 335 .ndo_set_mac_address = ixgb_set_mac,
335 .ndo_change_mtu = ixgb_change_mtu, 336 .ndo_change_mtu = ixgb_change_mtu,
336 .ndo_tx_timeout = ixgb_tx_timeout, 337 .ndo_tx_timeout = ixgb_tx_timeout,
337 .ndo_vlan_rx_register = ixgb_vlan_rx_register,
338 .ndo_vlan_rx_add_vid = ixgb_vlan_rx_add_vid, 338 .ndo_vlan_rx_add_vid = ixgb_vlan_rx_add_vid,
339 .ndo_vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid, 339 .ndo_vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid,
340#ifdef CONFIG_NET_POLL_CONTROLLER 340#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -446,8 +446,10 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
446 NETIF_F_HW_VLAN_FILTER; 446 NETIF_F_HW_VLAN_FILTER;
447 netdev->features |= NETIF_F_TSO; 447 netdev->features |= NETIF_F_TSO;
448 448
449 if (pci_using_dac) 449 if (pci_using_dac) {
450 netdev->features |= NETIF_F_HIGHDMA; 450 netdev->features |= NETIF_F_HIGHDMA;
451 netdev->vlan_features |= NETIF_F_HIGHDMA;
452 }
451 453
452 /* make sure the EEPROM is good */ 454 /* make sure the EEPROM is good */
453 455
@@ -470,7 +472,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
470 adapter->part_num = ixgb_get_ee_pba_number(&adapter->hw); 472 adapter->part_num = ixgb_get_ee_pba_number(&adapter->hw);
471 473
472 init_timer(&adapter->watchdog_timer); 474 init_timer(&adapter->watchdog_timer);
473 adapter->watchdog_timer.function = &ixgb_watchdog; 475 adapter->watchdog_timer.function = ixgb_watchdog;
474 adapter->watchdog_timer.data = (unsigned long)adapter; 476 adapter->watchdog_timer.data = (unsigned long)adapter;
475 477
476 INIT_WORK(&adapter->tx_timeout_task, ixgb_tx_timeout_task); 478 INIT_WORK(&adapter->tx_timeout_task, ixgb_tx_timeout_task);
@@ -523,7 +525,7 @@ ixgb_remove(struct pci_dev *pdev)
523 struct net_device *netdev = pci_get_drvdata(pdev); 525 struct net_device *netdev = pci_get_drvdata(pdev);
524 struct ixgb_adapter *adapter = netdev_priv(netdev); 526 struct ixgb_adapter *adapter = netdev_priv(netdev);
525 527
526 flush_scheduled_work(); 528 cancel_work_sync(&adapter->tx_timeout_task);
527 529
528 unregister_netdev(netdev); 530 unregister_netdev(netdev);
529 531
@@ -531,6 +533,7 @@ ixgb_remove(struct pci_dev *pdev)
531 pci_release_regions(pdev); 533 pci_release_regions(pdev);
532 534
533 free_netdev(netdev); 535 free_netdev(netdev);
536 pci_disable_device(pdev);
534} 537}
535 538
536/** 539/**
@@ -666,13 +669,12 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
666 int size; 669 int size;
667 670
668 size = sizeof(struct ixgb_buffer) * txdr->count; 671 size = sizeof(struct ixgb_buffer) * txdr->count;
669 txdr->buffer_info = vmalloc(size); 672 txdr->buffer_info = vzalloc(size);
670 if (!txdr->buffer_info) { 673 if (!txdr->buffer_info) {
671 netif_err(adapter, probe, adapter->netdev, 674 netif_err(adapter, probe, adapter->netdev,
672 "Unable to allocate transmit descriptor ring memory\n"); 675 "Unable to allocate transmit descriptor ring memory\n");
673 return -ENOMEM; 676 return -ENOMEM;
674 } 677 }
675 memset(txdr->buffer_info, 0, size);
676 678
677 /* round up to nearest 4K */ 679 /* round up to nearest 4K */
678 680
@@ -756,13 +758,12 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
756 int size; 758 int size;
757 759
758 size = sizeof(struct ixgb_buffer) * rxdr->count; 760 size = sizeof(struct ixgb_buffer) * rxdr->count;
759 rxdr->buffer_info = vmalloc(size); 761 rxdr->buffer_info = vzalloc(size);
760 if (!rxdr->buffer_info) { 762 if (!rxdr->buffer_info) {
761 netif_err(adapter, probe, adapter->netdev, 763 netif_err(adapter, probe, adapter->netdev,
762 "Unable to allocate receive descriptor ring\n"); 764 "Unable to allocate receive descriptor ring\n");
763 return -ENOMEM; 765 return -ENOMEM;
764 } 766 }
765 memset(rxdr->buffer_info, 0, size);
766 767
767 /* Round up to nearest 4K */ 768 /* Round up to nearest 4K */
768 769
@@ -1075,6 +1076,8 @@ ixgb_set_multi(struct net_device *netdev)
1075 1076
1076 if (netdev->flags & IFF_PROMISC) { 1077 if (netdev->flags & IFF_PROMISC) {
1077 rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE); 1078 rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE);
1079 /* disable VLAN filtering */
1080 rctl &= ~IXGB_RCTL_CFIEN;
1078 rctl &= ~IXGB_RCTL_VFE; 1081 rctl &= ~IXGB_RCTL_VFE;
1079 } else { 1082 } else {
1080 if (netdev->flags & IFF_ALLMULTI) { 1083 if (netdev->flags & IFF_ALLMULTI) {
@@ -1083,7 +1086,9 @@ ixgb_set_multi(struct net_device *netdev)
1083 } else { 1086 } else {
1084 rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE); 1087 rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE);
1085 } 1088 }
1089 /* enable VLAN filtering */
1086 rctl |= IXGB_RCTL_VFE; 1090 rctl |= IXGB_RCTL_VFE;
1091 rctl &= ~IXGB_RCTL_CFIEN;
1087 } 1092 }
1088 1093
1089 if (netdev_mc_count(netdev) > IXGB_MAX_NUM_MULTICAST_ADDRESSES) { 1094 if (netdev_mc_count(netdev) > IXGB_MAX_NUM_MULTICAST_ADDRESSES) {
@@ -1102,6 +1107,12 @@ ixgb_set_multi(struct net_device *netdev)
1102 1107
1103 ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0); 1108 ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0);
1104 } 1109 }
1110
1111 if (netdev->features & NETIF_F_HW_VLAN_RX)
1112 ixgb_vlan_strip_enable(adapter);
1113 else
1114 ixgb_vlan_strip_disable(adapter);
1115
1105} 1116}
1106 1117
1107/** 1118/**
@@ -1249,7 +1260,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
1249 1260
1250 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { 1261 if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
1251 struct ixgb_buffer *buffer_info; 1262 struct ixgb_buffer *buffer_info;
1252 css = skb_transport_offset(skb); 1263 css = skb_checksum_start_offset(skb);
1253 cso = css + skb->csum_offset; 1264 cso = css + skb->csum_offset;
1254 1265
1255 i = adapter->tx_ring.next_to_use; 1266 i = adapter->tx_ring.next_to_use;
@@ -1495,7 +1506,7 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1495 DESC_NEEDED))) 1506 DESC_NEEDED)))
1496 return NETDEV_TX_BUSY; 1507 return NETDEV_TX_BUSY;
1497 1508
1498 if (adapter->vlgrp && vlan_tx_tag_present(skb)) { 1509 if (vlan_tx_tag_present(skb)) {
1499 tx_flags |= IXGB_TX_FLAGS_VLAN; 1510 tx_flags |= IXGB_TX_FLAGS_VLAN;
1500 vlan_id = vlan_tx_tag_get(skb); 1511 vlan_id = vlan_tx_tag_get(skb);
1501 } 1512 }
@@ -1905,7 +1916,7 @@ ixgb_rx_checksum(struct ixgb_adapter *adapter,
1905 */ 1916 */
1906 if ((rx_desc->status & IXGB_RX_DESC_STATUS_IXSM) || 1917 if ((rx_desc->status & IXGB_RX_DESC_STATUS_IXSM) ||
1907 (!(rx_desc->status & IXGB_RX_DESC_STATUS_TCPCS))) { 1918 (!(rx_desc->status & IXGB_RX_DESC_STATUS_TCPCS))) {
1908 skb->ip_summed = CHECKSUM_NONE; 1919 skb_checksum_none_assert(skb);
1909 return; 1920 return;
1910 } 1921 }
1911 1922
@@ -1913,7 +1924,7 @@ ixgb_rx_checksum(struct ixgb_adapter *adapter,
1913 /* now look at the TCP checksum error bit */ 1924 /* now look at the TCP checksum error bit */
1914 if (rx_desc->errors & IXGB_RX_DESC_ERRORS_TCPE) { 1925 if (rx_desc->errors & IXGB_RX_DESC_ERRORS_TCPE) {
1915 /* let the stack verify checksum errors */ 1926 /* let the stack verify checksum errors */
1916 skb->ip_summed = CHECKSUM_NONE; 1927 skb_checksum_none_assert(skb);
1917 adapter->hw_csum_rx_error++; 1928 adapter->hw_csum_rx_error++;
1918 } else { 1929 } else {
1919 /* TCP checksum is good */ 1930 /* TCP checksum is good */
@@ -2036,12 +2047,11 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
2036 ixgb_rx_checksum(adapter, rx_desc, skb); 2047 ixgb_rx_checksum(adapter, rx_desc, skb);
2037 2048
2038 skb->protocol = eth_type_trans(skb, netdev); 2049 skb->protocol = eth_type_trans(skb, netdev);
2039 if (adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { 2050 if (status & IXGB_RX_DESC_STATUS_VP)
2040 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 2051 __vlan_hwaccel_put_tag(skb,
2041 le16_to_cpu(rx_desc->special)); 2052 le16_to_cpu(rx_desc->special));
2042 } else { 2053
2043 netif_receive_skb(skb); 2054 netif_receive_skb(skb);
2044 }
2045 2055
2046rxdesc_done: 2056rxdesc_done:
2047 /* clean up descriptor, might be written over by hw */ 2057 /* clean up descriptor, might be written over by hw */
@@ -2139,43 +2149,26 @@ map_skb:
2139 } 2149 }
2140} 2150}
2141 2151
2142/**
2143 * ixgb_vlan_rx_register - enables or disables vlan tagging/stripping.
2144 *
2145 * @param netdev network interface device structure
2146 * @param grp indicates to enable or disable tagging/stripping
2147 **/
2148static void 2152static void
2149ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) 2153ixgb_vlan_strip_enable(struct ixgb_adapter *adapter)
2150{ 2154{
2151 struct ixgb_adapter *adapter = netdev_priv(netdev); 2155 u32 ctrl;
2152 u32 ctrl, rctl;
2153
2154 ixgb_irq_disable(adapter);
2155 adapter->vlgrp = grp;
2156 2156
2157 if (grp) { 2157 /* enable VLAN tag insert/strip */
2158 /* enable VLAN tag insert/strip */ 2158 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
2159 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0); 2159 ctrl |= IXGB_CTRL0_VME;
2160 ctrl |= IXGB_CTRL0_VME; 2160 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
2161 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl); 2161}
2162
2163 /* enable VLAN receive filtering */
2164
2165 rctl = IXGB_READ_REG(&adapter->hw, RCTL);
2166 rctl &= ~IXGB_RCTL_CFIEN;
2167 IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
2168 } else {
2169 /* disable VLAN tag insert/strip */
2170 2162
2171 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0); 2163static void
2172 ctrl &= ~IXGB_CTRL0_VME; 2164ixgb_vlan_strip_disable(struct ixgb_adapter *adapter)
2173 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl); 2165{
2174 } 2166 u32 ctrl;
2175 2167
2176 /* don't enable interrupts unless we are UP */ 2168 /* disable VLAN tag insert/strip */
2177 if (adapter->netdev->flags & IFF_UP) 2169 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
2178 ixgb_irq_enable(adapter); 2170 ctrl &= ~IXGB_CTRL0_VME;
2171 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
2179} 2172}
2180 2173
2181static void 2174static void
@@ -2190,6 +2183,7 @@ ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
2190 vfta = IXGB_READ_REG_ARRAY(&adapter->hw, VFTA, index); 2183 vfta = IXGB_READ_REG_ARRAY(&adapter->hw, VFTA, index);
2191 vfta |= (1 << (vid & 0x1F)); 2184 vfta |= (1 << (vid & 0x1F));
2192 ixgb_write_vfta(&adapter->hw, index, vfta); 2185 ixgb_write_vfta(&adapter->hw, index, vfta);
2186 set_bit(vid, adapter->active_vlans);
2193} 2187}
2194 2188
2195static void 2189static void
@@ -2198,35 +2192,22 @@ ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
2198 struct ixgb_adapter *adapter = netdev_priv(netdev); 2192 struct ixgb_adapter *adapter = netdev_priv(netdev);
2199 u32 vfta, index; 2193 u32 vfta, index;
2200 2194
2201 ixgb_irq_disable(adapter);
2202
2203 vlan_group_set_device(adapter->vlgrp, vid, NULL);
2204
2205 /* don't enable interrupts unless we are UP */
2206 if (adapter->netdev->flags & IFF_UP)
2207 ixgb_irq_enable(adapter);
2208
2209 /* remove VID from filter table */ 2195 /* remove VID from filter table */
2210 2196
2211 index = (vid >> 5) & 0x7F; 2197 index = (vid >> 5) & 0x7F;
2212 vfta = IXGB_READ_REG_ARRAY(&adapter->hw, VFTA, index); 2198 vfta = IXGB_READ_REG_ARRAY(&adapter->hw, VFTA, index);
2213 vfta &= ~(1 << (vid & 0x1F)); 2199 vfta &= ~(1 << (vid & 0x1F));
2214 ixgb_write_vfta(&adapter->hw, index, vfta); 2200 ixgb_write_vfta(&adapter->hw, index, vfta);
2201 clear_bit(vid, adapter->active_vlans);
2215} 2202}
2216 2203
2217static void 2204static void
2218ixgb_restore_vlan(struct ixgb_adapter *adapter) 2205ixgb_restore_vlan(struct ixgb_adapter *adapter)
2219{ 2206{
2220 ixgb_vlan_rx_register(adapter->netdev, adapter->vlgrp); 2207 u16 vid;
2221 2208
2222 if (adapter->vlgrp) { 2209 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
2223 u16 vid; 2210 ixgb_vlan_rx_add_vid(adapter->netdev, vid);
2224 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
2225 if (!vlan_group_get_device(adapter->vlgrp, vid))
2226 continue;
2227 ixgb_vlan_rx_add_vid(adapter->netdev, vid);
2228 }
2229 }
2230} 2211}
2231 2212
2232#ifdef CONFIG_NET_POLL_CONTROLLER 2213#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index 88a08f056241..dd7fbeb1f7d1 100644
--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -191,9 +191,9 @@ struct ixgb_option {
191 } r; 191 } r;
192 struct { /* list_option info */ 192 struct { /* list_option info */
193 int nr; 193 int nr;
194 struct ixgb_opt_list { 194 const struct ixgb_opt_list {
195 int i; 195 int i;
196 char *str; 196 const char *str;
197 } *p; 197 } *p;
198 } l; 198 } l;
199 } arg; 199 } arg;
@@ -226,7 +226,7 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)
226 break; 226 break;
227 case list_option: { 227 case list_option: {
228 int i; 228 int i;
229 struct ixgb_opt_list *ent; 229 const struct ixgb_opt_list *ent;
230 230
231 for (i = 0; i < opt->arg.l.nr; i++) { 231 for (i = 0; i < opt->arg.l.nr; i++) {
232 ent = &opt->arg.l.p[i]; 232 ent = &opt->arg.l.p[i];
@@ -322,14 +322,15 @@ ixgb_check_options(struct ixgb_adapter *adapter)
322 } 322 }
323 { /* Flow Control */ 323 { /* Flow Control */
324 324
325 struct ixgb_opt_list fc_list[] = 325 static const struct ixgb_opt_list fc_list[] = {
326 {{ ixgb_fc_none, "Flow Control Disabled" }, 326 { ixgb_fc_none, "Flow Control Disabled" },
327 { ixgb_fc_rx_pause,"Flow Control Receive Only" }, 327 { ixgb_fc_rx_pause, "Flow Control Receive Only" },
328 { ixgb_fc_tx_pause,"Flow Control Transmit Only" }, 328 { ixgb_fc_tx_pause, "Flow Control Transmit Only" },
329 { ixgb_fc_full, "Flow Control Enabled" }, 329 { ixgb_fc_full, "Flow Control Enabled" },
330 { ixgb_fc_default, "Flow Control Hardware Default" }}; 330 { ixgb_fc_default, "Flow Control Hardware Default" }
331 };
331 332
332 const struct ixgb_option opt = { 333 static const struct ixgb_option opt = {
333 .type = list_option, 334 .type = list_option,
334 .name = "Flow Control", 335 .name = "Flow Control",
335 .err = "reading default settings from EEPROM", 336 .err = "reading default settings from EEPROM",