From patchwork Thu Jan 7 07:15:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingjing Wu X-Patchwork-Id: 86089 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 98F97A09FF; Thu, 7 Jan 2021 08:29:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A4E0140EDA; Thu, 7 Jan 2021 08:29:01 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 388B4140ED5 for ; Thu, 7 Jan 2021 08:28:59 +0100 (CET) IronPort-SDR: q5MdNnJifyHjkiZP2xyvw53dyn8fIzpEMERZV0Rs/lwHZzY0kxG2PQ1KhEKwvIj+XBtug1egP9 VmeRn5NDO+4g== X-IronPort-AV: E=McAfee;i="6000,8403,9856"; a="173880063" X-IronPort-AV: E=Sophos;i="5.79,329,1602572400"; d="scan'208";a="173880063" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2021 23:28:58 -0800 IronPort-SDR: AvaQhU1chj77wWQt7VDdGD3TB6QAGMEVG7jIviuyOXx39+2nM38JkFDeBlnzFtI0QLIC1zQZIM xwL9Y+1mNpIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,329,1602572400"; d="scan'208";a="379617089" Received: from dpdk-wujingji.sh.intel.com ([10.67.119.101]) by orsmga008.jf.intel.com with ESMTP; 06 Jan 2021 23:28:57 -0800 From: Jingjing Wu To: dev@dpdk.org Cc: jingjing.wu@intel.com, beilei.xing@intel.com, chenbo.xia@intel.com, xiuchun.lu@intel.com Date: Thu, 7 Jan 2021 15:15:02 +0800 Message-Id: <20210107071503.14720-6-jingjing.wu@intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20210107071503.14720-1-jingjing.wu@intel.com> References: <20201219075454.40266-1-jingjing.wu@intel.com> <20210107071503.14720-1-jingjing.wu@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 5/6] net/iavf_be: extend backend to support iavf rxq_irq 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" Signed-off-by: Jingjing Wu --- drivers/net/iavf_be/iavf_be_ethdev.c | 3 ++- drivers/net/iavf_be/iavf_be_rxtx.c | 5 +++++ drivers/net/iavf_be/iavf_be_vchnl.c | 8 ++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/iavf_be/iavf_be_ethdev.c b/drivers/net/iavf_be/iavf_be_ethdev.c index 4bf936f21b..76d6103c2f 100644 --- a/drivers/net/iavf_be/iavf_be_ethdev.c +++ b/drivers/net/iavf_be/iavf_be_ethdev.c @@ -382,7 +382,6 @@ iavfbe_new_device(struct rte_emudev *dev) adapter->reset = (uint8_t *)(uintptr_t)addr; IAVFBE_WRITE_32(adapter->reset, RTE_IAVF_EMU_RESET_COMPLETED); adapter->started = 1; - printf("NEW DEVICE: memtable, %p\n", adapter->mem_table); return 0; } @@ -465,6 +464,7 @@ iavfbe_update_device(struct rte_emudev *dev) "Can not get irq info of rxq %d\n", i); return -1; } + rxq->kickfd = irq_info.eventfd; rte_atomic32_set(&rxq->irq_enable, irq_info.enable); } @@ -479,6 +479,7 @@ iavfbe_update_device(struct rte_emudev *dev) "Can not get irq info of txq %d\n", i); return -1; } + txq->callfd = irq_info.eventfd; rte_atomic32_set(&txq->irq_enable, irq_info.enable); } diff --git a/drivers/net/iavf_be/iavf_be_rxtx.c b/drivers/net/iavf_be/iavf_be_rxtx.c index 66f30cc0a8..9da70976e1 100644 --- a/drivers/net/iavf_be/iavf_be_rxtx.c +++ b/drivers/net/iavf_be/iavf_be_rxtx.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -461,6 +462,10 @@ iavfbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) end_of_xmit: txq->rx_head = head; txq->stats.sent_miss_num += nb_pkts - nb_tx; + + if (rte_atomic32_read(&txq->irq_enable) == true) + eventfd_write(txq->callfd, (eventfd_t)1); + end_unlock: rte_spinlock_unlock(&txq->access_lock); diff --git a/drivers/net/iavf_be/iavf_be_vchnl.c b/drivers/net/iavf_be/iavf_be_vchnl.c index 2195047280..243ad638f8 100644 --- a/drivers/net/iavf_be/iavf_be_vchnl.c +++ b/drivers/net/iavf_be/iavf_be_vchnl.c @@ -95,12 +95,15 @@ apply_tx_irq(struct iavfbe_tx_queue *txq, uint16_t vector) { struct rte_emudev_irq_info info; + rte_spinlock_lock(&txq->access_lock); txq->vector = vector; if (rte_emudev_get_irq_info(txq->adapter->edev_id, vector, &info)) { IAVF_BE_LOG(ERR, "Can not get irq info\n"); return IAVF_ERR_DEVICE_NOT_SUPPORTED; } txq->callfd = info.eventfd; + rte_atomic32_set(&txq->irq_enable, info.enable); + rte_spinlock_unlock(&txq->access_lock); return 0; } @@ -110,12 +113,15 @@ apply_rx_irq(struct iavfbe_rx_queue *rxq, uint16_t vector) { struct rte_emudev_irq_info info; + rte_spinlock_lock(&rxq->access_lock); rxq->vector = vector; if (rte_emudev_get_irq_info(rxq->adapter->edev_id, vector, &info)) { IAVF_BE_LOG(ERR, "Can not get irq info\n"); return IAVF_ERR_DEVICE_NOT_SUPPORTED; } rxq->kickfd = info.eventfd; + rte_atomic32_set(&rxq->irq_enable, info.enable); + rte_spinlock_unlock(&rxq->access_lock); return 0; } @@ -557,13 +563,11 @@ iavfbe_process_cmd_config_irq_map(struct iavfbe_adapter *adapter, txq = dev->data->tx_queues[j]; if ((1 << j) & map->rxq_map) { - txq->vector = vector_id; ret = apply_tx_irq(txq, vector_id); if (ret) goto send_msg; } if ((1 << j) & map->txq_map) { - rxq->vector = vector_id; ret = apply_rx_irq(rxq, vector_id); if (ret) goto send_msg;