From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 0F1FDA0C4F;
	Tue, 13 Jul 2021 16:19:57 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C3899410F0;
	Tue, 13 Jul 2021 16:19:56 +0200 (CEST)
Received: from mga18.intel.com (mga18.intel.com [134.134.136.126])
 by mails.dpdk.org (Postfix) with ESMTP id 951D2410DC
 for <dev@dpdk.org>; Tue, 13 Jul 2021 16:19:54 +0200 (CEST)
X-IronPort-AV: E=McAfee;i="6200,9189,10043"; a="197443235"
X-IronPort-AV: E=Sophos;i="5.84,236,1620716400"; d="scan'208";a="197443235"
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 13 Jul 2021 07:19:51 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.84,236,1620716400"; d="scan'208";a="630057251"
Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14])
 by orsmga005.jf.intel.com with ESMTP; 13 Jul 2021 07:19:50 -0700
Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by
 ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2242.10; Tue, 13 Jul 2021 07:19:50 -0700
Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by
 ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2242.10; Tue, 13 Jul 2021 07:19:49 -0700
Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by
 orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2242.10 via Frontend Transport; Tue, 13 Jul 2021 07:19:49 -0700
Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.177)
 by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.1.2242.10; Tue, 13 Jul 2021 07:19:45 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=kzm1COYijphDe9bPS6uw8AoN0DBNAl9+uK0f7hjqaK+Lby4TTt40/4gkl38jHVL7K6jw+Nbmg/P6pNg2zXhAo8A0DJ1CcVpLsEBYxWGJEuXo278QaT3UMqCHGNmNUZdgk0NuA8acXM90ew+DrGjfXAF+WZklEgOaalF2q0SM/sta/Wt9njoVg5LtwUPWgw3sx4152mM8dBdl9bp2oNcaqGa5TKFrAe0ikRvZE98AwlMYIVPpohsS12LaMn6zzrVJpFD6/dkjoukiHpMirAbzFJCWch1KZwNCntah/8t75zTd+RQDpDuTMyvNg4GzcrmMYgCTp599C88dWIbt5O/mcA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=4bWh7RYo4lvoYaoNtl1acte4tvaz0qmomfsXjEOdtHY=;
 b=AnWKHd3Fa+hW3hwJJzrVz6HGbDb86cMNeW+hlXsFYIiPi84tdy3GpbpkJa5hdMybTqxHFy+noVB7Wq3vQXR/Rca4amf10S4PZLqv7W8jfOVgvkqSU/eabk/rvNTQMRsANFw3/YHwL+SMUxrI7xFZ4Dw9BokDjoN1VK5W2rtkqfhewJe+f+h7IbwHJWpmHR2gPr4jTFIPZsvmONmuXh+pSCCku9VfYqysk9juCsQre4GWpwuD3AIpnzZg4UZPH77tKximWIQh52AqPMPPVd7+2TM5hfYxtdgq21P0vi6ESJhitaOshRZAbrbiMXUqTVBUdd7IHA1aGG59kF66Xu6kKQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
 dkim=pass header.d=intel.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; 
 s=selector2-intel-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=4bWh7RYo4lvoYaoNtl1acte4tvaz0qmomfsXjEOdtHY=;
 b=wUzhDA+BlyOeJXLQ75F0ALuF7kZIaVlyq2QzFq2ifp7WqlpXFV/4K1kdhSPMVYiaEQNw5IUSwTyh2O4idC2eobnANnav72XBjw/e0Vob9mC6mnwK8Wo8yFWREnzKCXAipiofTuUhH274BGk9QFUTH1XyUswapIHrVVEfW+NhnSo=
Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19)
 by DM5PR1101MB2089.namprd11.prod.outlook.com (2603:10b6:4:54::12) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.26; Tue, 13 Jul
 2021 14:19:39 +0000
