diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-17 10:53:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-17 10:53:25 -0500 |
commit | 847e9170c77d3b4f57822ae1f4cf4f65c65a8254 (patch) | |
tree | 23f931fa2c3f9cf967deb638fed9804806d07357 | |
parent | 72eb8c6747b49e41fd2b042510f03ac7c13426fc (diff) | |
parent | 5f9021cfdc3524a4c5e3d7ae2d049eb7adcd6776 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (27 commits)
rtnetlink: propagate error from dev_change_flags in do_setlink()
isdn: remove extra byteswap in isdn_net_ciscohdlck_slarp_send_reply
Phonet: refuse to send bigger than MTU packets
e1000e: fix IPMI traffic
e1000e: fix warn_on reload after phy_id error
phy: fix phy address bug
e100: fix dma error in direction for mapping
igb: use dev_printk instead of printk
qla3xxx: Cleanup: Fix link print statements.
igb: Use device_set_wakeup_enable
e1000: Use device_set_wakeup_enable
e1000e: Use device_set_wakeup_enable
via-velocity: enable perfect filtering for multicast packets
phy: Add support for Marvell 88E1118 PHY
mlx4_en: Pause parameters per port
phylib: fix premature freeing of struct mii_bus
atl1: Do not enumerate options unsupported by chip
atl1e: fix broken multicast by removing unnecessary crc inversion
gianfar: Fix DMA unmap invocations
net/ucc_geth: Fix oops in uec_get_ethtool_stats()
...
33 files changed, 526 insertions, 111 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index bb904a0a98bd..1bfc55d7a26c 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -1641,8 +1641,10 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp) | |||
1641 | /* slarp reply, send own ip/netmask; if values are nonsense remote | 1641 | /* slarp reply, send own ip/netmask; if values are nonsense remote |
1642 | * should think we are unable to provide it with an address via SLARP */ | 1642 | * should think we are unable to provide it with an address via SLARP */ |
1643 | p += put_u32(p, CISCO_SLARP_REPLY); | 1643 | p += put_u32(p, CISCO_SLARP_REPLY); |
1644 | p += put_u32(p, addr); // address | 1644 | *(__be32 *)p = addr; // address |
1645 | p += put_u32(p, mask); // netmask | 1645 | p += 4; |
1646 | *(__be32 *)p = mask; // netmask | ||
1647 | p += 4; | ||
1646 | p += put_u16(p, 0); // unused | 1648 | p += put_u16(p, 0); // unused |
1647 | 1649 | ||
1648 | isdn_net_write_super(lp, skb); | 1650 | isdn_net_write_super(lp, skb); |
diff --git a/drivers/net/atl1e/atl1e_hw.c b/drivers/net/atl1e/atl1e_hw.c index 8cbc1b59bd62..4a7700620119 100644 --- a/drivers/net/atl1e/atl1e_hw.c +++ b/drivers/net/atl1e/atl1e_hw.c | |||
@@ -163,9 +163,6 @@ int atl1e_read_mac_addr(struct atl1e_hw *hw) | |||
163 | * atl1e_hash_mc_addr | 163 | * atl1e_hash_mc_addr |
164 | * purpose | 164 | * purpose |
165 | * set hash value for a multicast address | 165 | * set hash value for a multicast address |
166 | * hash calcu processing : | ||
167 | * 1. calcu 32bit CRC for multicast address | ||
168 | * 2. reverse crc with MSB to LSB | ||
169 | */ | 166 | */ |
170 | u32 atl1e_hash_mc_addr(struct atl1e_hw *hw, u8 *mc_addr) | 167 | u32 atl1e_hash_mc_addr(struct atl1e_hw *hw, u8 *mc_addr) |
171 | { | 168 | { |
@@ -174,7 +171,6 @@ u32 atl1e_hash_mc_addr(struct atl1e_hw *hw, u8 *mc_addr) | |||
174 | int i; | 171 | int i; |
175 | 172 | ||
176 | crc32 = ether_crc_le(6, mc_addr); | 173 | crc32 = ether_crc_le(6, mc_addr); |
177 | crc32 = ~crc32; | ||
178 | for (i = 0; i < 32; i++) | 174 | for (i = 0; i < 32; i++) |
179 | value |= (((crc32 >> i) & 1) << (31 - i)); | 175 | value |= (((crc32 >> i) & 1) << (31 - i)); |
180 | 176 | ||
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 246d92b42636..aef403d299ee 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -3404,14 +3404,8 @@ static void atl1_get_wol(struct net_device *netdev, | |||
3404 | { | 3404 | { |
3405 | struct atl1_adapter *adapter = netdev_priv(netdev); | 3405 | struct atl1_adapter *adapter = netdev_priv(netdev); |
3406 | 3406 | ||
3407 | wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC; | 3407 | wol->supported = WAKE_MAGIC; |
3408 | wol->wolopts = 0; | 3408 | wol->wolopts = 0; |
3409 | if (adapter->wol & ATLX_WUFC_EX) | ||
3410 | wol->wolopts |= WAKE_UCAST; | ||
3411 | if (adapter->wol & ATLX_WUFC_MC) | ||
3412 | wol->wolopts |= WAKE_MCAST; | ||
3413 | if (adapter->wol & ATLX_WUFC_BC) | ||
3414 | wol->wolopts |= WAKE_BCAST; | ||
3415 | if (adapter->wol & ATLX_WUFC_MAG) | 3409 | if (adapter->wol & ATLX_WUFC_MAG) |
3416 | wol->wolopts |= WAKE_MAGIC; | 3410 | wol->wolopts |= WAKE_MAGIC; |
3417 | return; | 3411 | return; |
@@ -3422,15 +3416,10 @@ static int atl1_set_wol(struct net_device *netdev, | |||
3422 | { | 3416 | { |
3423 | struct atl1_adapter *adapter = netdev_priv(netdev); | 3417 | struct atl1_adapter *adapter = netdev_priv(netdev); |
3424 | 3418 | ||
3425 | if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) | 3419 | if (wol->wolopts & (WAKE_PHY | WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | |
3420 | WAKE_ARP | WAKE_MAGICSECURE)) | ||
3426 | return -EOPNOTSUPP; | 3421 | return -EOPNOTSUPP; |
3427 | adapter->wol = 0; | 3422 | adapter->wol = 0; |
3428 | if (wol->wolopts & WAKE_UCAST) | ||
3429 | adapter->wol |= ATLX_WUFC_EX; | ||
3430 | if (wol->wolopts & WAKE_MCAST) | ||
3431 | adapter->wol |= ATLX_WUFC_MC; | ||
3432 | if (wol->wolopts & WAKE_BCAST) | ||
3433 | adapter->wol |= ATLX_WUFC_BC; | ||
3434 | if (wol->wolopts & WAKE_MAGIC) | 3423 | if (wol->wolopts & WAKE_MAGIC) |
3435 | adapter->wol |= ATLX_WUFC_MAG; | 3424 | adapter->wol |= ATLX_WUFC_MAG; |
3436 | return 0; | 3425 | return 0; |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 3d69fae781cf..e8bfcce6b319 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -166,7 +166,7 @@ | |||
166 | 166 | ||
167 | #define DRV_NAME "e100" | 167 | #define DRV_NAME "e100" |
168 | #define DRV_EXT "-NAPI" | 168 | #define DRV_EXT "-NAPI" |
169 | #define DRV_VERSION "3.5.23-k4"DRV_EXT | 169 | #define DRV_VERSION "3.5.23-k6"DRV_EXT |
170 | #define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver" | 170 | #define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver" |
171 | #define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation" | 171 | #define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation" |
172 | #define PFX DRV_NAME ": " | 172 | #define PFX DRV_NAME ": " |
@@ -1804,7 +1804,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | |||
1804 | struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data; | 1804 | struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data; |
1805 | put_unaligned_le32(rx->dma_addr, &prev_rfd->link); | 1805 | put_unaligned_le32(rx->dma_addr, &prev_rfd->link); |
1806 | pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr, | 1806 | pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr, |
1807 | sizeof(struct rfd), PCI_DMA_TODEVICE); | 1807 | sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL); |
1808 | } | 1808 | } |
1809 | 1809 | ||
1810 | return 0; | 1810 | return 0; |
@@ -1823,7 +1823,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
1823 | 1823 | ||
1824 | /* Need to sync before taking a peek at cb_complete bit */ | 1824 | /* Need to sync before taking a peek at cb_complete bit */ |
1825 | pci_dma_sync_single_for_cpu(nic->pdev, rx->dma_addr, | 1825 | pci_dma_sync_single_for_cpu(nic->pdev, rx->dma_addr, |
1826 | sizeof(struct rfd), PCI_DMA_FROMDEVICE); | 1826 | sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL); |
1827 | rfd_status = le16_to_cpu(rfd->status); | 1827 | rfd_status = le16_to_cpu(rfd->status); |
1828 | 1828 | ||
1829 | DPRINTK(RX_STATUS, DEBUG, "status=0x%04X\n", rfd_status); | 1829 | DPRINTK(RX_STATUS, DEBUG, "status=0x%04X\n", rfd_status); |
@@ -1850,7 +1850,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
1850 | 1850 | ||
1851 | /* Get data */ | 1851 | /* Get data */ |
1852 | pci_unmap_single(nic->pdev, rx->dma_addr, | 1852 | pci_unmap_single(nic->pdev, rx->dma_addr, |
1853 | RFD_BUF_LEN, PCI_DMA_FROMDEVICE); | 1853 | RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); |
1854 | 1854 | ||
1855 | /* If this buffer has the el bit, but we think the receiver | 1855 | /* If this buffer has the el bit, but we think the receiver |
1856 | * is still running, check to see if it really stopped while | 1856 | * is still running, check to see if it really stopped while |
@@ -1943,7 +1943,7 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done, | |||
1943 | new_before_last_rfd->command |= cpu_to_le16(cb_el); | 1943 | new_before_last_rfd->command |= cpu_to_le16(cb_el); |
1944 | pci_dma_sync_single_for_device(nic->pdev, | 1944 | pci_dma_sync_single_for_device(nic->pdev, |
1945 | new_before_last_rx->dma_addr, sizeof(struct rfd), | 1945 | new_before_last_rx->dma_addr, sizeof(struct rfd), |
1946 | PCI_DMA_TODEVICE); | 1946 | PCI_DMA_BIDIRECTIONAL); |
1947 | 1947 | ||
1948 | /* Now that we have a new stopping point, we can clear the old | 1948 | /* Now that we have a new stopping point, we can clear the old |
1949 | * stopping point. We must sync twice to get the proper | 1949 | * stopping point. We must sync twice to get the proper |
@@ -1951,11 +1951,11 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done, | |||
1951 | old_before_last_rfd->command &= ~cpu_to_le16(cb_el); | 1951 | old_before_last_rfd->command &= ~cpu_to_le16(cb_el); |
1952 | pci_dma_sync_single_for_device(nic->pdev, | 1952 | pci_dma_sync_single_for_device(nic->pdev, |
1953 | old_before_last_rx->dma_addr, sizeof(struct rfd), | 1953 | old_before_last_rx->dma_addr, sizeof(struct rfd), |
1954 | PCI_DMA_TODEVICE); | 1954 | PCI_DMA_BIDIRECTIONAL); |
1955 | old_before_last_rfd->size = cpu_to_le16(VLAN_ETH_FRAME_LEN); | 1955 | old_before_last_rfd->size = cpu_to_le16(VLAN_ETH_FRAME_LEN); |
1956 | pci_dma_sync_single_for_device(nic->pdev, | 1956 | pci_dma_sync_single_for_device(nic->pdev, |
1957 | old_before_last_rx->dma_addr, sizeof(struct rfd), | 1957 | old_before_last_rx->dma_addr, sizeof(struct rfd), |
1958 | PCI_DMA_TODEVICE); | 1958 | PCI_DMA_BIDIRECTIONAL); |
1959 | } | 1959 | } |
1960 | 1960 | ||
1961 | if(restart_required) { | 1961 | if(restart_required) { |
@@ -1978,7 +1978,7 @@ static void e100_rx_clean_list(struct nic *nic) | |||
1978 | for(rx = nic->rxs, i = 0; i < count; rx++, i++) { | 1978 | for(rx = nic->rxs, i = 0; i < count; rx++, i++) { |
1979 | if(rx->skb) { | 1979 | if(rx->skb) { |
1980 | pci_unmap_single(nic->pdev, rx->dma_addr, | 1980 | pci_unmap_single(nic->pdev, rx->dma_addr, |
1981 | RFD_BUF_LEN, PCI_DMA_FROMDEVICE); | 1981 | RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); |
1982 | dev_kfree_skb(rx->skb); | 1982 | dev_kfree_skb(rx->skb); |
1983 | } | 1983 | } |
1984 | } | 1984 | } |
@@ -2021,7 +2021,7 @@ static int e100_rx_alloc_list(struct nic *nic) | |||
2021 | before_last->command |= cpu_to_le16(cb_el); | 2021 | before_last->command |= cpu_to_le16(cb_el); |
2022 | before_last->size = 0; | 2022 | before_last->size = 0; |
2023 | pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr, | 2023 | pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr, |
2024 | sizeof(struct rfd), PCI_DMA_TODEVICE); | 2024 | sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL); |
2025 | 2025 | ||
2026 | nic->rx_to_use = nic->rx_to_clean = nic->rxs; | 2026 | nic->rx_to_use = nic->rx_to_clean = nic->rxs; |
2027 | nic->ru_running = RU_SUSPENDED; | 2027 | nic->ru_running = RU_SUSPENDED; |
@@ -2222,7 +2222,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode) | |||
2222 | msleep(10); | 2222 | msleep(10); |
2223 | 2223 | ||
2224 | pci_dma_sync_single_for_cpu(nic->pdev, nic->rx_to_clean->dma_addr, | 2224 | pci_dma_sync_single_for_cpu(nic->pdev, nic->rx_to_clean->dma_addr, |
2225 | RFD_BUF_LEN, PCI_DMA_FROMDEVICE); | 2225 | RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); |
2226 | 2226 | ||
2227 | if(memcmp(nic->rx_to_clean->skb->data + sizeof(struct rfd), | 2227 | if(memcmp(nic->rx_to_clean->skb->data + sizeof(struct rfd), |
2228 | skb->data, ETH_DATA_LEN)) | 2228 | skb->data, ETH_DATA_LEN)) |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 6a3893acfe04..c854c96f5ab3 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -1774,7 +1774,8 @@ static void e1000_get_wol(struct net_device *netdev, | |||
1774 | 1774 | ||
1775 | /* this function will set ->supported = 0 and return 1 if wol is not | 1775 | /* this function will set ->supported = 0 and return 1 if wol is not |
1776 | * supported by this hardware */ | 1776 | * supported by this hardware */ |
1777 | if (e1000_wol_exclusion(adapter, wol)) | 1777 | if (e1000_wol_exclusion(adapter, wol) || |
1778 | !device_can_wakeup(&adapter->pdev->dev)) | ||
1778 | return; | 1779 | return; |
1779 | 1780 | ||
1780 | /* apply any specific unsupported masks here */ | 1781 | /* apply any specific unsupported masks here */ |
@@ -1811,7 +1812,8 @@ static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1811 | if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) | 1812 | if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) |
1812 | return -EOPNOTSUPP; | 1813 | return -EOPNOTSUPP; |
1813 | 1814 | ||
1814 | if (e1000_wol_exclusion(adapter, wol)) | 1815 | if (e1000_wol_exclusion(adapter, wol) || |
1816 | !device_can_wakeup(&adapter->pdev->dev)) | ||
1815 | return wol->wolopts ? -EOPNOTSUPP : 0; | 1817 | return wol->wolopts ? -EOPNOTSUPP : 0; |
1816 | 1818 | ||
1817 | switch (hw->device_id) { | 1819 | switch (hw->device_id) { |
@@ -1838,6 +1840,8 @@ static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1838 | if (wol->wolopts & WAKE_MAGIC) | 1840 | if (wol->wolopts & WAKE_MAGIC) |
1839 | adapter->wol |= E1000_WUFC_MAG; | 1841 | adapter->wol |= E1000_WUFC_MAG; |
1840 | 1842 | ||
1843 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | ||
1844 | |||
1841 | return 0; | 1845 | return 0; |
1842 | } | 1846 | } |
1843 | 1847 | ||
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index fac82152e4c8..872799b746f5 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -1179,6 +1179,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
1179 | 1179 | ||
1180 | /* initialize the wol settings based on the eeprom settings */ | 1180 | /* initialize the wol settings based on the eeprom settings */ |
1181 | adapter->wol = adapter->eeprom_wol; | 1181 | adapter->wol = adapter->eeprom_wol; |
1182 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | ||
1182 | 1183 | ||
1183 | /* print bus type/speed/width info */ | 1184 | /* print bus type/speed/width info */ |
1184 | DPRINTK(PROBE, INFO, "(PCI%s:%s:%s) ", | 1185 | DPRINTK(PROBE, INFO, "(PCI%s:%s:%s) ", |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index c55de1c027af..c55fd6fdb91c 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -299,6 +299,7 @@ struct e1000_adapter { | |||
299 | unsigned long led_status; | 299 | unsigned long led_status; |
300 | 300 | ||
301 | unsigned int flags; | 301 | unsigned int flags; |
302 | unsigned int flags2; | ||
302 | struct work_struct downshift_task; | 303 | struct work_struct downshift_task; |
303 | struct work_struct update_phy_task; | 304 | struct work_struct update_phy_task; |
304 | }; | 305 | }; |
@@ -306,6 +307,7 @@ struct e1000_adapter { | |||
306 | struct e1000_info { | 307 | struct e1000_info { |
307 | enum e1000_mac_type mac; | 308 | enum e1000_mac_type mac; |
308 | unsigned int flags; | 309 | unsigned int flags; |
310 | unsigned int flags2; | ||
309 | u32 pba; | 311 | u32 pba; |
310 | s32 (*get_variants)(struct e1000_adapter *); | 312 | s32 (*get_variants)(struct e1000_adapter *); |
311 | struct e1000_mac_operations *mac_ops; | 313 | struct e1000_mac_operations *mac_ops; |
@@ -347,6 +349,9 @@ struct e1000_info { | |||
347 | #define FLAG_RX_RESTART_NOW (1 << 30) | 349 | #define FLAG_RX_RESTART_NOW (1 << 30) |
348 | #define FLAG_MSI_TEST_FAILED (1 << 31) | 350 | #define FLAG_MSI_TEST_FAILED (1 << 31) |
349 | 351 | ||
352 | /* CRC Stripping defines */ | ||
353 | #define FLAG2_CRC_STRIPPING (1 << 0) | ||
354 | |||
350 | #define E1000_RX_DESC_PS(R, i) \ | 355 | #define E1000_RX_DESC_PS(R, i) \ |
351 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) | 356 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) |
352 | #define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i])) | 357 | #define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i])) |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 70c11c811a08..62421ce96311 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -1713,7 +1713,8 @@ static void e1000_get_wol(struct net_device *netdev, | |||
1713 | wol->supported = 0; | 1713 | wol->supported = 0; |
1714 | wol->wolopts = 0; | 1714 | wol->wolopts = 0; |
1715 | 1715 | ||
1716 | if (!(adapter->flags & FLAG_HAS_WOL)) | 1716 | if (!(adapter->flags & FLAG_HAS_WOL) || |
1717 | !device_can_wakeup(&adapter->pdev->dev)) | ||
1717 | return; | 1718 | return; |
1718 | 1719 | ||
1719 | wol->supported = WAKE_UCAST | WAKE_MCAST | | 1720 | wol->supported = WAKE_UCAST | WAKE_MCAST | |
@@ -1751,7 +1752,8 @@ static int e1000_set_wol(struct net_device *netdev, | |||
1751 | if (wol->wolopts & WAKE_MAGICSECURE) | 1752 | if (wol->wolopts & WAKE_MAGICSECURE) |
1752 | return -EOPNOTSUPP; | 1753 | return -EOPNOTSUPP; |
1753 | 1754 | ||
1754 | if (!(adapter->flags & FLAG_HAS_WOL)) | 1755 | if (!(adapter->flags & FLAG_HAS_WOL) || |
1756 | !device_can_wakeup(&adapter->pdev->dev)) | ||
1755 | return wol->wolopts ? -EOPNOTSUPP : 0; | 1757 | return wol->wolopts ? -EOPNOTSUPP : 0; |
1756 | 1758 | ||
1757 | /* these settings will always override what we currently have */ | 1759 | /* these settings will always override what we currently have */ |
@@ -1770,6 +1772,8 @@ static int e1000_set_wol(struct net_device *netdev, | |||
1770 | if (wol->wolopts & WAKE_ARP) | 1772 | if (wol->wolopts & WAKE_ARP) |
1771 | adapter->wol |= E1000_WUFC_ARP; | 1773 | adapter->wol |= E1000_WUFC_ARP; |
1772 | 1774 | ||
1775 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | ||
1776 | |||
1773 | return 0; | 1777 | return 0; |
1774 | } | 1778 | } |
1775 | 1779 | ||
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index abd492b7336d..91795f78c3e4 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -499,6 +499,10 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
499 | goto next_desc; | 499 | goto next_desc; |
500 | } | 500 | } |
501 | 501 | ||
502 | /* adjust length to remove Ethernet CRC */ | ||
503 | if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) | ||
504 | length -= 4; | ||
505 | |||
502 | total_rx_bytes += length; | 506 | total_rx_bytes += length; |
503 | total_rx_packets++; | 507 | total_rx_packets++; |
504 | 508 | ||
@@ -804,6 +808,10 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
804 | pci_dma_sync_single_for_device(pdev, ps_page->dma, | 808 | pci_dma_sync_single_for_device(pdev, ps_page->dma, |
805 | PAGE_SIZE, PCI_DMA_FROMDEVICE); | 809 | PAGE_SIZE, PCI_DMA_FROMDEVICE); |
806 | 810 | ||
811 | /* remove the CRC */ | ||
812 | if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) | ||
813 | l1 -= 4; | ||
814 | |||
807 | skb_put(skb, l1); | 815 | skb_put(skb, l1); |
808 | goto copydone; | 816 | goto copydone; |
809 | } /* if */ | 817 | } /* if */ |
@@ -825,6 +833,12 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
825 | skb->truesize += length; | 833 | skb->truesize += length; |
826 | } | 834 | } |
827 | 835 | ||
836 | /* strip the ethernet crc, problem is we're using pages now so | ||
837 | * this whole operation can get a little cpu intensive | ||
838 | */ | ||
839 | if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) | ||
840 | pskb_trim(skb, skb->len - 4); | ||
841 | |||
828 | copydone: | 842 | copydone: |
829 | total_rx_bytes += skb->len; | 843 | total_rx_bytes += skb->len; |
830 | total_rx_packets++; | 844 | total_rx_packets++; |
@@ -2301,8 +2315,12 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
2301 | else | 2315 | else |
2302 | rctl |= E1000_RCTL_LPE; | 2316 | rctl |= E1000_RCTL_LPE; |
2303 | 2317 | ||
2304 | /* Enable hardware CRC frame stripping */ | 2318 | /* Some systems expect that the CRC is included in SMBUS traffic. The |
2305 | rctl |= E1000_RCTL_SECRC; | 2319 | * hardware strips the CRC before sending to both SMBUS (BMC) and to |
2320 | * host memory when this is enabled | ||
2321 | */ | ||
2322 | if (adapter->flags2 & FLAG2_CRC_STRIPPING) | ||
2323 | rctl |= E1000_RCTL_SECRC; | ||
2306 | 2324 | ||
2307 | /* Setup buffer sizes */ | 2325 | /* Setup buffer sizes */ |
2308 | rctl &= ~E1000_RCTL_SZ_4096; | 2326 | rctl &= ~E1000_RCTL_SZ_4096; |
@@ -4766,6 +4784,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4766 | adapter->ei = ei; | 4784 | adapter->ei = ei; |
4767 | adapter->pba = ei->pba; | 4785 | adapter->pba = ei->pba; |
4768 | adapter->flags = ei->flags; | 4786 | adapter->flags = ei->flags; |
4787 | adapter->flags2 = ei->flags2; | ||
4769 | adapter->hw.adapter = adapter; | 4788 | adapter->hw.adapter = adapter; |
4770 | adapter->hw.mac.type = ei->mac; | 4789 | adapter->hw.mac.type = ei->mac; |
4771 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; | 4790 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; |
@@ -4970,6 +4989,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4970 | 4989 | ||
4971 | /* initialize the wol settings based on the eeprom settings */ | 4990 | /* initialize the wol settings based on the eeprom settings */ |
4972 | adapter->wol = adapter->eeprom_wol; | 4991 | adapter->wol = adapter->eeprom_wol; |
4992 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | ||
4973 | 4993 | ||
4974 | /* reset the hardware with the new settings */ | 4994 | /* reset the hardware with the new settings */ |
4975 | e1000e_reset(adapter); | 4995 | e1000e_reset(adapter); |
@@ -5008,6 +5028,7 @@ err_hw_init: | |||
5008 | err_sw_init: | 5028 | err_sw_init: |
5009 | if (adapter->hw.flash_address) | 5029 | if (adapter->hw.flash_address) |
5010 | iounmap(adapter->hw.flash_address); | 5030 | iounmap(adapter->hw.flash_address); |
5031 | e1000e_reset_interrupt_capability(adapter); | ||
5011 | err_flashmap: | 5032 | err_flashmap: |
5012 | iounmap(adapter->hw.hw_addr); | 5033 | iounmap(adapter->hw.hw_addr); |
5013 | err_ioremap: | 5034 | err_ioremap: |
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c index 77a3d7207a5f..e909f96698e8 100644 --- a/drivers/net/e1000e/param.c +++ b/drivers/net/e1000e/param.c | |||
@@ -151,6 +151,16 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); | |||
151 | */ | 151 | */ |
152 | E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]"); | 152 | E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]"); |
153 | 153 | ||
154 | /* | ||
155 | * Enable CRC Stripping | ||
156 | * | ||
157 | * Valid Range: 0, 1 | ||
158 | * | ||
159 | * Default Value: 1 (enabled) | ||
160 | */ | ||
161 | E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \ | ||
162 | "the CRC"); | ||
163 | |||
154 | struct e1000_option { | 164 | struct e1000_option { |
155 | enum { enable_option, range_option, list_option } type; | 165 | enum { enable_option, range_option, list_option } type; |
156 | const char *name; | 166 | const char *name; |
@@ -404,6 +414,21 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
404 | adapter->flags |= FLAG_SMART_POWER_DOWN; | 414 | adapter->flags |= FLAG_SMART_POWER_DOWN; |
405 | } | 415 | } |
406 | } | 416 | } |
417 | { /* CRC Stripping */ | ||
418 | const struct e1000_option opt = { | ||
419 | .type = enable_option, | ||
420 | .name = "CRC Stripping", | ||
421 | .err = "defaulting to enabled", | ||
422 | .def = OPTION_ENABLED | ||
423 | }; | ||
424 | |||
425 | if (num_CrcStripping > bd) { | ||
426 | unsigned int crc_stripping = CrcStripping[bd]; | ||
427 | e1000_validate_option(&crc_stripping, &opt, adapter); | ||
428 | if (crc_stripping == OPTION_ENABLED) | ||
429 | adapter->flags2 |= FLAG2_CRC_STRIPPING; | ||
430 | } | ||
431 | } | ||
407 | { /* Kumeran Lock Loss Workaround */ | 432 | { /* Kumeran Lock Loss Workaround */ |
408 | const struct e1000_option opt = { | 433 | const struct e1000_option opt = { |
409 | .type = enable_option, | 434 | .type = enable_option, |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 83a5cb6aa23b..c4af949bf860 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -1407,6 +1407,10 @@ static int gfar_clean_tx_ring(struct net_device *dev) | |||
1407 | if (bdp->status & TXBD_DEF) | 1407 | if (bdp->status & TXBD_DEF) |
1408 | dev->stats.collisions++; | 1408 | dev->stats.collisions++; |
1409 | 1409 | ||
1410 | /* Unmap the DMA memory */ | ||
1411 | dma_unmap_single(&priv->dev->dev, bdp->bufPtr, | ||
1412 | bdp->length, DMA_TO_DEVICE); | ||
1413 | |||
1410 | /* Free the sk buffer associated with this TxBD */ | 1414 | /* Free the sk buffer associated with this TxBD */ |
1411 | dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]); | 1415 | dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]); |
1412 | 1416 | ||
@@ -1666,6 +1670,9 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit) | |||
1666 | 1670 | ||
1667 | skb = priv->rx_skbuff[priv->skb_currx]; | 1671 | skb = priv->rx_skbuff[priv->skb_currx]; |
1668 | 1672 | ||
1673 | dma_unmap_single(&priv->dev->dev, bdp->bufPtr, | ||
1674 | priv->rx_buffer_size, DMA_FROM_DEVICE); | ||
1675 | |||
1669 | /* We drop the frame if we failed to allocate a new buffer */ | 1676 | /* We drop the frame if we failed to allocate a new buffer */ |
1670 | if (unlikely(!newskb || !(bdp->status & RXBD_LAST) || | 1677 | if (unlikely(!newskb || !(bdp->status & RXBD_LAST) || |
1671 | bdp->status & RXBD_ERR)) { | 1678 | bdp->status & RXBD_ERR)) { |
@@ -1674,14 +1681,8 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit) | |||
1674 | if (unlikely(!newskb)) | 1681 | if (unlikely(!newskb)) |
1675 | newskb = skb; | 1682 | newskb = skb; |
1676 | 1683 | ||
1677 | if (skb) { | 1684 | if (skb) |
1678 | dma_unmap_single(&priv->dev->dev, | ||
1679 | bdp->bufPtr, | ||
1680 | priv->rx_buffer_size, | ||
1681 | DMA_FROM_DEVICE); | ||
1682 | |||
1683 | dev_kfree_skb_any(skb); | 1685 | dev_kfree_skb_any(skb); |
1684 | } | ||
1685 | } else { | 1686 | } else { |
1686 | /* Increment the number of packets */ | 1687 | /* Increment the number of packets */ |
1687 | dev->stats.rx_packets++; | 1688 | dev->stats.rx_packets++; |
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index 58906c984be9..89964fa739a0 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
@@ -1776,7 +1776,8 @@ static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1776 | 1776 | ||
1777 | /* this function will set ->supported = 0 and return 1 if wol is not | 1777 | /* this function will set ->supported = 0 and return 1 if wol is not |
1778 | * supported by this hardware */ | 1778 | * supported by this hardware */ |
1779 | if (igb_wol_exclusion(adapter, wol)) | 1779 | if (igb_wol_exclusion(adapter, wol) || |
1780 | !device_can_wakeup(&adapter->pdev->dev)) | ||
1780 | return; | 1781 | return; |
1781 | 1782 | ||
1782 | /* apply any specific unsupported masks here */ | 1783 | /* apply any specific unsupported masks here */ |
@@ -1805,7 +1806,8 @@ static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1805 | if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) | 1806 | if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) |
1806 | return -EOPNOTSUPP; | 1807 | return -EOPNOTSUPP; |
1807 | 1808 | ||
1808 | if (igb_wol_exclusion(adapter, wol)) | 1809 | if (igb_wol_exclusion(adapter, wol) || |
1810 | !device_can_wakeup(&adapter->pdev->dev)) | ||
1809 | return wol->wolopts ? -EOPNOTSUPP : 0; | 1811 | return wol->wolopts ? -EOPNOTSUPP : 0; |
1810 | 1812 | ||
1811 | switch (hw->device_id) { | 1813 | switch (hw->device_id) { |
@@ -1825,6 +1827,8 @@ static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1825 | if (wol->wolopts & WAKE_MAGIC) | 1827 | if (wol->wolopts & WAKE_MAGIC) |
1826 | adapter->wol |= E1000_WUFC_MAG; | 1828 | adapter->wol |= E1000_WUFC_MAG; |
1827 | 1829 | ||
1830 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | ||
1831 | |||
1828 | return 0; | 1832 | return 0; |
1829 | } | 1833 | } |
1830 | 1834 | ||
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 1f397cd99414..1cbae85b1426 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -1019,10 +1019,9 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1019 | state &= ~PCIE_LINK_STATE_L0S; | 1019 | state &= ~PCIE_LINK_STATE_L0S; |
1020 | pci_write_config_word(us_dev, pos + PCI_EXP_LNKCTL, | 1020 | pci_write_config_word(us_dev, pos + PCI_EXP_LNKCTL, |
1021 | state); | 1021 | state); |
1022 | printk(KERN_INFO "Disabling ASPM L0s upstream switch " | 1022 | dev_info(&pdev->dev, |
1023 | "port %x:%x.%x\n", us_dev->bus->number, | 1023 | "Disabling ASPM L0s upstream switch port %s\n", |
1024 | PCI_SLOT(us_dev->devfn), | 1024 | pci_name(us_dev)); |
1025 | PCI_FUNC(us_dev->devfn)); | ||
1026 | } | 1025 | } |
1027 | default: | 1026 | default: |
1028 | break; | 1027 | break; |
@@ -1244,6 +1243,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1244 | 1243 | ||
1245 | /* initialize the wol settings based on the eeprom settings */ | 1244 | /* initialize the wol settings based on the eeprom settings */ |
1246 | adapter->wol = adapter->eeprom_wol; | 1245 | adapter->wol = adapter->eeprom_wol; |
1246 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | ||
1247 | 1247 | ||
1248 | /* reset the hardware with the new settings */ | 1248 | /* reset the hardware with the new settings */ |
1249 | igb_reset(adapter); | 1249 | igb_reset(adapter); |
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c index a3f732418c49..96e709d6440a 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c | |||
@@ -656,10 +656,10 @@ static int mlx4_en_start_port(struct net_device *dev) | |||
656 | /* Configure port */ | 656 | /* Configure port */ |
657 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 657 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, |
658 | priv->rx_skb_size + ETH_FCS_LEN, | 658 | priv->rx_skb_size + ETH_FCS_LEN, |
659 | mdev->profile.tx_pause, | 659 | priv->prof->tx_pause, |
660 | mdev->profile.tx_ppp, | 660 | priv->prof->tx_ppp, |
661 | mdev->profile.rx_pause, | 661 | priv->prof->rx_pause, |
662 | mdev->profile.rx_ppp); | 662 | priv->prof->rx_ppp); |
663 | if (err) { | 663 | if (err) { |
664 | mlx4_err(mdev, "Failed setting port general configurations" | 664 | mlx4_err(mdev, "Failed setting port general configurations" |
665 | " for port %d, with error %d\n", priv->port, err); | 665 | " for port %d, with error %d\n", priv->port, err); |
diff --git a/drivers/net/mlx4/en_params.c b/drivers/net/mlx4/en_params.c index c2e69b1bcd0a..95706ee1c019 100644 --- a/drivers/net/mlx4/en_params.c +++ b/drivers/net/mlx4/en_params.c | |||
@@ -90,6 +90,7 @@ MLX4_EN_PARM_INT(rx_ring_size2, MLX4_EN_AUTO_CONF, "Rx ring size for port 2"); | |||
90 | int mlx4_en_get_profile(struct mlx4_en_dev *mdev) | 90 | int mlx4_en_get_profile(struct mlx4_en_dev *mdev) |
91 | { | 91 | { |
92 | struct mlx4_en_profile *params = &mdev->profile; | 92 | struct mlx4_en_profile *params = &mdev->profile; |
93 | int i; | ||
93 | 94 | ||
94 | params->rx_moder_cnt = min_t(int, rx_moder_cnt, MLX4_EN_AUTO_CONF); | 95 | params->rx_moder_cnt = min_t(int, rx_moder_cnt, MLX4_EN_AUTO_CONF); |
95 | params->rx_moder_time = min_t(int, rx_moder_time, MLX4_EN_AUTO_CONF); | 96 | params->rx_moder_time = min_t(int, rx_moder_time, MLX4_EN_AUTO_CONF); |
@@ -97,11 +98,13 @@ int mlx4_en_get_profile(struct mlx4_en_dev *mdev) | |||
97 | params->rss_xor = (rss_xor != 0); | 98 | params->rss_xor = (rss_xor != 0); |
98 | params->rss_mask = rss_mask & 0x1f; | 99 | params->rss_mask = rss_mask & 0x1f; |
99 | params->num_lro = min_t(int, num_lro , MLX4_EN_MAX_LRO_DESCRIPTORS); | 100 | params->num_lro = min_t(int, num_lro , MLX4_EN_MAX_LRO_DESCRIPTORS); |
100 | params->rx_pause = pprx; | 101 | for (i = 1; i <= MLX4_MAX_PORTS; i++) { |
101 | params->rx_ppp = pfcrx; | 102 | params->prof[i].rx_pause = pprx; |
102 | params->tx_pause = pptx; | 103 | params->prof[i].rx_ppp = pfcrx; |
103 | params->tx_ppp = pfctx; | 104 | params->prof[i].tx_pause = pptx; |
104 | if (params->rx_ppp || params->tx_ppp) { | 105 | params->prof[i].tx_ppp = pfctx; |
106 | } | ||
107 | if (pfcrx || pfctx) { | ||
105 | params->prof[1].tx_ring_num = MLX4_EN_TX_RING_NUM; | 108 | params->prof[1].tx_ring_num = MLX4_EN_TX_RING_NUM; |
106 | params->prof[2].tx_ring_num = MLX4_EN_TX_RING_NUM; | 109 | params->prof[2].tx_ring_num = MLX4_EN_TX_RING_NUM; |
107 | } else { | 110 | } else { |
@@ -407,14 +410,14 @@ static int mlx4_en_set_pauseparam(struct net_device *dev, | |||
407 | struct mlx4_en_dev *mdev = priv->mdev; | 410 | struct mlx4_en_dev *mdev = priv->mdev; |
408 | int err; | 411 | int err; |
409 | 412 | ||
410 | mdev->profile.tx_pause = pause->tx_pause != 0; | 413 | priv->prof->tx_pause = pause->tx_pause != 0; |
411 | mdev->profile.rx_pause = pause->rx_pause != 0; | 414 | priv->prof->rx_pause = pause->rx_pause != 0; |
412 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 415 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, |
413 | priv->rx_skb_size + ETH_FCS_LEN, | 416 | priv->rx_skb_size + ETH_FCS_LEN, |
414 | mdev->profile.tx_pause, | 417 | priv->prof->tx_pause, |
415 | mdev->profile.tx_ppp, | 418 | priv->prof->tx_ppp, |
416 | mdev->profile.rx_pause, | 419 | priv->prof->rx_pause, |
417 | mdev->profile.rx_ppp); | 420 | priv->prof->rx_ppp); |
418 | if (err) | 421 | if (err) |
419 | mlx4_err(mdev, "Failed setting pause params to\n"); | 422 | mlx4_err(mdev, "Failed setting pause params to\n"); |
420 | 423 | ||
@@ -425,10 +428,9 @@ static void mlx4_en_get_pauseparam(struct net_device *dev, | |||
425 | struct ethtool_pauseparam *pause) | 428 | struct ethtool_pauseparam *pause) |
426 | { | 429 | { |
427 | struct mlx4_en_priv *priv = netdev_priv(dev); | 430 | struct mlx4_en_priv *priv = netdev_priv(dev); |
428 | struct mlx4_en_dev *mdev = priv->mdev; | ||
429 | 431 | ||
430 | pause->tx_pause = mdev->profile.tx_pause; | 432 | pause->tx_pause = priv->prof->tx_pause; |
431 | pause->rx_pause = mdev->profile.rx_pause; | 433 | pause->rx_pause = priv->prof->rx_pause; |
432 | } | 434 | } |
433 | 435 | ||
434 | static void mlx4_en_get_ringparam(struct net_device *dev, | 436 | static void mlx4_en_get_ringparam(struct net_device *dev, |
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h index 11fb17c6e97b..98ddc0811f93 100644 --- a/drivers/net/mlx4/mlx4_en.h +++ b/drivers/net/mlx4/mlx4_en.h | |||
@@ -322,6 +322,10 @@ struct mlx4_en_port_profile { | |||
322 | u32 rx_ring_num; | 322 | u32 rx_ring_num; |
323 | u32 tx_ring_size; | 323 | u32 tx_ring_size; |
324 | u32 rx_ring_size; | 324 | u32 rx_ring_size; |
325 | u8 rx_pause; | ||
326 | u8 rx_ppp; | ||
327 | u8 tx_pause; | ||
328 | u8 tx_ppp; | ||
325 | }; | 329 | }; |
326 | 330 | ||
327 | struct mlx4_en_profile { | 331 | struct mlx4_en_profile { |
@@ -333,10 +337,6 @@ struct mlx4_en_profile { | |||
333 | int rx_moder_cnt; | 337 | int rx_moder_cnt; |
334 | int rx_moder_time; | 338 | int rx_moder_time; |
335 | int auto_moder; | 339 | int auto_moder; |
336 | u8 rx_pause; | ||
337 | u8 rx_ppp; | ||
338 | u8 tx_pause; | ||
339 | u8 tx_ppp; | ||
340 | u8 no_reset; | 340 | u8 no_reset; |
341 | struct mlx4_en_port_profile prof[MLX4_MAX_PORTS + 1]; | 341 | struct mlx4_en_port_profile prof[MLX4_MAX_PORTS + 1]; |
342 | }; | 342 | }; |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index d8463b1c3df3..1b6f548c4411 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -33,8 +33,8 @@ | |||
33 | 33 | ||
34 | #define DRV_MODULE_NAME "niu" | 34 | #define DRV_MODULE_NAME "niu" |
35 | #define PFX DRV_MODULE_NAME ": " | 35 | #define PFX DRV_MODULE_NAME ": " |
36 | #define DRV_MODULE_VERSION "0.9" | 36 | #define DRV_MODULE_VERSION "1.0" |
37 | #define DRV_MODULE_RELDATE "May 4, 2008" | 37 | #define DRV_MODULE_RELDATE "Nov 14, 2008" |
38 | 38 | ||
39 | static char version[] __devinitdata = | 39 | static char version[] __devinitdata = |
40 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 40 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
@@ -406,7 +406,7 @@ static int esr2_set_rx_cfg(struct niu *np, unsigned long channel, u32 val) | |||
406 | } | 406 | } |
407 | 407 | ||
408 | /* Mode is always 10G fiber. */ | 408 | /* Mode is always 10G fiber. */ |
409 | static int serdes_init_niu(struct niu *np) | 409 | static int serdes_init_niu_10g_fiber(struct niu *np) |
410 | { | 410 | { |
411 | struct niu_link_config *lp = &np->link_config; | 411 | struct niu_link_config *lp = &np->link_config; |
412 | u32 tx_cfg, rx_cfg; | 412 | u32 tx_cfg, rx_cfg; |
@@ -443,6 +443,223 @@ static int serdes_init_niu(struct niu *np) | |||
443 | return 0; | 443 | return 0; |
444 | } | 444 | } |
445 | 445 | ||
446 | static int serdes_init_niu_1g_serdes(struct niu *np) | ||
447 | { | ||
448 | struct niu_link_config *lp = &np->link_config; | ||
449 | u16 pll_cfg, pll_sts; | ||
450 | int max_retry = 100; | ||
451 | u64 sig, mask, val; | ||
452 | u32 tx_cfg, rx_cfg; | ||
453 | unsigned long i; | ||
454 | int err; | ||
455 | |||
456 | tx_cfg = (PLL_TX_CFG_ENTX | PLL_TX_CFG_SWING_1375MV | | ||
457 | PLL_TX_CFG_RATE_HALF); | ||
458 | rx_cfg = (PLL_RX_CFG_ENRX | PLL_RX_CFG_TERM_0P8VDDT | | ||
459 | PLL_RX_CFG_ALIGN_ENA | PLL_RX_CFG_LOS_LTHRESH | | ||
460 | PLL_RX_CFG_RATE_HALF); | ||
461 | |||
462 | if (np->port == 0) | ||
463 | rx_cfg |= PLL_RX_CFG_EQ_LP_ADAPTIVE; | ||
464 | |||
465 | if (lp->loopback_mode == LOOPBACK_PHY) { | ||
466 | u16 test_cfg = PLL_TEST_CFG_LOOPBACK_CML_DIS; | ||
467 | |||
468 | mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | ||
469 | ESR2_TI_PLL_TEST_CFG_L, test_cfg); | ||
470 | |||
471 | tx_cfg |= PLL_TX_CFG_ENTEST; | ||
472 | rx_cfg |= PLL_RX_CFG_ENTEST; | ||
473 | } | ||
474 | |||
475 | /* Initialize PLL for 1G */ | ||
476 | pll_cfg = (PLL_CFG_ENPLL | PLL_CFG_MPY_8X); | ||
477 | |||
478 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | ||
479 | ESR2_TI_PLL_CFG_L, pll_cfg); | ||
480 | if (err) { | ||
481 | dev_err(np->device, PFX "NIU Port %d " | ||
482 | "serdes_init_niu_1g_serdes: " | ||
483 | "mdio write to ESR2_TI_PLL_CFG_L failed", np->port); | ||
484 | return err; | ||
485 | } | ||
486 | |||
487 | pll_sts = PLL_CFG_ENPLL; | ||
488 | |||
489 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | ||
490 | ESR2_TI_PLL_STS_L, pll_sts); | ||
491 | if (err) { | ||
492 | dev_err(np->device, PFX "NIU Port %d " | ||
493 | "serdes_init_niu_1g_serdes: " | ||
494 | "mdio write to ESR2_TI_PLL_STS_L failed", np->port); | ||
495 | return err; | ||
496 | } | ||
497 | |||
498 | udelay(200); | ||
499 | |||
500 | /* Initialize all 4 lanes of the SERDES. */ | ||
501 | for (i = 0; i < 4; i++) { | ||
502 | err = esr2_set_tx_cfg(np, i, tx_cfg); | ||
503 | if (err) | ||
504 | return err; | ||
505 | } | ||
506 | |||
507 | for (i = 0; i < 4; i++) { | ||
508 | err = esr2_set_rx_cfg(np, i, rx_cfg); | ||
509 | if (err) | ||
510 | return err; | ||
511 | } | ||
512 | |||
513 | switch (np->port) { | ||
514 | case 0: | ||
515 | val = (ESR_INT_SRDY0_P0 | ESR_INT_DET0_P0); | ||
516 | mask = val; | ||
517 | break; | ||
518 | |||
519 | case 1: | ||
520 | val = (ESR_INT_SRDY0_P1 | ESR_INT_DET0_P1); | ||
521 | mask = val; | ||
522 | break; | ||
523 | |||
524 | default: | ||
525 | return -EINVAL; | ||
526 | } | ||
527 | |||
528 | while (max_retry--) { | ||
529 | sig = nr64(ESR_INT_SIGNALS); | ||
530 | if ((sig & mask) == val) | ||
531 | break; | ||
532 | |||
533 | mdelay(500); | ||
534 | } | ||
535 | |||
536 | if ((sig & mask) != val) { | ||
537 | dev_err(np->device, PFX "Port %u signal bits [%08x] are not " | ||
538 | "[%08x]\n", np->port, (int) (sig & mask), (int) val); | ||
539 | return -ENODEV; | ||
540 | } | ||
541 | |||
542 | return 0; | ||
543 | } | ||
544 | |||
545 | static int serdes_init_niu_10g_serdes(struct niu *np) | ||
546 | { | ||
547 | struct niu_link_config *lp = &np->link_config; | ||
548 | u32 tx_cfg, rx_cfg, pll_cfg, pll_sts; | ||
549 | int max_retry = 100; | ||
550 | u64 sig, mask, val; | ||
551 | unsigned long i; | ||
552 | int err; | ||
553 | |||
554 | tx_cfg = (PLL_TX_CFG_ENTX | PLL_TX_CFG_SWING_1375MV); | ||
555 | rx_cfg = (PLL_RX_CFG_ENRX | PLL_RX_CFG_TERM_0P8VDDT | | ||
556 | PLL_RX_CFG_ALIGN_ENA | PLL_RX_CFG_LOS_LTHRESH | | ||
557 | PLL_RX_CFG_EQ_LP_ADAPTIVE); | ||
558 | |||
559 | if (lp->loopback_mode == LOOPBACK_PHY) { | ||
560 | u16 test_cfg = PLL_TEST_CFG_LOOPBACK_CML_DIS; | ||
561 | |||
562 | mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | ||
563 | ESR2_TI_PLL_TEST_CFG_L, test_cfg); | ||
564 | |||
565 | tx_cfg |= PLL_TX_CFG_ENTEST; | ||
566 | rx_cfg |= PLL_RX_CFG_ENTEST; | ||
567 | } | ||
568 | |||
569 | /* Initialize PLL for 10G */ | ||
570 | pll_cfg = (PLL_CFG_ENPLL | PLL_CFG_MPY_10X); | ||
571 | |||
572 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | ||
573 | ESR2_TI_PLL_CFG_L, pll_cfg & 0xffff); | ||
574 | if (err) { | ||
575 | dev_err(np->device, PFX "NIU Port %d " | ||
576 | "serdes_init_niu_10g_serdes: " | ||
577 | "mdio write to ESR2_TI_PLL_CFG_L failed", np->port); | ||
578 | return err; | ||
579 | } | ||
580 | |||
581 | pll_sts = PLL_CFG_ENPLL; | ||
582 | |||
583 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | ||
584 | ESR2_TI_PLL_STS_L, pll_sts & 0xffff); | ||
585 | if (err) { | ||
586 | dev_err(np->device, PFX "NIU Port %d " | ||
587 | "serdes_init_niu_10g_serdes: " | ||
588 | "mdio write to ESR2_TI_PLL_STS_L failed", np->port); | ||
589 | return err; | ||
590 | } | ||
591 | |||
592 | udelay(200); | ||
593 | |||
594 | /* Initialize all 4 lanes of the SERDES. */ | ||
595 | for (i = 0; i < 4; i++) { | ||
596 | err = esr2_set_tx_cfg(np, i, tx_cfg); | ||
597 | if (err) | ||
598 | return err; | ||
599 | } | ||
600 | |||
601 | for (i = 0; i < 4; i++) { | ||
602 | err = esr2_set_rx_cfg(np, i, rx_cfg); | ||
603 | if (err) | ||
604 | return err; | ||
605 | } | ||
606 | |||
607 | /* check if serdes is ready */ | ||
608 | |||
609 | switch (np->port) { | ||
610 | case 0: | ||
611 | mask = ESR_INT_SIGNALS_P0_BITS; | ||
612 | val = (ESR_INT_SRDY0_P0 | | ||
613 | ESR_INT_DET0_P0 | | ||
614 | ESR_INT_XSRDY_P0 | | ||
615 | ESR_INT_XDP_P0_CH3 | | ||
616 | ESR_INT_XDP_P0_CH2 | | ||
617 | ESR_INT_XDP_P0_CH1 | | ||
618 | ESR_INT_XDP_P0_CH0); | ||
619 | break; | ||
620 | |||
621 | case 1: | ||
622 | mask = ESR_INT_SIGNALS_P1_BITS; | ||
623 | val = (ESR_INT_SRDY0_P1 | | ||
624 | ESR_INT_DET0_P1 | | ||
625 | ESR_INT_XSRDY_P1 | | ||
626 | ESR_INT_XDP_P1_CH3 | | ||
627 | ESR_INT_XDP_P1_CH2 | | ||
628 | ESR_INT_XDP_P1_CH1 | | ||
629 | ESR_INT_XDP_P1_CH0); | ||
630 | break; | ||
631 | |||
632 | default: | ||
633 | return -EINVAL; | ||
634 | } | ||
635 | |||
636 | while (max_retry--) { | ||
637 | sig = nr64(ESR_INT_SIGNALS); | ||
638 | if ((sig & mask) == val) | ||
639 | break; | ||
640 | |||
641 | mdelay(500); | ||
642 | } | ||
643 | |||
644 | if ((sig & mask) != val) { | ||
645 | pr_info(PFX "NIU Port %u signal bits [%08x] are not " | ||
646 | "[%08x] for 10G...trying 1G\n", | ||
647 | np->port, (int) (sig & mask), (int) val); | ||
648 | |||
649 | /* 10G failed, try initializing at 1G */ | ||
650 | err = serdes_init_niu_1g_serdes(np); | ||
651 | if (!err) { | ||
652 | np->flags &= ~NIU_FLAGS_10G; | ||
653 | np->mac_xcvr = MAC_XCVR_PCS; | ||
654 | } else { | ||
655 | dev_err(np->device, PFX "Port %u 10G/1G SERDES " | ||
656 | "Link Failed \n", np->port); | ||
657 | return -ENODEV; | ||
658 | } | ||
659 | } | ||
660 | return 0; | ||
661 | } | ||
662 | |||
446 | static int esr_read_rxtx_ctrl(struct niu *np, unsigned long chan, u32 *val) | 663 | static int esr_read_rxtx_ctrl(struct niu *np, unsigned long chan, u32 *val) |
447 | { | 664 | { |
448 | int err; | 665 | int err; |
@@ -1954,13 +2171,23 @@ static const struct niu_phy_ops phy_ops_10g_serdes = { | |||
1954 | .link_status = link_status_10g_serdes, | 2171 | .link_status = link_status_10g_serdes, |
1955 | }; | 2172 | }; |
1956 | 2173 | ||
2174 | static const struct niu_phy_ops phy_ops_10g_serdes_niu = { | ||
2175 | .serdes_init = serdes_init_niu_10g_serdes, | ||
2176 | .link_status = link_status_10g_serdes, | ||
2177 | }; | ||
2178 | |||
2179 | static const struct niu_phy_ops phy_ops_1g_serdes_niu = { | ||
2180 | .serdes_init = serdes_init_niu_1g_serdes, | ||
2181 | .link_status = link_status_1g_serdes, | ||
2182 | }; | ||
2183 | |||
1957 | static const struct niu_phy_ops phy_ops_1g_rgmii = { | 2184 | static const struct niu_phy_ops phy_ops_1g_rgmii = { |
1958 | .xcvr_init = xcvr_init_1g_rgmii, | 2185 | .xcvr_init = xcvr_init_1g_rgmii, |
1959 | .link_status = link_status_1g_rgmii, | 2186 | .link_status = link_status_1g_rgmii, |
1960 | }; | 2187 | }; |
1961 | 2188 | ||
1962 | static const struct niu_phy_ops phy_ops_10g_fiber_niu = { | 2189 | static const struct niu_phy_ops phy_ops_10g_fiber_niu = { |
1963 | .serdes_init = serdes_init_niu, | 2190 | .serdes_init = serdes_init_niu_10g_fiber, |
1964 | .xcvr_init = xcvr_init_10g, | 2191 | .xcvr_init = xcvr_init_10g, |
1965 | .link_status = link_status_10g, | 2192 | .link_status = link_status_10g, |
1966 | }; | 2193 | }; |
@@ -1998,11 +2225,21 @@ struct niu_phy_template { | |||
1998 | u32 phy_addr_base; | 2225 | u32 phy_addr_base; |
1999 | }; | 2226 | }; |
2000 | 2227 | ||
2001 | static const struct niu_phy_template phy_template_niu = { | 2228 | static const struct niu_phy_template phy_template_niu_10g_fiber = { |
2002 | .ops = &phy_ops_10g_fiber_niu, | 2229 | .ops = &phy_ops_10g_fiber_niu, |
2003 | .phy_addr_base = 16, | 2230 | .phy_addr_base = 16, |
2004 | }; | 2231 | }; |
2005 | 2232 | ||
2233 | static const struct niu_phy_template phy_template_niu_10g_serdes = { | ||
2234 | .ops = &phy_ops_10g_serdes_niu, | ||
2235 | .phy_addr_base = 0, | ||
2236 | }; | ||
2237 | |||
2238 | static const struct niu_phy_template phy_template_niu_1g_serdes = { | ||
2239 | .ops = &phy_ops_1g_serdes_niu, | ||
2240 | .phy_addr_base = 0, | ||
2241 | }; | ||
2242 | |||
2006 | static const struct niu_phy_template phy_template_10g_fiber = { | 2243 | static const struct niu_phy_template phy_template_10g_fiber = { |
2007 | .ops = &phy_ops_10g_fiber, | 2244 | .ops = &phy_ops_10g_fiber, |
2008 | .phy_addr_base = 8, | 2245 | .phy_addr_base = 8, |
@@ -2182,8 +2419,25 @@ static int niu_determine_phy_disposition(struct niu *np) | |||
2182 | u32 phy_addr_off = 0; | 2419 | u32 phy_addr_off = 0; |
2183 | 2420 | ||
2184 | if (plat_type == PLAT_TYPE_NIU) { | 2421 | if (plat_type == PLAT_TYPE_NIU) { |
2185 | tp = &phy_template_niu; | 2422 | switch (np->flags & |
2186 | phy_addr_off += np->port; | 2423 | (NIU_FLAGS_10G | |
2424 | NIU_FLAGS_FIBER | | ||
2425 | NIU_FLAGS_XCVR_SERDES)) { | ||
2426 | case NIU_FLAGS_10G | NIU_FLAGS_XCVR_SERDES: | ||
2427 | /* 10G Serdes */ | ||
2428 | tp = &phy_template_niu_10g_serdes; | ||
2429 | break; | ||
2430 | case NIU_FLAGS_XCVR_SERDES: | ||
2431 | /* 1G Serdes */ | ||
2432 | tp = &phy_template_niu_1g_serdes; | ||
2433 | break; | ||
2434 | case NIU_FLAGS_10G | NIU_FLAGS_FIBER: | ||
2435 | /* 10G Fiber */ | ||
2436 | default: | ||
2437 | tp = &phy_template_niu_10g_fiber; | ||
2438 | phy_addr_off += np->port; | ||
2439 | break; | ||
2440 | } | ||
2187 | } else { | 2441 | } else { |
2188 | switch (np->flags & | 2442 | switch (np->flags & |
2189 | (NIU_FLAGS_10G | | 2443 | (NIU_FLAGS_10G | |
@@ -7213,6 +7467,12 @@ static int __devinit niu_phy_type_prop_decode(struct niu *np, | |||
7213 | np->flags |= NIU_FLAGS_10G; | 7467 | np->flags |= NIU_FLAGS_10G; |
7214 | np->flags &= ~NIU_FLAGS_FIBER; | 7468 | np->flags &= ~NIU_FLAGS_FIBER; |
7215 | np->mac_xcvr = MAC_XCVR_XPCS; | 7469 | np->mac_xcvr = MAC_XCVR_XPCS; |
7470 | } else if (!strcmp(phy_prop, "xgsd") || !strcmp(phy_prop, "gsd")) { | ||
7471 | /* 10G Serdes or 1G Serdes, default to 10G */ | ||
7472 | np->flags |= NIU_FLAGS_10G; | ||
7473 | np->flags &= ~NIU_FLAGS_FIBER; | ||
7474 | np->flags |= NIU_FLAGS_XCVR_SERDES; | ||
7475 | np->mac_xcvr = MAC_XCVR_XPCS; | ||
7216 | } else { | 7476 | } else { |
7217 | return -EINVAL; | 7477 | return -EINVAL; |
7218 | } | 7478 | } |
@@ -7741,6 +8001,8 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent) | |||
7741 | u32 val; | 8001 | u32 val; |
7742 | int err; | 8002 | int err; |
7743 | 8003 | ||
8004 | num_10g = num_1g = 0; | ||
8005 | |||
7744 | if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) || | 8006 | if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) || |
7745 | !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) { | 8007 | !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) { |
7746 | num_10g = 0; | 8008 | num_10g = 0; |
@@ -7757,6 +8019,16 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent) | |||
7757 | parent->num_ports = 2; | 8019 | parent->num_ports = 2; |
7758 | val = (phy_encode(PORT_TYPE_10G, 0) | | 8020 | val = (phy_encode(PORT_TYPE_10G, 0) | |
7759 | phy_encode(PORT_TYPE_10G, 1)); | 8021 | phy_encode(PORT_TYPE_10G, 1)); |
8022 | } else if ((np->flags & NIU_FLAGS_XCVR_SERDES) && | ||
8023 | (parent->plat_type == PLAT_TYPE_NIU)) { | ||
8024 | /* this is the Monza case */ | ||
8025 | if (np->flags & NIU_FLAGS_10G) { | ||
8026 | val = (phy_encode(PORT_TYPE_10G, 0) | | ||
8027 | phy_encode(PORT_TYPE_10G, 1)); | ||
8028 | } else { | ||
8029 | val = (phy_encode(PORT_TYPE_1G, 0) | | ||
8030 | phy_encode(PORT_TYPE_1G, 1)); | ||
8031 | } | ||
7760 | } else { | 8032 | } else { |
7761 | err = fill_phy_probe_info(np, parent, info); | 8033 | err = fill_phy_probe_info(np, parent, info); |
7762 | if (err) | 8034 | if (err) |
@@ -8656,7 +8928,9 @@ static void __devinit niu_device_announce(struct niu *np) | |||
8656 | dev->name, | 8928 | dev->name, |
8657 | (np->flags & NIU_FLAGS_XMAC ? "XMAC" : "BMAC"), | 8929 | (np->flags & NIU_FLAGS_XMAC ? "XMAC" : "BMAC"), |
8658 | (np->flags & NIU_FLAGS_10G ? "10G" : "1G"), | 8930 | (np->flags & NIU_FLAGS_10G ? "10G" : "1G"), |
8659 | (np->flags & NIU_FLAGS_FIBER ? "FIBER" : "COPPER"), | 8931 | (np->flags & NIU_FLAGS_FIBER ? "FIBER" : |
8932 | (np->flags & NIU_FLAGS_XCVR_SERDES ? "SERDES" : | ||
8933 | "COPPER")), | ||
8660 | (np->mac_xcvr == MAC_XCVR_MII ? "MII" : | 8934 | (np->mac_xcvr == MAC_XCVR_MII ? "MII" : |
8661 | (np->mac_xcvr == MAC_XCVR_PCS ? "PCS" : "XPCS")), | 8935 | (np->mac_xcvr == MAC_XCVR_PCS ? "PCS" : "XPCS")), |
8662 | np->vpd.phy_type); | 8936 | np->vpd.phy_type); |
diff --git a/drivers/net/niu.h b/drivers/net/niu.h index c6fa883daa22..180ca8ae93de 100644 --- a/drivers/net/niu.h +++ b/drivers/net/niu.h | |||
@@ -1048,6 +1048,13 @@ | |||
1048 | #define PLL_CFG_LD_SHIFT 8 | 1048 | #define PLL_CFG_LD_SHIFT 8 |
1049 | #define PLL_CFG_MPY 0x0000001e | 1049 | #define PLL_CFG_MPY 0x0000001e |
1050 | #define PLL_CFG_MPY_SHIFT 1 | 1050 | #define PLL_CFG_MPY_SHIFT 1 |
1051 | #define PLL_CFG_MPY_4X 0x0 | ||
1052 | #define PLL_CFG_MPY_5X 0x00000002 | ||
1053 | #define PLL_CFG_MPY_6X 0x00000004 | ||
1054 | #define PLL_CFG_MPY_8X 0x00000008 | ||
1055 | #define PLL_CFG_MPY_10X 0x0000000a | ||
1056 | #define PLL_CFG_MPY_12X 0x0000000c | ||
1057 | #define PLL_CFG_MPY_12P5X 0x0000000e | ||
1051 | #define PLL_CFG_ENPLL 0x00000001 | 1058 | #define PLL_CFG_ENPLL 0x00000001 |
1052 | 1059 | ||
1053 | #define ESR2_TI_PLL_STS_L (ESR2_BASE + 0x002) | 1060 | #define ESR2_TI_PLL_STS_L (ESR2_BASE + 0x002) |
@@ -1093,6 +1100,9 @@ | |||
1093 | #define PLL_TX_CFG_INVPAIR 0x00000080 | 1100 | #define PLL_TX_CFG_INVPAIR 0x00000080 |
1094 | #define PLL_TX_CFG_RATE 0x00000060 | 1101 | #define PLL_TX_CFG_RATE 0x00000060 |
1095 | #define PLL_TX_CFG_RATE_SHIFT 5 | 1102 | #define PLL_TX_CFG_RATE_SHIFT 5 |
1103 | #define PLL_TX_CFG_RATE_FULL 0x0 | ||
1104 | #define PLL_TX_CFG_RATE_HALF 0x20 | ||
1105 | #define PLL_TX_CFG_RATE_QUAD 0x40 | ||
1096 | #define PLL_TX_CFG_BUSWIDTH 0x0000001c | 1106 | #define PLL_TX_CFG_BUSWIDTH 0x0000001c |
1097 | #define PLL_TX_CFG_BUSWIDTH_SHIFT 2 | 1107 | #define PLL_TX_CFG_BUSWIDTH_SHIFT 2 |
1098 | #define PLL_TX_CFG_ENTEST 0x00000002 | 1108 | #define PLL_TX_CFG_ENTEST 0x00000002 |
@@ -1132,6 +1142,9 @@ | |||
1132 | #define PLL_RX_CFG_INVPAIR 0x00000080 | 1142 | #define PLL_RX_CFG_INVPAIR 0x00000080 |
1133 | #define PLL_RX_CFG_RATE 0x00000060 | 1143 | #define PLL_RX_CFG_RATE 0x00000060 |
1134 | #define PLL_RX_CFG_RATE_SHIFT 5 | 1144 | #define PLL_RX_CFG_RATE_SHIFT 5 |
1145 | #define PLL_RX_CFG_RATE_FULL 0x0 | ||
1146 | #define PLL_RX_CFG_RATE_HALF 0x20 | ||
1147 | #define PLL_RX_CFG_RATE_QUAD 0x40 | ||
1135 | #define PLL_RX_CFG_BUSWIDTH 0x0000001c | 1148 | #define PLL_RX_CFG_BUSWIDTH 0x0000001c |
1136 | #define PLL_RX_CFG_BUSWIDTH_SHIFT 2 | 1149 | #define PLL_RX_CFG_BUSWIDTH_SHIFT 2 |
1137 | #define PLL_RX_CFG_ENTEST 0x00000002 | 1150 | #define PLL_RX_CFG_ENTEST 0x00000002 |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 4aa547947040..eb6411c4694f 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -227,6 +227,59 @@ static int m88e1111_config_init(struct phy_device *phydev) | |||
227 | return 0; | 227 | return 0; |
228 | } | 228 | } |
229 | 229 | ||
230 | static int m88e1118_config_aneg(struct phy_device *phydev) | ||
231 | { | ||
232 | int err; | ||
233 | |||
234 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | ||
235 | if (err < 0) | ||
236 | return err; | ||
237 | |||
238 | err = phy_write(phydev, MII_M1011_PHY_SCR, | ||
239 | MII_M1011_PHY_SCR_AUTO_CROSS); | ||
240 | if (err < 0) | ||
241 | return err; | ||
242 | |||
243 | err = genphy_config_aneg(phydev); | ||
244 | return 0; | ||
245 | } | ||
246 | |||
247 | static int m88e1118_config_init(struct phy_device *phydev) | ||
248 | { | ||
249 | int err; | ||
250 | |||
251 | /* Change address */ | ||
252 | err = phy_write(phydev, 0x16, 0x0002); | ||
253 | if (err < 0) | ||
254 | return err; | ||
255 | |||
256 | /* Enable 1000 Mbit */ | ||
257 | err = phy_write(phydev, 0x15, 0x1070); | ||
258 | if (err < 0) | ||
259 | return err; | ||
260 | |||
261 | /* Change address */ | ||
262 | err = phy_write(phydev, 0x16, 0x0003); | ||
263 | if (err < 0) | ||
264 | return err; | ||
265 | |||
266 | /* Adjust LED Control */ | ||
267 | err = phy_write(phydev, 0x10, 0x021e); | ||
268 | if (err < 0) | ||
269 | return err; | ||
270 | |||
271 | /* Reset address */ | ||
272 | err = phy_write(phydev, 0x16, 0x0); | ||
273 | if (err < 0) | ||
274 | return err; | ||
275 | |||
276 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | ||
277 | if (err < 0) | ||
278 | return err; | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | |||
230 | static int m88e1145_config_init(struct phy_device *phydev) | 283 | static int m88e1145_config_init(struct phy_device *phydev) |
231 | { | 284 | { |
232 | int err; | 285 | int err; |
@@ -416,6 +469,19 @@ static struct phy_driver marvell_drivers[] = { | |||
416 | .driver = { .owner = THIS_MODULE }, | 469 | .driver = { .owner = THIS_MODULE }, |
417 | }, | 470 | }, |
418 | { | 471 | { |
472 | .phy_id = 0x01410e10, | ||
473 | .phy_id_mask = 0xfffffff0, | ||
474 | .name = "Marvell 88E1118", | ||
475 | .features = PHY_GBIT_FEATURES, | ||
476 | .flags = PHY_HAS_INTERRUPT, | ||
477 | .config_init = &m88e1118_config_init, | ||
478 | .config_aneg = &m88e1118_config_aneg, | ||
479 | .read_status = &genphy_read_status, | ||
480 | .ack_interrupt = &marvell_ack_interrupt, | ||
481 | .config_intr = &marvell_config_intr, | ||
482 | .driver = {.owner = THIS_MODULE,}, | ||
483 | }, | ||
484 | { | ||
419 | .phy_id = 0x01410cd0, | 485 | .phy_id = 0x01410cd0, |
420 | .phy_id_mask = 0xfffffff0, | 486 | .phy_id_mask = 0xfffffff0, |
421 | .name = "Marvell 88E1145", | 487 | .name = "Marvell 88E1145", |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index d0ed1ef284a8..536bda1f428b 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -136,7 +136,7 @@ void mdiobus_unregister(struct mii_bus *bus) | |||
136 | BUG_ON(bus->state != MDIOBUS_REGISTERED); | 136 | BUG_ON(bus->state != MDIOBUS_REGISTERED); |
137 | bus->state = MDIOBUS_UNREGISTERED; | 137 | bus->state = MDIOBUS_UNREGISTERED; |
138 | 138 | ||
139 | device_unregister(&bus->dev); | 139 | device_del(&bus->dev); |
140 | for (i = 0; i < PHY_MAX_ADDR; i++) { | 140 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
141 | if (bus->phy_map[i]) | 141 | if (bus->phy_map[i]) |
142 | device_unregister(&bus->phy_map[i]->dev); | 142 | device_unregister(&bus->phy_map[i]->dev); |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index e11b03b2b25a..8fb1faca883a 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -227,8 +227,8 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr) | |||
227 | if (r) | 227 | if (r) |
228 | return ERR_PTR(r); | 228 | return ERR_PTR(r); |
229 | 229 | ||
230 | /* If the phy_id is all Fs, there is no device there */ | 230 | /* If the phy_id is all Fs or all 0s, there is no device there */ |
231 | if (0xffffffff == phy_id) | 231 | if ((0xffff == phy_id) || (0x00 == phy_id)) |
232 | return NULL; | 232 | return NULL; |
233 | 233 | ||
234 | dev = phy_device_create(bus, addr, phy_id); | 234 | dev = phy_device_create(bus, addr, phy_id); |
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index 3cdd07c45b6d..508452c02151 100644 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
@@ -1515,9 +1515,6 @@ static u32 ql_get_link_state(struct ql3_adapter *qdev) | |||
1515 | linkState = LS_UP; | 1515 | linkState = LS_UP; |
1516 | } else { | 1516 | } else { |
1517 | linkState = LS_DOWN; | 1517 | linkState = LS_DOWN; |
1518 | if (netif_msg_link(qdev)) | ||
1519 | printk(KERN_WARNING PFX | ||
1520 | "%s: Link is down.\n", qdev->ndev->name); | ||
1521 | } | 1518 | } |
1522 | return linkState; | 1519 | return linkState; |
1523 | } | 1520 | } |
@@ -1581,10 +1578,6 @@ static int ql_finish_auto_neg(struct ql3_adapter *qdev) | |||
1581 | ql_mac_enable(qdev, 1); | 1578 | ql_mac_enable(qdev, 1); |
1582 | } | 1579 | } |
1583 | 1580 | ||
1584 | if (netif_msg_link(qdev)) | ||
1585 | printk(KERN_DEBUG PFX | ||
1586 | "%s: Change port_link_state LS_DOWN to LS_UP.\n", | ||
1587 | qdev->ndev->name); | ||
1588 | qdev->port_link_state = LS_UP; | 1581 | qdev->port_link_state = LS_UP; |
1589 | netif_start_queue(qdev->ndev); | 1582 | netif_start_queue(qdev->ndev); |
1590 | netif_carrier_on(qdev->ndev); | 1583 | netif_carrier_on(qdev->ndev); |
@@ -1655,14 +1648,9 @@ static void ql_link_state_machine_work(struct work_struct *work) | |||
1655 | /* Fall Through */ | 1648 | /* Fall Through */ |
1656 | 1649 | ||
1657 | case LS_DOWN: | 1650 | case LS_DOWN: |
1658 | if (netif_msg_link(qdev)) | ||
1659 | printk(KERN_DEBUG PFX | ||
1660 | "%s: port_link_state = LS_DOWN.\n", | ||
1661 | qdev->ndev->name); | ||
1662 | if (curr_link_state == LS_UP) { | 1651 | if (curr_link_state == LS_UP) { |
1663 | if (netif_msg_link(qdev)) | 1652 | if (netif_msg_link(qdev)) |
1664 | printk(KERN_DEBUG PFX | 1653 | printk(KERN_INFO PFX "%s: Link is up.\n", |
1665 | "%s: curr_link_state = LS_UP.\n", | ||
1666 | qdev->ndev->name); | 1654 | qdev->ndev->name); |
1667 | if (ql_is_auto_neg_complete(qdev)) | 1655 | if (ql_is_auto_neg_complete(qdev)) |
1668 | ql_finish_auto_neg(qdev); | 1656 | ql_finish_auto_neg(qdev); |
@@ -1670,6 +1658,7 @@ static void ql_link_state_machine_work(struct work_struct *work) | |||
1670 | if (qdev->port_link_state == LS_UP) | 1658 | if (qdev->port_link_state == LS_UP) |
1671 | ql_link_down_detect_clear(qdev); | 1659 | ql_link_down_detect_clear(qdev); |
1672 | 1660 | ||
1661 | qdev->port_link_state = LS_UP; | ||
1673 | } | 1662 | } |
1674 | break; | 1663 | break; |
1675 | 1664 | ||
@@ -1678,12 +1667,14 @@ static void ql_link_state_machine_work(struct work_struct *work) | |||
1678 | * See if the link is currently down or went down and came | 1667 | * See if the link is currently down or went down and came |
1679 | * back up | 1668 | * back up |
1680 | */ | 1669 | */ |
1681 | if ((curr_link_state == LS_DOWN) || ql_link_down_detect(qdev)) { | 1670 | if (curr_link_state == LS_DOWN) { |
1682 | if (netif_msg_link(qdev)) | 1671 | if (netif_msg_link(qdev)) |
1683 | printk(KERN_INFO PFX "%s: Link is down.\n", | 1672 | printk(KERN_INFO PFX "%s: Link is down.\n", |
1684 | qdev->ndev->name); | 1673 | qdev->ndev->name); |
1685 | qdev->port_link_state = LS_DOWN; | 1674 | qdev->port_link_state = LS_DOWN; |
1686 | } | 1675 | } |
1676 | if (ql_link_down_detect(qdev)) | ||
1677 | qdev->port_link_state = LS_DOWN; | ||
1687 | break; | 1678 | break; |
1688 | } | 1679 | } |
1689 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | 1680 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); |
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c index 85f38a6b6a49..68a7f5414133 100644 --- a/drivers/net/ucc_geth_ethtool.c +++ b/drivers/net/ucc_geth_ethtool.c | |||
@@ -323,17 +323,17 @@ static void uec_get_ethtool_stats(struct net_device *netdev, | |||
323 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) { | 323 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) { |
324 | base = (u32 __iomem *)&ugeth->ug_regs->tx64; | 324 | base = (u32 __iomem *)&ugeth->ug_regs->tx64; |
325 | for (i = 0; i < UEC_HW_STATS_LEN; i++) | 325 | for (i = 0; i < UEC_HW_STATS_LEN; i++) |
326 | data[j++] = (u64)in_be32(&base[i]); | 326 | data[j++] = in_be32(&base[i]); |
327 | } | 327 | } |
328 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) { | 328 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) { |
329 | base = (u32 __iomem *)ugeth->p_tx_fw_statistics_pram; | 329 | base = (u32 __iomem *)ugeth->p_tx_fw_statistics_pram; |
330 | for (i = 0; i < UEC_TX_FW_STATS_LEN; i++) | 330 | for (i = 0; i < UEC_TX_FW_STATS_LEN; i++) |
331 | data[j++] = (u64)in_be32(&base[i]); | 331 | data[j++] = base ? in_be32(&base[i]) : 0; |
332 | } | 332 | } |
333 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) { | 333 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) { |
334 | base = (u32 __iomem *)ugeth->p_rx_fw_statistics_pram; | 334 | base = (u32 __iomem *)ugeth->p_rx_fw_statistics_pram; |
335 | for (i = 0; i < UEC_RX_FW_STATS_LEN; i++) | 335 | for (i = 0; i < UEC_RX_FW_STATS_LEN; i++) |
336 | data[j++] = (u64)in_be32(&base[i]); | 336 | data[j++] = base ? in_be32(&base[i]) : 0; |
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 3590ea5a902d..11cb3e504e1c 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -2296,7 +2296,7 @@ static void velocity_set_multi(struct net_device *dev) | |||
2296 | } | 2296 | } |
2297 | 2297 | ||
2298 | mac_set_cam_mask(regs, vptr->mCAMmask); | 2298 | mac_set_cam_mask(regs, vptr->mCAMmask); |
2299 | rx_mode = (RCR_AM | RCR_AB); | 2299 | rx_mode = RCR_AM | RCR_AB | RCR_AP; |
2300 | } | 2300 | } |
2301 | if (dev->mtu > 1500) | 2301 | if (dev->mtu > 1500) |
2302 | rx_mode |= RCR_AL; | 2302 | rx_mode |= RCR_AL; |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 331e5f1c2d8e..29aec6e10020 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -331,10 +331,11 @@ static inline void lockdep_on(void) | |||
331 | # define lock_set_subclass(l, s, i) do { } while (0) | 331 | # define lock_set_subclass(l, s, i) do { } while (0) |
332 | # define lockdep_init() do { } while (0) | 332 | # define lockdep_init() do { } while (0) |
333 | # define lockdep_info() do { } while (0) | 333 | # define lockdep_info() do { } while (0) |
334 | # define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0) | 334 | # define lockdep_init_map(lock, name, key, sub) \ |
335 | do { (void)(name); (void)(key); } while (0) | ||
335 | # define lockdep_set_class(lock, key) do { (void)(key); } while (0) | 336 | # define lockdep_set_class(lock, key) do { (void)(key); } while (0) |
336 | # define lockdep_set_class_and_name(lock, key, name) \ | 337 | # define lockdep_set_class_and_name(lock, key, name) \ |
337 | do { (void)(key); } while (0) | 338 | do { (void)(key); (void)(name); } while (0) |
338 | #define lockdep_set_class_and_subclass(lock, key, sub) \ | 339 | #define lockdep_set_class_and_subclass(lock, key, sub) \ |
339 | do { (void)(key); } while (0) | 340 | do { (void)(key); } while (0) |
340 | #define lockdep_set_subclass(lock, sub) do { } while (0) | 341 | #define lockdep_set_subclass(lock, sub) do { } while (0) |
diff --git a/include/net/sock.h b/include/net/sock.h index c04f9e18ea22..2f47107f6d0f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -815,7 +815,7 @@ static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) | |||
815 | */ | 815 | */ |
816 | #define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ | 816 | #define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ |
817 | do { \ | 817 | do { \ |
818 | sk->sk_lock.owned = 0; \ | 818 | sk->sk_lock.owned = 0; \ |
819 | init_waitqueue_head(&sk->sk_lock.wq); \ | 819 | init_waitqueue_head(&sk->sk_lock.wq); \ |
820 | spin_lock_init(&(sk)->sk_lock.slock); \ | 820 | spin_lock_init(&(sk)->sk_lock.slock); \ |
821 | debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ | 821 | debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 31f29d2989fd..4dfb6b4d4559 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -878,7 +878,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, | |||
878 | if (ifm->ifi_change) | 878 | if (ifm->ifi_change) |
879 | flags = (flags & ifm->ifi_change) | | 879 | flags = (flags & ifm->ifi_change) | |
880 | (dev->flags & ~ifm->ifi_change); | 880 | (dev->flags & ~ifm->ifi_change); |
881 | dev_change_flags(dev, flags); | 881 | err = dev_change_flags(dev, flags); |
882 | if (err < 0) | ||
883 | goto errout; | ||
882 | } | 884 | } |
883 | 885 | ||
884 | if (tb[IFLA_TXQLEN]) | 886 | if (tb[IFLA_TXQLEN]) |
diff --git a/net/core/scm.c b/net/core/scm.c index ab242cc1acca..b12303dd39d9 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -75,7 +75,6 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) | |||
75 | if (!fpl) | 75 | if (!fpl) |
76 | return -ENOMEM; | 76 | return -ENOMEM; |
77 | *fplp = fpl; | 77 | *fplp = fpl; |
78 | INIT_LIST_HEAD(&fpl->list); | ||
79 | fpl->count = 0; | 78 | fpl->count = 0; |
80 | } | 79 | } |
81 | fpp = &fpl->fp[fpl->count]; | 80 | fpp = &fpl->fp[fpl->count]; |
@@ -301,7 +300,6 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl) | |||
301 | 300 | ||
302 | new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL); | 301 | new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL); |
303 | if (new_fpl) { | 302 | if (new_fpl) { |
304 | INIT_LIST_HEAD(&new_fpl->list); | ||
305 | for (i=fpl->count-1; i>=0; i--) | 303 | for (i=fpl->count-1; i>=0; i--) |
306 | get_file(fpl->fp[i]); | 304 | get_file(fpl->fp[i]); |
307 | memcpy(new_fpl, fpl, sizeof(*fpl)); | 305 | memcpy(new_fpl, fpl, sizeof(*fpl)); |
diff --git a/net/core/sock.c b/net/core/sock.c index 5e2a3132a8c9..341e39456952 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -136,7 +136,6 @@ | |||
136 | static struct lock_class_key af_family_keys[AF_MAX]; | 136 | static struct lock_class_key af_family_keys[AF_MAX]; |
137 | static struct lock_class_key af_family_slock_keys[AF_MAX]; | 137 | static struct lock_class_key af_family_slock_keys[AF_MAX]; |
138 | 138 | ||
139 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
140 | /* | 139 | /* |
141 | * Make lock validator output more readable. (we pre-construct these | 140 | * Make lock validator output more readable. (we pre-construct these |
142 | * strings build-time, so that runtime initialization of socket | 141 | * strings build-time, so that runtime initialization of socket |
@@ -187,7 +186,6 @@ static const char *af_family_clock_key_strings[AF_MAX+1] = { | |||
187 | "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" , | 186 | "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" , |
188 | "clock-AF_MAX" | 187 | "clock-AF_MAX" |
189 | }; | 188 | }; |
190 | #endif | ||
191 | 189 | ||
192 | /* | 190 | /* |
193 | * sk_callback_lock locking rules are per-address-family, | 191 | * sk_callback_lock locking rules are per-address-family, |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 861978a4f1a8..cfb38ac9d698 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -209,9 +209,17 @@ static int ip_local_deliver_finish(struct sk_buff *skb) | |||
209 | 209 | ||
210 | hash = protocol & (MAX_INET_PROTOS - 1); | 210 | hash = protocol & (MAX_INET_PROTOS - 1); |
211 | ipprot = rcu_dereference(inet_protos[hash]); | 211 | ipprot = rcu_dereference(inet_protos[hash]); |
212 | if (ipprot != NULL && (net == &init_net || ipprot->netns_ok)) { | 212 | if (ipprot != NULL) { |
213 | int ret; | 213 | int ret; |
214 | 214 | ||
215 | if (!net_eq(net, &init_net) && !ipprot->netns_ok) { | ||
216 | if (net_ratelimit()) | ||
217 | printk("%s: proto %d isn't netns-ready\n", | ||
218 | __func__, protocol); | ||
219 | kfree_skb(skb); | ||
220 | goto out; | ||
221 | } | ||
222 | |||
215 | if (!ipprot->no_policy) { | 223 | if (!ipprot->no_policy) { |
216 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { | 224 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { |
217 | kfree_skb(skb); | 225 | kfree_skb(skb); |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 410046a8cc91..e44deb8d4df2 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -661,6 +661,11 @@ int datagram_send_ctl(struct net *net, | |||
661 | switch (rthdr->type) { | 661 | switch (rthdr->type) { |
662 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 662 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
663 | case IPV6_SRCRT_TYPE_2: | 663 | case IPV6_SRCRT_TYPE_2: |
664 | if (rthdr->hdrlen != 2 || | ||
665 | rthdr->segments_left != 1) { | ||
666 | err = -EINVAL; | ||
667 | goto exit_f; | ||
668 | } | ||
664 | break; | 669 | break; |
665 | #endif | 670 | #endif |
666 | default: | 671 | default: |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 4e5eac301f91..2aa294be0c79 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -366,11 +366,16 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, | |||
366 | } | 366 | } |
367 | 367 | ||
368 | /* routing header option needs extra check */ | 368 | /* routing header option needs extra check */ |
369 | retv = -EINVAL; | ||
369 | if (optname == IPV6_RTHDR && opt && opt->srcrt) { | 370 | if (optname == IPV6_RTHDR && opt && opt->srcrt) { |
370 | struct ipv6_rt_hdr *rthdr = opt->srcrt; | 371 | struct ipv6_rt_hdr *rthdr = opt->srcrt; |
371 | switch (rthdr->type) { | 372 | switch (rthdr->type) { |
372 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 373 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
373 | case IPV6_SRCRT_TYPE_2: | 374 | case IPV6_SRCRT_TYPE_2: |
375 | if (rthdr->hdrlen != 2 || | ||
376 | rthdr->segments_left != 1) | ||
377 | goto sticky_done; | ||
378 | |||
374 | break; | 379 | break; |
375 | #endif | 380 | #endif |
376 | default: | 381 | default: |
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index defeb7a0d502..7ab30f668b5a 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c | |||
@@ -144,8 +144,8 @@ static int pn_send(struct sk_buff *skb, struct net_device *dev, | |||
144 | struct phonethdr *ph; | 144 | struct phonethdr *ph; |
145 | int err; | 145 | int err; |
146 | 146 | ||
147 | if (skb->len + 2 > 0xffff) { | 147 | if (skb->len + 2 > 0xffff /* Phonet length field limit */ || |
148 | /* Phonet length field would overflow */ | 148 | skb->len + sizeof(struct phonethdr) > dev->mtu) { |
149 | err = -EMSGSIZE; | 149 | err = -EMSGSIZE; |
150 | goto drop; | 150 | goto drop; |
151 | } | 151 | } |