common/cnxk: add NIX inline IPsec config API

Add API to configure NIX block for inline IPSec.

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
This commit is contained in:
Vidya Sagar Velumuri 2021-04-06 20:11:15 +05:30 committed by Jerin Jacob
parent 1c518ee11e
commit bd02fe78c6
3 changed files with 39 additions and 0 deletions

View File

@ -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)
{

View File

@ -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,

View File

@ -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;