From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <Gavin.Hu@arm.com>
Received: from EUR04-VI1-obe.outbound.protection.outlook.com
 (mail-eopbgr80047.outbound.protection.outlook.com [40.107.8.47])
 by dpdk.org (Postfix) with ESMTP id 415E41559
 for <dev@dpdk.org>; Mon, 10 Sep 2018 08:32:11 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; 
 s=selector1-arm-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=lN8GNSLvsePAFyQ4e0hJbEnczO9A6FNmwtY6yjNYUxg=;
 b=n2unbDzQPPb7YwZkW4GnSq8s+9IqIcfNTtGUkF6ZTjBtPrtlqQgsfIyoS6CSBy79j8tY+kduqUFyWaEmDM7P8PWUWDJi8AzLu7inY8c1wG8zxOsDLBq9jLiB0ZsOO0tM6wWNteOV+PJU1pFgpY4NS8lFrQqWGU3LWzhfJzo1anc=
Received: from VI1PR08MB3167.eurprd08.prod.outlook.com (52.133.15.142) by
 VI1PR08MB0464.eurprd08.prod.outlook.com (10.162.16.146) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1122.16; Mon, 10 Sep 2018 06:32:09 +0000
Received: from VI1PR08MB3167.eurprd08.prod.outlook.com
 ([fe80::b91d:e285:4647:f3e8]) by VI1PR08MB3167.eurprd08.prod.outlook.com
 ([fe80::b91d:e285:4647:f3e8%2]) with mapi id 15.20.1122.019; Mon, 10 Sep 2018
 06:32:09 +0000
From: "Gavin Hu (Arm Technology China)" <Gavin.Hu@arm.com>
To: Jens Freimann <jfreimann@redhat.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "tiwei.bie@intel.com" <tiwei.bie@intel.com>, "maxime.coquelin@redhat.com"
 <maxime.coquelin@redhat.com>
Thread-Topic: [dpdk-dev] [PATCH v5 06/11] net/virtio-user: add option to use
 packed queues
Thread-Index: AQHURg5WS9BkRWZkXUSXRuQSgZkYTKTpE5Dw
Date: Mon, 10 Sep 2018 06:32:09 +0000
Message-ID: <VI1PR08MB3167F43284CD3CAE034520D68F050@VI1PR08MB3167.eurprd08.prod.outlook.com>
References: <20180906181947.20646-1-jfreimann@redhat.com>
 <20180906181947.20646-7-jfreimann@redhat.com>
In-Reply-To: <20180906181947.20646-7-jfreimann@redhat.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=Gavin.Hu@arm.com; 
x-originating-ip: [113.29.88.7]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; VI1PR08MB0464;
 6:R1CpmUaSjIyjl5Oh6TeZfeYRkPUFHCPfQLkKZBsq2vY7Dotf2WmQi56z+DT1r6QV7XWPR3i5xVqZBGSZ5Sb1eBzTVRDqBcp9/SFkDsVoTSlfZ6WqBnfWsKtdyJqrd8EY+Rc7TvDqp+X6wo+YVju9kh4O+cUJtSvVZxyhKawJQ0ghwvK7pKoV3mXUvrrZhtO9p7nmiZSJ9+yqgivvasZkd2Pd5gjyt67BCUNw+ZC4yXSX35OvBbuI1Hlc/BAOwi/9aAxZbiDNld72ANquwTBecKh4j3xYaHPHak+CGttrjfOAUxTb4vnvdj+2/0X6Ht2Jf9p2MzmFRyEtpA9UAweATIrFKtEgx8yzFWWc/B9GZbPqZaP5yc8LAFb2YNuSCQfO8RacU4gUa1Wx3YBj3r/RDfjorjDcLvwiJo4GzvtRZyKMrYcQfyiF0b3k99hOOk3W8pxGnaLf2WRxmintb+xgfg==;
 5:e3KBbm9H601uxDpKJig0bkqt5m2qixiIEVW8fq2EYrtvPmthMI+UaXA5lKBjJAlEkobaoNF9656Og7ZQ4w+o8TFn2PVX7ANUs/0bV3XqL5fQBOZegyCdvqbivCkC2RrDOR0njhKKiyydfONRewrlIHGpJUWwkRp6OhaojaduX58=;
 7:bOFY/9dVdlQGH1YVJE6AgGIDwtEszh9deym0i0677Oz9YQ3STKb3KMTiPbHSK6UmOheV2h1gfOu9wk1aJuYA3EOGrSpS4ipIRNHpUlqOKaYkb6Y4FujFHWo6PPVn29257FUzB0GLkOsva7s7O9/o2KCjvFXqQ17Kgow7SH67DGDuTl5OIB2mcHZ/BbvIx5vEqX+PPcXsXouvjd4yHl+o3GOB5abk+ZytJne/x8aJdOVNqY9EOXiReIlpXgNIH3hE
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-correlation-id: 643a9ddc-b4d8-4698-843d-08d616e722a0
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(7020095)(4652040)(8989137)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);
 SRVR:VI1PR08MB0464; 
