Message ID | 20160929203130.58712-1-sodey@sonusnet.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Yuanhan Liu |
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 CBFD45595; Thu, 29 Sep 2016 22:31:56 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0043.outbound.protection.outlook.com [104.47.37.43]) by dpdk.org (Postfix) with ESMTP id 25C152BA1 for <dev@dpdk.org>; Thu, 29 Sep 2016 22:31:55 +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=kZOfpEKGJGabR3qxhKDIZt3J78XwTDXU5R/RhPTf2+U=; b=OfQWw76vN/lBh0EwNKS/i8jVppaCWgqtw/idACjOIliGU2ZyZhbeTRQDJ+iOz6QanJw8B8xqKgD2PCt7BZMsVrR3prykVdvlHaQ0/IwdLXvS7Mghzy+9c9XKNQMNVMQr4sAAeIVVGD6qquaa2rQ7XQTcEYjIj5pk+j6wXP15mII= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sodey@sonusnet.com; Received: from SODEY-LMA.sonusnet.com (208.45.178.4) by CY1PR03MB1504.namprd03.prod.outlook.com (10.163.17.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Thu, 29 Sep 2016 20:31:52 +0000 From: Dey <sodey@sonusnet.com> To: <mark.b.kavanagh@intel.com>, <yuanhan.liu@linux.intel.com>, <stephen@networkplumber.org>, <dev@dpdk.org> CC: Dey <sodey@sonusnet.com> Date: Thu, 29 Sep 2016 16:31:30 -0400 Message-ID: <20160929203130.58712-1-sodey@sonusnet.com> X-Mailer: git-send-email 2.9.3.windows.1 In-Reply-To: <20160922135643.37636-1-sodey@sonusnet.com> References: <20160922135643.37636-1-sodey@sonusnet.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [208.45.178.4] X-ClientProxiedBy: BN6PR14CA0023.namprd14.prod.outlook.com (10.173.157.161) To CY1PR03MB1504.namprd03.prod.outlook.com (10.163.17.22) X-MS-Office365-Filtering-Correlation-Id: 2cf03426-12b0-4fef-ad6a-08d3e8a7a60b X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1504; 2:lICyFlLTMkBvG8UcVXIOUCefmGyMyAQJWU0/eI0iik1PDavPl28rjFQvFLQeWo51ZAtjaKIQYK/R1nSqsr/6pPFW4e80aw+Sjdv1byNGP58GaZhXknLopPPSiBVrVLJ+ABQ1nG1TeLF6tGAUN9nIQ8sfmqz+N4ue7sC9k+R8gH6egoFqPSJI9YWB0tDIrEv0; 3:5zQmwvBgGUJoYDJ3JGY7BxxW6JGRORlQvpazFhhiOK1IvDdKAZhqfX+fPhZRNU4WK5LXPoKtkvc22jsIec3w4MvtnP4VsOX4T9Q8jYf3FMJcqfO1nhlNsss//nR9/kUd X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1504; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1504; 25:U4VFGeuUKhR1D8VaCNdko9tyV8vZOgatyVBoLL/DDhj2wu7PceTgj6Brxl4wVFDTwstGlmZ//D9fqq/sgaGbqKHtjap8v9SoTKRDwkkHQGsfowqyQMV5jzeCQT8iFuQ/f4UTXuaQo6EYkBs2pmhOs7ObAbI62V0IMRDbc4/6Ja1LQWUnfyrYsesP0tY538hqlpH71SCmNa43Lw+AutnRHHTBfNKa2FvbyQKyU99xcGSJ3fGo93S19sAPAASKhNwNv5/I7g+HwT8+jnxrUn4uJjtDeLnFG6fZpF3snjDX5Ou4I+AHJEfDAnp2tLDJ9TDwRXjaK9dBK5w2n46NrY44PJuE0Htea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HVPJ+ErLYp4D9aW2NcYbMlMVZNnovTPPr1tP2xCAdxh5gm7deewtAj5nxQjUb1yJL2WnwIB5pzYL5/xmvmMaMkSf27xK6ZRiNF; 4:gpkPshTuD2D4N4dEfJl1nHjBydnJJqRbvs4MpvzAQqMqVyyDCdUu/xHYb2B06dHQtto4CvqrQ8vIQT5S4fRUco4eXuHU7IAdQWsvXCLBEB5Yh5vLWA/mRcGE2diVx11Ra3hBqNlNuWPMOZ28wH7K3EWrpSkRYJ0qWw8SGCccN2bid61tYUDmAIxTLLX1TELXGsbZYUkr7vyfCiDpabSKVeKzRybPNH8KUmH8OOlECo8vpRVYgXLPOTDyYiqCA5GLBo/T4wG4EXiiSxVBPw7+7uD5zehflb/o7ytNc9U8xzzVBHgIlc7tnW6h7q46TWChDm0iTNtH145xQsONrJ9dqa/l1Mk0Eg393vwVuFX0yom0JyHX2UWFj1+PjO7MGxCo3NV+DBvEkrq8H5Q1RVu4sc2ks87ff9psAP1cJN/ySETJV+ER1amM6Dr9O+99IdWY X-Microsoft-Antispam-PRVS: <CY1PR03MB1504B795D7D3F8455E712504DACE0@CY1PR03MB1504.namprd03.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(158342451672863); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:CY1PR03MB1504; BCL:0; PCL:0; RULEID:; SRVR:CY1PR03MB1504; X-Forefront-PRVS: 00808B16F3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(43544003)(189002)(68736007)(5003940100001)(101416001)(6666003)(4001430100002)(106356001)(229853001)(105586002)(42186005)(33646002)(50986999)(77096005)(53416004)(76176999)(86362001)(92566002)(586003)(19580405001)(189998001)(1076002)(8676002)(3846002)(69596002)(6116002)(97736004)(305945005)(7736002)(36756003)(7846002)(107886002)(5001770100001)(47776003)(19580395003)(48376002)(2950100002)(4326007)(50226002)(2201001)(81166006)(81156014)(50466002)(2906002)(5660300001)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB1504; H:SODEY-LMA.sonusnet.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: sonusnet.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB1504; 23:tbcluhNyUD1SwqSYQrRXHR7jDMeWfj5zCkz6zJuXR?= =?us-ascii?Q?3bNd3mAhooMh2X86jI3FtZXvwkzKApEsQGPQt35FlIMvQYrO4kLR0zAkE8fv?= =?us-ascii?Q?8jMeB4UkWOGC7Y6B8r8gfF94EPIsHWOCroE0wnZYHWAuFBPrGgCwuhvEfRtG?= =?us-ascii?Q?E2xJNdkxYbxWSNn7elPIaxBu0nJZCsajNExBrYDn10ZMUc1pTc4QHTwUz594?= =?us-ascii?Q?je14Dh84vXNL4p87KlLBOtWiVndG29kvKBTJ2uPauvXwBVhGWGTvOLyp0Ax6?= =?us-ascii?Q?cRlsRdAJ7nuyMOfbsO6AL7yDmZUrpqaiyK0lneqAzgz4F78mNlDHpl11hwuu?= =?us-ascii?Q?q/Mrc+pIP1xHu2joDh37C4pT9MLz+TR7q1VbjmugcVdEkrkTWSYDMI+ChPjd?= =?us-ascii?Q?kdzQWUXFNFpVzoAnVbiPT54OzZSg94ot2YUYtr/8Idp7tMvIvwI8wRBqF02m?= =?us-ascii?Q?jB7zcbbe/5gcgIlLlLO6ArcQhyo0IgCYoopzIJ7/vFfhGCYvOL2rST6Y45U8?= =?us-ascii?Q?b3oqLYz19wmNmFGrbIaZaNnQzVpJP+cZ+7HGMcCS0p5tj8jMmgJHta+SU6qt?= =?us-ascii?Q?g5H1SSvykL8DW7QMBNOEnKG5KAm0KJM4K8VohZm0K2nQg1S5VsTGeQBiUIM5?= =?us-ascii?Q?t4Qeqw5/wORZgyZeNMZa+lH96Wu5QPb7VoUf9DFxcVkpI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2NCf0b/SUf5Ujfr68oM2iiQbXv3ZeQc8kXwzW7sPqkp5DFSQ6aZfJtZG1t1idL7Ft/3uPtGCwUEwXAjsJZrCphMkxgE9+GJywJrwqZu9GLo30J7bjJnR8sQ9w==; 24:dWgwOKuOd0LKaaxDe9d9rWDOichTVNpzeo4YSv4pnDr5862GMtXxapjf5FRMIyLSzqyT6M8sU1GqWtxdGl12bbu2goXdxXU6DmcjpR//9y4=; 7:VRTxvEk8MZ556EArZgryvBlUTIGMNvT2zGrtvBYHtO9GI+a9luBz6Wh5+jbstbFZF51xFQkSv0mcc6+KI5eOY1Y7SXZQpSFcS9elKyKOkbbnYQQICjcJM58B9GHyg3aB6twCcePvPxfwe5Bdqz7echVvCYUS0+uF4HRG0vp8gqq/aVA+prBPURQtIHg5gg1mBG+BAo9BjbM1p56MrNLvkl3HiJSts7860elt35Jsue3xaYMsnUG+3n0n5SnRfQdDNDP7jQ8ts36L5ZarI60fBne3QY3m/g8z4WFD56mTfThbAeQJU5djIREYYyviNAWn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sonusnet.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2016 20:31:52.7393 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1504 Subject: [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
Sept. 29, 2016, 8:31 p.m. UTC
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 acheive
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(+)
.xstats_get = virtio_dev_xstats_get,
Comments
On Thu, Sep 29, 2016 at 04:31:30PM -0400, Dey wrote: > /* > * 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 Your patch is malformed: I got an error while trying to apply it. patch: **** malformed patch at line 167: * dev_ops for virtio, bare necessities for basic operation Seems like the way you were generating the patch is wrong. Anyway, I applied it manually, with the "- frame_size" fix as well as few more minor coding style fixes. So applied to dpdk-next-virtio. --yliu
> >On Thu, Sep 29, 2016 at 04:31:30PM -0400, Dey wrote: >> /* >> * 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 > >Your patch is malformed: I got an error while trying to apply it. > > patch: **** malformed patch at line 167: * dev_ops for virtio, > bare necessities for basic operation > >Seems like the way you were generating the patch is wrong. > >Anyway, I applied it manually, with the "- frame_size" fix as well >as few more minor coding style fixes. > >So applied to dpdk-next-virtio. Hi Yuanhan/Souvik, Given my contributions to this patch (and in particular since comments from here - http://dpdk.org/ml/archives/dev/2016-September/047208.html - were copied directly into the commit message), I think that I should have been added as co-author of the patch? Let me know if you think that I am mistaken. Thanks in advance, Mark > > --yliu
On Mon, Oct 10, 2016 at 10:49:22AM +0000, Kavanagh, Mark B wrote: > > > >On Thu, Sep 29, 2016 at 04:31:30PM -0400, Dey wrote: > >> /* > >> * 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 > > > >Your patch is malformed: I got an error while trying to apply it. > > > > patch: **** malformed patch at line 167: * dev_ops for virtio, > > bare necessities for basic operation > > > >Seems like the way you were generating the patch is wrong. > > > >Anyway, I applied it manually, with the "- frame_size" fix as well > >as few more minor coding style fixes. > > > >So applied to dpdk-next-virtio. > > Hi Yuanhan/Souvik, > > Given my contributions to this patch (and in particular since comments from here - http://dpdk.org/ml/archives/dev/2016-September/047208.html - were copied directly into the commit message), I think that I should have been added as co-author of the patch? Mark, I appreciate your contributions here. But for this case, I think it might not be enough for adding you as the co-author: you don't co-write the code with Souvik after all. However, I'd suggest you to add your "Reviewed-by" if a patch looks to you after your review effort. This is another way to recognize your contributions to a patch. Thanks. --yliu > > Let me know if you think that I am mistaken. > > Thanks in advance, > Mark > > > > --yliu
>-----Original Message----- >From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] >Sent: Tuesday, October 11, 2016 5:01 AM >To: Kavanagh, Mark B <mark.b.kavanagh@intel.com> >Cc: Dey <sodey@sonusnet.com>; stephen@networkplumber.org; dev@dpdk.org >Subject: Re: [PATCH v7] net/virtio: add set_mtu in virtio > >On Mon, Oct 10, 2016 at 10:49:22AM +0000, Kavanagh, Mark B wrote: >> > >> >On Thu, Sep 29, 2016 at 04:31:30PM -0400, Dey wrote: >> >> /* >> >> * 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 >> > >> >Your patch is malformed: I got an error while trying to apply it. >> > >> > patch: **** malformed patch at line 167: * dev_ops for virtio, >> > bare necessities for basic operation >> > >> >Seems like the way you were generating the patch is wrong. >> > >> >Anyway, I applied it manually, with the "- frame_size" fix as well >> >as few more minor coding style fixes. >> > >> >So applied to dpdk-next-virtio. >> >> Hi Yuanhan/Souvik, >> >> Given my contributions to this patch (and in particular since comments from here - >http://dpdk.org/ml/archives/dev/2016-September/047208.html - were copied directly into the >commit message), I think that I should have been added as co-author of the patch? > >Mark, > >I appreciate your contributions here. But for this case, I think it >might not be enough for adding you as the co-author: you don't co-write >the code with Souvik after all. > >However, I'd suggest you to add your "Reviewed-by" if a patch looks to >you after your review effort. This is another way to recognize your >contributions to a patch. No problem Yuanhan - thanks for clarifying. Reviewed-by: Mark Kavanagh <mark.b.kavanagh@intel.com> > >Thanks. > > --yliu > > >> >> Let me know if you think that I am mistaken. >> >> Thanks in advance, >> Mark >> > >> > --yliu
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); + 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,