Message ID | BN3PR03MB14946676AD33FC565680FF74DAC70@BN3PR03MB1494.namprd03.prod.outlook.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id D9C813238; Thu, 6 Oct 2016 15:39:54 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0047.outbound.protection.outlook.com [104.47.37.47]) by dpdk.org (Postfix) with ESMTP id F23382C58 for <dev@dpdk.org>; Thu, 6 Oct 2016 15:39:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=SonusNetworks.onmicrosoft.com; s=selector1-sonusnet-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=C0LCWM80IJjhoO634AfwYoiWwfYtTNduAzAghz6ANW4=; b=drIS0xXXMMsjH+SBGLMABk7FCuUQ/vO0Ko+DgJ+l3GPe/0zSpNxMdV65438XoxAxMeB7gpXXO6CDtuxKlzmRjy8r8/EvwbAxLcEk0rM/mKMpS7ZFn4Olb/bQkRZaK0nnV0u0XVKDogosp36f9Y13uhHqroFFWa/PpuRe0QTm9AQ= Received: from BN3PR03MB1494.namprd03.prod.outlook.com (10.163.35.145) by BN3PR03MB1493.namprd03.prod.outlook.com (10.163.35.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Thu, 6 Oct 2016 13:39:50 +0000 Received: from BN3PR03MB1494.namprd03.prod.outlook.com ([10.163.35.145]) by BN3PR03MB1494.namprd03.prod.outlook.com ([10.163.35.145]) with mapi id 15.01.0659.015; Thu, 6 Oct 2016 13:39:50 +0000 From: "Dey, Souvik" <sodey@sonusnet.com> To: "Dey, Souvik" <sodey@sonusnet.com>, "Kavanagh, Mark B" <mark.b.kavanagh@intel.com>, "yuanhan.liu@linux.intel.com" <yuanhan.liu@linux.intel.com>, "stephen@networkplumber.org" <stephen@networkplumber.org> CC: "dev@dpdk.org" <dev@dpdk.org> Thread-Topic: [PATCH v7] net/virtio: add set_mtu in virtio Thread-Index: AQHSGpCEO2JH49nnlEKHRbCquIGY6aCTpQrAgAVQiPCAAJaigIAAX2LggAGNORA= Date: Thu, 6 Oct 2016 13:39:50 +0000 Message-ID: <BN3PR03MB14946676AD33FC565680FF74DAC70@BN3PR03MB1494.namprd03.prod.outlook.com> References: <20160922135643.37636-1-sodey@sonusnet.com> <20160929203130.58712-1-sodey@sonusnet.com> <BN3PR03MB1494CD67AB36557559F2CCCADAC50@BN3PR03MB1494.namprd03.prod.outlook.com> <DC5AD7FA266D86499789B1BCAEC715F85C722FC4@irsmsx105.ger.corp.intel.com> <CY1PR03MB150394E8F63E461EB744B74ADAC40@CY1PR03MB1503.namprd03.prod.outlook.com> In-Reply-To: <CY1PR03MB150394E8F63E461EB744B74ADAC40@CY1PR03MB1503.namprd03.prod.outlook.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sodey@sonusnet.com; x-originating-ip: [208.45.178.4] x-ms-office365-filtering-correlation-id: ab0ea347-c60a-479a-cc58-08d3edee3f18 x-microsoft-exchange-diagnostics: 1; BN3PR03MB1493; 6:ju3IRbTjGB5itL/qb9Zy4smPx9mAWS9MshJnsLymT0njj8D09JSSXi/4UsVdKn1mUw+T0pCuzkH1afNVNlfq0VZlCGJFGrstm5S+CewJLgWmKPLwUr+98qG03epeOLPKtSG23jM5NK0g60uWXgWvrbvKYB9ve5z3cbhGVMMqlL23qP/oo7lmI9MgXat8+/WAfVeK9SSo/tEJsu5Tlj55AQLC+9Lh7oz6enGTypfS/vpYZfmx4yB0EOLrvKb3yBDgn6XkLB3Dv3LBUat2xEgkMSoWZinUOHJzux/RBMHwm6ORS52tIz6ZK+uRCH3J2x+R; 5:Z4kbGc4cDSyQCkQjIzbF48aCYmwZc+cFZTvu6rtWpDdIeahV8bvo6M/Oe8W3yuKF2vrtRffLcDJimN3Flqr2ZhX7fuDv2Y68yAh2PmdUPirM7nkLHVMYK4456AFtvMRCXQ7e9MU5TseZ32HbPtIV1Q==; 24:32KZEF0yUiai50yPDhJ24ZGV9OGh/LZ7RAH9OaAbNRnzhPYbKUFXy2RoLn8njdTndHbBHkYXS65tQlA0jQYDi3imq2arddZ2fW+t6Hc4LDw=; 7:O2rPTFUDccoBUuD/Iug/QoxUCxf5eH0PsnonKMErmY1KiTWlrZAQISN+A+B/nKxpBZkzsLoK+IvCHPebBjdr18b/1XmCKwqpJKsNaUuU64aQWNX2f+eB0UlHEDmEfe6QDrVPCmtOXkv0zQm0PfmsfVEW27kybwhJ16CRikpAea+xbjWVoKbEm2IRFr+XtyKse+kOopGnx2Fqeer1EcW/l2z421D9cHhFqSc19BUhGWwq7LepvOe/Kl9sbOcrmmeXR3w8rVmxm7BCvvgsJ4Yc3BrSeVZ7M9B1DlKmj6KXtTRyhvD87jhK36T31jG4C0CO x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1493; x-microsoft-antispam-prvs: <BN3PR03MB1493B9F8C22FC23E68271490DAC70@BN3PR03MB1493.namprd03.prod.outlook.com> x-exchange-antispam-report-test: UriScan:(158342451672863)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:BN3PR03MB1493; BCL:0; PCL:0; RULEID:; SRVR:BN3PR03MB1493; x-forefront-prvs: 00872B689F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(53754006)(13464003)(43544003)(189002)(199003)(377454003)(92566002)(68736007)(66066001)(76576001)(77096005)(8676002)(2900100001)(2201001)(86362001)(33656002)(11100500001)(6116002)(5002640100001)(106116001)(106356001)(5001770100001)(10400500002)(97736004)(93886004)(102836003)(3846002)(50986999)(76176999)(54356999)(81166006)(81156014)(105586002)(2501003)(189998001)(586003)(101416001)(99286002)(3660700001)(2906002)(122556002)(74316002)(7696004)(9686002)(3280700002)(87936001)(5660300001)(7846002)(4326007)(305945005)(7736002)(2950100002)(19580405001)(8936002)(19580395003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB1493; H:BN3PR03MB1494.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: sonusnet.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: sonusnet.com X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Oct 2016 13:39:50.3709 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 29a671dc-ed7e-4a54-b1e5-8da1eb495dc3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB1493 Subject: Re: [dpdk-dev] [PATCH v7] net/virtio: add set_mtu in virtio X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
souvikdey33
Oct. 6, 2016, 1:39 p.m. UTC
Hi Stephen/Liu, Any other comments or suggestions for this. If the below patch looks fine then please do suggest the next steps . -- Regards, Souvik -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Dey, Souvik Sent: Wednesday, October 5, 2016 10:05 AM To: Kavanagh, Mark B <mark.b.kavanagh@intel.com>; yuanhan.liu@linux.intel.com; stephen@networkplumber.org Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v7] net/virtio: add set_mtu in virtio Yes Mark, I have modified the patch with the below comments. drivers/net/virtio/virtio_ethdev.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) To: Dey, Souvik <sodey@sonusnet.com>; yuanhan.liu@linux.intel.com; stephen@networkplumber.org Cc: dev@dpdk.org Subject: RE: [PATCH v7] net/virtio: add set_mtu in virtio >Hi All, > Is there any further comments or modifications required for this >patch, or what next steps do you guys suggest here ? Hi Souvik, Some minor comments inline. Thanks, Mark > >-- >Regards, >Souvik > >-----Original Message----- >From: Dey, Souvik >Sent: Saturday, October 1, 2016 10:09 AM >To: mark.b.kavanagh@intel.com; yuanhan.liu@linux.intel.com; >stephen@networkplumber.org; dev@dpdk.org >Subject: RE: [PATCH v7] net/virtio: add set_mtu in virtio > >Hi Liu/Stephen/Mark, > > I have submitted Version 7 of this patch. Do let me know if this looks proper. > >-- >Regards, >Souvik > >-----Original Message----- >From: Dey, Souvik >Sent: Thursday, September 29, 2016 4:32 PM >To: mark.b.kavanagh@intel.com; yuanhan.liu@linux.intel.com; >stephen@networkplumber.org; dev@dpdk.org >Cc: Dey, Souvik <sodey@sonusnet.com> >Subject: [PATCH v7] net/virtio: add set_mtu in virtio > > >Virtio interfaces do not currently allow the user to specify a >particular Maximum Transmission Unit (MTU).Consequently, the MTU of >Virtio interfaces is typically set to the Ethernet default value of 1500. >This is problematic in the case of cloud deployments, in which a >specific (and potentially non-standard) MTU needs to be set by a DHCP >server, which needs to be honored by all interfaces across the traffic >path.To achieve this Virtio interfaces should support setting of MTU. >In case when GRE/VXLAN tunneling is used for internal communication, >there will be an overhead added by the infrastructure in the packet >over and above the ETHER MTU of 1518. So to take care of this overhead >in these cases the DHCP server corrects the L3 MTU to 1454. But since >virtio interfaces was not having the MTU set functionality that MTU >sent by the DHCP server was ignored and the instance will still send >packets with 1500 MTU which after encapsulation will become more than >1518 and eventually gets dropped in the infrastructure. >By adding an additional 'set_mtu' function to the Virtio driver, we can >honor the MTU sent by the DHCP server. The dhcp server/controller can >then leverage this 'set_mtu' functionality to resolve the above >mentioned issue of packets getting dropped due to incorrect size. > > >Signed-off-by: Souvik Dey <sodey@sonusnet.com> > >--- >Changes in v7: >- Replaced the CRC_LEN with the merge rx buf header length. >- Changed the frame_len max validation to VIRTIO_MAX_RX_PKTLEN. >Changes in v6: >- Description of change corrected >- Corrected the identations >- Corrected the subject line too >- The From line was also not correct >- Re-submitting as the below patch was not proper Changes in v5: >- Fix log message for out-of-bounds MTU parameter in virtio_mtu_set >- Calculate frame size, based on 'mtu' parameter >- Corrected the upper bound and lower bound checks in virtio_mtu_set >Changes in v4: Incorporated review comments. >Changes in v3: Corrected few style errors as reported by sys-stv. >Changes in v2: Incorporated review comments. > > drivers/net/virtio/virtio_ethdev.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > >diff --git a/drivers/net/virtio/virtio_ethdev.c >b/drivers/net/virtio/virtio_ethdev.c >index 423c597..1dbfea6 100644 >--- a/drivers/net/virtio/virtio_ethdev.c >+++ b/drivers/net/virtio/virtio_ethdev.c >@@ -653,12 +653,20 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev) > PMD_INIT_LOG(ERR, "Failed to disable allmulticast"); } > >+#define VLAN_TAG_LEN 4 /* 802.3ac tag (not DMA'd) */ There should be a blank line between the #define and the function prototype beneath. >+static int virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { >+ struct virtio_hw *hw = dev->data->dev_private; >+ uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + >+ hw->vtnet_hdr_size; I'll rely on Stephen and Yuanhan's judgment for this. >+ uint32_t frame_size = mtu + ether_hdr_len; >+ >+ if (mtu < ETHER_MIN_MTU || frame_size > VIRTIO_MAX_RX_PKTLEN) { >+ PMD_INIT_LOG(ERR, "MTU should be between %d and %d\n", >+ ETHER_MIN_MTU, VIRTIO_MAX_RX_PKTLEN); Shouldn't last format print parameter should be (VIRTIO_MAX_RX_PKTLEN - ether_hdr_len)? i.e PMD_INIT_LOG(ERR, "MTU should........%d\n", ETHER_MIN_MTU, (VIRTIO_MAX_RX_PKTLEN - ether_hdr_len)); >+ return -EINVAL; >+ } >+ return 0; >+} > > /* > * dev_ops for virtio, bare necessities for basic operation > */ >@@ -677,7 +685,6 @@ static const struct eth_dev_ops virtio_eth_dev_ops = { > .allmulticast_enable = virtio_dev_allmulticast_enable, > .allmulticast_disable = virtio_dev_allmulticast_disable, >+ .mtu_set = virtio_mtu_set, > .dev_infos_get = virtio_dev_info_get, > .stats_get = virtio_dev_stats_get, > .xstats_get = virtio_dev_xstats_get, >-- >2.9.3.windows.1
Comments
> >Hi Stephen/Liu, > Any other comments or suggestions for this. If the below patch looks fine then please >do suggest the next steps . Hi Souvik, Just to let you know that Yuanhan is out of office on account of public holidays in PRC. AFAIA he should be back online from next week. Thanks, Mark > >-- >Regards, >Souvik > >-----Original Message----- >From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Dey, Souvik >Sent: Wednesday, October 5, 2016 10:05 AM >To: Kavanagh, Mark B <mark.b.kavanagh@intel.com>; yuanhan.liu@linux.intel.com; >stephen@networkplumber.org >Cc: dev@dpdk.org >Subject: Re: [dpdk-dev] [PATCH v7] net/virtio: add set_mtu in virtio > >Yes Mark, I have modified the patch with the below comments. > >drivers/net/virtio/virtio_ethdev.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > >diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c >index 423c597..1dbfea6 100644 >--- a/drivers/net/virtio/virtio_ethdev.c >+++ b/drivers/net/virtio/virtio_ethdev.c >@@ -653,12 +653,20 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev) > PMD_INIT_LOG(ERR, "Failed to disable allmulticast"); } > >+#define VLAN_TAG_LEN 4 /* 802.3ac tag (not DMA'd) */ >+ >+static int virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { >+ struct virtio_hw *hw = dev->data->dev_private; >+ uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + >+ hw->vtnet_hdr_size; >+ uint32_t frame_size = mtu + ether_hdr_len; >+ >+ if (mtu < ETHER_MIN_MTU || frame_size > VIRTIO_MAX_RX_PKTLEN) { >+ PMD_INIT_LOG(ERR, "MTU should be between %d and %d\n", >+ ETHER_MIN_MTU, (VIRTIO_MAX_RX_PKTLEN - ether_hdr_len)); >+ return -EINVAL; >+ } >+ return 0; >+} > >Let mem know if this looks good or we have few more comments. > >-- >Regards, >Souvik > >-----Original Message----- >From: Kavanagh, Mark B [mailto:mark.b.kavanagh@intel.com] >Sent: Wednesday, October 5, 2016 4:16 AM >To: Dey, Souvik <sodey@sonusnet.com>; yuanhan.liu@linux.intel.com; stephen@networkplumber.org >Cc: dev@dpdk.org >Subject: RE: [PATCH v7] net/virtio: add set_mtu in virtio > >>Hi All, >> Is there any further comments or modifications required for this >>patch, or what next steps do you guys suggest here ? > >Hi Souvik, > >Some minor comments inline. > >Thanks, >Mark > >> >>-- >>Regards, >>Souvik >> >>-----Original Message----- >>From: Dey, Souvik >>Sent: Saturday, October 1, 2016 10:09 AM >>To: mark.b.kavanagh@intel.com; yuanhan.liu@linux.intel.com; >>stephen@networkplumber.org; dev@dpdk.org >>Subject: RE: [PATCH v7] net/virtio: add set_mtu in virtio >> >>Hi Liu/Stephen/Mark, >> >> I have submitted Version 7 of this patch. Do let me know if this looks proper. >> >>-- >>Regards, >>Souvik >> >>-----Original Message----- >>From: Dey, Souvik >>Sent: Thursday, September 29, 2016 4:32 PM >>To: mark.b.kavanagh@intel.com; yuanhan.liu@linux.intel.com; >>stephen@networkplumber.org; dev@dpdk.org >>Cc: Dey, Souvik <sodey@sonusnet.com> >>Subject: [PATCH v7] net/virtio: add set_mtu in virtio >> >> >>Virtio interfaces do not currently allow the user to specify a >>particular Maximum Transmission Unit (MTU).Consequently, the MTU of >>Virtio interfaces is typically set to the Ethernet default value of 1500. >>This is problematic in the case of cloud deployments, in which a >>specific (and potentially non-standard) MTU needs to be set by a DHCP >>server, which needs to be honored by all interfaces across the traffic >>path.To achieve this Virtio interfaces should support setting of MTU. >>In case when GRE/VXLAN tunneling is used for internal communication, >>there will be an overhead added by the infrastructure in the packet >>over and above the ETHER MTU of 1518. So to take care of this overhead >>in these cases the DHCP server corrects the L3 MTU to 1454. But since >>virtio interfaces was not having the MTU set functionality that MTU >>sent by the DHCP server was ignored and the instance will still send >>packets with 1500 MTU which after encapsulation will become more than >>1518 and eventually gets dropped in the infrastructure. >>By adding an additional 'set_mtu' function to the Virtio driver, we can >>honor the MTU sent by the DHCP server. The dhcp server/controller can >>then leverage this 'set_mtu' functionality to resolve the above >>mentioned issue of packets getting dropped due to incorrect size. >> >> >>Signed-off-by: Souvik Dey <sodey@sonusnet.com> >> >>--- >>Changes in v7: >>- Replaced the CRC_LEN with the merge rx buf header length. >>- Changed the frame_len max validation to VIRTIO_MAX_RX_PKTLEN. >>Changes in v6: >>- Description of change corrected >>- Corrected the identations >>- Corrected the subject line too >>- The From line was also not correct >>- Re-submitting as the below patch was not proper Changes in v5: >>- Fix log message for out-of-bounds MTU parameter in virtio_mtu_set >>- Calculate frame size, based on 'mtu' parameter >>- Corrected the upper bound and lower bound checks in virtio_mtu_set >>Changes in v4: Incorporated review comments. >>Changes in v3: Corrected few style errors as reported by sys-stv. >>Changes in v2: Incorporated review comments. >> >> drivers/net/virtio/virtio_ethdev.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >>diff --git a/drivers/net/virtio/virtio_ethdev.c >>b/drivers/net/virtio/virtio_ethdev.c >>index 423c597..1dbfea6 100644 >>--- a/drivers/net/virtio/virtio_ethdev.c >>+++ b/drivers/net/virtio/virtio_ethdev.c >>@@ -653,12 +653,20 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev) >> PMD_INIT_LOG(ERR, "Failed to disable allmulticast"); } >> >>+#define VLAN_TAG_LEN 4 /* 802.3ac tag (not DMA'd) */ > >There should be a blank line between the #define and the function prototype beneath. > >>+static int virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { >>+ struct virtio_hw *hw = dev->data->dev_private; >>+ uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + >>+ hw->vtnet_hdr_size; > >I'll rely on Stephen and Yuanhan's judgment for this. > >>+ uint32_t frame_size = mtu + ether_hdr_len; >>+ >>+ if (mtu < ETHER_MIN_MTU || frame_size > VIRTIO_MAX_RX_PKTLEN) { >>+ PMD_INIT_LOG(ERR, "MTU should be between %d and %d\n", >>+ ETHER_MIN_MTU, VIRTIO_MAX_RX_PKTLEN); > >Shouldn't last format print parameter should be (VIRTIO_MAX_RX_PKTLEN - ether_hdr_len)? >i.e PMD_INIT_LOG(ERR, "MTU should........%d\n", > ETHER_MIN_MTU, (VIRTIO_MAX_RX_PKTLEN - ether_hdr_len)); > >>+ return -EINVAL; >>+ } >>+ return 0; >>+} >> >> /* >> * dev_ops for virtio, bare necessities for basic operation >> */ >>@@ -677,7 +685,6 @@ static const struct eth_dev_ops virtio_eth_dev_ops = { >> .allmulticast_enable = virtio_dev_allmulticast_enable, >> .allmulticast_disable = virtio_dev_allmulticast_disable, >>+ .mtu_set = virtio_mtu_set, >> .dev_infos_get = virtio_dev_info_get, >> .stats_get = virtio_dev_stats_get, >> .xstats_get = virtio_dev_xstats_get, >>-- >>2.9.3.windows.1
I think current patch is fine. If someone has later problem with it on some scenario we can fix the bug then. Please merge
Hi Stephen,
As I am new to this patch submission, I did not get what you exactly meant my “Please merge”, do you mean that you Ack the patch and it can be upstreamed or you want me submit a new version or something. Sorry for my ignorance.
Thanks
--
Souvik
From: Stephen Hemminger [mailto:stephen@networkplumber.org]
Sent: Thursday, October 6, 2016 6:30 PM
To: Kavanagh, Mark B <mark.b.kavanagh@intel.com>
Cc: Dey, Souvik <sodey@sonusnet.com>; yuanhan.liu@linux.intel.com; dev@dpdk.org
Subject: Re: [PATCH v7] net/virtio: add set_mtu in virtio
I think current patch is fine. If someone has later problem with it on some scenario we can fix the bug then.
Please merge
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 423c597..1dbfea6 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -653,12 +653,20 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev) PMD_INIT_LOG(ERR, "Failed to disable allmulticast"); } +#define VLAN_TAG_LEN 4 /* 802.3ac tag (not DMA'd) */ + +static int virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { + struct virtio_hw *hw = dev->data->dev_private; + uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + + hw->vtnet_hdr_size; + uint32_t frame_size = mtu + ether_hdr_len; + + if (mtu < ETHER_MIN_MTU || frame_size > VIRTIO_MAX_RX_PKTLEN) { + PMD_INIT_LOG(ERR, "MTU should be between %d and %d\n", + ETHER_MIN_MTU, (VIRTIO_MAX_RX_PKTLEN - ether_hdr_len)); + return -EINVAL; + } + return 0; +} Let mem know if this looks good or we have few more comments. -- Regards, Souvik -----Original Message----- From: Kavanagh, Mark B [mailto:mark.b.kavanagh@intel.com] Sent: Wednesday, October 5, 2016 4:16 AM