[dpdk-dev] [PATCH v3 04/20] thunderx/nicvf: add get_reg and get_reg_length support

Ferruh Yigit ferruh.yigit at intel.com
Wed Jun 8 18:16:12 CEST 2016


On 6/7/2016 5:40 PM, Jerin Jacob wrote:
> Signed-off-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
> Signed-off-by: Maciej Czekaj <maciej.czekaj at caviumnetworks.com>
> Signed-off-by: Kamil Rytarowski <Kamil.Rytarowski at caviumnetworks.com>
> Signed-off-by: Zyta Szpak <zyta.szpak at semihalf.com>
> Signed-off-by: Slawomir Rosek <slawomir.rosek at semihalf.com>
> Signed-off-by: Radoslaw Biernacki <rad at semihalf.com>
> ---
>  drivers/net/thunderx/nicvf_ethdev.c | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
> index 5d28eea..34b4735 100644
> --- a/drivers/net/thunderx/nicvf_ethdev.c
> +++ b/drivers/net/thunderx/nicvf_ethdev.c
> @@ -70,6 +70,9 @@
>  #include "nicvf_logs.h"
>  
>  static int nicvf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
> +static int nicvf_dev_get_reg_length(struct rte_eth_dev *dev);
> +static int nicvf_dev_get_regs(struct rte_eth_dev *dev,
> +			      struct rte_dev_reg_info *regs);

Is these declarations required, function order seems correct? Since
these are static functions, it is possible to remove these by
re-ordering function locations.

>  
>  static inline int
>  nicvf_atomic_write_link_status(struct rte_eth_dev *dev,
> @@ -145,9 +148,36 @@ nicvf_dev_link_update(struct rte_eth_dev *dev,
>  	return nicvf_atomic_write_link_status(dev, &link);
>  }
>  
> +static int
> +nicvf_dev_get_reg_length(struct rte_eth_dev *dev  __rte_unused)
> +{
> +	return nicvf_reg_get_count();
> +}
> +
> +static int
> +nicvf_dev_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs)
> +{
> +	uint64_t *data = regs->data;
> +	struct nicvf *nic = nicvf_pmd_priv(dev);
> +
> +	if (data == NULL)
> +		return -EINVAL;
> +
> +	/* Support only full register dump */
> +	if ((regs->length == 0) ||
> +		(regs->length == (uint32_t)nicvf_reg_get_count())) {
> +		regs->version = nic->vendor_id << 16 | nic->device_id;
> +		nicvf_reg_dump(nic, data);
> +		return 0;
> +	}
> +	return -ENOTSUP;
> +}
> +
>  /* Initialize and register driver with DPDK Application */
>  static const struct eth_dev_ops nicvf_eth_dev_ops = {
>  	.link_update              = nicvf_dev_link_update,
> +	.get_reg_length           = nicvf_dev_get_reg_length,
> +	.get_reg                  = nicvf_dev_get_regs,
>  };
>  
>  static int
> 



More information about the dev mailing list