If any of the HWC commands are not recognized by the
underlying hardware, the hardware returns the response
header status of -1. Log the information using
netdev_info_once to avoid multiple error logs in dmesg.
Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
---
drivers/net/ethernet/microsoft/mana/hw_channel.c | 4 ++++
drivers/net/ethernet/microsoft/mana/mana_en.c | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c
index a8c4d8db75a5..70c3b57b1e75 100644
--- a/drivers/net/ethernet/microsoft/mana/hw_channel.c
+++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c
@@ -890,6 +890,10 @@ int mana_hwc_send_request(struct hw_channel_context *hwc, u32 req_len,
}
if (ctx->status_code && ctx->status_code != GDMA_STATUS_MORE_ENTRIES) {
+ if (ctx->status_code == -1) {
+ err = -EOPNOTSUPP;
+ goto out;
+ }
dev_err(hwc->dev, "HWC: Failed hw_channel req: 0x%x\n",
ctx->status_code);
err = -EPROTO;
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index d5644400e71f..10e766c73fca 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -847,6 +847,9 @@ static int mana_send_request(struct mana_context *ac, void *in_buf,
err = mana_gd_send_request(gc, in_len, in_buf, out_len,
out_buf);
if (err || resp->status) {
+ if (err == -EOPNOTSUPP)
+ return err;
+
dev_err(dev, "Failed to send mana message: %d, 0x%x\n",
err, resp->status);
return err ? err : -EPROTO;
@@ -1251,6 +1254,10 @@ int mana_query_link_cfg(struct mana_port_context *apc)
sizeof(resp));
if (err) {
+ if (err == -EOPNOTSUPP) {
+ netdev_info_once(ndev, "MANA_QUERY_LINK_CONFIG not supported\n");
+ return err;
+ }
netdev_err(ndev, "Failed to query link config: %d\n", err);
return err;
}
@@ -1293,6 +1300,10 @@ int mana_set_bw_clamp(struct mana_port_context *apc, u32 speed,
sizeof(resp));
if (err) {
+ if (err == -EOPNOTSUPP) {
+ netdev_info_once(ndev, "MANA_SET_BW_CLAMP not supported\n");
+ return err;
+ }
netdev_err(ndev, "Failed to set bandwidth clamp for speed %u, err = %d",
speed, err);
return err;
--
2.34.1
On Wed, Jun 11, 2025 at 01:46:16AM -0700, Erni Sri Satya Vennela wrote: > If any of the HWC commands are not recognized by the > underlying hardware, the hardware returns the response > header status of -1. Log the information using > netdev_info_once to avoid multiple error logs in dmesg. > > Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com> > Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> > Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com> > --- > drivers/net/ethernet/microsoft/mana/hw_channel.c | 4 ++++ > drivers/net/ethernet/microsoft/mana/mana_en.c | 11 +++++++++++ > 2 files changed, 15 insertions(+) > > diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c > index a8c4d8db75a5..70c3b57b1e75 100644 > --- a/drivers/net/ethernet/microsoft/mana/hw_channel.c > +++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c > @@ -890,6 +890,10 @@ int mana_hwc_send_request(struct hw_channel_context *hwc, u32 req_len, > } > > if (ctx->status_code && ctx->status_code != GDMA_STATUS_MORE_ENTRIES) { > + if (ctx->status_code == -1) { Minor comment: instead of == -1 could use some macro like GDMA_STATUS_CMD_UNSUPPORTED, rest LGTM. > + err = -EOPNOTSUPP; > + goto out; > + } > dev_err(hwc->dev, "HWC: Failed hw_channel req: 0x%x\n", > ctx->status_code); > err = -EPROTO; > diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c > index d5644400e71f..10e766c73fca 100644 > --- a/drivers/net/ethernet/microsoft/mana/mana_en.c > +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c > @@ -847,6 +847,9 @@ static int mana_send_request(struct mana_context *ac, void *in_buf, > err = mana_gd_send_request(gc, in_len, in_buf, out_len, > out_buf); > if (err || resp->status) { > + if (err == -EOPNOTSUPP) > + return err; > + > dev_err(dev, "Failed to send mana message: %d, 0x%x\n", > err, resp->status); > return err ? err : -EPROTO; > @@ -1251,6 +1254,10 @@ int mana_query_link_cfg(struct mana_port_context *apc) > sizeof(resp)); > > if (err) { > + if (err == -EOPNOTSUPP) { > + netdev_info_once(ndev, "MANA_QUERY_LINK_CONFIG not supported\n"); > + return err; > + } > netdev_err(ndev, "Failed to query link config: %d\n", err); > return err; > } > @@ -1293,6 +1300,10 @@ int mana_set_bw_clamp(struct mana_port_context *apc, u32 speed, > sizeof(resp)); > > if (err) { > + if (err == -EOPNOTSUPP) { > + netdev_info_once(ndev, "MANA_SET_BW_CLAMP not supported\n"); > + return err; > + } > netdev_err(ndev, "Failed to set bandwidth clamp for speed %u, err = %d", > speed, err); > return err; > -- > 2.34.1 > Reviewed-by: Dipayaan Roy <dipayanroy@linux.microsoft.com>
On Wed, Jun 11, 2025 at 04:35:39AM -0700, Dipayaan Roy wrote: > On Wed, Jun 11, 2025 at 01:46:16AM -0700, Erni Sri Satya Vennela wrote: > > If any of the HWC commands are not recognized by the > > underlying hardware, the hardware returns the response > > header status of -1. Log the information using > > netdev_info_once to avoid multiple error logs in dmesg. > > > > Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com> > > Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> > > Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com> > > --- > > drivers/net/ethernet/microsoft/mana/hw_channel.c | 4 ++++ > > drivers/net/ethernet/microsoft/mana/mana_en.c | 11 +++++++++++ > > 2 files changed, 15 insertions(+) > > > > diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c > > index a8c4d8db75a5..70c3b57b1e75 100644 > > --- a/drivers/net/ethernet/microsoft/mana/hw_channel.c > > +++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c > > @@ -890,6 +890,10 @@ int mana_hwc_send_request(struct hw_channel_context *hwc, u32 req_len, > > } > > > > if (ctx->status_code && ctx->status_code != GDMA_STATUS_MORE_ENTRIES) { > > + if (ctx->status_code == -1) { > Minor comment: instead of == -1 could use some macro like GDMA_STATUS_CMD_UNSUPPORTED, rest LGTM. Thankyou Dipayaan. I'll define this macro and us it for the next version. > > Reviewed-by: Dipayaan Roy <dipayanroy@linux.microsoft.com>
© 2016 - 2025 Red Hat, Inc.