From: Vidya Sagar Velumuri Date: Tue, 6 Apr 2021 14:41:15 +0000 (+0530) Subject: common/cnxk: add NIX inline IPsec config API X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=bd02fe78c603f8f505dedccd4218d1e5fb518fdf;p=dpdk.git common/cnxk: add NIX inline IPsec config API Add API to configure NIX block for inline IPSec. Signed-off-by: Vidya Sagar Velumuri Acked-by: Nithin Dabilpuram --- diff --git a/drivers/common/cnxk/roc_nix.c b/drivers/common/cnxk/roc_nix.c index e64936e2e2..06219763b7 100644 --- a/drivers/common/cnxk/roc_nix.c +++ b/drivers/common/cnxk/roc_nix.c @@ -80,6 +80,34 @@ roc_nix_get_pf_func(struct roc_nix *roc_nix) return dev->pf_func; } +int +roc_nix_lf_inl_ipsec_cfg(struct roc_nix *roc_nix, struct roc_nix_ipsec_cfg *cfg, + bool enb) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct nix_inline_ipsec_lf_cfg *lf_cfg; + struct mbox *mbox = (&nix->dev)->mbox; + + lf_cfg = mbox_alloc_msg_nix_inline_ipsec_lf_cfg(mbox); + if (lf_cfg == NULL) + return -ENOSPC; + + if (enb) { + lf_cfg->enable = 1; + lf_cfg->sa_base_addr = cfg->iova; + lf_cfg->ipsec_cfg1.sa_idx_w = plt_log2_u32(cfg->max_sa); + lf_cfg->ipsec_cfg0.lenm1_max = roc_nix_max_pkt_len(roc_nix) - 1; + lf_cfg->ipsec_cfg1.sa_idx_max = cfg->max_sa - 1; + lf_cfg->ipsec_cfg0.sa_pow2_size = plt_log2_u32(cfg->sa_size); + lf_cfg->ipsec_cfg0.tag_const = cfg->tag_const; + lf_cfg->ipsec_cfg0.tt = cfg->tt; + } else { + lf_cfg->enable = 0; + } + + return mbox_process(mbox); +} + int roc_nix_max_pkt_len(struct roc_nix *roc_nix) { diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 638f82789a..1c097cb1a8 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -110,6 +110,14 @@ struct roc_nix_link_info { uint64_t port : 8; }; +struct roc_nix_ipsec_cfg { + uint32_t sa_size; + uint32_t tag_const; + plt_iova_t iova; + uint16_t max_sa; + uint8_t tt; +}; + /* Link status update callback */ typedef void (*link_status_t)(struct roc_nix *roc_nix, struct roc_nix_link_info *link); @@ -156,6 +164,8 @@ int __roc_api roc_nix_max_pkt_len(struct roc_nix *roc_nix); int __roc_api roc_nix_lf_alloc(struct roc_nix *roc_nix, uint32_t nb_rxq, uint32_t nb_txq, uint64_t rx_cfg); int __roc_api roc_nix_lf_free(struct roc_nix *roc_nix); +int __roc_api roc_nix_lf_inl_ipsec_cfg(struct roc_nix *roc_nix, + struct roc_nix_ipsec_cfg *cfg, bool enb); /* IRQ */ void __roc_api roc_nix_rx_queue_intr_enable(struct roc_nix *roc_nix, diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index bc6c9884d2..a0df26a8e8 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -28,6 +28,7 @@ INTERNAL { roc_nix_is_sdp; roc_nix_is_vf_or_sdp; roc_nix_lf_alloc; + roc_nix_lf_inl_ipsec_cfg; roc_nix_lf_free; roc_nix_mac_addr_add; roc_nix_mac_addr_del;