Received: from DM6PR11MB4491.namprd11.prod.outlook.com
 ([fe80::7dc4:66b0:f76b:6d48]) by DM6PR11MB4491.namprd11.prod.outlook.com
 ([fe80::7dc4:66b0:f76b:6d48%7]) with mapi id 15.20.4308.027; Tue, 13 Jul 2021
 14:19:39 +0000
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: Chengwen Feng <fengchengwen@huawei.com>, "thomas@monjalon.net"
 <thomas@monjalon.net>, "Yigit, Ferruh" <ferruh.yigit@intel.com>, "Richardson, 
 Bruce" <bruce.richardson@intel.com>, "jerinj@marvell.com"
 <jerinj@marvell.com>, "jerinjacobk@gmail.com" <jerinjacobk@gmail.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, "mb@smartsharesystems.com"
 <mb@smartsharesystems.com>, "nipun.gupta@nxp.com" <nipun.gupta@nxp.com>,
 "hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
 "maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
 "honnappa.nagarahalli@arm.com" <honnappa.nagarahalli@arm.com>,
 "david.marchand@redhat.com" <david.marchand@redhat.com>, "sburla@marvell.com"
 <sburla@marvell.com>, "pkapoor@marvell.com" <pkapoor@marvell.com>,
 "liangma@liangbit.com" <liangma@liangbit.com>
Thread-Topic: [PATCH v2] dmadev: introduce DMA device library
Thread-Index: AQHXdjdRbUdumR0gYkyDDWqH5tGJ/qtA9NFw
Date: Tue, 13 Jul 2021 14:19:39 +0000
Message-ID: <DM6PR11MB4491C845AD5B76A3E7C8181E9A149@DM6PR11MB4491.namprd11.prod.outlook.com>
References: <1625231891-2963-1-git-send-email-fengchengwen@huawei.com>
 <1625995556-41473-1-git-send-email-fengchengwen@huawei.com>
In-Reply-To: <1625995556-41473-1-git-send-email-fengchengwen@huawei.com>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-product: dlpe-windows
dlp-reaction: no-action
dlp-version: 11.5.1.3
authentication-results: huawei.com; dkim=none (message not signed)
 header.d=none;huawei.com; dmarc=none action=none header.from=intel.com;
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 9e1a7940-dc04-4a59-a0ab-08d946094013
x-ms-traffictypediagnostic: DM5PR1101MB2089:
x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <DM5PR1101MB208916D70171DEB9F7B537929A149@DM5PR1101MB2089.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:8882;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: drSvsH1CgsYqhQLl0TCnFMUUK0Dgi+dm6CRzpSS6aazc4bMv7eVTej4qJRtCRzhzvnSEhNdHHaiYQJBI45GmpEz9kkEXhOFOMy7Uz9BVS5PXGw0jhapCm3rCznCV/vdPN9iHaTwpmhCaMGTPF+RjiuGJ6IPVb1ALja4cDx2fUFtZMzx0wrnhccj+0IvpsqBHrvLisT+ujmJVeQ8913HkCzCNkStOkb+1QVZSPZpx2354ETWl54EoRpw/0bSicfUHsW9a74ZdarqGeahbFTodm+ASmXE0h++p3RgGUCbfeCZN417AlhzuRHSlBzmMqqWXWDK2AEc0I7YIvDdG/oWZT4zvDJ3Px0B/fjc+tjdYtkPN6J0/WPjYVPrgNoKjDA4rlOHeKLmSYI2SsSTYeoHdVom9CCKGdDC3T9NKmQ7OyK+3bTedvz9ag/RNbRb22ZwGhIV6DXAqMYG5DXCU7FGiWj31j6fn1arvyc6wHlIwnYp6E2qUT6ydm9KK7Ihd7tBZK1Px2DPV/9mKr9ooNPZ/xebNFaBDnC4bxIl7mPYQUYuqW9/Jb4JKQZ2TBMjUCks1SHorG6F539WhqsUmwzmwuPNuOQ+u/6FsE5Gmr+UCaIy2AWHnBmTP5GIs9Y8q/JTjV+p0Cs8H3QJ5cewL784nWw==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(346002)(366004)(376002)(39860400002)(396003)(136003)(8676002)(66946007)(316002)(64756008)(55236004)(66476007)(26005)(66446008)(83380400001)(478600001)(5660300002)(33656002)(86362001)(110136005)(66556008)(55016002)(2906002)(7696005)(186003)(122000001)(71200400001)(6506007)(52536014)(38100700002)(7416002)(8936002)(4326008)(9686003)(54906003)(76116006);
 DIR:OUT; SFP:1102; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata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hw5grrUYtChhw7+cLWG5ECM1q9iBJV3XDEX7WmwWn5ixXaE+RCxUe?=
 =?us-ascii?Q?CIaznl/Z+iMg8pbTQ7iizPRngIkat9fqQRiTC6XEJ938HuSK2UYTp7LMomI1?=
 =?us-ascii?Q?KSqU+PhNTsg9kyQ89xTPsKr6z5P4GEk4ka/gpAoFjDNa3WiFCktonD8n/5Cv?=
 =?us-ascii?Q?uWPDxsElKUBBT2ngOU4iY8c6kyoSVWxBk7RVU3WD89E1ByglucoLgKRy/hAx?=
 =?us-ascii?Q?hSCLlj6q+Yqv0LcgVFtEFteEkc5U28upkaqEPWBxoRhFqWzD4gO4TY3GtqmJ?=
 =?us-ascii?Q?m64P4a3rEnyKqmUqW2a0vLI1yznhoe1mQOV6Bcw/HB5xGAtNoMQdSwwkDiLs?=
 =?us-ascii?Q?aHLdKg1j+vgXK4Y3sRUko7VRs6kVCL5rdHcaiVCiLiVGw810R70QA4y2IB89?=
 =?us-ascii?Q?Vx3xBcJGjNrU/3/LmecIlv6HX1D3t6hE2DvfoH3/Sui3JOOnyCE8UNy+HzQP?=
 =?us-ascii?Q?TXkp3fmhk0mRC9UESkUonXfA?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4491.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 9e1a7940-dc04-4a59-a0ab-08d946094013