x-ms-traffictypediagnostic: VI1PR08MB0464:
x-microsoft-antispam-prvs: <VI1PR08MB04641BDDFDF8FCDE997E395F8F050@VI1PR08MB0464.eurprd08.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(103651359005742)(228905959029699);
x-ms-exchange-senderadcheck: 1
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
 RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699050);
 SRVR:VI1PR08MB0464; BCL:0; PCL:0; RULEID:; SRVR:VI1PR08MB0464; 
x-forefront-prvs: 07915F544A
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(136003)(376002)(39850400004)(396003)(346002)(366004)(199004)(40434004)(189003)(13464003)(68736007)(478600001)(14454004)(72206003)(5250100002)(486006)(476003)(4326008)(25786009)(2501003)(81166006)(6116002)(81156014)(102836004)(6506007)(53546011)(186003)(26005)(55236004)(11346002)(8936002)(6246003)(446003)(575784001)(86362001)(2900100001)(97736004)(3846002)(106356001)(256004)(105586002)(74316002)(305945005)(7736002)(5660300001)(66066001)(110136005)(14444005)(7696005)(76176011)(53936002)(55016002)(2906002)(316002)(54906003)(99286004)(9686003)(5024004)(33656002)(229853002)(6436002);
 DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB0464;
 H:VI1PR08MB3167.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; A:1; MX:1; 
received-spf: None (protection.outlook.com: arm.com does not designate
 permitted sender hosts)
x-microsoft-antispam-message-info: BUgEGlPIcMsf3kbypEaifhbmWu6Qd6qTzqmWjbeoLcnwaIl9zKZcF+BpKlbRxfXA+xEZksgqKgF9pSAJjNJuIazAniJ234a0xSvJj2fZeTPK/szA4NU68oI6gqEPibxsD7iZuvRUkCoxJ9zhzqLyfLp3hhCZhh72A97Wt9l87HkIzRtXYZPPiIqawRh7NYAxY6mBiM2FWAFRYVLq497rpTcE2Ou35GHVvsIzjHzW/SOtbCmicXbwop5Oc1cD8eqyybukd747k9XOXFE6uGu6/w437D52zSAq1YAJiEC5zgsMVTmwvbhU867OE7+oyNBqZDVaWrm6n+jSifDUnTDuLOlB87brlbONTqPUQSgBZew=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 643a9ddc-b4d8-4698-843d-08d616e722a0
X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Sep 2018 06:32:09.2224 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB0464
Subject: Re: [dpdk-dev] [PATCH v5 06/11] net/virtio-user: add option to
	use	packed queues
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
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>
X-List-Received-Date: Mon, 10 Sep 2018 06:32:11 -0000



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Jens Freimann
> Sent: Friday, September 7, 2018 2:20 AM
> To: dev@dpdk.org
> Cc: tiwei.bie@intel.com; maxime.coquelin@redhat.com
> Subject: [dpdk-dev] [PATCH v5 06/11] net/virtio-user: add option to use
> packed queues
>
> From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>
> Add option to enable packed queue support for virtio-user devices.
>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
>  drivers/net/virtio/virtio_user/virtio_user_dev.c | 10 ++++++++--
> drivers/net/virtio/virtio_user/virtio_user_dev.h |  2 +-
>  drivers/net/virtio/virtio_user_ethdev.c          | 14 +++++++++++++-
>  3 files changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index 7df600b02..9979bea0d 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> @@ -372,12 +372,13 @@ virtio_user_dev_setup(struct virtio_user_dev *dev)
>   1ULL << VIRTIO_NET_F_GUEST_TSO4|\
>   1ULL << VIRTIO_NET_F_GUEST_TSO6|\
>   1ULL << VIRTIO_F_IN_ORDER|\
> - 1ULL << VIRTIO_F_VERSION_1)
> + 1ULL << VIRTIO_F_VERSION_1|\
> + 1ULL << VIRTIO_F_RING_PACKED)
>
>  int
>  virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues=
,
>       int cq, int queue_size, const char *mac, char **ifname,
> -     int mrg_rxbuf, int in_order)
> +     int mrg_rxbuf, int in_order, int packed_vq)
>  {
>  pthread_mutex_init(&dev->mutex, NULL);
>  snprintf(dev->path, PATH_MAX, "%s", path); @@ -432,6 +433,11
> @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int
> queues,
>  dev->unsupported_features |=3D (1ull <<
> VIRTIO_F_IN_ORDER);
>  }
>
> +if (packed_vq)
> +dev->device_features |=3D (1ull << VIRTIO_F_RING_PACKED);
> +else
> +dev->device_features &=3D ~(1ull <<
> VIRTIO_F_RING_PACKED);
> +

