On Thu, Apr 17, 2025 at 03:38:26PM +0200, Zhu Yanjun wrote:
> On 17.04.25 09:57, Erni Sri Satya Vennela wrote:
> >Add support for speed in mana ethtool get_link_ksettings
> >operation. This feature is not supported by all hardware.
> >
> >Signed-off-by: Erni Sri Satya Vennela <er...@linux.microsoft.com>
> >Reviewed-by: Shradha Gupta <shradhagu...@linux.microsoft.com>
> >Reviewed-by: Haiyang Zhang <haiya...@microsoft.com>
> >---
> > drivers/net/ethernet/microsoft/mana/mana_en.c | 42 +++++++++++++++++++
> > .../ethernet/microsoft/mana/mana_ethtool.c | 6 +++
> > include/net/mana/mana.h | 17 ++++++++
> > 3 files changed, 65 insertions(+)
> >
> >diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c
> >b/drivers/net/ethernet/microsoft/mana/mana_en.c
> >index 2bac6be8f6a0..ba550fc7ece0 100644
> >--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> >+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> >@@ -1156,6 +1156,48 @@ static int mana_cfg_vport_steering(struct
> >mana_port_context *apc,
> > return err;
> > }
> >+int mana_query_link_cfg(struct mana_port_context *apc)
> >+{
> >+ struct net_device *ndev = apc->ndev;
> >+ struct mana_query_link_config_resp resp = {};
> >+ struct mana_query_link_config_req req = {};
> >+ int err;
> >+
> >+ mana_gd_init_req_hdr(&req.hdr, MANA_QUERY_LINK_CONFIG,
> >+ sizeof(req), sizeof(resp));
> >+
> >+ req.vport = apc->port_handle;
> >+
> >+ err = mana_send_request(apc->ac, &req, sizeof(req), &resp,
> >+ sizeof(resp));
> >+
> >+ if (err) {
> >+ netdev_err(ndev, "Failed to query link config: %d\n", err);
> >+ goto out;
> >+ }
> >+
> >+ err = mana_verify_resp_hdr(&resp.hdr, MANA_QUERY_LINK_CONFIG,
> >+ sizeof(resp));
> >+
> >+ if (err || resp.hdr.status) {
> >+ netdev_err(ndev, "Failed to query link config: %d, 0x%x\n", err,
> >+ resp.hdr.status);
> >+ if (!err)
> >+ err = -EPROTO;
>
> EPROTO means Protocol error. Thus, ENOTSUPP or EPROTONOSUPPORT is better?
>
> Zhu Yanjun
Thank you for the suggestion, Zhu Yanjun. I will also make this change
in mana_set_bw_clamp(). This update will be included in the next version
of the patch.
>
> >+ goto out;
> >+ }
> >+
> >+ if (resp.qos_unconfigured) {
> >+ err = -EINVAL;
> >+ goto out;
> >+ }
> >+ apc->speed = resp.link_speed_mbps;
> >+ return 0;
> >+
> >+out:
> >+ return err;
> >+}
> >+