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 77130A0A0F; Sat, 8 May 2021 10:43:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F093940140; Sat, 8 May 2021 10:43:11 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 44F7C4013F for ; Sat, 8 May 2021 10:43:10 +0200 (CEST) IronPort-SDR: 7kQGWMBINl96E+w5Tku5WITHbID4DJR74CrVCizc69zlwH1yTqEf4W0aQn9TSWZCpeGiRUuAo5 4548SwMUtIRA== X-IronPort-AV: E=McAfee;i="6200,9189,9977"; a="198544896" X-IronPort-AV: E=Sophos;i="5.82,283,1613462400"; d="scan'208";a="198544896" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2021 01:43:09 -0700 IronPort-SDR: UHeQO/fTWfTBdI29pdrcm53b7+dAkzZL2BvXfwmGJsYnf75lCLrNqLKW8ucQFjGXsVduDsnHP9 UQrAaIWJv3DQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,283,1613462400"; d="scan'208";a="398049710" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga007.fm.intel.com with ESMTP; 08 May 2021 01:43:08 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Sat, 8 May 2021 01:43:08 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Sat, 8 May 2021 01:43:08 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.41) 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.2106.2; Sat, 8 May 2021 01:43:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UrGobQNnw4WbV5/Vi3gLvuA29pFmIPG+ao0hjZWsJG92zDMqOWS7YA21RH/8hm4MpURJjG6CKkp53DkoX9SLgaHKkmf2pC3fX/PZOUS0bSu+CLfLtRoa3/9JJ0BuWIk6/hr93ChBQ3aT/HHwauJlllZPt858izbb+RLLO4iDDb5b+fla0deXosHgKOtmN5PLWtDo3oPDDHvN1vy58Q76DxVbnBw5DMl9KvwuUczEXa4ilqtYzh4BiFJR11gNXZ6CaBvOXdPdrPt+A34CUyNGRREE+8SvZTLpHE5rI0CC2fQ/uf64tKSHeK82ZhnSAiPDaNvc2e3uKkFmiSSQOI/28g== 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=JW9ijDZi43mZChWgTBltqViM3VTrKCEZElJuvnUHU2k=; b=QegCbZ8cMOLslFZ6Mx2QCJnBHWYthLUJvjASGKPumvYzwOT351TSQG4CFB5tQ3h+yiJiKG4sDuFsGYZO86FfoZxJmgdGwTcROWHHOrGYH530/yTZKg994TcLWI6MCE8GUb3wDF6091818RtVeZNfGt1ZzRaoeVGS502JBYQ/NrouZ1r+qS6nUX1IDP+2C++94YUfUKc8F3+ZR1DlzIloo6s5mj8fr4UKw2PRr4RH/On8Z/fGZFlT9XPjZUR9v5zUYQnTH3dJcl4ZlyqQ1DbIJT8o1At46/Kw3v9enlE6DfelBUedcvbPFeQz2pl194GJr3/UfxV0/5L+H5Qp33oWrw== 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=JW9ijDZi43mZChWgTBltqViM3VTrKCEZElJuvnUHU2k=; b=WQlt5QuC6y+MQRYPpHeavjRcQ81pjICIgAxaYopL90N52D9a5P0ZEpUBRZAXE1oRMWvrJIbBCQ8TE0wu21dTdV+OxccQ6gtfma9dyHZThHnFWYLMWtAgfEbAYaryqm8NxFNEuxgQoSWSsnV/VcwfSOnRTGULwhqyLOiPK3AWPs8= Received: from CO1PR11MB5073.namprd11.prod.outlook.com (2603:10b6:303:92::23) by MWHPR11MB1422.namprd11.prod.outlook.com (2603:10b6:300:25::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Sat, 8 May 2021 08:43:05 +0000 Received: from CO1PR11MB5073.namprd11.prod.outlook.com ([fe80::5d32:3b99:d0a:df54]) by CO1PR11MB5073.namprd11.prod.outlook.com ([fe80::5d32:3b99:d0a:df54%5]) with mapi id 15.20.4108.031; Sat, 8 May 2021 08:43:05 +0000 From: "Ling, WeiX" To: Balazs Nemeth , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3] vhost: read last used index once Thread-Index: AQHXK5RQiD6RCMlib0GRZUVWVD4CnqrZdK5Q Date: Sat, 8 May 2021 08:43:05 +0000 Message-ID: References: <8b9b42cf2b18feb41c4b64a174ccc154847c59f9.1617789063.git.bnemeth@redhat.com> <8b9b42cf2b18feb41c4b64a174ccc154847c59f9.1617789236.git.bnemeth@redhat.com> In-Reply-To: <8b9b42cf2b18feb41c4b64a174ccc154847c59f9.1617789236.git.bnemeth@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.51] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 03ddb920-fcae-4a00-91b2-08d911fd4c3c x-ms-traffictypediagnostic: MWHPR11MB1422: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LXUCUQnXj9oQqdjvnTXKHXRtj+WBxDa0nu190UFhoHMg1QLfjMX8CESPVx0CBDk+8HxxNfKnfsxezzydI/VwoyVPW5v1hr+nVhKMGxkN1cuOVWk2rcyI0Sh0zhkc59eg7kDKM8LQbtrms+q4fk1sUuIlTpJFYON+BXhKd1jI6tQODrR1Gf/g+c6wvkq3wGc8jqr2bLz2J0xvqNQ5t3CSNgmYupqNI2etF1pBf5t/TcC9TT5y7erwcYTsJRXZON9IUnZW+LdPKdnlw5wZnKu5+1nq85C/KbrZfNO1Kd5hQYMvYdFcsahbkFS0LWK0lvo2cHndKWOIDUEH05olihviOpuvYByWQyarihdNCJMlBOS+Ddp20kEQ8viE0IaF8ojXwPYbEa2dzPNmmWEIiZdxta+awx7G5HKORsQC6FOO2kug6UZhxlIBdhCaRrRpPMf7eDl9X6aVX/GSPfLV5Xjo3WQWSio+6eM8tKDffWCpCsejiT5BAlwHnS5BVU80uQ31T02Jp9xbHoW4+2sEW0D9ZI2xiAWzOhiHFXez1w7I2XT3E/PklwH+DwnbjcrxN1zdCJCGLl3VTtYMZh6/KNK/hS+H2BoPh6beFcVFYeBv3zd7Rqaol4keQhPNseb+ST7AE96EoPQErriQUw9pMDFtFjhShRiexFmdDKyvR5voEb/BFRmwWjHUViZN9lWa/iIC x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO1PR11MB5073.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(376002)(136003)(396003)(39860400002)(366004)(26005)(53546011)(966005)(9686003)(38100700002)(6506007)(55016002)(52536014)(122000001)(7696005)(71200400001)(33656002)(316002)(478600001)(110136005)(2906002)(8936002)(83380400001)(76116006)(86362001)(66946007)(8676002)(66476007)(66556008)(64756008)(66446008)(5660300002)(186003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?TFZKLQjVSXYJEEAvHFJ7KV/oA8egYUDKzrTQUFowYn3U2VXDUIOHQr8pPFq+?= =?us-ascii?Q?lnX6jSe3IjNewSnebe6F31nRscL2EuQYw2Eg7tJbw18r7jmgyJuhbtbhpFJq?= =?us-ascii?Q?ntc8mKRORnmPoSoTGTv7gkp86KkrbLOQ+R+kHnHWUcTPifXEZ8Ejr2jblWGF?= =?us-ascii?Q?OAlZ14vEOjW2Oo8zwoMs1RpGs65Oqt+yJ9BiLarl9e3xJkKRYIOdkWtHZNei?= =?us-ascii?Q?swQiLZhEBkHsKRQoty5xYqk0IC1EqZXQk678s73L9ZZrRw+nCpeIZFHRrV/3?= =?us-ascii?Q?xy2Y/NiQ4zJWN82a81+wXrrz8OCOkfkIJof7Xjfpp0W/2eRykH+ZuLWcJyis?= =?us-ascii?Q?iaMwv7+bDTkaQZzpa1NoyjTxZb0bUl1EN+DrCnuMKzz7O25MFT0vb7UhVw15?= =?us-ascii?Q?rHiXCyH2lKrpJcbO5PF8AsauYiqKreaBR/nF1BSpXcat7A3aeroF/3SLCTDg?= =?us-ascii?Q?RoFtb8SS8PbEYqTg+A7q+vpRukyv5ykDgn572EpUwJMDNOYPdC6kkMRaTbAd?= =?us-ascii?Q?QLptOJzhko/gx6Fuf53SDaAtxTmG7g10CP8BfSy+6h5hyH2ywmrw+xdq/5Vn?= =?us-ascii?Q?q4Ufh7V711aBDSGgW+Ohl4uYGVFjX2fMxPHNzUWM/lDocj4Q2iBemgrVuxAF?= =?us-ascii?Q?GGL4ngv7MHlW0k5LiiPiIplHWP5J+plHRzTKE5rV/vHydtFtj3ozvlG5yltC?= =?us-ascii?Q?zKv7P+uJbmAg/QX763k+T9urxCV3WqQAD0NpT2yylY3dHXEeiZ0BixB29owS?= =?us-ascii?Q?mRLqVddz2FaDuelb9rtZfW6ePPgODU30FpfTw8zdEK65LoLA6wDdMtGjdnsH?= =?us-ascii?Q?zXTkGps2X/ewtKxJeShsZ0wnHvLypYJDRi/6mOPmGB2nmQDWk6/81IAWLmAu?= =?us-ascii?Q?7NJc1tb4dsAowIKamGN4CsTVm/K4MWUSA3wHWuCKk5badKCHeNWdKtY60m0R?= =?us-ascii?Q?ZzUeC/oApSrB320aX45gmxw1E/34JKvHrrAe0cxXNSZcIAKY00WLA7YU7rJK?= =?us-ascii?Q?ZFkOpiW+HKJk+B9ORWWOSDmGsvG0vOfqXpuW3TovQOXGVvYsoas6J5S+TfkR?= =?us-ascii?Q?mptvEuwsCSGdzWqHDV9qYA8bMWwxhs5qh6XWAms82zZMpsVfCAeYSl88yzkg?= =?us-ascii?Q?zasqgH7/a1glwMeUNJXLcU87p/yFY57hKexKl81/OtWSn8Y7ttoG1uAU8rED?= =?us-ascii?Q?gynNeDPeRfEgMmi4Jixsg0tKVOpuMwtQqhMONedwzKYMkw5F/SSq5GZ8WTxM?= =?us-ascii?Q?PxXP8/yIsINeBf6orIHWBjm+ahIy3zuj6gQWiA1li2EBV3IMgSUIqyUwFacn?= =?us-ascii?Q?D39vUsCdlBL7iT0Ai5hHCO9E?= x-ms-exchange-transport-forked: True 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: CO1PR11MB5073.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03ddb920-fcae-4a00-91b2-08d911fd4c3c X-MS-Exchange-CrossTenant-originalarrivaltime: 08 May 2021 08:43:05.1618 (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: fUIZoKzdf91EkgnLJFF6Q2dslE+PeiSM+RnOjFSqjwjLvNn3221Ul7mYxd3NLSV8mEVJsT5OYmxUxKj9ry8fug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1422 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3] vhost: read last used index once 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 Sender: "dev" Hi Balazs Nemeth, Your patch cause a bug about virtio-user can't recieve packets when use pac= ked ring and ring size is 255. Please have a look about it. https://bugs.dpdk.org/show_bug.cgi?id=3D699 Thanks. Regards, Ling Wei > -----Original Message----- > From: dev On Behalf Of Balazs Nemeth > Sent: Wednesday, April 7, 2021 05:55 PM > To: bnemeth@redhat.com; dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3] vhost: read last used index once >=20 > Instead of calculating the address of a packed descriptor based on the > vq->desc_packed and vq->last_used_idx every time, store that base > address in desc_base. On arm, this saves 176 bytes in code size of functi= on in > which vhost_flush_enqueue_batch_packed gets inlined. >=20 > Signed-off-by: Balazs Nemeth > --- > lib/librte_vhost/virtio_net.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) >=20 > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.= c index > 179c57b46..f091384a6 100644 > --- a/lib/librte_vhost/virtio_net.c > +++ b/lib/librte_vhost/virtio_net.c > @@ -217,6 +217,8 @@ vhost_flush_enqueue_batch_packed(struct > virtio_net *dev, { > uint16_t i; > uint16_t flags; > + uint16_t last_used_idx =3D vq->last_used_idx; > + struct vring_packed_desc *desc_base =3D &vq- > >desc_packed[last_used_idx]; >=20 > if (vq->shadow_used_idx) { > do_data_copy_enqueue(dev, vq); > @@ -226,16 +228,17 @@ vhost_flush_enqueue_batch_packed(struct > virtio_net *dev, > flags =3D PACKED_DESC_ENQUEUE_USED_FLAG(vq- > >used_wrap_counter); >=20 > vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { > - vq->desc_packed[vq->last_used_idx + i].id =3D ids[i]; > - vq->desc_packed[vq->last_used_idx + i].len =3D lens[i]; > + desc_base[i].id =3D ids[i]; > + desc_base[i].len =3D lens[i]; > } >=20 > rte_atomic_thread_fence(__ATOMIC_RELEASE); >=20 > - vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) > - vq->desc_packed[vq->last_used_idx + i].flags =3D flags; > + vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { > + desc_base[i].flags =3D flags; > + } >=20 > - vhost_log_cache_used_vring(dev, vq, vq->last_used_idx * > + vhost_log_cache_used_vring(dev, vq, last_used_idx * > sizeof(struct vring_packed_desc), > sizeof(struct vring_packed_desc) * > PACKED_BATCH_SIZE); > -- > 2.30.2