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 619D9A00C5; Wed, 27 Jul 2022 01:08:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 001AD40E03; Wed, 27 Jul 2022 01:08:10 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id EEE5440A89 for ; Wed, 27 Jul 2022 01:08:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658876889; x=1690412889; h=from:to:cc:subject:date:message-id; bh=fRzeE3D7EFCCTHGNU4NOHMSIMGDUjjdeYhoMlqwGirU=; b=Z92w+J9pgXdiQn5DxD6u50jdQglljRh6pBoRBDJAIV9uVQ6S6gQBm/DT NqipsDwE1Ts7+7usmpDc4+4fVDT4Sa+ZTjUIGAFig8hLkpgEwp8srSDg5 K4R64PdA/dm6MSZv4mKoZF2EHWREwxTUV6v7KJbXKWLiyF+9yo5LNScr1 rQuhXLO2l0CDGb0txB9aF6+2jY2oKoJDfFjadyAMguFjK3RQUIBEw2IRi CwZsxXSmhzENDeRhFqbRTY5FSEwYHL3q+Gu4dc0lZ9lBPMKrnBbcfzqtr +UOj5vtwVfCUhtFZSKAdsd+X3a00vsRUxTLeVnLjQyW6kCzxBbHlNe3+R A==; X-IronPort-AV: E=McAfee;i="6400,9594,10420"; a="374393955" X-IronPort-AV: E=Sophos;i="5.93,194,1654585200"; d="scan'208";a="374393955" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2022 16:08:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,194,1654585200"; d="scan'208";a="689639593" Received: from silpixa00400465.ir.intel.com ([10.55.128.22]) by FMSMGA003.fm.intel.com with ESMTP; 26 Jul 2022 16:08:07 -0700 From: Kai Ji To: dev@dpdk.org Cc: gakhil@marvell.com, Kai Ji Subject: [dpdk-dev v1] lib/cryptodev: multi-process IPC request handler Date: Wed, 27 Jul 2022 07:08:04 +0800 Message-Id: <20220726230804.90036-1-kai.ji@intel.com> X-Mailer: git-send-email 2.17.1 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 This patch add in multi-process IPC request handler function in rte cryptodev. This function intend to support a queue-pair configuration request to allow the secondary process to reconfigure the queue-pair setup'ed by the primary process. Signed-off-by: Kai Ji --- lib/cryptodev/rte_cryptodev.c | 45 +++++++++++++++++++++++++++++++++++ lib/cryptodev/rte_cryptodev.h | 14 +++++++++++ 2 files changed, 59 insertions(+) diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 42f3221052..18fdbf6db6 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -1202,6 +1202,51 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id) return 0; } +/* crypto queue pair config */ +#define CRYPTODEV_MP_REQ "cryptodev_mp_request" + +static int +rte_cryptodev_mp_request(const struct rte_mp_msg *mp_msg, const void *peer) +{ + struct rte_mp_msg mp_res; + struct rte_cryptodev_mp_param *res = + (struct rte_cryptodev_mp_param *)mp_res.param; + const struct rte_cryptodev_mp_param *param = + (const struct rte_cryptodev_mp_param *)mp_msg->param; + + int ret; + int dev_id = 0; + int port_id = 0, socket_id = 1; + struct rte_cryptodev_qp_conf queue_conf; + queue_conf.nb_descriptors = 2; + + RTE_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY); + switch (param->type) { + case RTE_CRYPTODEV_MP_REQ_QP: + ret = rte_cryptodev_queue_pair_setup(dev_id, port_id, + &queue_conf, socket_id); + res->result = ret; + + ret = rte_mp_reply(&mp_res, peer); + break; + default: + CDEV_LOG_ERR("invalid mp request type\n"); + return -EINVAL; + } + return ret; + +} + +int rte_cryptodev_mp_request_register(void) +{ + int ret; + + RTE_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY); + ret = rte_mp_action_register(CRYPTODEV_MP_REQ, + rte_cryptodev_mp_request); + return ret; +} + int rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id, const struct rte_cryptodev_qp_conf *qp_conf, int socket_id) diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h index 56f459c6a0..901465ca65 100644 --- a/lib/cryptodev/rte_cryptodev.h +++ b/lib/cryptodev/rte_cryptodev.h @@ -539,6 +539,18 @@ enum rte_cryptodev_event_type { RTE_CRYPTODEV_EVENT_MAX /**< max value of this enum */ }; +/* Request types for IPC. */ +enum rte_cryptodev_mp_req_type { + RTE_CRYPTODEV_MP_REQ_NONE, + RTE_CRYPTODEV_MP_REQ_QP +}; + +/* Parameters for IPC. */ +struct rte_cryptodev_mp_param { + enum rte_cryptodev_mp_req_type type; + int result; +}; + /** Crypto device queue pair configuration structure. */ struct rte_cryptodev_qp_conf { uint32_t nb_descriptors; /**< Number of descriptors per queue pair */ @@ -744,6 +756,8 @@ rte_cryptodev_stop(uint8_t dev_id); extern int rte_cryptodev_close(uint8_t dev_id); +extern int rte_cryptodev_mp_request_register(void); + /** * Allocate and set up a receive queue pair for a device. * -- 2.17.1