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.
linux/ixgbevf: patch for Intel 4.6.3 version
- Loading branch information
1 parent
9ec13dc
commit cb68f3d
Showing
1 changed file
with
168 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
diff --git a/ixgbevf/Makefile b/ixgbevf/Makefile | ||
index b37fbce..f3cdb26 100644 | ||
--- a/ixgbevf/Makefile | ||
+++ b/ixgbevf/Makefile | ||
@@ -7,22 +7,22 @@ ifneq ($(KERNELRELEASE),) | ||
# Makefile for the Intel(R) 10GbE PCI Express Virtual Function Driver | ||
# | ||
|
||
-obj-$(CONFIG_IXGBEVF) += ixgbevf.o | ||
+obj-$(CONFIG_IXGBEVF) += ixgbevf$(NETMAP_DRIVER_SUFFIX).o | ||
|
||
-define ixgbevf-y | ||
+define ixgbevf$(NETMAP_DRIVER_SUFFIX)-y | ||
ixgbevf_main.o | ||
ixgbevf_ethtool.o | ||
ixgbe_vf.o | ||
ixgbe_mbx.o | ||
endef | ||
-ixgbevf-y := $(strip ${ixgbevf-y}) | ||
-ixgbevf-${CONFIG_PCI_HYPERV:m=y} += ixgbe_hv_vf.o | ||
-ixgbevf-y += kcompat.o | ||
+ixgbevf$(NETMAP_DRIVER_SUFFIX)-y := $(strip ${ixgbevf$(NETMAP_DRIVER_SUFFIX)-y}) | ||
+ixgbevf$(NETMAP_DRIVER_SUFFIX)-${CONFIG_PCI_HYPERV:m=y} += ixgbe_hv_vf.o | ||
+ixgbevf$(NETMAP_DRIVER_SUFFIX)-y += kcompat.o | ||
|
||
else # ifneq($(KERNELRELEASE),) | ||
# normal makefile | ||
|
||
-DRIVER := ixgbevf | ||
+DRIVER := ixgbevf$(NETMAP_DRIVER_SUFFIX) | ||
|
||
ifeq (,$(wildcard common.mk)) | ||
$(error Cannot find common.mk build rules) | ||
@@ -69,9 +69,12 @@ ccc: clean | ||
@+$(call kernelbuild,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 kernelbuild,clean) | ||
diff --git a/ixgbevf/ixgbevf_main.c b/ixgbevf/ixgbevf_main.c | ||
index e7bd791..c845e6c 100644 | ||
--- a/ixgbevf/ixgbevf_main.c | ||
+++ b/ixgbevf/ixgbevf_main.c | ||
@@ -338,6 +338,23 @@ static void ixgbevf_tx_timeout(struct net_device *netdev) | ||
ixgbevf_tx_timeout_reset(adapter); | ||
} | ||
|
||
+#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 | ||
+ */ | ||
+#define NM_IXGBEVF | ||
+#include <ixgbe_netmap_linux.h> | ||
+#endif | ||
|
||
/** | ||
* ixgbevf_clean_tx_irq - Reclaim resources after transmit completes | ||
@@ -358,6 +375,17 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector, | ||
if (test_bit(__IXGBEVF_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 = IXGBEVF_TX_DESC(tx_ring, i); | ||
i -= tx_ring->count; | ||
@@ -1356,6 +1384,16 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, | ||
bool xdp_xmit = false; | ||
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 | ||
@@ -2054,6 +2092,10 @@ static void ixgbevf_configure_tx_ring(struct ixgbevf_adapter *adapter, | ||
clear_bit(__IXGBEVF_HANG_CHECK_ARMED, &ring->state); | ||
clear_bit(__IXGBEVF_TX_XDP_RING_PRIMED, &ring->state); | ||
|
||
+#ifdef DEV_NETMAP | ||
+ txdctl = ixgbe_netmap_configure_tx_ring(adapter, reg_idx, txdctl); | ||
+#endif /* DEV_NETMAP */ | ||
+ | ||
IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(reg_idx), txdctl); | ||
|
||
/* poll to verify queue is enabled */ | ||
@@ -2288,6 +2330,10 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_adapter *adapter, | ||
IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(reg_idx), rxdctl); | ||
|
||
ixgbevf_rx_desc_queue_enable(adapter, ring); | ||
+#ifdef DEV_NETMAP | ||
+ if (ixgbe_netmap_configure_rx_ring(adapter, reg_idx)) | ||
+ return; | ||
+#endif /* DEV_NETMAP */ | ||
ixgbevf_alloc_rx_buffers(ring, ixgbevf_desc_unused(ring)); | ||
} | ||
|
||
@@ -5581,8 +5627,10 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev, | ||
if (netdev->features & NETIF_F_GRO) | ||
DPRINTK(PROBE, INFO, "GRO is enabled\n"); | ||
#endif | ||
- | ||
DPRINTK(PROBE, INFO, "%s\n", ixgbevf_driver_string); | ||
+#ifdef DEV_NETMAP | ||
+ ixgbe_netmap_attach(adapter); | ||
+#endif /* DEV_NETMAP */ | ||
return 0; | ||
|
||
err_register: | ||
@@ -5623,6 +5671,10 @@ static void __devexit ixgbevf_remove(struct pci_dev *pdev) | ||
|
||
adapter = netdev_priv(netdev); | ||
|
||
+#ifdef DEV_NETMAP | ||
+ ixgbe_netmap_detach(adapter); | ||
+#endif /* DEV_NETMAP */ | ||
+ | ||
set_bit(__IXGBEVF_REMOVING, &adapter->state); | ||
cancel_work_sync(&adapter->service_task); | ||
|
||
diff --git a/ixgbevf/kcompat.h b/ixgbevf/kcompat.h | ||
index 785e735..56246ec 100644 | ||
--- a/ixgbevf/kcompat.h | ||
+++ b/ixgbevf/kcompat.h | ||
@@ -4,6 +4,8 @@ | ||
#ifndef _KCOMPAT_H_ | ||
#define _KCOMPAT_H_ | ||
|
||
+#include <netmap_linux_config.h> | ||
+ | ||
#ifndef LINUX_VERSION_CODE | ||
#include <linux/version.h> | ||
#else |