All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Apeksha Gupta <apeksha.gupta@nxp.com>,
	<david.marchand@redhat.com>, <andrew.rybchenko@oktetlabs.ru>,
	<ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>, <sachin.saxena@nxp.com>, <hemant.agrawal@nxp.com>
Subject: Re: [dpdk-dev] [PATCH v3 2/5] net/enetfec: add UIO support
Date: Thu, 23 Sep 2021 11:13:27 +0100	[thread overview]
Message-ID: <7fbc1cdf-8974-0012-dd21-c73022559576@intel.com> (raw)
In-Reply-To: <20210909204314.1826-3-apeksha.gupta@nxp.com>

On 9/9/2021 9:43 PM, Apeksha Gupta wrote:
> Implemented the fec-uio driver in kernel. enetfec PMD uses
> UIO interface to interact with "fec-uio" driver implemented in
> kernel for PHY initialisation and for mapping the allocated memory
> of register & BD from kernel to DPDK which gives access to
> non-cacheable memory for BD.
> 
> Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
> Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>

<...>

> +static struct uio_job enetfec_uio_job;
> +int count;
> +

This is a global non-static variable with a very generic name, when DPDK
application compiled all other dpdk libraries/drivers and applicaiton will have
access to this variable.

Please make the variable 'static' if possible and add a driver prefix.

<...>

> +config_enetfec_uio(struct enetfec_private *fep)
> +{
> +	char uio_device_file_name[32];
> +	struct uio_job *uio_job = NULL;
> +
> +	/* Mapping is done only one time */
> +	if (count > 0) {
> +		printf("Mapped!\n");
> +		return 0;

'printf' ? Should use logging macros.


> +	}
> +
> +	uio_job = &enetfec_uio_job;
> +
> +	/* Find UIO device created by ENETFEC-UIO kernel driver */
> +	memset(uio_device_file_name, 0, sizeof(uio_device_file_name));
> +	snprintf(uio_device_file_name, sizeof(uio_device_file_name), "%s%d",
> +			FEC_UIO_DEVICE_FILE_NAME, uio_job->uio_minor_number);

I guess this assumes 'uio_minor_number' is '0', but how can you know? What if
user bind another device first? Implemention your own uio handling is error prone.

> +
> +	/* Open device file */
> +	uio_job->uio_fd = open(uio_device_file_name, O_RDWR);
> +	if (uio_job->uio_fd < 0) {
> +		printf("US_UIO: Open Failed\n");
> +		exit(1);

'exit' ? Exit from all dpdk application because one of the drivers underneath
failed? Please return an error.

  reply	other threads:[~2021-09-23 10:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 20:43 [dpdk-dev] [PATCH v3 0/5] drivers/net: add NXP ENETFEC driver Apeksha Gupta
2021-09-09 20:43 ` [dpdk-dev] [PATCH v3 1/5] net/enetfec: introduce " Apeksha Gupta
2021-09-23 10:09   ` Ferruh Yigit
2021-10-01 10:22     ` [dpdk-dev] [EXT] " Apeksha Gupta
2021-10-01 14:45       ` Ferruh Yigit
2021-10-05  5:24         ` Apeksha Gupta
2021-10-05  9:29           ` Ferruh Yigit
2021-10-06  9:36             ` Apeksha Gupta
2021-09-09 20:43 ` [dpdk-dev] [PATCH v3 2/5] net/enetfec: add UIO support Apeksha Gupta
2021-09-23 10:13   ` Ferruh Yigit [this message]
2021-10-01 10:30     ` [dpdk-dev] [EXT] " Apeksha Gupta
2021-09-09 20:43 ` [dpdk-dev] [PATCH v3 3/5] net/enetfec: support queue configuration Apeksha Gupta
2021-09-09 20:43 ` [dpdk-dev] [PATCH v3 4/5] net/enetfec: add enqueue and dequeue support Apeksha Gupta
2021-09-09 20:43 ` [dpdk-dev] [PATCH v3 5/5] net/enetfec: add features Apeksha Gupta

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=7fbc1cdf-8974-0012-dd21-c73022559576@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=apeksha.gupta@nxp.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=sachin.saxena@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.