From nobody Thu Nov 28 13:52:37 2024 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72523198E91 for ; Wed, 2 Oct 2024 09:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727859828; cv=none; b=hzBzUZpFNaYn6y2c6NGD3aNOTfWuKHPe2sLSBptbB0g96wmgmEnfOM1wGxPUXuqgA5WBdlX5dHohQDdjshqZcmwlapwKjMj3doYEjU16v8gRUTwyLUx9NSHNXHtNj7SCqzQbZuf47Uy+O4eq8bzAFJzAg1APPy+H4vSJVAJJQ+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727859828; c=relaxed/simple; bh=0HczZybwcOvyDCXb/Fw0Kq345nQiLm5f4dZXh7KvAg0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AuYMDHfAga4OdEfshdFTQt+bZkzTuTCiS3EuvSA1ZShcxBHUITGlmiaEKD9OGyOpxAW05PsbbEF1HJbc2EYvkAnKIkQLMx5tqaeCvn1LMInTjiM8Yd1wyURrSCQHuzm0IcwEvfEyMgYiT0JevhHgowurLzQpAd2Gsbm8B+mlmrA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=openvpn.net; spf=pass smtp.mailfrom=openvpn.com; dkim=pass (2048-bit key) header.d=openvpn.net header.i=@openvpn.net header.b=BNRIXeeU; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=openvpn.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=openvpn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=openvpn.net header.i=@openvpn.net header.b="BNRIXeeU" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-42cbc22e1c4so48306245e9.2 for ; Wed, 02 Oct 2024 02:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1727859824; x=1728464624; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Jtid/4Ggea81hP8xAarmxZwacDuX1oN1onp/X4GHPpc=; b=BNRIXeeUiKFWw0PuShIhM0vt8kJnlsZHwe24vpmp6S4QViLAXL3tBONMniNN/eEOFZ N6QopwbtJOmlfeuv3EnHUDv5JujinXaS5n/Ipe7VdBs1MBiXaosDQAR8qykFxvOkbwHo 9l1V7b2NZD3JfocF96Jufnajr6ID4VSfEpyLr2XjHon776PAN84yB9mA4/+JdhRF4IH+ 3kTj0IXQOBuYeFbL3vqsKi4krvY0uKSPEC1CcwBdvLtymz8IbdXH7JY8KCM81UOsoLmX VY+OvMd54b09hufruFIMskQBaGoGcZiyw45WjosHUo2B6CDblPuWJYrP1oHR/EUnrKS3 wDcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727859824; x=1728464624; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jtid/4Ggea81hP8xAarmxZwacDuX1oN1onp/X4GHPpc=; b=EtLZhURkl7pIKFO6/hRaSD9CVgYTZlREDVWIb86Wu2mJTRq3YLCYYHeSyPXQ0zhOGX XfaL1Ui3p4HiI1OMp62ymKlEh2PQh8vqQKcHUiMPELD/l+fqdrOfpkO8pZwYyS4bN02G HTNulnWPDbvz/pLW3AIqFCD++KsYCMjSkgLW4jEkFJe271YlTRXhq/o0kLNNnuDcPeQU eTf0jh1ss4nhL7uhk3V60mgn9B4zDKGuQrfnDTMoGfgiXTt/a6DZkOBgZjOGDBVwccE3 5L13IKyD7h4SHTcT3/Uy9IJTf0XEt3Peto4/ZjlfNMDiCPoJpB49hCjrjqe2RyJvd90O NzWQ== X-Forwarded-Encrypted: i=1; AJvYcCVZpv0Ha3UzRaSQd06GE2W3gs5bwyAoG0DMFdiH64UQ28bVJ1gBZ/pDvwPAXLIPLaVFquBnXMqk46mEnK0=@vger.kernel.org X-Gm-Message-State: AOJu0YwPl73vJ7gf96hLj0qJ4CSCP0Zi+ZgrQU1usFz7r5+RuAPiUCsL zrJLyGmUKJd8rz0Ynv0XR77QsN42G+PX0gg/6LbzQbrzSiHctvAwvCtemRSsdzs= X-Google-Smtp-Source: AGHT+IHF+moQuogaubmFiV9fQExZlkakNdb2tJX5ZJm8bc81FDHr5npglK+ha3mscDcMX8g5JXpqFQ== X-Received: by 2002:a5d:498e:0:b0:37c:c4b4:3396 with SMTP id ffacd0b85a97d-37cfb9d454cmr1409760f8f.29.1727859823678; Wed, 02 Oct 2024 02:03:43 -0700 (PDT) Received: from serenity.mandelbit.com ([2001:67c:2fbc:1:da6e:ecd8:2234:c32e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd56e8822sm13602320f8f.50.2024.10.02.02.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 02:03:43 -0700 (PDT) From: Antonio Quartulli Date: Wed, 02 Oct 2024 11:02:37 +0200 Subject: [PATCH net-next v8 23/24] ovpn: add basic ethtool support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-b4-ovpn-v8-23-37ceffcffbde@openvpn.net> References: <20241002-b4-ovpn-v8-0-37ceffcffbde@openvpn.net> In-Reply-To: <20241002-b4-ovpn-v8-0-37ceffcffbde@openvpn.net> To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Donald Hunter , Antonio Quartulli , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sd@queasysnail.net, ryazanov.s.a@gmail.com, Andrew Lunn X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1696; i=antonio@openvpn.net; h=from:subject:message-id; bh=0HczZybwcOvyDCXb/Fw0Kq345nQiLm5f4dZXh7KvAg0=; b=owEBbQGS/pANAwAIAQtw5TqgONWHAcsmYgBm/QxTy21F+BrAC+0BHzA21YyFzTw73Iap1BeA4 QiQ06zZYkaJATMEAAEIAB0WIQSZq9xs+NQS5N5fwPwLcOU6oDjVhwUCZv0MUwAKCRALcOU6oDjV hxhlB/0TB9PzRSCIcixOB4y3zYbwFDJCgJpMby3jkPceLt/4GRyPssjFpp1QvRt6sfyxB8Ziu1g 2hTw0pKX8RiWiL2jFFVo5FLFbDhwvwMNMz9eN2MCTfedFMiA5gwsaXC4imQl1Vm5E/pOyTLSTWk uxbDvdTbGs8yYLpw0H9Xk+ZEowVBaV0+T+Vu+FFXhPk7n53ixreCGgtlpLNRa0W9Qr5WauUflbz 2dUFL+63/+z0Hs0UcFJ3B0bn95TYVTEUkp+dCcOh9uvOVZ8R4dnEPkw/b4m08Bq430+ERb0uEOD v3c1k8Ix+/5ZTqpyC/1OUGvmYxFqYPXNS1+sfxe3AZGBkpUL X-Developer-Key: i=antonio@openvpn.net; a=openpgp; fpr=CABDA1282017C267219885C748F0CCB68F59D14C Implement support for basic ethtool functionality. Note that ovpn is a virtual device driver, therefore various ethtool APIs are just not meaningful and thus not implemented. Signed-off-by: Antonio Quartulli Reviewed-by: Andrew Lunn --- drivers/net/ovpn/main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/ovpn/main.c b/drivers/net/ovpn/main.c index 6048df5890c8fa46f3d91498903b4277a33f06db..a164b6ca2a4b8d69a76938fcd1b= 76d1f2e563dd8 100644 --- a/drivers/net/ovpn/main.c +++ b/drivers/net/ovpn/main.c @@ -7,6 +7,7 @@ * James Yonan */ =20 +#include #include #include #include @@ -137,6 +138,19 @@ bool ovpn_dev_is_valid(const struct net_device *dev) return dev->netdev_ops->ndo_start_xmit =3D=3D ovpn_net_xmit; } =20 +static void ovpn_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + strscpy(info->driver, OVPN_FAMILY_NAME, sizeof(info->driver)); + strscpy(info->bus_info, "ovpn", sizeof(info->bus_info)); +} + +static const struct ethtool_ops ovpn_ethtool_ops =3D { + .get_drvinfo =3D ovpn_get_drvinfo, + .get_link =3D ethtool_op_get_link, + .get_ts_info =3D ethtool_op_get_ts_info, +}; + static struct rtnl_link_ops ovpn_link_ops =3D { .kind =3D OVPN_FAMILY_NAME, .netns_refund =3D false, @@ -158,6 +172,7 @@ static void ovpn_setup(struct net_device *dev) =20 dev->pcpu_stat_type =3D NETDEV_PCPU_STAT_TSTATS; =20 + dev->ethtool_ops =3D &ovpn_ethtool_ops; dev->netdev_ops =3D &ovpn_netdev_ops; dev->rtnl_link_ops =3D &ovpn_link_ops; =20 --=20 2.45.2