DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Yong Zhang <zhang.yong25@zte.com.cn>
Cc: dev@dpdk.org, david.marchand@redhat.com
Subject: Re: [v2 1/5] raw/zxdh: introduce zxdh raw device driver
Date: Tue, 8 Oct 2024 09:21:50 -0700	[thread overview]
Message-ID: <20241008092150.6cd0e89d@hermes.local> (raw)
In-Reply-To: <20240812073209.1924286-1-zhang.yong25@zte.com.cn>

On Mon, 12 Aug 2024 15:31:24 +0800
Yong Zhang <zhang.yong25@zte.com.cn> wrote:

> diff --git a/doc/guides/rawdevs/zxdh.rst b/doc/guides/rawdevs/zxdh.rst
> new file mode 100644
> index 0000000000..fa7ada1004
> --- /dev/null
> +++ b/doc/guides/rawdevs/zxdh.rst
> @@ -0,0 +1,30 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright 2024 ZTE Corporation
> +
> +ZXDH Rawdev Driver
> +======================
> +
> +The ``zxdh`` rawdev driver is an implementation of the rawdev API,
> +that provides communication between two separate hosts.
> +This is achieved via using the GDMA controller of Dinghai SoC,
> +which can be configured through exposed MPF devices.

This is awkward use of passive voice and could be simplified and
shortened.

> +
> +Device Setup
> +-------------
> +
> +It is recommended to bind the ZXDH MPF kernel driver for MPF devices (Not mandatory).
> +The kernel drivers can be downloaded at `ZTE Official Website
> +<https://enterprise.zte.com.cn/>`_.

