From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <roy.fan.zhang@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 4288CE5D
 for <dev@dpdk.org>; Mon, 27 Nov 2017 17:47:23 +0100 (CET)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 27 Nov 2017 08:47:22 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.44,465,1505804400"; 
   d="scan'208";a="7633532"
Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75])
 by fmsmga001.fm.intel.com with ESMTP; 27 Nov 2017 08:47:20 -0800
Received: from irsmsx101.ger.corp.intel.com ([169.254.1.22]) by
 IRSMSX153.ger.corp.intel.com ([169.254.9.34]) with mapi id 14.03.0319.002;
 Mon, 27 Nov 2017 16:47:19 +0000
From: "Zhang, Roy Fan" <roy.fan.zhang@intel.com>
To: Jay Zhou <jianjay.zhou@huawei.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "yliu@fridaylinux.org" <yliu@fridaylinux.org>,
 "maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
 "arei.gonglei@huawei.com" <arei.gonglei@huawei.com>, "Zeng, Xin"
 <xin.zeng@intel.com>, "weidong.huang@huawei.com" <weidong.huang@huawei.com>,
 "wangxinxin.wang@huawei.com" <wangxinxin.wang@huawei.com>,
 "longpeng2@huawei.com" <longpeng2@huawei.com>
Thread-Topic: [PATCH] virtio: add new driver for crypto devices
Thread-Index: AQHTX8dFV/HgsE430UOJJXSBBIVIC6Mobg7A
Date: Mon, 27 Nov 2017 16:47:19 +0000
Message-ID: <9F7182E3F746AB4EA17801C148F3C6043305A340@IRSMSX101.ger.corp.intel.com>
References: <1510938620-15268-1-git-send-email-jianjay.zhou@huawei.com>
In-Reply-To: <1510938620-15268-1-git-send-email-jianjay.zhou@huawei.com>
Accept-Language: en-IE, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ctpclassification: CTP_PUBLIC
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjk4NzRiNTUtMDE0OS00OWQwLWI0NDctZmFmNDc3Y2E1YTE2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNi41LjkuMyIsIlRydXN0ZWRMYWJlbEhhc2giOiJlNUFMY0xJczFnT3E1RFhnT0FlUzlpT1RWOTZRc05wUktqXC9nNXFzYzNrdz0ifQ==
dlp-product: dlpe-windows
dlp-version: 11.0.0.116
dlp-reaction: no-action
x-originating-ip: [163.33.239.180]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH] virtio: add new driver for crypto devices
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 27 Nov 2017 16:47:23 -0000

Hi Jay,

Thanks for contributing to DPDK.

The code has been tested and works fine.=20

A few comments:

1. Could you split the patch into a patchset, as suggested in contribution =
guide in http://dpdk.org/doc/guides/contributing/patches.html, section 5.4?
2. Please update doc/guides/cryptodevs for describing your virtio crypto PM=
D.
3. Please update doc/guides/rel_notes/release_18.02.=20
4. One more comment inline

Regards,
Fan

> -----Original Message-----
> From: Jay Zhou [mailto:jianjay.zhou@huawei.com]
> Sent: Friday, November 17, 2017 5:10 PM
> To: dev@dpdk.org
> Cc: yliu@fridaylinux.org; maxime.coquelin@redhat.com;
> arei.gonglei@huawei.com; Zhang, Roy Fan <roy.fan.zhang@intel.com>; Zeng,
> Xin <xin.zeng@intel.com>; weidong.huang@huawei.com;
> wangxinxin.wang@huawei.com; longpeng2@huawei.com;
> jianjay.zhou@huawei.com
> Subject: [PATCH] virtio: add new driver for crypto devices
> +	/*
> +	 * malloc memory to store indirect vring_desc entries, including
> +	 * ctrl request, cipher key, auth key, session input and desc vring
> +	 */
> +	desc_offset =3D ctrl_req_length + cipher_keylen + auth_keylen
> +		+ input_length;

Instead of using rte_malloc() as below, you could pre-allocate a mempool an=
d use
rte_mempool_get() or rte_mempool_get_bulk() to get these memory to store de=
scriptors.
You can use rte_mempool_virt2iova() to obtain the physical address of this =
memory. This shall
have better performance.

> +	virt_addr_started =3D rte_malloc(NULL,
> +		desc_offset +
> NUM_ENTRY_VIRTIO_CRYPTO_SYM_CREATE_SESSION
> +			* sizeof(struct vring_desc), RTE_CACHE_LINE_SIZE);
> +	if (virt_addr_started =3D=3D NULL) {
> +		PMD_SESSION_LOG(ERR, "not enough heap memory");
> +		return -ENOSPC;
> +	}
> +	phys_addr_started =3D rte_malloc_virt2phy(virt_addr_started);