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 D427FA0547; Mon, 29 Mar 2021 16:37:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 39E17140D9C; Mon, 29 Mar 2021 16:37:04 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 32446406B4 for ; Mon, 29 Mar 2021 16:37:02 +0200 (CEST) IronPort-SDR: ls/qndb8yLgXvXChv3Yln023KqD4QNNoaeF7dMBgv5ZHnTyx1D4S1sWx2cEX3fh5j02Yh4xqNC yty2Olgk5w0w== X-IronPort-AV: E=McAfee;i="6000,8403,9938"; a="191589140" X-IronPort-AV: E=Sophos;i="5.81,288,1610438400"; d="scan'208";a="191589140" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 07:37:01 -0700 IronPort-SDR: VdVi4C45ivJSK5LTOj+iDH3X55F8oPzbONX6LRB5hleWh+T/BxV/F5R/FsjRKscWYVZsyWlOsx r30D9wdWM+4g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,288,1610438400"; d="scan'208";a="526979703" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by orsmga004.jf.intel.com with ESMTP; 29 Mar 2021 07:37:01 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Elad Nachman Date: Mon, 29 Mar 2021 15:36:54 +0100 Message-Id: <20210329143655.521750-2-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210329143655.521750-1-ferruh.yigit@intel.com> References: <20201126144613.4986-1-eladv6@gmail.com> <20210329143655.521750-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 2/3] kni: support async user request 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" Adding async userspace requests which don't wait for the userspace response and always return success. This is preparation to address a regression in KNI. Signed-off-by: Elad Nachman Signed-off-by: Ferruh Yigit --- kernel/linux/kni/kni_net.c | 9 +++++++++ lib/librte_kni/rte_kni.c | 7 +++++-- lib/librte_kni/rte_kni_common.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c index b830054c7491..6cf99da0dc92 100644 --- a/kernel/linux/kni/kni_net.c +++ b/kernel/linux/kni/kni_net.c @@ -124,6 +124,14 @@ kni_net_process_request(struct net_device *dev, struct rte_kni_request *req) goto fail; } + /* No result available since request is handled + * asynchronously. set response to success. + */ + if (req->async != 0) { + req->result = 0; + goto async; + } + ret_val = wait_event_interruptible_timeout(kni->wq, kni_fifo_count(kni->resp_q), 3 * HZ); if (signal_pending(current) || ret_val <= 0) { @@ -139,6 +147,7 @@ kni_net_process_request(struct net_device *dev, struct rte_kni_request *req) } memcpy(req, kni->sync_kva, sizeof(struct rte_kni_request)); +async: ret = 0; fail: diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index 837d0217d2d1..9dae6a8d7c0c 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -591,8 +591,11 @@ rte_kni_handle_request(struct rte_kni *kni) break; } - /* Construct response mbuf and put it back to resp_q */ - ret = kni_fifo_put(kni->resp_q, (void **)&req, 1); + /* if needed, construct response buffer and put it back to resp_q */ + if (!req->async) + ret = kni_fifo_put(kni->resp_q, (void **)&req, 1); + else + ret = 1; if (ret != 1) { RTE_LOG(ERR, KNI, "Fail to put the muf back to resp_q\n"); return -1; /* It is an error of can't putting the mbuf back */ diff --git a/lib/librte_kni/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h index ffb3182731a0..b547ea550171 100644 --- a/lib/librte_kni/rte_kni_common.h +++ b/lib/librte_kni/rte_kni_common.h @@ -48,6 +48,7 @@ struct rte_kni_request { uint8_t promiscusity;/**< 1: promisc mode enable, 0: disable */ uint8_t allmulti; /**< 1: all-multicast mode enable, 0: disable */ }; + int32_t async : 1; /**< 1: request is asynchronous */ int32_t result; /**< Result for processing request */ } __attribute__((__packed__)); -- 2.30.2