From: Ilya Maximets Date: Wed, 10 Oct 2018 14:12:20 +0000 (+0300) Subject: drivers/net: use sleep delay by default for Intel NICs X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fd61c749dbb2224d1e988085340c22ab9c985243;p=dpdk.git drivers/net: use sleep delay by default for Intel NICs NICs uses different delays up to a second during their configuration. It makes no sense to busy-wait so long wasting CPU cycles and preventing any other threads to execute on the same CPU core. These busy polling are the rudiments that came from the kernel drivers where you can not sleep in interrupt context, but as we're in userspace, we're able and should sleep to allow other threads to run. Delays never called on rx/tx path, so this should not affect performance. Signed-off-by: Ilya Maximets Reviewed-by: Ferruh Yigit --- diff --git a/drivers/net/avf/Makefile b/drivers/net/avf/Makefile index 0a142c1045..aec6e4cba2 100644 --- a/drivers/net/avf/Makefile +++ b/drivers/net/avf/Makefile @@ -8,7 +8,7 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_pmd_avf.a -CFLAGS += -O3 $(WERROR_FLAGS) -Wno-strict-aliasing +CFLAGS += -O3 $(WERROR_FLAGS) -Wno-strict-aliasing -DALLOW_EXPERIMENTAL_API LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash LDLIBS += -lrte_bus_pci diff --git a/drivers/net/avf/base/avf_osdep.h b/drivers/net/avf/base/avf_osdep.h index 9ef45968e7..442a5acd06 100644 --- a/drivers/net/avf/base/avf_osdep.h +++ b/drivers/net/avf/base/avf_osdep.h @@ -93,8 +93,8 @@ typedef uint64_t u64; #define avf_memset(a, b, c, d) memset((a), (b), (c)) #define avf_memcpy(a, b, c, d) rte_memcpy((a), (b), (c)) -#define avf_usec_delay(x) rte_delay_us(x) -#define avf_msec_delay(x) rte_delay_us(1000*(x)) +#define avf_usec_delay(x) rte_delay_us_sleep(x) +#define avf_msec_delay(x) avf_usec_delay(1000 * (x)) #define AVF_PCI_REG(reg) rte_read32(reg) #define AVF_PCI_REG_ADDR(a, reg) \ diff --git a/drivers/net/avf/meson.build b/drivers/net/avf/meson.build index 9a05ebbf4e..2dfda9d4eb 100644 --- a/drivers/net/avf/meson.build +++ b/drivers/net/avf/meson.build @@ -3,6 +3,8 @@ cflags += ['-Wno-strict-aliasing'] +allow_experimental_apis = true + subdir('base') objs = [base_objs] diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile index 9c87e883b7..0ed6276568 100644 --- a/drivers/net/e1000/Makefile +++ b/drivers/net/e1000/Makefile @@ -10,6 +10,7 @@ LIB = librte_pmd_e1000.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_bus_pci diff --git a/drivers/net/e1000/base/e1000_osdep.h b/drivers/net/e1000/base/e1000_osdep.h index b8868049fe..5958ea157a 100644 --- a/drivers/net/e1000/base/e1000_osdep.h +++ b/drivers/net/e1000/base/e1000_osdep.h @@ -48,7 +48,7 @@ #include "../e1000_logs.h" -#define DELAY(x) rte_delay_us(x) +#define DELAY(x) rte_delay_us_sleep(x) #define usec_delay(x) DELAY(x) #define usec_delay_irq(x) DELAY(x) #define msec_delay(x) DELAY(1000*(x)) diff --git a/drivers/net/e1000/meson.build b/drivers/net/e1000/meson.build index cf456995cc..d0901d3779 100644 --- a/drivers/net/e1000/meson.build +++ b/drivers/net/e1000/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation +allow_experimental_apis = true + subdir('base') objs = [base_objs] diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h index 9d6ee4d236..8a2d82a8d0 100644 --- a/drivers/net/i40e/base/i40e_osdep.h +++ b/drivers/net/i40e/base/i40e_osdep.h @@ -205,9 +205,9 @@ struct i40e_spinlock { #define i40e_memcpy(a, b, c, d) rte_memcpy((a), (b), (c)) #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) -#define DELAY(x) rte_delay_us(x) -#define i40e_usec_delay(x) rte_delay_us(x) -#define i40e_msec_delay(x) rte_delay_us(1000*(x)) +#define DELAY(x) rte_delay_us_sleep(x) +#define i40e_usec_delay(x) DELAY(x) +#define i40e_msec_delay(x) DELAY(1000 * (x)) #define udelay(x) DELAY(x) #define msleep(x) DELAY(1000*(x)) #define usleep_range(min, max) msleep(DIV_ROUND_UP(min, 1000)) diff --git a/drivers/net/ifc/base/ifcvf_osdep.h b/drivers/net/ifc/base/ifcvf_osdep.h index cf151ef52b..6aef25ea45 100644 --- a/drivers/net/ifc/base/ifcvf_osdep.h +++ b/drivers/net/ifc/base/ifcvf_osdep.h @@ -17,7 +17,7 @@ #define DEBUGOUT(S, args...) RTE_LOG(DEBUG, PMD, S, ##args) #define STATIC static -#define msec_delay rte_delay_ms +#define msec_delay(x) rte_delay_us_sleep(1000 * (x)) #define IFCVF_READ_REG8(reg) rte_read8(reg) #define IFCVF_WRITE_REG8(val, reg) rte_write8((val), (reg)) diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h index e648ea4626..ea8dc1cbe5 100644 --- a/drivers/net/ixgbe/base/ixgbe_osdep.h +++ b/drivers/net/ixgbe/base/ixgbe_osdep.h @@ -21,7 +21,7 @@ #define ASSERT(x) if(!(x)) rte_panic("IXGBE: x") -#define DELAY(x) rte_delay_us(x) +#define DELAY(x) rte_delay_us_sleep(x) #define usec_delay(x) DELAY(x) #define msec_delay(x) DELAY(1000*(x)) diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build index 02d5ef5e4a..544a141484 100644 --- a/drivers/net/ixgbe/meson.build +++ b/drivers/net/ixgbe/meson.build @@ -5,10 +5,11 @@ version = 2 cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS'] +allow_experimental_apis = true + subdir('base') objs = [base_objs] -allow_experimental_apis = true sources = files( 'ixgbe_82599_bypass.c', 'ixgbe_bypass.c',