diff options
Diffstat (limited to 'drivers')
99 files changed, 1151 insertions, 309 deletions
diff --git a/drivers/net/ethernet/3com/3c509.c b/drivers/net/ethernet/3com/3c509.c index c53384d41c96..35df0b9e6848 100644 --- a/drivers/net/ethernet/3com/3c509.c +++ b/drivers/net/ethernet/3com/3c509.c | |||
@@ -749,7 +749,7 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
749 | 749 | ||
750 | spin_unlock_irqrestore(&lp->lock, flags); | 750 | spin_unlock_irqrestore(&lp->lock, flags); |
751 | 751 | ||
752 | dev_kfree_skb (skb); | 752 | dev_consume_skb_any (skb); |
753 | 753 | ||
754 | /* Clear the Tx status stack. */ | 754 | /* Clear the Tx status stack. */ |
755 | { | 755 | { |
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 238ccea965c8..61477b8e8d24 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c | |||
@@ -2086,7 +2086,7 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2086 | /* ... and the packet rounded to a doubleword. */ | 2086 | /* ... and the packet rounded to a doubleword. */ |
2087 | skb_tx_timestamp(skb); | 2087 | skb_tx_timestamp(skb); |
2088 | iowrite32_rep(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2); | 2088 | iowrite32_rep(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2); |
2089 | dev_kfree_skb (skb); | 2089 | dev_consume_skb_any (skb); |
2090 | if (ioread16(ioaddr + TxFree) > 1536) { | 2090 | if (ioread16(ioaddr + TxFree) > 1536) { |
2091 | netif_start_queue (dev); /* AKPM: redundant? */ | 2091 | netif_start_queue (dev); /* AKPM: redundant? */ |
2092 | } else { | 2092 | } else { |
diff --git a/drivers/net/ethernet/8390/lib8390.c b/drivers/net/ethernet/8390/lib8390.c index d2cd80444ade..599311f0e05c 100644 --- a/drivers/net/ethernet/8390/lib8390.c +++ b/drivers/net/ethernet/8390/lib8390.c | |||
@@ -404,7 +404,7 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb, | |||
404 | spin_unlock(&ei_local->page_lock); | 404 | spin_unlock(&ei_local->page_lock); |
405 | enable_irq_lockdep_irqrestore(dev->irq, &flags); | 405 | enable_irq_lockdep_irqrestore(dev->irq, &flags); |
406 | skb_tx_timestamp(skb); | 406 | skb_tx_timestamp(skb); |
407 | dev_kfree_skb(skb); | 407 | dev_consume_skb_any(skb); |
408 | dev->stats.tx_bytes += send_length; | 408 | dev->stats.tx_bytes += send_length; |
409 | 409 | ||
410 | return NETDEV_TX_OK; | 410 | return NETDEV_TX_OK; |
diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c index c0f68dcd1dc1..95779b6b7394 100644 --- a/drivers/net/ethernet/adi/bfin_mac.c +++ b/drivers/net/ethernet/adi/bfin_mac.c | |||
@@ -1040,6 +1040,7 @@ static struct ptp_clock_info bfin_ptp_caps = { | |||
1040 | .n_alarm = 0, | 1040 | .n_alarm = 0, |
1041 | .n_ext_ts = 0, | 1041 | .n_ext_ts = 0, |
1042 | .n_per_out = 0, | 1042 | .n_per_out = 0, |
1043 | .n_pins = 0, | ||
1043 | .pps = 0, | 1044 | .pps = 0, |
1044 | .adjfreq = bfin_ptp_adjfreq, | 1045 | .adjfreq = bfin_ptp_adjfreq, |
1045 | .adjtime = bfin_ptp_adjtime, | 1046 | .adjtime = bfin_ptp_adjtime, |
@@ -1086,7 +1087,7 @@ static inline void _tx_reclaim_skb(void) | |||
1086 | tx_list_head->desc_a.config &= ~DMAEN; | 1087 | tx_list_head->desc_a.config &= ~DMAEN; |
1087 | tx_list_head->status.status_word = 0; | 1088 | tx_list_head->status.status_word = 0; |
1088 | if (tx_list_head->skb) { | 1089 | if (tx_list_head->skb) { |
1089 | dev_kfree_skb(tx_list_head->skb); | 1090 | dev_consume_skb_any(tx_list_head->skb); |
1090 | tx_list_head->skb = NULL; | 1091 | tx_list_head->skb = NULL; |
1091 | } | 1092 | } |
1092 | tx_list_head = tx_list_head->next; | 1093 | tx_list_head = tx_list_head->next; |
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 511f6eecd58b..fcaeeb8a4929 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c | |||
@@ -476,7 +476,7 @@ static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
476 | spin_unlock_irqrestore(&db->lock, flags); | 476 | spin_unlock_irqrestore(&db->lock, flags); |
477 | 477 | ||
478 | /* free this SKB */ | 478 | /* free this SKB */ |
479 | dev_kfree_skb(skb); | 479 | dev_consume_skb_any(skb); |
480 | 480 | ||
481 | return NETDEV_TX_OK; | 481 | return NETDEV_TX_OK; |
482 | } | 482 | } |
diff --git a/drivers/net/ethernet/altera/altera_sgdma.c b/drivers/net/ethernet/altera/altera_sgdma.c index cbeee073a9ff..0ee96639ae44 100644 --- a/drivers/net/ethernet/altera/altera_sgdma.c +++ b/drivers/net/ethernet/altera/altera_sgdma.c | |||
@@ -84,8 +84,8 @@ int sgdma_initialize(struct altera_tse_private *priv) | |||
84 | return -EINVAL; | 84 | return -EINVAL; |
85 | } | 85 | } |
86 | 86 | ||
87 | priv->txdescphys = dma_map_single(priv->device, priv->rx_dma_desc, | 87 | priv->txdescphys = dma_map_single(priv->device, priv->tx_dma_desc, |
88 | priv->rxdescmem, DMA_TO_DEVICE); | 88 | priv->txdescmem, DMA_TO_DEVICE); |
89 | 89 | ||
90 | if (dma_mapping_error(priv->device, priv->txdescphys)) { | 90 | if (dma_mapping_error(priv->device, priv->txdescphys)) { |
91 | sgdma_uninitialize(priv); | 91 | sgdma_uninitialize(priv); |
@@ -340,7 +340,7 @@ static int sgdma_async_read(struct altera_tse_private *priv) | |||
340 | /* clear control and status */ | 340 | /* clear control and status */ |
341 | iowrite32(0, &csr->control); | 341 | iowrite32(0, &csr->control); |
342 | 342 | ||
343 | /* If statuc available, clear those bits */ | 343 | /* If status available, clear those bits */ |
344 | if (sts & 0xf) | 344 | if (sts & 0xf) |
345 | iowrite32(0xf, &csr->status); | 345 | iowrite32(0xf, &csr->status); |
346 | 346 | ||
@@ -390,9 +390,8 @@ sgdma_txphysaddr(struct altera_tse_private *priv, | |||
390 | struct sgdma_descrip *desc) | 390 | struct sgdma_descrip *desc) |
391 | { | 391 | { |
392 | dma_addr_t paddr = priv->txdescmem_busaddr; | 392 | dma_addr_t paddr = priv->txdescmem_busaddr; |
393 | dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc - | 393 | uintptr_t offs = (uintptr_t)desc - (uintptr_t)priv->tx_dma_desc; |
394 | (dma_addr_t)priv->tx_dma_desc); | 394 | return (dma_addr_t)((uintptr_t)paddr + offs); |
395 | return paddr + offs; | ||
396 | } | 395 | } |
397 | 396 | ||
398 | static dma_addr_t | 397 | static dma_addr_t |
@@ -400,9 +399,8 @@ sgdma_rxphysaddr(struct altera_tse_private *priv, | |||
400 | struct sgdma_descrip *desc) | 399 | struct sgdma_descrip *desc) |
401 | { | 400 | { |
402 | dma_addr_t paddr = priv->rxdescmem_busaddr; | 401 | dma_addr_t paddr = priv->rxdescmem_busaddr; |
403 | dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc - | 402 | uintptr_t offs = (uintptr_t)desc - (uintptr_t)priv->rx_dma_desc; |
404 | (dma_addr_t)priv->rx_dma_desc); | 403 | return (dma_addr_t)((uintptr_t)paddr + offs); |
405 | return paddr + offs; | ||
406 | } | 404 | } |
407 | 405 | ||
408 | #define list_remove_head(list, entry, type, member) \ | 406 | #define list_remove_head(list, entry, type, member) \ |
diff --git a/drivers/net/ethernet/altera/altera_tse_ethtool.c b/drivers/net/ethernet/altera/altera_tse_ethtool.c index 63ac5f4960e4..319ca74f5e74 100644 --- a/drivers/net/ethernet/altera/altera_tse_ethtool.c +++ b/drivers/net/ethernet/altera/altera_tse_ethtool.c | |||
@@ -181,6 +181,14 @@ static void tse_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
181 | u32 *tse_mac_regs = (u32 *)priv->mac_dev; | 181 | u32 *tse_mac_regs = (u32 *)priv->mac_dev; |
182 | u32 *buf = regbuf; | 182 | u32 *buf = regbuf; |
183 | 183 | ||
184 | /* Set version to a known value, so ethtool knows | ||
185 | * how to do any special formatting of this data. | ||
186 | * This version number will need to change if and | ||
187 | * when this register table is changed. | ||
188 | */ | ||
189 | |||
190 | regs->version = 1; | ||
191 | |||
184 | for (i = 0; i < TSE_NUM_REGS; i++) | 192 | for (i = 0; i < TSE_NUM_REGS; i++) |
185 | buf[i] = ioread32(&tse_mac_regs[i]); | 193 | buf[i] = ioread32(&tse_mac_regs[i]); |
186 | } | 194 | } |
diff --git a/drivers/net/ethernet/amd/7990.c b/drivers/net/ethernet/amd/7990.c index 18e542f7853d..98a10d555b79 100644 --- a/drivers/net/ethernet/amd/7990.c +++ b/drivers/net/ethernet/amd/7990.c | |||
@@ -578,7 +578,7 @@ int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
578 | outs++; | 578 | outs++; |
579 | /* Kick the lance: transmit now */ | 579 | /* Kick the lance: transmit now */ |
580 | WRITERDP(lp, LE_C0_INEA | LE_C0_TDMD); | 580 | WRITERDP(lp, LE_C0_INEA | LE_C0_TDMD); |
581 | dev_kfree_skb(skb); | 581 | dev_consume_skb_any(skb); |
582 | 582 | ||
583 | spin_lock_irqsave(&lp->devlock, flags); | 583 | spin_lock_irqsave(&lp->devlock, flags); |
584 | if (TX_BUFFS_AVAIL) | 584 | if (TX_BUFFS_AVAIL) |
diff --git a/drivers/net/ethernet/amd/am79c961a.c b/drivers/net/ethernet/amd/am79c961a.c index 9793767996a2..87e727b921dc 100644 --- a/drivers/net/ethernet/amd/am79c961a.c +++ b/drivers/net/ethernet/amd/am79c961a.c | |||
@@ -472,7 +472,7 @@ am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev) | |||
472 | if (am_readword(dev, priv->txhdr + (priv->txhead << 3) + 2) & TMD_OWN) | 472 | if (am_readword(dev, priv->txhdr + (priv->txhead << 3) + 2) & TMD_OWN) |
473 | netif_stop_queue(dev); | 473 | netif_stop_queue(dev); |
474 | 474 | ||
475 | dev_kfree_skb(skb); | 475 | dev_consume_skb_any(skb); |
476 | 476 | ||
477 | return NETDEV_TX_OK; | 477 | return NETDEV_TX_OK; |
478 | } | 478 | } |
diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c index 2ae00ed83afa..e7cc9174e364 100644 --- a/drivers/net/ethernet/amd/pcnet32.c +++ b/drivers/net/ethernet/amd/pcnet32.c | |||
@@ -2448,7 +2448,7 @@ static netdev_tx_t pcnet32_start_xmit(struct sk_buff *skb, | |||
2448 | lp->tx_dma_addr[entry] = | 2448 | lp->tx_dma_addr[entry] = |
2449 | pci_map_single(lp->pci_dev, skb->data, skb->len, PCI_DMA_TODEVICE); | 2449 | pci_map_single(lp->pci_dev, skb->data, skb->len, PCI_DMA_TODEVICE); |
2450 | if (pci_dma_mapping_error(lp->pci_dev, lp->tx_dma_addr[entry])) { | 2450 | if (pci_dma_mapping_error(lp->pci_dev, lp->tx_dma_addr[entry])) { |
2451 | dev_kfree_skb(skb); | 2451 | dev_kfree_skb_any(skb); |
2452 | dev->stats.tx_dropped++; | 2452 | dev->stats.tx_dropped++; |
2453 | goto drop_packet; | 2453 | goto drop_packet; |
2454 | } | 2454 | } |
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 2e45f6ec1bf0..238356108e65 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c | |||
@@ -1097,7 +1097,7 @@ static netdev_tx_t alx_start_xmit(struct sk_buff *skb, | |||
1097 | return NETDEV_TX_OK; | 1097 | return NETDEV_TX_OK; |
1098 | 1098 | ||
1099 | drop: | 1099 | drop: |
1100 | dev_kfree_skb(skb); | 1100 | dev_kfree_skb_any(skb); |
1101 | return NETDEV_TX_OK; | 1101 | return NETDEV_TX_OK; |
1102 | } | 1102 | } |
1103 | 1103 | ||
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 4d3258dd0a88..31f262302128 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
@@ -832,7 +832,7 @@ static int atl1c_sw_init(struct atl1c_adapter *adapter) | |||
832 | } | 832 | } |
833 | 833 | ||
834 | static inline void atl1c_clean_buffer(struct pci_dev *pdev, | 834 | static inline void atl1c_clean_buffer(struct pci_dev *pdev, |
835 | struct atl1c_buffer *buffer_info, int in_irq) | 835 | struct atl1c_buffer *buffer_info) |
836 | { | 836 | { |
837 | u16 pci_driection; | 837 | u16 pci_driection; |
838 | if (buffer_info->flags & ATL1C_BUFFER_FREE) | 838 | if (buffer_info->flags & ATL1C_BUFFER_FREE) |
@@ -850,12 +850,8 @@ static inline void atl1c_clean_buffer(struct pci_dev *pdev, | |||
850 | pci_unmap_page(pdev, buffer_info->dma, | 850 | pci_unmap_page(pdev, buffer_info->dma, |
851 | buffer_info->length, pci_driection); | 851 | buffer_info->length, pci_driection); |
852 | } | 852 | } |
853 | if (buffer_info->skb) { | 853 | if (buffer_info->skb) |
854 | if (in_irq) | 854 | dev_consume_skb_any(buffer_info->skb); |
855 | dev_kfree_skb_irq(buffer_info->skb); | ||
856 | else | ||
857 | dev_kfree_skb(buffer_info->skb); | ||
858 | } | ||
859 | buffer_info->dma = 0; | 855 | buffer_info->dma = 0; |
860 | buffer_info->skb = NULL; | 856 | buffer_info->skb = NULL; |
861 | ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_FREE); | 857 | ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_FREE); |
@@ -875,7 +871,7 @@ static void atl1c_clean_tx_ring(struct atl1c_adapter *adapter, | |||
875 | ring_count = tpd_ring->count; | 871 | ring_count = tpd_ring->count; |
876 | for (index = 0; index < ring_count; index++) { | 872 | for (index = 0; index < ring_count; index++) { |
877 | buffer_info = &tpd_ring->buffer_info[index]; | 873 | buffer_info = &tpd_ring->buffer_info[index]; |
878 | atl1c_clean_buffer(pdev, buffer_info, 0); | 874 | atl1c_clean_buffer(pdev, buffer_info); |
879 | } | 875 | } |
880 | 876 | ||
881 | /* Zero out Tx-buffers */ | 877 | /* Zero out Tx-buffers */ |
@@ -899,7 +895,7 @@ static void atl1c_clean_rx_ring(struct atl1c_adapter *adapter) | |||
899 | 895 | ||
900 | for (j = 0; j < rfd_ring->count; j++) { | 896 | for (j = 0; j < rfd_ring->count; j++) { |
901 | buffer_info = &rfd_ring->buffer_info[j]; | 897 | buffer_info = &rfd_ring->buffer_info[j]; |
902 | atl1c_clean_buffer(pdev, buffer_info, 0); | 898 | atl1c_clean_buffer(pdev, buffer_info); |
903 | } | 899 | } |
904 | /* zero out the descriptor ring */ | 900 | /* zero out the descriptor ring */ |
905 | memset(rfd_ring->desc, 0, rfd_ring->size); | 901 | memset(rfd_ring->desc, 0, rfd_ring->size); |
@@ -1562,7 +1558,7 @@ static bool atl1c_clean_tx_irq(struct atl1c_adapter *adapter, | |||
1562 | 1558 | ||
1563 | while (next_to_clean != hw_next_to_clean) { | 1559 | while (next_to_clean != hw_next_to_clean) { |
1564 | buffer_info = &tpd_ring->buffer_info[next_to_clean]; | 1560 | buffer_info = &tpd_ring->buffer_info[next_to_clean]; |
1565 | atl1c_clean_buffer(pdev, buffer_info, 1); | 1561 | atl1c_clean_buffer(pdev, buffer_info); |
1566 | if (++next_to_clean == tpd_ring->count) | 1562 | if (++next_to_clean == tpd_ring->count) |
1567 | next_to_clean = 0; | 1563 | next_to_clean = 0; |
1568 | atomic_set(&tpd_ring->next_to_clean, next_to_clean); | 1564 | atomic_set(&tpd_ring->next_to_clean, next_to_clean); |
@@ -2085,7 +2081,7 @@ static void atl1c_tx_rollback(struct atl1c_adapter *adpt, | |||
2085 | while (index != tpd_ring->next_to_use) { | 2081 | while (index != tpd_ring->next_to_use) { |
2086 | tpd = ATL1C_TPD_DESC(tpd_ring, index); | 2082 | tpd = ATL1C_TPD_DESC(tpd_ring, index); |
2087 | buffer_info = &tpd_ring->buffer_info[index]; | 2083 | buffer_info = &tpd_ring->buffer_info[index]; |
2088 | atl1c_clean_buffer(adpt->pdev, buffer_info, 0); | 2084 | atl1c_clean_buffer(adpt->pdev, buffer_info); |
2089 | memset(tpd, 0, sizeof(struct atl1c_tpd_desc)); | 2085 | memset(tpd, 0, sizeof(struct atl1c_tpd_desc)); |
2090 | if (++index == tpd_ring->count) | 2086 | if (++index == tpd_ring->count) |
2091 | index = 0; | 2087 | index = 0; |
@@ -2258,7 +2254,7 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb, | |||
2258 | /* roll back tpd/buffer */ | 2254 | /* roll back tpd/buffer */ |
2259 | atl1c_tx_rollback(adapter, tpd, type); | 2255 | atl1c_tx_rollback(adapter, tpd, type); |
2260 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2256 | spin_unlock_irqrestore(&adapter->tx_lock, flags); |
2261 | dev_kfree_skb(skb); | 2257 | dev_kfree_skb_any(skb); |
2262 | } else { | 2258 | } else { |
2263 | atl1c_tx_queue(adapter, skb, tpd, type); | 2259 | atl1c_tx_queue(adapter, skb, tpd, type); |
2264 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2260 | spin_unlock_irqrestore(&adapter->tx_lock, flags); |
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index 265ce1b752ed..78befb522a52 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c | |||
@@ -55,6 +55,7 @@ static const char atl2_driver_name[] = "atl2"; | |||
55 | static const char atl2_driver_string[] = "Atheros(R) L2 Ethernet Driver"; | 55 | static const char atl2_driver_string[] = "Atheros(R) L2 Ethernet Driver"; |
56 | static const char atl2_copyright[] = "Copyright (c) 2007 Atheros Corporation."; | 56 | static const char atl2_copyright[] = "Copyright (c) 2007 Atheros Corporation."; |
57 | static const char atl2_driver_version[] = ATL2_DRV_VERSION; | 57 | static const char atl2_driver_version[] = ATL2_DRV_VERSION; |
58 | static const struct ethtool_ops atl2_ethtool_ops; | ||
58 | 59 | ||
59 | MODULE_AUTHOR("Atheros Corporation <xiong.huang@atheros.com>, Chris Snook <csnook@redhat.com>"); | 60 | MODULE_AUTHOR("Atheros Corporation <xiong.huang@atheros.com>, Chris Snook <csnook@redhat.com>"); |
60 | MODULE_DESCRIPTION("Atheros Fast Ethernet Network Driver"); | 61 | MODULE_DESCRIPTION("Atheros Fast Ethernet Network Driver"); |
@@ -71,8 +72,6 @@ static DEFINE_PCI_DEVICE_TABLE(atl2_pci_tbl) = { | |||
71 | }; | 72 | }; |
72 | MODULE_DEVICE_TABLE(pci, atl2_pci_tbl); | 73 | MODULE_DEVICE_TABLE(pci, atl2_pci_tbl); |
73 | 74 | ||
74 | static void atl2_set_ethtool_ops(struct net_device *netdev); | ||
75 | |||
76 | static void atl2_check_options(struct atl2_adapter *adapter); | 75 | static void atl2_check_options(struct atl2_adapter *adapter); |
77 | 76 | ||
78 | /** | 77 | /** |
@@ -1397,7 +1396,7 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1397 | atl2_setup_pcicmd(pdev); | 1396 | atl2_setup_pcicmd(pdev); |
1398 | 1397 | ||
1399 | netdev->netdev_ops = &atl2_netdev_ops; | 1398 | netdev->netdev_ops = &atl2_netdev_ops; |
1400 | atl2_set_ethtool_ops(netdev); | 1399 | SET_ETHTOOL_OPS(netdev, &atl2_ethtool_ops); |
1401 | netdev->watchdog_timeo = 5 * HZ; | 1400 | netdev->watchdog_timeo = 5 * HZ; |
1402 | strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); | 1401 | strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); |
1403 | 1402 | ||
@@ -2105,11 +2104,6 @@ static const struct ethtool_ops atl2_ethtool_ops = { | |||
2105 | .set_eeprom = atl2_set_eeprom, | 2104 | .set_eeprom = atl2_set_eeprom, |
2106 | }; | 2105 | }; |
2107 | 2106 | ||
2108 | static void atl2_set_ethtool_ops(struct net_device *netdev) | ||
2109 | { | ||
2110 | SET_ETHTOOL_OPS(netdev, &atl2_ethtool_ops); | ||
2111 | } | ||
2112 | |||
2113 | #define LBYTESWAP(a) ((((a) & 0x00ff00ff) << 8) | \ | 2107 | #define LBYTESWAP(a) ((((a) & 0x00ff00ff) << 8) | \ |
2114 | (((a) & 0xff00ff00) >> 8)) | 2108 | (((a) & 0xff00ff00) >> 8)) |
2115 | #define LONGSWAP(a) ((LBYTESWAP(a) << 16) | (LBYTESWAP(a) >> 16)) | 2109 | #define LONGSWAP(a) ((LBYTESWAP(a) << 16) | (LBYTESWAP(a) >> 16)) |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index bbbd2a4bc161..37422af9ef13 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -6322,6 +6322,7 @@ static const struct ptp_clock_info tg3_ptp_caps = { | |||
6322 | .n_alarm = 0, | 6322 | .n_alarm = 0, |
6323 | .n_ext_ts = 0, | 6323 | .n_ext_ts = 0, |
6324 | .n_per_out = 1, | 6324 | .n_per_out = 1, |
6325 | .n_pins = 0, | ||
6325 | .pps = 0, | 6326 | .pps = 0, |
6326 | .adjfreq = tg3_ptp_adjfreq, | 6327 | .adjfreq = tg3_ptp_adjfreq, |
6327 | .adjtime = tg3_ptp_adjtime, | 6328 | .adjtime = tg3_ptp_adjtime, |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index cb7625366ec2..a881e982a084 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -2946,17 +2946,17 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
2946 | /* Sanity checks for the skb */ | 2946 | /* Sanity checks for the skb */ |
2947 | 2947 | ||
2948 | if (unlikely(skb->len <= ETH_HLEN)) { | 2948 | if (unlikely(skb->len <= ETH_HLEN)) { |
2949 | dev_kfree_skb(skb); | 2949 | dev_kfree_skb_any(skb); |
2950 | BNAD_UPDATE_CTR(bnad, tx_skb_too_short); | 2950 | BNAD_UPDATE_CTR(bnad, tx_skb_too_short); |
2951 | return NETDEV_TX_OK; | 2951 | return NETDEV_TX_OK; |
2952 | } | 2952 | } |
2953 | if (unlikely(len > BFI_TX_MAX_DATA_PER_VECTOR)) { | 2953 | if (unlikely(len > BFI_TX_MAX_DATA_PER_VECTOR)) { |
2954 | dev_kfree_skb(skb); | 2954 | dev_kfree_skb_any(skb); |
2955 | BNAD_UPDATE_CTR(bnad, tx_skb_headlen_zero); | 2955 | BNAD_UPDATE_CTR(bnad, tx_skb_headlen_zero); |
2956 | return NETDEV_TX_OK; | 2956 | return NETDEV_TX_OK; |
2957 | } | 2957 | } |
2958 | if (unlikely(len == 0)) { | 2958 | if (unlikely(len == 0)) { |
2959 | dev_kfree_skb(skb); | 2959 | dev_kfree_skb_any(skb); |
2960 | BNAD_UPDATE_CTR(bnad, tx_skb_headlen_zero); | 2960 | BNAD_UPDATE_CTR(bnad, tx_skb_headlen_zero); |
2961 | return NETDEV_TX_OK; | 2961 | return NETDEV_TX_OK; |
2962 | } | 2962 | } |
@@ -2968,7 +2968,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
2968 | * and the netif_tx_stop_all_queues() call. | 2968 | * and the netif_tx_stop_all_queues() call. |
2969 | */ | 2969 | */ |
2970 | if (unlikely(!tcb || !test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) { | 2970 | if (unlikely(!tcb || !test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))) { |
2971 | dev_kfree_skb(skb); | 2971 | dev_kfree_skb_any(skb); |
2972 | BNAD_UPDATE_CTR(bnad, tx_skb_stopping); | 2972 | BNAD_UPDATE_CTR(bnad, tx_skb_stopping); |
2973 | return NETDEV_TX_OK; | 2973 | return NETDEV_TX_OK; |
2974 | } | 2974 | } |
@@ -2981,7 +2981,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
2981 | wis = BNA_TXQ_WI_NEEDED(vectors); /* 4 vectors per work item */ | 2981 | wis = BNA_TXQ_WI_NEEDED(vectors); /* 4 vectors per work item */ |
2982 | 2982 | ||
2983 | if (unlikely(vectors > BFI_TX_MAX_VECTORS_PER_PKT)) { | 2983 | if (unlikely(vectors > BFI_TX_MAX_VECTORS_PER_PKT)) { |
2984 | dev_kfree_skb(skb); | 2984 | dev_kfree_skb_any(skb); |
2985 | BNAD_UPDATE_CTR(bnad, tx_skb_max_vectors); | 2985 | BNAD_UPDATE_CTR(bnad, tx_skb_max_vectors); |
2986 | return NETDEV_TX_OK; | 2986 | return NETDEV_TX_OK; |
2987 | } | 2987 | } |
@@ -3021,7 +3021,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
3021 | 3021 | ||
3022 | /* Program the opcode, flags, frame_len, num_vectors in WI */ | 3022 | /* Program the opcode, flags, frame_len, num_vectors in WI */ |
3023 | if (bnad_txq_wi_prepare(bnad, tcb, skb, txqent)) { | 3023 | if (bnad_txq_wi_prepare(bnad, tcb, skb, txqent)) { |
3024 | dev_kfree_skb(skb); | 3024 | dev_kfree_skb_any(skb); |
3025 | return NETDEV_TX_OK; | 3025 | return NETDEV_TX_OK; |
3026 | } | 3026 | } |
3027 | txqent->hdr.wi.reserved = 0; | 3027 | txqent->hdr.wi.reserved = 0; |
@@ -3047,7 +3047,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
3047 | /* Undo the changes starting at tcb->producer_index */ | 3047 | /* Undo the changes starting at tcb->producer_index */ |
3048 | bnad_tx_buff_unmap(bnad, unmap_q, q_depth, | 3048 | bnad_tx_buff_unmap(bnad, unmap_q, q_depth, |
3049 | tcb->producer_index); | 3049 | tcb->producer_index); |
3050 | dev_kfree_skb(skb); | 3050 | dev_kfree_skb_any(skb); |
3051 | BNAD_UPDATE_CTR(bnad, tx_skb_frag_zero); | 3051 | BNAD_UPDATE_CTR(bnad, tx_skb_frag_zero); |
3052 | return NETDEV_TX_OK; | 3052 | return NETDEV_TX_OK; |
3053 | } | 3053 | } |
@@ -3076,7 +3076,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
3076 | if (unlikely(len != skb->len)) { | 3076 | if (unlikely(len != skb->len)) { |
3077 | /* Undo the changes starting at tcb->producer_index */ | 3077 | /* Undo the changes starting at tcb->producer_index */ |
3078 | bnad_tx_buff_unmap(bnad, unmap_q, q_depth, tcb->producer_index); | 3078 | bnad_tx_buff_unmap(bnad, unmap_q, q_depth, tcb->producer_index); |
3079 | dev_kfree_skb(skb); | 3079 | dev_kfree_skb_any(skb); |
3080 | BNAD_UPDATE_CTR(bnad, tx_skb_len_mismatch); | 3080 | BNAD_UPDATE_CTR(bnad, tx_skb_len_mismatch); |
3081 | return NETDEV_TX_OK; | 3081 | return NETDEV_TX_OK; |
3082 | } | 3082 | } |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index d0c38e01e99f..6116887d2880 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -1045,7 +1045,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1045 | mapping = dma_map_single(&bp->pdev->dev, skb->data, | 1045 | mapping = dma_map_single(&bp->pdev->dev, skb->data, |
1046 | len, DMA_TO_DEVICE); | 1046 | len, DMA_TO_DEVICE); |
1047 | if (dma_mapping_error(&bp->pdev->dev, mapping)) { | 1047 | if (dma_mapping_error(&bp->pdev->dev, mapping)) { |
1048 | kfree_skb(skb); | 1048 | dev_kfree_skb_any(skb); |
1049 | goto unlock; | 1049 | goto unlock; |
1050 | } | 1050 | } |
1051 | 1051 | ||
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index d2a183c3a6ce..521dfea44b83 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c | |||
@@ -897,7 +897,7 @@ static void xgmac_tx_complete(struct xgmac_priv *priv) | |||
897 | /* Check tx error on the last segment */ | 897 | /* Check tx error on the last segment */ |
898 | if (desc_get_tx_ls(p)) { | 898 | if (desc_get_tx_ls(p)) { |
899 | desc_get_tx_status(priv, p); | 899 | desc_get_tx_status(priv, p); |
900 | dev_kfree_skb(skb); | 900 | dev_consume_skb_any(skb); |
901 | } | 901 | } |
902 | 902 | ||
903 | priv->tx_skbuff[entry] = NULL; | 903 | priv->tx_skbuff[entry] = NULL; |
@@ -1105,7 +1105,7 @@ static netdev_tx_t xgmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1105 | len = skb_headlen(skb); | 1105 | len = skb_headlen(skb); |
1106 | paddr = dma_map_single(priv->device, skb->data, len, DMA_TO_DEVICE); | 1106 | paddr = dma_map_single(priv->device, skb->data, len, DMA_TO_DEVICE); |
1107 | if (dma_mapping_error(priv->device, paddr)) { | 1107 | if (dma_mapping_error(priv->device, paddr)) { |
1108 | dev_kfree_skb(skb); | 1108 | dev_kfree_skb_any(skb); |
1109 | return NETDEV_TX_OK; | 1109 | return NETDEV_TX_OK; |
1110 | } | 1110 | } |
1111 | priv->tx_skbuff[entry] = skb; | 1111 | priv->tx_skbuff[entry] = skb; |
@@ -1169,7 +1169,7 @@ dma_err: | |||
1169 | desc = first; | 1169 | desc = first; |
1170 | dma_unmap_single(priv->device, desc_get_buf_addr(desc), | 1170 | dma_unmap_single(priv->device, desc_get_buf_addr(desc), |
1171 | desc_get_buf_len(desc), DMA_TO_DEVICE); | 1171 | desc_get_buf_len(desc), DMA_TO_DEVICE); |
1172 | dev_kfree_skb(skb); | 1172 | dev_kfree_skb_any(skb); |
1173 | return NETDEV_TX_OK; | 1173 | return NETDEV_TX_OK; |
1174 | } | 1174 | } |
1175 | 1175 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c index 632b318eb38a..8b069f96e920 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c | |||
@@ -298,7 +298,7 @@ static void free_tx_desc(struct adapter *adapter, struct sge_txq *q, | |||
298 | if (need_unmap) | 298 | if (need_unmap) |
299 | unmap_skb(d->skb, q, cidx, pdev); | 299 | unmap_skb(d->skb, q, cidx, pdev); |
300 | if (d->eop) { | 300 | if (d->eop) { |
301 | kfree_skb(d->skb); | 301 | dev_consume_skb_any(d->skb); |
302 | d->skb = NULL; | 302 | d->skb = NULL; |
303 | } | 303 | } |
304 | } | 304 | } |
@@ -1188,7 +1188,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
1188 | cpl->wr.wr_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(gen) | | 1188 | cpl->wr.wr_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(gen) | |
1189 | V_WR_TID(q->token)); | 1189 | V_WR_TID(q->token)); |
1190 | wr_gen2(d, gen); | 1190 | wr_gen2(d, gen); |
1191 | kfree_skb(skb); | 1191 | dev_consume_skb_any(skb); |
1192 | return; | 1192 | return; |
1193 | } | 1193 | } |
1194 | 1194 | ||
@@ -1233,7 +1233,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1233 | * anything shorter than an Ethernet header. | 1233 | * anything shorter than an Ethernet header. |
1234 | */ | 1234 | */ |
1235 | if (unlikely(skb->len < ETH_HLEN)) { | 1235 | if (unlikely(skb->len < ETH_HLEN)) { |
1236 | dev_kfree_skb(skb); | 1236 | dev_kfree_skb_any(skb); |
1237 | return NETDEV_TX_OK; | 1237 | return NETDEV_TX_OK; |
1238 | } | 1238 | } |
1239 | 1239 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index d4db382ff8c7..ca95cf2954eb 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c | |||
@@ -383,7 +383,7 @@ static void free_tx_desc(struct adapter *adap, struct sge_txq *q, | |||
383 | if (d->skb) { /* an SGL is present */ | 383 | if (d->skb) { /* an SGL is present */ |
384 | if (unmap) | 384 | if (unmap) |
385 | unmap_sgl(dev, d->skb, d->sgl, q); | 385 | unmap_sgl(dev, d->skb, d->sgl, q); |
386 | kfree_skb(d->skb); | 386 | dev_consume_skb_any(d->skb); |
387 | d->skb = NULL; | 387 | d->skb = NULL; |
388 | } | 388 | } |
389 | ++d; | 389 | ++d; |
@@ -1009,7 +1009,7 @@ netdev_tx_t t4_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1009 | * anything shorter than an Ethernet header. | 1009 | * anything shorter than an Ethernet header. |
1010 | */ | 1010 | */ |
1011 | if (unlikely(skb->len < ETH_HLEN)) { | 1011 | if (unlikely(skb->len < ETH_HLEN)) { |
1012 | out_free: dev_kfree_skb(skb); | 1012 | out_free: dev_kfree_skb_any(skb); |
1013 | return NETDEV_TX_OK; | 1013 | return NETDEV_TX_OK; |
1014 | } | 1014 | } |
1015 | 1015 | ||
@@ -1104,7 +1104,7 @@ out_free: dev_kfree_skb(skb); | |||
1104 | 1104 | ||
1105 | if (immediate) { | 1105 | if (immediate) { |
1106 | inline_tx_skb(skb, &q->q, cpl + 1); | 1106 | inline_tx_skb(skb, &q->q, cpl + 1); |
1107 | dev_kfree_skb(skb); | 1107 | dev_consume_skb_any(skb); |
1108 | } else { | 1108 | } else { |
1109 | int last_desc; | 1109 | int last_desc; |
1110 | 1110 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index 0a89963c48ce..9cfa4b4bb089 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c | |||
@@ -401,7 +401,7 @@ static void free_tx_desc(struct adapter *adapter, struct sge_txq *tq, | |||
401 | if (sdesc->skb) { | 401 | if (sdesc->skb) { |
402 | if (need_unmap) | 402 | if (need_unmap) |
403 | unmap_sgl(dev, sdesc->skb, sdesc->sgl, tq); | 403 | unmap_sgl(dev, sdesc->skb, sdesc->sgl, tq); |
404 | kfree_skb(sdesc->skb); | 404 | dev_consume_skb_any(sdesc->skb); |
405 | sdesc->skb = NULL; | 405 | sdesc->skb = NULL; |
406 | } | 406 | } |
407 | 407 | ||
@@ -1275,7 +1275,7 @@ int t4vf_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1275 | * need it any longer. | 1275 | * need it any longer. |
1276 | */ | 1276 | */ |
1277 | inline_tx_skb(skb, &txq->q, cpl + 1); | 1277 | inline_tx_skb(skb, &txq->q, cpl + 1); |
1278 | dev_kfree_skb(skb); | 1278 | dev_consume_skb_any(skb); |
1279 | } else { | 1279 | } else { |
1280 | /* | 1280 | /* |
1281 | * Write the skb's Scatter/Gather list into the TX Packet CPL | 1281 | * Write the skb's Scatter/Gather list into the TX Packet CPL |
@@ -1354,7 +1354,7 @@ out_free: | |||
1354 | * An error of some sort happened. Free the TX skb and tell the | 1354 | * An error of some sort happened. Free the TX skb and tell the |
1355 | * OS that we've "dealt" with the packet ... | 1355 | * OS that we've "dealt" with the packet ... |
1356 | */ | 1356 | */ |
1357 | dev_kfree_skb(skb); | 1357 | dev_kfree_skb_any(skb); |
1358 | return NETDEV_TX_OK; | 1358 | return NETDEV_TX_OK; |
1359 | } | 1359 | } |
1360 | 1360 | ||
diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c index 19f642a45f40..fe84fbabc0d4 100644 --- a/drivers/net/ethernet/cirrus/cs89x0.c +++ b/drivers/net/ethernet/cirrus/cs89x0.c | |||
@@ -1174,7 +1174,7 @@ static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1174 | writewords(lp, TX_FRAME_PORT, skb->data, (skb->len + 1) >> 1); | 1174 | writewords(lp, TX_FRAME_PORT, skb->data, (skb->len + 1) >> 1); |
1175 | spin_unlock_irqrestore(&lp->lock, flags); | 1175 | spin_unlock_irqrestore(&lp->lock, flags); |
1176 | dev->stats.tx_bytes += skb->len; | 1176 | dev->stats.tx_bytes += skb->len; |
1177 | dev_kfree_skb(skb); | 1177 | dev_consume_skb_any(skb); |
1178 | 1178 | ||
1179 | /* We DO NOT call netif_wake_queue() here. | 1179 | /* We DO NOT call netif_wake_queue() here. |
1180 | * We also DO NOT call netif_start_queue(). | 1180 | * We also DO NOT call netif_start_queue(). |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 4c35fc8fad99..2945718ce806 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -521,7 +521,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb, | |||
521 | unsigned int txq_map; | 521 | unsigned int txq_map; |
522 | 522 | ||
523 | if (skb->len <= 0) { | 523 | if (skb->len <= 0) { |
524 | dev_kfree_skb(skb); | 524 | dev_kfree_skb_any(skb); |
525 | return NETDEV_TX_OK; | 525 | return NETDEV_TX_OK; |
526 | } | 526 | } |
527 | 527 | ||
@@ -536,7 +536,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb, | |||
536 | if (skb_shinfo(skb)->gso_size == 0 && | 536 | if (skb_shinfo(skb)->gso_size == 0 && |
537 | skb_shinfo(skb)->nr_frags + 1 > ENIC_NON_TSO_MAX_DESC && | 537 | skb_shinfo(skb)->nr_frags + 1 > ENIC_NON_TSO_MAX_DESC && |
538 | skb_linearize(skb)) { | 538 | skb_linearize(skb)) { |
539 | dev_kfree_skb(skb); | 539 | dev_kfree_skb_any(skb); |
540 | return NETDEV_TX_OK; | 540 | return NETDEV_TX_OK; |
541 | } | 541 | } |
542 | 542 | ||
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index a1a2b4028a5c..8c4b93be333b 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
@@ -1033,7 +1033,7 @@ dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1033 | spin_unlock_irqrestore(&db->lock, flags); | 1033 | spin_unlock_irqrestore(&db->lock, flags); |
1034 | 1034 | ||
1035 | /* free this SKB */ | 1035 | /* free this SKB */ |
1036 | dev_kfree_skb(skb); | 1036 | dev_consume_skb_any(skb); |
1037 | 1037 | ||
1038 | return NETDEV_TX_OK; | 1038 | return NETDEV_TX_OK; |
1039 | } | 1039 | } |
diff --git a/drivers/net/ethernet/dec/tulip/dmfe.c b/drivers/net/ethernet/dec/tulip/dmfe.c index 5ad9e3e3c0b8..53f0c618045c 100644 --- a/drivers/net/ethernet/dec/tulip/dmfe.c +++ b/drivers/net/ethernet/dec/tulip/dmfe.c | |||
@@ -696,7 +696,7 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, | |||
696 | /* Too large packet check */ | 696 | /* Too large packet check */ |
697 | if (skb->len > MAX_PACKET_SIZE) { | 697 | if (skb->len > MAX_PACKET_SIZE) { |
698 | pr_err("big packet = %d\n", (u16)skb->len); | 698 | pr_err("big packet = %d\n", (u16)skb->len); |
699 | dev_kfree_skb(skb); | 699 | dev_kfree_skb_any(skb); |
700 | return NETDEV_TX_OK; | 700 | return NETDEV_TX_OK; |
701 | } | 701 | } |
702 | 702 | ||
@@ -743,7 +743,7 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, | |||
743 | dw32(DCR7, db->cr7_data); | 743 | dw32(DCR7, db->cr7_data); |
744 | 744 | ||
745 | /* free this SKB */ | 745 | /* free this SKB */ |
746 | dev_kfree_skb(skb); | 746 | dev_consume_skb_any(skb); |
747 | 747 | ||
748 | return NETDEV_TX_OK; | 748 | return NETDEV_TX_OK; |
749 | } | 749 | } |
diff --git a/drivers/net/ethernet/dec/tulip/uli526x.c b/drivers/net/ethernet/dec/tulip/uli526x.c index aa4ee385091f..aa801a6af7b9 100644 --- a/drivers/net/ethernet/dec/tulip/uli526x.c +++ b/drivers/net/ethernet/dec/tulip/uli526x.c | |||
@@ -607,7 +607,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb, | |||
607 | /* Too large packet check */ | 607 | /* Too large packet check */ |
608 | if (skb->len > MAX_PACKET_SIZE) { | 608 | if (skb->len > MAX_PACKET_SIZE) { |
609 | netdev_err(dev, "big packet = %d\n", (u16)skb->len); | 609 | netdev_err(dev, "big packet = %d\n", (u16)skb->len); |
610 | dev_kfree_skb(skb); | 610 | dev_kfree_skb_any(skb); |
611 | return NETDEV_TX_OK; | 611 | return NETDEV_TX_OK; |
612 | } | 612 | } |
613 | 613 | ||
@@ -648,7 +648,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb, | |||
648 | uw32(DCR7, db->cr7_data); | 648 | uw32(DCR7, db->cr7_data); |
649 | 649 | ||
650 | /* free this SKB */ | 650 | /* free this SKB */ |
651 | dev_kfree_skb(skb); | 651 | dev_consume_skb_any(skb); |
652 | 652 | ||
653 | return NETDEV_TX_OK; | 653 | return NETDEV_TX_OK; |
654 | } | 654 | } |
diff --git a/drivers/net/ethernet/dlink/sundance.c b/drivers/net/ethernet/dlink/sundance.c index 113cd799a131..d9e5ca0d48c1 100644 --- a/drivers/net/ethernet/dlink/sundance.c +++ b/drivers/net/ethernet/dlink/sundance.c | |||
@@ -1137,7 +1137,7 @@ start_tx (struct sk_buff *skb, struct net_device *dev) | |||
1137 | return NETDEV_TX_OK; | 1137 | return NETDEV_TX_OK; |
1138 | 1138 | ||
1139 | drop_frame: | 1139 | drop_frame: |
1140 | dev_kfree_skb(skb); | 1140 | dev_kfree_skb_any(skb); |
1141 | np->tx_skbuff[entry] = NULL; | 1141 | np->tx_skbuff[entry] = NULL; |
1142 | dev->stats.tx_dropped++; | 1142 | dev->stats.tx_dropped++; |
1143 | return NETDEV_TX_OK; | 1143 | return NETDEV_TX_OK; |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 03a351300013..f9f8a589cdef 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -338,7 +338,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
338 | 338 | ||
339 | /* Protocol checksum off-load for TCP and UDP. */ | 339 | /* Protocol checksum off-load for TCP and UDP. */ |
340 | if (fec_enet_clear_csum(skb, ndev)) { | 340 | if (fec_enet_clear_csum(skb, ndev)) { |
341 | kfree_skb(skb); | 341 | dev_kfree_skb_any(skb); |
342 | return NETDEV_TX_OK; | 342 | return NETDEV_TX_OK; |
343 | } | 343 | } |
344 | 344 | ||
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 89ccb5b08708..82386b29914a 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c | |||
@@ -372,6 +372,7 @@ void fec_ptp_init(struct platform_device *pdev) | |||
372 | fep->ptp_caps.n_alarm = 0; | 372 | fep->ptp_caps.n_alarm = 0; |
373 | fep->ptp_caps.n_ext_ts = 0; | 373 | fep->ptp_caps.n_ext_ts = 0; |
374 | fep->ptp_caps.n_per_out = 0; | 374 | fep->ptp_caps.n_per_out = 0; |
375 | fep->ptp_caps.n_pins = 0; | ||
375 | fep->ptp_caps.pps = 0; | 376 | fep->ptp_caps.pps = 0; |
376 | fep->ptp_caps.adjfreq = fec_ptp_adjfreq; | 377 | fep->ptp_caps.adjfreq = fec_ptp_adjfreq; |
377 | fep->ptp_caps.adjtime = fec_ptp_adjtime; | 378 | fep->ptp_caps.adjtime = fec_ptp_adjtime; |
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 6e12f9365856..9125d9abf099 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -754,9 +754,19 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) | |||
754 | num_tx_qs = 1; | 754 | num_tx_qs = 1; |
755 | num_rx_qs = 1; | 755 | num_rx_qs = 1; |
756 | } else { /* MQ_MG_MODE */ | 756 | } else { /* MQ_MG_MODE */ |
757 | /* get the actual number of supported groups */ | ||
758 | unsigned int num_grps = of_get_available_child_count(np); | ||
759 | |||
760 | if (num_grps == 0 || num_grps > MAXGROUPS) { | ||
761 | dev_err(&ofdev->dev, "Invalid # of int groups(%d)\n", | ||
762 | num_grps); | ||
763 | pr_err("Cannot do alloc_etherdev, aborting\n"); | ||
764 | return -EINVAL; | ||
765 | } | ||
766 | |||
757 | if (poll_mode == GFAR_SQ_POLLING) { | 767 | if (poll_mode == GFAR_SQ_POLLING) { |
758 | num_tx_qs = 2; /* one txq per int group */ | 768 | num_tx_qs = num_grps; /* one txq per int group */ |
759 | num_rx_qs = 2; /* one rxq per int group */ | 769 | num_rx_qs = num_grps; /* one rxq per int group */ |
760 | } else { /* GFAR_MQ_POLLING */ | 770 | } else { /* GFAR_MQ_POLLING */ |
761 | num_tx_qs = tx_queues ? *tx_queues : 1; | 771 | num_tx_qs = tx_queues ? *tx_queues : 1; |
762 | num_rx_qs = rx_queues ? *rx_queues : 1; | 772 | num_rx_qs = rx_queues ? *rx_queues : 1; |
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index abc28da27042..bb568006f37d 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
@@ -414,6 +414,7 @@ static struct ptp_clock_info ptp_gianfar_caps = { | |||
414 | .n_alarm = 0, | 414 | .n_alarm = 0, |
415 | .n_ext_ts = N_EXT_TS, | 415 | .n_ext_ts = N_EXT_TS, |
416 | .n_per_out = 0, | 416 | .n_per_out = 0, |
417 | .n_pins = 0, | ||
417 | .pps = 1, | 418 | .pps = 1, |
418 | .adjfreq = ptp_gianfar_adjfreq, | 419 | .adjfreq = ptp_gianfar_adjfreq, |
419 | .adjtime = ptp_gianfar_adjtime, | 420 | .adjtime = ptp_gianfar_adjtime, |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 72291a8904a9..c8299c31b21f 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
@@ -3261,7 +3261,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ) | |||
3261 | 3261 | ||
3262 | dev->stats.tx_packets++; | 3262 | dev->stats.tx_packets++; |
3263 | 3263 | ||
3264 | dev_kfree_skb(skb); | 3264 | dev_consume_skb_any(skb); |
3265 | 3265 | ||
3266 | ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL; | 3266 | ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL; |
3267 | ugeth->skb_dirtytx[txQ] = | 3267 | ugeth->skb_dirtytx[txQ] = |
diff --git a/drivers/net/ethernet/i825xx/lib82596.c b/drivers/net/ethernet/i825xx/lib82596.c index 17fca323c143..c984998b34a0 100644 --- a/drivers/net/ethernet/i825xx/lib82596.c +++ b/drivers/net/ethernet/i825xx/lib82596.c | |||
@@ -993,7 +993,7 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
993 | dev->name)); | 993 | dev->name)); |
994 | dev->stats.tx_dropped++; | 994 | dev->stats.tx_dropped++; |
995 | 995 | ||
996 | dev_kfree_skb(skb); | 996 | dev_kfree_skb_any(skb); |
997 | } else { | 997 | } else { |
998 | if (++lp->next_tx_cmd == TX_RING_SIZE) | 998 | if (++lp->next_tx_cmd == TX_RING_SIZE) |
999 | lp->next_tx_cmd = 0; | 999 | lp->next_tx_cmd = 0; |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 7628e0fd8455..538903bf13bc 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
@@ -490,7 +490,7 @@ static int ehea_refill_rq_def(struct ehea_port_res *pr, | |||
490 | skb_arr[index] = skb; | 490 | skb_arr[index] = skb; |
491 | tmp_addr = ehea_map_vaddr(skb->data); | 491 | tmp_addr = ehea_map_vaddr(skb->data); |
492 | if (tmp_addr == -1) { | 492 | if (tmp_addr == -1) { |
493 | dev_kfree_skb(skb); | 493 | dev_consume_skb_any(skb); |
494 | q_skba->os_skbs = fill_wqes - i; | 494 | q_skba->os_skbs = fill_wqes - i; |
495 | ret = 0; | 495 | ret = 0; |
496 | break; | 496 | break; |
@@ -856,7 +856,7 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) | |||
856 | 856 | ||
857 | index = EHEA_BMASK_GET(EHEA_WR_ID_INDEX, cqe->wr_id); | 857 | index = EHEA_BMASK_GET(EHEA_WR_ID_INDEX, cqe->wr_id); |
858 | skb = pr->sq_skba.arr[index]; | 858 | skb = pr->sq_skba.arr[index]; |
859 | dev_kfree_skb(skb); | 859 | dev_consume_skb_any(skb); |
860 | pr->sq_skba.arr[index] = NULL; | 860 | pr->sq_skba.arr[index] = NULL; |
861 | } | 861 | } |
862 | 862 | ||
@@ -2044,7 +2044,7 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev, | |||
2044 | skb_copy_bits(skb, 0, imm_data, skb->len); | 2044 | skb_copy_bits(skb, 0, imm_data, skb->len); |
2045 | 2045 | ||
2046 | swqe->immediate_data_length = skb->len; | 2046 | swqe->immediate_data_length = skb->len; |
2047 | dev_kfree_skb(skb); | 2047 | dev_consume_skb_any(skb); |
2048 | } | 2048 | } |
2049 | 2049 | ||
2050 | static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev) | 2050 | static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev) |
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index e75bdfcd1374..c9127562bd22 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
@@ -1044,7 +1044,7 @@ retry_bounce: | |||
1044 | DMA_TO_DEVICE); | 1044 | DMA_TO_DEVICE); |
1045 | 1045 | ||
1046 | out: | 1046 | out: |
1047 | dev_kfree_skb(skb); | 1047 | dev_consume_skb_any(skb); |
1048 | return NETDEV_TX_OK; | 1048 | return NETDEV_TX_OK; |
1049 | 1049 | ||
1050 | map_failed_frags: | 1050 | map_failed_frags: |
diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c index 3bd79a3ff829..fb1a914a3ad4 100644 --- a/drivers/net/ethernet/intel/e1000e/ptp.c +++ b/drivers/net/ethernet/intel/e1000e/ptp.c | |||
@@ -189,6 +189,7 @@ static const struct ptp_clock_info e1000e_ptp_clock_info = { | |||
189 | .n_alarm = 0, | 189 | .n_alarm = 0, |
190 | .n_ext_ts = 0, | 190 | .n_ext_ts = 0, |
191 | .n_per_out = 0, | 191 | .n_per_out = 0, |
192 | .n_pins = 0, | ||
192 | .pps = 0, | 193 | .pps = 0, |
193 | .adjfreq = e1000e_phc_adjfreq, | 194 | .adjfreq = e1000e_phc_adjfreq, |
194 | .adjtime = e1000e_phc_adjtime, | 195 | .adjtime = e1000e_phc_adjtime, |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 6049e63a826d..28da4125c8c9 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c | |||
@@ -114,6 +114,11 @@ static struct i40e_stats i40e_gstrings_stats[] = { | |||
114 | I40E_PF_STAT("VF_admin_queue_requests", vf_aq_requests), | 114 | I40E_PF_STAT("VF_admin_queue_requests", vf_aq_requests), |
115 | I40E_PF_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts), | 115 | I40E_PF_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts), |
116 | I40E_PF_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared), | 116 | I40E_PF_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared), |
117 | /* LPI stats */ | ||
118 | I40E_PF_STAT("tx_lpi_status", stats.tx_lpi_status), | ||
119 | I40E_PF_STAT("rx_lpi_status", stats.rx_lpi_status), | ||
120 | I40E_PF_STAT("tx_lpi_count", stats.tx_lpi_count), | ||
121 | I40E_PF_STAT("rx_lpi_count", stats.rx_lpi_count), | ||
117 | }; | 122 | }; |
118 | 123 | ||
119 | #define I40E_QUEUE_STATS_LEN(n) \ | 124 | #define I40E_QUEUE_STATS_LEN(n) \ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 113354214517..28df88ef3c8b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -740,6 +740,7 @@ void i40e_update_stats(struct i40e_vsi *vsi) | |||
740 | u32 rx_page, rx_buf; | 740 | u32 rx_page, rx_buf; |
741 | u64 rx_p, rx_b; | 741 | u64 rx_p, rx_b; |
742 | u64 tx_p, tx_b; | 742 | u64 tx_p, tx_b; |
743 | u32 val; | ||
743 | int i; | 744 | int i; |
744 | u16 q; | 745 | u16 q; |
745 | 746 | ||
@@ -972,6 +973,20 @@ void i40e_update_stats(struct i40e_vsi *vsi) | |||
972 | i40e_stat_update32(hw, I40E_GLPRT_RJC(hw->port), | 973 | i40e_stat_update32(hw, I40E_GLPRT_RJC(hw->port), |
973 | pf->stat_offsets_loaded, | 974 | pf->stat_offsets_loaded, |
974 | &osd->rx_jabber, &nsd->rx_jabber); | 975 | &osd->rx_jabber, &nsd->rx_jabber); |
976 | |||
977 | val = rd32(hw, I40E_PRTPM_EEE_STAT); | ||
978 | nsd->tx_lpi_status = | ||
979 | (val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >> | ||
980 | I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_SHIFT; | ||
981 | nsd->rx_lpi_status = | ||
982 | (val & I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_MASK) >> | ||
983 | I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_SHIFT; | ||
984 | i40e_stat_update32(hw, I40E_PRTPM_TLPIC, | ||
985 | pf->stat_offsets_loaded, | ||
986 | &osd->tx_lpi_count, &nsd->tx_lpi_count); | ||
987 | i40e_stat_update32(hw, I40E_PRTPM_RLPIC, | ||
988 | pf->stat_offsets_loaded, | ||
989 | &osd->rx_lpi_count, &nsd->rx_lpi_count); | ||
975 | } | 990 | } |
976 | 991 | ||
977 | pf->stat_offsets_loaded = true; | 992 | pf->stat_offsets_loaded = true; |
@@ -6381,7 +6396,7 @@ static int i40e_sw_init(struct i40e_pf *pf) | |||
6381 | pf->flags |= I40E_FLAG_FD_SB_ENABLED; | 6396 | pf->flags |= I40E_FLAG_FD_SB_ENABLED; |
6382 | } else { | 6397 | } else { |
6383 | dev_info(&pf->pdev->dev, | 6398 | dev_info(&pf->pdev->dev, |
6384 | "Flow Director Side Band mode Disabled in MFP mode\n"); | 6399 | "Flow Director Sideband mode Disabled in MFP mode\n"); |
6385 | } | 6400 | } |
6386 | pf->fdir_pf_filter_count = | 6401 | pf->fdir_pf_filter_count = |
6387 | pf->hw.func_caps.fd_filters_guaranteed; | 6402 | pf->hw.func_caps.fd_filters_guaranteed; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h index 5c902f448b1d..d2f0b95fd0d7 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_type.h +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h | |||
@@ -1014,6 +1014,11 @@ struct i40e_hw_port_stats { | |||
1014 | u64 tx_size_big; /* ptc9522 */ | 1014 | u64 tx_size_big; /* ptc9522 */ |
1015 | u64 mac_short_packet_dropped; /* mspdc */ | 1015 | u64 mac_short_packet_dropped; /* mspdc */ |
1016 | u64 checksum_error; /* xec */ | 1016 | u64 checksum_error; /* xec */ |
1017 | /* EEE LPI */ | ||
1018 | bool tx_lpi_status; | ||
1019 | bool rx_lpi_status; | ||
1020 | u64 tx_lpi_count; /* etlpic */ | ||
1021 | u64 rx_lpi_count; /* erlpic */ | ||
1017 | }; | 1022 | }; |
1018 | 1023 | ||
1019 | /* Checksum and Shadow RAM pointers */ | 1024 | /* Checksum and Shadow RAM pointers */ |
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h index 7189d6f08ddd..efe73ad6fdb9 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_type.h +++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h | |||
@@ -1020,6 +1020,11 @@ struct i40e_hw_port_stats { | |||
1020 | u64 tx_size_big; /* ptc9522 */ | 1020 | u64 tx_size_big; /* ptc9522 */ |
1021 | u64 mac_short_packet_dropped; /* mspdc */ | 1021 | u64 mac_short_packet_dropped; /* mspdc */ |
1022 | u64 checksum_error; /* xec */ | 1022 | u64 checksum_error; /* xec */ |
1023 | /* EEE LPI */ | ||
1024 | bool tx_lpi_status; | ||
1025 | bool rx_lpi_status; | ||
1026 | u64 tx_lpi_count; /* etlpic */ | ||
1027 | u64 rx_lpi_count; /* erlpic */ | ||
1023 | }; | 1028 | }; |
1024 | 1029 | ||
1025 | /* Checksum and Shadow RAM pointers */ | 1030 | /* Checksum and Shadow RAM pointers */ |
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c index d381bcc4ea9f..d3eafa320ba9 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c | |||
@@ -1968,8 +1968,7 @@ static void i40evf_init_task(struct work_struct *work) | |||
1968 | } | 1968 | } |
1969 | err = i40evf_send_api_ver(adapter); | 1969 | err = i40evf_send_api_ver(adapter); |
1970 | if (err) { | 1970 | if (err) { |
1971 | dev_err(&pdev->dev, "Unable to send to PF (%d)\n", | 1971 | dev_err(&pdev->dev, "Unable to send to PF (%d)\n", err); |
1972 | err); | ||
1973 | i40evf_shutdown_adminq(hw); | 1972 | i40evf_shutdown_adminq(hw); |
1974 | goto err; | 1973 | goto err; |
1975 | } | 1974 | } |
@@ -1977,8 +1976,10 @@ static void i40evf_init_task(struct work_struct *work) | |||
1977 | goto restart; | 1976 | goto restart; |
1978 | break; | 1977 | break; |
1979 | case __I40EVF_INIT_VERSION_CHECK: | 1978 | case __I40EVF_INIT_VERSION_CHECK: |
1980 | if (!i40evf_asq_done(hw)) | 1979 | if (!i40evf_asq_done(hw)) { |
1980 | dev_err(&pdev->dev, "Admin queue command never completed.\n"); | ||
1981 | goto err; | 1981 | goto err; |
1982 | } | ||
1982 | 1983 | ||
1983 | /* aq msg sent, awaiting reply */ | 1984 | /* aq msg sent, awaiting reply */ |
1984 | err = i40evf_verify_api_ver(adapter); | 1985 | err = i40evf_verify_api_ver(adapter); |
@@ -2133,8 +2134,6 @@ err_alloc: | |||
2133 | kfree(adapter->vf_res); | 2134 | kfree(adapter->vf_res); |
2134 | adapter->vf_res = NULL; | 2135 | adapter->vf_res = NULL; |
2135 | err: | 2136 | err: |
2136 | if (hw->aq.asq.count) | ||
2137 | i40evf_shutdown_adminq(hw); /* ignore error */ | ||
2138 | /* Things went into the weeds, so try again later */ | 2137 | /* Things went into the weeds, so try again later */ |
2139 | if (++adapter->aq_wait_count > I40EVF_AQ_MAX_ERR) { | 2138 | if (++adapter->aq_wait_count > I40EVF_AQ_MAX_ERR) { |
2140 | dev_err(&pdev->dev, "Failed to communicate with PF; giving up.\n"); | 2139 | dev_err(&pdev->dev, "Failed to communicate with PF; giving up.\n"); |
diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h index d0f14be3d94f..bdb246e848e1 100644 --- a/drivers/net/ethernet/intel/igb/e1000_regs.h +++ b/drivers/net/ethernet/intel/igb/e1000_regs.h | |||
@@ -362,12 +362,25 @@ | |||
362 | * Filter - RW */ | 362 | * Filter - RW */ |
363 | #define E1000_VMVIR(_n) (0x03700 + (4 * (_n))) | 363 | #define E1000_VMVIR(_n) (0x03700 + (4 * (_n))) |
364 | 364 | ||
365 | #define wr32(reg, value) (writel(value, hw->hw_addr + reg)) | 365 | struct e1000_hw; |
366 | #define rd32(reg) (readl(hw->hw_addr + reg)) | 366 | |
367 | u32 igb_rd32(struct e1000_hw *hw, u32 reg); | ||
368 | |||
369 | /* write operations, indexed using DWORDS */ | ||
370 | #define wr32(reg, val) \ | ||
371 | do { \ | ||
372 | u8 __iomem *hw_addr = ACCESS_ONCE((hw)->hw_addr); \ | ||
373 | if (!E1000_REMOVED(hw_addr)) \ | ||
374 | writel((val), &hw_addr[(reg)]); \ | ||
375 | } while (0) | ||
376 | |||
377 | #define rd32(reg) (igb_rd32(hw, reg)) | ||
378 | |||
367 | #define wrfl() ((void)rd32(E1000_STATUS)) | 379 | #define wrfl() ((void)rd32(E1000_STATUS)) |
368 | 380 | ||
369 | #define array_wr32(reg, offset, value) \ | 381 | #define array_wr32(reg, offset, value) \ |
370 | (writel(value, hw->hw_addr + reg + ((offset) << 2))) | 382 | wr32((reg) + ((offset) << 2), (value)) |
383 | |||
371 | #define array_rd32(reg, offset) \ | 384 | #define array_rd32(reg, offset) \ |
372 | (readl(hw->hw_addr + reg + ((offset) << 2))) | 385 | (readl(hw->hw_addr + reg + ((offset) << 2))) |
373 | 386 | ||
@@ -406,4 +419,6 @@ | |||
406 | #define E1000_INVM_DATA_REG(_n) (0x12120 + 4*(_n)) | 419 | #define E1000_INVM_DATA_REG(_n) (0x12120 + 4*(_n)) |
407 | #define E1000_INVM_SIZE 64 /* Number of INVM Data Registers */ | 420 | #define E1000_INVM_SIZE 64 /* Number of INVM Data Registers */ |
408 | 421 | ||
422 | #define E1000_REMOVED(h) unlikely(!(h)) | ||
423 | |||
409 | #endif | 424 | #endif |
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index a202c9640e93..411b213c63be 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h | |||
@@ -434,6 +434,7 @@ struct igb_adapter { | |||
434 | struct delayed_work ptp_overflow_work; | 434 | struct delayed_work ptp_overflow_work; |
435 | struct work_struct ptp_tx_work; | 435 | struct work_struct ptp_tx_work; |
436 | struct sk_buff *ptp_tx_skb; | 436 | struct sk_buff *ptp_tx_skb; |
437 | struct hwtstamp_config tstamp_config; | ||
437 | unsigned long ptp_tx_start; | 438 | unsigned long ptp_tx_start; |
438 | unsigned long last_rx_ptp_check; | 439 | unsigned long last_rx_ptp_check; |
439 | spinlock_t tmreg_lock; | 440 | spinlock_t tmreg_lock; |
@@ -545,8 +546,8 @@ static inline void igb_ptp_rx_hwtstamp(struct igb_ring *rx_ring, | |||
545 | rx_ring->last_rx_timestamp = jiffies; | 546 | rx_ring->last_rx_timestamp = jiffies; |
546 | } | 547 | } |
547 | 548 | ||
548 | int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, | 549 | int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); |
549 | int cmd); | 550 | int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr); |
550 | #ifdef CONFIG_IGB_HWMON | 551 | #ifdef CONFIG_IGB_HWMON |
551 | void igb_sysfs_exit(struct igb_adapter *adapter); | 552 | void igb_sysfs_exit(struct igb_adapter *adapter); |
552 | int igb_sysfs_init(struct igb_adapter *adapter); | 553 | int igb_sysfs_init(struct igb_adapter *adapter); |
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index e35bc1faa452..e5570acbeea8 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | |||
@@ -2353,6 +2353,11 @@ static int igb_get_ts_info(struct net_device *dev, | |||
2353 | { | 2353 | { |
2354 | struct igb_adapter *adapter = netdev_priv(dev); | 2354 | struct igb_adapter *adapter = netdev_priv(dev); |
2355 | 2355 | ||
2356 | if (adapter->ptp_clock) | ||
2357 | info->phc_index = ptp_clock_index(adapter->ptp_clock); | ||
2358 | else | ||
2359 | info->phc_index = -1; | ||
2360 | |||
2356 | switch (adapter->hw.mac.type) { | 2361 | switch (adapter->hw.mac.type) { |
2357 | case e1000_82575: | 2362 | case e1000_82575: |
2358 | info->so_timestamping = | 2363 | info->so_timestamping = |
@@ -2374,11 +2379,6 @@ static int igb_get_ts_info(struct net_device *dev, | |||
2374 | SOF_TIMESTAMPING_RX_HARDWARE | | 2379 | SOF_TIMESTAMPING_RX_HARDWARE | |
2375 | SOF_TIMESTAMPING_RAW_HARDWARE; | 2380 | SOF_TIMESTAMPING_RAW_HARDWARE; |
2376 | 2381 | ||
2377 | if (adapter->ptp_clock) | ||
2378 | info->phc_index = ptp_clock_index(adapter->ptp_clock); | ||
2379 | else | ||
2380 | info->phc_index = -1; | ||
2381 | |||
2382 | info->tx_types = | 2382 | info->tx_types = |
2383 | (1 << HWTSTAMP_TX_OFF) | | 2383 | (1 << HWTSTAMP_TX_OFF) | |
2384 | (1 << HWTSTAMP_TX_ON); | 2384 | (1 << HWTSTAMP_TX_ON); |
@@ -2791,9 +2791,11 @@ static int igb_get_module_eeprom(struct net_device *netdev, | |||
2791 | /* Read EEPROM block, SFF-8079/SFF-8472, word at a time */ | 2791 | /* Read EEPROM block, SFF-8079/SFF-8472, word at a time */ |
2792 | for (i = 0; i < last_word - first_word + 1; i++) { | 2792 | for (i = 0; i < last_word - first_word + 1; i++) { |
2793 | status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]); | 2793 | status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]); |
2794 | if (status != E1000_SUCCESS) | 2794 | if (status != E1000_SUCCESS) { |
2795 | /* Error occurred while reading module */ | 2795 | /* Error occurred while reading module */ |
2796 | kfree(dataword); | ||
2796 | return -EIO; | 2797 | return -EIO; |
2798 | } | ||
2797 | 2799 | ||
2798 | be16_to_cpus(&dataword[i]); | 2800 | be16_to_cpus(&dataword[i]); |
2799 | } | 2801 | } |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 17feea0ea2b0..cd20409858d1 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -751,6 +751,28 @@ static void igb_cache_ring_register(struct igb_adapter *adapter) | |||
751 | } | 751 | } |
752 | } | 752 | } |
753 | 753 | ||
754 | u32 igb_rd32(struct e1000_hw *hw, u32 reg) | ||
755 | { | ||
756 | struct igb_adapter *igb = container_of(hw, struct igb_adapter, hw); | ||
757 | u8 __iomem *hw_addr = ACCESS_ONCE(hw->hw_addr); | ||
758 | u32 value = 0; | ||
759 | |||
760 | if (E1000_REMOVED(hw_addr)) | ||
761 | return ~value; | ||
762 | |||
763 | value = readl(&hw_addr[reg]); | ||
764 | |||
765 | /* reads should not return all F's */ | ||
766 | if (!(~value) && (!reg || !(~readl(hw_addr)))) { | ||
767 | struct net_device *netdev = igb->netdev; | ||
768 | hw->hw_addr = NULL; | ||
769 | netif_device_detach(netdev); | ||
770 | netdev_err(netdev, "PCIe link lost, device now detached\n"); | ||
771 | } | ||
772 | |||
773 | return value; | ||
774 | } | ||
775 | |||
754 | /** | 776 | /** |
755 | * igb_write_ivar - configure ivar for given MSI-X vector | 777 | * igb_write_ivar - configure ivar for given MSI-X vector |
756 | * @hw: pointer to the HW structure | 778 | * @hw: pointer to the HW structure |
@@ -1013,6 +1035,12 @@ static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx) | |||
1013 | { | 1035 | { |
1014 | struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; | 1036 | struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; |
1015 | 1037 | ||
1038 | /* Coming from igb_set_interrupt_capability, the vectors are not yet | ||
1039 | * allocated. So, q_vector is NULL so we should stop here. | ||
1040 | */ | ||
1041 | if (!q_vector) | ||
1042 | return; | ||
1043 | |||
1016 | if (q_vector->tx.ring) | 1044 | if (q_vector->tx.ring) |
1017 | adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL; | 1045 | adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL; |
1018 | 1046 | ||
@@ -1121,6 +1149,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) | |||
1121 | 1149 | ||
1122 | /* If we can't do MSI-X, try MSI */ | 1150 | /* If we can't do MSI-X, try MSI */ |
1123 | msi_only: | 1151 | msi_only: |
1152 | adapter->flags &= ~IGB_FLAG_HAS_MSIX; | ||
1124 | #ifdef CONFIG_PCI_IOV | 1153 | #ifdef CONFIG_PCI_IOV |
1125 | /* disable SR-IOV for non MSI-X configurations */ | 1154 | /* disable SR-IOV for non MSI-X configurations */ |
1126 | if (adapter->vf_data) { | 1155 | if (adapter->vf_data) { |
@@ -7162,8 +7191,10 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
7162 | case SIOCGMIIREG: | 7191 | case SIOCGMIIREG: |
7163 | case SIOCSMIIREG: | 7192 | case SIOCSMIIREG: |
7164 | return igb_mii_ioctl(netdev, ifr, cmd); | 7193 | return igb_mii_ioctl(netdev, ifr, cmd); |
7194 | case SIOCGHWTSTAMP: | ||
7195 | return igb_ptp_get_ts_config(netdev, ifr); | ||
7165 | case SIOCSHWTSTAMP: | 7196 | case SIOCSHWTSTAMP: |
7166 | return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd); | 7197 | return igb_ptp_set_ts_config(netdev, ifr); |
7167 | default: | 7198 | default: |
7168 | return -EOPNOTSUPP; | 7199 | return -EOPNOTSUPP; |
7169 | } | 7200 | } |
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index a894551ae3c0..da55fbb090b2 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c | |||
@@ -541,10 +541,26 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, | |||
541 | } | 541 | } |
542 | 542 | ||
543 | /** | 543 | /** |
544 | * igb_ptp_hwtstamp_ioctl - control hardware time stamping | 544 | * igb_ptp_get_ts_config - get hardware time stamping config |
545 | * @netdev: | ||
546 | * @ifreq: | ||
547 | * | ||
548 | * Get the hwtstamp_config settings to return to the user. Rather than attempt | ||
549 | * to deconstruct the settings from the registers, just return a shadow copy | ||
550 | * of the last known settings. | ||
551 | **/ | ||
552 | int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr) | ||
553 | { | ||
554 | struct igb_adapter *adapter = netdev_priv(netdev); | ||
555 | struct hwtstamp_config *config = &adapter->tstamp_config; | ||
556 | |||
557 | return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? | ||
558 | -EFAULT : 0; | ||
559 | } | ||
560 | /** | ||
561 | * igb_ptp_set_ts_config - control hardware time stamping | ||
545 | * @netdev: | 562 | * @netdev: |
546 | * @ifreq: | 563 | * @ifreq: |
547 | * @cmd: | ||
548 | * | 564 | * |
549 | * Outgoing time stamping can be enabled and disabled. Play nice and | 565 | * Outgoing time stamping can be enabled and disabled. Play nice and |
550 | * disable it when requested, although it shouldn't case any overhead | 566 | * disable it when requested, although it shouldn't case any overhead |
@@ -558,12 +574,11 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, | |||
558 | * not supported, with the exception of "all V2 events regardless of | 574 | * not supported, with the exception of "all V2 events regardless of |
559 | * level 2 or 4". | 575 | * level 2 or 4". |
560 | **/ | 576 | **/ |
561 | int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, | 577 | int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr) |
562 | struct ifreq *ifr, int cmd) | ||
563 | { | 578 | { |
564 | struct igb_adapter *adapter = netdev_priv(netdev); | 579 | struct igb_adapter *adapter = netdev_priv(netdev); |
565 | struct e1000_hw *hw = &adapter->hw; | 580 | struct e1000_hw *hw = &adapter->hw; |
566 | struct hwtstamp_config config; | 581 | struct hwtstamp_config *config = &adapter->tstamp_config; |
567 | u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED; | 582 | u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED; |
568 | u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; | 583 | u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; |
569 | u32 tsync_rx_cfg = 0; | 584 | u32 tsync_rx_cfg = 0; |
@@ -571,14 +586,14 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, | |||
571 | bool is_l2 = false; | 586 | bool is_l2 = false; |
572 | u32 regval; | 587 | u32 regval; |
573 | 588 | ||
574 | if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) | 589 | if (copy_from_user(config, ifr->ifr_data, sizeof(*config))) |
575 | return -EFAULT; | 590 | return -EFAULT; |
576 | 591 | ||
577 | /* reserved for future extensions */ | 592 | /* reserved for future extensions */ |
578 | if (config.flags) | 593 | if (config->flags) |
579 | return -EINVAL; | 594 | return -EINVAL; |
580 | 595 | ||
581 | switch (config.tx_type) { | 596 | switch (config->tx_type) { |
582 | case HWTSTAMP_TX_OFF: | 597 | case HWTSTAMP_TX_OFF: |
583 | tsync_tx_ctl = 0; | 598 | tsync_tx_ctl = 0; |
584 | case HWTSTAMP_TX_ON: | 599 | case HWTSTAMP_TX_ON: |
@@ -587,7 +602,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, | |||
587 | return -ERANGE; | 602 | return -ERANGE; |
588 | } | 603 | } |
589 | 604 | ||
590 | switch (config.rx_filter) { | 605 | switch (config->rx_filter) { |
591 | case HWTSTAMP_FILTER_NONE: | 606 | case HWTSTAMP_FILTER_NONE: |
592 | tsync_rx_ctl = 0; | 607 | tsync_rx_ctl = 0; |
593 | break; | 608 | break; |
@@ -611,7 +626,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, | |||
611 | case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: | 626 | case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: |
612 | case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: | 627 | case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: |
613 | tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2; | 628 | tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2; |
614 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; | 629 | config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; |
615 | is_l2 = true; | 630 | is_l2 = true; |
616 | is_l4 = true; | 631 | is_l4 = true; |
617 | break; | 632 | break; |
@@ -622,12 +637,12 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, | |||
622 | */ | 637 | */ |
623 | if (hw->mac.type != e1000_82576) { | 638 | if (hw->mac.type != e1000_82576) { |
624 | tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL; | 639 | tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL; |
625 | config.rx_filter = HWTSTAMP_FILTER_ALL; | 640 | config->rx_filter = HWTSTAMP_FILTER_ALL; |
626 | break; | 641 | break; |
627 | } | 642 | } |
628 | /* fall through */ | 643 | /* fall through */ |
629 | default: | 644 | default: |
630 | config.rx_filter = HWTSTAMP_FILTER_NONE; | 645 | config->rx_filter = HWTSTAMP_FILTER_NONE; |
631 | return -ERANGE; | 646 | return -ERANGE; |
632 | } | 647 | } |
633 | 648 | ||
@@ -644,7 +659,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, | |||
644 | if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) { | 659 | if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) { |
645 | tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; | 660 | tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED; |
646 | tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL; | 661 | tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL; |
647 | config.rx_filter = HWTSTAMP_FILTER_ALL; | 662 | config->rx_filter = HWTSTAMP_FILTER_ALL; |
648 | is_l2 = true; | 663 | is_l2 = true; |
649 | is_l4 = true; | 664 | is_l4 = true; |
650 | 665 | ||
@@ -708,7 +723,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, | |||
708 | regval = rd32(E1000_RXSTMPL); | 723 | regval = rd32(E1000_RXSTMPL); |
709 | regval = rd32(E1000_RXSTMPH); | 724 | regval = rd32(E1000_RXSTMPH); |
710 | 725 | ||
711 | return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? | 726 | return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? |
712 | -EFAULT : 0; | 727 | -EFAULT : 0; |
713 | } | 728 | } |
714 | 729 | ||
@@ -865,6 +880,9 @@ void igb_ptp_reset(struct igb_adapter *adapter) | |||
865 | if (!(adapter->flags & IGB_FLAG_PTP)) | 880 | if (!(adapter->flags & IGB_FLAG_PTP)) |
866 | return; | 881 | return; |
867 | 882 | ||
883 | /* reset the tstamp_config */ | ||
884 | memset(&adapter->tstamp_config, 0, sizeof(adapter->tstamp_config)); | ||
885 | |||
868 | switch (adapter->hw.mac.type) { | 886 | switch (adapter->hw.mac.type) { |
869 | case e1000_82576: | 887 | case e1000_82576: |
870 | /* Dial the nominal frequency. */ | 888 | /* Dial the nominal frequency. */ |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c index 911b711b6ba1..24fba39e194e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | |||
@@ -2913,6 +2913,9 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) | |||
2913 | mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); | 2913 | mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); |
2914 | mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); | 2914 | mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); |
2915 | 2915 | ||
2916 | if (ixgbe_removed(hw->hw_addr)) | ||
2917 | goto done; | ||
2918 | |||
2916 | if (!mpsar_lo && !mpsar_hi) | 2919 | if (!mpsar_lo && !mpsar_hi) |
2917 | goto done; | 2920 | goto done; |
2918 | 2921 | ||
diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c index f68b78c732a8..b2d002394e5d 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c +++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 82599 Virtual Function driver | 3 | Intel 82599 Virtual Function driver |
4 | Copyright(c) 1999 - 2012 Intel Corporation. | 4 | Copyright(c) 1999 - 2014 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -530,41 +530,55 @@ static const u32 register_test_patterns[] = { | |||
530 | 0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF | 530 | 0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF |
531 | }; | 531 | }; |
532 | 532 | ||
533 | #define REG_PATTERN_TEST(R, M, W) \ | 533 | static bool reg_pattern_test(struct ixgbevf_adapter *adapter, u64 *data, |
534 | { \ | 534 | int reg, u32 mask, u32 write) |
535 | u32 pat, val, before; \ | 535 | { |
536 | for (pat = 0; pat < ARRAY_SIZE(register_test_patterns); pat++) { \ | 536 | u32 pat, val, before; |
537 | before = readl(adapter->hw.hw_addr + R); \ | 537 | |
538 | writel((register_test_patterns[pat] & W), \ | 538 | if (IXGBE_REMOVED(adapter->hw.hw_addr)) { |
539 | (adapter->hw.hw_addr + R)); \ | 539 | *data = 1; |
540 | val = readl(adapter->hw.hw_addr + R); \ | 540 | return true; |
541 | if (val != (register_test_patterns[pat] & W & M)) { \ | 541 | } |
542 | hw_dbg(&adapter->hw, \ | 542 | for (pat = 0; pat < ARRAY_SIZE(register_test_patterns); pat++) { |
543 | "pattern test reg %04X failed: got " \ | 543 | before = ixgbe_read_reg(&adapter->hw, reg); |
544 | "0x%08X expected 0x%08X\n", \ | 544 | ixgbe_write_reg(&adapter->hw, reg, |
545 | R, val, (register_test_patterns[pat] & W & M)); \ | 545 | register_test_patterns[pat] & write); |
546 | *data = R; \ | 546 | val = ixgbe_read_reg(&adapter->hw, reg); |
547 | writel(before, adapter->hw.hw_addr + R); \ | 547 | if (val != (register_test_patterns[pat] & write & mask)) { |
548 | return 1; \ | 548 | hw_dbg(&adapter->hw, |
549 | } \ | 549 | "pattern test reg %04X failed: got 0x%08X expected 0x%08X\n", |
550 | writel(before, adapter->hw.hw_addr + R); \ | 550 | reg, val, |
551 | } \ | 551 | register_test_patterns[pat] & write & mask); |
552 | *data = reg; | ||
553 | ixgbe_write_reg(&adapter->hw, reg, before); | ||
554 | return true; | ||
555 | } | ||
556 | ixgbe_write_reg(&adapter->hw, reg, before); | ||
557 | } | ||
558 | return false; | ||
552 | } | 559 | } |
553 | 560 | ||
554 | #define REG_SET_AND_CHECK(R, M, W) \ | 561 | static bool reg_set_and_check(struct ixgbevf_adapter *adapter, u64 *data, |
555 | { \ | 562 | int reg, u32 mask, u32 write) |
556 | u32 val, before; \ | 563 | { |
557 | before = readl(adapter->hw.hw_addr + R); \ | 564 | u32 val, before; |
558 | writel((W & M), (adapter->hw.hw_addr + R)); \ | 565 | |
559 | val = readl(adapter->hw.hw_addr + R); \ | 566 | if (IXGBE_REMOVED(adapter->hw.hw_addr)) { |
560 | if ((W & M) != (val & M)) { \ | 567 | *data = 1; |
561 | pr_err("set/check reg %04X test failed: got 0x%08X expected " \ | 568 | return true; |
562 | "0x%08X\n", R, (val & M), (W & M)); \ | 569 | } |
563 | *data = R; \ | 570 | before = ixgbe_read_reg(&adapter->hw, reg); |
564 | writel(before, (adapter->hw.hw_addr + R)); \ | 571 | ixgbe_write_reg(&adapter->hw, reg, write & mask); |
565 | return 1; \ | 572 | val = ixgbe_read_reg(&adapter->hw, reg); |
566 | } \ | 573 | if ((write & mask) != (val & mask)) { |
567 | writel(before, (adapter->hw.hw_addr + R)); \ | 574 | pr_err("set/check reg %04X test failed: got 0x%08X expected 0x%08X\n", |
575 | reg, (val & mask), write & mask); | ||
576 | *data = reg; | ||
577 | ixgbe_write_reg(&adapter->hw, reg, before); | ||
578 | return true; | ||
579 | } | ||
580 | ixgbe_write_reg(&adapter->hw, reg, before); | ||
581 | return false; | ||
568 | } | 582 | } |
569 | 583 | ||
570 | static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data) | 584 | static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data) |
@@ -572,6 +586,12 @@ static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data) | |||
572 | const struct ixgbevf_reg_test *test; | 586 | const struct ixgbevf_reg_test *test; |
573 | u32 i; | 587 | u32 i; |
574 | 588 | ||
589 | if (IXGBE_REMOVED(adapter->hw.hw_addr)) { | ||
590 | dev_err(&adapter->pdev->dev, | ||
591 | "Adapter removed - register test blocked\n"); | ||
592 | *data = 1; | ||
593 | return 1; | ||
594 | } | ||
575 | test = reg_test_vf; | 595 | test = reg_test_vf; |
576 | 596 | ||
577 | /* | 597 | /* |
@@ -580,38 +600,47 @@ static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data) | |||
580 | */ | 600 | */ |
581 | while (test->reg) { | 601 | while (test->reg) { |
582 | for (i = 0; i < test->array_len; i++) { | 602 | for (i = 0; i < test->array_len; i++) { |
603 | bool b = false; | ||
604 | |||
583 | switch (test->test_type) { | 605 | switch (test->test_type) { |
584 | case PATTERN_TEST: | 606 | case PATTERN_TEST: |
585 | REG_PATTERN_TEST(test->reg + (i * 0x40), | 607 | b = reg_pattern_test(adapter, data, |
586 | test->mask, | 608 | test->reg + (i * 0x40), |
587 | test->write); | 609 | test->mask, |
610 | test->write); | ||
588 | break; | 611 | break; |
589 | case SET_READ_TEST: | 612 | case SET_READ_TEST: |
590 | REG_SET_AND_CHECK(test->reg + (i * 0x40), | 613 | b = reg_set_and_check(adapter, data, |
591 | test->mask, | 614 | test->reg + (i * 0x40), |
592 | test->write); | 615 | test->mask, |
616 | test->write); | ||
593 | break; | 617 | break; |
594 | case WRITE_NO_TEST: | 618 | case WRITE_NO_TEST: |
595 | writel(test->write, | 619 | ixgbe_write_reg(&adapter->hw, |
596 | (adapter->hw.hw_addr + test->reg) | 620 | test->reg + (i * 0x40), |
597 | + (i * 0x40)); | 621 | test->write); |
598 | break; | 622 | break; |
599 | case TABLE32_TEST: | 623 | case TABLE32_TEST: |
600 | REG_PATTERN_TEST(test->reg + (i * 4), | 624 | b = reg_pattern_test(adapter, data, |
601 | test->mask, | 625 | test->reg + (i * 4), |
602 | test->write); | 626 | test->mask, |
627 | test->write); | ||
603 | break; | 628 | break; |
604 | case TABLE64_TEST_LO: | 629 | case TABLE64_TEST_LO: |
605 | REG_PATTERN_TEST(test->reg + (i * 8), | 630 | b = reg_pattern_test(adapter, data, |
606 | test->mask, | 631 | test->reg + (i * 8), |
607 | test->write); | 632 | test->mask, |
633 | test->write); | ||
608 | break; | 634 | break; |
609 | case TABLE64_TEST_HI: | 635 | case TABLE64_TEST_HI: |
610 | REG_PATTERN_TEST((test->reg + 4) + (i * 8), | 636 | b = reg_pattern_test(adapter, data, |
611 | test->mask, | 637 | test->reg + 4 + (i * 8), |
612 | test->write); | 638 | test->mask, |
639 | test->write); | ||
613 | break; | 640 | break; |
614 | } | 641 | } |
642 | if (b) | ||
643 | return 1; | ||
615 | } | 644 | } |
616 | test++; | 645 | test++; |
617 | } | 646 | } |
@@ -626,6 +655,14 @@ static void ixgbevf_diag_test(struct net_device *netdev, | |||
626 | struct ixgbevf_adapter *adapter = netdev_priv(netdev); | 655 | struct ixgbevf_adapter *adapter = netdev_priv(netdev); |
627 | bool if_running = netif_running(netdev); | 656 | bool if_running = netif_running(netdev); |
628 | 657 | ||
658 | if (IXGBE_REMOVED(adapter->hw.hw_addr)) { | ||
659 | dev_err(&adapter->pdev->dev, | ||
660 | "Adapter removed - test blocked\n"); | ||
661 | data[0] = 1; | ||
662 | data[1] = 1; | ||
663 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
664 | return; | ||
665 | } | ||
629 | set_bit(__IXGBEVF_TESTING, &adapter->state); | 666 | set_bit(__IXGBEVF_TESTING, &adapter->state); |
630 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { | 667 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { |
631 | /* Offline tests */ | 668 | /* Offline tests */ |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h index 08fb88aba67b..a08bd7c46766 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | |||
@@ -315,6 +315,11 @@ static inline u16 ixgbevf_desc_unused(struct ixgbevf_ring *ring) | |||
315 | return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1; | 315 | return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1; |
316 | } | 316 | } |
317 | 317 | ||
318 | static inline void ixgbevf_write_tail(struct ixgbevf_ring *ring, u32 value) | ||
319 | { | ||
320 | writel(value, ring->tail); | ||
321 | } | ||
322 | |||
318 | #define IXGBEVF_RX_DESC(R, i) \ | 323 | #define IXGBEVF_RX_DESC(R, i) \ |
319 | (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) | 324 | (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i])) |
320 | #define IXGBEVF_TX_DESC(R, i) \ | 325 | #define IXGBEVF_TX_DESC(R, i) \ |
@@ -401,6 +406,7 @@ struct ixgbevf_adapter { | |||
401 | u64 bp_tx_missed; | 406 | u64 bp_tx_missed; |
402 | #endif | 407 | #endif |
403 | 408 | ||
409 | u8 __iomem *io_addr; /* Mainly for iounmap use */ | ||
404 | u32 link_speed; | 410 | u32 link_speed; |
405 | bool link_up; | 411 | bool link_up; |
406 | 412 | ||
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 592d8a6baabc..a50e892a5d21 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -99,6 +99,49 @@ static void ixgbevf_queue_reset_subtask(struct ixgbevf_adapter *adapter); | |||
99 | static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector); | 99 | static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector); |
100 | static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter); | 100 | static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter); |
101 | 101 | ||
102 | static void ixgbevf_remove_adapter(struct ixgbe_hw *hw) | ||
103 | { | ||
104 | struct ixgbevf_adapter *adapter = hw->back; | ||
105 | |||
106 | if (!hw->hw_addr) | ||
107 | return; | ||
108 | hw->hw_addr = NULL; | ||
109 | dev_err(&adapter->pdev->dev, "Adapter removed\n"); | ||
110 | schedule_work(&adapter->watchdog_task); | ||
111 | } | ||
112 | |||
113 | static void ixgbevf_check_remove(struct ixgbe_hw *hw, u32 reg) | ||
114 | { | ||
115 | u32 value; | ||
116 | |||
117 | /* The following check not only optimizes a bit by not | ||
118 | * performing a read on the status register when the | ||
119 | * register just read was a status register read that | ||
120 | * returned IXGBE_FAILED_READ_REG. It also blocks any | ||
121 | * potential recursion. | ||
122 | */ | ||
123 | if (reg == IXGBE_VFSTATUS) { | ||
124 | ixgbevf_remove_adapter(hw); | ||
125 | return; | ||
126 | } | ||
127 | value = ixgbe_read_reg(hw, IXGBE_VFSTATUS); | ||
128 | if (value == IXGBE_FAILED_READ_REG) | ||
129 | ixgbevf_remove_adapter(hw); | ||
130 | } | ||
131 | |||
132 | u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg) | ||
133 | { | ||
134 | u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr); | ||
135 | u32 value; | ||
136 | |||
137 | if (IXGBE_REMOVED(reg_addr)) | ||
138 | return IXGBE_FAILED_READ_REG; | ||
139 | value = readl(reg_addr + reg); | ||
140 | if (unlikely(value == IXGBE_FAILED_READ_REG)) | ||
141 | ixgbevf_check_remove(hw, reg); | ||
142 | return value; | ||
143 | } | ||
144 | |||
102 | static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring, | 145 | static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring, |
103 | u32 val) | 146 | u32 val) |
104 | { | 147 | { |
@@ -111,7 +154,7 @@ static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring, | |||
111 | * such as IA-64). | 154 | * such as IA-64). |
112 | */ | 155 | */ |
113 | wmb(); | 156 | wmb(); |
114 | writel(val, rx_ring->tail); | 157 | ixgbevf_write_tail(rx_ring, val); |
115 | } | 158 | } |
116 | 159 | ||
117 | /** | 160 | /** |
@@ -1139,7 +1182,7 @@ static void ixgbevf_configure_tx_ring(struct ixgbevf_adapter *adapter, | |||
1139 | /* reset head and tail pointers */ | 1182 | /* reset head and tail pointers */ |
1140 | IXGBE_WRITE_REG(hw, IXGBE_VFTDH(reg_idx), 0); | 1183 | IXGBE_WRITE_REG(hw, IXGBE_VFTDH(reg_idx), 0); |
1141 | IXGBE_WRITE_REG(hw, IXGBE_VFTDT(reg_idx), 0); | 1184 | IXGBE_WRITE_REG(hw, IXGBE_VFTDT(reg_idx), 0); |
1142 | ring->tail = hw->hw_addr + IXGBE_VFTDT(reg_idx); | 1185 | ring->tail = adapter->io_addr + IXGBE_VFTDT(reg_idx); |
1143 | 1186 | ||
1144 | /* reset ntu and ntc to place SW in sync with hardwdare */ | 1187 | /* reset ntu and ntc to place SW in sync with hardwdare */ |
1145 | ring->next_to_clean = 0; | 1188 | ring->next_to_clean = 0; |
@@ -1259,6 +1302,8 @@ static void ixgbevf_disable_rx_queue(struct ixgbevf_adapter *adapter, | |||
1259 | u32 rxdctl; | 1302 | u32 rxdctl; |
1260 | u8 reg_idx = ring->reg_idx; | 1303 | u8 reg_idx = ring->reg_idx; |
1261 | 1304 | ||
1305 | if (IXGBE_REMOVED(hw->hw_addr)) | ||
1306 | return; | ||
1262 | rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx)); | 1307 | rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx)); |
1263 | rxdctl &= ~IXGBE_RXDCTL_ENABLE; | 1308 | rxdctl &= ~IXGBE_RXDCTL_ENABLE; |
1264 | 1309 | ||
@@ -1284,6 +1329,8 @@ static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter, | |||
1284 | u32 rxdctl; | 1329 | u32 rxdctl; |
1285 | u8 reg_idx = ring->reg_idx; | 1330 | u8 reg_idx = ring->reg_idx; |
1286 | 1331 | ||
1332 | if (IXGBE_REMOVED(hw->hw_addr)) | ||
1333 | return; | ||
1287 | do { | 1334 | do { |
1288 | usleep_range(1000, 2000); | 1335 | usleep_range(1000, 2000); |
1289 | rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx)); | 1336 | rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx)); |
@@ -1318,7 +1365,7 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_adapter *adapter, | |||
1318 | /* reset head and tail pointers */ | 1365 | /* reset head and tail pointers */ |
1319 | IXGBE_WRITE_REG(hw, IXGBE_VFRDH(reg_idx), 0); | 1366 | IXGBE_WRITE_REG(hw, IXGBE_VFRDH(reg_idx), 0); |
1320 | IXGBE_WRITE_REG(hw, IXGBE_VFRDT(reg_idx), 0); | 1367 | IXGBE_WRITE_REG(hw, IXGBE_VFRDT(reg_idx), 0); |
1321 | ring->tail = hw->hw_addr + IXGBE_VFRDT(reg_idx); | 1368 | ring->tail = adapter->io_addr + IXGBE_VFRDT(reg_idx); |
1322 | 1369 | ||
1323 | /* reset ntu and ntc to place SW in sync with hardwdare */ | 1370 | /* reset ntu and ntc to place SW in sync with hardwdare */ |
1324 | ring->next_to_clean = 0; | 1371 | ring->next_to_clean = 0; |
@@ -2357,6 +2404,14 @@ static void ixgbevf_watchdog_task(struct work_struct *work) | |||
2357 | bool link_up = adapter->link_up; | 2404 | bool link_up = adapter->link_up; |
2358 | s32 need_reset; | 2405 | s32 need_reset; |
2359 | 2406 | ||
2407 | if (IXGBE_REMOVED(hw->hw_addr)) { | ||
2408 | if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) { | ||
2409 | rtnl_lock(); | ||
2410 | ixgbevf_down(adapter); | ||
2411 | rtnl_unlock(); | ||
2412 | } | ||
2413 | return; | ||
2414 | } | ||
2360 | ixgbevf_queue_reset_subtask(adapter); | 2415 | ixgbevf_queue_reset_subtask(adapter); |
2361 | 2416 | ||
2362 | adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK; | 2417 | adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK; |
@@ -3060,7 +3115,7 @@ static void ixgbevf_tx_map(struct ixgbevf_ring *tx_ring, | |||
3060 | tx_ring->next_to_use = i; | 3115 | tx_ring->next_to_use = i; |
3061 | 3116 | ||
3062 | /* notify HW of packet */ | 3117 | /* notify HW of packet */ |
3063 | writel(i, tx_ring->tail); | 3118 | ixgbevf_write_tail(tx_ring, i); |
3064 | 3119 | ||
3065 | return; | 3120 | return; |
3066 | dma_error: | 3121 | dma_error: |
@@ -3459,6 +3514,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3459 | 3514 | ||
3460 | hw->hw_addr = ioremap(pci_resource_start(pdev, 0), | 3515 | hw->hw_addr = ioremap(pci_resource_start(pdev, 0), |
3461 | pci_resource_len(pdev, 0)); | 3516 | pci_resource_len(pdev, 0)); |
3517 | adapter->io_addr = hw->hw_addr; | ||
3462 | if (!hw->hw_addr) { | 3518 | if (!hw->hw_addr) { |
3463 | err = -EIO; | 3519 | err = -EIO; |
3464 | goto err_ioremap; | 3520 | goto err_ioremap; |
@@ -3544,7 +3600,7 @@ err_register: | |||
3544 | ixgbevf_clear_interrupt_scheme(adapter); | 3600 | ixgbevf_clear_interrupt_scheme(adapter); |
3545 | err_sw_init: | 3601 | err_sw_init: |
3546 | ixgbevf_reset_interrupt_capability(adapter); | 3602 | ixgbevf_reset_interrupt_capability(adapter); |
3547 | iounmap(hw->hw_addr); | 3603 | iounmap(adapter->io_addr); |
3548 | err_ioremap: | 3604 | err_ioremap: |
3549 | free_netdev(netdev); | 3605 | free_netdev(netdev); |
3550 | err_alloc_etherdev: | 3606 | err_alloc_etherdev: |
@@ -3582,7 +3638,7 @@ static void ixgbevf_remove(struct pci_dev *pdev) | |||
3582 | ixgbevf_clear_interrupt_scheme(adapter); | 3638 | ixgbevf_clear_interrupt_scheme(adapter); |
3583 | ixgbevf_reset_interrupt_capability(adapter); | 3639 | ixgbevf_reset_interrupt_capability(adapter); |
3584 | 3640 | ||
3585 | iounmap(adapter->hw.hw_addr); | 3641 | iounmap(adapter->io_addr); |
3586 | pci_release_regions(pdev); | 3642 | pci_release_regions(pdev); |
3587 | 3643 | ||
3588 | hw_dbg(&adapter->hw, "Remove complete\n"); | 3644 | hw_dbg(&adapter->hw, "Remove complete\n"); |
diff --git a/drivers/net/ethernet/intel/ixgbevf/regs.h b/drivers/net/ethernet/intel/ixgbevf/regs.h index debd8c0e1f28..09dd8f698bea 100644 --- a/drivers/net/ethernet/intel/ixgbevf/regs.h +++ b/drivers/net/ethernet/intel/ixgbevf/regs.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 82599 Virtual Function driver | 3 | Intel 82599 Virtual Function driver |
4 | Copyright(c) 1999 - 2012 Intel Corporation. | 4 | Copyright(c) 1999 - 2014 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -70,16 +70,6 @@ | |||
70 | #define IXGBE_VFGOTC_MSB 0x02024 | 70 | #define IXGBE_VFGOTC_MSB 0x02024 |
71 | #define IXGBE_VFMPRC 0x01034 | 71 | #define IXGBE_VFMPRC 0x01034 |
72 | 72 | ||
73 | #define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg))) | ||
74 | |||
75 | #define IXGBE_READ_REG(a, reg) readl((a)->hw_addr + (reg)) | ||
76 | |||
77 | #define IXGBE_WRITE_REG_ARRAY(a, reg, offset, value) ( \ | ||
78 | writel((value), ((a)->hw_addr + (reg) + ((offset) << 2)))) | ||
79 | |||
80 | #define IXGBE_READ_REG_ARRAY(a, reg, offset) ( \ | ||
81 | readl((a)->hw_addr + (reg) + ((offset) << 2))) | ||
82 | |||
83 | #define IXGBE_WRITE_FLUSH(a) (IXGBE_READ_REG(a, IXGBE_VFSTATUS)) | 73 | #define IXGBE_WRITE_FLUSH(a) (IXGBE_READ_REG(a, IXGBE_VFSTATUS)) |
84 | 74 | ||
85 | #endif /* _IXGBEVF_REGS_H_ */ | 75 | #endif /* _IXGBEVF_REGS_H_ */ |
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h index 7b1f502d1716..096d33a59def 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.h +++ b/drivers/net/ethernet/intel/ixgbevf/vf.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 82599 Virtual Function driver | 3 | Intel 82599 Virtual Function driver |
4 | Copyright(c) 1999 - 2012 Intel Corporation. | 4 | Copyright(c) 1999 - 2014 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
@@ -172,6 +172,37 @@ struct ixgbevf_info { | |||
172 | const struct ixgbe_mac_operations *mac_ops; | 172 | const struct ixgbe_mac_operations *mac_ops; |
173 | }; | 173 | }; |
174 | 174 | ||
175 | #define IXGBE_FAILED_READ_REG 0xffffffffU | ||
176 | |||
177 | #define IXGBE_REMOVED(a) unlikely(!(a)) | ||
178 | |||
179 | static inline void ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 value) | ||
180 | { | ||
181 | u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr); | ||
182 | |||
183 | if (IXGBE_REMOVED(reg_addr)) | ||
184 | return; | ||
185 | writel(value, reg_addr + reg); | ||
186 | } | ||
187 | #define IXGBE_WRITE_REG(h, r, v) ixgbe_write_reg(h, r, v) | ||
188 | |||
189 | u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg); | ||
190 | #define IXGBE_READ_REG(h, r) ixgbe_read_reg(h, r) | ||
191 | |||
192 | static inline void ixgbe_write_reg_array(struct ixgbe_hw *hw, u32 reg, | ||
193 | u32 offset, u32 value) | ||
194 | { | ||
195 | ixgbe_write_reg(hw, reg + (offset << 2), value); | ||
196 | } | ||
197 | #define IXGBE_WRITE_REG_ARRAY(h, r, o, v) ixgbe_write_reg_array(h, r, o, v) | ||
198 | |||
199 | static inline u32 ixgbe_read_reg_array(struct ixgbe_hw *hw, u32 reg, | ||
200 | u32 offset) | ||
201 | { | ||
202 | return ixgbe_read_reg(hw, reg + (offset << 2)); | ||
203 | } | ||
204 | #define IXGBE_READ_REG_ARRAY(h, r, o) ixgbe_read_reg_array(h, r, o) | ||
205 | |||
175 | void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size); | 206 | void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size); |
176 | int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api); | 207 | int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api); |
177 | int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, | 208 | int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, |
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index f5685c0d0579..14ff8d64257d 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c | |||
@@ -2059,7 +2059,7 @@ jme_expand_header(struct jme_adapter *jme, struct sk_buff *skb) | |||
2059 | if (unlikely(skb_shinfo(skb)->gso_size && | 2059 | if (unlikely(skb_shinfo(skb)->gso_size && |
2060 | skb_header_cloned(skb) && | 2060 | skb_header_cloned(skb) && |
2061 | pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) { | 2061 | pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) { |
2062 | dev_kfree_skb(skb); | 2062 | dev_kfree_skb_any(skb); |
2063 | return -1; | 2063 | return -1; |
2064 | } | 2064 | } |
2065 | 2065 | ||
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index a2565ce22b7c..b7b8d74c22d9 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -730,7 +730,7 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb) | |||
730 | unlikely(tag_bytes & ~12)) { | 730 | unlikely(tag_bytes & ~12)) { |
731 | if (skb_checksum_help(skb) == 0) | 731 | if (skb_checksum_help(skb) == 0) |
732 | goto no_csum; | 732 | goto no_csum; |
733 | kfree_skb(skb); | 733 | dev_kfree_skb_any(skb); |
734 | return 1; | 734 | return 1; |
735 | } | 735 | } |
736 | 736 | ||
@@ -819,7 +819,7 @@ static netdev_tx_t mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
819 | if (txq->tx_ring_size - txq->tx_desc_count < MAX_SKB_FRAGS + 1) { | 819 | if (txq->tx_ring_size - txq->tx_desc_count < MAX_SKB_FRAGS + 1) { |
820 | if (net_ratelimit()) | 820 | if (net_ratelimit()) |
821 | netdev_err(dev, "tx queue full?!\n"); | 821 | netdev_err(dev, "tx queue full?!\n"); |
822 | kfree_skb(skb); | 822 | dev_kfree_skb_any(skb); |
823 | return NETDEV_TX_OK; | 823 | return NETDEV_TX_OK; |
824 | } | 824 | } |
825 | 825 | ||
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 597846193869..7f81ae66cc89 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
@@ -2845,7 +2845,7 @@ mapping_unwind: | |||
2845 | mapping_error: | 2845 | mapping_error: |
2846 | if (net_ratelimit()) | 2846 | if (net_ratelimit()) |
2847 | dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name); | 2847 | dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name); |
2848 | dev_kfree_skb(skb); | 2848 | dev_kfree_skb_any(skb); |
2849 | return NETDEV_TX_OK; | 2849 | return NETDEV_TX_OK; |
2850 | } | 2850 | } |
2851 | 2851 | ||
@@ -3172,7 +3172,7 @@ static void skge_tx_done(struct net_device *dev) | |||
3172 | pkts_compl++; | 3172 | pkts_compl++; |
3173 | bytes_compl += e->skb->len; | 3173 | bytes_compl += e->skb->len; |
3174 | 3174 | ||
3175 | dev_kfree_skb(e->skb); | 3175 | dev_consume_skb_any(e->skb); |
3176 | } | 3176 | } |
3177 | } | 3177 | } |
3178 | netdev_completed_queue(dev, pkts_compl, bytes_compl); | 3178 | netdev_completed_queue(dev, pkts_compl, bytes_compl); |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index d524676fdff4..b81106451a0a 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -2002,7 +2002,7 @@ mapping_unwind: | |||
2002 | mapping_error: | 2002 | mapping_error: |
2003 | if (net_ratelimit()) | 2003 | if (net_ratelimit()) |
2004 | dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name); | 2004 | dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name); |
2005 | dev_kfree_skb(skb); | 2005 | dev_kfree_skb_any(skb); |
2006 | return NETDEV_TX_OK; | 2006 | return NETDEV_TX_OK; |
2007 | } | 2007 | } |
2008 | 2008 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c index abaf6bb22416..57dda95b67d8 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c | |||
@@ -276,6 +276,7 @@ static const struct ptp_clock_info mlx4_en_ptp_clock_info = { | |||
276 | .n_alarm = 0, | 276 | .n_alarm = 0, |
277 | .n_ext_ts = 0, | 277 | .n_ext_ts = 0, |
278 | .n_per_out = 0, | 278 | .n_per_out = 0, |
279 | .n_pins = 0, | ||
279 | .pps = 0, | 280 | .pps = 0, |
280 | .adjfreq = mlx4_en_phc_adjfreq, | 281 | .adjfreq = mlx4_en_phc_adjfreq, |
281 | .adjtime = mlx4_en_phc_adjtime, | 282 | .adjtime = mlx4_en_phc_adjtime, |
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index ce84dc289c8f..14ac0e2bc09f 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c | |||
@@ -4832,7 +4832,7 @@ static inline void copy_old_skb(struct sk_buff *old, struct sk_buff *skb) | |||
4832 | skb->csum = old->csum; | 4832 | skb->csum = old->csum; |
4833 | skb_set_network_header(skb, ETH_HLEN); | 4833 | skb_set_network_header(skb, ETH_HLEN); |
4834 | 4834 | ||
4835 | dev_kfree_skb(old); | 4835 | dev_consume_skb_any(old); |
4836 | } | 4836 | } |
4837 | 4837 | ||
4838 | /** | 4838 | /** |
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index d44fdb91808e..a2844ff322c4 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c | |||
@@ -4049,7 +4049,7 @@ static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4049 | if (!is_s2io_card_up(sp)) { | 4049 | if (!is_s2io_card_up(sp)) { |
4050 | DBG_PRINT(TX_DBG, "%s: Card going down for reset\n", | 4050 | DBG_PRINT(TX_DBG, "%s: Card going down for reset\n", |
4051 | dev->name); | 4051 | dev->name); |
4052 | dev_kfree_skb(skb); | 4052 | dev_kfree_skb_any(skb); |
4053 | return NETDEV_TX_OK; | 4053 | return NETDEV_TX_OK; |
4054 | } | 4054 | } |
4055 | 4055 | ||
@@ -4122,7 +4122,7 @@ static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4122 | ((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) { | 4122 | ((put_off+1) == queue_len ? 0 : (put_off+1)) == get_off) { |
4123 | DBG_PRINT(TX_DBG, "Error in xmit, No free TXDs.\n"); | 4123 | DBG_PRINT(TX_DBG, "Error in xmit, No free TXDs.\n"); |
4124 | s2io_stop_tx_queue(sp, fifo->fifo_no); | 4124 | s2io_stop_tx_queue(sp, fifo->fifo_no); |
4125 | dev_kfree_skb(skb); | 4125 | dev_kfree_skb_any(skb); |
4126 | spin_unlock_irqrestore(&fifo->tx_lock, flags); | 4126 | spin_unlock_irqrestore(&fifo->tx_lock, flags); |
4127 | return NETDEV_TX_OK; | 4127 | return NETDEV_TX_OK; |
4128 | } | 4128 | } |
@@ -4244,7 +4244,7 @@ pci_map_failed: | |||
4244 | swstats->pci_map_fail_cnt++; | 4244 | swstats->pci_map_fail_cnt++; |
4245 | s2io_stop_tx_queue(sp, fifo->fifo_no); | 4245 | s2io_stop_tx_queue(sp, fifo->fifo_no); |
4246 | swstats->mem_freed += skb->truesize; | 4246 | swstats->mem_freed += skb->truesize; |
4247 | dev_kfree_skb(skb); | 4247 | dev_kfree_skb_any(skb); |
4248 | spin_unlock_irqrestore(&fifo->tx_lock, flags); | 4248 | spin_unlock_irqrestore(&fifo->tx_lock, flags); |
4249 | return NETDEV_TX_OK; | 4249 | return NETDEV_TX_OK; |
4250 | } | 4250 | } |
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index 11adc89959c1..d107bcbb8543 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c | |||
@@ -824,7 +824,7 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev) | |||
824 | if (unlikely(skb->len <= 0)) { | 824 | if (unlikely(skb->len <= 0)) { |
825 | vxge_debug_tx(VXGE_ERR, | 825 | vxge_debug_tx(VXGE_ERR, |
826 | "%s: Buffer has no data..", dev->name); | 826 | "%s: Buffer has no data..", dev->name); |
827 | dev_kfree_skb(skb); | 827 | dev_kfree_skb_any(skb); |
828 | return NETDEV_TX_OK; | 828 | return NETDEV_TX_OK; |
829 | } | 829 | } |
830 | 830 | ||
@@ -833,7 +833,7 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev) | |||
833 | if (unlikely(!is_vxge_card_up(vdev))) { | 833 | if (unlikely(!is_vxge_card_up(vdev))) { |
834 | vxge_debug_tx(VXGE_ERR, | 834 | vxge_debug_tx(VXGE_ERR, |
835 | "%s: vdev not initialized", dev->name); | 835 | "%s: vdev not initialized", dev->name); |
836 | dev_kfree_skb(skb); | 836 | dev_kfree_skb_any(skb); |
837 | return NETDEV_TX_OK; | 837 | return NETDEV_TX_OK; |
838 | } | 838 | } |
839 | 839 | ||
@@ -843,7 +843,7 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev) | |||
843 | vxge_debug_tx(VXGE_ERR, | 843 | vxge_debug_tx(VXGE_ERR, |
844 | "%s: Failed to store the mac address", | 844 | "%s: Failed to store the mac address", |
845 | dev->name); | 845 | dev->name); |
846 | dev_kfree_skb(skb); | 846 | dev_kfree_skb_any(skb); |
847 | return NETDEV_TX_OK; | 847 | return NETDEV_TX_OK; |
848 | } | 848 | } |
849 | } | 849 | } |
@@ -990,7 +990,7 @@ _exit1: | |||
990 | vxge_hw_fifo_txdl_free(fifo_hw, dtr); | 990 | vxge_hw_fifo_txdl_free(fifo_hw, dtr); |
991 | _exit0: | 991 | _exit0: |
992 | netif_tx_stop_queue(fifo->txq); | 992 | netif_tx_stop_queue(fifo->txq); |
993 | dev_kfree_skb(skb); | 993 | dev_kfree_skb_any(skb); |
994 | 994 | ||
995 | return NETDEV_TX_OK; | 995 | return NETDEV_TX_OK; |
996 | } | 996 | } |
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 811be0bccd14..fddb464aeab3 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c | |||
@@ -2231,7 +2231,7 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2231 | if (pci_dma_mapping_error(np->pci_dev, | 2231 | if (pci_dma_mapping_error(np->pci_dev, |
2232 | np->put_tx_ctx->dma)) { | 2232 | np->put_tx_ctx->dma)) { |
2233 | /* on DMA mapping error - drop the packet */ | 2233 | /* on DMA mapping error - drop the packet */ |
2234 | kfree_skb(skb); | 2234 | dev_kfree_skb_any(skb); |
2235 | u64_stats_update_begin(&np->swstats_tx_syncp); | 2235 | u64_stats_update_begin(&np->swstats_tx_syncp); |
2236 | np->stat_tx_dropped++; | 2236 | np->stat_tx_dropped++; |
2237 | u64_stats_update_end(&np->swstats_tx_syncp); | 2237 | u64_stats_update_end(&np->swstats_tx_syncp); |
@@ -2277,7 +2277,7 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2277 | if (unlikely(tmp_tx_ctx++ == np->last_tx_ctx)) | 2277 | if (unlikely(tmp_tx_ctx++ == np->last_tx_ctx)) |
2278 | tmp_tx_ctx = np->first_tx_ctx; | 2278 | tmp_tx_ctx = np->first_tx_ctx; |
2279 | } while (tmp_tx_ctx != np->put_tx_ctx); | 2279 | } while (tmp_tx_ctx != np->put_tx_ctx); |
2280 | kfree_skb(skb); | 2280 | dev_kfree_skb_any(skb); |
2281 | np->put_tx_ctx = start_tx_ctx; | 2281 | np->put_tx_ctx = start_tx_ctx; |
2282 | u64_stats_update_begin(&np->swstats_tx_syncp); | 2282 | u64_stats_update_begin(&np->swstats_tx_syncp); |
2283 | np->stat_tx_dropped++; | 2283 | np->stat_tx_dropped++; |
@@ -2380,7 +2380,7 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb, | |||
2380 | if (pci_dma_mapping_error(np->pci_dev, | 2380 | if (pci_dma_mapping_error(np->pci_dev, |
2381 | np->put_tx_ctx->dma)) { | 2381 | np->put_tx_ctx->dma)) { |
2382 | /* on DMA mapping error - drop the packet */ | 2382 | /* on DMA mapping error - drop the packet */ |
2383 | kfree_skb(skb); | 2383 | dev_kfree_skb_any(skb); |
2384 | u64_stats_update_begin(&np->swstats_tx_syncp); | 2384 | u64_stats_update_begin(&np->swstats_tx_syncp); |
2385 | np->stat_tx_dropped++; | 2385 | np->stat_tx_dropped++; |
2386 | u64_stats_update_end(&np->swstats_tx_syncp); | 2386 | u64_stats_update_end(&np->swstats_tx_syncp); |
@@ -2427,7 +2427,7 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb, | |||
2427 | if (unlikely(tmp_tx_ctx++ == np->last_tx_ctx)) | 2427 | if (unlikely(tmp_tx_ctx++ == np->last_tx_ctx)) |
2428 | tmp_tx_ctx = np->first_tx_ctx; | 2428 | tmp_tx_ctx = np->first_tx_ctx; |
2429 | } while (tmp_tx_ctx != np->put_tx_ctx); | 2429 | } while (tmp_tx_ctx != np->put_tx_ctx); |
2430 | kfree_skb(skb); | 2430 | dev_kfree_skb_any(skb); |
2431 | np->put_tx_ctx = start_tx_ctx; | 2431 | np->put_tx_ctx = start_tx_ctx; |
2432 | u64_stats_update_begin(&np->swstats_tx_syncp); | 2432 | u64_stats_update_begin(&np->swstats_tx_syncp); |
2433 | np->stat_tx_dropped++; | 2433 | np->stat_tx_dropped++; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index df9daa335292..b9039b569beb 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -38,8 +38,8 @@ | |||
38 | 38 | ||
39 | #define _QLCNIC_LINUX_MAJOR 5 | 39 | #define _QLCNIC_LINUX_MAJOR 5 |
40 | #define _QLCNIC_LINUX_MINOR 3 | 40 | #define _QLCNIC_LINUX_MINOR 3 |
41 | #define _QLCNIC_LINUX_SUBVERSION 56 | 41 | #define _QLCNIC_LINUX_SUBVERSION 57 |
42 | #define QLCNIC_LINUX_VERSIONID "5.3.56" | 42 | #define QLCNIC_LINUX_VERSIONID "5.3.57" |
43 | #define QLCNIC_DRV_IDC_VER 0x01 | 43 | #define QLCNIC_DRV_IDC_VER 0x01 |
44 | #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ | 44 | #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ |
45 | (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) | 45 | (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) |
@@ -169,11 +169,20 @@ struct cmd_desc_type0 { | |||
169 | 169 | ||
170 | __le64 addr_buffer2; | 170 | __le64 addr_buffer2; |
171 | 171 | ||
172 | __le16 reference_handle; | 172 | __le16 encap_descr; /* 15:10 offset of outer L3 header, |
173 | * 9:6 number of 32bit words in outer L3 header, | ||
174 | * 5 offload outer L4 checksum, | ||
175 | * 4 offload outer L3 checksum, | ||
176 | * 3 Inner L4 type, TCP=0, UDP=1, | ||
177 | * 2 Inner L3 type, IPv4=0, IPv6=1, | ||
178 | * 1 Outer L3 type,IPv4=0, IPv6=1, | ||
179 | * 0 type of encapsulation, GRE=0, VXLAN=1 | ||
180 | */ | ||
173 | __le16 mss; | 181 | __le16 mss; |
174 | u8 port_ctxid; /* 7:4 ctxid 3:0 port */ | 182 | u8 port_ctxid; /* 7:4 ctxid 3:0 port */ |
175 | u8 total_hdr_length; /* LSO only : MAC+IP+TCP Hdr size */ | 183 | u8 hdr_length; /* LSO only : MAC+IP+TCP Hdr size */ |
176 | __le16 conn_id; /* IPSec offoad only */ | 184 | u8 outer_hdr_length; /* Encapsulation only */ |
185 | u8 rsvd1; | ||
177 | 186 | ||
178 | __le64 addr_buffer3; | 187 | __le64 addr_buffer3; |
179 | __le64 addr_buffer1; | 188 | __le64 addr_buffer1; |
@@ -183,7 +192,9 @@ struct cmd_desc_type0 { | |||
183 | __le64 addr_buffer4; | 192 | __le64 addr_buffer4; |
184 | 193 | ||
185 | u8 eth_addr[ETH_ALEN]; | 194 | u8 eth_addr[ETH_ALEN]; |
186 | __le16 vlan_TCI; | 195 | __le16 vlan_TCI; /* In case of encapsulation, |
196 | * this is for outer VLAN | ||
197 | */ | ||
187 | 198 | ||
188 | } __attribute__ ((aligned(64))); | 199 | } __attribute__ ((aligned(64))); |
189 | 200 | ||
@@ -524,6 +535,7 @@ struct qlcnic_hardware_context { | |||
524 | u8 extend_lb_time; | 535 | u8 extend_lb_time; |
525 | u8 phys_port_id[ETH_ALEN]; | 536 | u8 phys_port_id[ETH_ALEN]; |
526 | u8 lb_mode; | 537 | u8 lb_mode; |
538 | u16 vxlan_port; | ||
527 | }; | 539 | }; |
528 | 540 | ||
529 | struct qlcnic_adapter_stats { | 541 | struct qlcnic_adapter_stats { |
@@ -538,6 +550,9 @@ struct qlcnic_adapter_stats { | |||
538 | u64 txbytes; | 550 | u64 txbytes; |
539 | u64 lrobytes; | 551 | u64 lrobytes; |
540 | u64 lso_frames; | 552 | u64 lso_frames; |
553 | u64 encap_lso_frames; | ||
554 | u64 encap_tx_csummed; | ||
555 | u64 encap_rx_csummed; | ||
541 | u64 xmit_on; | 556 | u64 xmit_on; |
542 | u64 xmit_off; | 557 | u64 xmit_off; |
543 | u64 skb_alloc_failure; | 558 | u64 skb_alloc_failure; |
@@ -899,6 +914,10 @@ struct qlcnic_mac_vlan_list { | |||
899 | #define QLCNIC_FW_CAPABILITY_2_BEACON BIT_7 | 914 | #define QLCNIC_FW_CAPABILITY_2_BEACON BIT_7 |
900 | #define QLCNIC_FW_CAPABILITY_2_PER_PORT_ESWITCH_CFG BIT_9 | 915 | #define QLCNIC_FW_CAPABILITY_2_PER_PORT_ESWITCH_CFG BIT_9 |
901 | 916 | ||
917 | #define QLCNIC_83XX_FW_CAPAB_ENCAP_RX_OFFLOAD BIT_0 | ||
918 | #define QLCNIC_83XX_FW_CAPAB_ENCAP_TX_OFFLOAD BIT_1 | ||
919 | #define QLCNIC_83XX_FW_CAPAB_ENCAP_CKO_OFFLOAD BIT_4 | ||
920 | |||
902 | /* module types */ | 921 | /* module types */ |
903 | #define LINKEVENT_MODULE_NOT_PRESENT 1 | 922 | #define LINKEVENT_MODULE_NOT_PRESENT 1 |
904 | #define LINKEVENT_MODULE_OPTICAL_UNKNOWN 2 | 923 | #define LINKEVENT_MODULE_OPTICAL_UNKNOWN 2 |
@@ -992,6 +1011,8 @@ struct qlcnic_ipaddr { | |||
992 | #define QLCNIC_APP_CHANGED_FLAGS 0x20000 | 1011 | #define QLCNIC_APP_CHANGED_FLAGS 0x20000 |
993 | #define QLCNIC_HAS_PHYS_PORT_ID 0x40000 | 1012 | #define QLCNIC_HAS_PHYS_PORT_ID 0x40000 |
994 | #define QLCNIC_TSS_RSS 0x80000 | 1013 | #define QLCNIC_TSS_RSS 0x80000 |
1014 | #define QLCNIC_ADD_VXLAN_PORT 0x100000 | ||
1015 | #define QLCNIC_DEL_VXLAN_PORT 0x200000 | ||
995 | 1016 | ||
996 | #define QLCNIC_IS_MSI_FAMILY(adapter) \ | 1017 | #define QLCNIC_IS_MSI_FAMILY(adapter) \ |
997 | ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) | 1018 | ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) |
@@ -1806,6 +1827,18 @@ struct qlcnic_hardware_ops { | |||
1806 | 1827 | ||
1807 | extern struct qlcnic_nic_template qlcnic_vf_ops; | 1828 | extern struct qlcnic_nic_template qlcnic_vf_ops; |
1808 | 1829 | ||
1830 | static inline bool qlcnic_encap_tx_offload(struct qlcnic_adapter *adapter) | ||
1831 | { | ||
1832 | return adapter->ahw->extra_capability[0] & | ||
1833 | QLCNIC_83XX_FW_CAPAB_ENCAP_TX_OFFLOAD; | ||
1834 | } | ||
1835 | |||
1836 | static inline bool qlcnic_encap_rx_offload(struct qlcnic_adapter *adapter) | ||
1837 | { | ||
1838 | return adapter->ahw->extra_capability[0] & | ||
1839 | QLCNIC_83XX_FW_CAPAB_ENCAP_RX_OFFLOAD; | ||
1840 | } | ||
1841 | |||
1809 | static inline int qlcnic_start_firmware(struct qlcnic_adapter *adapter) | 1842 | static inline int qlcnic_start_firmware(struct qlcnic_adapter *adapter) |
1810 | { | 1843 | { |
1811 | return adapter->nic_ops->start_firmware(adapter); | 1844 | return adapter->nic_ops->start_firmware(adapter); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 3b83fbde4975..b7cffb46a75d 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -77,7 +77,7 @@ static const struct qlcnic_mailbox_metadata qlcnic_83xx_mbx_tbl[] = { | |||
77 | {QLCNIC_CMD_GET_PORT_CONFIG, 2, 2}, | 77 | {QLCNIC_CMD_GET_PORT_CONFIG, 2, 2}, |
78 | {QLCNIC_CMD_GET_LINK_STATUS, 2, 4}, | 78 | {QLCNIC_CMD_GET_LINK_STATUS, 2, 4}, |
79 | {QLCNIC_CMD_IDC_ACK, 5, 1}, | 79 | {QLCNIC_CMD_IDC_ACK, 5, 1}, |
80 | {QLCNIC_CMD_INIT_NIC_FUNC, 2, 1}, | 80 | {QLCNIC_CMD_INIT_NIC_FUNC, 3, 1}, |
81 | {QLCNIC_CMD_STOP_NIC_FUNC, 2, 1}, | 81 | {QLCNIC_CMD_STOP_NIC_FUNC, 2, 1}, |
82 | {QLCNIC_CMD_SET_LED_CONFIG, 5, 1}, | 82 | {QLCNIC_CMD_SET_LED_CONFIG, 5, 1}, |
83 | {QLCNIC_CMD_GET_LED_CONFIG, 1, 5}, | 83 | {QLCNIC_CMD_GET_LED_CONFIG, 1, 5}, |
@@ -87,6 +87,7 @@ static const struct qlcnic_mailbox_metadata qlcnic_83xx_mbx_tbl[] = { | |||
87 | {QLCNIC_CMD_BC_EVENT_SETUP, 2, 1}, | 87 | {QLCNIC_CMD_BC_EVENT_SETUP, 2, 1}, |
88 | {QLCNIC_CMD_DCB_QUERY_CAP, 1, 2}, | 88 | {QLCNIC_CMD_DCB_QUERY_CAP, 1, 2}, |
89 | {QLCNIC_CMD_DCB_QUERY_PARAM, 1, 50}, | 89 | {QLCNIC_CMD_DCB_QUERY_PARAM, 1, 50}, |
90 | {QLCNIC_CMD_SET_INGRESS_ENCAP, 2, 1}, | ||
90 | }; | 91 | }; |
91 | 92 | ||
92 | const u32 qlcnic_83xx_ext_reg_tbl[] = { | 93 | const u32 qlcnic_83xx_ext_reg_tbl[] = { |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h index 81c1889f6f3e..88d809c35633 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | |||
@@ -528,8 +528,9 @@ enum qlc_83xx_ext_regs { | |||
528 | }; | 528 | }; |
529 | 529 | ||
530 | /* Initialize/Stop NIC command bit definitions */ | 530 | /* Initialize/Stop NIC command bit definitions */ |
531 | #define QLC_REGISTER_DCB_AEN BIT_1 | ||
532 | #define QLC_REGISTER_LB_IDC BIT_0 | 531 | #define QLC_REGISTER_LB_IDC BIT_0 |
532 | #define QLC_REGISTER_DCB_AEN BIT_1 | ||
533 | #define QLC_83XX_MULTI_TENANCY_INFO BIT_29 | ||
533 | #define QLC_INIT_FW_RESOURCES BIT_31 | 534 | #define QLC_INIT_FW_RESOURCES BIT_31 |
534 | 535 | ||
535 | /* 83xx funcitons */ | 536 | /* 83xx funcitons */ |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index 90a2dda351ec..ec399b7f5bd7 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -1020,10 +1020,97 @@ static int qlcnic_83xx_idc_check_state_validity(struct qlcnic_adapter *adapter, | |||
1020 | return 0; | 1020 | return 0; |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | #define QLC_83XX_ENCAP_TYPE_VXLAN BIT_1 | ||
1024 | #define QLC_83XX_MATCH_ENCAP_ID BIT_2 | ||
1025 | #define QLC_83XX_SET_VXLAN_UDP_DPORT BIT_3 | ||
1026 | #define QLC_83XX_VXLAN_UDP_DPORT(PORT) ((PORT & 0xffff) << 16) | ||
1027 | |||
1028 | #define QLCNIC_ENABLE_INGRESS_ENCAP_PARSING 1 | ||
1029 | #define QLCNIC_DISABLE_INGRESS_ENCAP_PARSING 0 | ||
1030 | |||
1031 | static int qlcnic_set_vxlan_port(struct qlcnic_adapter *adapter) | ||
1032 | { | ||
1033 | u16 port = adapter->ahw->vxlan_port; | ||
1034 | struct qlcnic_cmd_args cmd; | ||
1035 | int ret = 0; | ||
1036 | |||
1037 | memset(&cmd, 0, sizeof(cmd)); | ||
1038 | |||
1039 | ret = qlcnic_alloc_mbx_args(&cmd, adapter, | ||
1040 | QLCNIC_CMD_INIT_NIC_FUNC); | ||
1041 | if (ret) | ||
1042 | return ret; | ||
1043 | |||
1044 | cmd.req.arg[1] = QLC_83XX_MULTI_TENANCY_INFO; | ||
1045 | cmd.req.arg[2] = QLC_83XX_ENCAP_TYPE_VXLAN | | ||
1046 | QLC_83XX_SET_VXLAN_UDP_DPORT | | ||
1047 | QLC_83XX_VXLAN_UDP_DPORT(port); | ||
1048 | |||
1049 | ret = qlcnic_issue_cmd(adapter, &cmd); | ||
1050 | if (ret) | ||
1051 | netdev_err(adapter->netdev, | ||
1052 | "Failed to set VXLAN port %d in adapter\n", | ||
1053 | port); | ||
1054 | |||
1055 | qlcnic_free_mbx_args(&cmd); | ||
1056 | |||
1057 | return ret; | ||
1058 | } | ||
1059 | |||
1060 | static int qlcnic_set_vxlan_parsing(struct qlcnic_adapter *adapter, | ||
1061 | bool state) | ||
1062 | { | ||
1063 | u16 vxlan_port = adapter->ahw->vxlan_port; | ||
1064 | struct qlcnic_cmd_args cmd; | ||
1065 | int ret = 0; | ||
1066 | |||
1067 | memset(&cmd, 0, sizeof(cmd)); | ||
1068 | |||
1069 | ret = qlcnic_alloc_mbx_args(&cmd, adapter, | ||
1070 | QLCNIC_CMD_SET_INGRESS_ENCAP); | ||
1071 | if (ret) | ||
1072 | return ret; | ||
1073 | |||
1074 | cmd.req.arg[1] = state ? QLCNIC_ENABLE_INGRESS_ENCAP_PARSING : | ||
1075 | QLCNIC_DISABLE_INGRESS_ENCAP_PARSING; | ||
1076 | |||
1077 | ret = qlcnic_issue_cmd(adapter, &cmd); | ||
1078 | if (ret) | ||
1079 | netdev_err(adapter->netdev, | ||
1080 | "Failed to %s VXLAN parsing for port %d\n", | ||
1081 | state ? "enable" : "disable", vxlan_port); | ||
1082 | else | ||
1083 | netdev_info(adapter->netdev, | ||
1084 | "%s VXLAN parsing for port %d\n", | ||
1085 | state ? "Enabled" : "Disabled", vxlan_port); | ||
1086 | |||
1087 | qlcnic_free_mbx_args(&cmd); | ||
1088 | |||
1089 | return ret; | ||
1090 | } | ||
1091 | |||
1023 | static void qlcnic_83xx_periodic_tasks(struct qlcnic_adapter *adapter) | 1092 | static void qlcnic_83xx_periodic_tasks(struct qlcnic_adapter *adapter) |
1024 | { | 1093 | { |
1094 | struct qlcnic_hardware_context *ahw = adapter->ahw; | ||
1095 | |||
1025 | if (adapter->fhash.fnum) | 1096 | if (adapter->fhash.fnum) |
1026 | qlcnic_prune_lb_filters(adapter); | 1097 | qlcnic_prune_lb_filters(adapter); |
1098 | |||
1099 | if (adapter->flags & QLCNIC_ADD_VXLAN_PORT) { | ||
1100 | if (qlcnic_set_vxlan_port(adapter)) | ||
1101 | return; | ||
1102 | |||
1103 | if (qlcnic_set_vxlan_parsing(adapter, true)) | ||
1104 | return; | ||
1105 | |||
1106 | adapter->flags &= ~QLCNIC_ADD_VXLAN_PORT; | ||
1107 | } else if (adapter->flags & QLCNIC_DEL_VXLAN_PORT) { | ||
1108 | if (qlcnic_set_vxlan_parsing(adapter, false)) | ||
1109 | return; | ||
1110 | |||
1111 | ahw->vxlan_port = 0; | ||
1112 | adapter->flags &= ~QLCNIC_DEL_VXLAN_PORT; | ||
1113 | } | ||
1027 | } | 1114 | } |
1028 | 1115 | ||
1029 | /** | 1116 | /** |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 1960609481ce..5bacf5210aed 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -47,6 +47,12 @@ static const struct qlcnic_stats qlcnic_gstrings_stats[] = { | |||
47 | {"lro_pkts", QLC_SIZEOF(stats.lro_pkts), QLC_OFF(stats.lro_pkts)}, | 47 | {"lro_pkts", QLC_SIZEOF(stats.lro_pkts), QLC_OFF(stats.lro_pkts)}, |
48 | {"lrobytes", QLC_SIZEOF(stats.lrobytes), QLC_OFF(stats.lrobytes)}, | 48 | {"lrobytes", QLC_SIZEOF(stats.lrobytes), QLC_OFF(stats.lrobytes)}, |
49 | {"lso_frames", QLC_SIZEOF(stats.lso_frames), QLC_OFF(stats.lso_frames)}, | 49 | {"lso_frames", QLC_SIZEOF(stats.lso_frames), QLC_OFF(stats.lso_frames)}, |
50 | {"encap_lso_frames", QLC_SIZEOF(stats.encap_lso_frames), | ||
51 | QLC_OFF(stats.encap_lso_frames)}, | ||
52 | {"encap_tx_csummed", QLC_SIZEOF(stats.encap_tx_csummed), | ||
53 | QLC_OFF(stats.encap_tx_csummed)}, | ||
54 | {"encap_rx_csummed", QLC_SIZEOF(stats.encap_rx_csummed), | ||
55 | QLC_OFF(stats.encap_rx_csummed)}, | ||
50 | {"skb_alloc_failure", QLC_SIZEOF(stats.skb_alloc_failure), | 56 | {"skb_alloc_failure", QLC_SIZEOF(stats.skb_alloc_failure), |
51 | QLC_OFF(stats.skb_alloc_failure)}, | 57 | QLC_OFF(stats.skb_alloc_failure)}, |
52 | {"mac_filter_limit_overrun", QLC_SIZEOF(stats.mac_filter_limit_overrun), | 58 | {"mac_filter_limit_overrun", QLC_SIZEOF(stats.mac_filter_limit_overrun), |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h index 576b301b11ef..cbe2399c30a0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h | |||
@@ -98,6 +98,7 @@ enum qlcnic_regs { | |||
98 | #define QLCNIC_CMD_GET_LINK_EVENT 0x48 | 98 | #define QLCNIC_CMD_GET_LINK_EVENT 0x48 |
99 | #define QLCNIC_CMD_CONFIGURE_MAC_RX_MODE 0x49 | 99 | #define QLCNIC_CMD_CONFIGURE_MAC_RX_MODE 0x49 |
100 | #define QLCNIC_CMD_CONFIGURE_HW_LRO 0x4A | 100 | #define QLCNIC_CMD_CONFIGURE_HW_LRO 0x4A |
101 | #define QLCNIC_CMD_SET_INGRESS_ENCAP 0x4E | ||
101 | #define QLCNIC_CMD_INIT_NIC_FUNC 0x60 | 102 | #define QLCNIC_CMD_INIT_NIC_FUNC 0x60 |
102 | #define QLCNIC_CMD_STOP_NIC_FUNC 0x61 | 103 | #define QLCNIC_CMD_STOP_NIC_FUNC 0x61 |
103 | #define QLCNIC_CMD_IDC_ACK 0x63 | 104 | #define QLCNIC_CMD_IDC_ACK 0x63 |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index 54ebf300332a..173b3d12991f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | |||
@@ -13,16 +13,19 @@ | |||
13 | 13 | ||
14 | #include "qlcnic.h" | 14 | #include "qlcnic.h" |
15 | 15 | ||
16 | #define TX_ETHER_PKT 0x01 | 16 | #define QLCNIC_TX_ETHER_PKT 0x01 |
17 | #define TX_TCP_PKT 0x02 | 17 | #define QLCNIC_TX_TCP_PKT 0x02 |
18 | #define TX_UDP_PKT 0x03 | 18 | #define QLCNIC_TX_UDP_PKT 0x03 |
19 | #define TX_IP_PKT 0x04 | 19 | #define QLCNIC_TX_IP_PKT 0x04 |
20 | #define TX_TCP_LSO 0x05 | 20 | #define QLCNIC_TX_TCP_LSO 0x05 |
21 | #define TX_TCP_LSO6 0x06 | 21 | #define QLCNIC_TX_TCP_LSO6 0x06 |
22 | #define TX_TCPV6_PKT 0x0b | 22 | #define QLCNIC_TX_ENCAP_PKT 0x07 |
23 | #define TX_UDPV6_PKT 0x0c | 23 | #define QLCNIC_TX_ENCAP_LSO 0x08 |
24 | #define FLAGS_VLAN_TAGGED 0x10 | 24 | #define QLCNIC_TX_TCPV6_PKT 0x0b |
25 | #define FLAGS_VLAN_OOB 0x40 | 25 | #define QLCNIC_TX_UDPV6_PKT 0x0c |
26 | |||
27 | #define QLCNIC_FLAGS_VLAN_TAGGED 0x10 | ||
28 | #define QLCNIC_FLAGS_VLAN_OOB 0x40 | ||
26 | 29 | ||
27 | #define qlcnic_set_tx_vlan_tci(cmd_desc, v) \ | 30 | #define qlcnic_set_tx_vlan_tci(cmd_desc, v) \ |
28 | (cmd_desc)->vlan_TCI = cpu_to_le16(v); | 31 | (cmd_desc)->vlan_TCI = cpu_to_le16(v); |
@@ -364,6 +367,101 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, | |||
364 | spin_unlock(&adapter->mac_learn_lock); | 367 | spin_unlock(&adapter->mac_learn_lock); |
365 | } | 368 | } |
366 | 369 | ||
370 | #define QLCNIC_ENCAP_VXLAN_PKT BIT_0 | ||
371 | #define QLCNIC_ENCAP_OUTER_L3_IP6 BIT_1 | ||
372 | #define QLCNIC_ENCAP_INNER_L3_IP6 BIT_2 | ||
373 | #define QLCNIC_ENCAP_INNER_L4_UDP BIT_3 | ||
374 | #define QLCNIC_ENCAP_DO_L3_CSUM BIT_4 | ||
375 | #define QLCNIC_ENCAP_DO_L4_CSUM BIT_5 | ||
376 | |||
377 | static int qlcnic_tx_encap_pkt(struct qlcnic_adapter *adapter, | ||
378 | struct cmd_desc_type0 *first_desc, | ||
379 | struct sk_buff *skb, | ||
380 | struct qlcnic_host_tx_ring *tx_ring) | ||
381 | { | ||
382 | u8 opcode = 0, inner_hdr_len = 0, outer_hdr_len = 0, total_hdr_len = 0; | ||
383 | int copied, copy_len, descr_size; | ||
384 | u32 producer = tx_ring->producer; | ||
385 | struct cmd_desc_type0 *hwdesc; | ||
386 | u16 flags = 0, encap_descr = 0; | ||
387 | |||
388 | opcode = QLCNIC_TX_ETHER_PKT; | ||
389 | encap_descr = QLCNIC_ENCAP_VXLAN_PKT; | ||
390 | |||
391 | if (skb_is_gso(skb)) { | ||
392 | inner_hdr_len = skb_inner_transport_header(skb) + | ||
393 | inner_tcp_hdrlen(skb) - | ||
394 | skb_inner_mac_header(skb); | ||
395 | |||
396 | /* VXLAN header size = 8 */ | ||
397 | outer_hdr_len = skb_transport_offset(skb) + 8 + | ||
398 | sizeof(struct udphdr); | ||
399 | first_desc->outer_hdr_length = outer_hdr_len; | ||
400 | total_hdr_len = inner_hdr_len + outer_hdr_len; | ||
401 | encap_descr |= QLCNIC_ENCAP_DO_L3_CSUM | | ||
402 | QLCNIC_ENCAP_DO_L4_CSUM; | ||
403 | first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | ||
404 | first_desc->hdr_length = inner_hdr_len; | ||
405 | |||
406 | /* Copy inner and outer headers in Tx descriptor(s) | ||
407 | * If total_hdr_len > cmd_desc_type0, use multiple | ||
408 | * descriptors | ||
409 | */ | ||
410 | copied = 0; | ||
411 | descr_size = (int)sizeof(struct cmd_desc_type0); | ||
412 | while (copied < total_hdr_len) { | ||
413 | copy_len = min(descr_size, (total_hdr_len - copied)); | ||
414 | hwdesc = &tx_ring->desc_head[producer]; | ||
415 | tx_ring->cmd_buf_arr[producer].skb = NULL; | ||
416 | skb_copy_from_linear_data_offset(skb, copied, | ||
417 | (char *)hwdesc, | ||
418 | copy_len); | ||
419 | copied += copy_len; | ||
420 | producer = get_next_index(producer, tx_ring->num_desc); | ||
421 | } | ||
422 | |||
423 | tx_ring->producer = producer; | ||
424 | |||
425 | /* Make sure updated tx_ring->producer is visible | ||
426 | * for qlcnic_tx_avail() | ||
427 | */ | ||
428 | smp_mb(); | ||
429 | adapter->stats.encap_lso_frames++; | ||
430 | |||
431 | opcode = QLCNIC_TX_ENCAP_LSO; | ||
432 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | ||
433 | if (inner_ip_hdr(skb)->version == 6) { | ||
434 | if (inner_ipv6_hdr(skb)->nexthdr == IPPROTO_UDP) | ||
435 | encap_descr |= QLCNIC_ENCAP_INNER_L4_UDP; | ||
436 | } else { | ||
437 | if (inner_ip_hdr(skb)->protocol == IPPROTO_UDP) | ||
438 | encap_descr |= QLCNIC_ENCAP_INNER_L4_UDP; | ||
439 | } | ||
440 | |||
441 | adapter->stats.encap_tx_csummed++; | ||
442 | opcode = QLCNIC_TX_ENCAP_PKT; | ||
443 | } | ||
444 | |||
445 | /* Prepare first 16 bits of byte offset 16 of Tx descriptor */ | ||
446 | if (ip_hdr(skb)->version == 6) | ||
447 | encap_descr |= QLCNIC_ENCAP_OUTER_L3_IP6; | ||
448 | |||
449 | /* outer IP header's size in 32bit words size*/ | ||
450 | encap_descr |= (skb_network_header_len(skb) >> 2) << 6; | ||
451 | |||
452 | /* outer IP header offset */ | ||
453 | encap_descr |= skb_network_offset(skb) << 10; | ||
454 | first_desc->encap_descr = cpu_to_le16(encap_descr); | ||
455 | |||
456 | first_desc->tcp_hdr_offset = skb_inner_transport_header(skb) - | ||
457 | skb->data; | ||
458 | first_desc->ip_hdr_offset = skb_inner_network_offset(skb); | ||
459 | |||
460 | qlcnic_set_tx_flags_opcode(first_desc, flags, opcode); | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
367 | static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter, | 465 | static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter, |
368 | struct cmd_desc_type0 *first_desc, struct sk_buff *skb, | 466 | struct cmd_desc_type0 *first_desc, struct sk_buff *skb, |
369 | struct qlcnic_host_tx_ring *tx_ring) | 467 | struct qlcnic_host_tx_ring *tx_ring) |
@@ -378,11 +476,11 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter, | |||
378 | 476 | ||
379 | if (protocol == ETH_P_8021Q) { | 477 | if (protocol == ETH_P_8021Q) { |
380 | vh = (struct vlan_ethhdr *)skb->data; | 478 | vh = (struct vlan_ethhdr *)skb->data; |
381 | flags = FLAGS_VLAN_TAGGED; | 479 | flags = QLCNIC_FLAGS_VLAN_TAGGED; |
382 | vlan_tci = ntohs(vh->h_vlan_TCI); | 480 | vlan_tci = ntohs(vh->h_vlan_TCI); |
383 | protocol = ntohs(vh->h_vlan_encapsulated_proto); | 481 | protocol = ntohs(vh->h_vlan_encapsulated_proto); |
384 | } else if (vlan_tx_tag_present(skb)) { | 482 | } else if (vlan_tx_tag_present(skb)) { |
385 | flags = FLAGS_VLAN_OOB; | 483 | flags = QLCNIC_FLAGS_VLAN_OOB; |
386 | vlan_tci = vlan_tx_tag_get(skb); | 484 | vlan_tci = vlan_tx_tag_get(skb); |
387 | } | 485 | } |
388 | if (unlikely(adapter->tx_pvid)) { | 486 | if (unlikely(adapter->tx_pvid)) { |
@@ -391,7 +489,7 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter, | |||
391 | if (vlan_tci && (adapter->flags & QLCNIC_TAGGING_ENABLED)) | 489 | if (vlan_tci && (adapter->flags & QLCNIC_TAGGING_ENABLED)) |
392 | goto set_flags; | 490 | goto set_flags; |
393 | 491 | ||
394 | flags = FLAGS_VLAN_OOB; | 492 | flags = QLCNIC_FLAGS_VLAN_OOB; |
395 | vlan_tci = adapter->tx_pvid; | 493 | vlan_tci = adapter->tx_pvid; |
396 | } | 494 | } |
397 | set_flags: | 495 | set_flags: |
@@ -402,25 +500,26 @@ set_flags: | |||
402 | flags |= BIT_0; | 500 | flags |= BIT_0; |
403 | memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN); | 501 | memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN); |
404 | } | 502 | } |
405 | opcode = TX_ETHER_PKT; | 503 | opcode = QLCNIC_TX_ETHER_PKT; |
406 | if (skb_is_gso(skb)) { | 504 | if (skb_is_gso(skb)) { |
407 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 505 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
408 | first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | 506 | first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
409 | first_desc->total_hdr_length = hdr_len; | 507 | first_desc->hdr_length = hdr_len; |
410 | opcode = (protocol == ETH_P_IPV6) ? TX_TCP_LSO6 : TX_TCP_LSO; | 508 | opcode = (protocol == ETH_P_IPV6) ? QLCNIC_TX_TCP_LSO6 : |
509 | QLCNIC_TX_TCP_LSO; | ||
411 | 510 | ||
412 | /* For LSO, we need to copy the MAC/IP/TCP headers into | 511 | /* For LSO, we need to copy the MAC/IP/TCP headers into |
413 | * the descriptor ring */ | 512 | * the descriptor ring */ |
414 | copied = 0; | 513 | copied = 0; |
415 | offset = 2; | 514 | offset = 2; |
416 | 515 | ||
417 | if (flags & FLAGS_VLAN_OOB) { | 516 | if (flags & QLCNIC_FLAGS_VLAN_OOB) { |
418 | first_desc->total_hdr_length += VLAN_HLEN; | 517 | first_desc->hdr_length += VLAN_HLEN; |
419 | first_desc->tcp_hdr_offset = VLAN_HLEN; | 518 | first_desc->tcp_hdr_offset = VLAN_HLEN; |
420 | first_desc->ip_hdr_offset = VLAN_HLEN; | 519 | first_desc->ip_hdr_offset = VLAN_HLEN; |
421 | 520 | ||
422 | /* Only in case of TSO on vlan device */ | 521 | /* Only in case of TSO on vlan device */ |
423 | flags |= FLAGS_VLAN_TAGGED; | 522 | flags |= QLCNIC_FLAGS_VLAN_TAGGED; |
424 | 523 | ||
425 | /* Create a TSO vlan header template for firmware */ | 524 | /* Create a TSO vlan header template for firmware */ |
426 | hwdesc = &tx_ring->desc_head[producer]; | 525 | hwdesc = &tx_ring->desc_head[producer]; |
@@ -464,16 +563,16 @@ set_flags: | |||
464 | l4proto = ip_hdr(skb)->protocol; | 563 | l4proto = ip_hdr(skb)->protocol; |
465 | 564 | ||
466 | if (l4proto == IPPROTO_TCP) | 565 | if (l4proto == IPPROTO_TCP) |
467 | opcode = TX_TCP_PKT; | 566 | opcode = QLCNIC_TX_TCP_PKT; |
468 | else if (l4proto == IPPROTO_UDP) | 567 | else if (l4proto == IPPROTO_UDP) |
469 | opcode = TX_UDP_PKT; | 568 | opcode = QLCNIC_TX_UDP_PKT; |
470 | } else if (protocol == ETH_P_IPV6) { | 569 | } else if (protocol == ETH_P_IPV6) { |
471 | l4proto = ipv6_hdr(skb)->nexthdr; | 570 | l4proto = ipv6_hdr(skb)->nexthdr; |
472 | 571 | ||
473 | if (l4proto == IPPROTO_TCP) | 572 | if (l4proto == IPPROTO_TCP) |
474 | opcode = TX_TCPV6_PKT; | 573 | opcode = QLCNIC_TX_TCPV6_PKT; |
475 | else if (l4proto == IPPROTO_UDP) | 574 | else if (l4proto == IPPROTO_UDP) |
476 | opcode = TX_UDPV6_PKT; | 575 | opcode = QLCNIC_TX_UDPV6_PKT; |
477 | } | 576 | } |
478 | } | 577 | } |
479 | first_desc->tcp_hdr_offset += skb_transport_offset(skb); | 578 | first_desc->tcp_hdr_offset += skb_transport_offset(skb); |
@@ -563,6 +662,8 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
563 | struct ethhdr *phdr; | 662 | struct ethhdr *phdr; |
564 | int i, k, frag_count, delta = 0; | 663 | int i, k, frag_count, delta = 0; |
565 | u32 producer, num_txd; | 664 | u32 producer, num_txd; |
665 | u16 protocol; | ||
666 | bool l4_is_udp = false; | ||
566 | 667 | ||
567 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) { | 668 | if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) { |
568 | netif_tx_stop_all_queues(netdev); | 669 | netif_tx_stop_all_queues(netdev); |
@@ -653,8 +754,23 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
653 | tx_ring->producer = get_next_index(producer, num_txd); | 754 | tx_ring->producer = get_next_index(producer, num_txd); |
654 | smp_mb(); | 755 | smp_mb(); |
655 | 756 | ||
656 | if (unlikely(qlcnic_tx_pkt(adapter, first_desc, skb, tx_ring))) | 757 | protocol = ntohs(skb->protocol); |
657 | goto unwind_buff; | 758 | if (protocol == ETH_P_IP) |
759 | l4_is_udp = ip_hdr(skb)->protocol == IPPROTO_UDP; | ||
760 | else if (protocol == ETH_P_IPV6) | ||
761 | l4_is_udp = ipv6_hdr(skb)->nexthdr == IPPROTO_UDP; | ||
762 | |||
763 | /* Check if it is a VXLAN packet */ | ||
764 | if (!skb->encapsulation || !l4_is_udp || | ||
765 | !qlcnic_encap_tx_offload(adapter)) { | ||
766 | if (unlikely(qlcnic_tx_pkt(adapter, first_desc, skb, | ||
767 | tx_ring))) | ||
768 | goto unwind_buff; | ||
769 | } else { | ||
770 | if (unlikely(qlcnic_tx_encap_pkt(adapter, first_desc, | ||
771 | skb, tx_ring))) | ||
772 | goto unwind_buff; | ||
773 | } | ||
658 | 774 | ||
659 | if (adapter->drv_mac_learn) | 775 | if (adapter->drv_mac_learn) |
660 | qlcnic_send_filter(adapter, first_desc, skb); | 776 | qlcnic_send_filter(adapter, first_desc, skb); |
@@ -1587,6 +1703,13 @@ static inline int qlcnic_83xx_is_lb_pkt(u64 sts_data, int lro_pkt) | |||
1587 | return (sts_data & QLC_83XX_NORMAL_LB_PKT) ? 1 : 0; | 1703 | return (sts_data & QLC_83XX_NORMAL_LB_PKT) ? 1 : 0; |
1588 | } | 1704 | } |
1589 | 1705 | ||
1706 | #define QLCNIC_ENCAP_LENGTH_MASK 0x7f | ||
1707 | |||
1708 | static inline u8 qlcnic_encap_length(u64 sts_data) | ||
1709 | { | ||
1710 | return sts_data & QLCNIC_ENCAP_LENGTH_MASK; | ||
1711 | } | ||
1712 | |||
1590 | static struct qlcnic_rx_buffer * | 1713 | static struct qlcnic_rx_buffer * |
1591 | qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter, | 1714 | qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter, |
1592 | struct qlcnic_host_sds_ring *sds_ring, | 1715 | struct qlcnic_host_sds_ring *sds_ring, |
@@ -1637,6 +1760,12 @@ qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter, | |||
1637 | 1760 | ||
1638 | skb->protocol = eth_type_trans(skb, netdev); | 1761 | skb->protocol = eth_type_trans(skb, netdev); |
1639 | 1762 | ||
1763 | if (qlcnic_encap_length(sts_data[1]) && | ||
1764 | skb->ip_summed == CHECKSUM_UNNECESSARY) { | ||
1765 | skb->encapsulation = 1; | ||
1766 | adapter->stats.encap_rx_csummed++; | ||
1767 | } | ||
1768 | |||
1640 | if (vid != 0xffff) | 1769 | if (vid != 0xffff) |
1641 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); | 1770 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); |
1642 | 1771 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 4b92d9d90267..79be451a3ffc 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/aer.h> | 21 | #include <linux/aer.h> |
22 | #include <linux/log2.h> | 22 | #include <linux/log2.h> |
23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
24 | #include <net/vxlan.h> | ||
24 | 25 | ||
25 | MODULE_DESCRIPTION("QLogic 1/10 GbE Converged/Intelligent Ethernet Driver"); | 26 | MODULE_DESCRIPTION("QLogic 1/10 GbE Converged/Intelligent Ethernet Driver"); |
26 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
@@ -461,6 +462,35 @@ static int qlcnic_get_phys_port_id(struct net_device *netdev, | |||
461 | return 0; | 462 | return 0; |
462 | } | 463 | } |
463 | 464 | ||
465 | static void qlcnic_add_vxlan_port(struct net_device *netdev, | ||
466 | sa_family_t sa_family, __be16 port) | ||
467 | { | ||
468 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
469 | struct qlcnic_hardware_context *ahw = adapter->ahw; | ||
470 | |||
471 | /* Adapter supports only one VXLAN port. Use very first port | ||
472 | * for enabling offload | ||
473 | */ | ||
474 | if (!qlcnic_encap_rx_offload(adapter) || ahw->vxlan_port) | ||
475 | return; | ||
476 | |||
477 | ahw->vxlan_port = ntohs(port); | ||
478 | adapter->flags |= QLCNIC_ADD_VXLAN_PORT; | ||
479 | } | ||
480 | |||
481 | static void qlcnic_del_vxlan_port(struct net_device *netdev, | ||
482 | sa_family_t sa_family, __be16 port) | ||
483 | { | ||
484 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
485 | struct qlcnic_hardware_context *ahw = adapter->ahw; | ||
486 | |||
487 | if (!qlcnic_encap_rx_offload(adapter) || !ahw->vxlan_port || | ||
488 | (ahw->vxlan_port != ntohs(port))) | ||
489 | return; | ||
490 | |||
491 | adapter->flags |= QLCNIC_DEL_VXLAN_PORT; | ||
492 | } | ||
493 | |||
464 | static const struct net_device_ops qlcnic_netdev_ops = { | 494 | static const struct net_device_ops qlcnic_netdev_ops = { |
465 | .ndo_open = qlcnic_open, | 495 | .ndo_open = qlcnic_open, |
466 | .ndo_stop = qlcnic_close, | 496 | .ndo_stop = qlcnic_close, |
@@ -479,6 +509,8 @@ static const struct net_device_ops qlcnic_netdev_ops = { | |||
479 | .ndo_fdb_del = qlcnic_fdb_del, | 509 | .ndo_fdb_del = qlcnic_fdb_del, |
480 | .ndo_fdb_dump = qlcnic_fdb_dump, | 510 | .ndo_fdb_dump = qlcnic_fdb_dump, |
481 | .ndo_get_phys_port_id = qlcnic_get_phys_port_id, | 511 | .ndo_get_phys_port_id = qlcnic_get_phys_port_id, |
512 | .ndo_add_vxlan_port = qlcnic_add_vxlan_port, | ||
513 | .ndo_del_vxlan_port = qlcnic_del_vxlan_port, | ||
482 | #ifdef CONFIG_NET_POLL_CONTROLLER | 514 | #ifdef CONFIG_NET_POLL_CONTROLLER |
483 | .ndo_poll_controller = qlcnic_poll_controller, | 515 | .ndo_poll_controller = qlcnic_poll_controller, |
484 | #endif | 516 | #endif |
@@ -1943,6 +1975,9 @@ qlcnic_attach(struct qlcnic_adapter *adapter) | |||
1943 | 1975 | ||
1944 | qlcnic_create_sysfs_entries(adapter); | 1976 | qlcnic_create_sysfs_entries(adapter); |
1945 | 1977 | ||
1978 | if (qlcnic_encap_rx_offload(adapter)) | ||
1979 | vxlan_get_rx_port(netdev); | ||
1980 | |||
1946 | adapter->is_up = QLCNIC_ADAPTER_UP_MAGIC; | 1981 | adapter->is_up = QLCNIC_ADAPTER_UP_MAGIC; |
1947 | return 0; | 1982 | return 0; |
1948 | 1983 | ||
@@ -2205,6 +2240,19 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev, | |||
2205 | if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) | 2240 | if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) |
2206 | netdev->features |= NETIF_F_LRO; | 2241 | netdev->features |= NETIF_F_LRO; |
2207 | 2242 | ||
2243 | if (qlcnic_encap_tx_offload(adapter)) { | ||
2244 | netdev->features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2245 | |||
2246 | /* encapsulation Tx offload supported by Adapter */ | ||
2247 | netdev->hw_enc_features = NETIF_F_IP_CSUM | | ||
2248 | NETIF_F_GSO_UDP_TUNNEL | | ||
2249 | NETIF_F_TSO | | ||
2250 | NETIF_F_TSO6; | ||
2251 | } | ||
2252 | |||
2253 | if (qlcnic_encap_rx_offload(adapter)) | ||
2254 | netdev->hw_enc_features |= NETIF_F_RXCSUM; | ||
2255 | |||
2208 | netdev->hw_features = netdev->features; | 2256 | netdev->hw_features = netdev->features; |
2209 | netdev->priv_flags |= IFF_UNICAST_FLT; | 2257 | netdev->priv_flags |= IFF_UNICAST_FLT; |
2210 | netdev->irq = adapter->msix_entries[0].vector; | 2258 | netdev->irq = adapter->msix_entries[0].vector; |
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 722344fcd155..6b861e3de4b0 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c | |||
@@ -1194,6 +1194,7 @@ static const struct ptp_clock_info efx_phc_clock_info = { | |||
1194 | .n_alarm = 0, | 1194 | .n_alarm = 0, |
1195 | .n_ext_ts = 0, | 1195 | .n_ext_ts = 0, |
1196 | .n_per_out = 0, | 1196 | .n_per_out = 0, |
1197 | .n_pins = 0, | ||
1197 | .pps = 1, | 1198 | .pps = 1, |
1198 | .adjfreq = efx_phc_adjfreq, | 1199 | .adjfreq = efx_phc_adjfreq, |
1199 | .adjtime = efx_phc_adjtime, | 1200 | .adjtime = efx_phc_adjtime, |
diff --git a/drivers/net/ethernet/silan/sc92031.c b/drivers/net/ethernet/silan/sc92031.c index 5eb933c97bba..7daa7d433099 100644 --- a/drivers/net/ethernet/silan/sc92031.c +++ b/drivers/net/ethernet/silan/sc92031.c | |||
@@ -987,7 +987,7 @@ out_unlock: | |||
987 | spin_unlock(&priv->lock); | 987 | spin_unlock(&priv->lock); |
988 | 988 | ||
989 | out: | 989 | out: |
990 | dev_kfree_skb(skb); | 990 | dev_consume_skb_any(skb); |
991 | 991 | ||
992 | return NETDEV_TX_OK; | 992 | return NETDEV_TX_OK; |
993 | } | 993 | } |
diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c index ff57a46388ee..6072f093e6b4 100644 --- a/drivers/net/ethernet/sis/sis900.c +++ b/drivers/net/ethernet/sis/sis900.c | |||
@@ -1614,7 +1614,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) | |||
1614 | skb->data, skb->len, PCI_DMA_TODEVICE); | 1614 | skb->data, skb->len, PCI_DMA_TODEVICE); |
1615 | if (unlikely(pci_dma_mapping_error(sis_priv->pci_dev, | 1615 | if (unlikely(pci_dma_mapping_error(sis_priv->pci_dev, |
1616 | sis_priv->tx_ring[entry].bufptr))) { | 1616 | sis_priv->tx_ring[entry].bufptr))) { |
1617 | dev_kfree_skb(skb); | 1617 | dev_kfree_skb_any(skb); |
1618 | sis_priv->tx_skbuff[entry] = NULL; | 1618 | sis_priv->tx_skbuff[entry] = NULL; |
1619 | net_dev->stats.tx_dropped++; | 1619 | net_dev->stats.tx_dropped++; |
1620 | spin_unlock_irqrestore(&sis_priv->lock, flags); | 1620 | spin_unlock_irqrestore(&sis_priv->lock, flags); |
diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c index c50fb08c9905..66b05e62f70a 100644 --- a/drivers/net/ethernet/smsc/smc911x.c +++ b/drivers/net/ethernet/smsc/smc911x.c | |||
@@ -551,7 +551,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
551 | dev->stats.tx_errors++; | 551 | dev->stats.tx_errors++; |
552 | dev->stats.tx_dropped++; | 552 | dev->stats.tx_dropped++; |
553 | spin_unlock_irqrestore(&lp->lock, flags); | 553 | spin_unlock_irqrestore(&lp->lock, flags); |
554 | dev_kfree_skb(skb); | 554 | dev_kfree_skb_any(skb); |
555 | return NETDEV_TX_OK; | 555 | return NETDEV_TX_OK; |
556 | } | 556 | } |
557 | 557 | ||
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 839c0e6cca01..d1b4dca53a9d 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
@@ -621,7 +621,7 @@ static void smc_hardware_send_pkt(unsigned long data) | |||
621 | done: if (!THROTTLE_TX_PKTS) | 621 | done: if (!THROTTLE_TX_PKTS) |
622 | netif_wake_queue(dev); | 622 | netif_wake_queue(dev); |
623 | 623 | ||
624 | dev_kfree_skb(skb); | 624 | dev_consume_skb_any(skb); |
625 | } | 625 | } |
626 | 626 | ||
627 | /* | 627 | /* |
@@ -657,7 +657,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
657 | netdev_warn(dev, "Far too big packet error.\n"); | 657 | netdev_warn(dev, "Far too big packet error.\n"); |
658 | dev->stats.tx_errors++; | 658 | dev->stats.tx_errors++; |
659 | dev->stats.tx_dropped++; | 659 | dev->stats.tx_dropped++; |
660 | dev_kfree_skb(skb); | 660 | dev_kfree_skb_any(skb); |
661 | return NETDEV_TX_OK; | 661 | return NETDEV_TX_OK; |
662 | } | 662 | } |
663 | 663 | ||
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 95e2b9a20d40..ed36ff48af57 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -1672,7 +1672,7 @@ static int smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1672 | pdata->ops->tx_writefifo(pdata, (unsigned int *)bufp, wrsz); | 1672 | pdata->ops->tx_writefifo(pdata, (unsigned int *)bufp, wrsz); |
1673 | freespace -= (skb->len + 32); | 1673 | freespace -= (skb->len + 32); |
1674 | skb_tx_timestamp(skb); | 1674 | skb_tx_timestamp(skb); |
1675 | dev_kfree_skb(skb); | 1675 | dev_consume_skb_any(skb); |
1676 | 1676 | ||
1677 | if (unlikely(smsc911x_tx_get_txstatcount(pdata) >= 30)) | 1677 | if (unlikely(smsc911x_tx_get_txstatcount(pdata) >= 30)) |
1678 | smsc911x_tx_update_txcounters(dev); | 1678 | smsc911x_tx_update_txcounters(dev); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8543e1cfd55e..d940034acdd4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -1303,7 +1303,7 @@ static void stmmac_tx_clean(struct stmmac_priv *priv) | |||
1303 | priv->hw->mode->clean_desc3(priv, p); | 1303 | priv->hw->mode->clean_desc3(priv, p); |
1304 | 1304 | ||
1305 | if (likely(skb != NULL)) { | 1305 | if (likely(skb != NULL)) { |
1306 | dev_kfree_skb(skb); | 1306 | dev_consume_skb_any(skb); |
1307 | priv->tx_skbuff[entry] = NULL; | 1307 | priv->tx_skbuff[entry] = NULL; |
1308 | } | 1308 | } |
1309 | 1309 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 7680581ebe12..b7ad3565566c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | |||
@@ -164,6 +164,7 @@ static struct ptp_clock_info stmmac_ptp_clock_ops = { | |||
164 | .n_alarm = 0, | 164 | .n_alarm = 0, |
165 | .n_ext_ts = 0, | 165 | .n_ext_ts = 0, |
166 | .n_per_out = 0, | 166 | .n_per_out = 0, |
167 | .n_pins = 0, | ||
167 | .pps = 0, | 168 | .pps = 0, |
168 | .adjfreq = stmmac_adjust_freq, | 169 | .adjfreq = stmmac_adjust_freq, |
169 | .adjtime = stmmac_adjust_time, | 170 | .adjtime = stmmac_adjust_time, |
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index c2799dc46325..102a66fc54a2 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c | |||
@@ -688,7 +688,7 @@ static __inline__ void gem_tx(struct net_device *dev, struct gem *gp, u32 gem_st | |||
688 | } | 688 | } |
689 | 689 | ||
690 | dev->stats.tx_packets++; | 690 | dev->stats.tx_packets++; |
691 | dev_kfree_skb(skb); | 691 | dev_consume_skb_any(skb); |
692 | } | 692 | } |
693 | gp->tx_old = entry; | 693 | gp->tx_old = entry; |
694 | 694 | ||
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index 8c351f100aca..372cb192c5aa 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c | |||
@@ -217,6 +217,7 @@ static struct ptp_clock_info cpts_info = { | |||
217 | .name = "CTPS timer", | 217 | .name = "CTPS timer", |
218 | .max_adj = 1000000, | 218 | .max_adj = 1000000, |
219 | .n_ext_ts = 0, | 219 | .n_ext_ts = 0, |
220 | .n_pins = 0, | ||
220 | .pps = 0, | 221 | .pps = 0, |
221 | .adjfreq = cpts_ptp_adjfreq, | 222 | .adjfreq = cpts_ptp_adjfreq, |
222 | .adjtime = cpts_ptp_adjtime, | 223 | .adjtime = cpts_ptp_adjtime, |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index b43f1b3b9632..7e1c91d41a87 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
@@ -873,6 +873,7 @@ static struct ptp_clock_info ptp_mpipe_caps = { | |||
873 | .name = "mPIPE clock", | 873 | .name = "mPIPE clock", |
874 | .max_adj = 999999999, | 874 | .max_adj = 999999999, |
875 | .n_ext_ts = 0, | 875 | .n_ext_ts = 0, |
876 | .n_pins = 0, | ||
876 | .pps = 0, | 877 | .pps = 0, |
877 | .adjfreq = ptp_mpipe_adjfreq, | 878 | .adjfreq = ptp_mpipe_adjfreq, |
878 | .adjtime = ptp_mpipe_adjtime, | 879 | .adjtime = ptp_mpipe_adjtime, |
diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c index b94449b4bd34..e5a5c5d4ce0c 100644 --- a/drivers/net/ethernet/tile/tilepro.c +++ b/drivers/net/ethernet/tile/tilepro.c | |||
@@ -1824,7 +1824,7 @@ busy: | |||
1824 | 1824 | ||
1825 | /* Handle completions. */ | 1825 | /* Handle completions. */ |
1826 | for (i = 0; i < nolds; i++) | 1826 | for (i = 0; i < nolds; i++) |
1827 | kfree_skb(olds[i]); | 1827 | dev_consume_skb_any(olds[i]); |
1828 | 1828 | ||
1829 | /* Update stats. */ | 1829 | /* Update stats. */ |
1830 | u64_stats_update_begin(&stats->syncp); | 1830 | u64_stats_update_begin(&stats->syncp); |
@@ -2008,7 +2008,7 @@ busy: | |||
2008 | 2008 | ||
2009 | /* Handle completions. */ | 2009 | /* Handle completions. */ |
2010 | for (i = 0; i < nolds; i++) | 2010 | for (i = 0; i < nolds; i++) |
2011 | kfree_skb(olds[i]); | 2011 | dev_consume_skb_any(olds[i]); |
2012 | 2012 | ||
2013 | /* HACK: Track "expanded" size for short packets (e.g. 42 < 60). */ | 2013 | /* HACK: Track "expanded" size for short packets (e.g. 42 < 60). */ |
2014 | u64_stats_update_begin(&stats->syncp); | 2014 | u64_stats_update_begin(&stats->syncp); |
diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c index 3f4a32e39d27..0282d0161859 100644 --- a/drivers/net/ethernet/toshiba/spider_net.c +++ b/drivers/net/ethernet/toshiba/spider_net.c | |||
@@ -860,7 +860,7 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal) | |||
860 | if (skb) { | 860 | if (skb) { |
861 | pci_unmap_single(card->pdev, buf_addr, skb->len, | 861 | pci_unmap_single(card->pdev, buf_addr, skb->len, |
862 | PCI_DMA_TODEVICE); | 862 | PCI_DMA_TODEVICE); |
863 | dev_kfree_skb(skb); | 863 | dev_consume_skb_any(skb); |
864 | } | 864 | } |
865 | } | 865 | } |
866 | return 0; | 866 | return 0; |
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index 9d93fa120578..ce2e4d14ab31 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c | |||
@@ -1676,7 +1676,7 @@ static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | |||
1676 | /* Must use alignment buffer. */ | 1676 | /* Must use alignment buffer. */ |
1677 | if (skb->len > PKT_BUF_SZ) { | 1677 | if (skb->len > PKT_BUF_SZ) { |
1678 | /* packet too long, drop it */ | 1678 | /* packet too long, drop it */ |
1679 | dev_kfree_skb(skb); | 1679 | dev_kfree_skb_any(skb); |
1680 | rp->tx_skbuff[entry] = NULL; | 1680 | rp->tx_skbuff[entry] = NULL; |
1681 | dev->stats.tx_dropped++; | 1681 | dev->stats.tx_dropped++; |
1682 | return NETDEV_TX_OK; | 1682 | return NETDEV_TX_OK; |
@@ -1696,7 +1696,7 @@ static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | |||
1696 | pci_map_single(rp->pdev, skb->data, skb->len, | 1696 | pci_map_single(rp->pdev, skb->data, skb->len, |
1697 | PCI_DMA_TODEVICE); | 1697 | PCI_DMA_TODEVICE); |
1698 | if (dma_mapping_error(&rp->pdev->dev, rp->tx_skbuff_dma[entry])) { | 1698 | if (dma_mapping_error(&rp->pdev->dev, rp->tx_skbuff_dma[entry])) { |
1699 | dev_kfree_skb(skb); | 1699 | dev_kfree_skb_any(skb); |
1700 | rp->tx_skbuff_dma[entry] = 0; | 1700 | rp->tx_skbuff_dma[entry] = 0; |
1701 | dev->stats.tx_dropped++; | 1701 | dev->stats.tx_dropped++; |
1702 | return NETDEV_TX_OK; | 1702 | return NETDEV_TX_OK; |
@@ -1834,7 +1834,7 @@ static void rhine_tx(struct net_device *dev) | |||
1834 | rp->tx_skbuff[entry]->len, | 1834 | rp->tx_skbuff[entry]->len, |
1835 | PCI_DMA_TODEVICE); | 1835 | PCI_DMA_TODEVICE); |
1836 | } | 1836 | } |
1837 | dev_kfree_skb(rp->tx_skbuff[entry]); | 1837 | dev_consume_skb_any(rp->tx_skbuff[entry]); |
1838 | rp->tx_skbuff[entry] = NULL; | 1838 | rp->tx_skbuff[entry] = NULL; |
1839 | entry = (++rp->dirty_tx) % TX_RING_SIZE; | 1839 | entry = (++rp->dirty_tx) % TX_RING_SIZE; |
1840 | } | 1840 | } |
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index ad61d26a44f3..de08e86db209 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c | |||
@@ -2565,7 +2565,7 @@ static netdev_tx_t velocity_xmit(struct sk_buff *skb, | |||
2565 | /* The hardware can handle at most 7 memory segments, so merge | 2565 | /* The hardware can handle at most 7 memory segments, so merge |
2566 | * the skb if there are more */ | 2566 | * the skb if there are more */ |
2567 | if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) { | 2567 | if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) { |
2568 | kfree_skb(skb); | 2568 | dev_kfree_skb_any(skb); |
2569 | return NETDEV_TX_OK; | 2569 | return NETDEV_TX_OK; |
2570 | } | 2570 | } |
2571 | 2571 | ||
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c index 36052b98b3fc..58756617644f 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c | |||
@@ -1037,7 +1037,7 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) | |||
1037 | skb_tx_timestamp(new_skb); | 1037 | skb_tx_timestamp(new_skb); |
1038 | 1038 | ||
1039 | dev->stats.tx_bytes += len; | 1039 | dev->stats.tx_bytes += len; |
1040 | dev_kfree_skb(new_skb); | 1040 | dev_consume_skb_any(new_skb); |
1041 | 1041 | ||
1042 | return 0; | 1042 | return 0; |
1043 | } | 1043 | } |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 98e7cbf720a5..352c5e45fe9c 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #define CAL_EVENT 7 | 47 | #define CAL_EVENT 7 |
48 | #define CAL_TRIGGER 7 | 48 | #define CAL_TRIGGER 7 |
49 | #define PER_TRIGGER 6 | 49 | #define PER_TRIGGER 6 |
50 | #define DP83640_N_PINS 12 | ||
50 | 51 | ||
51 | #define MII_DP83640_MICR 0x11 | 52 | #define MII_DP83640_MICR 0x11 |
52 | #define MII_DP83640_MISR 0x12 | 53 | #define MII_DP83640_MISR 0x12 |
@@ -173,6 +174,37 @@ MODULE_PARM_DESC(chosen_phy, \ | |||
173 | MODULE_PARM_DESC(gpio_tab, \ | 174 | MODULE_PARM_DESC(gpio_tab, \ |
174 | "Which GPIO line to use for which purpose: cal,perout,extts1,...,extts6"); | 175 | "Which GPIO line to use for which purpose: cal,perout,extts1,...,extts6"); |
175 | 176 | ||
177 | static void dp83640_gpio_defaults(struct ptp_pin_desc *pd) | ||
178 | { | ||
179 | int i, index; | ||
180 | |||
181 | for (i = 0; i < DP83640_N_PINS; i++) { | ||
182 | snprintf(pd[i].name, sizeof(pd[i].name), "GPIO%d", 1 + i); | ||
183 | pd[i].index = i; | ||
184 | } | ||
185 | |||
186 | for (i = 0; i < GPIO_TABLE_SIZE; i++) { | ||
187 | if (gpio_tab[i] < 1 || gpio_tab[i] > DP83640_N_PINS) { | ||
188 | pr_err("gpio_tab[%d]=%hu out of range", i, gpio_tab[i]); | ||
189 | return; | ||
190 | } | ||
191 | } | ||
192 | |||
193 | index = gpio_tab[CALIBRATE_GPIO] - 1; | ||
194 | pd[index].func = PTP_PF_PHYSYNC; | ||
195 | pd[index].chan = 0; | ||
196 | |||
197 | index = gpio_tab[PEROUT_GPIO] - 1; | ||
198 | pd[index].func = PTP_PF_PEROUT; | ||
199 | pd[index].chan = 0; | ||
200 | |||
201 | for (i = EXTTS0_GPIO; i < GPIO_TABLE_SIZE; i++) { | ||
202 | index = gpio_tab[i] - 1; | ||
203 | pd[index].func = PTP_PF_EXTTS; | ||
204 | pd[index].chan = i - EXTTS0_GPIO; | ||
205 | } | ||
206 | } | ||
207 | |||
176 | /* a list of clocks and a mutex to protect it */ | 208 | /* a list of clocks and a mutex to protect it */ |
177 | static LIST_HEAD(phyter_clocks); | 209 | static LIST_HEAD(phyter_clocks); |
178 | static DEFINE_MUTEX(phyter_clocks_lock); | 210 | static DEFINE_MUTEX(phyter_clocks_lock); |
@@ -266,15 +298,22 @@ static u64 phy2txts(struct phy_txts *p) | |||
266 | return ns; | 298 | return ns; |
267 | } | 299 | } |
268 | 300 | ||
269 | static void periodic_output(struct dp83640_clock *clock, | 301 | static int periodic_output(struct dp83640_clock *clock, |
270 | struct ptp_clock_request *clkreq, bool on) | 302 | struct ptp_clock_request *clkreq, bool on) |
271 | { | 303 | { |
272 | struct dp83640_private *dp83640 = clock->chosen; | 304 | struct dp83640_private *dp83640 = clock->chosen; |
273 | struct phy_device *phydev = dp83640->phydev; | 305 | struct phy_device *phydev = dp83640->phydev; |
274 | u32 sec, nsec, period; | 306 | u32 sec, nsec, pwidth; |
275 | u16 gpio, ptp_trig, trigger, val; | 307 | u16 gpio, ptp_trig, trigger, val; |
276 | 308 | ||
277 | gpio = on ? gpio_tab[PEROUT_GPIO] : 0; | 309 | if (on) { |
310 | gpio = 1 + ptp_find_pin(clock->ptp_clock, PTP_PF_PEROUT, 0); | ||
311 | if (gpio < 1) | ||
312 | return -EINVAL; | ||
313 | } else { | ||
314 | gpio = 0; | ||
315 | } | ||
316 | |||
278 | trigger = PER_TRIGGER; | 317 | trigger = PER_TRIGGER; |
279 | 318 | ||
280 | ptp_trig = TRIG_WR | | 319 | ptp_trig = TRIG_WR | |
@@ -291,13 +330,14 @@ static void periodic_output(struct dp83640_clock *clock, | |||
291 | ext_write(0, phydev, PAGE5, PTP_TRIG, ptp_trig); | 330 | ext_write(0, phydev, PAGE5, PTP_TRIG, ptp_trig); |
292 | ext_write(0, phydev, PAGE4, PTP_CTL, val); | 331 | ext_write(0, phydev, PAGE4, PTP_CTL, val); |
293 | mutex_unlock(&clock->extreg_lock); | 332 | mutex_unlock(&clock->extreg_lock); |
294 | return; | 333 | return 0; |
295 | } | 334 | } |
296 | 335 | ||
297 | sec = clkreq->perout.start.sec; | 336 | sec = clkreq->perout.start.sec; |
298 | nsec = clkreq->perout.start.nsec; | 337 | nsec = clkreq->perout.start.nsec; |
299 | period = clkreq->perout.period.sec * 1000000000UL; | 338 | pwidth = clkreq->perout.period.sec * 1000000000UL; |
300 | period += clkreq->perout.period.nsec; | 339 | pwidth += clkreq->perout.period.nsec; |
340 | pwidth /= 2; | ||
301 | 341 | ||
302 | mutex_lock(&clock->extreg_lock); | 342 | mutex_lock(&clock->extreg_lock); |
303 | 343 | ||
@@ -310,8 +350,8 @@ static void periodic_output(struct dp83640_clock *clock, | |||
310 | ext_write(0, phydev, PAGE4, PTP_TDR, nsec >> 16); /* ns[31:16] */ | 350 | ext_write(0, phydev, PAGE4, PTP_TDR, nsec >> 16); /* ns[31:16] */ |
311 | ext_write(0, phydev, PAGE4, PTP_TDR, sec & 0xffff); /* sec[15:0] */ | 351 | ext_write(0, phydev, PAGE4, PTP_TDR, sec & 0xffff); /* sec[15:0] */ |
312 | ext_write(0, phydev, PAGE4, PTP_TDR, sec >> 16); /* sec[31:16] */ | 352 | ext_write(0, phydev, PAGE4, PTP_TDR, sec >> 16); /* sec[31:16] */ |
313 | ext_write(0, phydev, PAGE4, PTP_TDR, period & 0xffff); /* ns[15:0] */ | 353 | ext_write(0, phydev, PAGE4, PTP_TDR, pwidth & 0xffff); /* ns[15:0] */ |
314 | ext_write(0, phydev, PAGE4, PTP_TDR, period >> 16); /* ns[31:16] */ | 354 | ext_write(0, phydev, PAGE4, PTP_TDR, pwidth >> 16); /* ns[31:16] */ |
315 | 355 | ||
316 | /*enable trigger*/ | 356 | /*enable trigger*/ |
317 | val &= ~TRIG_LOAD; | 357 | val &= ~TRIG_LOAD; |
@@ -319,6 +359,7 @@ static void periodic_output(struct dp83640_clock *clock, | |||
319 | ext_write(0, phydev, PAGE4, PTP_CTL, val); | 359 | ext_write(0, phydev, PAGE4, PTP_CTL, val); |
320 | 360 | ||
321 | mutex_unlock(&clock->extreg_lock); | 361 | mutex_unlock(&clock->extreg_lock); |
362 | return 0; | ||
322 | } | 363 | } |
323 | 364 | ||
324 | /* ptp clock methods */ | 365 | /* ptp clock methods */ |
@@ -424,18 +465,21 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp, | |||
424 | struct dp83640_clock *clock = | 465 | struct dp83640_clock *clock = |
425 | container_of(ptp, struct dp83640_clock, caps); | 466 | container_of(ptp, struct dp83640_clock, caps); |
426 | struct phy_device *phydev = clock->chosen->phydev; | 467 | struct phy_device *phydev = clock->chosen->phydev; |
427 | int index; | 468 | unsigned int index; |
428 | u16 evnt, event_num, gpio_num; | 469 | u16 evnt, event_num, gpio_num; |
429 | 470 | ||
430 | switch (rq->type) { | 471 | switch (rq->type) { |
431 | case PTP_CLK_REQ_EXTTS: | 472 | case PTP_CLK_REQ_EXTTS: |
432 | index = rq->extts.index; | 473 | index = rq->extts.index; |
433 | if (index < 0 || index >= N_EXT_TS) | 474 | if (index >= N_EXT_TS) |
434 | return -EINVAL; | 475 | return -EINVAL; |
435 | event_num = EXT_EVENT + index; | 476 | event_num = EXT_EVENT + index; |
436 | evnt = EVNT_WR | (event_num & EVNT_SEL_MASK) << EVNT_SEL_SHIFT; | 477 | evnt = EVNT_WR | (event_num & EVNT_SEL_MASK) << EVNT_SEL_SHIFT; |
437 | if (on) { | 478 | if (on) { |
438 | gpio_num = gpio_tab[EXTTS0_GPIO + index]; | 479 | gpio_num = 1 + ptp_find_pin(clock->ptp_clock, |
480 | PTP_PF_EXTTS, index); | ||
481 | if (gpio_num < 1) | ||
482 | return -EINVAL; | ||
439 | evnt |= (gpio_num & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT; | 483 | evnt |= (gpio_num & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT; |
440 | if (rq->extts.flags & PTP_FALLING_EDGE) | 484 | if (rq->extts.flags & PTP_FALLING_EDGE) |
441 | evnt |= EVNT_FALL; | 485 | evnt |= EVNT_FALL; |
@@ -448,8 +492,7 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp, | |||
448 | case PTP_CLK_REQ_PEROUT: | 492 | case PTP_CLK_REQ_PEROUT: |
449 | if (rq->perout.index != 0) | 493 | if (rq->perout.index != 0) |
450 | return -EINVAL; | 494 | return -EINVAL; |
451 | periodic_output(clock, rq, on); | 495 | return periodic_output(clock, rq, on); |
452 | return 0; | ||
453 | 496 | ||
454 | default: | 497 | default: |
455 | break; | 498 | break; |
@@ -458,6 +501,12 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp, | |||
458 | return -EOPNOTSUPP; | 501 | return -EOPNOTSUPP; |
459 | } | 502 | } |
460 | 503 | ||
504 | static int ptp_dp83640_verify(struct ptp_clock_info *ptp, unsigned int pin, | ||
505 | enum ptp_pin_function func, unsigned int chan) | ||
506 | { | ||
507 | return 0; | ||
508 | } | ||
509 | |||
461 | static u8 status_frame_dst[6] = { 0x01, 0x1B, 0x19, 0x00, 0x00, 0x00 }; | 510 | static u8 status_frame_dst[6] = { 0x01, 0x1B, 0x19, 0x00, 0x00, 0x00 }; |
462 | static u8 status_frame_src[6] = { 0x08, 0x00, 0x17, 0x0B, 0x6B, 0x0F }; | 511 | static u8 status_frame_src[6] = { 0x08, 0x00, 0x17, 0x0B, 0x6B, 0x0F }; |
463 | 512 | ||
@@ -875,6 +924,7 @@ static void dp83640_free_clocks(void) | |||
875 | mutex_destroy(&clock->extreg_lock); | 924 | mutex_destroy(&clock->extreg_lock); |
876 | mutex_destroy(&clock->clock_lock); | 925 | mutex_destroy(&clock->clock_lock); |
877 | put_device(&clock->bus->dev); | 926 | put_device(&clock->bus->dev); |
927 | kfree(clock->caps.pin_config); | ||
878 | kfree(clock); | 928 | kfree(clock); |
879 | } | 929 | } |
880 | 930 | ||
@@ -894,12 +944,18 @@ static void dp83640_clock_init(struct dp83640_clock *clock, struct mii_bus *bus) | |||
894 | clock->caps.n_alarm = 0; | 944 | clock->caps.n_alarm = 0; |
895 | clock->caps.n_ext_ts = N_EXT_TS; | 945 | clock->caps.n_ext_ts = N_EXT_TS; |
896 | clock->caps.n_per_out = 1; | 946 | clock->caps.n_per_out = 1; |
947 | clock->caps.n_pins = DP83640_N_PINS; | ||
897 | clock->caps.pps = 0; | 948 | clock->caps.pps = 0; |
898 | clock->caps.adjfreq = ptp_dp83640_adjfreq; | 949 | clock->caps.adjfreq = ptp_dp83640_adjfreq; |
899 | clock->caps.adjtime = ptp_dp83640_adjtime; | 950 | clock->caps.adjtime = ptp_dp83640_adjtime; |
900 | clock->caps.gettime = ptp_dp83640_gettime; | 951 | clock->caps.gettime = ptp_dp83640_gettime; |
901 | clock->caps.settime = ptp_dp83640_settime; | 952 | clock->caps.settime = ptp_dp83640_settime; |
902 | clock->caps.enable = ptp_dp83640_enable; | 953 | clock->caps.enable = ptp_dp83640_enable; |
954 | clock->caps.verify = ptp_dp83640_verify; | ||
955 | /* | ||
956 | * Convert the module param defaults into a dynamic pin configuration. | ||
957 | */ | ||
958 | dp83640_gpio_defaults(clock->caps.pin_config); | ||
903 | /* | 959 | /* |
904 | * Get a reference to this bus instance. | 960 | * Get a reference to this bus instance. |
905 | */ | 961 | */ |
@@ -950,6 +1006,13 @@ static struct dp83640_clock *dp83640_clock_get_bus(struct mii_bus *bus) | |||
950 | if (!clock) | 1006 | if (!clock) |
951 | goto out; | 1007 | goto out; |
952 | 1008 | ||
1009 | clock->caps.pin_config = kzalloc(sizeof(struct ptp_pin_desc) * | ||
1010 | DP83640_N_PINS, GFP_KERNEL); | ||
1011 | if (!clock->caps.pin_config) { | ||
1012 | kfree(clock); | ||
1013 | clock = NULL; | ||
1014 | goto out; | ||
1015 | } | ||
953 | dp83640_clock_init(clock, bus); | 1016 | dp83640_clock_init(clock, bus); |
954 | list_add_tail(&phyter_clocks, &clock->list); | 1017 | list_add_tail(&phyter_clocks, &clock->list); |
955 | out: | 1018 | out: |
@@ -1363,7 +1426,7 @@ static void __exit dp83640_exit(void) | |||
1363 | } | 1426 | } |
1364 | 1427 | ||
1365 | MODULE_DESCRIPTION("National Semiconductor DP83640 PHY driver"); | 1428 | MODULE_DESCRIPTION("National Semiconductor DP83640 PHY driver"); |
1366 | MODULE_AUTHOR("Richard Cochran <richardcochran@gmail.at>"); | 1429 | MODULE_AUTHOR("Richard Cochran <richardcochran@gmail.com>"); |
1367 | MODULE_LICENSE("GPL"); | 1430 | MODULE_LICENSE("GPL"); |
1368 | 1431 | ||
1369 | module_init(dp83640_init); | 1432 | module_init(dp83640_init); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 80d84c446962..99fa48c941c6 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -883,7 +883,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
883 | dev_warn(&dev->dev, | 883 | dev_warn(&dev->dev, |
884 | "Unexpected TXQ (%d) queue failure: %d\n", qnum, err); | 884 | "Unexpected TXQ (%d) queue failure: %d\n", qnum, err); |
885 | dev->stats.tx_dropped++; | 885 | dev->stats.tx_dropped++; |
886 | kfree_skb(skb); | 886 | dev_kfree_skb_any(skb); |
887 | return NETDEV_TX_OK; | 887 | return NETDEV_TX_OK; |
888 | } | 888 | } |
889 | 889 | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 28965adfeebd..97394345e5dd 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -1078,7 +1078,7 @@ unlock_drop_pkt: | |||
1078 | spin_unlock_irqrestore(&tq->tx_lock, flags); | 1078 | spin_unlock_irqrestore(&tq->tx_lock, flags); |
1079 | drop_pkt: | 1079 | drop_pkt: |
1080 | tq->stats.drop_total++; | 1080 | tq->stats.drop_total++; |
1081 | dev_kfree_skb(skb); | 1081 | dev_kfree_skb_any(skb); |
1082 | return NETDEV_TX_OK; | 1082 | return NETDEV_TX_OK; |
1083 | } | 1083 | } |
1084 | 1084 | ||
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index bef37be402b8..0355f8767e3b 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
@@ -137,8 +137,6 @@ struct xenvif { | |||
137 | u16 dealloc_ring[MAX_PENDING_REQS]; | 137 | u16 dealloc_ring[MAX_PENDING_REQS]; |
138 | struct task_struct *dealloc_task; | 138 | struct task_struct *dealloc_task; |
139 | wait_queue_head_t dealloc_wq; | 139 | wait_queue_head_t dealloc_wq; |
140 | struct timer_list dealloc_delay; | ||
141 | bool dealloc_delay_timed_out; | ||
142 | 140 | ||
143 | /* Use kthread for guest RX */ | 141 | /* Use kthread for guest RX */ |
144 | struct task_struct *task; | 142 | struct task_struct *task; |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index a6a8c1579eb9..23bb2f4b18fe 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -407,7 +407,6 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
407 | .desc = i }; | 407 | .desc = i }; |
408 | vif->grant_tx_handle[i] = NETBACK_INVALID_HANDLE; | 408 | vif->grant_tx_handle[i] = NETBACK_INVALID_HANDLE; |
409 | } | 409 | } |
410 | init_timer(&vif->dealloc_delay); | ||
411 | 410 | ||
412 | /* | 411 | /* |
413 | * Initialise a dummy MAC address. We choose the numerically | 412 | * Initialise a dummy MAC address. We choose the numerically |
@@ -556,7 +555,6 @@ void xenvif_disconnect(struct xenvif *vif) | |||
556 | } | 555 | } |
557 | 556 | ||
558 | if (vif->dealloc_task) { | 557 | if (vif->dealloc_task) { |
559 | del_timer_sync(&vif->dealloc_delay); | ||
560 | kthread_stop(vif->dealloc_task); | 558 | kthread_stop(vif->dealloc_task); |
561 | vif->dealloc_task = NULL; | 559 | vif->dealloc_task = NULL; |
562 | } | 560 | } |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 5a8c4a43c522..1e4628724778 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -133,11 +133,6 @@ static inline pending_ring_idx_t pending_index(unsigned i) | |||
133 | return i & (MAX_PENDING_REQS-1); | 133 | return i & (MAX_PENDING_REQS-1); |
134 | } | 134 | } |
135 | 135 | ||
136 | static inline pending_ring_idx_t nr_free_slots(struct xen_netif_tx_back_ring *ring) | ||
137 | { | ||
138 | return ring->nr_ents - (ring->sring->req_prod - ring->rsp_prod_pvt); | ||
139 | } | ||
140 | |||
141 | bool xenvif_rx_ring_slots_available(struct xenvif *vif, int needed) | 136 | bool xenvif_rx_ring_slots_available(struct xenvif *vif, int needed) |
142 | { | 137 | { |
143 | RING_IDX prod, cons; | 138 | RING_IDX prod, cons; |
@@ -1574,7 +1569,7 @@ static inline void xenvif_tx_dealloc_action(struct xenvif *vif) | |||
1574 | vif->pages_to_unmap, | 1569 | vif->pages_to_unmap, |
1575 | gop - vif->tx_unmap_ops); | 1570 | gop - vif->tx_unmap_ops); |
1576 | if (ret) { | 1571 | if (ret) { |
1577 | netdev_err(vif->dev, "Unmap fail: nr_ops %x ret %d\n", | 1572 | netdev_err(vif->dev, "Unmap fail: nr_ops %tx ret %d\n", |
1578 | gop - vif->tx_unmap_ops, ret); | 1573 | gop - vif->tx_unmap_ops, ret); |
1579 | for (i = 0; i < gop - vif->tx_unmap_ops; ++i) { | 1574 | for (i = 0; i < gop - vif->tx_unmap_ops; ++i) { |
1580 | if (gop[i].status != GNTST_okay) | 1575 | if (gop[i].status != GNTST_okay) |
@@ -1718,36 +1713,9 @@ static inline int tx_work_todo(struct xenvif *vif) | |||
1718 | return 0; | 1713 | return 0; |
1719 | } | 1714 | } |
1720 | 1715 | ||
1721 | static void xenvif_dealloc_delay(unsigned long data) | ||
1722 | { | ||
1723 | struct xenvif *vif = (struct xenvif *)data; | ||
1724 | |||
1725 | vif->dealloc_delay_timed_out = true; | ||
1726 | wake_up(&vif->dealloc_wq); | ||
1727 | } | ||
1728 | |||
1729 | static inline bool tx_dealloc_work_todo(struct xenvif *vif) | 1716 | static inline bool tx_dealloc_work_todo(struct xenvif *vif) |
1730 | { | 1717 | { |
1731 | if (vif->dealloc_cons != vif->dealloc_prod) { | 1718 | return vif->dealloc_cons != vif->dealloc_prod; |
1732 | if ((nr_free_slots(&vif->tx) > 2 * XEN_NETBK_LEGACY_SLOTS_MAX) && | ||
1733 | (vif->dealloc_prod - vif->dealloc_cons < MAX_PENDING_REQS / 4) && | ||
1734 | !vif->dealloc_delay_timed_out) { | ||
1735 | if (!timer_pending(&vif->dealloc_delay)) { | ||
1736 | vif->dealloc_delay.function = | ||
1737 | xenvif_dealloc_delay; | ||
1738 | vif->dealloc_delay.data = (unsigned long)vif; | ||
1739 | mod_timer(&vif->dealloc_delay, | ||
1740 | jiffies + msecs_to_jiffies(1)); | ||
1741 | |||
1742 | } | ||
1743 | return false; | ||
1744 | } | ||
1745 | del_timer_sync(&vif->dealloc_delay); | ||
1746 | vif->dealloc_delay_timed_out = false; | ||
1747 | return true; | ||
1748 | } | ||
1749 | |||
1750 | return false; | ||
1751 | } | 1719 | } |
1752 | 1720 | ||
1753 | void xenvif_unmap_frontend_rings(struct xenvif *vif) | 1721 | void xenvif_unmap_frontend_rings(struct xenvif *vif) |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 49f3b3dbbed8..057b05700f8b 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -658,7 +658,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
658 | 658 | ||
659 | drop: | 659 | drop: |
660 | dev->stats.tx_dropped++; | 660 | dev->stats.tx_dropped++; |
661 | dev_kfree_skb(skb); | 661 | dev_kfree_skb_any(skb); |
662 | return NETDEV_TX_OK; | 662 | return NETDEV_TX_OK; |
663 | } | 663 | } |
664 | 664 | ||
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index 34a0c607318e..419056d7887e 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c | |||
@@ -25,6 +25,96 @@ | |||
25 | 25 | ||
26 | #include "ptp_private.h" | 26 | #include "ptp_private.h" |
27 | 27 | ||
28 | static int ptp_disable_pinfunc(struct ptp_clock_info *ops, | ||
29 | enum ptp_pin_function func, unsigned int chan) | ||
30 | { | ||
31 | struct ptp_clock_request rq; | ||
32 | int err = 0; | ||
33 | |||
34 | memset(&rq, 0, sizeof(rq)); | ||
35 | |||
36 | switch (func) { | ||
37 | case PTP_PF_NONE: | ||
38 | break; | ||
39 | case PTP_PF_EXTTS: | ||
40 | rq.type = PTP_CLK_REQ_EXTTS; | ||
41 | rq.extts.index = chan; | ||
42 | err = ops->enable(ops, &rq, 0); | ||
43 | break; | ||
44 | case PTP_PF_PEROUT: | ||
45 | rq.type = PTP_CLK_REQ_PEROUT; | ||
46 | rq.perout.index = chan; | ||
47 | err = ops->enable(ops, &rq, 0); | ||
48 | break; | ||
49 | case PTP_PF_PHYSYNC: | ||
50 | break; | ||
51 | default: | ||
52 | return -EINVAL; | ||
53 | } | ||
54 | |||
55 | return err; | ||
56 | } | ||
57 | |||
58 | int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin, | ||
59 | enum ptp_pin_function func, unsigned int chan) | ||
60 | { | ||
61 | struct ptp_clock_info *info = ptp->info; | ||
62 | struct ptp_pin_desc *pin1 = NULL, *pin2 = &info->pin_config[pin]; | ||
63 | unsigned int i; | ||
64 | |||
65 | /* Check to see if any other pin previously had this function. */ | ||
66 | for (i = 0; i < info->n_pins; i++) { | ||
67 | if (info->pin_config[i].func == func && | ||
68 | info->pin_config[i].chan == chan) { | ||
69 | pin1 = &info->pin_config[i]; | ||
70 | break; | ||
71 | } | ||
72 | } | ||
73 | if (pin1 && i == pin) | ||
74 | return 0; | ||
75 | |||
76 | /* Check the desired function and channel. */ | ||
77 | switch (func) { | ||
78 | case PTP_PF_NONE: | ||
79 | break; | ||
80 | case PTP_PF_EXTTS: | ||
81 | if (chan >= info->n_ext_ts) | ||
82 | return -EINVAL; | ||
83 | break; | ||
84 | case PTP_PF_PEROUT: | ||
85 | if (chan >= info->n_per_out) | ||
86 | return -EINVAL; | ||
87 | break; | ||
88 | case PTP_PF_PHYSYNC: | ||
89 | pr_err("sorry, cannot reassign the calibration pin\n"); | ||
90 | return -EINVAL; | ||
91 | default: | ||
92 | return -EINVAL; | ||
93 | } | ||
94 | |||
95 | if (pin2->func == PTP_PF_PHYSYNC) { | ||
96 | pr_err("sorry, cannot reprogram the calibration pin\n"); | ||
97 | return -EINVAL; | ||
98 | } | ||
99 | |||
100 | if (info->verify(info, pin, func, chan)) { | ||
101 | pr_err("driver cannot use function %u on pin %u\n", func, chan); | ||
102 | return -EOPNOTSUPP; | ||
103 | } | ||
104 | |||
105 | /* Disable whatever function was previously assigned. */ | ||
106 | if (pin1) { | ||
107 | ptp_disable_pinfunc(info, func, chan); | ||
108 | pin1->func = PTP_PF_NONE; | ||
109 | pin1->chan = 0; | ||
110 | } | ||
111 | ptp_disable_pinfunc(info, pin2->func, pin2->chan); | ||
112 | pin2->func = func; | ||
113 | pin2->chan = chan; | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
28 | int ptp_open(struct posix_clock *pc, fmode_t fmode) | 118 | int ptp_open(struct posix_clock *pc, fmode_t fmode) |
29 | { | 119 | { |
30 | return 0; | 120 | return 0; |
@@ -35,12 +125,13 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) | |||
35 | struct ptp_clock_caps caps; | 125 | struct ptp_clock_caps caps; |
36 | struct ptp_clock_request req; | 126 | struct ptp_clock_request req; |
37 | struct ptp_sys_offset *sysoff = NULL; | 127 | struct ptp_sys_offset *sysoff = NULL; |
128 | struct ptp_pin_desc pd; | ||
38 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); | 129 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); |
39 | struct ptp_clock_info *ops = ptp->info; | 130 | struct ptp_clock_info *ops = ptp->info; |
40 | struct ptp_clock_time *pct; | 131 | struct ptp_clock_time *pct; |
41 | struct timespec ts; | 132 | struct timespec ts; |
42 | int enable, err = 0; | 133 | int enable, err = 0; |
43 | unsigned int i; | 134 | unsigned int i, pin_index; |
44 | 135 | ||
45 | switch (cmd) { | 136 | switch (cmd) { |
46 | 137 | ||
@@ -51,6 +142,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) | |||
51 | caps.n_ext_ts = ptp->info->n_ext_ts; | 142 | caps.n_ext_ts = ptp->info->n_ext_ts; |
52 | caps.n_per_out = ptp->info->n_per_out; | 143 | caps.n_per_out = ptp->info->n_per_out; |
53 | caps.pps = ptp->info->pps; | 144 | caps.pps = ptp->info->pps; |
145 | caps.n_pins = ptp->info->n_pins; | ||
54 | if (copy_to_user((void __user *)arg, &caps, sizeof(caps))) | 146 | if (copy_to_user((void __user *)arg, &caps, sizeof(caps))) |
55 | err = -EFAULT; | 147 | err = -EFAULT; |
56 | break; | 148 | break; |
@@ -126,6 +218,40 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) | |||
126 | err = -EFAULT; | 218 | err = -EFAULT; |
127 | break; | 219 | break; |
128 | 220 | ||
221 | case PTP_PIN_GETFUNC: | ||
222 | if (copy_from_user(&pd, (void __user *)arg, sizeof(pd))) { | ||
223 | err = -EFAULT; | ||
224 | break; | ||
225 | } | ||
226 | pin_index = pd.index; | ||
227 | if (pin_index >= ops->n_pins) { | ||
228 | err = -EINVAL; | ||
229 | break; | ||
230 | } | ||
231 | if (mutex_lock_interruptible(&ptp->pincfg_mux)) | ||
232 | return -ERESTARTSYS; | ||
233 | pd = ops->pin_config[pin_index]; | ||
234 | mutex_unlock(&ptp->pincfg_mux); | ||
235 | if (!err && copy_to_user((void __user *)arg, &pd, sizeof(pd))) | ||
236 | err = -EFAULT; | ||
237 | break; | ||
238 | |||
239 | case PTP_PIN_SETFUNC: | ||
240 | if (copy_from_user(&pd, (void __user *)arg, sizeof(pd))) { | ||
241 | err = -EFAULT; | ||
242 | break; | ||
243 | } | ||
244 | pin_index = pd.index; | ||
245 | if (pin_index >= ops->n_pins) { | ||
246 | err = -EINVAL; | ||
247 | break; | ||
248 | } | ||
249 | if (mutex_lock_interruptible(&ptp->pincfg_mux)) | ||
250 | return -ERESTARTSYS; | ||
251 | err = ptp_set_pinfunc(ptp, pin_index, pd.func, pd.chan); | ||
252 | mutex_unlock(&ptp->pincfg_mux); | ||
253 | break; | ||
254 | |||
129 | default: | 255 | default: |
130 | err = -ENOTTY; | 256 | err = -ENOTTY; |
131 | break; | 257 | break; |
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index a8319b266643..e25d2bc898e5 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c | |||
@@ -169,6 +169,7 @@ static void delete_ptp_clock(struct posix_clock *pc) | |||
169 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); | 169 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); |
170 | 170 | ||
171 | mutex_destroy(&ptp->tsevq_mux); | 171 | mutex_destroy(&ptp->tsevq_mux); |
172 | mutex_destroy(&ptp->pincfg_mux); | ||
172 | ida_simple_remove(&ptp_clocks_map, ptp->index); | 173 | ida_simple_remove(&ptp_clocks_map, ptp->index); |
173 | kfree(ptp); | 174 | kfree(ptp); |
174 | } | 175 | } |
@@ -203,6 +204,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, | |||
203 | ptp->index = index; | 204 | ptp->index = index; |
204 | spin_lock_init(&ptp->tsevq.lock); | 205 | spin_lock_init(&ptp->tsevq.lock); |
205 | mutex_init(&ptp->tsevq_mux); | 206 | mutex_init(&ptp->tsevq_mux); |
207 | mutex_init(&ptp->pincfg_mux); | ||
206 | init_waitqueue_head(&ptp->tsev_wq); | 208 | init_waitqueue_head(&ptp->tsev_wq); |
207 | 209 | ||
208 | /* Create a new device in our class. */ | 210 | /* Create a new device in our class. */ |
@@ -249,6 +251,7 @@ no_sysfs: | |||
249 | device_destroy(ptp_class, ptp->devid); | 251 | device_destroy(ptp_class, ptp->devid); |
250 | no_device: | 252 | no_device: |
251 | mutex_destroy(&ptp->tsevq_mux); | 253 | mutex_destroy(&ptp->tsevq_mux); |
254 | mutex_destroy(&ptp->pincfg_mux); | ||
252 | no_slot: | 255 | no_slot: |
253 | kfree(ptp); | 256 | kfree(ptp); |
254 | no_memory: | 257 | no_memory: |
@@ -305,6 +308,26 @@ int ptp_clock_index(struct ptp_clock *ptp) | |||
305 | } | 308 | } |
306 | EXPORT_SYMBOL(ptp_clock_index); | 309 | EXPORT_SYMBOL(ptp_clock_index); |
307 | 310 | ||
311 | int ptp_find_pin(struct ptp_clock *ptp, | ||
312 | enum ptp_pin_function func, unsigned int chan) | ||
313 | { | ||
314 | struct ptp_pin_desc *pin = NULL; | ||
315 | int i; | ||
316 | |||
317 | mutex_lock(&ptp->pincfg_mux); | ||
318 | for (i = 0; i < ptp->info->n_pins; i++) { | ||
319 | if (ptp->info->pin_config[i].func == func && | ||
320 | ptp->info->pin_config[i].chan == chan) { | ||
321 | pin = &ptp->info->pin_config[i]; | ||
322 | break; | ||
323 | } | ||
324 | } | ||
325 | mutex_unlock(&ptp->pincfg_mux); | ||
326 | |||
327 | return pin ? i : -1; | ||
328 | } | ||
329 | EXPORT_SYMBOL(ptp_find_pin); | ||
330 | |||
308 | /* module operations */ | 331 | /* module operations */ |
309 | 332 | ||
310 | static void __exit ptp_exit(void) | 333 | static void __exit ptp_exit(void) |
diff --git a/drivers/ptp/ptp_ixp46x.c b/drivers/ptp/ptp_ixp46x.c index 4a08727fcaf3..604d340f2095 100644 --- a/drivers/ptp/ptp_ixp46x.c +++ b/drivers/ptp/ptp_ixp46x.c | |||
@@ -244,6 +244,7 @@ static struct ptp_clock_info ptp_ixp_caps = { | |||
244 | .name = "IXP46X timer", | 244 | .name = "IXP46X timer", |
245 | .max_adj = 66666655, | 245 | .max_adj = 66666655, |
246 | .n_ext_ts = N_EXT_TS, | 246 | .n_ext_ts = N_EXT_TS, |
247 | .n_pins = 0, | ||
247 | .pps = 0, | 248 | .pps = 0, |
248 | .adjfreq = ptp_ixp_adjfreq, | 249 | .adjfreq = ptp_ixp_adjfreq, |
249 | .adjtime = ptp_ixp_adjtime, | 250 | .adjtime = ptp_ixp_adjtime, |
diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c index 71a2559278d7..90a106308c4f 100644 --- a/drivers/ptp/ptp_pch.c +++ b/drivers/ptp/ptp_pch.c | |||
@@ -514,6 +514,7 @@ static struct ptp_clock_info ptp_pch_caps = { | |||
514 | .name = "PCH timer", | 514 | .name = "PCH timer", |
515 | .max_adj = 50000000, | 515 | .max_adj = 50000000, |
516 | .n_ext_ts = N_EXT_TS, | 516 | .n_ext_ts = N_EXT_TS, |
517 | .n_pins = 0, | ||
517 | .pps = 0, | 518 | .pps = 0, |
518 | .adjfreq = ptp_pch_adjfreq, | 519 | .adjfreq = ptp_pch_adjfreq, |
519 | .adjtime = ptp_pch_adjtime, | 520 | .adjtime = ptp_pch_adjtime, |
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h index df03f2e30ad9..9c5d41421b65 100644 --- a/drivers/ptp/ptp_private.h +++ b/drivers/ptp/ptp_private.h | |||
@@ -48,8 +48,12 @@ struct ptp_clock { | |||
48 | long dialed_frequency; /* remembers the frequency adjustment */ | 48 | long dialed_frequency; /* remembers the frequency adjustment */ |
49 | struct timestamp_event_queue tsevq; /* simple fifo for time stamps */ | 49 | struct timestamp_event_queue tsevq; /* simple fifo for time stamps */ |
50 | struct mutex tsevq_mux; /* one process at a time reading the fifo */ | 50 | struct mutex tsevq_mux; /* one process at a time reading the fifo */ |
51 | struct mutex pincfg_mux; /* protect concurrent info->pin_config access */ | ||
51 | wait_queue_head_t tsev_wq; | 52 | wait_queue_head_t tsev_wq; |
52 | int defunct; /* tells readers to go away when clock is being removed */ | 53 | int defunct; /* tells readers to go away when clock is being removed */ |
54 | struct device_attribute *pin_dev_attr; | ||
55 | struct attribute **pin_attr; | ||
56 | struct attribute_group pin_attr_group; | ||
53 | }; | 57 | }; |
54 | 58 | ||
55 | /* | 59 | /* |
@@ -69,6 +73,10 @@ static inline int queue_cnt(struct timestamp_event_queue *q) | |||
69 | * see ptp_chardev.c | 73 | * see ptp_chardev.c |
70 | */ | 74 | */ |
71 | 75 | ||
76 | /* caller must hold pincfg_mux */ | ||
77 | int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin, | ||
78 | enum ptp_pin_function func, unsigned int chan); | ||
79 | |||
72 | long ptp_ioctl(struct posix_clock *pc, | 80 | long ptp_ioctl(struct posix_clock *pc, |
73 | unsigned int cmd, unsigned long arg); | 81 | unsigned int cmd, unsigned long arg); |
74 | 82 | ||
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c index 13ec5311746a..302e626fe6b0 100644 --- a/drivers/ptp/ptp_sysfs.c +++ b/drivers/ptp/ptp_sysfs.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | #include <linux/capability.h> | 20 | #include <linux/capability.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #include "ptp_private.h" | 23 | #include "ptp_private.h" |
23 | 24 | ||
@@ -42,6 +43,7 @@ PTP_SHOW_INT(max_adjustment, max_adj); | |||
42 | PTP_SHOW_INT(n_alarms, n_alarm); | 43 | PTP_SHOW_INT(n_alarms, n_alarm); |
43 | PTP_SHOW_INT(n_external_timestamps, n_ext_ts); | 44 | PTP_SHOW_INT(n_external_timestamps, n_ext_ts); |
44 | PTP_SHOW_INT(n_periodic_outputs, n_per_out); | 45 | PTP_SHOW_INT(n_periodic_outputs, n_per_out); |
46 | PTP_SHOW_INT(n_programmable_pins, n_pins); | ||
45 | PTP_SHOW_INT(pps_available, pps); | 47 | PTP_SHOW_INT(pps_available, pps); |
46 | 48 | ||
47 | static struct attribute *ptp_attrs[] = { | 49 | static struct attribute *ptp_attrs[] = { |
@@ -50,6 +52,7 @@ static struct attribute *ptp_attrs[] = { | |||
50 | &dev_attr_n_alarms.attr, | 52 | &dev_attr_n_alarms.attr, |
51 | &dev_attr_n_external_timestamps.attr, | 53 | &dev_attr_n_external_timestamps.attr, |
52 | &dev_attr_n_periodic_outputs.attr, | 54 | &dev_attr_n_periodic_outputs.attr, |
55 | &dev_attr_n_programmable_pins.attr, | ||
53 | &dev_attr_pps_available.attr, | 56 | &dev_attr_pps_available.attr, |
54 | NULL, | 57 | NULL, |
55 | }; | 58 | }; |
@@ -175,6 +178,63 @@ out: | |||
175 | return err; | 178 | return err; |
176 | } | 179 | } |
177 | 180 | ||
181 | static int ptp_pin_name2index(struct ptp_clock *ptp, const char *name) | ||
182 | { | ||
183 | int i; | ||
184 | for (i = 0; i < ptp->info->n_pins; i++) { | ||
185 | if (!strcmp(ptp->info->pin_config[i].name, name)) | ||
186 | return i; | ||
187 | } | ||
188 | return -1; | ||
189 | } | ||
190 | |||
191 | static ssize_t ptp_pin_show(struct device *dev, struct device_attribute *attr, | ||
192 | char *page) | ||
193 | { | ||
194 | struct ptp_clock *ptp = dev_get_drvdata(dev); | ||
195 | unsigned int func, chan; | ||
196 | int index; | ||
197 | |||
198 | index = ptp_pin_name2index(ptp, attr->attr.name); | ||
199 | if (index < 0) | ||
200 | return -EINVAL; | ||
201 | |||
202 | if (mutex_lock_interruptible(&ptp->pincfg_mux)) | ||
203 | return -ERESTARTSYS; | ||
204 | |||
205 | func = ptp->info->pin_config[index].func; | ||
206 | chan = ptp->info->pin_config[index].chan; | ||
207 | |||
208 | mutex_unlock(&ptp->pincfg_mux); | ||
209 | |||
210 | return snprintf(page, PAGE_SIZE, "%u %u\n", func, chan); | ||
211 | } | ||
212 | |||
213 | static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr, | ||
214 | const char *buf, size_t count) | ||
215 | { | ||
216 | struct ptp_clock *ptp = dev_get_drvdata(dev); | ||
217 | unsigned int func, chan; | ||
218 | int cnt, err, index; | ||
219 | |||
220 | cnt = sscanf(buf, "%u %u", &func, &chan); | ||
221 | if (cnt != 2) | ||
222 | return -EINVAL; | ||
223 | |||
224 | index = ptp_pin_name2index(ptp, attr->attr.name); | ||
225 | if (index < 0) | ||
226 | return -EINVAL; | ||
227 | |||
228 | if (mutex_lock_interruptible(&ptp->pincfg_mux)) | ||
229 | return -ERESTARTSYS; | ||
230 | err = ptp_set_pinfunc(ptp, index, func, chan); | ||
231 | mutex_unlock(&ptp->pincfg_mux); | ||
232 | if (err) | ||
233 | return err; | ||
234 | |||
235 | return count; | ||
236 | } | ||
237 | |||
178 | static DEVICE_ATTR(extts_enable, 0220, NULL, extts_enable_store); | 238 | static DEVICE_ATTR(extts_enable, 0220, NULL, extts_enable_store); |
179 | static DEVICE_ATTR(fifo, 0444, extts_fifo_show, NULL); | 239 | static DEVICE_ATTR(fifo, 0444, extts_fifo_show, NULL); |
180 | static DEVICE_ATTR(period, 0220, NULL, period_store); | 240 | static DEVICE_ATTR(period, 0220, NULL, period_store); |
@@ -195,9 +255,56 @@ int ptp_cleanup_sysfs(struct ptp_clock *ptp) | |||
195 | if (info->pps) | 255 | if (info->pps) |
196 | device_remove_file(dev, &dev_attr_pps_enable); | 256 | device_remove_file(dev, &dev_attr_pps_enable); |
197 | 257 | ||
258 | if (info->n_pins) { | ||
259 | sysfs_remove_group(&dev->kobj, &ptp->pin_attr_group); | ||
260 | kfree(ptp->pin_attr); | ||
261 | kfree(ptp->pin_dev_attr); | ||
262 | } | ||
198 | return 0; | 263 | return 0; |
199 | } | 264 | } |
200 | 265 | ||
266 | static int ptp_populate_pins(struct ptp_clock *ptp) | ||
267 | { | ||
268 | struct device *dev = ptp->dev; | ||
269 | struct ptp_clock_info *info = ptp->info; | ||
270 | int err = -ENOMEM, i, n_pins = info->n_pins; | ||
271 | |||
272 | ptp->pin_dev_attr = kzalloc(n_pins * sizeof(*ptp->pin_dev_attr), | ||
273 | GFP_KERNEL); | ||
274 | if (!ptp->pin_dev_attr) | ||
275 | goto no_dev_attr; | ||
276 | |||
277 | ptp->pin_attr = kzalloc((1 + n_pins) * sizeof(struct attribute *), | ||
278 | GFP_KERNEL); | ||
279 | if (!ptp->pin_attr) | ||
280 | goto no_pin_attr; | ||
281 | |||
282 | for (i = 0; i < n_pins; i++) { | ||
283 | struct device_attribute *da = &ptp->pin_dev_attr[i]; | ||
284 | sysfs_attr_init(&da->attr); | ||
285 | da->attr.name = info->pin_config[i].name; | ||
286 | da->attr.mode = 0644; | ||
287 | da->show = ptp_pin_show; | ||
288 | da->store = ptp_pin_store; | ||
289 | ptp->pin_attr[i] = &da->attr; | ||
290 | } | ||
291 | |||
292 | ptp->pin_attr_group.name = "pins"; | ||
293 | ptp->pin_attr_group.attrs = ptp->pin_attr; | ||
294 | |||
295 | err = sysfs_create_group(&dev->kobj, &ptp->pin_attr_group); | ||
296 | if (err) | ||
297 | goto no_group; | ||
298 | return 0; | ||
299 | |||
300 | no_group: | ||
301 | kfree(ptp->pin_attr); | ||
302 | no_pin_attr: | ||
303 | kfree(ptp->pin_dev_attr); | ||
304 | no_dev_attr: | ||
305 | return err; | ||
306 | } | ||
307 | |||
201 | int ptp_populate_sysfs(struct ptp_clock *ptp) | 308 | int ptp_populate_sysfs(struct ptp_clock *ptp) |
202 | { | 309 | { |
203 | struct device *dev = ptp->dev; | 310 | struct device *dev = ptp->dev; |
@@ -222,7 +329,15 @@ int ptp_populate_sysfs(struct ptp_clock *ptp) | |||
222 | if (err) | 329 | if (err) |
223 | goto out4; | 330 | goto out4; |
224 | } | 331 | } |
332 | if (info->n_pins) { | ||
333 | err = ptp_populate_pins(ptp); | ||
334 | if (err) | ||
335 | goto out5; | ||
336 | } | ||
225 | return 0; | 337 | return 0; |
338 | out5: | ||
339 | if (info->pps) | ||
340 | device_remove_file(dev, &dev_attr_pps_enable); | ||
226 | out4: | 341 | out4: |
227 | if (info->n_per_out) | 342 | if (info->n_per_out) |
228 | device_remove_file(dev, &dev_attr_period); | 343 | device_remove_file(dev, &dev_attr_period); |
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index 47541e1608f3..ebb3ebc7176b 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c | |||
@@ -554,7 +554,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) | |||
554 | printk_ratelimited("%s: Failed to allocate a work queue entry\n", | 554 | printk_ratelimited("%s: Failed to allocate a work queue entry\n", |
555 | dev->name); | 555 | dev->name); |
556 | priv->stats.tx_dropped++; | 556 | priv->stats.tx_dropped++; |
557 | dev_kfree_skb(skb); | 557 | dev_kfree_skb_any(skb); |
558 | return 0; | 558 | return 0; |
559 | } | 559 | } |
560 | 560 | ||
@@ -565,7 +565,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) | |||
565 | dev->name); | 565 | dev->name); |
566 | cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1)); | 566 | cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1)); |
567 | priv->stats.tx_dropped++; | 567 | priv->stats.tx_dropped++; |
568 | dev_kfree_skb(skb); | 568 | dev_kfree_skb_any(skb); |
569 | return 0; | 569 | return 0; |
570 | } | 570 | } |
571 | 571 | ||
@@ -682,7 +682,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) | |||
682 | work->grp); | 682 | work->grp); |
683 | priv->stats.tx_packets++; | 683 | priv->stats.tx_packets++; |
684 | priv->stats.tx_bytes += skb->len; | 684 | priv->stats.tx_bytes += skb->len; |
685 | dev_kfree_skb(skb); | 685 | dev_consume_skb_any(skb); |
686 | return 0; | 686 | return 0; |
687 | } | 687 | } |
688 | 688 | ||
diff --git a/drivers/staging/wlags49_h2/wl_netdev.c b/drivers/staging/wlags49_h2/wl_netdev.c index 965b1c0a4753..69bc0a01ae14 100644 --- a/drivers/staging/wlags49_h2/wl_netdev.c +++ b/drivers/staging/wlags49_h2/wl_netdev.c | |||
@@ -715,7 +715,7 @@ int wl_send( struct wl_private *lp ) | |||
715 | 715 | ||
716 | /* Free the skb and perform queue cleanup, as the buffer was | 716 | /* Free the skb and perform queue cleanup, as the buffer was |
717 | transmitted successfully */ | 717 | transmitted successfully */ |
718 | dev_kfree_skb( lp->txF.skb ); | 718 | dev_consume_skb_any( lp->txF.skb ); |
719 | 719 | ||
720 | lp->txF.skb = NULL; | 720 | lp->txF.skb = NULL; |
721 | lp->txF.port = 0; | 721 | lp->txF.port = 0; |
@@ -1730,7 +1730,7 @@ int wl_send_dma( struct wl_private *lp, struct sk_buff *skb, int port ) | |||
1730 | WL_WDS_NETIF_STOP_QUEUE( lp ); | 1730 | WL_WDS_NETIF_STOP_QUEUE( lp ); |
1731 | lp->netif_queue_on = FALSE; | 1731 | lp->netif_queue_on = FALSE; |
1732 | 1732 | ||
1733 | dev_kfree_skb( skb ); | 1733 | dev_kfree_skb_any( skb ); |
1734 | return 0; | 1734 | return 0; |
1735 | } | 1735 | } |
1736 | } | 1736 | } |
@@ -1755,7 +1755,7 @@ int wl_send_dma( struct wl_private *lp, struct sk_buff *skb, int port ) | |||
1755 | 1755 | ||
1756 | /* Free the skb and perform queue cleanup, as the buffer was | 1756 | /* Free the skb and perform queue cleanup, as the buffer was |
1757 | transmitted successfully */ | 1757 | transmitted successfully */ |
1758 | dev_kfree_skb( skb ); | 1758 | dev_consume_skb_any( skb ); |
1759 | 1759 | ||
1760 | return TRUE; | 1760 | return TRUE; |
1761 | } // wl_send_dma | 1761 | } // wl_send_dma |