Skip to content

Commit 86eb2a5

Browse files
Erni Sri Satya VennelaNipaLocal
authored andcommitted
net: mana: Handle unsupported HWC commands
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 <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Reviewed-by: Shradha Gupta <[email protected]> Reviewed-by: Saurabh Singh Sengar <[email protected]> Reviewed-by: Dipayaan Roy <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 61a5989 commit 86eb2a5

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

drivers/net/ethernet/microsoft/mana/hw_channel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,10 @@ int mana_hwc_send_request(struct hw_channel_context *hwc, u32 req_len,
891891
}
892892

893893
if (ctx->status_code && ctx->status_code != GDMA_STATUS_MORE_ENTRIES) {
894+
if (ctx->status_code == GDMA_STATUS_CMD_UNSUPPORTED) {
895+
err = -EOPNOTSUPP;
896+
goto out;
897+
}
894898
if (req_msg->req.msg_type != MANA_QUERY_PHY_STAT)
895899
dev_err(hwc->dev, "HWC: Failed hw_channel req: 0x%x\n",
896900
ctx->status_code);

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,9 @@ static int mana_send_request(struct mana_context *ac, void *in_buf,
847847
err = mana_gd_send_request(gc, in_len, in_buf, out_len,
848848
out_buf);
849849
if (err || resp->status) {
850+
if (err == -EOPNOTSUPP)
851+
return err;
852+
850853
if (req->req.msg_type != MANA_QUERY_PHY_STAT)
851854
dev_err(dev, "Failed to send mana message: %d, 0x%x\n",
852855
err, resp->status);
@@ -1252,6 +1255,10 @@ int mana_query_link_cfg(struct mana_port_context *apc)
12521255
sizeof(resp));
12531256

12541257
if (err) {
1258+
if (err == -EOPNOTSUPP) {
1259+
netdev_info_once(ndev, "MANA_QUERY_LINK_CONFIG not supported\n");
1260+
return err;
1261+
}
12551262
netdev_err(ndev, "Failed to query link config: %d\n", err);
12561263
return err;
12571264
}
@@ -1294,6 +1301,10 @@ int mana_set_bw_clamp(struct mana_port_context *apc, u32 speed,
12941301
sizeof(resp));
12951302

12961303
if (err) {
1304+
if (err == -EOPNOTSUPP) {
1305+
netdev_info_once(ndev, "MANA_SET_BW_CLAMP not supported\n");
1306+
return err;
1307+
}
12971308
netdev_err(ndev, "Failed to set bandwidth clamp for speed %u, err = %d",
12981309
speed, err);
12991310
return err;

include/net/mana/gdma.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "shm_channel.h"
1111

1212
#define GDMA_STATUS_MORE_ENTRIES 0x00000105
13+
#define GDMA_STATUS_CMD_UNSUPPORTED 0xffffffff
1314

1415
/* Structures labeled with "HW DATA" are exchanged with the hardware. All of
1516
* them are naturally aligned and hence don't need __packed.

0 commit comments

Comments
 (0)