diff mbox series

[v2,09/17] common/cnxk: add inline IPsec configuration mbox

Message ID 1624599410-29689-10-git-send-email-anoobj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers show
Series Add CPT in Marvell CNXK common driver | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Anoob Joseph June 25, 2021, 5:36 a.m. UTC
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>

Add mbox to configure inbound & outbound inline IPsec.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
 drivers/common/cnxk/roc_cpt.c      | 61 ++++++++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_cpt.h      |  5 ++++
 drivers/common/cnxk/roc_cpt_priv.h |  2 ++
 drivers/common/cnxk/version.map    |  2 ++
 4 files changed, 70 insertions(+)
diff mbox series

Patch

diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index fd92de3..81e8b15 100644
--- a/drivers/common/cnxk/roc_cpt.c
+++ b/drivers/common/cnxk/roc_cpt.c
@@ -217,6 +217,67 @@  cpt_lf_dump(struct roc_cpt_lf *lf)
 }
 
 int
+cpt_lf_outb_cfg(struct dev *dev, uint16_t sso_pf_func, uint16_t nix_pf_func,
+		uint8_t lf_id, bool ena)
+{
+	struct cpt_inline_ipsec_cfg_msg *req;
+	struct mbox *mbox = dev->mbox;
+
+	req = mbox_alloc_msg_cpt_inline_ipsec_cfg(mbox);
+	if (req == NULL)
+		return -ENOSPC;
+
+	req->dir = CPT_INLINE_OUTBOUND;
+	req->slot = lf_id;
+	if (ena) {
+		req->enable = 1;
+		req->sso_pf_func = sso_pf_func;
+		req->nix_pf_func = nix_pf_func;
+	} else {
+		req->enable = 0;
+	}
+
+	return mbox_process(mbox);
+}
+
+int
+roc_cpt_inline_ipsec_cfg(struct dev *cpt_dev, uint8_t lf_id,
+			 struct roc_nix *roc_nix)
+{
+	bool ena = roc_nix ? true : false;
+	uint16_t nix_pf_func = 0;
+	uint16_t sso_pf_func = 0;
+
+	if (ena) {
+		nix_pf_func = roc_nix_get_pf_func(roc_nix);
+		sso_pf_func = idev_sso_pffunc_get();
+	}
+
+	return cpt_lf_outb_cfg(cpt_dev, sso_pf_func, nix_pf_func, lf_id, ena);
+}
+
+int
+roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt, uint16_t param1,
+			     uint16_t param2)
+{
+	struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt);
+	struct cpt_rx_inline_lf_cfg_msg *req;
+	struct mbox *mbox;
+
+	mbox = cpt->dev.mbox;
+
+	req = mbox_alloc_msg_cpt_rx_inline_lf_cfg(mbox);
+	if (req == NULL)
+		return -ENOSPC;
+
+	req->sso_pf_func = idev_sso_pffunc_get();
+	req->param1 = param1;
+	req->param2 = param2;
+
+	return mbox_process(mbox);
+}
+
+int
 roc_cpt_rxc_time_cfg(struct roc_cpt *roc_cpt, struct roc_cpt_rxc_time_cfg *cfg)
 {
 	struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt);
diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h
index 022c8ad..83ef5c7 100644
--- a/drivers/common/cnxk/roc_cpt.h
+++ b/drivers/common/cnxk/roc_cpt.h
@@ -29,6 +29,7 @@  struct roc_cpt_lf {
 	uint64_t *fc_addr;
 	uint64_t io_addr;
 	uint8_t *iq_vaddr;
+	struct roc_nix *inl_outb_nix;
 } __plt_cache_aligned;
 
 struct roc_cpt {
@@ -64,6 +65,10 @@  void __roc_api roc_cpt_dev_clear(struct roc_cpt *roc_cpt);
 int __roc_api roc_cpt_lf_init(struct roc_cpt *roc_cpt, struct roc_cpt_lf *lf);
 void __roc_api roc_cpt_lf_fini(struct roc_cpt_lf *lf);
 int __roc_api roc_cpt_lf_ctx_flush(struct roc_cpt_lf *lf, uint64_t cptr);
+int __roc_api roc_cpt_inline_ipsec_cfg(struct dev *dev, uint8_t slot,
+				       struct roc_nix *nix);
+int __roc_api roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt,
+					   uint16_t param1, uint16_t param2);
 int __roc_api roc_cpt_afs_print(struct roc_cpt *roc_cpt);
 int __roc_api roc_cpt_lfs_print(struct roc_cpt *roc_cpt);
 void __roc_api roc_cpt_iq_disable(struct roc_cpt_lf *lf);
diff --git a/drivers/common/cnxk/roc_cpt_priv.h b/drivers/common/cnxk/roc_cpt_priv.h
index 6cfa4df..0880ec0 100644
--- a/drivers/common/cnxk/roc_cpt_priv.h
+++ b/drivers/common/cnxk/roc_cpt_priv.h
@@ -33,6 +33,8 @@  int cpt_lfs_free(struct dev *dev);
 int cpt_lf_init(struct roc_cpt_lf *lf);
 void cpt_lf_fini(struct roc_cpt_lf *lf);
 
+int cpt_lf_outb_cfg(struct dev *dev, uint16_t sso_pf_func, uint16_t nix_pf_func,
+		    uint8_t lf_id, bool ena);
 int cpt_get_msix_offset(struct dev *dev, struct msix_offset_rsp **msix_rsp);
 uint64_t cpt_get_blkaddr(struct dev *dev);
 
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 0827b77..59d7d91 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -17,6 +17,8 @@  INTERNAL {
 	roc_cpt_dev_fini;
 	roc_cpt_dev_init;
 	roc_cpt_eng_grp_add;
+	roc_cpt_inline_ipsec_cfg;
+	roc_cpt_inline_ipsec_inb_cfg;
 	roc_cpt_iq_disable;
 	roc_cpt_lf_ctx_flush;
 	roc_cpt_lf_init;