forked from luigirizzo/netmap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux/ixgbe: patch for Intel 5.11.3 version
- Loading branch information
1 parent
709a1ec
commit 8f144c9
Showing
2 changed files
with
174 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
diff --git a/ixgbe/Makefile b/ixgbe/Makefile | ||
index adccdaa..137c98f 100644 | ||
--- a/ixgbe/Makefile | ||
+++ b/ixgbe/Makefile | ||
@@ -7,9 +7,9 @@ ifneq ($(KERNELRELEASE),) | ||
# Makefile for the Intel(R) 10GbE PCI Express Linux Network Driver | ||
# | ||
|
||
-obj-$(CONFIG_IXGBE) += ixgbe.o | ||
+obj-$(CONFIG_IXGBE) += ixgbe$(NETMAP_DRIVER_SUFFIX).o | ||
|
||
-define ixgbe-y | ||
+define ixgbe$(NETMAP_DRIVER_SUFFIX)-y | ||
ixgbe_main.o | ||
ixgbe_api.o | ||
ixgbe_common.o | ||
@@ -29,24 +29,24 @@ define ixgbe-y | ||
ixgbe_x540.o | ||
ixgbe_x550.o | ||
endef | ||
-ixgbe-y := $(strip ${ixgbe-y}) | ||
+ixgbe$(NETMAP_DRIVER_SUFFIX)-y := $(strip ${ixgbe$(NETMAP_DRIVER_SUFFIX)-y}) | ||
|
||
-ixgbe-${CONFIG_DCB} += ixgbe_dcb_nl.o | ||
+ixgbe$(NETMAP_DRIVER_SUFFIX)-${CONFIG_DCB} += ixgbe_dcb_nl.o | ||
|
||
-ixgbe-${CONFIG_DEBUG_FS} += ixgbe_debugfs.o | ||
+ixgbe$(NETMAP_DRIVER_SUFFIX)-${CONFIG_DEBUG_FS} += ixgbe_debugfs.o | ||
|
||
-ixgbe-${CONFIG_FCOE:m=y} += ixgbe_fcoe.o | ||
+ixgbe$(NETMAP_DRIVER_SUFFIX)-${CONFIG_FCOE:m=y} += ixgbe_fcoe.o | ||
|
||
-ixgbe-$(CONFIG_PTP_1588_CLOCK:m=y) += ixgbe_ptp.o | ||
+ixgbe$(NETMAP_DRIVER_SUFFIX)-$(CONFIG_PTP_1588_CLOCK:m=y) += ixgbe_ptp.o | ||
|
||
-ixgbe-${CONFIG_SYSFS} += ixgbe_sysfs.o | ||
+ixgbe$(NETMAP_DRIVER_SUFFIX)-${CONFIG_SYSFS} += ixgbe_sysfs.o | ||
|
||
-ixgbe-y += kcompat.o | ||
+ixgbe$(NETMAP_DRIVER_SUFFIX)-y += kcompat.o | ||
|
||
else # ifneq($(KERNELRELEASE),) | ||
# normal makefile | ||
|
||
-DRIVER := ixgbe | ||
+DRIVER := ixgbe$(NETMAP_DRIVER_SUFFIX) | ||
|
||
ifeq (,$(wildcard common.mk)) | ||
$(error Cannot find common.mk build rules) | ||
@@ -119,9 +119,12 @@ ccc: clean | ||
@+$(call devkernelbuild,modules,coccicheck MODE=report)) | ||
|
||
# Build manfiles | ||
-manfile: | ||
+manfile: ../$(DRIVER).$(MANSECTION) | ||
@gzip -c ../${DRIVER}.${MANSECTION} > ${DRIVER}.${MANSECTION}.gz | ||
|
||
+../$(DRIVER).$(MANSECTION): | ||
+ touch $@ | ||
+ | ||
# Clean the module subdirectories | ||
clean: | ||
@+$(call devkernelbuild,clean) | ||
diff --git a/ixgbe/ixgbe_main.c b/ixgbe/ixgbe_main.c | ||
index 3205fc0..ce0b0b5 100644 | ||
--- a/ixgbe/ixgbe_main.c | ||
+++ b/ixgbe/ixgbe_main.c | ||
@@ -715,6 +715,23 @@ static void ixgbe_tx_timeout(struct net_device *netdev) | ||
} | ||
} | ||
|
||
+#if defined(CONFIG_NETMAP) || defined(CONFIG_NETMAP_MODULE) | ||
+/* | ||
+ * The #ifdef DEV_NETMAP / #endif blocks in this file are meant to | ||
+ * be a reference on how to implement netmap support in a driver. | ||
+ * Additional comments are in ixgbe_netmap_linux.h . | ||
+ * | ||
+ * The code is originally developed on FreeBSD and in the interest | ||
+ * of maintainability we try to limit differences between the two systems. | ||
+ * | ||
+ * <ixgbe_netmap_linux.h> contains functions for netmap support | ||
+ * that extend the standard driver. | ||
+ * It also defines DEV_NETMAP so further conditional sections use | ||
+ * that instead of CONFIG_NETMAP | ||
+ */ | ||
+#include <ixgbe_netmap_linux.h> | ||
+#endif | ||
+ | ||
/** | ||
* ixgbe_clean_tx_irq - Reclaim resources after transmit completes | ||
* @q_vector: structure containing interrupt and ring information | ||
@@ -734,6 +751,17 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, | ||
if (test_bit(__IXGBE_DOWN, &adapter->state)) | ||
return true; | ||
|
||
+#ifdef DEV_NETMAP | ||
+ /* | ||
+ * In netmap mode, all the work is done in the context | ||
+ * of the client thread. Interrupt handlers only wake up | ||
+ * clients, which may be sleeping on individual rings | ||
+ * or on a global resource for all rings. | ||
+ */ | ||
+ if (netmap_tx_irq(adapter->netdev, tx_ring->queue_index) != NM_IRQ_PASS) | ||
+ return true; | ||
+#endif /* DEV_NETMAP */ | ||
+ | ||
tx_buffer = &tx_ring->tx_buffer_info[i]; | ||
tx_desc = IXGBE_TX_DESC(tx_ring, i); | ||
i -= tx_ring->count; | ||
@@ -2212,6 +2240,16 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | ||
unsigned int xdp_xmit = 0; | ||
struct xdp_buff xdp; | ||
|
||
+#ifdef DEV_NETMAP | ||
+ /* | ||
+ * Same as the txeof routine: only wakeup clients on intr. | ||
+ */ | ||
+ int dummy, nm_irq; | ||
+ nm_irq = netmap_rx_irq(rx_ring->netdev, rx_ring->queue_index, &dummy); | ||
+ if (nm_irq != NM_IRQ_PASS) | ||
+ return (nm_irq == NM_IRQ_RESCHED) ? budget : 1; | ||
+#endif /* DEV_NETMAP */ | ||
+ | ||
xdp.data = NULL; | ||
xdp.data_end = NULL; | ||
#ifdef HAVE_XDP_BUFF_RXQ | ||
@@ -3692,6 +3730,10 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter, | ||
memset(ring->tx_buffer_info, 0, | ||
sizeof(struct ixgbe_tx_buffer) * ring->count); | ||
|
||
+#ifdef DEV_NETMAP | ||
+ txdctl = ixgbe_netmap_configure_tx_ring(adapter, reg_idx, txdctl); | ||
+#endif /* DEV_NETMAP */ | ||
+ | ||
/* enable queue */ | ||
IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), txdctl); | ||
|
||
@@ -4384,6 +4426,12 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, | ||
IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(reg_idx), rxdctl); | ||
|
||
ixgbe_rx_desc_queue_enable(adapter, ring); | ||
+ | ||
+#ifdef DEV_NETMAP | ||
+ if (ixgbe_netmap_configure_rx_ring(adapter, reg_idx)) | ||
+ return; | ||
+#endif /* DEV_NETMAP */ | ||
+ | ||
#ifdef HAVE_AF_XDP_ZC_SUPPORT | ||
if (ring->xsk_pool) | ||
ixgbe_alloc_rx_buffers_zc(ring, ixgbe_desc_unused(ring)); | ||
@@ -13011,6 +13059,10 @@ no_info_string: | ||
hw->mac.ops.setup_eee(hw, eee_enable); | ||
} | ||
|
||
+#ifdef DEV_NETMAP | ||
+ ixgbe_netmap_attach(adapter); | ||
+#endif /* DEV_NETMAP */ | ||
+ | ||
return 0; | ||
|
||
err_register: | ||
@@ -13067,6 +13119,11 @@ static void ixgbe_remove(struct pci_dev *pdev) | ||
return; | ||
|
||
netdev = adapter->netdev; | ||
+ | ||
+#ifdef DEV_NETMAP | ||
+ ixgbe_netmap_detach(adapter); | ||
+#endif /* DEV_NETMAP */ | ||
+ | ||
#ifdef HAVE_IXGBE_DEBUG_FS | ||
ixgbe_dbg_adapter_exit(adapter); | ||
|