From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D27BA00BE; Tue, 7 Jul 2020 05:21:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 134DD1DD3B; Tue, 7 Jul 2020 05:21:38 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id C7D1A1DD37 for ; Tue, 7 Jul 2020 05:21:35 +0200 (CEST) IronPort-SDR: nztDGJlULrxFWQMGUMZwI/wHNFQYxK4iMSHR+nS81vlwXQQ8ZD3GJugC77FnQuh9Iqxn995JRU KgzS6CvpSaFw== X-IronPort-AV: E=McAfee;i="6000,8403,9674"; a="212505342" X-IronPort-AV: E=Sophos;i="5.75,321,1589266800"; d="scan'208";a="212505342" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2020 20:21:34 -0700 IronPort-SDR: D4gwnpbzZIUA8xSoJwbFI/85el9gTEpcodBvyQM8jMD4EoOCwd9Gv0y7PUPpBZ24T8zaEmmZHK 7p9qgt7+/kFg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,321,1589266800"; d="scan'208";a="322543549" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by FMSMGA003.fm.intel.com with ESMTP; 06 Jul 2020 20:21:34 -0700 Received: from orsmsx153.amr.corp.intel.com (10.22.226.247) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 6 Jul 2020 20:21:34 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by ORSMSX153.amr.corp.intel.com (10.22.226.247) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 6 Jul 2020 20:21:33 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 6 Jul 2020 20:21:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TjDAz6SSEbiDGCSYVm21PsSEpbIhcpgE7rG+OJfvbGqrlP2qh+AHQi3BbAO+EOA9jyJwjj6B0dTrYiWy6+ZVwIJj+uFQqA7tUSqH30gqdsayuk0vvHQ5GwAQXT2C8l4D+0/nym2RXaaPPXajb3iDbhrYzZPCNXYqMv92a/g5ou9iMPB49spcinWNxancx247pN9qmbncZTr9GPg4Lb5wKld2k94/9Uev8lQS1wbcEcdWIHk3Rg2eCeWd+k0getZUSkeiBmgwSxOftZu3gplAPSlfFQl5nlz402KE3xt98rfEXRaBsp17XGDnpKJzirJP9R9hOS5ecSLmIeXbyHeD9A== 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=CA2Py8DQKB6nIh66CLMYnaYVt/c08m+wLeNeKmy1yAk=; b=PSd+2ma/pgcJH4vBcY3G3oxiHIxnLUIpDnjVV48VV5Xok+uC1gPtfQNRfw7KYCy1Z8vPMTC/jIOMebM791R3y3yskkGOndjJHzwQ4g1OOeTPQa1ALDM3ge6V9G71XjED7rlzmmSMs85MEGN0nyWEJobGop+4leCAATjEfah4MzXPdM3LTlpJu3TN00wY2KhzwvaCHk6Aru7k5iarZMvwU5iM1uURxPINuxA/Chi+iWIoCE9pfgVwqCcQeVqWZXG8/fndmzA5veP7XGR+0nUe2IdWRaMRkQrmD6IPSyZ9w0hvhx0H38EDlg9ZX72AYJRgxeXqkPLXCoPOkIcjiS9UfQ== 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=CA2Py8DQKB6nIh66CLMYnaYVt/c08m+wLeNeKmy1yAk=; b=Ey8qpQ88dYy8YdUAjFPnShEp9DT2x1/KjvjpgVMBUCLoGSy8UTsdZ+usUar2MVt24o9JzKU9q072RwfgmFE+M3iSp0SMTWk3tCX75LaDj/jCD3m8yeIGCkg5fT2yVPNXNlAtQvoNnh+WQgXtvcxXgdqQFtRvtnVcai0p42Z7xK4= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB3709.namprd11.prod.outlook.com (2603:10b6:208:f3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21; Tue, 7 Jul 2020 03:21:32 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::7cde:8326:5010:c47e]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::7cde:8326:5010:c47e%7]) with mapi id 15.20.3153.029; Tue, 7 Jul 2020 03:21:32 +0000 From: "Xia, Chenbo" To: Adrian Moreno , "dev@dpdk.org" , "Ye, Xiaolong" , "shahafs@mellanox.com" , "matan@mellanox.com" , "maxime.coquelin@redhat.com" , "Wang, Xiao W" , "viacheslavo@mellanox.com" CC: "jasowang@redhat.com" , "lulu@redhat.com" Thread-Topic: [PATCH v3 2/8] vhost: refactor Virtio ready check Thread-Index: AQHWU4gvPNXL71jD2UOCHB0TUgkQH6j7dEow Date: Tue, 7 Jul 2020 03:21:32 +0000 Message-ID: References: <20200706112452.1474533-1-amorenoz@redhat.com> <20200706112452.1474533-3-amorenoz@redhat.com> In-Reply-To: <20200706112452.1474533-3-amorenoz@redhat.com> Accept-Language: zh-CN, 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.198.147.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3dd0a6b9-15b3-4c8b-b386-08d82224d910 x-ms-traffictypediagnostic: MN2PR11MB3709: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0457F11EAF x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UzBdiVxcTjTD+VqocyT1CT01qsnzkpWqjRPLXWbcKGD+LVV/VeHkPbgcYFN3ArJGDVfZbJV6c4qqy35Q9meNtbcpl0ZlUp8+TuNirqx+9ESv+1xY6OnSC5QQzn3ETxEO9YI+jpf8z+qtFPBnzsbB5rOyOb8etX8vnAEOJ/XfGFxDcOdGZYf0KVuJULLbBvGqbhkc3q8rJuTJYHiAaAdcbd3y+gM+ElIfi62NqQ7fy8YMVN7cfL0QLbC6kDbiMpBf5VYeCVD+Gi1uWkQ7BmbTbJ/E4aWCxxCME9DrcjN9BNV79hGFmHkrSjcwTmhHEgT/oHWBWrDOY+JmFPyARRBW1h7/ZmeFiE22HiauFKozZUoftJP8lHUhKE+QmHOweeOx x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB4063.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(366004)(346002)(39860400002)(136003)(396003)(83380400001)(8936002)(478600001)(4326008)(316002)(33656002)(110136005)(5660300002)(54906003)(52536014)(2906002)(9686003)(55016002)(8676002)(53546011)(7696005)(6506007)(76116006)(86362001)(66446008)(64756008)(66556008)(186003)(66476007)(71200400001)(26005)(66946007)(921003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: PnDwLBDmcSELmHy6iOoITt7hQ2w9S8a+wYnqFcq79Mmtr1snh3qF5ZK0ScBNCyNIXfbYX7FPs0l7oA7f8O67RGGXirJFdA0S/FUSyOVi+zXZw2ynvbVWRzAMGSM4hxxuHjOaWfOb8DVtJLUWxYHJo1Zks/Jrfbehop9onNo1IqwU3Ty0AgLFxw0jSxYakyqQfc2F+QjD2oJj/bBKJBSE1LF6SLLyES8xN/rIGdm9Mc9uQBJPCwTR8gyNlObxHKtyPy8A8u4C6QihSiSsiFqYmLj6diFt96/d9KLRIuC2vqHD7s8M0VtqICe1GuA9skOikHYlqtzfTTJL+o+WHpfvNwOr7QamyIIRKnDmhr1ZWNYgkF5nb1uVMHHhaTfBa0j5Mqa3d92hKhNfcFM9P/e34HpfhNcYMazLonMVFFQGhHhpOZSspTJlKcsiblCfqfwiwYeXg78iV7UWOwyXqsXM6pNMM7L1+5cYVbXRmpdiXmesxVcj3aVP/w5K3IGcq/um 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: MN2PR11MB4063.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3dd0a6b9-15b3-4c8b-b386-08d82224d910 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jul 2020 03:21:32.7173 (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: TfWukBO3s/QTimpdl3kQbpQYBKFjYkdtFS01VZm4KiRILuPPUfINk9ZePnA7p1RkW810gjg4Hi6j9HW6LAfGoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3709 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 2/8] vhost: refactor Virtio ready check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" > -----Original Message----- > From: Adrian Moreno > Sent: Monday, July 6, 2020 7:25 PM > To: dev@dpdk.org; Xia, Chenbo ; Ye, Xiaolong > ; shahafs@mellanox.com; matan@mellanox.com; > maxime.coquelin@redhat.com; Wang, Xiao W ; > viacheslavo@mellanox.com > Cc: jasowang@redhat.com; lulu@redhat.com > Subject: [PATCH v3 2/8] vhost: refactor Virtio ready check >=20 > From: Maxime Coquelin >=20 > This patch is a small refactoring, as preliminary work for adding support= to Virtio > status support. >=20 > No functionnal change here. >=20 > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/vhost.c | 1 + > lib/librte_vhost/vhost_user.c | 33 +++++++++++++++++++++------------ > 2 files changed, 22 insertions(+), 12 deletions(-) >=20 > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index > 0d822d6a3..aa1424261 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -710,6 +710,7 @@ vhost_enable_dequeue_zero_copy(int vid) > return; >=20 > dev->dequeue_zero_copy =3D 1; > + VHOST_LOG_CONFIG(INFO, "dequeue zero copy is enabled\n"); > } >=20 > void > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.= c index > 5750dde6d..ff8b1752b 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -1337,6 +1337,9 @@ virtio_is_ready(struct virtio_net *dev) > struct vhost_virtqueue *vq; > uint32_t i; >=20 > + if (dev->flags & VIRTIO_DEV_READY) > + return 1; > + > if (dev->nr_vring < VIRTIO_DEV_NUM_VQS_TO_BE_READY) > return 0; >=20 > @@ -1347,6 +1350,8 @@ virtio_is_ready(struct virtio_net *dev) > return 0; > } >=20 > + dev->flags |=3D VIRTIO_DEV_READY; > + > if (!(dev->flags & VIRTIO_DEV_RUNNING)) > VHOST_LOG_CONFIG(INFO, > "virtio is now ready for processing.\n"); @@ -2825,28 > +2830,32 @@ vhost_user_msg_handler(int vid, int fd) > } >=20 >=20 > - if (!(dev->flags & VIRTIO_DEV_READY) && virtio_is_ready(dev)) { > - dev->flags |=3D VIRTIO_DEV_READY; > + if (!virtio_is_ready(dev)) > + goto out; >=20 > - if (!(dev->flags & VIRTIO_DEV_RUNNING)) { > - if (dev->dequeue_zero_copy) { > - VHOST_LOG_CONFIG(INFO, > - "dequeue zero copy is > enabled\n"); > - } > + /* > + * Virtio is now ready. If not done already, it is time > + * to notify the application it can process the rings and > + * configure the vDPA device if present. > + */ >=20 > - if (dev->notify_ops->new_device(dev->vid) =3D=3D 0) > - dev->flags |=3D VIRTIO_DEV_RUNNING; > - } > + if (!(dev->flags & VIRTIO_DEV_RUNNING)) { > + if (dev->notify_ops->new_device(dev->vid) =3D=3D 0) > + dev->flags |=3D VIRTIO_DEV_RUNNING; > } >=20 > vdpa_dev =3D dev->vdpa_dev; > - if (vdpa_dev && virtio_is_ready(dev) && > - !(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) { > + if (!vdpa_dev) > + goto out; > + > + if (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) { > if (vdpa_dev->ops->dev_conf) > vdpa_dev->ops->dev_conf(dev->vid); > + > dev->flags |=3D VIRTIO_DEV_VDPA_CONFIGURED; > } >=20 > +out: > return 0; > } >=20 > -- > 2.26.2 Reviewed-by: Chenbo Xia