[dpdk-dev] [PATCH v5 03/11] net/octeontx_ep: add device init and uninit

Ferruh Yigit ferruh.yigit at intel.com
Thu Jan 28 17:55:30 CET 2021


On 1/28/2021 3:22 PM, Nalla Pradeep wrote:
> Add basic init and uninit function which includes
> initializing fields of ethdev private structure.
> 
> Signed-off-by: Nalla Pradeep <pnalla at marvell.com>
> ---
>   drivers/common/octeontx2/otx2_common.h  |  2 +-
>   drivers/net/octeontx_ep/otx_ep_common.h | 19 ++++++-
>   drivers/net/octeontx_ep/otx_ep_ethdev.c | 72 +++++++++++++++++++++++--
>   3 files changed, 86 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/common/octeontx2/otx2_common.h b/drivers/common/octeontx2/otx2_common.h
> index 96021eda2..cd52e098e 100644
> --- a/drivers/common/octeontx2/otx2_common.h
> +++ b/drivers/common/octeontx2/otx2_common.h
> @@ -136,7 +136,7 @@ extern int otx2_logtype_ree;
>   #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
>   #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
>   #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
> -#define PCI_DEVID_OCTEONTX2_EP_VF		0xB203 /* OCTEON TX2 EP mode */
> +#define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */

Hi Nalla,

Can you prepare a patch as a first patch of your series, that
1) renames 'PCI_DEVID_OCTEONTX2_EP_VF' -> 'PCI_DEVID_OCTEONTX2_EP_NET_VF'
2) adds 'PCI_DEVID_OCTEONTX2_EP_RAW_VF'

And does required driver changes for above.

Since that change requires update in the existing driver, 	 'raw/octeontx2_ep', 
better to get it out of way before 'net/octeontx_ep' changes, instead of 
spreading this into the 'net/octeontx_ep' patches.

What do you think?


>   /* OCTEON TX2 98xx EP mode */
>   #define PCI_DEVID_CN98XX_EP_NET_VF		0xB103
>   #define PCI_DEVID_OCTEONTX2_EP_RAW_VF		0xB204 /* OCTEON TX2 EP mode */
> diff --git a/drivers/net/octeontx_ep/otx_ep_common.h b/drivers/net/octeontx_ep/otx_ep_common.h
> index 35ea99a79..0d6484c87 100644
> --- a/drivers/net/octeontx_ep/otx_ep_common.h
> +++ b/drivers/net/octeontx_ep/otx_ep_common.h
> @@ -4,11 +4,28 @@
>   #ifndef _OTX_EP_COMMON_H_
>   #define _OTX_EP_COMMON_H_
>   
> +#define otx_ep_info(fmt, args...)				\
> +	RTE_LOG(INFO, PMD, fmt "\n", ## args)
> +
> +#define otx_ep_err(fmt, args...)				\
> +	RTE_LOG(ERR, PMD, "%s():%u " fmt "\n",			\
> +		__func__, __LINE__, ## args)

Below is using new log type, 'otx_net_ep_logtype', but why above two, 'info' & 
'err' types continue to use 'RTE_LOGTYPE_PMD'?
Can you switch them to new log type please?

> +
> +#define otx_ep_dbg(fmt, args...)				\
> +	rte_log(RTE_LOG_DEBUG, otx_net_ep_logtype,		\
> +		"%s():%u " fmt "\n",				\
> +		__func__, __LINE__, ##args)
> +

I think you need to move 'RTE_LOG_REGISTER' into this patch, that macro creates 
the 'otx_net_ep_logtype' logtype variable. Currently that macro is in next patch.

<...>

>   static int
>   otx_ep_eth_dev_init(struct rte_eth_dev *eth_dev)
>   {
> -	RTE_SET_USED(eth_dev);
> +	struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
> +	struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
> +	struct rte_ether_addr vf_mac_addr;
> +
> +	/* Single process support */
> +	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> +		return 0;
> +
> +	otx_epvf->eth_dev = eth_dev;
> +	otx_epvf->port_id = eth_dev->data->port_id;
> +	eth_dev->data->mac_addrs = rte_zmalloc("otx_ep", RTE_ETHER_ADDR_LEN, 0);
> +	if (eth_dev->data->mac_addrs == NULL) {
> +		otx_ep_err("MAC addresses memory allocation failed\n");
> +		return -ENOMEM;
> +	}
> +	rte_eth_random_addr(vf_mac_addr.addr_bytes);
> +	rte_ether_addr_copy(eth_dev->data->mac_addrs, &vf_mac_addr);

The API is 'rte_ether_addr_copy(from, to)', _unfortunately it is reverse of the 
more standard (dst, src) order_, can parameters be used wrong above?



More information about the dev mailing list