From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: <jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
"Kiran Kumar K" <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>,
Harman Kalra <hkalra@marvell.com>
Cc: <dev@dpdk.org>
Subject: [PATCH v2 08/17] net/cnxk: move PMD function defines to common code
Date: Tue, 1 Oct 2024 11:30:46 +0530 [thread overview]
Message-ID: <20241001060055.3747591-8-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20241001060055.3747591-1-ndabilpuram@marvell.com>
Move PMD function definitions to common code for
cn9k/cn10k since they are declared commonly.
Also remove the reference to 'struct rte_security_session'
since it is now a driver internal structure and not
exported to application code.
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
drivers/net/cnxk/cn10k_ethdev_sec.c | 61 ----------------------------
drivers/net/cnxk/cnxk_ethdev_sec.c | 63 +++++++++++++++++++++++++++++
drivers/net/cnxk/rte_pmd_cnxk.h | 8 ++--
3 files changed, 67 insertions(+), 65 deletions(-)
diff --git a/drivers/net/cnxk/cn10k_ethdev_sec.c b/drivers/net/cnxk/cn10k_ethdev_sec.c
index 5e509e97d4..074bb09822 100644
--- a/drivers/net/cnxk/cn10k_ethdev_sec.c
+++ b/drivers/net/cnxk/cn10k_ethdev_sec.c
@@ -1208,67 +1208,6 @@ cn10k_eth_sec_session_update(void *device, struct rte_security_session *sess,
return 0;
}
-int
-rte_pmd_cnxk_hw_sa_read(void *device, struct rte_security_session *sess,
- union rte_pmd_cnxk_ipsec_hw_sa *data, uint32_t len)
-{
- struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
- struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
- struct cnxk_eth_sec_sess *eth_sec;
- int rc;
-
- eth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);
- if (eth_sec == NULL)
- return -EINVAL;
-
- rc = roc_nix_inl_sa_sync(&dev->nix, eth_sec->sa, eth_sec->inb,
- ROC_NIX_INL_SA_OP_FLUSH);
- if (rc)
- return -EINVAL;
- rte_delay_ms(1);
- memcpy(data, eth_sec->sa, len);
-
- return 0;
-}
-
-int
-rte_pmd_cnxk_hw_sa_write(void *device, struct rte_security_session *sess,
- union rte_pmd_cnxk_ipsec_hw_sa *data, uint32_t len)
-{
- struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
- struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
- struct cnxk_eth_sec_sess *eth_sec;
- int rc = -EINVAL;
-
- eth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);
- if (eth_sec == NULL)
- return rc;
- rc = roc_nix_inl_ctx_write(&dev->nix, data, eth_sec->sa, eth_sec->inb,
- len);
- if (rc)
- return rc;
-
- return 0;
-}
-
-union rte_pmd_cnxk_cpt_res_s *
-rte_pmd_cnxk_inl_ipsec_res(struct rte_mbuf *mbuf)
-{
- const union nix_rx_parse_u *rx;
- uint16_t desc_size;
- uintptr_t wqe;
-
- if (!mbuf || !(mbuf->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD))
- return NULL;
-
- wqe = (uintptr_t)(mbuf + 1);
- rx = (const union nix_rx_parse_u *)(wqe + 8);
- desc_size = (rx->desc_sizem1 + 1) * 16;
-
- /* rte_pmd_cnxk_cpt_res_s sits after SG list at 16B aligned address */
- return (void *)(wqe + 64 + desc_size);
-}
-
static int
cn10k_eth_sec_session_stats_get(void *device, struct rte_security_session *sess,
struct rte_security_stats *stats)
diff --git a/drivers/net/cnxk/cnxk_ethdev_sec.c b/drivers/net/cnxk/cnxk_ethdev_sec.c
index 6f5319e534..cdd5656817 100644
--- a/drivers/net/cnxk/cnxk_ethdev_sec.c
+++ b/drivers/net/cnxk/cnxk_ethdev_sec.c
@@ -2,6 +2,8 @@
* Copyright(C) 2021 Marvell.
*/
+#include <rte_pmd_cnxk.h>
+
#include <cnxk_ethdev.h>
#include <cnxk_mempool.h>
@@ -295,6 +297,67 @@ cnxk_eth_sec_sess_get_by_sess(struct cnxk_eth_dev *dev,
return NULL;
}
+int
+rte_pmd_cnxk_hw_sa_read(void *device, void *__sess, union rte_pmd_cnxk_ipsec_hw_sa *data,
+ uint32_t len)
+{
+ struct rte_security_session *sess = __sess;
+ struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ struct cnxk_eth_sec_sess *eth_sec;
+ int rc;
+
+ eth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);
+ if (eth_sec == NULL)
+ return -EINVAL;
+
+ rc = roc_nix_inl_sa_sync(&dev->nix, eth_sec->sa, eth_sec->inb, ROC_NIX_INL_SA_OP_FLUSH);
+ if (rc)
+ return -EINVAL;
+ rte_delay_ms(1);
+ memcpy(data, eth_sec->sa, len);
+
+ return 0;
+}
+
+int
+rte_pmd_cnxk_hw_sa_write(void *device, void *__sess, union rte_pmd_cnxk_ipsec_hw_sa *data,
+ uint32_t len)
+{
+ struct rte_security_session *sess = __sess;
+ struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ struct cnxk_eth_sec_sess *eth_sec;
+ int rc = -EINVAL;
+
+ eth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);
+ if (eth_sec == NULL)
+ return rc;
+ rc = roc_nix_inl_ctx_write(&dev->nix, data, eth_sec->sa, eth_sec->inb, len);
+ if (rc)
+ return rc;
+
+ return 0;
+}
+
+union rte_pmd_cnxk_cpt_res_s *
+rte_pmd_cnxk_inl_ipsec_res(struct rte_mbuf *mbuf)
+{
+ const union nix_rx_parse_u *rx;
+ uint16_t desc_size;
+ uintptr_t wqe;
+
+ if (!mbuf || !(mbuf->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD))
+ return NULL;
+
+ wqe = (uintptr_t)(mbuf + 1);
+ rx = (const union nix_rx_parse_u *)(wqe + 8);
+ desc_size = (rx->desc_sizem1 + 1) * 16;
+
+ /* rte_pmd_cnxk_cpt_res_s sits after SG list at 16B aligned address */
+ return (void *)(wqe + 64 + desc_size);
+}
+
static unsigned int
cnxk_eth_sec_session_get_size(void *device __rte_unused)
{
diff --git a/drivers/net/cnxk/rte_pmd_cnxk.h b/drivers/net/cnxk/rte_pmd_cnxk.h
index 88030046db..70f2f96fd4 100644
--- a/drivers/net/cnxk/rte_pmd_cnxk.h
+++ b/drivers/net/cnxk/rte_pmd_cnxk.h
@@ -495,7 +495,7 @@ union rte_pmd_cnxk_cpt_res_s {
* @param device
* Port identifier of Ethernet device.
* @param sess
- * Handle of the security session.
+ * Handle of the security session as void *.
* @param[out] data
* Destination pointer to copy SA context for application.
* @param len
@@ -505,7 +505,7 @@ union rte_pmd_cnxk_cpt_res_s {
* 0 on success, a negative errno value otherwise.
*/
__rte_experimental
-int rte_pmd_cnxk_hw_sa_read(void *device, struct rte_security_session *sess,
+int rte_pmd_cnxk_hw_sa_read(void *device, void *sess,
union rte_pmd_cnxk_ipsec_hw_sa *data, uint32_t len);
/**
* Write HW SA context to session.
@@ -513,7 +513,7 @@ int rte_pmd_cnxk_hw_sa_read(void *device, struct rte_security_session *sess,
* @param device
* Port identifier of Ethernet device.
* @param sess
- * Handle of the security session.
+ * Handle of the security session as void *.
* @param[in] data
* Source data pointer from application to copy SA context into session.
* @param len
@@ -523,7 +523,7 @@ int rte_pmd_cnxk_hw_sa_read(void *device, struct rte_security_session *sess,
* 0 on success, a negative errno value otherwise.
*/
__rte_experimental
-int rte_pmd_cnxk_hw_sa_write(void *device, struct rte_security_session *sess,
+int rte_pmd_cnxk_hw_sa_write(void *device, void *sess,
union rte_pmd_cnxk_ipsec_hw_sa *data, uint32_t len);
/**
--
2.34.1
next prev parent reply other threads:[~2024-10-01 6:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 6:00 [PATCH v2 01/17] net/cnxk: added telemetry support do dump SA information Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 02/17] net/cnxk: handle timestamp correctly for VF Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 03/17] net/cnxk: update Rx offloads to handle timestamp Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 04/17] event/cnxk: handle timestamp for event mode Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 05/17] net/cnxk: update mbuf and rearm data for Rx inject packets Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 06/17] common/cnxk: remove restriction to clear RPM stats Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 07/17] common/cnxk: allow MAC address set/add with active VFs Nithin Dabilpuram
2024-10-01 6:00 ` Nithin Dabilpuram [this message]
2024-10-01 6:00 ` [PATCH v2 09/17] common/cnxk: add flush wait after write of inline ctx Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 10/17] common/cnxk: fix CPT HW word size for outbound SA Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 11/17] net/cnxk: add PMD APIs for IPsec SA base and flush Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 12/17] net/cnxk: add PMD APIs to submit CPT instruction Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 13/17] net/cnxk: add PMD API to retrieve CPT queue statistics Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 14/17] net/cnxk: add option to enable custom inbound sa usage Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 15/17] net/cnxk: add PMD API to retrieve the model string Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 16/17] net/cnxk: handle OOP for inbound packet Nithin Dabilpuram
2024-10-01 6:00 ` [PATCH v2 17/17] event/cnxk: handle inbound out of place processing Nithin Dabilpuram
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241001060055.3747591-8-ndabilpuram@marvell.com \
--to=ndabilpuram@marvell.com \
--cc=dev@dpdk.org \
--cc=hkalra@marvell.com \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).