From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 01B9B5F1C for ; Fri, 14 Sep 2018 12:59:56 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180914105956euoutp02bfd1d9492b1ef1d13e268e3fd225ccb9~UPyPior4R1722317223euoutp02u; Fri, 14 Sep 2018 10:59:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180914105956euoutp02bfd1d9492b1ef1d13e268e3fd225ccb9~UPyPior4R1722317223euoutp02u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536922796; bh=n3+Q6L7+oTWfwBbsMw+fOyEV0DTZDUTGzzki5XBVPPk=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=uo+uhjH7jBCWRJB7V2X6ogrhJ6gFAMtF2b06jOd1ERg+IRq33QnjXxiBhBzKAAw0C k2a3gJ+nVwFs0+0CwuQ8O6SzIFC/YfZmqAnAmtD8Ixvb7VQ0tuWqQFCkPs8b0c30ox b9wDaSQ2nUG+Qjyc+XELXDI2XGUAzIAbNFiDSBcw= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180914105955eucas1p1e2df26c180820e7f894a5deb61586819~UPyPCtpIP0133001330eucas1p1k; Fri, 14 Sep 2018 10:59:55 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 89.27.04441.BA49B9B5; Fri, 14 Sep 2018 11:59:55 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180914105954eucas1p1662492cee6b5387cd4655ec940619ea8~UPyOKrY6P0514605146eucas1p1M; Fri, 14 Sep 2018 10:59:54 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-5f-5b9b94ab7a70 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 5C.9A.04128.AA49B9B5; Fri, 14 Sep 2018 11:59:54 +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 <0PF1002IVL6ZB130@eusync1.samsung.com>; Fri, 14 Sep 2018 11:59:54 +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: Fri, 14 Sep 2018 14:01:09 +0300 Message-id: <20180914110109.29900-3-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180914110109.29900-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsWy7djP87qrp8yONnixX9Si+0MLk8WNVfYW 7z5tZ7K40v6T3WLmgs+MFlePf2e2eP9nEYvF9A39bBaL78hZbD3zl9Fi//PD7A7cHr8WLGX1 WLznJZNHz8l5TB59W1YxBrBEcdmkpOZklqUW6dslcGV8vTiVsWCedsXGud8ZGxhfqHQxcnBI CJhITN2Y1sXIySEksIJR4u5s8S5GLiD7M6PEj5VXWUASIDVH1jxhgUgsY5T43HORCcJpZpK4 MvMbE0gVm4COxKnVRxhBbBEBAYnPnYvZQIqYBeYwSzSu2sMGkhAWCJDYvGc2mM0ioCpxZUYX mM0rYC2xuOMBI8Q6eYnVGw4wg9icAjYS1y4dAVstIbCATeLislfMEHe7SJw7HAxRLyzx6vgW dghbRuLy5G6os+sl7re8ZITo7WCUmH7oHxNEwl5iy+tzYA3MAnwSk7ZNh5rJ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dfLWnmsz530OKp2z8AZTj8eVfdmnbuR1Kaw+PK9gw5sjfDdD3578/9kuVk+J pTgj0VCLuag4EQCZCsjtKAIAAA== X-CMS-MailID: 20180914105954eucas1p1662492cee6b5387cd4655ec940619ea8 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180914105954eucas1p1662492cee6b5387cd4655ec940619ea8 References: <20180903144311eucas1p2b6499c49dbd0d54334e973113cdc5ad6~Q6vBsFYRm1033710337eucas1p2D@eucas1p2.samsung.com> <20180914110109.29900-1-i.maximets@samsung.com> Subject: [dpdk-dev] [PATCH v2 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: Fri, 14 Sep 2018 10:59:57 -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 | 1 + drivers/net/avf/base/avf_osdep.h | 4 ++-- 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 ++- 9 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/net/avf/Makefile b/drivers/net/avf/Makefile index 3f815bbc4..8ee707529 100644 --- a/drivers/net/avf/Makefile +++ b/drivers/net/avf/Makefile @@ -9,6 +9,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_pmd_avf.a CFLAGS += -O3 +CFLAGS += -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/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 bb5dfd2af..94ede9bc2 100644 --- a/drivers/net/ixgbe/base/ixgbe_osdep.h +++ b/drivers/net/ixgbe/base/ixgbe_osdep.h @@ -51,7 +51,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