From ed79bf91bc71fad4b1a41c039ee5876c95d56123 Mon Sep 17 00:00:00 2001 From: Vidya Sagar Velumuri Date: Fri, 25 Jun 2021 11:06:41 +0530 Subject: [PATCH] common/cnxk: add inline IPsec configuration mailbox Add mbox to configure inbound & outbound inline IPsec. Signed-off-by: Tejasree Kondoj Signed-off-by: Vidya Sagar Velumuri Acked-by: Akhil Goyal --- 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 --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c index fd92de33ab..81e8b158cf 100644 --- a/drivers/common/cnxk/roc_cpt.c +++ b/drivers/common/cnxk/roc_cpt.c @@ -216,6 +216,67 @@ cpt_lf_dump(struct roc_cpt_lf *lf) plt_read64(lf->rbase + CPT_LF_Q_GRP_PTR)); } +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) { diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h index 022c8adcd7..83ef5c72fa 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 6cfa4dff43..0880ec098d 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 4fae3256ab..faa8eb405a 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -39,6 +39,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; -- 2.20.1