Skip to content

Commit 179040e

Browse files
committed
net: mana: Handle unsupported HWC commands
jira LE-4385 Rebuild_History Non-Buildable kernel-5.14.0-570.52.1.el9_6 commit-author Erni Sri Satya Vennela <[email protected]> commit ca8ac48 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-5.14.0-570.52.1.el9_6/ca8ac489.failed 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]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> (cherry picked from commit ca8ac48) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # drivers/net/ethernet/microsoft/mana/mana_en.c
1 parent 2132fca commit 179040e

File tree

1 file changed

+159
-0
lines changed

1 file changed

+159
-0
lines changed
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
net: mana: Handle unsupported HWC commands
2+
3+
jira LE-4385
4+
Rebuild_History Non-Buildable kernel-5.14.0-570.52.1.el9_6
5+
commit-author Erni Sri Satya Vennela <[email protected]>
6+
commit ca8ac489ca33c986ff02ee14c3e1c10b86355428
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-5.14.0-570.52.1.el9_6/ca8ac489.failed
10+
11+
If any of the HWC commands are not recognized by the
12+
underlying hardware, the hardware returns the response
13+
header status of -1. Log the information using
14+
netdev_info_once to avoid multiple error logs in dmesg.
15+
16+
Signed-off-by: Erni Sri Satya Vennela <[email protected]>
17+
Reviewed-by: Haiyang Zhang <[email protected]>
18+
Reviewed-by: Shradha Gupta <[email protected]>
19+
Reviewed-by: Saurabh Singh Sengar <[email protected]>
20+
Reviewed-by: Dipayaan Roy <[email protected]>
21+
Link: https://patch.msgid.link/[email protected]
22+
Signed-off-by: Paolo Abeni <[email protected]>
23+
24+
(cherry picked from commit ca8ac489ca33c986ff02ee14c3e1c10b86355428)
25+
Signed-off-by: Jonathan Maple <[email protected]>
26+
27+
# Conflicts:
28+
# drivers/net/ethernet/microsoft/mana/mana_en.c
29+
diff --cc drivers/net/ethernet/microsoft/mana/mana_en.c
30+
index cf8ccab43478,5aee7bda1504..000000000000
31+
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
32+
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
33+
@@@ -1160,6 -1238,95 +1163,98 @@@ out
34+
return err;
35+
}
36+
37+
++<<<<<<< HEAD
38+
++=======
39+
+ int mana_query_link_cfg(struct mana_port_context *apc)
40+
+ {
41+
+ struct net_device *ndev = apc->ndev;
42+
+ struct mana_query_link_config_resp resp = {};
43+
+ struct mana_query_link_config_req req = {};
44+
+ int err;
45+
+
46+
+ mana_gd_init_req_hdr(&req.hdr, MANA_QUERY_LINK_CONFIG,
47+
+ sizeof(req), sizeof(resp));
48+
+
49+
+ req.vport = apc->port_handle;
50+
+ req.hdr.resp.msg_version = GDMA_MESSAGE_V2;
51+
+
52+
+ err = mana_send_request(apc->ac, &req, sizeof(req), &resp,
53+
+ sizeof(resp));
54+
+
55+
+ if (err) {
56+
+ if (err == -EOPNOTSUPP) {
57+
+ netdev_info_once(ndev, "MANA_QUERY_LINK_CONFIG not supported\n");
58+
+ return err;
59+
+ }
60+
+ netdev_err(ndev, "Failed to query link config: %d\n", err);
61+
+ return err;
62+
+ }
63+
+
64+
+ err = mana_verify_resp_hdr(&resp.hdr, MANA_QUERY_LINK_CONFIG,
65+
+ sizeof(resp));
66+
+
67+
+ if (err || resp.hdr.status) {
68+
+ netdev_err(ndev, "Failed to query link config: %d, 0x%x\n", err,
69+
+ resp.hdr.status);
70+
+ if (!err)
71+
+ err = -EOPNOTSUPP;
72+
+ return err;
73+
+ }
74+
+
75+
+ if (resp.qos_unconfigured) {
76+
+ err = -EINVAL;
77+
+ return err;
78+
+ }
79+
+ apc->speed = resp.link_speed_mbps;
80+
+ apc->max_speed = resp.qos_speed_mbps;
81+
+ return 0;
82+
+ }
83+
+
84+
+ int mana_set_bw_clamp(struct mana_port_context *apc, u32 speed,
85+
+ int enable_clamping)
86+
+ {
87+
+ struct mana_set_bw_clamp_resp resp = {};
88+
+ struct mana_set_bw_clamp_req req = {};
89+
+ struct net_device *ndev = apc->ndev;
90+
+ int err;
91+
+
92+
+ mana_gd_init_req_hdr(&req.hdr, MANA_SET_BW_CLAMP,
93+
+ sizeof(req), sizeof(resp));
94+
+ req.vport = apc->port_handle;
95+
+ req.link_speed_mbps = speed;
96+
+ req.enable_clamping = enable_clamping;
97+
+
98+
+ err = mana_send_request(apc->ac, &req, sizeof(req), &resp,
99+
+ sizeof(resp));
100+
+
101+
+ if (err) {
102+
+ if (err == -EOPNOTSUPP) {
103+
+ netdev_info_once(ndev, "MANA_SET_BW_CLAMP not supported\n");
104+
+ return err;
105+
+ }
106+
+ netdev_err(ndev, "Failed to set bandwidth clamp for speed %u, err = %d",
107+
+ speed, err);
108+
+ return err;
109+
+ }
110+
+
111+
+ err = mana_verify_resp_hdr(&resp.hdr, MANA_SET_BW_CLAMP,
112+
+ sizeof(resp));
113+
+
114+
+ if (err || resp.hdr.status) {
115+
+ netdev_err(ndev, "Failed to set bandwidth clamp: %d, 0x%x\n", err,
116+
+ resp.hdr.status);
117+
+ if (!err)
118+
+ err = -EOPNOTSUPP;
119+
+ return err;
120+
+ }
121+
+
122+
+ if (resp.qos_unconfigured)
123+
+ netdev_info(ndev, "QoS is unconfigured\n");
124+
+
125+
+ return 0;
126+
+ }
127+
+
128+
++>>>>>>> ca8ac489ca33 (net: mana: Handle unsupported HWC commands)
129+
int mana_create_wq_obj(struct mana_port_context *apc,
130+
mana_handle_t vport,
131+
u32 wq_type, struct mana_obj_spec *wq_spec,
132+
diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c
133+
index df8b52c991d8..7455e1a36a86 100644
134+
--- a/drivers/net/ethernet/microsoft/mana/hw_channel.c
135+
+++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c
136+
@@ -871,6 +871,10 @@ int mana_hwc_send_request(struct hw_channel_context *hwc, u32 req_len,
137+
}
138+
139+
if (ctx->status_code && ctx->status_code != GDMA_STATUS_MORE_ENTRIES) {
140+
+ if (ctx->status_code == GDMA_STATUS_CMD_UNSUPPORTED) {
141+
+ err = -EOPNOTSUPP;
142+
+ goto out;
143+
+ }
144+
if (req_msg->req.msg_type != MANA_QUERY_PHY_STAT)
145+
dev_err(hwc->dev, "HWC: Failed hw_channel req: 0x%x\n",
146+
ctx->status_code);
147+
* Unmerged path drivers/net/ethernet/microsoft/mana/mana_en.c
148+
diff --git a/include/net/mana/gdma.h b/include/net/mana/gdma.h
149+
index a1661ec549f4..18f3761416dd 100644
150+
--- a/include/net/mana/gdma.h
151+
+++ b/include/net/mana/gdma.h
152+
@@ -10,6 +10,7 @@
153+
#include "shm_channel.h"
154+
155+
#define GDMA_STATUS_MORE_ENTRIES 0x00000105
156+
+#define GDMA_STATUS_CMD_UNSUPPORTED 0xffffffff
157+
158+
/* Structures labeled with "HW DATA" are exchanged with the hardware. All of
159+
* them are naturally aligned and hence don't need __packed.

0 commit comments

Comments
 (0)