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 23975A0A0C; Sun, 4 Jul 2021 18:06:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0155141103; Sun, 4 Jul 2021 18:06:16 +0200 (CEST) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by mails.dpdk.org (Postfix) with ESMTP id DF4E340040 for ; Sun, 4 Jul 2021 18:06:13 +0200 (CEST) Received: by mail-lf1-f45.google.com with SMTP id n14so27874209lfu.8 for ; Sun, 04 Jul 2021 09:06:13 -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=Q9/vNNMT4nnytakN8Dft3ScPrtIGO/IMNSZcz8qAwx8=; b=kBawFGUEoFuK/18kN547FGEE3YjXKXU4VV8RNwgV4MpeworrvJW2taMmgrJGO8hJZt hOJXuiCo2AwyPsRPXgIDBj5GdXitdzAU0l9+Czjlvc+CMyPuSvPaCNiLnXU7nIEqP2uY r1N8CJMXHYaJ4bEtXhE1c3l0zNvtWAI0Tev5QYWDwC38iWjnC5nQY6Zv4up5uwweZqYM 7WjkFEC4jvWtRtyDzgcIwQ1UhPFiO5OAlnpgxVSj8D/o0ZeTR/qZNVNWwKLmPCtvt/Pr ONFYNQ3z+aTCcn8sx1kIsBvrrW1fLjhTZ3ZfYXBVVfob5mNII7KUsvkyK8+swBC+Z/xi 7akg== 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=Q9/vNNMT4nnytakN8Dft3ScPrtIGO/IMNSZcz8qAwx8=; b=kU9An8melUwhSyKOe6zaZ/UOlwU7k5mfQ14iUVxluUpHF3+wkX0PWGQI02uYMkY6qV I9dL9wh8c/A5GOLWRPxql/k/dpVFSYF96BiQlw8UyIcZ25Y4oNCseNTnH00utC7cuYm3 z6zsO3pWv4973n+sc4bYoAQJFfpQE0UNYBQ9Mb5V5uOHe0TmIKymbYgOD9TsjNheRFrl KthTo3+egpD/wjIFOmRzxXHH8R4aWgLtNY/hTOIG2hqX7jRh1Fsd4YHZNeIAVUcjK5xx J1IqAcesoZDySdf6MnLSUUk47CdmAAGj+eGwQLAY5O3NQeRPozI+TC8DMMkCqEQ5NrFM I2TA== X-Gm-Message-State: AOAM531bLrBdv70N2/pyu5LtX7uooKrCw0/WpzYfo8Y341wBIDWHztCr 0eW5txHTf8gVX0Iw5eUafBz6S6gr08Z/wQ== X-Google-Smtp-Source: ABdhPJyjiKnKHFp5GoAg2X/rTGmrclTgE0oP5/e5Lsh5hA0oX84Zc5EW2zyKbpN5THPZM0OLcHFKsw== X-Received: by 2002:ac2:4d93:: with SMTP id g19mr7107240lfe.475.1625414773178; Sun, 04 Jul 2021 09:06:13 -0700 (PDT) Received: from localhost.localdomain ([77.105.178.215]) by smtp.gmail.com with ESMTPSA id 125sm482056lfm.173.2021.07.04.09.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 09:06:12 -0700 (PDT) From: Igor Ryzhov To: dev@dpdk.org Cc: ferruh.yigit@intel.com, dg@adax.com Date: Sun, 4 Jul 2021 19:06:09 +0300 Message-Id: <20210704160610.62682-2-iryzhov@nfware.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210704160610.62682-1-iryzhov@nfware.com> References: <20190924193312.17381-1-iryzhov@nfware.com> <20210704160610.62682-1-iryzhov@nfware.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 2/2] 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" 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 99da8d37dd6b..84357bec1341 100644 --- a/kernel/linux/kni/kni_net.c +++ b/kernel/linux/kni/kni_net.c @@ -805,9 +805,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.32.0