From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 649C845AE3; Tue, 8 Oct 2024 18:21:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 512D64025C; Tue, 8 Oct 2024 18:21:54 +0200 (CEST) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id CCDCB4021E for ; Tue, 8 Oct 2024 18:21:52 +0200 (CEST) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-20bb92346caso38180075ad.0 for ; Tue, 08 Oct 2024 09:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728404512; x=1729009312; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ZCGChTwsfvfPqG1qqzMjCy3Yt9FrmtCXIBuEJWYLczA=; b=cdwWd7hjcfhZ0Nyvr4tWWIenJgeyERd54rEKC8+NZyMeN8X76wIJLQOhZ9FKv6Ahrr zl43ObDZQDIsA5JEqvJJOdfUwcZsq6HvjpuhLh0vfwjamxyT3SkBKabyrDHUgG1YMZ18 /xOyA83T1HJKnritVn4NmtlWZM0Q9UrW/EbcqmUGaUStf2FPiTlQoUXmqCNTcDyggIth i0O/Ti0OuN38S3b7oqVvWW02dfj5tCl2iKLZmxT1QCx+BRP8GxRCsM+JGBp19JDJf/o4 XGGiIEQMnnxkFbW7AIqpD4dN01sswITrlBFhzTFo4zf8o+WLlc9h7tkuR9mxByFIDVh+ dpNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728404512; x=1729009312; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZCGChTwsfvfPqG1qqzMjCy3Yt9FrmtCXIBuEJWYLczA=; b=dNSG9/nk61mtfcO8AzRaucD9KG8cjSzZYVGyMIphGOsIOa9NFooNXwr5b+FftiFutt 0WnNNlpCpVA0toYOonCTJPI0k/UIci3dHzUNT0xcSMWMmhgRPFCZic2m9J0J9VFJrxa+ Y5/HHB4E58HzwUFZueRozV2+1yUyGO66tZvDiU5/YkmQwFbN06BQGRL0runSkPBDUvwb MHTx8sFyWUeJcvIR0vkNSJyFV0De50Ha4QFzPdxL5HuCNDd9MfEVEWA4UfZasMJKBkch kXT5tOaJVaXclEGwL+aas1w+hgPbamlNQDfTI5dG3IvTkBVJrfwUdj9I8iowRztsTs8a vB4Q== X-Gm-Message-State: AOJu0Yyu21rjS60q812cYpcw4g1XSqNWhfSdY1REA5wjJ+oaPqOnbSzR LEMTOte9j7AOWUsivC3eS34uRD3oj2pHxiLN0c2u6H+GpnW4GKZUO4FXYwlMLbY= X-Google-Smtp-Source: AGHT+IExiO+g0ugN9WhhsOZgEpIYqeG0sHn3Jjbp8F1CMRmRx496HcVALyp4TPoqMR3K6pw+vf+Y7g== X-Received: by 2002:a17:903:2412:b0:207:794c:ef24 with SMTP id d9443c01a7336-20c5fab101dmr11119945ad.4.1728404511865; Tue, 08 Oct 2024 09:21:51 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1395a533sm57203045ad.204.2024.10.08.09.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:21:51 -0700 (PDT) Date: Tue, 8 Oct 2024 09:21:50 -0700 From: Stephen Hemminger To: Yong Zhang Cc: dev@dpdk.org, david.marchand@redhat.com Subject: Re: [v2 1/5] raw/zxdh: introduce zxdh raw device driver Message-ID: <20241008092150.6cd0e89d@hermes.local> In-Reply-To: <20240812073209.1924286-1-zhang.yong25@zte.com.cn> References: <20240812073209.1924286-1-zhang.yong25@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, 12 Aug 2024 15:31:24 +0800 Yong Zhang 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 > +`_. 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 > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include 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 // for rte_spinlock_t #include // for RTE_LOG_COMMA, RTE_LOG_LINE_PREFIX #include // 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 // lines 13-13 The full include-list for drivers/raw/zxdh/zxdh_rawdev.h: #include // for rte_spinlock_t #include // for RTE_LOG_COMMA, RTE_LOG_LINE_PREFIX #include // for rte_rawdev #include // 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 // for PATH_MAX #include // 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 // lines 5-5 - #include // lines 16-16 - #include // lines 28-28 - #include // lines 19-19 - #include // lines 21-21 - #include // lines 22-22 - #include // lines 26-26 - #include // lines 25-25 - #include // lines 7-7 - #include // lines 9-9 - #include // lines 12-12 The full include-list for drivers/raw/zxdh/zxdh_rawdev.c: #include "zxdh_rawdev.h" #include // for rte_pci_device, rte_pci_get_sysfs... #include // for EINVAL, ENOMEM, EEXIST, errno #include // for open, O_RDWR #include // for uint16_t, uint32_t, uint8_t, uint... #include // for PATH_MAX #include // for rte_wmb #include // for __rte_unused, RTE_PRIORITY_LAST #include // for rte_mem_resource, RTE_PMD_REGISTE... #include // for rte_mem_map, rte_mem_prot, rte_me... #include // for rte_strerror, per_lcore__rte_errno #include // for rte_socket_id #include // for RTE_LOG_ERR, RTE_LOG_DEBUG, RTE_L... #include // for rte_free, rte_zmalloc #include // for rte_memzone, rte_memzone::(anonym... #include // for rte_pci_addr, PCI_PRI_FMT, rte_pc... #include // for rte_rawdev_obj_t, rte_rawdev, RTE... #include // for rte_rawdev_pmd_allocate, rte_rawd... #include // for rte_spinlock_lock, rte_spinlock_u... #include // for NULL, size_t, snprintf #include // for memset, strerror #include // for close #include "rte_branch_prediction.h" // for unlikely