aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-04-16 20:35:26 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-16 20:35:26 -0400
commita54bfa40fd16aeb90bc556189221576f746f8567 (patch)
tree176bb7a99ffab5f42f0dd4e9671f335be3f3efa0 /drivers/net/ixgbe
parentfe957c40ec5e2763b9977c565beab3bde3aaf85b (diff)
parent134ffb4cad92a6aa534e55a9be145bca780a32c1 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c59
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c40
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c55
-rw-r--r--drivers/net/ixgbe/ixgbe_common.h3
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c24
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c57
6 files changed, 128 insertions, 110 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index a7ae4d45b53d..03eb54f4f1cc 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -921,61 +921,6 @@ static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw)
921} 921}
922 922
923/** 923/**
924 * ixgbe_blink_led_start_82598 - Blink LED based on index.
925 * @hw: pointer to hardware structure
926 * @index: led number to blink
927 **/
928static s32 ixgbe_blink_led_start_82598(struct ixgbe_hw *hw, u32 index)
929{
930 ixgbe_link_speed speed = 0;
931 bool link_up = 0;
932 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
933 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
934
935 /*
936 * Link must be up to auto-blink the LEDs on the 82598EB MAC;
937 * force it if link is down.
938 */
939 hw->mac.ops.check_link(hw, &speed, &link_up, false);
940
941 if (!link_up) {
942 autoc_reg |= IXGBE_AUTOC_FLU;
943 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
944 msleep(10);
945 }
946
947 led_reg &= ~IXGBE_LED_MODE_MASK(index);
948 led_reg |= IXGBE_LED_BLINK(index);
949 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
950 IXGBE_WRITE_FLUSH(hw);
951
952 return 0;
953}
954
955/**
956 * ixgbe_blink_led_stop_82598 - Stop blinking LED based on index.
957 * @hw: pointer to hardware structure
958 * @index: led number to stop blinking
959 **/
960static s32 ixgbe_blink_led_stop_82598(struct ixgbe_hw *hw, u32 index)
961{
962 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
963 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
964
965 autoc_reg &= ~IXGBE_AUTOC_FLU;
966 autoc_reg |= IXGBE_AUTOC_AN_RESTART;
967 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
968
969 led_reg &= ~IXGBE_LED_MODE_MASK(index);
970 led_reg &= ~IXGBE_LED_BLINK(index);
971 led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
972 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
973 IXGBE_WRITE_FLUSH(hw);
974
975 return 0;
976}
977
978/**
979 * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register 924 * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register
980 * @hw: pointer to hardware structure 925 * @hw: pointer to hardware structure
981 * @reg: analog register to read 926 * @reg: analog register to read
@@ -1197,8 +1142,8 @@ static struct ixgbe_mac_operations mac_ops_82598 = {
1197 .get_link_capabilities = &ixgbe_get_link_capabilities_82598, 1142 .get_link_capabilities = &ixgbe_get_link_capabilities_82598,
1198 .led_on = &ixgbe_led_on_generic, 1143 .led_on = &ixgbe_led_on_generic,
1199 .led_off = &ixgbe_led_off_generic, 1144 .led_off = &ixgbe_led_off_generic,
1200 .blink_led_start = &ixgbe_blink_led_start_82598, 1145 .blink_led_start = &ixgbe_blink_led_start_generic,
1201 .blink_led_stop = &ixgbe_blink_led_stop_82598, 1146 .blink_led_stop = &ixgbe_blink_led_stop_generic,
1202 .set_rar = &ixgbe_set_rar_generic, 1147 .set_rar = &ixgbe_set_rar_generic,
1203 .clear_rar = &ixgbe_clear_rar_generic, 1148 .clear_rar = &ixgbe_clear_rar_generic,
1204 .set_vmdq = &ixgbe_set_vmdq_82598, 1149 .set_vmdq = &ixgbe_set_vmdq_82598,
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index b3f4e96a018c..9e824b450416 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -68,8 +68,6 @@ s32 ixgbe_clear_vmdq_82599(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
68s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan, 68s32 ixgbe_set_vfta_82599(struct ixgbe_hw *hw, u32 vlan,
69 u32 vind, bool vlan_on); 69 u32 vind, bool vlan_on);
70s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw); 70s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw);
71s32 ixgbe_blink_led_stop_82599(struct ixgbe_hw *hw, u32 index);
72s32 ixgbe_blink_led_start_82599(struct ixgbe_hw *hw, u32 index);
73s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw); 71s32 ixgbe_init_uta_tables_82599(struct ixgbe_hw *hw);
74s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val); 72s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val);
75s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val); 73s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val);
@@ -1039,40 +1037,6 @@ s32 ixgbe_clear_vfta_82599(struct ixgbe_hw *hw)
1039} 1037}
1040 1038
1041/** 1039/**
1042 * ixgbe_blink_led_start_82599 - Blink LED based on index.
1043 * @hw: pointer to hardware structure
1044 * @index: led number to blink
1045 **/
1046s32 ixgbe_blink_led_start_82599(struct ixgbe_hw *hw, u32 index)
1047{
1048 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
1049
1050 led_reg &= ~IXGBE_LED_MODE_MASK(index);
1051 led_reg |= IXGBE_LED_BLINK(index);
1052 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
1053 IXGBE_WRITE_FLUSH(hw);
1054
1055 return 0;
1056}
1057
1058/**
1059 * ixgbe_blink_led_stop_82599 - Stop blinking LED based on index.
1060 * @hw: pointer to hardware structure
1061 * @index: led number to stop blinking
1062 **/
1063s32 ixgbe_blink_led_stop_82599(struct ixgbe_hw *hw, u32 index)
1064{
1065 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
1066
1067 led_reg &= ~IXGBE_LED_MODE_MASK(index);
1068 led_reg &= ~IXGBE_LED_BLINK(index);
1069 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
1070 IXGBE_WRITE_FLUSH(hw);
1071
1072 return 0;
1073}
1074
1075/**
1076 * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array 1040 * ixgbe_init_uta_tables_82599 - Initialize the Unicast Table Array
1077 * @hw: pointer to hardware structure 1041 * @hw: pointer to hardware structure
1078 **/ 1042 **/
@@ -1353,8 +1317,8 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
1353 .get_link_capabilities = &ixgbe_get_link_capabilities_82599, 1317 .get_link_capabilities = &ixgbe_get_link_capabilities_82599,
1354 .led_on = &ixgbe_led_on_generic, 1318 .led_on = &ixgbe_led_on_generic,
1355 .led_off = &ixgbe_led_off_generic, 1319 .led_off = &ixgbe_led_off_generic,
1356 .blink_led_start = &ixgbe_blink_led_start_82599, 1320 .blink_led_start = &ixgbe_blink_led_start_generic,
1357 .blink_led_stop = &ixgbe_blink_led_stop_82599, 1321 .blink_led_stop = &ixgbe_blink_led_stop_generic,
1358 .set_rar = &ixgbe_set_rar_generic, 1322 .set_rar = &ixgbe_set_rar_generic,
1359 .clear_rar = &ixgbe_clear_rar_generic, 1323 .clear_rar = &ixgbe_clear_rar_generic,
1360 .set_vmdq = &ixgbe_set_vmdq_82599, 1324 .set_vmdq = &ixgbe_set_vmdq_82599,
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 2d4af5d2d3f7..5f2ee34e9d1d 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -2074,3 +2074,58 @@ s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval)
2074 2074
2075 return 0; 2075 return 0;
2076} 2076}
2077
2078/**
2079 * ixgbe_blink_led_start_generic - Blink LED based on index.
2080 * @hw: pointer to hardware structure
2081 * @index: led number to blink
2082 **/
2083s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
2084{
2085 ixgbe_link_speed speed = 0;
2086 bool link_up = 0;
2087 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
2088 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
2089
2090 /*
2091 * Link must be up to auto-blink the LEDs;
2092 * Force it if link is down.
2093 */
2094 hw->mac.ops.check_link(hw, &speed, &link_up, false);
2095
2096 if (!link_up) {
2097 autoc_reg |= IXGBE_AUTOC_FLU;
2098 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2099 msleep(10);
2100 }
2101
2102 led_reg &= ~IXGBE_LED_MODE_MASK(index);
2103 led_reg |= IXGBE_LED_BLINK(index);
2104 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
2105 IXGBE_WRITE_FLUSH(hw);
2106
2107 return 0;
2108}
2109
2110/**
2111 * ixgbe_blink_led_stop_generic - Stop blinking LED based on index.
2112 * @hw: pointer to hardware structure
2113 * @index: led number to stop blinking
2114 **/
2115s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index)
2116{
2117 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
2118 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
2119
2120 autoc_reg &= ~IXGBE_AUTOC_FLU;
2121 autoc_reg |= IXGBE_AUTOC_AN_RESTART;
2122 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2123
2124 led_reg &= ~IXGBE_LED_MODE_MASK(index);
2125 led_reg &= ~IXGBE_LED_BLINK(index);
2126 led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
2127 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
2128 IXGBE_WRITE_FLUSH(hw);
2129
2130 return 0;
2131}
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h
index 24f73e719c3f..dd260890ad0a 100644
--- a/drivers/net/ixgbe/ixgbe_common.h
+++ b/drivers/net/ixgbe/ixgbe_common.h
@@ -76,6 +76,9 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw);
76s32 ixgbe_read_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 *val); 76s32 ixgbe_read_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 *val);
77s32 ixgbe_write_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 val); 77s32 ixgbe_write_analog_reg8_generic(struct ixgbe_hw *hw, u32 reg, u8 val);
78 78
79s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index);
80s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);
81
79#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg))) 82#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
80 83
81#ifndef writeq 84#ifndef writeq
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index aafc120f164e..f0a20facc650 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -943,6 +943,24 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
943} 943}
944 944
945 945
946static int ixgbe_wol_exclusion(struct ixgbe_adapter *adapter,
947 struct ethtool_wolinfo *wol)
948{
949 struct ixgbe_hw *hw = &adapter->hw;
950 int retval = 1;
951
952 switch(hw->device_id) {
953 case IXGBE_DEV_ID_82599_KX4:
954 retval = 0;
955 break;
956 default:
957 wol->supported = 0;
958 retval = 0;
959 }
960
961 return retval;
962}
963
946static void ixgbe_get_wol(struct net_device *netdev, 964static void ixgbe_get_wol(struct net_device *netdev,
947 struct ethtool_wolinfo *wol) 965 struct ethtool_wolinfo *wol)
948{ 966{
@@ -952,7 +970,8 @@ static void ixgbe_get_wol(struct net_device *netdev,
952 WAKE_BCAST | WAKE_MAGIC; 970 WAKE_BCAST | WAKE_MAGIC;
953 wol->wolopts = 0; 971 wol->wolopts = 0;
954 972
955 if (!device_can_wakeup(&adapter->pdev->dev)) 973 if (ixgbe_wol_exclusion(adapter, wol) ||
974 !device_can_wakeup(&adapter->pdev->dev))
956 return; 975 return;
957 976
958 if (adapter->wol & IXGBE_WUFC_EX) 977 if (adapter->wol & IXGBE_WUFC_EX)
@@ -974,6 +993,9 @@ static int ixgbe_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
974 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) 993 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
975 return -EOPNOTSUPP; 994 return -EOPNOTSUPP;
976 995
996 if (ixgbe_wol_exclusion(adapter, wol))
997 return wol->wolopts ? -EOPNOTSUPP : 0;
998
977 adapter->wol = 0; 999 adapter->wol = 0;
978 1000
979 if (wol->wolopts & WAKE_UCAST) 1001 if (wol->wolopts & WAKE_UCAST)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 813c5bc1a8fa..0d9a3ac043a6 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2723,17 +2723,21 @@ static inline bool ixgbe_set_rss_queues(struct ixgbe_adapter *adapter)
2723 **/ 2723 **/
2724static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter) 2724static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
2725{ 2725{
2726 /* Start with base case */
2727 adapter->num_rx_queues = 1;
2728 adapter->num_tx_queues = 1;
2729
2730#ifdef CONFIG_IXGBE_DCB 2726#ifdef CONFIG_IXGBE_DCB
2731 if (ixgbe_set_dcb_queues(adapter)) 2727 if (ixgbe_set_dcb_queues(adapter))
2732 return; 2728 goto done;
2733 2729
2734#endif 2730#endif
2735 if (ixgbe_set_rss_queues(adapter)) 2731 if (ixgbe_set_rss_queues(adapter))
2736 return; 2732 goto done;
2733
2734 /* fallback to base case */
2735 adapter->num_rx_queues = 1;
2736 adapter->num_tx_queues = 1;
2737
2738done:
2739 /* Notify the stack of the (possibly) reduced Tx Queue count. */
2740 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
2737} 2741}
2738 2742
2739static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, 2743static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
@@ -2992,9 +2996,6 @@ try_msi:
2992 } 2996 }
2993 2997
2994out: 2998out:
2995 /* Notify the stack of the (possibly) reduced Tx Queue count. */
2996 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
2997
2998 return err; 2999 return err;
2999} 3000}
3000 3001
@@ -3611,9 +3612,9 @@ static int ixgbe_resume(struct pci_dev *pdev)
3611 3612
3612 return 0; 3613 return 0;
3613} 3614}
3614
3615#endif /* CONFIG_PM */ 3615#endif /* CONFIG_PM */
3616static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) 3616
3617static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
3617{ 3618{
3618 struct net_device *netdev = pci_get_drvdata(pdev); 3619 struct net_device *netdev = pci_get_drvdata(pdev);
3619 struct ixgbe_adapter *adapter = netdev_priv(netdev); 3620 struct ixgbe_adapter *adapter = netdev_priv(netdev);
@@ -3672,18 +3673,46 @@ static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state)
3672 pci_enable_wake(pdev, PCI_D3cold, 0); 3673 pci_enable_wake(pdev, PCI_D3cold, 0);
3673 } 3674 }
3674 3675
3676 *enable_wake = !!wufc;
3677
3675 ixgbe_release_hw_control(adapter); 3678 ixgbe_release_hw_control(adapter);
3676 3679
3677 pci_disable_device(pdev); 3680 pci_disable_device(pdev);
3678 3681
3679 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 3682 return 0;
3683}
3684
3685#ifdef CONFIG_PM
3686static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state)
3687{
3688 int retval;
3689 bool wake;
3690
3691 retval = __ixgbe_shutdown(pdev, &wake);
3692 if (retval)
3693 return retval;
3694
3695 if (wake) {
3696 pci_prepare_to_sleep(pdev);
3697 } else {
3698 pci_wake_from_d3(pdev, false);
3699 pci_set_power_state(pdev, PCI_D3hot);
3700 }
3680 3701
3681 return 0; 3702 return 0;
3682} 3703}
3704#endif /* CONFIG_PM */
3683 3705
3684static void ixgbe_shutdown(struct pci_dev *pdev) 3706static void ixgbe_shutdown(struct pci_dev *pdev)
3685{ 3707{
3686 ixgbe_suspend(pdev, PMSG_SUSPEND); 3708 bool wake;
3709
3710 __ixgbe_shutdown(pdev, &wake);
3711
3712 if (system_state == SYSTEM_POWER_OFF) {
3713 pci_wake_from_d3(pdev, wake);
3714 pci_set_power_state(pdev, PCI_D3hot);
3715 }
3687} 3716}
3688 3717
3689/** 3718/**
@@ -4342,7 +4371,7 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
4342 int count = 0; 4371 int count = 0;
4343 unsigned int f; 4372 unsigned int f;
4344 4373
4345 r_idx = (adapter->num_tx_queues - 1) & skb->queue_mapping; 4374 r_idx = skb->queue_mapping;
4346 tx_ring = &adapter->tx_ring[r_idx]; 4375 tx_ring = &adapter->tx_ring[r_idx];
4347 4376
4348 if (adapter->vlgrp && vlan_tx_tag_present(skb)) { 4377 if (adapter->vlgrp && vlan_tx_tag_present(skb)) {