Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
carlatat committed Aug 28, 2020
2 parents 0882c17 + dbf4b73 commit a6b7110
Show file tree
Hide file tree
Showing 54 changed files with 5,202 additions and 1,039 deletions.
7 changes: 7 additions & 0 deletions LINUX/bsd_glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,13 @@ struct nm_linux_selrecord_t;

#define tsleep(a, b, c, t) msleep(10)

#ifndef NETMAP_LINUX_HAVE_STRUCT_TIMEVAL
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
#endif /* !NETMAP_LINUX_HAVE_STRUCT_TIMEVAL */

#define microtime do_gettimeofday /* debugging */
#ifndef NETMAP_LINUX_HAVE_DO_GETTIMEOFDAY
#define do_gettimeofday(tv_) \
Expand Down
23 changes: 23 additions & 0 deletions LINUX/configure
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,17 @@ EOF
}
EOF

# (un)use_mm is unavailable in kernel 5.8 and later
add_test 'have KTHREAD_USE_MM' <<EOF
#include <linux/kthread.h>
#include <linux/mmu_context.h>
void dummy(struct mm_struct *mm)
{
kthread_use_mm(mm);
}
EOF

# number of parameters in ndo_select_queue
# (we expect at most one of these to succeed)
params="NULL, NULL"
Expand Down Expand Up @@ -1740,6 +1751,18 @@ EOF
}
EOF

# is struct timeval defined?
add_test 'have STRUCT_TIMEVAL' << EOF
#include <linux/time.h>
void
dummy(struct timeval *tv) {
tv->tv_sec = 0;
tv->tv_usec = 0;
return;
}
EOF

add_test 'have DO_GETTIMEOFDAY' <<EOF
#include <linux/time.h>
Expand Down
7 changes: 5 additions & 2 deletions LINUX/default-config.mak.in_
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ define intel_driver
$(1)@fetch := test -e @SRCDIR@/ext-drivers/$(1)-$(2).tar.gz || wget https://sourceforge.net/projects/e1000/files/$(1)%20stable/$(2)/$(1)-$(2).tar.gz -P @SRCDIR@/ext-drivers/
$(1)@src := tar xf @SRCDIR@/ext-drivers/$(1)-$(2).tar.gz && ln -s $(1)-$(2)/src $(1)
$(1)@patch := patches/intel--$(1)--$(2)
$(1)@prepare :=
$(1)@build = make -C $(1) CFLAGS_EXTRA="$$($(1)@cflags) $(EXTRA_CFLAGS)" @KOPTS@ NETMAP_DRIVER_SUFFIX=@DRVSUFFIX@ KSRC=@KSRC@
$(1)@install = make -C $(1) install INSTALL_MOD_PATH=@MODPATH@ CFLAGS_EXTRA="$$($(1)@cflags) $(EXTRA_CFLAGS)" NETMAP_DRIVER_SUFFIX=@DRVSUFFIX@ KSRC=@KSRC@
$(1)@clean = if [ -d $(1) ]; then make -C $(1) clean CFLAGS_EXTRA="$$($(1)@cflags) $(EXTRA_CFLAGS)" NETMAP_DRIVER_SUFFIX=@DRVSUFFIX@ KSRC=@KSRC@; fi
Expand All @@ -75,10 +74,13 @@ define default
$(1)@v := $(if $($(1)@v),$($(1)@v),$(2))
endef

# some additional, driver-specific CFLAGS (used in the @build variable above)
# some additional, driver-specific CFLAGS (used in the @build variable above) and fixes
e1000e@cflags := -fno-pie
igb@cflags := -DDISABLE_PACKET_SPLIT -fno-pie
ixgbe@cflags := @REC_DISABLED_WARNINGS@
igb@prepare := $(if $(filter $(igb@v),5.3.5.61),@SRCDIR@/intel-fix.sh igb,)
e1000e@prepare := $(if $(filter $(e1000e@v),3.8.4),@SRCDIR@/intel-fix.sh e1000e,)
ixgbevf@prepare := $(if $(filter $(ixgbevf@v),4.7.1),@SRCDIR@/intel-fix.sh ixgbevf,)

# set all the default versions (can be overrided by --select-version=)
$(eval $(call default,ixgbe,5.3.8))
Expand All @@ -90,6 +92,7 @@ $(eval $(call default,i40e,2.4.6))
# only define the drivers that are selected after the --(no-)ext-drivers= processing (variable E_DRIVERS)
$(foreach d,$(filter ixgbe ixgbevf e1000e igb i40e,$(E_DRIVERS)),$(eval $(call intel_driver,$d,$($(d)@v))))


define mellanox_driver
$(1)@fetch := test -e @SRCDIR@/ext-drivers/mlnx-en-$(2)-ubuntu18.04-x86_64.tgz || wget http://content.mellanox.com/ofed/MLNX_EN-$(2)/mlnx-en-$(2)-ubuntu18.04-x86_64.tgz -P @SRCDIR@/ext-drivers
$(1)@src := tar xf @SRCDIR@/ext-drivers/mlnx-en-$(2)-ubuntu18.04-x86_64.tgz && tar xf mlnx-en-$(2)-ubuntu18.04-x86_64/src/MLNX_EN_SRC-$(2).tgz && tar xf MLNX_EN_SRC-$(2)/SOURCES/mlnx-en_$($(1)@pv).orig.tar.gz && ln -s mlnx-en-$($(1)@pv) $(1)
Expand Down
32 changes: 30 additions & 2 deletions LINUX/final-patches/intel--e1000e--3.6.0
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
diff --git a/e1000e/Makefile b/e1000e/Makefile
index f300712..d8ca5dd 100644
index f300712..01c2de9 100644
--- a/e1000e/Makefile
+++ b/e1000e/Makefile
@@ -36,7 +36,7 @@ e1000e-y += kcompat.o
@@ -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

Expand Down
119 changes: 119 additions & 0 deletions LINUX/final-patches/intel--e1000e--3.8.4
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.
Loading

0 comments on commit a6b7110

Please sign in to comment.