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 6A054427F7; Tue, 21 Mar 2023 14:05:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 01EA2410D3; Tue, 21 Mar 2023 14:05:49 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E0F91410D1; Tue, 21 Mar 2023 14:05:47 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32L8kAdv032616; Tue, 21 Mar 2023 06:05:41 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=ZKKhoS5Wp4P9cKdjfEbW09F8+1/CWV+mSeEyWJ6jYL0=; b=j/XMxbunsf6IfsHe4DzEfhmqy3xryFg1gOrIykNXmD65Nah+OSi8m/IKxgEo32WlzU6K aJjP4TGULDbyumOpVaj6eDR0lrkA500gxm3iycPimmEFlGIvp9iAQLRPrRlIDlqfoLHR HJwbR9ma4JcYvj3ZlTceV31IPeRma7y/w627QvpU2oWnvxGycG4sg3rYpGY/yw3BWZbz rkHXa798ISRQuGqZAOEsSahBh17Anre2nCwjB1SdUz4WwQeZJbvvJ2NUJcElsTrrX+BK MRKXNjB+171KmQ7NFg4ec1X3xoDSXtb7bBsdj6ofhLDfO1OfIJyO5XngBjVIHBvt0U8z 1w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pf9c3h20h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 21 Mar 2023 06:05:41 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 21 Mar 2023 06:05:39 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Tue, 21 Mar 2023 06:05:39 -0700 Received: from localhost.localdomain (unknown [10.28.36.102]) by maili.marvell.com (Postfix) with ESMTP id 075415B6931; Tue, 21 Mar 2023 06:05:33 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , , , , , , , , , , , Akhil Goyal , Subject: [PATCH] doc: fix cryptodev code block mismatch Date: Tue, 21 Mar 2023 18:35:27 +0530 Message-ID: <20230321130527.3182636-1-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: s-j4VS8qYq_K2rDawYzFVl7QV6QskBiF X-Proofpoint-GUID: s-j4VS8qYq_K2rDawYzFVl7QV6QskBiF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-21_08,2023-03-21_01,2023-02-09_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 Certain structures were replicated in programmer's guide, which resulted in mismatch when that structure is changed in future releases. Added literal includes to copy code block while compiling. Fixes: 0318c02b57cf ("doc: add cryptodev chapter in prog guide") Cc: stable@dpdk.org Signed-off-by: Akhil Goyal Reported-by: David Marchand --- doc/guides/prog_guide/cryptodev_lib.rst | 121 ++++-------------------- lib/cryptodev/rte_crypto_sym.h | 4 + lib/cryptodev/rte_cryptodev.h | 6 ++ 3 files changed, 31 insertions(+), 100 deletions(-) diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index 0d9f7059ea..2b513bbf82 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -98,14 +98,10 @@ The rte_cryptodev_configure API is used to configure a Crypto device. The ``rte_cryptodev_config`` structure is used to pass the configuration parameters for socket selection and number of queue pairs. -.. code-block:: c - - struct rte_cryptodev_config { - int socket_id; - /**< Socket to allocate resources on */ - uint16_t nb_queue_pairs; - /**< Number of queue pairs to configure on device */ - }; +.. literalinclude:: ../../../lib/cryptodev/rte_cryptodev.h + :language: c + :start-after: Structure rte_cryptodev_config 8< + :end-before: >8 End of structure rte_cryptodev_config. Configuration of Queue Pairs @@ -121,11 +117,11 @@ Each queue pairs resources may be allocated on a specified socket. const struct rte_cryptodev_qp_conf *qp_conf, int socket_id) - struct rte_cryptodev_qp_conf { - uint32_t nb_descriptors; /**< Number of descriptors per queue pair */ - struct rte_mempool *mp_session; - /**< The mempool for creating session in sessionless mode */ - }; + +.. literalinclude:: ../../../lib/cryptodev/rte_cryptodev.h + :language: c + :start-after: Structure rte_cryptodev_qp_conf 8< + :end-before: >8 End of structure rte_cryptodev_qp_conf. The field ``mp_session`` is used for creating temporary session to process @@ -271,23 +267,10 @@ This allows the user to query a specific Crypto PMD and get all the device features and capabilities. The ``rte_cryptodev_info`` structure contains all the relevant information for the device. -.. code-block:: c - - struct rte_cryptodev_info { - const char *driver_name; - uint8_t driver_id; - struct rte_device *device; - - uint64_t feature_flags; - - const struct rte_cryptodev_capabilities *capabilities; - - unsigned max_nb_queue_pairs; - - struct { - unsigned max_nb_sessions; - } sym; - }; +.. literalinclude:: ../../../lib/cryptodev/rte_cryptodev.h + :language: c + :start-after: Structure rte_cryptodev_info 8< + :end-before: >8 End of structure rte_cryptodev_info. Operation Processing @@ -540,22 +523,10 @@ Currently there are three transforms types cipher, authentication and AEAD. Also it is important to note that the order in which the transforms are passed indicates the order of the chaining. -.. code-block:: c - - struct rte_crypto_sym_xform { - struct rte_crypto_sym_xform *next; - /**< next xform in chain */ - enum rte_crypto_sym_xform_type type; - /**< xform type */ - union { - struct rte_crypto_auth_xform auth; - /**< Authentication / hash xform */ - struct rte_crypto_cipher_xform cipher; - /**< Cipher xform */ - struct rte_crypto_aead_xform aead; - /**< AEAD xform */ - }; - }; +.. literalinclude:: ../../../lib/cryptodev/rte_crypto_sym.h + :language: c + :start-after: Structure rte_crypto_sym_xform 8< + :end-before: >8 End of structure rte_crypto_sym_xform. The API does not place a limit on the number of transforms that can be chained together but this will be limited by the underlying Crypto device poll mode @@ -578,61 +549,11 @@ authentication/ cipher/ AEAD parameters required depending on the type of operat specified in the session or the transform chain. -.. code-block:: c +.. literalinclude:: ../../../lib/cryptodev/rte_crypto_sym.h + :language: c + :start-after: Structure rte_crypto_sym_op 8< + :end-before: >8 End of structure rte_crypto_sym_op. - struct rte_crypto_sym_op { - struct rte_mbuf *m_src; - struct rte_mbuf *m_dst; - - union { - void *session; - /**< Handle for the initialised session context */ - struct rte_crypto_sym_xform *xform; - /**< Session-less API Crypto operation parameters */ - }; - - union { - struct { - struct { - uint32_t offset; - uint32_t length; - } data; /**< Data offsets and length for AEAD */ - - struct { - uint8_t *data; - rte_iova_t phys_addr; - } digest; /**< Digest parameters */ - - struct { - uint8_t *data; - rte_iova_t phys_addr; - } aad; - /**< Additional authentication parameters */ - } aead; - - struct { - struct { - struct { - uint32_t offset; - uint32_t length; - } data; /**< Data offsets and length for ciphering */ - } cipher; - - struct { - struct { - uint32_t offset; - uint32_t length; - } data; - /**< Data offsets and length for authentication */ - - struct { - uint8_t *data; - rte_iova_t phys_addr; - } digest; /**< Digest parameters */ - } auth; - }; - }; - }; Synchronous mode ---------------- diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index 2cfe66530c..b43174dbec 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -582,6 +582,7 @@ enum rte_crypto_sym_xform_type { * hold a single transform, the type field is used to specify which transform * is contained within the union */ +/* Structure rte_crypto_sym_xform 8< */ struct rte_crypto_sym_xform { struct rte_crypto_sym_xform *next; /**< next xform in chain */ @@ -597,6 +598,7 @@ struct rte_crypto_sym_xform { /**< AEAD xform */ }; }; +/* >8 End of structure rte_crypto_sym_xform. */ /** * Symmetric Cryptographic Operation. @@ -628,6 +630,7 @@ struct rte_crypto_sym_xform { * destination buffer being at a different alignment, relative to buffer start, * to the data in the source buffer. */ +/* Structure rte_crypto_sym_op 8< */ struct rte_crypto_sym_op { struct rte_mbuf *m_src; /**< source mbuf */ struct rte_mbuf *m_dst; /**< destination mbuf */ @@ -889,6 +892,7 @@ struct rte_crypto_sym_op { }; }; }; +/* >8 End of structure rte_crypto_sym_op. */ /** diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h index 27cdec8495..3a9ad13660 100644 --- a/lib/cryptodev/rte_cryptodev.h +++ b/lib/cryptodev/rte_cryptodev.h @@ -553,6 +553,7 @@ extern const char * rte_cryptodev_get_feature_name(uint64_t flag); /** Crypto device information */ +/* Structure rte_cryptodev_info 8< */ struct rte_cryptodev_info { const char *driver_name; /**< Driver name. */ uint8_t driver_id; /**< Driver identifier */ @@ -581,6 +582,7 @@ struct rte_cryptodev_info { */ } sym; }; +/* >8 End of structure rte_cryptodev_info. */ #define RTE_CRYPTODEV_DETACHED (0) #define RTE_CRYPTODEV_ATTACHED (1) @@ -593,11 +595,13 @@ enum rte_cryptodev_event_type { }; /** Crypto device queue pair configuration structure. */ +/* Structure rte_cryptodev_qp_conf 8<*/ struct rte_cryptodev_qp_conf { uint32_t nb_descriptors; /**< Number of descriptors per queue pair */ struct rte_mempool *mp_session; /**< The mempool for creating session in sessionless mode */ }; +/* >8 End of structure rte_cryptodev_qp_conf. */ /** * Function type used for processing crypto ops when enqueue/dequeue burst is @@ -726,6 +730,7 @@ extern int rte_cryptodev_socket_id(uint8_t dev_id); /** Crypto device configuration structure */ +/* Structure rte_cryptodev_config 8< */ struct rte_cryptodev_config { int socket_id; /**< Socket to allocate resources on */ uint16_t nb_queue_pairs; @@ -738,6 +743,7 @@ struct rte_cryptodev_config { * - RTE_CRYTPODEV_FF_SECURITY */ }; +/* >8 End of structure rte_cryptodev_config. */ /** * Configure a device. -- 2.25.1