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 C5E9C42351; Tue, 10 Oct 2023 21:08:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 982DD4028A; Tue, 10 Oct 2023 21:08:25 +0200 (CEST) Received: from BN3PR00CU001.outbound.protection.outlook.com (mail-eastus2azon11020002.outbound.protection.outlook.com [52.101.56.2]) by mails.dpdk.org (Postfix) with ESMTP id E405740041 for ; Tue, 10 Oct 2023 21:08:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P9hcTDRnt3eoXZoeQV8KNdrkc0LsX+qAx08FFCUPQBvhhzsz6xrl4KPghErsh7+T5ELEQ+rc6v39b0FR03AfMgQxYQYE2sgLQK3z6FwUeLvnEerJfVfXQG0DqveVzXNWwRWz0TIhIS7iECX+1efUJ5Bs2/eVrL5ThAXCGJtMk1Oik9cbWHT9NIe9XfiVXaICaHusC/d2q/EzIlVhvtnsY+DZ/MLQnWRgWQX3OQKU7ieXdICpdVyEL9pWb8TrAQYxOEHE3aDbJUAgVZ+iO9Kgynq/v925WAyyCbAOfqgeo0w7EzdQ2FbYAqpcAkYOsYyBP2T+aZ+mswRukdJPofsXHg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+opE8Qc91kdgPcIQWjKVPaxByD6ENHX7VJjnoiVTLnM=; b=HuUTeTuKnQVXTbDINvK6gFK0NAF2kv1cYg1m1uFPlIvJT7FIwnbakBw1eTJFeAaJ1RY3F2cFxAm4fk4voIpwq69vlFsrbdkWuse1vJvViYAvE6n9nNes6RP+7an6WSIyD7BBbLq0ubnQhW2XgEfptYMORsbnIENw8RRSe4iy3ffNAcmo9wGFKiJkW2SDZZ3kt5IOI7XzHwr4umwPIxot6Voobv0ZCJsm7Bobm/o5bgujc2rWzcS3Je47sQcwnuJjNUzUFDBqvmlegN0BSiMkOfjNCB26+jaE/Gy8lfB/oxjhtbr91Q9K++m3+CzgV8oXevZiIs/BkL88Fo1EtKb83A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+opE8Qc91kdgPcIQWjKVPaxByD6ENHX7VJjnoiVTLnM=; b=ebkKdE8Vdl9V4jwF6bOscLT/n63Ikt/+oflVXrcpdzWmgncLFfgAqMbV/CUA6R/FTveuZrO2Yd8jdCh9Y6SgxVTECK1JlshkSriiblf/PEl331NtuOO7p3v0o1ue+QHWB813ejMHoS+IidvnFseihsXHaRkqxgJLQlhvDZBedPQ= Received: from PH7PR21MB3263.namprd21.prod.outlook.com (2603:10b6:510:1db::16) by BY1PR21MB3966.namprd21.prod.outlook.com (2603:10b6:a03:522::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.2; Tue, 10 Oct 2023 19:08:20 +0000 Received: from PH7PR21MB3263.namprd21.prod.outlook.com ([fe80::bc89:f4fb:3df6:66d9]) by PH7PR21MB3263.namprd21.prod.outlook.com ([fe80::bc89:f4fb:3df6:66d9%4]) with mapi id 15.20.6907.003; Tue, 10 Oct 2023 19:08:20 +0000 From: Long Li To: Sam Andrew , "dev@dpdk.org" , "ferruh.yigit@amd.com" , "andrew.rybchenko@oktetlabs.ru" Subject: RE: [PATCH v3] net/netvsc: add support for mtu_set Thread-Topic: [PATCH v3] net/netvsc: add support for mtu_set Thread-Index: AQHZ+6lq3ldrOfuPzUeY7XkXcLu127BDYtZA Date: Tue, 10 Oct 2023 19:08:20 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=bcee6afe-e6b0-45e8-b277-eff8a22f3d92; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2023-10-05T23:13:52Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR21MB3263:EE_|BY1PR21MB3966:EE_ x-ms-office365-filtering-correlation-id: 9b430255-6445-483b-fdf3-08dbc9c44472 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CHtbV+0RhROgoTL0X7hPVMMEscyvMn87dkfaX13QTwytqsHpWGEgID2L5MFak/lHzgg6/YxO1V3BevSQL9tSfUb6dUMaIDI+nFVwzoUMl2baMYtzQnN+glkHmqSY0JzgZXdXcD60CWAGeWdU32bLGaLNnnF8Oe3mEfG6rpTH8/WUu3ahEBxEQNNqjyhW43bqeEvxiRGsFeV2PUrIAf2TjWRcohtSvb8AvbBfOksdK3h2LHtt3rkJHbcLr/f7nWrv0oWgYyIyyn+thfg4LMErP3fIOvC7ZtKK02exrkrrrC88pNz/g/PugQuzSjywAf+w1wfF30cnWBWNOPfHJFPlQJYlBFtpXRVbjYnVjMEx6QjdEMXp/q3FBzyJBouPLTOaRtxNFOkVGrhec8/6Uk5YNaJDizgI4IVqswupJNLsPIKmZ2hjQxYgy3wro9qu6q+7Cq6fiZE6ZQqyb4Gc6baZRkLbeONxrUbglaQHStKn1ctEsReVEBnbhfhHps68G6OKmgGvzuoCsqMspdat+emcRa90DhyuSe007M23cd/OnFWd70DyGmrQQN25Xi9b8OQrl8O0hSYQnDJ3j+9ixfVxQ1X4CQt5difN39ixd7ZDJ8ujaHsQ5SKC8HPvFzn/R3MAolIuQ87Kdxnr8anXppI0WxMYzNhRnVstyAoFAQ0CeC8= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR21MB3263.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(136003)(396003)(39860400002)(366004)(376002)(230922051799003)(1800799009)(451199024)(64100799003)(186009)(122000001)(38070700005)(82960400001)(86362001)(82950400001)(38100700002)(33656002)(10290500003)(478600001)(55016003)(30864003)(8936002)(41300700001)(7696005)(9686003)(52536014)(5660300002)(2906002)(71200400001)(8676002)(83380400001)(64756008)(66946007)(8990500004)(316002)(66476007)(6506007)(66556008)(76116006)(26005)(110136005)(66446008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?bc/8qhWxwhjbstNObhHGy29pe03iUjwOLU1yBj7eXVLZPBoeAENdoeKE2qRV?= =?us-ascii?Q?8BByHj4zc/mku2p0j8gfhOfnXud6s4pvTg54146q4W+JgG+kEP/OqWlrx1DS?= =?us-ascii?Q?TdPJORO15hJxfisHXrp8RezoLFb5mvwA8myUGkFIm2O7vlytw7O07k37D6sE?= =?us-ascii?Q?HPd++15XhRfpJrg7KQqPOfZe7rk16rmK5Ij4RXDzfnp7Oh+b9mVe5GfzdIg1?= =?us-ascii?Q?+cSnD3YLty9jPCXYEh/883jV8LGeDVRFgBJWcu0P4ZMzsR0dyIhgiAKBlcnE?= =?us-ascii?Q?0UdabZOuSZ2Y5dB+n34mXLxxOOw1TES9fOQvfD9jKLWOUxZmqXMq315On0Jx?= =?us-ascii?Q?XAZPmw+EG8FNFiSINbpBtDel/DF01g23DqTXHud0S+KdI6Eh7wA/bhnqEUBo?= =?us-ascii?Q?2OG28/gPw8W15Vk1Fkcy5oyrOGyAeJL+r3lEBlo8WKNQQ/+37Yqe2+iDdBaF?= =?us-ascii?Q?dARqUkdB1zAOKcukXPQ3r8SJxWsoOB4M0UuKxSxzy43b3wAiibdUKA8WM0G3?= =?us-ascii?Q?NviEwaoFHlutFeL8687VFsBEiiZzsrCIW1NKhFMsr7/BzahbJvAOqVZEzw8Z?= =?us-ascii?Q?BRoVL+dKF3ZQlu48CMD2++IX4IZo6EI+DiOjsfuDO3x1YgmJLwkVAt2/RRkT?= =?us-ascii?Q?DZ3rDMexHtjMik0RFNX3p0H3VmwDCJb1pt8b0LTRHUHdNHR1hYVCwFnsWhao?= =?us-ascii?Q?ZtNL4QzBfGdy6umfPuHnL8KaAB7fyxXcbse8k7Xw8dt/QDsJWJz1iWiCN7nn?= =?us-ascii?Q?wACwxBlSthQvy/VWqhqNtiHlGavkX3bDGhfyfc6ZkMrMFRJ0thku+y8tGXOH?= =?us-ascii?Q?Ohks34Hx5sdX9bRU0WYYB+4b4KrJraXRyP4WrMDBObg3UtqyIiM5mI8I0l7S?= =?us-ascii?Q?opAahdOaRnOSpdNF9FqUlLb9PNGHzJ+Vo/6tg8UUU3gddP5sAIOKGtxPhNAY?= =?us-ascii?Q?5SE3HnDDKBeF2II4reqYS7x7PX5mLFgERH6ZYbn0WG1yHtoIPDFVKm6WlInf?= =?us-ascii?Q?IBj9oR6dxwzfMfzjLKzFzbdCPtWaMvB9mLiBKVUhm9VGWeIizMqynzpfI58/?= =?us-ascii?Q?m5OhAoHGY0YfUo3S60Y8a68D0DT1LKv5G1AD49WuuMmDsTMnDoQZJygi0gMk?= =?us-ascii?Q?4uSnyzKvK4m1zCFfm6ABBe8n4MntxsyiSBhU0u1fP+Rs0hjM02YAu4hdOq6b?= =?us-ascii?Q?Vm6kP7fc3bRN5wkWs1VtipNa9WtVXRh4kSLccvlnpmINiEs6z66sZ3cCW9lo?= =?us-ascii?Q?uhYeyahik6wEmNJdfJ3B2ywjtBeGLHg/XEuWzF+C2mKZjfy7OYznvW6drK1k?= =?us-ascii?Q?15INq7FuvtgKJBhIS6GQCQZft8iQJAMikMEpTkH9X2P+DroAlhcJMcy61usN?= =?us-ascii?Q?PFRakM+SwJ1oqIpDm8lpKCsueB+EcHptBtcbQ2FlVEEI53KSNkFOnMJqeZz9?= =?us-ascii?Q?6lUPOYT3VcUuWGqlQZuxEvigz/UXk3vPJay6pLHyZttfQX7G3AQf6FDly+uX?= =?us-ascii?Q?UelryLXi485zp6RobIC6JNV2AAhkb839J1k//+OhK+jHmepAiLObab+7Io66?= =?us-ascii?Q?sjP4Xpq9UUs1M74pr4BE9kPk9m8nsbgT0Jsfm+Va?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR21MB3263.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b430255-6445-483b-fdf3-08dbc9c44472 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2023 19:08:20.1752 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0Eq2RMk7ggpAkbxXXPtVNNYbRmDLZqdI6zpAFETfrJXX/iteZIXXVpC26N0iD8HqUobCvSRGVCyfOBD8a6iITQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR21MB3966 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 > Subject: [PATCH v3] net/netvsc: add support for mtu_set >=20 > Add support for changing the netvsc MTU. The MTU can only be set at nvs > initialization, therefore to change the MTU the underlying vmbus > channel(s) are torn down and the vmbus device unmapped and remapped. The > existing rx and tx queue(s) are reconnected to the new vmbus channel(s). >=20 > Signed-off-by: Sam Andrew > Acked-by: Stephen Hemminger Acked-by: Long Li > --- > v3: If device is not stopped when MTU change attempted, return -EBUSY, in= stead > of -EIO. Fix additional coding style issue. >=20 > v2: Fix coding style issue. > --- > drivers/bus/vmbus/vmbus_common.c | 6 +- > drivers/net/netvsc/hn_ethdev.c | 185 +++++++++++++++++++++++++------ > drivers/net/netvsc/hn_rndis.c | 7 ++ > drivers/net/netvsc/hn_rndis.h | 1 + > drivers/net/netvsc/hn_var.h | 3 +- > drivers/net/netvsc/hn_vf.c | 23 +++- > 6 files changed, 190 insertions(+), 35 deletions(-) >=20 > diff --git a/drivers/bus/vmbus/vmbus_common.c > b/drivers/bus/vmbus/vmbus_common.c > index 95f3ad78bc..feb9fbe33f 100644 > --- a/drivers/bus/vmbus/vmbus_common.c > +++ b/drivers/bus/vmbus/vmbus_common.c > @@ -39,6 +39,9 @@ vmbus_map_resource(void *requested_addr, int fd, off_t > offset, size_t size, > "mmap(%d, %p, %zu, %ld) failed: %s", > fd, requested_addr, size, (long)offset, > strerror(errno)); > + } else { > + VMBUS_LOG(DEBUG, " VMBUS memory mapped at %p", > + mapaddr); > } > return mapaddr; > } > @@ -55,9 +58,10 @@ vmbus_unmap_resource(void *requested_addr, size_t > size) > VMBUS_LOG(ERR, "munmap(%p, 0x%lx) failed: %s", > requested_addr, (unsigned long)size, > strerror(errno)); > - } else > + } else { > VMBUS_LOG(DEBUG, " VMBUS memory unmapped at %p", > requested_addr); > + } > } >=20 > /** > diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethde= v.c > index d0bbc0a4c0..993ed14f52 100644 > --- a/drivers/net/netvsc/hn_ethdev.c > +++ b/drivers/net/netvsc/hn_ethdev.c > @@ -1059,37 +1059,6 @@ hn_dev_close(struct rte_eth_dev *dev) > return ret; > } >=20 > -static const struct eth_dev_ops hn_eth_dev_ops =3D { > - .dev_configure =3D hn_dev_configure, > - .dev_start =3D hn_dev_start, > - .dev_stop =3D hn_dev_stop, > - .dev_close =3D hn_dev_close, > - .dev_infos_get =3D hn_dev_info_get, > - .txq_info_get =3D hn_dev_tx_queue_info, > - .rxq_info_get =3D hn_dev_rx_queue_info, > - .dev_supported_ptypes_get =3D hn_vf_supported_ptypes, > - .promiscuous_enable =3D hn_dev_promiscuous_enable, > - .promiscuous_disable =3D hn_dev_promiscuous_disable, > - .allmulticast_enable =3D hn_dev_allmulticast_enable, > - .allmulticast_disable =3D hn_dev_allmulticast_disable, > - .set_mc_addr_list =3D hn_dev_mc_addr_list, > - .reta_update =3D hn_rss_reta_update, > - .reta_query =3D hn_rss_reta_query, > - .rss_hash_update =3D hn_rss_hash_update, > - .rss_hash_conf_get =3D hn_rss_hash_conf_get, > - .tx_queue_setup =3D hn_dev_tx_queue_setup, > - .tx_queue_release =3D hn_dev_tx_queue_release, > - .tx_done_cleanup =3D hn_dev_tx_done_cleanup, > - .rx_queue_setup =3D hn_dev_rx_queue_setup, > - .rx_queue_release =3D hn_dev_rx_queue_release, > - .link_update =3D hn_dev_link_update, > - .stats_get =3D hn_dev_stats_get, > - .stats_reset =3D hn_dev_stats_reset, > - .xstats_get =3D hn_dev_xstats_get, > - .xstats_get_names =3D hn_dev_xstats_get_names, > - .xstats_reset =3D hn_dev_xstats_reset, > -}; > - > /* > * Setup connection between PMD and kernel. > */ > @@ -1129,12 +1098,158 @@ hn_detach(struct hn_data *hv) > hn_rndis_detach(hv); > } >=20 > +/* > + * Connects EXISTING rx/tx queues to NEW vmbus channel(s), and > + * re-initializes NDIS and RNDIS, including re-sending initial > + * NDIS/RNDIS configuration. To be used after the underlying vmbus > + * has been un- and re-mapped, e.g. as must happen when the device > + * MTU is changed. > + */ > +static int > +hn_reinit(struct rte_eth_dev *dev, uint16_t mtu) { > + struct hn_data *hv =3D dev->data->dev_private; > + struct hn_rx_queue **rxqs =3D (struct hn_rx_queue **)dev->data- > >rx_queues; > + struct hn_tx_queue **txqs =3D (struct hn_tx_queue **)dev->data- > >tx_queues; > + int i, ret =3D 0; > + > + /* Point primary queues at new primary channel */ > + rxqs[0]->chan =3D hv->channels[0]; > + txqs[0]->chan =3D hv->channels[0]; > + > + ret =3D hn_attach(hv, mtu); > + if (ret) > + return ret; > + > + /* Create vmbus subchannels, additional RNDIS configuration */ > + ret =3D hn_dev_configure(dev); > + if (ret) > + return ret; > + > + /* Point any additional queues at new subchannels */ > + for (i =3D 1; i < dev->data->nb_rx_queues; i++) > + rxqs[i]->chan =3D hv->channels[i]; > + for (i =3D 1; i < dev->data->nb_tx_queues; i++) > + txqs[i]->chan =3D hv->channels[i]; > + > + return ret; > +} > + > +static int > +hn_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { > + struct hn_data *hv =3D dev->data->dev_private; > + unsigned int orig_mtu =3D dev->data->mtu; > + uint32_t rndis_mtu; > + int ret =3D 0; > + int i; > + > + if (dev->data->dev_started) { > + PMD_DRV_LOG(ERR, "Device must be stopped before changing > MTU"); > + return -EBUSY; > + } > + > + /* Change MTU of underlying VF dev first, if it exists */ > + ret =3D hn_vf_mtu_set(dev, mtu); > + if (ret) > + return ret; > + > + /* Release channel resources */ > + hn_detach(hv); > + > + /* Close any secondary vmbus channels */ > + for (i =3D 1; i < hv->num_queues; i++) > + rte_vmbus_chan_close(hv->channels[i]); > + > + /* Close primary vmbus channel */ > + rte_free(hv->channels[0]); > + > + /* Unmap and re-map vmbus device */ > + rte_vmbus_unmap_device(hv->vmbus); > + ret =3D rte_vmbus_map_device(hv->vmbus); > + if (ret) { > + /* This is a catastrophic error - the device is unusable */ > + PMD_DRV_LOG(ERR, "Could not re-map vmbus device!"); > + return ret; > + } > + > + /* Update pointers to re-mapped UIO resources */ > + hv->rxbuf_res =3D hv->vmbus->resource[HV_RECV_BUF_MAP]; > + hv->chim_res =3D hv->vmbus->resource[HV_SEND_BUF_MAP]; > + > + /* Re-open the primary vmbus channel */ > + ret =3D rte_vmbus_chan_open(hv->vmbus, &hv->channels[0]); > + if (ret) { > + /* This is a catastrophic error - the device is unusable */ > + PMD_DRV_LOG(ERR, "Could not re-open vmbus channel!"); > + return ret; > + } > + > + rte_vmbus_set_latency(hv->vmbus, hv->channels[0], hv->latency); > + > + ret =3D hn_reinit(dev, mtu); > + if (!ret) > + goto out; > + > + /* In case of error, attempt to restore original MTU */ > + ret =3D hn_reinit(dev, orig_mtu); > + if (ret) > + PMD_DRV_LOG(ERR, "Restoring original MTU failed for netvsc"); > + > + ret =3D hn_vf_mtu_set(dev, orig_mtu); > + if (ret) > + PMD_DRV_LOG(ERR, "Restoring original MTU failed for VF"); > + > +out: > + if (hn_rndis_get_mtu(hv, &rndis_mtu)) { > + PMD_DRV_LOG(ERR, "Could not get MTU via RNDIS"); > + } else { > + dev->data->mtu =3D (uint16_t)rndis_mtu; > + PMD_DRV_LOG(DEBUG, "RNDIS MTU is %u", dev->data->mtu); > + } > + > + return ret; > +} > + > +static const struct eth_dev_ops hn_eth_dev_ops =3D { > + .dev_configure =3D hn_dev_configure, > + .dev_start =3D hn_dev_start, > + .dev_stop =3D hn_dev_stop, > + .dev_close =3D hn_dev_close, > + .dev_infos_get =3D hn_dev_info_get, > + .txq_info_get =3D hn_dev_tx_queue_info, > + .rxq_info_get =3D hn_dev_rx_queue_info, > + .dev_supported_ptypes_get =3D hn_vf_supported_ptypes, > + .promiscuous_enable =3D hn_dev_promiscuous_enable, > + .promiscuous_disable =3D hn_dev_promiscuous_disable, > + .allmulticast_enable =3D hn_dev_allmulticast_enable, > + .allmulticast_disable =3D hn_dev_allmulticast_disable, > + .set_mc_addr_list =3D hn_dev_mc_addr_list, > + .mtu_set =3D hn_dev_mtu_set, > + .reta_update =3D hn_rss_reta_update, > + .reta_query =3D hn_rss_reta_query, > + .rss_hash_update =3D hn_rss_hash_update, > + .rss_hash_conf_get =3D hn_rss_hash_conf_get, > + .tx_queue_setup =3D hn_dev_tx_queue_setup, > + .tx_queue_release =3D hn_dev_tx_queue_release, > + .tx_done_cleanup =3D hn_dev_tx_done_cleanup, > + .rx_queue_setup =3D hn_dev_rx_queue_setup, > + .rx_queue_release =3D hn_dev_rx_queue_release, > + .link_update =3D hn_dev_link_update, > + .stats_get =3D hn_dev_stats_get, > + .stats_reset =3D hn_dev_stats_reset, > + .xstats_get =3D hn_dev_xstats_get, > + .xstats_get_names =3D hn_dev_xstats_get_names, > + .xstats_reset =3D hn_dev_xstats_reset, > +}; > + > static int > eth_hn_dev_init(struct rte_eth_dev *eth_dev) { > struct hn_data *hv =3D eth_dev->data->dev_private; > struct rte_device *device =3D eth_dev->device; > struct rte_vmbus_device *vmbus; > + uint32_t mtu; > unsigned int rxr_cnt; > int err, max_chan; >=20 > @@ -1218,6 +1333,12 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) > if (err) > goto failed; >=20 > + err =3D hn_rndis_get_mtu(hv, &mtu); > + if (err) > + goto failed; > + eth_dev->data->mtu =3D (uint16_t)mtu; > + PMD_INIT_LOG(DEBUG, "RNDIS MTU is %u", eth_dev->data->mtu); > + > err =3D hn_rndis_get_eaddr(hv, eth_dev->data->mac_addrs->addr_bytes); > if (err) > goto failed; > @@ -1272,7 +1393,7 @@ eth_hn_dev_uninit(struct rte_eth_dev *eth_dev) >=20 > hn_detach(hv); > hn_chim_uninit(eth_dev); > - rte_vmbus_chan_close(hv->primary->chan); > + rte_vmbus_chan_close(hv->channels[0]); > rte_free(hv->primary); > ret =3D rte_eth_dev_owner_delete(hv->owner.id); > if (ret !=3D 0) > diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.= c index > 29c6009b2c..778f86f2bf 100644 > --- a/drivers/net/netvsc/hn_rndis.c > +++ b/drivers/net/netvsc/hn_rndis.c > @@ -1111,6 +1111,13 @@ hn_rndis_get_eaddr(struct hn_data *hv, uint8_t > *eaddr) > return 0; > } >=20 > +int > +hn_rndis_get_mtu(struct hn_data *hv, uint32_t *mtu) { > + return hn_rndis_query(hv, OID_GEN_MAXIMUM_FRAME_SIZE, NULL, 0, > + mtu, sizeof(uint32_t)); > +} > + > int > hn_rndis_get_linkstatus(struct hn_data *hv) { diff --git > a/drivers/net/netvsc/hn_rndis.h b/drivers/net/netvsc/hn_rndis.h index > 9a8251fc2f..7f40f6221d 100644 > --- a/drivers/net/netvsc/hn_rndis.h > +++ b/drivers/net/netvsc/hn_rndis.h > @@ -10,6 +10,7 @@ void hn_rndis_link_status(struct rte_eth_dev *dev, > const void *msg); > int hn_rndis_attach(struct hn_data *hv); > void hn_rndis_detach(struct hn_data *hv); > int hn_rndis_get_eaddr(struct hn_data *hv, uint8_t *eaddr); > +int hn_rndis_get_mtu(struct hn_data *hv, uint32_t *mtu); > int hn_rndis_get_linkstatus(struct hn_data *hv); > int hn_rndis_get_linkspeed(struct hn_data *hv); > int hn_rndis_set_rxfilter(struct hn_data *hv, uint32_t filter); > diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h in= dex > e1f8e69a28..e37946804d 100644 > --- a/drivers/net/netvsc/hn_var.h > +++ b/drivers/net/netvsc/hn_var.h > @@ -13,7 +13,7 @@ > * Tunable ethdev params > */ > #define HN_MIN_RX_BUF_SIZE 1024 > -#define HN_MAX_XFER_LEN 2048 > +#define HN_MAX_XFER_LEN > RTE_ETHER_MAX_JUMBO_FRAME_LEN > #define HN_MAX_MAC_ADDRS 1 > #define HN_MAX_CHANNELS 64 >=20 > @@ -287,6 +287,7 @@ int hn_vf_rss_hash_update(struct rte_eth_dev > *dev, > int hn_vf_reta_hash_update(struct rte_eth_dev *dev, > struct rte_eth_rss_reta_entry64 *reta_conf, > uint16_t reta_size); > +int hn_vf_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); > int hn_eth_rmv_event_callback(uint16_t port_id, > enum rte_eth_event_type event > __rte_unused, > void *cb_arg, void *out __rte_unused); diff -- > git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index > 782395d805..90cb6f6923 100644 > --- a/drivers/net/netvsc/hn_vf.c > +++ b/drivers/net/netvsc/hn_vf.c > @@ -239,7 +239,7 @@ int hn_vf_add(struct rte_eth_dev *dev, struct hn_data > *hv) >=20 > port =3D hv->vf_ctx.vf_port; >=20 > - /* If the primary device has started, this is a VF host add. > + /* If the primary device has started, this is a VF hot add. > * Configure and start VF device. > */ > if (dev->data->dev_started) { > @@ -264,6 +264,12 @@ int hn_vf_add(struct rte_eth_dev *dev, struct hn_dat= a > *hv) > goto exit; > } >=20 > + ret =3D hn_vf_mtu_set(dev, dev->data->mtu); > + if (ret) { > + PMD_DRV_LOG(ERR, "Failed to set VF MTU"); > + goto exit; > + } > + > PMD_DRV_LOG(NOTICE, "Starting VF port %d", port); > ret =3D rte_eth_dev_start(port); > if (ret) { > @@ -778,3 +784,18 @@ int hn_vf_reta_hash_update(struct rte_eth_dev *dev, >=20 > return ret; > } > + > +int hn_vf_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { > + struct hn_data *hv =3D dev->data->dev_private; > + struct rte_eth_dev *vf_dev; > + int ret =3D 0; > + > + rte_rwlock_read_lock(&hv->vf_lock); > + vf_dev =3D hn_get_vf_dev(hv); > + if (hv->vf_ctx.vf_vsc_switched && vf_dev) > + ret =3D vf_dev->dev_ops->mtu_set(vf_dev, mtu); > + rte_rwlock_read_unlock(&hv->vf_lock); > + > + return ret; > +} > -- > 2.42.0.windows.2