From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0065.outbound.protection.outlook.com [104.47.37.65]) by dpdk.org (Postfix) with ESMTP id 112A42BD1 for ; Tue, 30 Aug 2016 01:02:57 +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=PwsnXwkvPPgo4MhfZUmv+mcLIohTKcKMzNPi3bPWRM0=; b=eARmd11++33aV/SonY73Cj26NNLzRqliDN3p48ynf2RD2fklW20W5culYu4khG20eCV9sKdnA2mUE45gpxzwZG2JKs7pgA357oqsmL2Lni5mdAvbCq+7cDrnl31QUF0ZV25uoQ+EDlB8cWhirh4c0bEPyf2x9zPYIA4LLjqEPPk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sodey@sonusnet.com; Received: from SODEY-LMA.sonusnet.com (2601:191:8300:9cda:dd87:47c2:f8d0:dc97) by MWHPR03MB2750.namprd03.prod.outlook.com (10.168.207.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Mon, 29 Aug 2016 23:02:52 +0000 From: souvikdey33 To: , , CC: , souvikdey33 Date: Mon, 29 Aug 2016 19:02:40 -0400 Message-ID: <20160829230240.20164-1-sodey@sonusnet.com> X-Mailer: git-send-email 2.9.3.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2601:191:8300:9cda:dd87:47c2:f8d0:dc97] X-ClientProxiedBy: DM5PR20CA0035.namprd20.prod.outlook.com (10.171.161.149) To MWHPR03MB2750.namprd03.prod.outlook.com (10.168.207.148) X-MS-Office365-Filtering-Correlation-Id: fc3355bf-a445-43f2-2ee3-08d3d0609b2f X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2750; 2:o28UEhersEtnxZOFf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+wXuvf26uxlyvUC52wenH6RF1/xvyp0Kp4cxqiujMAvax90nM+kTq6aK7uXNa6hSb+nIp27N7kDNXeG4prKJa7naCpiemzXK5obAd88C/Sxr+0Dj8XsU5iAn18mdeYw/d8k18yLgQx0Jnqg0UTfL5H3/tlZDGd+eIStfF8bpcO1AXcybn7HQ6ylMMlbmazHc9NDSgMtZaBieoA5K+XT1P00CVyX5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:MWHPR03MB2750; BCL:0; PCL:0; RULEID:; SRVR:MWHPR03MB2750; X-Forefront-PRVS: 0049B3F387 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(4001430100002)(50226002)(81156014)(586003)(36756003)(33646002)(81166006)(8676002)(68736007)(86152002)(86362001)(50986999)(105586002)(7846002)(42186005)(2201001)(6116002)(106356001)(101416001)(5003940100001)(50466002)(4326007)(2906002)(5660300001)(229853001)(48376002)(107886002)(305945005)(53416004)(189998001)(7736002)(92566002)(5001770100001)(47776003)(97736004)(77096005)(19580405001)(69596002)(19580395003)(1076002)(43062003)(3826002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2750; H:SODEY-LMA.sonusnet.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) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2750; 23:ZDcVF0DZ12xAQFtTMZQc/AUsXSEiG6KHejer8302y?= =?us-ascii?Q?Ti2RIiHnz4z6iD93B0rBtrfLjCgKk9BF3tJSOgCHRLoWUpfNXZbmVzsmYwYw?= =?us-ascii?Q?o7koo+GdJejR6Vz6BUS8DhCPvW8bdt9FMtZ98vwTPXw85u6PaBD0pygUj+pX?= =?us-ascii?Q?1Iu06GXDB+MlD71fV+ghfO8StQLon7PHfMAYAEe5YVoyddtOrnNFjQrZazM6?= =?us-ascii?Q?w0zk+tIliJGLyVolvek1ZQI93hy6uW3a9A6rJR3byoKyqmvMHbZKWJ2D/mFB?= =?us-ascii?Q?Uf/iceyPs/9dcQVxGgGzfriXOpxH3aI2pL9SzlslNHCuNrfFo1Jn0okG15QX?= =?us-ascii?Q?W6olEYjk/dhhacCO52MLvb/7126qlja6W5sFWMKD+s9VQapz3TwtHGE4pDg3?= =?us-ascii?Q?UxUwo1IWD2VwoCdIqv0HyGu5TLgae/bOKhrZLKTMVUTukuMOuTmARsY+bIiv?= =?us-ascii?Q?GkANP1Ehhzrp+JSfU6H1XdgAA4TprvUtmd64BPl+onFgfurCBsClp7dtWmad?= =?us-ascii?Q?u5KtvAlrMIn9TiA6W9cvKzU52JOcY95Z66ghhIdCoGzousmRASqzP4U4BShc?= =?us-ascii?Q?pgsrLQwgpgvfrK6ppToZjOpjt4Lv+Z4Fn1nltkr7VFmHvdXonW3UcHAyppt9?= =?us-ascii?Q?CueouheEruF/Ey+GNN7irRL2KZ7OW7OtDWxvTDA5BDY8uodTOzktoBHQjx+H?= =?us-ascii?Q?xz08lktO4/yhfO6X4OfG/WCMy9c7E5A706hwMXDtZWUJvjrYDgWBLeYRRW5i?= =?us-ascii?Q?+6y0xQjRyo6a0kZZDay4Y4eixHlBYIA3nNJAzXETXOb1sZYs4p7RAMbVFn+q?= =?us-ascii?Q?OE3axWXTQDa5El3mkULcpWIA+35bmpqajZMoNUqzT9asPQrudLdjMbP547LU?= =?us-ascii?Q?ReoCD3tAOx6bXGSvQtKGsW1QDVE39oa3h12yifs4q4I91YXFDpsYwgiXDj5c?= =?us-ascii?Q?oiLQ28xVpum6tGaYEGa2twWMYpw5qqIW/WxxwWgB+E2+wWuNnvojmmDq5G1P?= =?us-ascii?Q?ugpMaY2DtIMroFKv0qO1I4u9Rimil1F2D17tCQVyz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etadata: NSPM X-OriginatorOrg: sonusnet.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2016 23:02:52.2245 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2750 Subject: [dpdk-dev] [PATCH v2] 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: Mon, 29 Aug 2016 23:02:57 -0000 Signed-off-by: Souvik Dey Fixes: 1fb8e8896ca8 ("Signed-off-by: Souvik Dey ") Reviewed-by: Stephen Hemminger Virtio interfaces should also support setting of mtu, as in case of cloud it is expected to have the consistent mtu across the infrastructure that the dhcp server sends and not hardcoded to 1500(default). --- 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); 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"); } +static int +virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) +{ + struct virtio_hw *hw = 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." + 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 = { .promiscuous_disable = virtio_dev_promiscuous_disable, .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, -- 2.9.3.windows.1