DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Pattan, Reshma" <reshma.pattan@intel.com>
To: "Xu, Rosen" <rosen.xu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>,
	"Wu, Jingjing" <jingjing.wu@intel.com>,
	"Iremonger, Bernard" <bernard.iremonger@intel.com>,
	"Xu, Rosen" <rosen.xu@intel.com>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] app/test-pmd: add IFPGA AFU register	read/write access for testpmd
Date: Fri, 14 Dec 2018 17:37:36 +0000	[thread overview]
Message-ID: <3AEA2BF9852C6F48A459DA490692831F2A3EAC16@irsmsx110.ger.corp.intel.com> (raw)
In-Reply-To: <1544750062-80485-1-git-send-email-rosen.xu@intel.com>

Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Rosen Xu
> Sent: Friday, December 14, 2018 1:14 AM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>;
> Xu, Rosen <rosen.xu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: [dpdk-dev] [PATCH v2] app/test-pmd: add IFPGA AFU register
> read/write access for testpmd
> 
> Currently register read/write of testpmd is only for PCI device, but more and
> more IFPGA based AFU devices need this feature to access registers, this patch
> will add support for it.
> 
> Signed-off-by: Rosen Xu <rosen.xu@intel.com>
> -	pci_len = pci_dev->mem_resource[0].len;
> -	if (reg_off >= pci_len) {
> +	if (reg_off >= len) {
>  		printf("Port %d: register offset %u (0x%X) out of port PCI "

Here log message mentions only PCI not ifpga device. Might need to edit the log.

> port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_x)  {
>  	uint32_t reg_v;
> -
> +	const struct rte_bus *bus;
> 
>  	if (port_id_is_invalid(port_id, ENABLED_WARN))
>  		return;
> @@ -935,7 +940,16 @@ void print_valid_ports(void)
>  		return;
>  	if (reg_bit_pos_is_invalid(bit_x))
>  		return;
> -	reg_v = port_id_pci_reg_read(port_id, reg_off);
> +
> +	bus = rte_bus_find_by_device(ports[port_id].dev_info.device);
> +	if (bus && !strcmp(bus->name, "pci")) {
> +		reg_v = port_id_pci_reg_read(port_id, reg_off);
> +	} else if (bus && !strcmp(bus->name, "ifpga")) {
> +		reg_v = port_id_afu_reg_read(port_id, reg_off);
> +	} else {
> +		printf("Not a PCI or AFU device\n");
> +		return;
> +	}

Here and in other places for reg_read , we have similar code  i.e. finding the device , checking its type, if ifpga call ifpga function else call pci functions.
Can this common code be moved to new function say pci_read_reg like port_reg_set() which we have already.
Also , again inside respective pci/ifpga reg read/write we are checking for pci type. So can all this be simplified, to remove redundant code.

Thanks,
Reshma

  parent reply	other threads:[~2018-12-14 17:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06 12:16 [dpdk-dev] [PATCH] " Rosen Xu
2018-12-07 10:24 ` Iremonger, Bernard
2018-12-14  1:16   ` Xu, Rosen
2018-12-14  1:14 ` [dpdk-dev] [PATCH v2] " Rosen Xu
2018-12-14 10:18   ` Iremonger, Bernard
2018-12-17 12:17     ` Xu, Rosen
2018-12-14 17:37   ` Pattan, Reshma [this message]
2018-12-17 12:16     ` Xu, Rosen
2018-12-17 12:29 ` [dpdk-dev] [PATCH v3] app/test-pmd: add IFPGA AFU register access fuction " Rosen Xu
2018-12-17 12:56 ` [dpdk-dev] [PATCH v4] app/test-pmd: add IFPGA AFU register access function " Rosen Xu
2018-12-18 10:21   ` Iremonger, Bernard
2018-12-18 11:32     ` Xu, Rosen
2018-12-18 11:30 ` [dpdk-dev] [PATCH v5] app/testpmd: add IFPGA AFU register access function Rosen Xu
2018-12-18 18:12   ` Iremonger, Bernard
2018-12-20  8:58     ` Ferruh Yigit
2018-12-20 10:48       ` Xu, Rosen
2018-12-20 14:22         ` Ferruh Yigit
2019-01-02  6:20           ` Xu, Rosen
2018-12-20 12:57   ` Ferruh Yigit
2019-01-02  6:19 ` [dpdk-dev] [PATCH v6] " Rosen Xu
2019-01-08 15:28   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3AEA2BF9852C6F48A459DA490692831F2A3EAC16@irsmsx110.ger.corp.intel.com \
    --to=reshma.pattan@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=rosen.xu@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).