X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jul 2021 14:19:39.2124 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: My1I1bXzWsAqYoCl9ultIUEXKbVpnrzxIA6HveVFnY54CehhGbMwDzJIv26wqOZ8xbjcZplJoWH80BaoiSgJBHLIM8fmhtQJxn/+19ueg1E=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1101MB2089
X-OriginatorOrg: intel.com
Subject: Re: [dpdk-dev] [PATCH v2] dmadev: introduce DMA device library
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>


> +#include "rte_dmadev_core.h"
> +
> +/**
> + *  DMA flags to augment operation preparation.
> + *  Used as the 'flags' parameter of rte_dmadev_copy/copy_sg/fill/fill_s=
g.
> + */
> +#define RTE_DMA_FLAG_FENCE	(1ull << 0)
> +/**< DMA fence flag
> + * It means the operation with this flag must be processed only after al=
l
> + * previous operations are completed.
> + *
> + * @see rte_dmadev_copy()
> + * @see rte_dmadev_copy_sg()
> + * @see rte_dmadev_fill()
> + * @see rte_dmadev_fill_sg()
> + */
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change without prior notice.
> + *
> + * Enqueue a copy operation onto the virtual DMA channel.
> + *
> + * This queues up a copy operation to be performed by hardware, but does=
 not
> + * trigger hardware to begin that operation.
> + *
> + * @param dev_id
> + *   The identifier of the device.
> + * @param vchan
> + *   The identifier of virtual DMA channel.
> + * @param src
> + *   The address of the source buffer.
> + * @param dst
> + *   The address of the destination buffer.
> + * @param length
> + *   The length of the data to be copied.
> + * @param flags
> + *   An flags for this operation.
> + *
> + * @return
> + *   - 0..UINT16_MAX: index of enqueued copy job.
> + *   - <0: Error code returned by the driver copy function.
> + */
> +__rte_experimental
> +static inline int
> +rte_dmadev_copy(uint16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iov=
a_t dst,
> +		uint32_t length, uint64_t flags)
> +{
> +	struct rte_dmadev *dev =3D &rte_dmadevices[dev_id];

One question I have - did you guys consider hiding definitions of struct rt=
e_dmadev=20
and  rte_dmadevices[] into .c straight from the start?
Probably no point to repeat our famous ABI ethdev/cryptodev/... pitfalls he=
re. =20

> +#ifdef RTE_DMADEV_DEBUG
> +	RTE_DMADEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
> +	RTE_FUNC_PTR_OR_ERR_RET(*dev->copy, -ENOTSUP);
> +	if (vchan >=3D dev->data->dev_conf.max_vchans) {
> +		RTE_DMADEV_LOG(ERR, "Invalid vchan %d\n", vchan);
> +		return -EINVAL;
> +	}
> +#endif
> +	return (*dev->copy)(dev, vchan, src, dst, length, flags);
> +}
> +
> +/**