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 95A8F45BC0; Thu, 24 Oct 2024 15:02:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 407C44347B; Thu, 24 Oct 2024 15:02:14 +0200 (CEST) Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0CFE143473 for ; Thu, 24 Oct 2024 15:01:58 +0200 (CEST) Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49OAlPXU024670; Thu, 24 Oct 2024 06:01:56 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=9 DLYf3OhcUN+vq6wBkWPaJmuCG46coTT4KAM7efjBqI=; b=EeYgaAoz8lLiN1ODs w2WIdwquv4KA0dZH7CNALjMCd/UpVjjTdCohu2PnuaSQEBF8XCUD7fvWAvYoq4gi dpFTM651tmfGnF/YLEhnw70IxLO3TU2IRnymzSr+ndvnMRbNpolOH5gEN1bB8/Zx kc6X4hxVUZkDmY2vre1P+zsBvVYFLdqEZkKBaV2c3OLm5hN2otVD/KKnLN3QDTq/ n8F2TJHS9OlT9vBaJADHJW/uxjllMwwZsd4PlGlGsZKbQ/eEBP12xvrspWTw4hJ5 eZo86sDO0jXGdDGlwVVTzeoh56e0DJV6yUQO7t75rYjC0kPE5aLyz/jF4RclTeiz Kv/og== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 42fm5709a9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Oct 2024 06:01:56 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 24 Oct 2024 06:01:55 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 24 Oct 2024 06:01:55 -0700 Received: from localhost.localdomain (unknown [10.28.36.102]) by maili.marvell.com (Postfix) with ESMTP id E87683F7098; Thu, 24 Oct 2024 06:01:51 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , Akhil Goyal Subject: [PATCH v4 5/9] raw/cnxk_rvu_lf: set message ID range Date: Thu, 24 Oct 2024 18:31:26 +0530 Message-ID: <20241024130130.3330978-6-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241024130130.3330978-1-gakhil@marvell.com> References: <20241008184915.1356089-1-gakhil@marvell.com> <20241024130130.3330978-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: OFKmhX-Cv-c7KhmrUidJYBBUeD3ykjAK X-Proofpoint-ORIG-GUID: OFKmhX-Cv-c7KhmrUidJYBBUeD3ykjAK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.687,Hydra:6.0.235,FMLib:17.0.607.475 definitions=2020-10-13_15,2020-10-13_02,2020-04-07_01 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 Added API rte_pmd_rvu_lf_msg_id_range_set() to set RVU mailbox message id range. Signed-off-by: Akhil Goyal --- doc/guides/rawdevs/cnxk_rvu_lf.rst | 12 ++++++++ drivers/common/cnxk/roc_mbox.h | 1 + drivers/common/cnxk/roc_rvu_lf.c | 30 ++++++++++++++++++++ drivers/common/cnxk/roc_rvu_lf.h | 3 ++ drivers/common/cnxk/version.map | 2 ++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c | 14 +++++++++ drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h | 15 ++++++++++ drivers/raw/cnxk_rvu_lf/version.map | 1 + 8 files changed, 78 insertions(+) diff --git a/doc/guides/rawdevs/cnxk_rvu_lf.rst b/doc/guides/rawdevs/cnxk_rvu_lf.rst index 52e4f12e3c..7622b19217 100644 --- a/doc/guides/rawdevs/cnxk_rvu_lf.rst +++ b/doc/guides/rawdevs/cnxk_rvu_lf.rst @@ -53,3 +53,15 @@ Application can register interrupt handlers using ``rte_pmd_rvu_lf_irq_register( or remove interrupt handler using ``rte_pmd_rvu_lf_irq_unregister()``. The irq numbers for which the interrupts are registered is negotiated separately and is not in scope of the driver. + +RVU LF RAW MESSAGE PROCESSING +----------------------------- + +Once a RVU LF raw device is probed, a range of message ids can be configured for +which mailboxes will be sent using the API ``rte_pmd_rvu_lf_msg_id_range_set``. + +For processing of mailboxes received on PF/VF application, application +can register callbacks using ``rte_pmd_rvu_lf_msg_handler_register()`` +and fill required responses as per the request and message id received. +Application can also unregister already registered message callbacks using +``rte_pmd_rvu_lf_msg_handler_unregister()``. diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h index dd65946e9e..f8791e9f84 100644 --- a/drivers/common/cnxk/roc_mbox.h +++ b/drivers/common/cnxk/roc_mbox.h @@ -54,6 +54,7 @@ struct mbox_msghdr { #define MBOX_MSG_MASK 0xFFFF #define MBOX_MSG_INVALID 0xFFFE #define MBOX_MSG_MAX 0xFFFF +#define MBOX_MSG_GENERIC_MAX_ID 0x1FF #define MBOX_MESSAGES \ /* Generic mbox IDs (range 0x000 - 0x1FF) */ \ diff --git a/drivers/common/cnxk/roc_rvu_lf.c b/drivers/common/cnxk/roc_rvu_lf.c index 2e1be81e52..1026ccc125 100644 --- a/drivers/common/cnxk/roc_rvu_lf.c +++ b/drivers/common/cnxk/roc_rvu_lf.c @@ -62,6 +62,36 @@ roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf) return dev_fini(&rvu->dev, rvu->pci_dev); } +int +roc_rvu_lf_msg_id_range_set(struct roc_rvu_lf *roc_rvu_lf, uint16_t from, uint16_t to) +{ + struct rvu_lf *rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + + if (from <= MBOX_MSG_GENERIC_MAX_ID || from > to) + return -EINVAL; + + rvu->msg_id_from = from; + rvu->msg_id_to = to; + + return 0; +} + +bool +roc_rvu_lf_msg_id_range_check(struct roc_rvu_lf *roc_rvu_lf, uint16_t msg_id) +{ + struct rvu_lf *rvu; + + if (roc_rvu_lf == NULL) + return 0; + + rvu = roc_rvu_lf_to_rvu_priv(roc_rvu_lf); + + if (msg_id > rvu->msg_id_from && msg_id < rvu->msg_id_to) + return 1; + + return 0; +} + int roc_rvu_lf_irq_register(struct roc_rvu_lf *roc_rvu_lf, unsigned int irq, roc_rvu_lf_intr_cb_fn cb, void *data) diff --git a/drivers/common/cnxk/roc_rvu_lf.h b/drivers/common/cnxk/roc_rvu_lf.h index 90a0b5690a..7243e170b9 100644 --- a/drivers/common/cnxk/roc_rvu_lf.h +++ b/drivers/common/cnxk/roc_rvu_lf.h @@ -21,6 +21,9 @@ TAILQ_HEAD(roc_rvu_lf_head, roc_rvu_lf); int __roc_api roc_rvu_lf_dev_init(struct roc_rvu_lf *roc_rvu_lf); int __roc_api roc_rvu_lf_dev_fini(struct roc_rvu_lf *roc_rvu_lf); +int __roc_api roc_rvu_lf_msg_id_range_set(struct roc_rvu_lf *roc_rvu_lf, + uint16_t from, uint16_t to); +bool __roc_api roc_rvu_lf_msg_id_range_check(struct roc_rvu_lf *roc_rvu_lf, uint16_t msg_id); typedef void (*roc_rvu_lf_intr_cb_fn)(void *cb_arg); typedef int (*roc_rvu_lf_msg_handler_cb_fn)(uint16_t vf, uint16_t msg_id, void *req, uint16_t req_len, diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 964c53f819..e38da19956 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -555,5 +555,7 @@ INTERNAL { roc_rvu_lf_irq_unregister; roc_rvu_lf_msg_handler_register; roc_rvu_lf_msg_handler_unregister; + roc_rvu_lf_msg_id_range_check; + roc_rvu_lf_msg_id_range_set; local: *; }; diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c index 29ab738392..82439cf9f8 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf.c @@ -16,6 +16,20 @@ #include "cnxk_rvu_lf.h" #include "cnxk_rvu_lf_driver.h" +int +rte_pmd_rvu_lf_msg_id_range_set(uint8_t dev_id, uint16_t from, uint16_t to) +{ + struct rte_rawdev *rawdev = rte_rawdev_pmd_get_dev(dev_id); + struct roc_rvu_lf *roc_rvu_lf; + + if (rawdev == NULL) + return -EINVAL; + + roc_rvu_lf = (struct roc_rvu_lf *)rawdev->dev_private; + + return roc_rvu_lf_msg_id_range_set(roc_rvu_lf, from, to); +} + int rte_pmd_rvu_lf_msg_handler_register(uint8_t dev_id, rte_pmd_rvu_lf_msg_handler_cb_fn cb) { diff --git a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h index ee5501cc57..07b0279aa0 100644 --- a/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h +++ b/drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_driver.h @@ -135,6 +135,21 @@ int rte_pmd_rvu_lf_msg_handler_register(uint8_t dev_id, rte_pmd_rvu_lf_msg_handl __rte_internal int rte_pmd_rvu_lf_msg_handler_unregister(uint8_t dev_id); +/** + * Set RVU mailbox message id range. + * + * @param dev_id + * device id of RVU LF device + * @param from + * starting message id for RVU mailbox (> 0x1FF) + * @param to + * last message id for RVU mailbox (< 0xFFFF) + * + * @return 0 on success, -EINVAL for invalid range + */ +__rte_internal +int rte_pmd_rvu_lf_msg_id_range_set(uint8_t dev_id, uint16_t from, uint16_t to); + #ifdef __cplusplus } #endif diff --git a/drivers/raw/cnxk_rvu_lf/version.map b/drivers/raw/cnxk_rvu_lf/version.map index fcbb2545ea..d8fb8eba26 100644 --- a/drivers/raw/cnxk_rvu_lf/version.map +++ b/drivers/raw/cnxk_rvu_lf/version.map @@ -5,6 +5,7 @@ INTERNAL { rte_pmd_rvu_lf_irq_unregister; rte_pmd_rvu_lf_msg_handler_register; rte_pmd_rvu_lf_msg_handler_unregister; + rte_pmd_rvu_lf_msg_id_range_set; rte_pmd_rvu_lf_npa_pf_func_get; rte_pmd_rvu_lf_sso_pf_func_get; -- 2.25.1