[dpdk-dev] [PATCH v2 02/15] common/octeontx2: add routine to check if sec capable otx2

Akhil Goyal akhil.goyal at nxp.com
Mon Jan 27 08:01:05 CET 2020


Hi Anoob,

> 
> From: Vamsi Attunuru <vattunuru at marvell.com>
> 
> This routine returns true if given rte_eth_dev is security offload
> capable and belongs to octeontx2.
> 
> Signed-off-by: Anoob Joseph <anoobj at marvell.com>
> Signed-off-by: Tejasree Kondoj <ktejasree at marvell.com>
> Signed-off-by: Vamsi Attunuru <vattunuru at marvell.com>
> ---
>  drivers/common/octeontx2/otx2_common.c               | 20
> ++++++++++++++++++++
>  drivers/common/octeontx2/otx2_common.h               |  2 ++
>  .../octeontx2/rte_common_octeontx2_version.map       |  1 +
>  3 files changed, 23 insertions(+)
> 
> diff --git a/drivers/common/octeontx2/otx2_common.c
> b/drivers/common/octeontx2/otx2_common.c
> index 7e45366..2f9b167 100644
> --- a/drivers/common/octeontx2/otx2_common.c
> +++ b/drivers/common/octeontx2/otx2_common.c
> @@ -3,6 +3,7 @@
>   */
> 
>  #include <rte_atomic.h>
> +#include <rte_ethdev.h>
>  #include <rte_malloc.h>
>  #include <rte_log.h>
> 
> @@ -23,6 +24,25 @@ otx2_npa_set_defaults(struct otx2_idev_cfg *idev)
> 
>  /**
>   * @internal
> + * Check if rte_eth_dev is security offload capable otx2_eth_dev
> + */
> +uint8_t
> +otx2_ethdev_is_sec_capable(struct rte_eth_dev *eth_dev)
> +{
> +	struct rte_pci_device *pci_dev;
> +
> +	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
> +
> +	if (pci_dev->id.device_id == PCI_DEVID_OCTEONTX2_RVU_PF ||
> +	    pci_dev->id.device_id == PCI_DEVID_OCTEONTX2_RVU_VF ||
> +	    pci_dev->id.device_id == PCI_DEVID_OCTEONTX2_RVU_AF_VF)
> +		return 1;
> +
> +	return 0;
> +}

Why is this API defined in common?
This is a capability of ethernet device and is only specific to OCTEONTX2 driver.

- Akhil


More information about the dev mailing list