What is works (and what doesn't) without the kernel driver.
Has this driver been submitted to upstream kernel.org?
DPDK does not want to be requiring or using 3rd party kernel drivers with non GPLv2 licenses.

> +
> +Initialization
> +--------------
> +
> +The ``zxdh`` rawdev driver needs to work in IOVA PA mode.
> +Consider using ``--iova-mode=pa`` in the EAL options.
> +
> +Platform Requirement
> +~~~~~~~~~~~~~~~~~~~~
> +
> +This PMD is only supported on ZTE Neo Platforms:
> +- Neo X510/X512
> +


Adding blank line at end of file causes git to complain when merging

> diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build
> index 05cad143fe..237d1bdd80 100644
> --- a/drivers/raw/meson.build
> +++ b/drivers/raw/meson.build
> @@ -12,5 +12,6 @@ drivers = [
>          'ifpga',
>          'ntb',
>          'skeleton',
> +        'zxdh',
>  ]
>  std_deps = ['rawdev']
> diff --git a/drivers/raw/zxdh/meson.build b/drivers/raw/zxdh/meson.build
> new file mode 100644
> index 0000000000..266d3db6d8
> --- /dev/null
> +++ b/drivers/raw/zxdh/meson.build
> @@ -0,0 +1,5 @@
> +#SPDX-License-Identifier: BSD-3-Clause
> +#Copyright 2024 ZTE Corporation
> +
> +deps += ['rawdev', 'kvargs', 'mbuf', 'bus_pci']
> +sources = files('zxdh_rawdev.c')
> diff --git a/drivers/raw/zxdh/zxdh_rawdev.c b/drivers/raw/zxdh/zxdh_rawdev.c
> new file mode 100644
> index 0000000000..269c4f92e0
> --- /dev/null
> +++ b/drivers/raw/zxdh/zxdh_rawdev.c
> @@ -0,0 +1,220 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2024 ZTE Corporation
> + */
> +
> +#include <assert.h>
> +#include <stdio.h>
> +#include <stdbool.h>
> +#include <errno.h>
> +#include <stdint.h>
> +#include <inttypes.h>
> +#include <string.h>
> +#include <sys/types.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +
> +#include <rte_byteorder.h>
> +#include <rte_errno.h>
> +#include <rte_common.h>
> +#include <rte_debug.h>
> +#include <rte_dev.h>
> +#include <rte_eal.h>
> +#include <rte_kvargs.h>
> +#include <rte_log.h>
> +#include <rte_malloc.h>
> +#include <rte_memory.h>
> +#include <rte_memcpy.h>
> +#include <rte_lcore.h>
> +#include <rte_cycles.h>
> +#include <rte_memzone.h>
> +#include <rte_atomic.h>
> +#include <rte_rawdev.h>
> +#include <rte_rawdev_pmd.h>
> +#include <rte_pci.h>
> +#include <bus_pci_driver.h>
> +#include <rte_eal_paging.h>

This is a large set of include and looks like it was a copy paste from elsewhere.

For example: you are including rte_kvargs.h but never use kvargs in the driver.

If I run iwyu on the driver it produces.

$ iwyu -I lib/eal/include -I drivers/bus/pci drivers/raw/zxdh/zxdh_rawdev.c

drivers/raw/zxdh/zxdh_rawdev.h should add these lines:
#include <generic/rte_spinlock.h>  // for rte_spinlock_t
#include <rte_log.h>               // for RTE_LOG_COMMA, RTE_LOG_LINE_PREFIX
#include <stdint.h>                // for uint32_t, uint16_t, uint8_t, uint64_t
#include "rte_common.h"            // for rte_iova_t

drivers/raw/zxdh/zxdh_rawdev.h should remove these lines:
- #include <rte_spinlock.h>  // lines 13-13

The full include-list for drivers/raw/zxdh/zxdh_rawdev.h:
#include <generic/rte_spinlock.h>  // for rte_spinlock_t
#include <rte_log.h>               // for RTE_LOG_COMMA, RTE_LOG_LINE_PREFIX
#include <rte_rawdev.h>            // for rte_rawdev
#include <stdint.h>                // for uint32_t, uint16_t, uint8_t, uint64_t
#include "rte_common.h"            // for rte_iova_t
---

drivers/raw/zxdh/zxdh_rawdev.c should add these lines:
#include <limits.h>                 // for PATH_MAX
#include <rte_spinlock.h>           // for rte_spinlock_lock, rte_spinlock_u...
#include "rte_branch_prediction.h"  // for unlikely

drivers/raw/zxdh/zxdh_rawdev.c should remove these lines:
- #include <assert.h>  // lines 5-5
- #include <rte_byteorder.h>  // lines 16-16
- #include <rte_cycles.h>  // lines 28-28
- #include <rte_debug.h>  // lines 19-19
- #include <rte_eal.h>  // lines 21-21
- #include <rte_kvargs.h>  // lines 22-22
- #include <rte_memcpy.h>  // lines 26-26
- #include <rte_memory.h>  // lines 25-25
- #include <stdbool.h>  // lines 7-7
- #include <stdint.h>  // lines 9-9
- #include <sys/types.h>  // lines 12-12

The full include-list for drivers/raw/zxdh/zxdh_rawdev.c:
#include "zxdh_rawdev.h"
#include <bus_pci_driver.h>         // for rte_pci_device, rte_pci_get_sysfs...
#include <errno.h>                  // for EINVAL, ENOMEM, EEXIST, errno
#include <fcntl.h>                  // for open, O_RDWR
#include <inttypes.h>               // for uint16_t, uint32_t, uint8_t, uint...
#include <limits.h>                 // for PATH_MAX
#include <rte_atomic.h>             // for rte_wmb
#include <rte_common.h>             // for __rte_unused, RTE_PRIORITY_LAST
#include <rte_dev.h>                // for rte_mem_resource, RTE_PMD_REGISTE...
#include <rte_eal_paging.h>         // for rte_mem_map, rte_mem_prot, rte_me...
#include <rte_errno.h>              // for rte_strerror, per_lcore__rte_errno
#include <rte_lcore.h>              // for rte_socket_id
#include <rte_log.h>                // for RTE_LOG_ERR, RTE_LOG_DEBUG, RTE_L...
#include <rte_malloc.h>             // for rte_free, rte_zmalloc
#include <rte_memzone.h>            // for rte_memzone, rte_memzone::(anonym...
#include <rte_pci.h>                // for rte_pci_addr, PCI_PRI_FMT, rte_pc...
#include <rte_rawdev.h>             // for rte_rawdev_obj_t, rte_rawdev, RTE...
#include <rte_rawdev_pmd.h>         // for rte_rawdev_pmd_allocate, rte_rawd...
#include <rte_spinlock.h>           // for rte_spinlock_lock, rte_spinlock_u...
#include <stdio.h>                  // for NULL, size_t, snprintf
#include <string.h>                 // for memset, strerror
#include <unistd.h>                 // for close
#include "rte_branch_prediction.h"  // for unlikely




  parent reply	other threads:[~2024-10-08 16:21 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12  7:31 Yong Zhang
2024-08-12  7:31 ` [v2 2/5] raw/zxdh: add support for queue setup operation Yong Zhang
2024-08-12  7:31 ` [v2 3/5] raw/zxdh: add support for standard rawdev operations Yong Zhang
2024-08-12  7:31 ` [v2 4/5] raw/zxdh: add support for enqueue operation Yong Zhang
2024-08-12  7:31 ` [v2 5/5] raw/zxdh: add support for dequeue operation Yong Zhang
2024-09-02  8:55 ` Re:[PATCH] raw/zxdh: introduce zxdh raw device driver Yong Zhang
2024-09-06  6:20 ` Yong Zhang
2024-09-09  8:31   ` [PATCH] " David Marchand
2024-09-09  9:26 ` Yong Zhang
2024-09-20  2:07 ` Yong Zhang
2024-09-23  1:49 ` Yong Zhang
2024-09-26  9:44 ` Yong Zhang
2024-09-29  1:26 ` Yong Zhang
2024-10-08  1:18 ` Yong Zhang
2024-10-08  2:58   ` [PATCH] " Stephen Hemminger
2024-10-08  6:40     ` zhang.yong25
2024-10-08 16:12       ` Stephen Hemminger
2024-10-08 16:21 ` Stephen Hemminger [this message]
2024-10-14  8:09 ` [v3 1/5] raw/gdtc: introduce gdtc " Yong Zhang
2024-10-14  8:09 ` [v3 2/5] raw/gdtc: add support for queue setup operation Yong Zhang
2024-10-14  8:09 ` [v3 3/5] raw/gdtc: add support for standard rawdev operations Yong Zhang
2024-10-14  8:09 ` [v3 4/5] raw/gdtc: add support for enqueue operation Yong Zhang
2024-10-14  8:09 ` [v3 5/5] raw/gdtc: add support for dequeue operation Yong Zhang
2024-10-15 16:50   ` Patrick Robb
2024-10-15 16:52     ` Patrick Robb
2024-10-14  8:22 ` Re:[PATCH] raw/gdtc: introduce gdtc raw device driver Yong Zhang
2024-10-14  8:33   ` [PATCH] " Morten Brørup

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=20241008092150.6cd0e89d@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=zhang.yong25@zte.com.cn \
    /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).