diff options
author | David S. Miller <davem@davemloft.net> | 2011-10-24 03:12:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-24 03:12:49 -0400 |
commit | 8b1857357acd919b9a7fa391afbea30123fdfaec (patch) | |
tree | 439493abe674452e72985f2806c0cd8cd7e2db28 | |
parent | 66b13d99d96a1a69f47a6bc3dc47f45955967377 (diff) | |
parent | 1128c756bef8285db3bbde5b26d4a6b4c7e2e613 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
-rw-r--r-- | drivers/net/ethernet/intel/igb/e1000_82575.c | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/e1000_mac.c | 63 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/e1000_mac.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 130 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igbvf/netdev.c | 14 |
6 files changed, 148 insertions, 66 deletions
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index 6580cea796c5..7881fb95a25b 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
@@ -1051,7 +1051,10 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw) | |||
1051 | 1051 | ||
1052 | /* Disabling VLAN filtering */ | 1052 | /* Disabling VLAN filtering */ |
1053 | hw_dbg("Initializing the IEEE VLAN\n"); | 1053 | hw_dbg("Initializing the IEEE VLAN\n"); |
1054 | igb_clear_vfta(hw); | 1054 | if (hw->mac.type == e1000_i350) |
1055 | igb_clear_vfta_i350(hw); | ||
1056 | else | ||
1057 | igb_clear_vfta(hw); | ||
1055 | 1058 | ||
1056 | /* Setup the receive address */ | 1059 | /* Setup the receive address */ |
1057 | igb_init_rx_addrs(hw, rar_count); | 1060 | igb_init_rx_addrs(hw, rar_count); |
diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.c b/drivers/net/ethernet/intel/igb/e1000_mac.c index 872119d91afd..73aac082c44d 100644 --- a/drivers/net/ethernet/intel/igb/e1000_mac.c +++ b/drivers/net/ethernet/intel/igb/e1000_mac.c | |||
@@ -117,6 +117,50 @@ static void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) | |||
117 | wrfl(); | 117 | wrfl(); |
118 | } | 118 | } |
119 | 119 | ||
120 | /* Due to a hw errata, if the host tries to configure the VFTA register | ||
121 | * while performing queries from the BMC or DMA, then the VFTA in some | ||
122 | * cases won't be written. | ||
123 | */ | ||
124 | |||
125 | /** | ||
126 | * igb_clear_vfta_i350 - Clear VLAN filter table | ||
127 | * @hw: pointer to the HW structure | ||
128 | * | ||
129 | * Clears the register array which contains the VLAN filter table by | ||
130 | * setting all the values to 0. | ||
131 | **/ | ||
132 | void igb_clear_vfta_i350(struct e1000_hw *hw) | ||
133 | { | ||
134 | u32 offset; | ||
135 | int i; | ||
136 | |||
137 | for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { | ||
138 | for (i = 0; i < 10; i++) | ||
139 | array_wr32(E1000_VFTA, offset, 0); | ||
140 | |||
141 | wrfl(); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | /** | ||
146 | * igb_write_vfta_i350 - Write value to VLAN filter table | ||
147 | * @hw: pointer to the HW structure | ||
148 | * @offset: register offset in VLAN filter table | ||
149 | * @value: register value written to VLAN filter table | ||
150 | * | ||
151 | * Writes value at the given offset in the register array which stores | ||
152 | * the VLAN filter table. | ||
153 | **/ | ||
154 | void igb_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value) | ||
155 | { | ||
156 | int i; | ||
157 | |||
158 | for (i = 0; i < 10; i++) | ||
159 | array_wr32(E1000_VFTA, offset, value); | ||
160 | |||
161 | wrfl(); | ||
162 | } | ||
163 | |||
120 | /** | 164 | /** |
121 | * igb_init_rx_addrs - Initialize receive address's | 165 | * igb_init_rx_addrs - Initialize receive address's |
122 | * @hw: pointer to the HW structure | 166 | * @hw: pointer to the HW structure |
@@ -155,9 +199,12 @@ s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add) | |||
155 | { | 199 | { |
156 | u32 index = (vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK; | 200 | u32 index = (vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK; |
157 | u32 mask = 1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK); | 201 | u32 mask = 1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK); |
158 | u32 vfta = array_rd32(E1000_VFTA, index); | 202 | u32 vfta; |
203 | struct igb_adapter *adapter = hw->back; | ||
159 | s32 ret_val = 0; | 204 | s32 ret_val = 0; |
160 | 205 | ||
206 | vfta = adapter->shadow_vfta[index]; | ||
207 | |||
161 | /* bit was set/cleared before we started */ | 208 | /* bit was set/cleared before we started */ |
162 | if ((!!(vfta & mask)) == add) { | 209 | if ((!!(vfta & mask)) == add) { |
163 | ret_val = -E1000_ERR_CONFIG; | 210 | ret_val = -E1000_ERR_CONFIG; |
@@ -167,8 +214,11 @@ s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add) | |||
167 | else | 214 | else |
168 | vfta &= ~mask; | 215 | vfta &= ~mask; |
169 | } | 216 | } |
170 | 217 | if (hw->mac.type == e1000_i350) | |
171 | igb_write_vfta(hw, index, vfta); | 218 | igb_write_vfta_i350(hw, index, vfta); |
219 | else | ||
220 | igb_write_vfta(hw, index, vfta); | ||
221 | adapter->shadow_vfta[index] = vfta; | ||
172 | 222 | ||
173 | return ret_val; | 223 | return ret_val; |
174 | } | 224 | } |
@@ -191,6 +241,13 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw) | |||
191 | u16 offset, nvm_alt_mac_addr_offset, nvm_data; | 241 | u16 offset, nvm_alt_mac_addr_offset, nvm_data; |
192 | u8 alt_mac_addr[ETH_ALEN]; | 242 | u8 alt_mac_addr[ETH_ALEN]; |
193 | 243 | ||
244 | /* | ||
245 | * Alternate MAC address is handled by the option ROM for 82580 | ||
246 | * and newer. SW support not required. | ||
247 | */ | ||
248 | if (hw->mac.type >= e1000_82580) | ||
249 | goto out; | ||
250 | |||
194 | ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1, | 251 | ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1, |
195 | &nvm_alt_mac_addr_offset); | 252 | &nvm_alt_mac_addr_offset); |
196 | if (ret_val) { | 253 | if (ret_val) { |
diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.h b/drivers/net/ethernet/intel/igb/e1000_mac.h index 4927f61fbbc8..e45996b4ea34 100644 --- a/drivers/net/ethernet/intel/igb/e1000_mac.h +++ b/drivers/net/ethernet/intel/igb/e1000_mac.h | |||
@@ -60,6 +60,7 @@ s32 igb_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, | |||
60 | 60 | ||
61 | void igb_clear_hw_cntrs_base(struct e1000_hw *hw); | 61 | void igb_clear_hw_cntrs_base(struct e1000_hw *hw); |
62 | void igb_clear_vfta(struct e1000_hw *hw); | 62 | void igb_clear_vfta(struct e1000_hw *hw); |
63 | void igb_clear_vfta_i350(struct e1000_hw *hw); | ||
63 | s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add); | 64 | s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add); |
64 | void igb_config_collision_dist(struct e1000_hw *hw); | 65 | void igb_config_collision_dist(struct e1000_hw *hw); |
65 | void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count); | 66 | void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count); |
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index 559443015cc5..c69feebf2653 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h | |||
@@ -363,6 +363,7 @@ struct igb_adapter { | |||
363 | u32 rss_queues; | 363 | u32 rss_queues; |
364 | u32 wvbr; | 364 | u32 wvbr; |
365 | int node; | 365 | int node; |
366 | u32 *shadow_vfta; | ||
366 | }; | 367 | }; |
367 | 368 | ||
368 | #define IGB_FLAG_HAS_MSI (1 << 0) | 369 | #define IGB_FLAG_HAS_MSI (1 << 0) |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index f689aa1b5a37..ced544499f1b 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -204,6 +204,7 @@ static struct pci_error_handlers igb_err_handler = { | |||
204 | .resume = igb_io_resume, | 204 | .resume = igb_io_resume, |
205 | }; | 205 | }; |
206 | 206 | ||
207 | static void igb_init_dmac(struct igb_adapter *adapter, u32 pba); | ||
207 | 208 | ||
208 | static struct pci_driver igb_driver = { | 209 | static struct pci_driver igb_driver = { |
209 | .name = igb_driver_name, | 210 | .name = igb_driver_name, |
@@ -1728,63 +1729,8 @@ void igb_reset(struct igb_adapter *adapter) | |||
1728 | 1729 | ||
1729 | if (hw->mac.ops.init_hw(hw)) | 1730 | if (hw->mac.ops.init_hw(hw)) |
1730 | dev_err(&pdev->dev, "Hardware Error\n"); | 1731 | dev_err(&pdev->dev, "Hardware Error\n"); |
1731 | if (hw->mac.type > e1000_82580) { | ||
1732 | if (adapter->flags & IGB_FLAG_DMAC) { | ||
1733 | u32 reg; | ||
1734 | |||
1735 | /* | ||
1736 | * DMA Coalescing high water mark needs to be higher | ||
1737 | * than * the * Rx threshold. The Rx threshold is | ||
1738 | * currently * pba - 6, so we * should use a high water | ||
1739 | * mark of pba * - 4. */ | ||
1740 | hwm = (pba - 4) << 10; | ||
1741 | |||
1742 | reg = (((pba-6) << E1000_DMACR_DMACTHR_SHIFT) | ||
1743 | & E1000_DMACR_DMACTHR_MASK); | ||
1744 | |||
1745 | /* transition to L0x or L1 if available..*/ | ||
1746 | reg |= (E1000_DMACR_DMAC_EN | E1000_DMACR_DMAC_LX_MASK); | ||
1747 | |||
1748 | /* watchdog timer= +-1000 usec in 32usec intervals */ | ||
1749 | reg |= (1000 >> 5); | ||
1750 | wr32(E1000_DMACR, reg); | ||
1751 | |||
1752 | /* no lower threshold to disable coalescing(smart fifb) | ||
1753 | * -UTRESH=0*/ | ||
1754 | wr32(E1000_DMCRTRH, 0); | ||
1755 | |||
1756 | /* set hwm to PBA - 2 * max frame size */ | ||
1757 | wr32(E1000_FCRTC, hwm); | ||
1758 | 1732 | ||
1759 | /* | 1733 | igb_init_dmac(adapter, pba); |
1760 | * This sets the time to wait before requesting tran- | ||
1761 | * sition to * low power state to number of usecs needed | ||
1762 | * to receive 1 512 * byte frame at gigabit line rate | ||
1763 | */ | ||
1764 | reg = rd32(E1000_DMCTLX); | ||
1765 | reg |= IGB_DMCTLX_DCFLUSH_DIS; | ||
1766 | |||
1767 | /* Delay 255 usec before entering Lx state. */ | ||
1768 | reg |= 0xFF; | ||
1769 | wr32(E1000_DMCTLX, reg); | ||
1770 | |||
1771 | /* free space in Tx packet buffer to wake from DMAC */ | ||
1772 | wr32(E1000_DMCTXTH, | ||
1773 | (IGB_MIN_TXPBSIZE - | ||
1774 | (IGB_TX_BUF_4096 + adapter->max_frame_size)) | ||
1775 | >> 6); | ||
1776 | |||
1777 | /* make low power state decision controlled by DMAC */ | ||
1778 | reg = rd32(E1000_PCIEMISC); | ||
1779 | reg |= E1000_PCIEMISC_LX_DECISION; | ||
1780 | wr32(E1000_PCIEMISC, reg); | ||
1781 | } /* end if IGB_FLAG_DMAC set */ | ||
1782 | } | ||
1783 | if (hw->mac.type == e1000_82580) { | ||
1784 | u32 reg = rd32(E1000_PCIEMISC); | ||
1785 | wr32(E1000_PCIEMISC, | ||
1786 | reg & ~E1000_PCIEMISC_LX_DECISION); | ||
1787 | } | ||
1788 | if (!netif_running(adapter->netdev)) | 1734 | if (!netif_running(adapter->netdev)) |
1789 | igb_power_down_link(adapter); | 1735 | igb_power_down_link(adapter); |
1790 | 1736 | ||
@@ -2260,6 +2206,7 @@ static void __devexit igb_remove(struct pci_dev *pdev) | |||
2260 | pci_release_selected_regions(pdev, | 2206 | pci_release_selected_regions(pdev, |
2261 | pci_select_bars(pdev, IORESOURCE_MEM)); | 2207 | pci_select_bars(pdev, IORESOURCE_MEM)); |
2262 | 2208 | ||
2209 | kfree(adapter->shadow_vfta); | ||
2263 | free_netdev(netdev); | 2210 | free_netdev(netdev); |
2264 | 2211 | ||
2265 | pci_disable_pcie_error_reporting(pdev); | 2212 | pci_disable_pcie_error_reporting(pdev); |
@@ -2492,6 +2439,11 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter) | |||
2492 | ((adapter->rss_queues > 1) && (adapter->vfs_allocated_count > 6))) | 2439 | ((adapter->rss_queues > 1) && (adapter->vfs_allocated_count > 6))) |
2493 | adapter->flags |= IGB_FLAG_QUEUE_PAIRS; | 2440 | adapter->flags |= IGB_FLAG_QUEUE_PAIRS; |
2494 | 2441 | ||
2442 | /* Setup and initialize a copy of the hw vlan table array */ | ||
2443 | adapter->shadow_vfta = kzalloc(sizeof(u32) * | ||
2444 | E1000_VLAN_FILTER_TBL_SIZE, | ||
2445 | GFP_ATOMIC); | ||
2446 | |||
2495 | /* This call may decrease the number of queues */ | 2447 | /* This call may decrease the number of queues */ |
2496 | if (igb_init_interrupt_scheme(adapter)) { | 2448 | if (igb_init_interrupt_scheme(adapter)) { |
2497 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); | 2449 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); |
@@ -7098,4 +7050,70 @@ static void igb_vmm_control(struct igb_adapter *adapter) | |||
7098 | } | 7050 | } |
7099 | } | 7051 | } |
7100 | 7052 | ||
7053 | static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) | ||
7054 | { | ||
7055 | struct e1000_hw *hw = &adapter->hw; | ||
7056 | u32 dmac_thr; | ||
7057 | u16 hwm; | ||
7058 | |||
7059 | if (hw->mac.type > e1000_82580) { | ||
7060 | if (adapter->flags & IGB_FLAG_DMAC) { | ||
7061 | u32 reg; | ||
7062 | |||
7063 | /* force threshold to 0. */ | ||
7064 | wr32(E1000_DMCTXTH, 0); | ||
7065 | |||
7066 | /* | ||
7067 | * DMA Coalescing high water mark needs to be higher | ||
7068 | * than the RX threshold. set hwm to PBA - 2 * max | ||
7069 | * frame size | ||
7070 | */ | ||
7071 | hwm = pba - (2 * adapter->max_frame_size); | ||
7072 | reg = rd32(E1000_DMACR); | ||
7073 | reg &= ~E1000_DMACR_DMACTHR_MASK; | ||
7074 | dmac_thr = pba - 4; | ||
7075 | |||
7076 | reg |= ((dmac_thr << E1000_DMACR_DMACTHR_SHIFT) | ||
7077 | & E1000_DMACR_DMACTHR_MASK); | ||
7078 | |||
7079 | /* transition to L0x or L1 if available..*/ | ||
7080 | reg |= (E1000_DMACR_DMAC_EN | E1000_DMACR_DMAC_LX_MASK); | ||
7081 | |||
7082 | /* watchdog timer= +-1000 usec in 32usec intervals */ | ||
7083 | reg |= (1000 >> 5); | ||
7084 | wr32(E1000_DMACR, reg); | ||
7085 | |||
7086 | /* | ||
7087 | * no lower threshold to disable | ||
7088 | * coalescing(smart fifb)-UTRESH=0 | ||
7089 | */ | ||
7090 | wr32(E1000_DMCRTRH, 0); | ||
7091 | wr32(E1000_FCRTC, hwm); | ||
7092 | |||
7093 | reg = (IGB_DMCTLX_DCFLUSH_DIS | 0x4); | ||
7094 | |||
7095 | wr32(E1000_DMCTLX, reg); | ||
7096 | |||
7097 | /* | ||
7098 | * free space in tx packet buffer to wake from | ||
7099 | * DMA coal | ||
7100 | */ | ||
7101 | wr32(E1000_DMCTXTH, (IGB_MIN_TXPBSIZE - | ||
7102 | (IGB_TX_BUF_4096 + adapter->max_frame_size)) >> 6); | ||
7103 | |||
7104 | /* | ||
7105 | * make low power state decision controlled | ||
7106 | * by DMA coal | ||
7107 | */ | ||
7108 | reg = rd32(E1000_PCIEMISC); | ||
7109 | reg &= ~E1000_PCIEMISC_LX_DECISION; | ||
7110 | wr32(E1000_PCIEMISC, reg); | ||
7111 | } /* endif adapter->dmac is not disabled */ | ||
7112 | } else if (hw->mac.type == e1000_82580) { | ||
7113 | u32 reg = rd32(E1000_PCIEMISC); | ||
7114 | wr32(E1000_PCIEMISC, reg & ~E1000_PCIEMISC_LX_DECISION); | ||
7115 | wr32(E1000_DMACR, 0); | ||
7116 | } | ||
7117 | } | ||
7118 | |||
7101 | /* igb_main.c */ | 7119 | /* igb_main.c */ |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index db2981748012..cca78124be31 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -45,13 +45,13 @@ | |||
45 | 45 | ||
46 | #include "igbvf.h" | 46 | #include "igbvf.h" |
47 | 47 | ||
48 | #define DRV_VERSION "2.0.0-k" | 48 | #define DRV_VERSION "2.0.1-k" |
49 | char igbvf_driver_name[] = "igbvf"; | 49 | char igbvf_driver_name[] = "igbvf"; |
50 | const char igbvf_driver_version[] = DRV_VERSION; | 50 | const char igbvf_driver_version[] = DRV_VERSION; |
51 | static const char igbvf_driver_string[] = | 51 | static const char igbvf_driver_string[] = |
52 | "Intel(R) Virtual Function Network Driver"; | 52 | "Intel(R) Gigabit Virtual Function Network Driver"; |
53 | static const char igbvf_copyright[] = | 53 | static const char igbvf_copyright[] = |
54 | "Copyright (c) 2009 - 2010 Intel Corporation."; | 54 | "Copyright (c) 2009 - 2011 Intel Corporation."; |
55 | 55 | ||
56 | static int igbvf_poll(struct napi_struct *napi, int budget); | 56 | static int igbvf_poll(struct napi_struct *napi, int budget); |
57 | static void igbvf_reset(struct igbvf_adapter *); | 57 | static void igbvf_reset(struct igbvf_adapter *); |
@@ -2525,9 +2525,11 @@ static void igbvf_print_device_info(struct igbvf_adapter *adapter) | |||
2525 | struct net_device *netdev = adapter->netdev; | 2525 | struct net_device *netdev = adapter->netdev; |
2526 | struct pci_dev *pdev = adapter->pdev; | 2526 | struct pci_dev *pdev = adapter->pdev; |
2527 | 2527 | ||
2528 | dev_info(&pdev->dev, "Intel(R) 82576 Virtual Function\n"); | 2528 | if (hw->mac.type == e1000_vfadapt_i350) |
2529 | dev_info(&pdev->dev, "Intel(R) I350 Virtual Function\n"); | ||
2530 | else | ||
2531 | dev_info(&pdev->dev, "Intel(R) 82576 Virtual Function\n"); | ||
2529 | dev_info(&pdev->dev, "Address: %pM\n", netdev->dev_addr); | 2532 | dev_info(&pdev->dev, "Address: %pM\n", netdev->dev_addr); |
2530 | dev_info(&pdev->dev, "MAC: %d\n", hw->mac.type); | ||
2531 | } | 2533 | } |
2532 | 2534 | ||
2533 | static int igbvf_set_features(struct net_device *netdev, u32 features) | 2535 | static int igbvf_set_features(struct net_device *netdev, u32 features) |
@@ -2864,7 +2866,7 @@ module_exit(igbvf_exit_module); | |||
2864 | 2866 | ||
2865 | 2867 | ||
2866 | MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>"); | 2868 | MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>"); |
2867 | MODULE_DESCRIPTION("Intel(R) 82576 Virtual Function Network Driver"); | 2869 | MODULE_DESCRIPTION("Intel(R) Gigabit Virtual Function Network Driver"); |
2868 | MODULE_LICENSE("GPL"); | 2870 | MODULE_LICENSE("GPL"); |
2869 | MODULE_VERSION(DRV_VERSION); | 2871 | MODULE_VERSION(DRV_VERSION); |
2870 | 2872 | ||