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 CEA13A00C5; Sun, 5 Jul 2020 15:53:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DFCD81DC61; Sun, 5 Jul 2020 15:53:22 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 9BAF31DB8B for ; Sun, 5 Jul 2020 15:53:20 +0200 (CEST) IronPort-SDR: Forgt5pXnbVPwTBLQhLGabfUiUaXiupiIcQuJCfEfMF8Prz0ytacqDFVbAHnCH8kwEVaaKc3S8 KbQ/3xxabL2w== X-IronPort-AV: E=McAfee;i="6000,8403,9672"; a="134767695" X-IronPort-AV: E=Sophos;i="5.75,316,1589266800"; d="scan'208";a="134767695" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2020 06:53:19 -0700 IronPort-SDR: oYSTBtrAUirOAmqbbcbl5qH1xXfHFdPdOeTOmz93heRFoooYY4J+PLXXKpTuks8vuer0jA7NnY hNEcyVNc6e2Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,316,1589266800"; d="scan'208";a="456408958" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 05 Jul 2020 06:53:19 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 5 Jul 2020 06:53:18 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 5 Jul 2020 06:53:18 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 5 Jul 2020 06:53:18 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 5 Jul 2020 06:53:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C0RqnhEM51WW9bNCzlmnZOl5JDh+c1y2/HFcGJS33oCsU/nl3TK1J3Fc6lPgtPHk4f2SKwMR1fDLF+BkBYYQNmOxHjT0DR9HFqxgGwyqcmWimiCIgN16qkeDtU0QT3wRRwx48hAAvaNq2LLJ1DbJ/6ztp3/L5t7mxJJDMkQcHHyzPMhwHG9O/y5gE2uG17ONo+Aew00p7ZaazeHMPx0b8oxcHNeZdBahnyXupcX4KJffkjhqJeyQg1SnKq5mINEKp4Wg6SDES4Glc4blSXbZAdAQLVDSuxIcy6r6z3rPg03lpwBYxUp3eGG8pWnJQBQs9yMNovTkckvHdBmQZQx4uw== 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=WKw0Kae7dcGttFzRzj2PcWjoIPQipHK7jwnc4li0/Os=; b=NIxr9UBxXb0DCS6UmVmF1QG7Qz1PV6TAMc7w91zXgud6H9+7/84IKAj11W5ha74DZxzv34+s9FqRhMJKPadeuMp5F7/qLN3UALTIXAcd1FfyIpSLd1TMZbjRwP0nf6AF7jCmaLwUXbGZMjg0npIWp38CQs+dPArExApH3xawEF89CU+Hvn6KkwpoAz9JAe91blRsIuOrjQM+hbdf08SKsO9hF43rgcDHalLJqavgP3MJTQYZeYukwebYFK+owa/Ul5TQBWgSgc39vKN8qR80za8Vo6YWLTkuFHKxetzKZEi1hTLnXNixxako9rt/5+lXCSYS44kRSTnyqBmYPc9BWg== 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=WKw0Kae7dcGttFzRzj2PcWjoIPQipHK7jwnc4li0/Os=; b=njLjcttH32wdJEZdTCyjSqRVjtBAOzkpx7talGk24vS+r1vqApMfi6TFCp+dHRUnfEoliZVSHMZnfmAFjzOJKIteK+jABOkKoXwhPNPf7GIV5cyomzQSXaJM2Jeb8ZXfP/1F4I9Dz9lfZt2QO+vz55vUE8PysXfQ0yRvkIOijDM= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB3614.namprd11.prod.outlook.com (2603:10b6:208:ea::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Sun, 5 Jul 2020 13:53:10 +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; Sun, 5 Jul 2020 13:53:10 +0000 From: "Xia, Chenbo" To: Adrian Moreno , "dev@dpdk.org" CC: "Wang, Zhihong" , "Wang, Xiao W" , "Yigit, Ferruh" , "maxime.coquelin@redhat.com" Thread-Topic: [PATCH v4 2/2] net/virtio: add reply-ack support to Virtio-user Thread-Index: AQHWUVK+HWFl8BUIxkWASFetgunOhqj5BIDA Date: Sun, 5 Jul 2020 13:53:10 +0000 Message-ID: References: <20200703155727.1320821-1-amorenoz@redhat.com> <20200703155727.1320821-3-amorenoz@redhat.com> In-Reply-To: <20200703155727.1320821-3-amorenoz@redhat.com> Accept-Language: zh-CN, 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.2.0.6 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.195] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5398e2d0-7d6e-4dec-b92b-08d820eac135 x-ms-traffictypediagnostic: MN2PR11MB3614: 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:6790; x-forefront-prvs: 045584D28C x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Bk2cDax8lHdmQTgQMYeQhM8K2JCuW20pe+qaPkYU2zuYQEAUA8WW0lfueisQkoKAYrYD9rPp8JPGFF15Bj2ApNw0V1DvQE8+0nXT5w7UiSdooCW9saUGE0Xn6e3s5ocLWBMErdlx77wXlGR14Fyux1sWEj/YNAORYEgwKpltfJO8ai1jR4juKnGrk4vYKRU46jP4nlkIuISVgXp1E1RHlW84x/eBcuk3+6amR9UKMj3KwN9sYsU5OOkkvyS3Lz8iAp4NvFr/OOeakoa+6pTJCkKwMP5chcfJZiED39S5W+hHvSiZKnUddP5Tj24GM5iUzrj7iRMqx3PrNeZynW86Dg== 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)(346002)(366004)(396003)(39860400002)(136003)(52536014)(66946007)(66476007)(64756008)(66446008)(55016002)(66556008)(86362001)(478600001)(4326008)(110136005)(2906002)(186003)(5660300002)(8676002)(26005)(6506007)(33656002)(316002)(54906003)(8936002)(9686003)(83380400001)(53546011)(76116006)(71200400001)(7696005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: qIYGnqjK2o6CJf8CX8Lxw7AhTfLG5r1x00Ah9xJLFJ5M922ykKGilXsVhlo0bH6K6t7wrwhOn170FXKli01qZC/ldeEnMCaLvLNBz/neQKAuwxv7Y1Ni4sK+JhvDV5akOvI6muFl+aH8ukpWUnIG7JFs/a+GlCExeRQq5/pOYgf5eHVpAxxmAj+kr636mg0LT+j9J6osWWl+lPt9IMnMnGPEEDS426p66VoR+xbsO4n75tZ9Vr6vB0954mPKIIV+t4X699hlL/CcxoDuiGYVMDWnPZCOQBIlQNuLc6uTjSvg1qB5J/0Pgm92dmf6tnqS/ceKYL515sR2QuY5NGWl7JR5NVmRTK59/K5zOGJ89SCH+eUvpdUi3WSOZcdYOrPVKB8hocQi/QqmGuhn4NtIBlkRUqMYFi+pMYY7P3BnSpU/A+UQZRgJVHIqHfohlqxHqoyB2igOx6x5BONbuWr3LO/NQDbVzNLI2Zp9yBc31jut8SsUd5ZXBptrYdbpJ7eK 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: 5398e2d0-7d6e-4dec-b92b-08d820eac135 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2020 13:53:10.8075 (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: IVK6ufAx73m4zxTzuBsHNroFjSv2NJwtaPxFJ2CtPp604yorGzgT2EyjWrk9SScPpHTtbkVvCbKPGUkhbT1wrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3614 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v4 2/2] net/virtio: add reply-ack support to Virtio-user 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: Friday, July 3, 2020 11:57 PM > To: dev@dpdk.org > Cc: Xia, Chenbo ; Wang, Zhihong > ; Wang, Xiao W ; Yigit, > Ferruh ; maxime.coquelin@redhat.com > Subject: [PATCH v4 2/2] net/virtio: add reply-ack support to Virtio-user >=20 > From: Maxime Coquelin >=20 > This patch adds support reply-ack vhost-user protocol feature, which is f= or now > only used to ensure VHOST_USER_SET_MEM_TABLE requests are handled by the > slave, but later will be used for VHOST_USER_SET_STATUS. >=20 > Signed-off-by: Maxime Coquelin > --- > drivers/net/virtio/virtio_user/vhost.h | 6 ++++- > drivers/net/virtio/virtio_user/vhost_user.c | 24 ++++++++++++++++--- > .../net/virtio/virtio_user/virtio_user_dev.c | 3 ++- > 3 files changed, 28 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_user/vhost.h > b/drivers/net/virtio/virtio_user/vhost.h > index 9ace1a90c..260e1c308 100644 > --- a/drivers/net/virtio/virtio_user/vhost.h > +++ b/drivers/net/virtio/virtio_user/vhost.h > @@ -50,7 +50,11 @@ struct vhost_vring_addr { >=20 > /** Protocol features. */ > #ifndef VHOST_USER_PROTOCOL_F_MQ > -#define VHOST_USER_PROTOCOL_F_MQ 0 > +#define VHOST_USER_PROTOCOL_F_MQ 0 > +#endif > + > +#ifndef VHOST_USER_PROTOCOL_F_REPLY_ACK #define > +VHOST_USER_PROTOCOL_F_REPLY_ACK 3 > #endif >=20 > enum vhost_user_request { > diff --git a/drivers/net/virtio/virtio_user/vhost_user.c > b/drivers/net/virtio/virtio_user/vhost_user.c > index e33067561..631d0e353 100644 > --- a/drivers/net/virtio/virtio_user/vhost_user.c > +++ b/drivers/net/virtio/virtio_user/vhost_user.c > @@ -32,6 +32,7 @@ struct vhost_user_msg { >=20 > #define VHOST_USER_VERSION_MASK 0x3 > #define VHOST_USER_REPLY_MASK (0x1 << 2) > +#define VHOST_USER_NEED_REPLY_MASK (0x1 << 3) > uint32_t flags; > uint32_t size; /* the following payload size */ > union { > @@ -253,6 +254,7 @@ vhost_user_sock(struct virtio_user_dev *dev, > struct vhost_user_msg msg; > struct vhost_vring_file *file =3D 0; > int need_reply =3D 0; > + int has_reply_ack; > int fds[VHOST_MEMORY_MAX_NREGIONS]; > int fd_num =3D 0; > int len; > @@ -265,6 +267,9 @@ vhost_user_sock(struct virtio_user_dev *dev, > if (dev->is_server && vhostfd < 0) > return -1; >=20 > + if (dev->protocol_features & (1ULL << > VHOST_USER_PROTOCOL_F_REPLY_ACK)) > + has_reply_ack =3D 1; > + > msg.request =3D req; > msg.flags =3D VHOST_USER_VERSION; > msg.size =3D 0; > @@ -293,6 +298,9 @@ vhost_user_sock(struct virtio_user_dev *dev, > msg.size =3D sizeof(m.payload.memory.nregions); > msg.size +=3D sizeof(m.payload.memory.padding); > msg.size +=3D fd_num * sizeof(struct vhost_memory_region); > + > + if (has_reply_ack) > + msg.flags |=3D VHOST_USER_NEED_REPLY_MASK; > break; >=20 > case VHOST_USER_SET_LOG_FD: > @@ -341,7 +349,7 @@ vhost_user_sock(struct virtio_user_dev *dev, > return -1; > } >=20 > - if (need_reply) { > + if (need_reply || msg.flags & VHOST_USER_NEED_REPLY_MASK) { > if (vhost_user_read(vhostfd, &msg) < 0) { > PMD_DRV_LOG(ERR, "Received msg failed: %s", > strerror(errno)); > @@ -371,8 +379,18 @@ vhost_user_sock(struct virtio_user_dev *dev, > sizeof(struct vhost_vring_state)); > break; > default: > - PMD_DRV_LOG(ERR, "Received unexpected msg type"); > - return -1; > + /* Reply-ack handling */ > + if (msg.size !=3D sizeof(m.payload.u64)) { > + PMD_DRV_LOG(ERR, "Received bad msg size"); > + return -1; > + } > + > + if (msg.payload.u64 !=3D 0) { > + PMD_DRV_LOG(ERR, "Slave replied NACK"); > + return -1; > + } > + > + break; > } > } >=20 > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c > b/drivers/net/virtio/virtio_user/virtio_user_dev.c > index 105536d35..0a6991bcc 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -423,7 +423,8 @@ virtio_user_dev_setup(struct virtio_user_dev *dev) > 1ULL << VHOST_USER_F_PROTOCOL_FEATURES) >=20 > #define VIRTIO_USER_SUPPORTED_PROTOCOL_FEATURES \ > - (1ULL << VHOST_USER_PROTOCOL_F_MQ) > + (1ULL << VHOST_USER_PROTOCOL_F_MQ | \ > + 1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK) >=20 > int > virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues= , > -- > 2.26.2 Reviewed-by: Chenbo Xia