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 6AAD2A0C4D; Thu, 17 Jun 2021 10:14:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E03024067A; Thu, 17 Jun 2021 10:14:55 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 5F20B40150 for ; Thu, 17 Jun 2021 10:14:54 +0200 (CEST) IronPort-SDR: lAaLtq/LFtnYB0mFzqC+i0ZNJkHCJeIvGkcldi7nDsC1HJ/crk4yae5os8rxS+vBB5sc4jYaei oKiIXVvESHTg== X-IronPort-AV: E=McAfee;i="6200,9189,10017"; a="206361068" X-IronPort-AV: E=Sophos;i="5.83,280,1616482800"; d="scan'208";a="206361068" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2021 01:14:52 -0700 IronPort-SDR: bEu8IQfULqLTFH0G/yct4KQCahXObLqTGGuhPnbd7oKK9YtzleY6ho2tP5xfDZ5Et5NbQZQiWV eSrDOz8EC6wQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,280,1616482800"; d="scan'208";a="488573244" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by fmsmga002.fm.intel.com with ESMTP; 17 Jun 2021 01:14:51 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit Date: Thu, 17 Jun 2021 09:14:46 +0100 Message-Id: <20210617081449.2045195-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC 1/4] test/virtual_pmd: enable getting device operations 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" This will be used to overwrite the dev_ops for various tests. Signed-off-by: Ferruh Yigit --- app/test/virtual_pmd.c | 14 ++++++++++++-- app/test/virtual_pmd.h | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index 7036f401ed95..4d6ce302a563 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -350,8 +350,8 @@ virtual_ethdev_rx_burst_success(void *queue __rte_unused, static uint16_t virtual_ethdev_rx_burst_fail(void *queue __rte_unused, - struct rte_mbuf **bufs __rte_unused, - uint16_t nb_pkts __rte_unused) + struct rte_mbuf **bufs __rte_unused, + uint16_t nb_pkts __rte_unused) { return 0; } @@ -614,3 +614,13 @@ virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, return -1; } + +struct eth_dev_ops * +virtual_ethdev_ops_get(uint16_t port_id) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + struct virtual_ethdev_private *dev_private = dev->data->dev_private; + struct eth_dev_ops *dev_ops = &dev_private->dev_ops; + + return dev_ops; +} diff --git a/app/test/virtual_pmd.h b/app/test/virtual_pmd.h index 120b58b27395..517dd0d2efa6 100644 --- a/app/test/virtual_pmd.h +++ b/app/test/virtual_pmd.h @@ -70,6 +70,12 @@ void virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(uint16_t port_id, uint8_t packet_fail_count); +/* Let application get dev_ops to be able to overwrite some operations + * per the specific test needs. + */ +struct eth_dev_ops * +virtual_ethdev_ops_get(uint16_t port_id); + #ifdef __cplusplus } #endif -- 2.31.1