From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4C27DA034F; Mon, 30 Aug 2021 16:27:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA84841102; Mon, 30 Aug 2021 16:27:37 +0200 (CEST) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by mails.dpdk.org (Postfix) with ESMTP id 5EA59410F3 for ; Mon, 30 Aug 2021 16:27:34 +0200 (CEST) Received: by mail-lj1-f174.google.com with SMTP id j12so26183650ljg.10 for ; Mon, 30 Aug 2021 07:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nfware.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3jIgzZ3EmW1KrgVIAZtGVe/ZLyx6LOQM39qunOg+d2g=; b=Iltdgv7BRcMVhsW+c3aO8cN5bWs+xcaVukLOyVxlJBHHEiZq50sWao7JcBM8zwAvaD aKD5/IdOAfMDnvouxEqhkLvr8EV1ZrEdEoY7xCzlGKyQ4BTc0ozRw1o8wCPA4mfw4tvZ XI0Et8gR8Yuev9aLkxW5GDKZHDt/Z02NbU0VKH7GxCKCcJQqc7oA7iJgRYWBKtfXFzv8 rVy5GIEtXaaseeAyHpF8pUf3FAKHCtEGiUUvmjiKYCn85MoRSPCF6vZ8lxisIK7OlQh/ sZTgHsvkg9WvT76Q4x840KX/a6krJ6w+lZ1E4RhsVaO4W/962vOLF/5bFO3WkfhPfsYy Xg6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3jIgzZ3EmW1KrgVIAZtGVe/ZLyx6LOQM39qunOg+d2g=; b=G1Apas+qvpR58nYsNc9ROby0hLGTpjt593NJjTgOK6Q7sgbn4ZiOKwVVRZuQwPmhBP t0uVba1iTbYffKONISuW6zNMynJcgKcmQSDxvbthcq3uq23Nnb93UfySfk62R4jWpZrN 55nR6fmwl8wchSmbGlboecc/qaVZtbpoXBTciMzosFZSN6C+Pvc+D4q3yc8tZ8QIOXrq SzeMSlbMb8+TKMC33bGwuQHa3TBy/BCdGZfHDGPzqSn/DnL79RFd1ExarKu+VamPgHSu 0h+jJaUC8VYoo8GEIRtzEDUNis9rPpj8L3KXVM9Dsu/eYXC324ijPHTfUSrqLSMioJll IalQ== X-Gm-Message-State: AOAM531uLB+yDMdF22MnAhb0Dyq+Yubp28kobwJM3P4w6b63DhNMiZbu KLC+Thq1YRE9xd16A725O87l4474Uc++tg== X-Google-Smtp-Source: ABdhPJy8w73TAahBVOpnWqYHrNW43UVBmJu2ZMVWQuoU9XVagInhcwvf3GDRjP7hv/kn58rpncm+Sg== X-Received: by 2002:a05:651c:1131:: with SMTP id e17mr20766346ljo.301.1630333653657; Mon, 30 Aug 2021 07:27:33 -0700 (PDT) Received: from localhost.localdomain ([77.105.181.112]) by smtp.gmail.com with ESMTPSA id p1sm692516lfo.255.2021.08.30.07.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 07:27:32 -0700 (PDT) From: Igor Ryzhov To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Mon, 30 Aug 2021 17:27:30 +0300 Message-Id: <20210830142731.32524-2-iryzhov@nfware.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210830142731.32524-1-iryzhov@nfware.com> References: <20210826151911.15699-1-iryzhov@nfware.com> <20210830142731.32524-1-iryzhov@nfware.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 2/3] kni: implement basic get_link_ksettings callback X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" It allows inspecting link parameters using ethtool. Signed-off-by: Igor Ryzhov --- kernel/linux/kni/kni_net.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c index 611719b5ee27..931b9daf104f 100644 --- a/kernel/linux/kni/kni_net.c +++ b/kernel/linux/kni/kni_net.c @@ -820,9 +820,34 @@ static void kni_get_drvinfo(struct net_device *dev, strlcpy(info->driver, "kni", sizeof(info->driver)); } +#ifdef ETHTOOL_GLINKSETTINGS +static int kni_get_link_ksettings(struct net_device *dev, + struct ethtool_link_ksettings *settings) +{ + struct kni_dev *kni = netdev_priv(dev); + + settings->base.port = PORT_OTHER; + + if (netif_carrier_ok(dev)) { + settings->base.speed = kni->speed; + settings->base.duplex = kni->duplex; + settings->base.autoneg = kni->autoneg; + } else { + settings->base.speed = SPEED_UNKNOWN; + settings->base.duplex = DUPLEX_UNKNOWN; + settings->base.autoneg = AUTONEG_ENABLE; + } + + return 0; +} +#endif + static const struct ethtool_ops kni_net_ethtool_ops = { .get_drvinfo = kni_get_drvinfo, .get_link = ethtool_op_get_link, +#ifdef ETHTOOL_GLINKSETTINGS + .get_link_ksettings = kni_get_link_ksettings, +#endif }; void -- 2.33.0