sipcap/netmap/LINUX/final-patches/diff--e1000e--30900--99999
farrokhi ccdba9490b - add netmap-libpcap
- add netmap (FreeBSD header files need to be updated with this)
- move prototype perl scripts to prototype/ folder
- create basic structure for sipcap app (no code yet)
2014-07-10 17:04:13 +04:30

92 lines
2.8 KiB
Plaintext

diff --git a/e1000e/netdev.c b/e1000e/netdev.c
index 7e615e2..f9d8a88 100644
--- a/e1000e/netdev.c
+++ b/e1000e/netdev.c
@@ -473,6 +473,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
+
/**
* e1000e_systim_to_hwtstamp - convert system time value to hw time stamp
* @adapter: board private structure
@@ -914,6 +918,10 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done,
bool cleaned = false;
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_EXT(*rx_ring, i);
staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
@@ -1203,6 +1211,10 @@ static bool e1000_clean_tx_irq(struct e1000_ring *tx_ring)
unsigned int total_tx_bytes = 0, total_tx_packets = 0;
unsigned int bytes_compl = 0, pkts_compl = 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);
@@ -3685,6 +3697,10 @@ static void e1000_configure(struct e1000_adapter *adapter)
e1000e_setup_rss_hash(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(rx_ring, e1000_desc_unused(rx_ring), GFP_KERNEL);
}
@@ -3988,6 +4004,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;
@@ -4307,6 +4327,10 @@ static int e1000_open(struct net_device *netdev)
adapter->tx_hang_recheck = false;
netif_start_queue(netdev);
+#ifdef DEV_NETMAP
+ netmap_enable_all_rings(netdev);
+#endif /* DEV_NETMAP */
+
adapter->idle_check = true;
hw->mac.get_link_status = true;
pm_runtime_put(&pdev->dev);
@@ -6768,6 +6792,9 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
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);
@@ -6866,6 +6893,10 @@ static void 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);