From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id ED81C1B4A8 for ; Thu, 4 Oct 2018 16:33:47 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181004143347euoutp012efe559d28643b09241c5b15bcc251ac~abmqqKYLV2949829498euoutp01D; Thu, 4 Oct 2018 14:33:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181004143347euoutp012efe559d28643b09241c5b15bcc251ac~abmqqKYLV2949829498euoutp01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1538663627; bh=2bguzgmwKj8nhRwGO5/OPA8FR2rWoDJUs/L9pjvVmJM=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=c7hxwRibXR4pK2MsYJCSA103eHHkS2v//vUq/9eQmCMow6S72fC1HTKk9JtZz352E ToUhiap70AWvL9tsDhYrAOIN6kGVm7NufiaFZJCkfjdb1os5mrq4ibnq54P/goLdGB 2WqjMercqm2o9K3x0TgkWTdlWFntX4D/2UjKYvpE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181004143346eucas1p156f4a11bb36a71b1f8ac627230f25917~abmqEQadW2115821158eucas1p1V; Thu, 4 Oct 2018 14:33:46 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id C2.58.04441.AC426BB5; Thu, 4 Oct 2018 15:33:46 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181004143345eucas1p2f9dfea7ea41111c2ce9cab98434339d0~abmpXkAZu0286602866eucas1p2S; Thu, 4 Oct 2018 14:33:45 +0000 (GMT) X-AuditID: cbfec7f2-a1ae89c000001159-cf-5bb624cac43d Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F6.B3.04128.9C426BB5; Thu, 4 Oct 2018 15:33:45 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PG200HZEWFYOX20@eusync1.samsung.com>; Thu, 04 Oct 2018 15:33:45 +0100 (BST) From: Ilya Maximets To: dev@dpdk.org Cc: Jingjing Wu , Konstantin Ananyev , Wenzhuo Lu , Beilei Xing , Qi Zhang , Xiao Wang , Bruce Richardson , Stephen Hemminger , Keith Wiles , Ilya Maximets Date: Thu, 04 Oct 2018 17:35:50 +0300 Message-id: <20181004143550.23077-3-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181004143550.23077-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsWy7djPc7qnVLZFG+x6xGHR/aGFyeLGKnuL d5+2M1lcaf/JbjFzwWdGi6vHvzNbvP+ziMVi+oZ+NovFd+Qstp75y2ix//lhdgduj18LlrJ6 LN7zksmj5+Q8Jo++LasYA1iiuGxSUnMyy1KL9O0SuDL+br3CXHBbr+L9i/ssDYz31bsYOTkk BEwkOp53MnYxcnEICaxglDh4vJMVwvnMKLFt5i1GmKrbp9azQSSWMUosOHSEFSQhJNDMJHFx RTqIzSagI3Fq9RGwBhEBAYnPnYvBGpgF5jBLNK7awwaSEBYIkDh94hRYM4uAqsS6w/1gDbwC 1hL3Xn6E2iYvsXrDAWYQm1PARuL9sg9gJ0kIzGGTuLL7MDtEkYvE1EvfmSBsYYlXx7dAxWUk Lk/uZoGw6yXut7xkhGjuYJSYfugfVIO9xJbX58AamAX4JCZtmw60jQMozivR0SYEUeIhMenb b2hYHGSU2DFlOssERskFj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X/8YzjKb2Ib1xKgoa3EUpyR aKjFXFScCADzxv9zKQIAAA== X-CMS-MailID: 20181004143345eucas1p2f9dfea7ea41111c2ce9cab98434339d0 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181004143345eucas1p2f9dfea7ea41111c2ce9cab98434339d0 References: <20180914110109.29900-1-i.maximets@samsung.com> <20181004143550.23077-1-i.maximets@samsung.com> Subject: [dpdk-dev] [PATCH v3 2/2] drivers/net: use sleep delay by default for intel NICs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Oct 2018 14:33:48 -0000 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 --- drivers/net/avf/Makefile | 2 +- drivers/net/avf/base/avf_osdep.h | 4 ++-- drivers/net/avf/meson.build | 2 ++ drivers/net/e1000/Makefile | 1 + drivers/net/e1000/base/e1000_osdep.h | 2 +- drivers/net/e1000/meson.build | 2 ++ drivers/net/i40e/base/i40e_osdep.h | 6 +++--- drivers/net/ifc/base/ifcvf_osdep.h | 2 +- drivers/net/ixgbe/base/ixgbe_osdep.h | 2 +- drivers/net/ixgbe/meson.build | 3 ++- 10 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/net/avf/Makefile b/drivers/net/avf/Makefile index 0a142c104..aec6e4cba 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 9ef45968e..442a5acd0 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 9a05ebbf4..2dfda9d4e 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 9c87e883b..0ed627656 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 b8868049f..5958ea157 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 cf456995c..d0901d377 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 8e5c593c9..a6072e153 100644 --- a/drivers/net/i40e/base/i40e_osdep.h +++ b/drivers/net/i40e/base/i40e_osdep.h @@ -233,9 +233,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 cf151ef52..6aef25ea4 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 e648ea462..ea8dc1cbe 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 02d5ef5e4..544a14148 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', -- 2.17.1