From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E2E91A0527; Mon, 20 Jan 2020 16:12:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7B9BE1BEA9; Mon, 20 Jan 2020 16:12:45 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 958524C7A; Mon, 20 Jan 2020 16:12:41 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 07:12:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,342,1574150400"; d="scan'208";a="219674115" Received: from dpdk-xiao1.sh.intel.com ([10.67.110.150]) by orsmga008.jf.intel.com with ESMTP; 20 Jan 2020 07:12:39 -0800 From: Xiao Wang To: david.hunt@intel.com Cc: dev@dpdk.org, Xiao Wang , stable@dpdk.org Date: Mon, 20 Jan 2020 22:06:57 -0500 Message-Id: <20200121030657.39048-3-xiao.w.wang@intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20200121030657.39048-1-xiao.w.wang@intel.com> References: <20200121030657.39048-1-xiao.w.wang@intel.com> Subject: [dpdk-dev] [PATCH 2/2] l3fwd-power: fix interrupt disable 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Since all related queues' interrupts are turned on before epoll, we need to turn off all the interrupts after wakeup. This patch fixes the issue of only turning off the interrupted queues. Fixes: b736d64787fc ("examples/l3fwd-power: disable Rx interrupt when waking up") Cc: stable@dpdk.org Signed-off-by: Xiao Wang --- examples/l3fwd-power/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index ffcc7ecf4..e9b2cb5b3 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -880,9 +880,6 @@ sleep_until_rx_interrupt(int num) port_id = ((uintptr_t)data) >> CHAR_BIT; queue_id = ((uintptr_t)data) & RTE_LEN2MASK(CHAR_BIT, uint8_t); - rte_spinlock_lock(&(locks[port_id])); - rte_eth_dev_rx_intr_disable(port_id, queue_id); - rte_spinlock_unlock(&(locks[port_id])); RTE_LOG(INFO, L3FWD_POWER, "lcore %u is waked up from rx interrupt on" " port %d queue %d\n", @@ -892,7 +889,7 @@ sleep_until_rx_interrupt(int num) return 0; } -static void turn_on_intr(struct lcore_conf *qconf) +static void turn_on_off_intr(struct lcore_conf *qconf, bool on) { int i; struct lcore_rx_queue *rx_queue; @@ -905,7 +902,10 @@ static void turn_on_intr(struct lcore_conf *qconf) queue_id = rx_queue->queue_id; rte_spinlock_lock(&(locks[port_id])); - rte_eth_dev_rx_intr_enable(port_id, queue_id); + if (on) + rte_eth_dev_rx_intr_enable(port_id, queue_id); + else + rte_eth_dev_rx_intr_disable(port_id, queue_id); rte_spinlock_unlock(&(locks[port_id])); } } @@ -1340,9 +1340,10 @@ main_loop(__attribute__((unused)) void *dummy) else { /* suspend until rx interrupt triggers */ if (intr_en) { - turn_on_intr(qconf); + turn_on_off_intr(qconf, 1); sleep_until_rx_interrupt( qconf->n_rx_queue); + turn_on_off_intr(qconf, 0); /** * start receiving packets immediately */ -- 2.15.1