From nobody Sat Nov 30 04:25:43 2024 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 151E318E03D; Thu, 12 Sep 2024 07:45:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726127106; cv=none; b=TFOgu3YhsbF0T7xmw5aSG/3GT1ZxPFF0anF1FlS5vJMBFl9PfJhkUjcQoDP14SDBJY/T/pAPNe6OA3ARZIEfKCi+/IuEYoOklZy67+q/xDQtqx4Jsh+3r/cpXWI42bGkc3JBfq5Zx+N3PIHx+ZgjhK6jvnedFzo6rsJUmYf+8pE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726127106; c=relaxed/simple; bh=Xu6sHgDKfgjbkEDyE3lLSibg39hwTKnEOVkCaHjK/cE=; h=From:To:Subject:Date:Message-Id; b=IOJhiw3gTidcoWTRJQMPSJqqUrtALUDTIqGGAY3AAeXpcpTqpDdvMahdWkatNTJqsnaelNxLq0Y4PYti9bx8cQ4U/0t9EIplH4kGfrX63nkvH50Tubir41q7vi8L8nqC60WR2MZpx+Zkeky7m4hQ31obUx33M19gaAc8UEGmIf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=qSGMdRyF; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="qSGMdRyF" Received: by linux.microsoft.com (Postfix, from userid 1173) id A01E220B9A9C; Thu, 12 Sep 2024 00:45:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A01E220B9A9C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1726127104; bh=jPfdFXZMhBELWCsu42PbhhsboZKB4K+0hkhbL/v0eZc=; h=From:To:Subject:Date:From; b=qSGMdRyF9DMPGqyStHV94plqd897WMSZn7iqv12xpXjMjiYpO3TpJB8JB+fC/4oZK oaJL98B4vOUD1+hHio+A+Zz6bRi01GKX14ccEn4yreK1cfjbSXsW/+vr6Qx9jpOYC0 DtigHJ9C3VysAXg/w5SJ8CxjwOddb3ULFjy2Nvu8= From: Erni Sri Satya Vennela To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shradhagupta@linux.microsoft.com, ahmed.zaki@intel.com, ernis@linux.microsoft.com, colin.i.king@gmail.com, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: mana: Add get_link and get_link_ksettings in ethtool Date: Thu, 12 Sep 2024 00:44:43 -0700 Message-Id: <1726127083-28538-1-git-send-email-ernis@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for the ethtool get_link and get_link_ksettings operations. Display standard port information using ethtool. Before the change: $ethtool enP30832s1 >No data available After the change: $ethtool enP30832s1 >Settings for enP30832s1: Supported ports: [ ] Supported link modes: Not reported Supported pause frame use: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Speed: Unknown! Duplex: Full Auto-negotiation: on Port: Direct Attach Copper PHYAD: 0 Transceiver: internal Link detected: yes Signed-off-by: Erni Sri Satya Vennela Reviewed-by: Haiyang Zhang Reviewed-by: Shradha Gupta --- .../ethernet/microsoft/mana/mana_ethtool.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/n= et/ethernet/microsoft/mana/mana_ethtool.c index 146d5db1792f..c2716d6cad36 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c +++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c @@ -369,6 +369,24 @@ static int mana_set_channels(struct net_device *ndev, return err; } =20 +static int mana_get_link_ksettings(struct net_device *ndev, + struct ethtool_link_ksettings *cmd) +{ + cmd->base.duplex =3D DUPLEX_FULL; + cmd->base.autoneg =3D AUTONEG_ENABLE; + cmd->base.port =3D PORT_DA; + + ethtool_link_ksettings_zero_link_mode(cmd, supported); + ethtool_link_ksettings_zero_link_mode(cmd, advertising); + + ethtool_link_ksettings_add_link_mode(cmd, supported, + Autoneg); + ethtool_link_ksettings_add_link_mode(cmd, advertising, + Autoneg); + + return 0; +} + const struct ethtool_ops mana_ethtool_ops =3D { .get_ethtool_stats =3D mana_get_ethtool_stats, .get_sset_count =3D mana_get_sset_count, @@ -380,4 +398,6 @@ const struct ethtool_ops mana_ethtool_ops =3D { .set_rxfh =3D mana_set_rxfh, .get_channels =3D mana_get_channels, .set_channels =3D mana_set_channels, + .get_link_ksettings =3D mana_get_link_ksettings, + .get_link =3D ethtool_op_get_link, }; --=20 2.34.1