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 69551A0519; Fri, 3 Jul 2020 10:41:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 18CC61DA52; Fri, 3 Jul 2020 10:41:03 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 3DABF1DA52 for ; Fri, 3 Jul 2020 10:41:01 +0200 (CEST) IronPort-SDR: oPHIWMSVWe6XdPQWLcGD6aBXjyaxAUlh5772OP1DYbYkTZcfBWMPqu0fdNK1dFKq7osjQzm2El Q7sF3MaMhQYg== X-IronPort-AV: E=McAfee;i="6000,8403,9670"; a="231979327" X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="231979327" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2020 01:41:00 -0700 IronPort-SDR: YiP0mjV+ZYZCiy84gY78X3QUBwvRWaB6v0lJBRAB8x5BpdsgjvC8Nhz5kZwMJ9y0R0oPkYEeuW /2W5P/ZQU7Yw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="278374339" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 03 Jul 2020 01:40:59 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Jul 2020 01:40:59 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 3 Jul 2020 01:40:59 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Fri, 3 Jul 2020 01:40:59 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.109) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Jul 2020 01:40:57 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZIJKheqipNWkXRgbCcdtYz9S0O+PlB0vfZ/IagYl/zmVoZOtrcqgoA4xDB2IBJ0oBMo5XiopwogV4FWae1q0SStTvh0wwU5oublwtkEf1VR/PaiiVofX4LGHfZqWhTiS33UQoQCvrXK9mTsrWWfj99ZaSA1DjpYTE4W8iONtnvRAj2FRJV+BwTHo6znOjPK+pzywVqm9Ti3EOVT7fwHn4CdLZTluT6uRUeziIh+KfDrpHYTEBkKH/o6gp9kmDZl2S2sFM0ROKasf6lxuHgc3iDGelO3HG2KgFDdW57lk2NYV8YpsdKNeffmM5sJ7T3x4VW9iokRbCvtItpo+8ikjFQ== 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=Lx+Q/GT4H9OGWBWx4NAfG4IUxbc0CJLJ7YagHfIk87E=; b=YZk1abbWBM8UnsUc/Rw9CC6Ir0kkV29Y0Px0yq1mz3E+kIDSGgDMht1k0pKZyXUtUiKymbwUq6gKAgfy2CN87jvtSKNIAITCvn3ojZR7B3ihfOYUxdAUNYjHqz/B69rpWaz1eAxLHwGqBSUqikUKzjQcafV6fQ9rhU0GBW3P4emKpmHCHPYL+4e/919LvhU6xNjcqCDDYWghrfyxYMvBZy6axmi099/AaVaaHC8yWHTXL3ZKpdh1GHQ+JCpHi0YWsFl85KPniNnRTrrpgKMc9G2sotkWvGmADqOpVKbzuAzlRyq+jRZibiPDoaKX8f8wgeqBBeWKu02hFdnyuYdrZg== 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=Lx+Q/GT4H9OGWBWx4NAfG4IUxbc0CJLJ7YagHfIk87E=; b=QEOh+1cHVL10S5YV9TP46c3ee+XK9FJP69DvBNTa6M8l4TVTICr4tL986iwoPMbtJo6e/GNS5OrvT8O1GYNo5jKfPb0yddup6MERB3z+dOrlS8EbVPaieOkbjLTeiIRqGkDZUFBfGiwkJdAloJeWvy00UKp9CQMrzEUwfbNmnaE= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB3982.namprd11.prod.outlook.com (2603:10b6:208:13b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.28; Fri, 3 Jul 2020 08:40:55 +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.028; Fri, 3 Jul 2020 08:40:55 +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 v3 1/2] net/virtio: add vhost-user protocol features support Thread-Index: AQHWUESRS7Lr+DMLQkqiKfgw87JY9aj1iABQ Date: Fri, 3 Jul 2020 08:40:54 +0000 Message-ID: References: <20200702074332.1211465-1-amorenoz@redhat.com> <20200702074332.1211465-2-amorenoz@redhat.com> In-Reply-To: <20200702074332.1211465-2-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: f2c05817-d783-4040-0da4-08d81f2ccd08 x-ms-traffictypediagnostic: MN2PR11MB3982: 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:7691; x-forefront-prvs: 045315E1EE x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dMoKjsMwWtyPj0FxCTBpX1nBv/tWwlX54zFd3mw6pgrIy3uJvacHxQ9q8Kbeet16r2e72D1KV/Kxab5NnX0nlOvFcnA8+PfsX/pFk1XZ2Lzy83WsSWCJkQh8bqfBysST0W805myXXCCCtvHyCWJFnnExen0M271HvC1KzZahMbPsXKSisUXd8gImJB8fV0RVcOBLYDfcH0t16EWXaCg33JNjGTxHfw7elQOl6ThA/O6kz0AA9fxEsJk3+5ruj4/IX5cpHxsNdRfCscgo5Lu3sT4M5nrMsFpzzwFJE5VC28K1ba21dTvn9Vn4ITl/wPNtLLsZ4a+tgOAMIE6r2xGrig== 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)(396003)(136003)(366004)(39860400002)(376002)(346002)(52536014)(186003)(76116006)(2906002)(54906003)(86362001)(33656002)(66476007)(5660300002)(110136005)(316002)(66946007)(478600001)(66446008)(64756008)(66556008)(7696005)(26005)(6506007)(8676002)(53546011)(8936002)(83380400001)(71200400001)(55016002)(4326008)(9686003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: zVtlpC8nua/iE7Nc0oD+BO7zI8wfPoauFstWNoVR8C7d8JOvAQH8QJsSiJ7O33Hyy7dUWQp55WIPtSJ+GMQvnQcQXXlZ8UIjfDcu4cEeXfB0vdCnxSDXddeXGrrRgWhFLKM9jwEbvl6wtV2srFEBCq1PCVu4Y8sgc2BWzMSI/tuPrwwGLpN4GFL9YLy/8zEEU4EUicCX20k1aXIwDboPqpOmBlqN66jPWR3UBAs4vl6QwuBQF6v3PEt+3vkHWplGMzLevfnXnU6fCrE1OMVaRaHKXGUCx8aEOrvJ2lzaCNpoLVOOnvqdsDz6oxh00wO++I/tb2ozo1ZHCWpJqUzd+CLYcba0ChqvqfGaH/hOMyq0Pu0sLLC5cLxfeWt2HkIHHd9dbIppbXPab9RKFLDu6HalE/UyLD+qiMFRhzAqdRvSu4ZfSUOKbasv7tNDDsdum6YVd0KeVoglYCVUvL9yt7b46jgqVqc1DT9UGcuu/+wfdZlTtMXTZA/BfpffhJ0g 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: f2c05817-d783-4040-0da4-08d81f2ccd08 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jul 2020 08:40:54.9395 (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: OvVYAF5LICYvq5XmI+ac9fhB6eH/Yn0s/dqgRdzVs0lLGHnqkjesSZBJBNF62j8Qmj32cUF62WudFnyzi7eRDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3982 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 1/2] net/virtio: add vhost-user protocol features support 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" Hi Adrian, > -----Original Message----- > From: Adrian Moreno > Sent: Thursday, July 2, 2020 3:44 PM > To: dev@dpdk.org > Cc: Xia, Chenbo ; Wang, Zhihong > ; Wang, Xiao W ; Yigit, > Ferruh ; maxime.coquelin@redhat.com > Subject: [PATCH v3 1/2] net/virtio: add vhost-user protocol features supp= ort >=20 > From: Maxime Coquelin >=20 > This patch adds support for Vhost-user protocol features. > It is required to support protocol features that were not in > initial Vhost-user specification, such as reply-ack, MTU... >=20 > Also, this patch prevents Virtio multiqueue feature negotiation > if the slave does not support MQ protocol feature as stated > in Vhost-user specification: > "The multiple queues feature is supported only when the protocol > feature ``VHOST_USER_PROTOCOL_F_MQ`` (bit 0) is set." >=20 > Signed-off-by: Maxime Coquelin > --- > drivers/net/virtio/virtio_user/vhost.h | 9 +++++ > drivers/net/virtio/virtio_user/vhost_user.c | 5 +++ > .../net/virtio/virtio_user/virtio_user_dev.c | 39 ++++++++++++++++++- > .../net/virtio/virtio_user/virtio_user_dev.h | 3 ++ > drivers/net/virtio/virtio_user_ethdev.c | 19 +++++++++ > 5 files changed, 73 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_user/vhost.h > b/drivers/net/virtio/virtio_user/vhost.h > index 1e784e58e..9ace1a90c 100644 > --- a/drivers/net/virtio/virtio_user/vhost.h > +++ b/drivers/net/virtio/virtio_user/vhost.h > @@ -44,6 +44,15 @@ struct vhost_vring_addr { > uint64_t log_guest_addr; > }; [snip] > @@ -446,6 +455,10 @@ virtio_user_dev_init(struct virtio_user_dev *dev, ch= ar > *path, int queues, > return -1; > } >=20 > + if (!is_vhost_user_by_type(dev->path)) > + dev->unsupported_features |=3D > + (1ULL << VHOST_USER_F_PROTOCOL_FEATURES); > + > if (!dev->is_server) { > if (dev->ops->send_request(dev, VHOST_USER_SET_OWNER, > NULL) < 0) { > @@ -460,6 +473,26 @@ virtio_user_dev_init(struct virtio_user_dev *dev, ch= ar > *path, int queues, > strerror(errno)); > return -1; > } > + > + > + if (dev->device_features & > + (1ULL << > VHOST_USER_F_PROTOCOL_FEATURES)) { > + if (dev->ops->send_request(dev, > + > VHOST_USER_GET_PROTOCOL_FEATURES, > + &protocol_features)) > + return -1; > + > + dev->protocol_features &=3D protocol_features; > + > + if (dev->ops->send_request(dev, > + > VHOST_USER_SET_PROTOCOL_FEATURES, > + &dev->protocol_features)) > + return -1; > + > + if (!(dev->protocol_features & > + (1ULL << > VHOST_USER_PROTOCOL_F_MQ))) > + dev->unsupported_features |=3D (1ull << > VIRTIO_NET_F_MQ); > + } > } else { > /* We just pretend vhost-user can support all these features. > * Note that this could be problematic that if some feature is > @@ -469,6 +502,8 @@ virtio_user_dev_init(struct virtio_user_dev *dev, cha= r > *path, int queues, > dev->device_features =3D VIRTIO_USER_SUPPORTED_FEATURES; > } >=20 > + > + > if (!mrg_rxbuf) > dev->unsupported_features |=3D (1ull << > VIRTIO_NET_F_MRG_RXBUF); >=20 > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h > b/drivers/net/virtio/virtio_user/virtio_user_dev.h > index 3b6b6065a..56e638f8a 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h > @@ -40,6 +40,9 @@ struct virtio_user_dev { > uint64_t device_features; /* supported features by device */ > uint64_t frontend_features; /* enabled frontend features */ > uint64_t unsupported_features; /* unsupported features mask > */ > + uint64_t protocol_features; /* negotiated protocol features > + * (Vhost-user only) > + */ > uint8_t status; > uint16_t port_id; > uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; > diff --git a/drivers/net/virtio/virtio_user_ethdev.c > b/drivers/net/virtio/virtio_user_ethdev.c > index 798f191c3..ccb5a18e2 100644 > --- a/drivers/net/virtio/virtio_user_ethdev.c > +++ b/drivers/net/virtio/virtio_user_ethdev.c > @@ -68,6 +68,7 @@ virtio_user_server_reconnect(struct virtio_user_dev *de= v) > int connectfd; > struct rte_eth_dev *eth_dev =3D &rte_eth_devices[dev->port_id]; > struct virtio_hw *hw =3D eth_dev->data->dev_private; > + uint64_t protocol_features; >=20 > connectfd =3D accept(dev->listenfd, NULL, NULL); > if (connectfd < 0) > @@ -81,6 +82,24 @@ virtio_user_server_reconnect(struct virtio_user_dev *d= ev) > return -1; > } >=20 > + if (dev->device_features & > + (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)) { > + if (dev->ops->send_request(dev, > + > VHOST_USER_GET_PROTOCOL_FEATURES, > + &protocol_features)) > + return -1; > + > + dev->protocol_features &=3D protocol_features; > + > + if (dev->ops->send_request(dev, > + > VHOST_USER_SET_PROTOCOL_FEATURES, > + &dev->protocol_features)) > + return -1; > + } > + > + if (!(dev->protocol_features & (1ULL << > VHOST_USER_PROTOCOL_F_MQ))) > + dev->unsupported_features |=3D (1ull << VIRTIO_NET_F_MQ); > + Should this 'if' be put into above '{}' ? This should be under the conditio= n that VHOST_USER_F_PROTOCOL_FEATURES is supported, right? Like the code change in 'virtio_user_dev_init'. Thanks, Chenbo > dev->device_features |=3D dev->frontend_features; >=20 > /* umask vhost-user unsupported features */ > -- > 2.26.2