From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0044.outbound.protection.outlook.com [104.47.32.44]) by dpdk.org (Postfix) with ESMTP id EFE57F94 for ; Wed, 7 Sep 2016 06:21:33 +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=6wUp0d2zg2vRy70dmsnqgKZK3TCx2a0JCv+gYtmdlb8=; b=L4kYuAJUOgN+mboAjgS9fmv/6EwJOcapvuCVYQNv0L4+D+r2G0Exl43nwBCQBBFNsBBBsu1V4ZpIxn8+HD3JL6UVQSLoPHw4eOSdWl0lOWGj0kV1/C1//PwTL4wlN3FPkDMNlz2KFgVSFhF5mWf9HweoW5hTn3+wVeYbq8p/XGk= Received: from BN3PR03MB1494.namprd03.prod.outlook.com (10.163.35.145) by BN3PR03MB1495.namprd03.prod.outlook.com (10.163.35.146) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.9; Wed, 7 Sep 2016 04:21:30 +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.0599.016; Wed, 7 Sep 2016 04:21:30 +0000 From: "Dey, Souvik" To: "dev@dpdk.org" , "stephen@networkplumber.org" , "yuanhan.liu@linux.intel.com" Thread-Topic: [PATCH v4]net/virtio: add mtu set in virtio Thread-Index: AQHSCL7xEgAVZJyiaUu1GlORUNZIaKBtbHzg Date: Wed, 7 Sep 2016 04:21:30 +0000 Message-ID: References: <20160907041832.35384-1-sodey@sonusnet.com> In-Reply-To: <20160907041832.35384-1-sodey@sonusnet.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: [66.30.138.194] x-ms-office365-filtering-correlation-id: f1201534-64c7-4978-955e-08d3d6d671c7 x-microsoft-exchange-diagnostics: 1; BN3PR03MB1495; 6:QljsFQ4WRX2PE1VNBN8Qg1xMP+GKrQgGxFTvn+EuSgtXfPT86Gyxjm07rvrUgESE+NHtQ0pNVub4bWxPFsyRFODGi8PqZH0lIM4WAvWZaxSiQrkqPmXEo+2r25W0G9L+kfbZGYspHPwdtn2TO4Rl8Zv3/F2ONT+0yhVOeHflFFnHgZOprTOFyapeZABInVJf8tyEMVvdtBNHkTGwoWmzJ66IkCc+IqyXzzZoJ46T87LtlN7KMAq5IZaOclAn9Td5pPSzuVVXQD05Ohd/WorUWdNzQUqwC16cQCcVmmHzuHs=; 5:4g3DWo6nCAKENrOYL4YV0XAP3gZY8KtKhUN5521SToQydEU4C+bFp3hHpJtfWZdeb5zo+7RvHPBzHNc613jOn3V0CagEiUCzaRTARjlFq3mlYZDglsxwQleFUvYZAparK6Ma+Ae/WG7TXsTzjYQgAg==; 24:gAAqLtX4gFDMqfZbgy7leDA9aqt2yNLuzB4IaSecM92VUDcL2nOPjI1Lp6wefWd+/pAKV8VWh2pb8lMCHrQNgKdNzNPpdiM7axRbTkqDiHY=; 7:EEjsj4DKb+Etuu5wgAwRV1GTDSXRsqnPWDAocgPChB2fAZspCtsO59OCuSXEjc/7jFZz1yvESXfIdZaWMVvmd2kFJMKsNqtEXxTGttbBG59aL+/TeS23fn9cxMn3C9dZ4uHyntC//ewSlPWR+AhzsZ4O6LqxNdZhwE5u6ldp7qa8cUYvvVCrqLeliRwEET319TmeK2OE04hBwZ6PT3pZKds42UOh01Y2hurRoKTX3y8ldX2MEjV0WLtNEtHjEHC2 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1495; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BN3PR03MB1495; BCL:0; PCL:0; RULEID:; SRVR:BN3PR03MB1495; x-forefront-prvs: 0058ABBBC7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(377454003)(199003)(13464003)(189002)(3900700001)(105586002)(81156014)(2501003)(87936001)(8936002)(19580395003)(7736002)(19580405001)(7696003)(97736004)(86362001)(76576001)(106356001)(107886002)(5001770100001)(8676002)(7846002)(76176999)(2201001)(50986999)(9686002)(92566002)(2906002)(54356999)(68736007)(586003)(106116001)(10400500002)(77096005)(3660700001)(33656002)(3846002)(6116002)(102836003)(11100500001)(74316002)(2950100001)(2900100001)(122556002)(3280700002)(66066001)(305945005)(189998001)(99286002)(5660300001)(5002640100001)(101416001)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB1495; H:BN3PR03MB1494.namprd03.prod.outlook.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) 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: 07 Sep 2016 04:21:30.7435 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 29a671dc-ed7e-4a54-b1e5-8da1eb495dc3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB1495 Subject: Re: [dpdk-dev] [PATCH v4]net/virtio: add mtu set in virtio X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2016 04:21:34 -0000 Hi Liu, Submitted the version 4 of the patch as you suggested , and have removed t= he Reviewed by line. I have still kept the function definition as to follow the same suit as we = have done for other eth_dev_ops. -- Regards, Souvik -----Original Message----- From: Dey, Souvik=20 Sent: Wednesday, September 7, 2016 12:19 AM To: dev@dpdk.org; stephen@networkplumber.org; yuanhan.liu@linux.intel.com Cc: Dey, Souvik Subject: [PATCH v4]net/virtio: add mtu set in virtio Virtio interfaces should also support setting of mtu, as in case of cloud i= t is expected to have the consistent mtu across the infrastructure that the= dhcp server sends and not hardcoded to 1500(default). Changes in v4: Incorporated review comments. Changes in v3: Corrected few style errors as reported by sys-stv. Changes in v2: Incorporated review comments. Signed-off-by: Souvik Dey --- drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio= _ethdev.c index 07d6449..da16ad4 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -92,6 +92,7 @@ static void virtio_mac_addr_add(struct rte_eth_dev *dev, = static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index= ); static void virtio_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); +static int virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); =20 static int virtio_dev_queue_stats_mapping_set( __rte_unused struct rte_eth_dev *eth_dev, @@ -652,6 +653,16 @@ virtio_dev= _allmulticast_disable(struct rte_eth_dev *dev) PMD_INIT_LOG(ERR, "Failed to disable allmulticast"); } =20 +static int +virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { + struct virtio_hw *hw =3D dev->data->dev_private; + if (mtu < VIRTIO_MIN_RX_BUFSIZE || mtu > VIRTIO_MAX_RX_PKTLEN) { + PMD_INIT_LOG(ERR, "Mtu should be between 64 and 9728\n"); + return -EINVAL; + } + return 0; +} + /* * dev_ops for virtio, bare necessities for basic operation */ @@ -664,6 +675,7 @@ static const struct eth_dev_ops virtio_eth_dev_ops =3D = { .promiscuous_disable =3D virtio_dev_promiscuous_disable, .allmulticast_enable =3D virtio_dev_allmulticast_enable, .allmulticast_disable =3D virtio_dev_allmulticast_disable, + .mtu_set =3D virtio_mtu_set, =20 .dev_infos_get =3D virtio_dev_info_get, .stats_get =3D virtio_dev_stats_get, -- 2.9.3.windows.1