From nobody Mon Nov 25 20:31:25 2024 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 97F6320694C for ; Fri, 25 Oct 2024 09:15:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729847732; cv=none; b=Bm0mcw/8XbSBiHXzooSsClligtpWqapox7RGPGGlhJIT+jNOablawCO9ttnJNx8hpcd2HMCzosS+cRe3VDvYnQThILq659PyABPkOn0Qbar4uZokOHIcgcubPQNvZ9gKbuWHRqm6m/IBf7+OxKJAk5zm4tG7Yzh2slIGtf+9EEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729847732; c=relaxed/simple; bh=aDlod1jXavu2K8KnusK1u2l7VsBsilN0fz8PvjNKPQ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ikssFqO0bYR4EdfFS8DAZ+EUBqK3na3AWVslYfdT+uYs39u/ClcnrtasD0+EIvDeIu7V0mmpOY2QXlSG+dBhAZQyln5j0zJM2yN9XdcCvN4mSE2x8G/SqLBQR4As7YCUNxImqLG39pgFZl3GCNc8kNk4mmh7Q3LwJvJ2K29o4+o= 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=DTsUcWbK; arc=none smtp.client-ip=209.85.128.52 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="DTsUcWbK" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-431481433bdso18288955e9.3 for ; Fri, 25 Oct 2024 02:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1729847726; x=1730452526; 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=vFaxyOK2oGzKEK+1blmMTfwvFfOfF/h23u+ELvVQAZo=; b=DTsUcWbK8GITfmPgtNZwnTKPzBiemYBGybGbjl8Ev3Wb+GH/pDEeh1DP1mbwUdtwjJ OVjrchAOv58aRMc0Wq5WZFSEmhruHOQkTaQW2WfOPN2dP+ky9sjnCaHO7n25ZRDMT7Wu Z/cMm0oz7gYumKLBc0dlGaUmnx3A6z37sa9niNe1yhcgBshWj9a1TVz+IOgpQqriX5Il 7vkKXEwAOjbavHtzGKF/hVRPpGxNidyxE76oeJWjj599/PeZKCG8c5Sr+uljx/yPYnmj 11JOODQuiCckKG/pkaO7AoOcfv6rDwuYO8mvBu/1mfpWGtFJlhQXrwvI/+wvvqljUeYb RlQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729847726; x=1730452526; 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=vFaxyOK2oGzKEK+1blmMTfwvFfOfF/h23u+ELvVQAZo=; b=b6/wEud1yMJd0GmQOKBXN/VrOJWaJWlCxIVCXVVD4/O55gje6PDGCmm7TNj9+KoWbW iJiOLAbcjfdaNZviywC79yEgfCicTVFnSYVSMl+gtWPDdurRpk5+TB5VNc1FTcrrUSxY lvgTIhyVN0Vgy7Pt7cQLAxeL/we0a2byf1vC3El/XtOY5FXbAb057eiE7HLfMlEsjf79 DIuenkkd3Tnxwh8ILp3+hJEhxd0bHPNo6O52rIX3jSga/aSjwKgHcLhrbsgpjpp7QvIr /2r5w55A4jR4XVTMqoFoqfFNVobn4uIpYbwADa/+o9PEYIARooY9N4iX93we8j2fQsiR 7xIw== X-Forwarded-Encrypted: i=1; AJvYcCVOuoV+ZBqv30ckG/CMNtNFl18OKuVN5M0Rc/2ewJuV/gmez07CxtOoVWmgRSSb5iCcoRs56YByEihk6nI=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1/iaxXeTi2N345CtTWn0N8PUMuRNwaudiR+JvP7sAoG9GYUfI +yDeMVL8UsSPaIE8FR/4eY+OYoN6tgQLOEgueUyu8r2d7i3I6SIYQAYnfBzZ1jg= X-Google-Smtp-Source: AGHT+IHdZtUJpbG6/D6BbBuUi9ffcO8PRYN2TCxsvYQIEaXjaIyVonX5TtVJ0mNoV/lY2gLvd5YaSw== X-Received: by 2002:a05:600c:3586:b0:42c:b52b:4335 with SMTP id 5b1f17b1804b1-431841442acmr81999675e9.10.1729847725939; Fri, 25 Oct 2024 02:15:25 -0700 (PDT) Received: from serenity.mandelbit.com ([2001:67c:2fbc:1:676b:7d84:55a4:bea5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b55f484sm41981485e9.13.2024.10.25.02.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 02:15:25 -0700 (PDT) From: Antonio Quartulli Date: Fri, 25 Oct 2024 11:14:21 +0200 Subject: [PATCH net-next v10 22/23] 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: <20241025-b4-ovpn-v10-22-b87530777be7@openvpn.net> References: <20241025-b4-ovpn-v10-0-b87530777be7@openvpn.net> In-Reply-To: <20241025-b4-ovpn-v10-0-b87530777be7@openvpn.net> To: Eric Dumazet , Jakub Kicinski , Paolo Abeni , Donald Hunter , Antonio Quartulli , Shuah Khan , donald.hunter@gmail.com, sd@queasysnail.net, ryazanov.s.a@gmail.com, Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1706; i=antonio@openvpn.net; h=from:subject:message-id; bh=aDlod1jXavu2K8KnusK1u2l7VsBsilN0fz8PvjNKPQ0=; b=owEBbQGS/pANAwAIAQtw5TqgONWHAcsmYgBnG2GbmBVzq6muocWMzSMc47zZXT7dX1O3Oe05h o958FVl6lqJATMEAAEIAB0WIQSZq9xs+NQS5N5fwPwLcOU6oDjVhwUCZxthmwAKCRALcOU6oDjV h2GzB/0Zk8m7YtfDOkyVEiLgleokTe4+p9IXU4buuL7L1YR76/Zr8zTNJnRq0bgYo7uMNMEYE7r jFDCP/3/SloBFkX1p7qPgnuaK65x1ru067hDuphpATt7ZDBQ9CPSKNYyy2cIHWWy8rbUi3wzQwe vFjwHvWRbPE7A97akN7FJ+o6qkaU19XDguL1y63NM+bjjD/7YTa41TQPOCQ0O7qKJkJyZ50B2J7 fhFhEIjlgUVmHAyOHnKdq0MjqssVDrvHeKxH6kaozkznVYd/hnchD/Kgq++KU0JkEZcS5QRBceY HN8GnFrq/AGrdDtl2OLi8TePt/+h3JZKcZ3ayoxTv5q+W1W+ 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 1bd563e3f16f49dd01c897fbe79cbd90f4b8e9aa..9dcf51ae1497dda17d418b76201= 1b04bfd0521df 100644 --- a/drivers/net/ovpn/main.c +++ b/drivers/net/ovpn/main.c @@ -7,6 +7,7 @@ * James Yonan */ =20 +#include #include #include #include @@ -96,6 +97,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 void ovpn_setup(struct net_device *dev) { /* compute the overhead considering AEAD encryption */ @@ -111,6 +125,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; =20 dev->priv_destructor =3D ovpn_struct_free; --=20 2.45.2