unsupported_features should be initialized also like following F_MAC.

>  if (dev->mac_specified) {
>  dev->device_features |=3D (1ull << VIRTIO_NET_F_MAC);
>  } else {
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h
> b/drivers/net/virtio/virtio_user/virtio_user_dev.h
> index d6e0e137b..7f46ba1d9 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h
> @@ -49,7 +49,7 @@ int virtio_user_start_device(struct virtio_user_dev
> *dev);  int virtio_user_stop_device(struct virtio_user_dev *dev);  int
> virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
>   int cq, int queue_size, const char *mac, char
> **ifname,
> - int mrg_rxbuf, int in_order);
> + int mrg_rxbuf, int in_order, int packed_vq);
>  void virtio_user_dev_uninit(struct virtio_user_dev *dev);  void
> virtio_user_handle_cq(struct virtio_user_dev *dev, uint16_t queue_idx);
> uint8_t virtio_user_handle_mq(struct virtio_user_dev *dev, uint16_t
> q_pairs); diff --git a/drivers/net/virtio/virtio_user_ethdev.c
> b/drivers/net/virtio/virtio_user_ethdev.c
> index 525d16cab..72ac86186 100644
> --- a/drivers/net/virtio/virtio_user_ethdev.c
> +++ b/drivers/net/virtio/virtio_user_ethdev.c
> @@ -364,6 +364,8 @@ static const char *valid_args[] =3D {
>  VIRTIO_USER_ARG_MRG_RXBUF,
>  #define VIRTIO_USER_ARG_IN_ORDER       "in_order"
>  VIRTIO_USER_ARG_IN_ORDER,
> +#define VIRTIO_USER_ARG_PACKED_VQ "packed_vq"
> +VIRTIO_USER_ARG_PACKED_VQ,
>  NULL
>  };
>
> @@ -473,6 +475,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
>  char *ifname =3D NULL;
>  char *mac_addr =3D NULL;
>  int ret =3D -1;
> +uint64_t packed_vq =3D 0;
>
>  kvlist =3D rte_kvargs_parse(rte_vdev_device_args(dev), valid_args);
>  if (!kvlist) {
> @@ -556,6 +559,15 @@ virtio_user_pmd_probe(struct rte_vdev_device
> *dev)
>  cq =3D 1;
>  }
>
> +if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PACKED_VQ) =3D=3D 1) {
> +if (rte_kvargs_process(kvlist,
> VIRTIO_USER_ARG_PACKED_VQ,
> +       &get_integer_arg, &packed_vq) < 0) {
> +PMD_INIT_LOG(ERR, "error to parse %s",
> +     VIRTIO_USER_ARG_PACKED_VQ);
> +goto end;
> +}
> +}
> +
>  if (queues > 1 && cq =3D=3D 0) {
>  PMD_INIT_LOG(ERR, "multi-q requires ctrl-q");
>  goto end;
> @@ -603,7 +615,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
>  vu_dev->is_server =3D false;
>  if (virtio_user_dev_init(hw->virtio_user_dev, path, queues,
> cq,
>   queue_size, mac_addr, &ifname, mrg_rxbuf,
> - in_order) < 0) {
> + in_order, packed_vq) < 0) {
>  PMD_INIT_LOG(ERR, "virtio_user_dev_init fails");
>  virtio_user_eth_dev_free(eth_dev);
>  goto end;
> --
> 2.17.1

IMPORTANT NOTICE: The contents of this email and any attachments are confid=
ential and may also be privileged. If you are not the intended recipient, p=
lease notify the sender immediately and do not disclose the contents to any=
 other person, use it for any purpose, or store or copy the information in =
any medium. Thank you.