forked from luigirizzo/netmap
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
54 changed files
with
5,202 additions
and
1,039 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
diff --git a/e1000e/Makefile b/e1000e/Makefile | ||
index 9af58b1..00ca1e8 100644 | ||
--- a/e1000e/Makefile | ||
+++ b/e1000e/Makefile | ||
@@ -9,9 +9,9 @@ ifneq ($(KERNELRELEASE),) | ||
# Makefile for the @SUMMARY@ | ||
# | ||
|
||
-obj-$(CONFIG_E1000E) += e1000e.o | ||
+obj-$(CONFIG_E1000E) += e1000e$(NETMAP_DRIVER_SUFFIX).o | ||
|
||
-define e1000e-y | ||
+define e1000e$(NETMAP_DRIVER_SUFFIX)-y | ||
netdev.o | ||
ethtool.o | ||
ich8lan.o | ||
@@ -23,20 +23,20 @@ define e1000e-y | ||
82571.o | ||
param.o | ||
endef | ||
-e1000e-y := $(strip ${e1000e-y}) | ||
+e1000e$(NETMAP_DRIVER_SUFFIX)-y := $(strip ${e1000e$(NETMAP_DRIVER_SUFFIX)-y}) | ||
|
||
#ifdef BUILD_PTP_SUPPORT | ||
-e1000e-$(CONFIG_PTP_1588_CLOCK:m=y) += ptp.o | ||
+e1000e$(NETMAP_DRIVER_SUFFIX)-$(CONFIG_PTP_1588_CLOCK:m=y) += ptp.o | ||
#endif | ||
|
||
#ifndef REMOVE_COMPAT | ||
|
||
-e1000e-y += kcompat.o | ||
+e1000e$(NETMAP_DRIVER_SUFFIX)-y += kcompat.o | ||
|
||
else # ifneq($(KERNELRELEASE),) | ||
# normal makefile | ||
|
||
-DRIVER := e1000e | ||
+DRIVER := e1000e$(NETMAP_DRIVER_SUFFIX) | ||
|
||
ifeq (,$(wildcard common.mk)) | ||
$(error Cannot find common.mk build rules) | ||
diff --git a/e1000e/netdev.c b/e1000e/netdev.c | ||
index bfd9dc8..b7e91da 100644 | ||
--- a/e1000e/netdev.c | ||
+++ b/e1000e/netdev.c | ||
@@ -483,6 +483,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 | ||
+ | ||
#ifdef HAVE_HW_TIME_STAMP | ||
/** | ||
* e1000e_systim_to_hwtstamp - convert system time value to hw time stamp | ||
@@ -1013,6 +1017,17 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring) | ||
bool cleaned = false; | ||
unsigned int total_rx_bytes = 0, total_rx_packets = 0; | ||
|
||
+#ifdef DEV_NETMAP | ||
+#ifdef CONFIG_E1000E_NAPI | ||
+#define NETMAP_DUMMY work_done | ||
+#else | ||
+ int dummy; | ||
+#define NETMAP_DUMMY &dummy | ||
+#endif | ||
+ if (netmap_rx_irq(netdev, 0, NETMAP_DUMMY)) | ||
+ return true; | ||
+#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); | ||
@@ -1330,6 +1345,11 @@ 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 true; /* 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); | ||
@@ -4263,6 +4283,10 @@ static void e1000_configure(struct e1000_adapter *adapter) | ||
#endif | ||
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); | ||
} | ||
|
||
@@ -8735,6 +8759,10 @@ 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); | ||
|
||
@@ -8831,6 +8859,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) && | ||
(adapter->hw.mac.type < e1000_pch_spt)) |
Empty file.
Oops, something went wrong.