From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7FE31A0C43; Fri, 22 Oct 2021 15:27:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C4044114A; Fri, 22 Oct 2021 15:27:07 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id B197E41149 for ; Fri, 22 Oct 2021 15:27:05 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10144"; a="209403451" X-IronPort-AV: E=Sophos;i="5.87,172,1631602800"; d="scan'208";a="209403451" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2021 06:26:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,172,1631602800"; d="scan'208";a="595549181" Received: from sivswdev08.ir.intel.com ([10.237.217.47]) by orsmga004.jf.intel.com with ESMTP; 22 Oct 2021 06:26:47 -0700 From: Konstantin Ananyev To: dev@dpdk.org Cc: chas3@att.com, humin29@huawei.com, leweix.yang@intel.com, Konstantin Ananyev Date: Fri, 22 Oct 2021 14:26:42 +0100 Message-Id: <20211022132642.30669-1-konstantin.ananyev@intel.com> X-Mailer: git-send-email 2.18.0 Subject: [dpdk-dev] [PATCH] test/bonding: fix failures after hiding ethdev internal structures X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" link bounding auto-test internally creates emulated ethdev. Some tests change Rx/Tx functions of this emulated device on the fly: by directly modifying rte_eth_dev fields and without doing stop/start for these devices. As now ethdev uses rte_eth_fp_ops[] for fast-path functions, these direct changes doesn't make expected effect. Fix the problem by guarding fast-path functions changes with rte_eth_dev_stop()/rte_eth_dev_start(). Fixes: 7a0935239b9e ("ethdev: make fast-path functions to use new flat array") Reported-by: Lewei Yang Signed-off-by: Konstantin Ananyev --- app/test/virtual_pmd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index 7e15b47eb0..ccdb418490 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -415,10 +415,14 @@ virtual_ethdev_rx_burst_fn_set_success(uint16_t port_id, uint8_t success) { struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; + rte_eth_dev_stop(port_id); + if (success) vrtl_eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_success; else vrtl_eth_dev->rx_pkt_burst = virtual_ethdev_rx_burst_fail; + + rte_eth_dev_start(port_id); } @@ -428,6 +432,7 @@ virtual_ethdev_tx_burst_fn_set_success(uint16_t port_id, uint8_t success) struct virtual_ethdev_private *dev_private = NULL; struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; + rte_eth_dev_stop(port_id); dev_private = vrtl_eth_dev->data->dev_private; if (success) @@ -436,6 +441,7 @@ virtual_ethdev_tx_burst_fn_set_success(uint16_t port_id, uint8_t success) vrtl_eth_dev->tx_pkt_burst = virtual_ethdev_tx_burst_fail; dev_private->tx_burst_fail_count = 0; + rte_eth_dev_start(port_id); } void @@ -445,7 +451,6 @@ virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(uint16_t port_id, struct virtual_ethdev_private *dev_private = NULL; struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; - dev_private = vrtl_eth_dev->data->dev_private; dev_private->tx_burst_fail_count = packet_fail_count; } -- 2.26.3