From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id CA28BF923 for ; Mon, 13 Feb 2017 15:28:49 +0100 (CET) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 435BD4E33D; Mon, 13 Feb 2017 14:28:50 +0000 (UTC) Received: from max-t460s.redhat.com (ovpn-117-88.ams2.redhat.com [10.36.117.88]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1DESW1B014561; Mon, 13 Feb 2017 09:28:47 -0500 From: Maxime Coquelin To: aconole@redhat.com, sodey@sonusnet.com, yuanhan.liu@linux.intel.com, jianfeng.tan@intel.com, dev@dpdk.org Cc: Maxime Coquelin Date: Mon, 13 Feb 2017 15:28:18 +0100 Message-Id: <20170213142820.8964-6-maxime.coquelin@redhat.com> In-Reply-To: <20170213142820.8964-1-maxime.coquelin@redhat.com> References: <20170213142820.8964-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 13 Feb 2017 14:28:50 +0000 (UTC) Subject: [dpdk-dev] [PATCH 5/7] net/vhost: Implement mtu_set callback X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2017 14:28:50 -0000 This patch implements the eth_dev's mtu_set callback. Signed-off-by: Maxime Coquelin --- doc/guides/nics/features/vhost.ini | 1 + drivers/net/vhost/rte_eth_vhost.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/doc/guides/nics/features/vhost.ini b/doc/guides/nics/features/vhost.ini index 23166fb..590dadb 100644 --- a/doc/guides/nics/features/vhost.ini +++ b/doc/guides/nics/features/vhost.ini @@ -11,3 +11,4 @@ Basic stats = Y Extended stats = Y x86-32 = Y x86-64 = Y +MTU update = Y diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index e98cffd..75feef1 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -575,6 +575,8 @@ new_device(int vid) for (i = 0; i < rte_vhost_get_queue_num(vid) * VIRTIO_QNUM; i++) rte_vhost_enable_guest_notification(vid, i, 0); + rte_vhost_mtu_get(vid, ð_dev->data->mtu); + eth_dev->data->dev_link.link_status = ETH_LINK_UP; rte_atomic32_set(&internal->dev_attached, 1); @@ -966,6 +968,21 @@ eth_link_update(struct rte_eth_dev *dev __rte_unused, return 0; } +static int +eth_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) +{ + if (dev->data->dev_link.link_status != ETH_LINK_UP) + return -EAGAIN; + + if (!dev->data->mtu) + return -ENOTSUP; + + if (dev->data->mtu != mtu) + return -EINVAL; + + return 0; +} + /** * Disable features in feature_mask. Returns 0 on success. */ @@ -1002,6 +1019,7 @@ static const struct eth_dev_ops ops = { .rx_queue_release = eth_queue_release, .tx_queue_release = eth_queue_release, .link_update = eth_link_update, + .mtu_set = eth_mtu_set, .stats_get = eth_stats_get, .stats_reset = eth_stats_reset, .xstats_reset = vhost_dev_xstats_reset, -- 2.9.3