92 lines
2.7 KiB
Plaintext
92 lines
2.7 KiB
Plaintext
|
diff --git a/e1000e/netdev.c b/e1000e/netdev.c
|
||
|
index fad8f9e..50f74e2 100644
|
||
|
--- a/e1000e/netdev.c
|
||
|
+++ b/e1000e/netdev.c
|
||
|
@@ -87,6 +87,10 @@ static int e1000_desc_unused(struct e1000_ring *ring)
|
||
|
return ring->count + ring->next_to_clean - ring->next_to_use - 1;
|
||
|
}
|
||
|
|
||
|
+#if defined(CONFIG_NETMAP) || defined(CONFIG_NETMAP_MODULE)
|
||
|
+#include <if_e1000e_netmap.h>
|
||
|
+#endif
|
||
|
+
|
||
|
/**
|
||
|
* e1000_receive_skb - helper function to handle Rx indications
|
||
|
* @adapter: board private structure
|
||
|
@@ -446,6 +450,10 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
|
||
|
bool cleaned = 0;
|
||
|
unsigned int total_rx_bytes = 0, total_rx_packets = 0;
|
||
|
|
||
|
+#ifdef DEV_NETMAP
|
||
|
+ if (netmap_rx_irq(netdev, 0, work_done))
|
||
|
+ return 1; /* seems to be ignored */
|
||
|
+#endif /* DEV_NETMAP */
|
||
|
i = rx_ring->next_to_clean;
|
||
|
rx_desc = E1000_RX_DESC(*rx_ring, i);
|
||
|
buffer_info = &rx_ring->buffer_info[i];
|
||
|
@@ -624,6 +632,10 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
|
||
|
unsigned int count = 0;
|
||
|
unsigned int total_tx_bytes = 0, total_tx_packets = 0;
|
||
|
|
||
|
+#ifdef DEV_NETMAP
|
||
|
+ if (netmap_tx_irq(netdev, 0))
|
||
|
+ return 1; /* cleaned ok */
|
||
|
+#endif /* DEV_NETMAP */
|
||
|
i = tx_ring->next_to_clean;
|
||
|
eop = tx_ring->buffer_info[i].next_to_watch;
|
||
|
eop_desc = E1000_TX_DESC(*tx_ring, eop);
|
||
|
@@ -2632,6 +2644,10 @@ static void e1000_configure(struct e1000_adapter *adapter)
|
||
|
e1000_configure_tx(adapter);
|
||
|
e1000_setup_rctl(adapter);
|
||
|
e1000_configure_rx(adapter);
|
||
|
+#ifdef DEV_NETMAP
|
||
|
+ if (e1000e_netmap_init_buffers(adapter))
|
||
|
+ return;
|
||
|
+#endif /* DEV_NETMAP */
|
||
|
adapter->alloc_rx_buf(adapter, e1000_desc_unused(adapter->rx_ring));
|
||
|
}
|
||
|
|
||
|
@@ -2892,6 +2908,10 @@ void e1000e_down(struct e1000_adapter *adapter)
|
||
|
|
||
|
netif_stop_queue(netdev);
|
||
|
|
||
|
+#ifdef DEV_NETMAP
|
||
|
+ netmap_disable_all_rings(netdev);
|
||
|
+#endif
|
||
|
+
|
||
|
/* disable transmits in the hardware */
|
||
|
tctl = er32(TCTL);
|
||
|
tctl &= ~E1000_TCTL_EN;
|
||
|
@@ -3174,6 +3194,10 @@ static int e1000_open(struct net_device *netdev)
|
||
|
|
||
|
netif_start_queue(netdev);
|
||
|
|
||
|
+#ifdef DEV_NETMAP
|
||
|
+ netmap_enable_all_rings(netdev);
|
||
|
+#endif /* DEV_NETMAP */
|
||
|
+
|
||
|
/* fire a link status change interrupt to start the watchdog */
|
||
|
ew32(ICS, E1000_ICS_LSC);
|
||
|
|
||
|
@@ -5227,6 +5251,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
|
||
|
if (err)
|
||
|
goto err_register;
|
||
|
|
||
|
+#ifdef DEV_NETMAP
|
||
|
+ e1000_netmap_attach(adapter);
|
||
|
+#endif /* DEV_NETMAP */
|
||
|
/* carrier off reporting is important to ethtool even BEFORE open */
|
||
|
netif_carrier_off(netdev);
|
||
|
|
||
|
@@ -5300,6 +5327,10 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
|
||
|
kfree(adapter->tx_ring);
|
||
|
kfree(adapter->rx_ring);
|
||
|
|
||
|
+#ifdef DEV_NETMAP
|
||
|
+ netmap_detach(netdev);
|
||
|
+#endif /* DEV_NETMAP */
|
||
|
+
|
||
|
iounmap(adapter->hw.hw_addr);
|
||
|
if (adapter->hw.flash_address)
|
||
|
iounmap(adapter->hw.flash_address);
|