From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by dpdk.org (Postfix) with ESMTP id AF4A5106B for ; Tue, 16 Jun 2015 08:40:28 +0200 (CEST) Received: by pacgb13 with SMTP id gb13so6658922pac.1 for ; Mon, 15 Jun 2015 23:40:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/ijTMjN5I1rAfpn5z/RKon7tuKlst+3WDnBCe0vzqx4=; b=rbb32ukTGNLQWMBNb88VI0bRlOBX/QF4FbY1o5LhlTloP6ffY+fec3By/+SBKKaNw0 Rex5gxP6QWyngq6lXqy5qrD4xllgwWQSOlvXEYm6lGcq62tkJkJfOlv1e40sr8dltGHB nCYKmh2mR4x01V8Rs6d/qfML0S4KfVNt9E/8XxXcaKiFbEYEkfkW3HgGn/ouZjLssaSo DsMyr3Lm39yu0z1fACJGC661pS6mWAsESAUYU/+JD63P0/pgrVGr7QBxQ0MCCmyydR0d YQdk0c8F1KhTom2aU2Kq3BvOf5naPYCJ62f9W1Lit8vPf69VpGIWAbqjPGhhWEYvEIUE 0W0Q== X-Received: by 10.66.163.38 with SMTP id yf6mr55313175pab.115.1434436828073; Mon, 15 Jun 2015 23:40:28 -0700 (PDT) Received: from localhost.localdomain.com ([144.49.130.148]) by mx.google.com with ESMTPSA id de4sm52800pbb.95.2015.06.15.23.40.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2015 23:40:27 -0700 (PDT) From: Vijayakumar Muthuvel Manickam To: dev@dpdk.org Date: Tue, 16 Jun 2015 02:39:54 -0400 Message-Id: <1434436794-27636-1-git-send-email-mmvijay@gmail.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <20150615090904.4b4d45a5@urahara> References: <20150615090904.4b4d45a5@urahara> Subject: [dpdk-dev] [PATCH v3] kni: Add link status update 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: Tue, 16 Jun 2015 06:40:29 -0000 Implement .ndo_change_carrier to enable DPDK applications to propagate link state changes to kni virtual interfaces through sysfs Signed-off-by: Vijayakumar Muthuvel Manickam --- Added kernel version check as .ndo_change_carrier is available only in kernel versions 3.9 and after lib/librte_eal/linuxapp/kni/kni_net.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index dd95db5..9f9022b 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -632,6 +632,17 @@ static int kni_net_set_mac(struct net_device *netdev, void *p) return 0; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) +static int kni_net_change_carrier(struct net_device *dev, bool new_carrier) +{ + if (new_carrier) + netif_carrier_on(dev); + else + netif_carrier_off(dev); + return 0; +} +#endif + static const struct header_ops kni_net_header_ops = { .create = kni_net_header, .rebuild = kni_net_rebuild_header, @@ -648,6 +659,9 @@ static const struct net_device_ops kni_net_netdev_ops = { .ndo_get_stats = kni_net_stats, .ndo_tx_timeout = kni_net_tx_timeout, .ndo_set_mac_address = kni_net_set_mac, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) + .ndo_change_carrier = kni_net_change_carrier, +#endif }; void -- 1.8.1.4