* [PATCH v2 1/3] net: mana: Add speed support in mana_get_link_ksettings
2025-04-21 6:33 [PATCH v2 0/3] net: mana: Add HTB Qdisc offload support Erni Sri Satya Vennela
@ 2025-04-21 6:33 ` Erni Sri Satya Vennela
2025-04-21 12:36 ` Andrew Lunn
2025-04-21 6:33 ` [PATCH v2 2/3] net: mana: Add sched HTB offload support Erni Sri Satya Vennela
2025-04-21 6:33 ` [PATCH v2 3/3] net: mana: Handle unsupported HWC commands Erni Sri Satya Vennela
2 siblings, 1 reply; 11+ messages in thread
From: Erni Sri Satya Vennela @ 2025-04-21 6:33 UTC (permalink / raw)
To: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
kuba, pabeni, longli, kotaranov, horms, mhklinux, pasha.tatashin,
ernis, kent.overstreet, brett.creeley, schakrabarti, shradhagupta,
ssengar, leon, rosenp, paulros, linux-hyperv, netdev,
linux-kernel, linux-rdma
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 <ernis@linux.microsoft.com>
Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
---
Changes in v2:
* Use -EOPNOTSUPP instead of -EPROTO in mana_query_link_cfg().
---
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 = -EOPNOTSUPP;
+ goto out;
+ }
+
+ if (resp.qos_unconfigured) {
+ err = -EINVAL;
+ goto out;
+ }
+ apc->speed = resp.link_speed_mbps;
+ return 0;
+
+out:
+ return err;
+}
+
int mana_create_wq_obj(struct mana_port_context *apc,
mana_handle_t vport,
u32 wq_type, struct mana_obj_spec *wq_spec,
diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
index c419626073f5..48234a738d26 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
@@ -427,6 +427,12 @@ static int mana_set_ringparam(struct net_device *ndev,
static int mana_get_link_ksettings(struct net_device *ndev,
struct ethtool_link_ksettings *cmd)
{
+ struct mana_port_context *apc = netdev_priv(ndev);
+ int err;
+
+ err = mana_query_link_cfg(apc);
+
+ cmd->base.speed = (err) ? SPEED_UNKNOWN : apc->speed;
cmd->base.duplex = DUPLEX_FULL;
cmd->base.port = PORT_OTHER;
diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
index 0f78065de8fe..63193613c185 100644
--- a/include/net/mana/mana.h
+++ b/include/net/mana/mana.h
@@ -468,6 +468,8 @@ struct mana_port_context {
u16 port_idx;
+ u32 speed;
+
bool port_is_up;
bool port_st_save; /* Saved port state */
@@ -497,6 +499,7 @@ struct bpf_prog *mana_xdp_get(struct mana_port_context *apc);
void mana_chn_setxdp(struct mana_port_context *apc, struct bpf_prog *prog);
int mana_bpf(struct net_device *ndev, struct netdev_bpf *bpf);
void mana_query_gf_stats(struct mana_port_context *apc);
+int mana_query_link_cfg(struct mana_port_context *apc);
int mana_pre_alloc_rxbufs(struct mana_port_context *apc, int mtu, int num_queues);
void mana_pre_dealloc_rxbufs(struct mana_port_context *apc);
@@ -523,6 +526,7 @@ enum mana_command_code {
MANA_FENCE_RQ = 0x20006,
MANA_CONFIG_VPORT_RX = 0x20007,
MANA_QUERY_VPORT_CONFIG = 0x20008,
+ MANA_QUERY_LINK_CONFIG = 0x2000A,
/* Privileged commands for the PF mode */
MANA_REGISTER_FILTER = 0x28000,
@@ -531,6 +535,19 @@ enum mana_command_code {
MANA_DEREGISTER_HW_PORT = 0x28004,
};
+/* Query Link Configuration*/
+struct mana_query_link_config_req {
+ struct gdma_req_hdr hdr;
+ mana_handle_t vport;
+}; /* HW DATA */
+
+struct mana_query_link_config_resp {
+ struct gdma_resp_hdr hdr;
+ u32 link_speed_mbps;
+ u8 qos_unconfigured;
+ u8 reserved[3];
+}; /* HW DATA */
+
/* Query Device Configuration */
struct mana_query_device_cfg_req {
struct gdma_req_hdr hdr;
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] net: mana: Add speed support in mana_get_link_ksettings
2025-04-21 6:33 ` [PATCH v2 1/3] net: mana: Add speed support in mana_get_link_ksettings Erni Sri Satya Vennela
@ 2025-04-21 12:36 ` Andrew Lunn
2025-04-21 18:14 ` Erni Sri Satya Vennela
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Lunn @ 2025-04-21 12:36 UTC (permalink / raw)
To: Erni Sri Satya Vennela
Cc: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
kuba, pabeni, longli, kotaranov, horms, mhklinux, pasha.tatashin,
kent.overstreet, brett.creeley, schakrabarti, shradhagupta,
ssengar, leon, rosenp, paulros, linux-hyperv, netdev,
linux-kernel, linux-rdma
On Sun, Apr 20, 2025 at 11:33:38PM -0700, Erni Sri Satya Vennela wrote:
> Add support for speed in mana ethtool get_link_ksettings
> operation. This feature is not supported by all hardware.
This needs a lot more justification. tc(1) will show you the current
HTB Qdisc setting. No other MAC driver i know of will show you Qdisc
info in ksettings. So why is mana special?
Something your said in an earlier thread might be relevant here. There
are two shaper settings involved. The Hypervisor can configure a
limit, which the VM has no control over. And then you have this second
limit the VM can set, which only has any effect if it is lower than
the hypervisor limit.
The hypervisor limit is much more like the value ksettings represents,
the media speed, which is impossible to go above, and the machine has
no control over. Reporting that limit in ksettings would seem
reasonable. But it does not appear your firmware offers that?
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/3] net: mana: Add speed support in mana_get_link_ksettings
2025-04-21 12:36 ` Andrew Lunn
@ 2025-04-21 18:14 ` Erni Sri Satya Vennela
0 siblings, 0 replies; 11+ messages in thread
From: Erni Sri Satya Vennela @ 2025-04-21 18:14 UTC (permalink / raw)
To: Andrew Lunn
Cc: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
kuba, pabeni, longli, kotaranov, horms, mhklinux, pasha.tatashin,
kent.overstreet, brett.creeley, schakrabarti, shradhagupta,
ssengar, leon, rosenp, paulros, linux-hyperv, netdev,
linux-kernel, linux-rdma
On Mon, Apr 21, 2025 at 02:36:43PM +0200, Andrew Lunn wrote:
> On Sun, Apr 20, 2025 at 11:33:38PM -0700, Erni Sri Satya Vennela wrote:
> > Add support for speed in mana ethtool get_link_ksettings
> > operation. This feature is not supported by all hardware.
>
> This needs a lot more justification. tc(1) will show you the current
> HTB Qdisc setting. No other MAC driver i know of will show you Qdisc
> info in ksettings. So why is mana special?
>
> Something your said in an earlier thread might be relevant here. There
> are two shaper settings involved. The Hypervisor can configure a
> limit, which the VM has no control over. And then you have this second
> limit the VM can set, which only has any effect if it is lower than
> the hypervisor limit.
>
> The hypervisor limit is much more like the value ksettings represents,
> the media speed, which is impossible to go above, and the machine has
> no control over. Reporting that limit in ksettings would seem
> reasonable. But it does not appear your firmware offers that?
>
> Andrew
>
Yes, that is correct. I will keep the ethtool mana_get_link_ksettings
unchanged, since the link speed can be reported using tc too. I will
make this change in the next version of the patch.
Thankyou for the pointer, Andrew.
> ---
> pw-bot: cr
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 2/3] net: mana: Add sched HTB offload support
2025-04-21 6:33 [PATCH v2 0/3] net: mana: Add HTB Qdisc offload support Erni Sri Satya Vennela
2025-04-21 6:33 ` [PATCH v2 1/3] net: mana: Add speed support in mana_get_link_ksettings Erni Sri Satya Vennela
@ 2025-04-21 6:33 ` Erni Sri Satya Vennela
2025-04-22 0:03 ` Jakub Kicinski
2025-04-21 6:33 ` [PATCH v2 3/3] net: mana: Handle unsupported HWC commands Erni Sri Satya Vennela
2 siblings, 1 reply; 11+ messages in thread
From: Erni Sri Satya Vennela @ 2025-04-21 6:33 UTC (permalink / raw)
To: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
kuba, pabeni, longli, kotaranov, horms, mhklinux, pasha.tatashin,
ernis, kent.overstreet, brett.creeley, schakrabarti, shradhagupta,
ssengar, leon, rosenp, paulros, linux-hyperv, netdev,
linux-kernel, linux-rdma
Introduce support for HTB qdisc offload in the mana ethernet
controller. This controller can offload only one HTB leaf.
The HTB leaf supports clamping the bandwidth for egress traffic.
It uses the function mana_set_bw_clamp(), which internally calls
a HWC command to the hardware to set the speed.
The minimum bandwidth is 100 Mbps, and only multiples of 100 Mbps
are handled by the hardware. When the HTB leaf/root is deleted,
the speed will be reset to maximum bandwidth supported by the SKU.
This feature is not supported by all hardware.
Steps to configure speed:
Add the root qdisc
$tc qdisc add dev enP30832s1 root handle 1: htb offload
Add the class with required rate
$tc class add dev enP30832s1 parent 1: classid 1:1 htb rate 1000mbit
Display class details
$tc class show dev enP30832s1 classid 1:1
>class htb 1:1 root prio 0 rate 1Gbit ceil 1Gbit
>burst 1375b cburst 1375b offload
Display port information using ethtool
$ethtool enP30832s1
>Settings for enP30832s1:
Supported ports: [ ]
Supported link modes: Not reported
Supported pause frame use: No
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: off
Port: Other
PHYAD: 0
Transceiver: internal
Link detected: yes
Delete class
$tc class del dev enP30832s1 classid 1:1
Delete root qdisc (If used alone, also deletes the attached class)
$tc qdisc del dev enP30832s1 root
Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
---
Changes in v2:
* Use -EOPNOTSUPP instead of -EPROTO in mana_set_bw_clamp().
* Change link_speed to link_speed_mbps in struct mana_set_bw_clamp_req.
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 138 ++++++++++++++++++
include/net/mana/mana.h | 19 +++
2 files changed, 157 insertions(+)
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index ba550fc7ece0..5b62f1443716 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -16,10 +16,13 @@
#include <net/netdev_lock.h>
#include <net/page_pool/helpers.h>
#include <net/xdp.h>
+#include <net/pkt_cls.h>
#include <net/mana/mana.h>
#include <net/mana/mana_auxiliary.h>
+#define MIN_BANDWIDTH 100
+
static DEFINE_IDA(mana_adev_ida);
static int mana_adev_idx_alloc(void)
@@ -719,6 +722,99 @@ static int mana_change_mtu(struct net_device *ndev, int new_mtu)
return err;
}
+static int mana_tc_htb_handle_leaf_queue(struct mana_port_context *mpc,
+ struct tc_htb_qopt_offload *opt,
+ bool alloc)
+{
+ u32 rate, old_speed;
+ int err;
+
+ if (opt->command == TC_HTB_LEAF_ALLOC_QUEUE) {
+ if (opt->parent_classid != TC_HTB_CLASSID_ROOT) {
+ NL_SET_ERR_MSG_MOD(opt->extack, "invalid parent classid");
+ return -EINVAL;
+ } else if (mpc->classid) {
+ NL_SET_ERR_MSG_MOD(opt->extack, "Cannot create multiple classes");
+ return -EOPNOTSUPP;
+ }
+ mpc->classid = opt->classid;
+ }
+
+ rate = div_u64(opt->rate, 1000) << 3; //Convert Bps to Kbps
+ rate = div_u64(rate, 1000); //Convert Kbps to Mbps
+
+ /*Get current speed*/
+ err = mana_query_link_cfg(mpc);
+ old_speed = (err) ? SPEED_UNKNOWN : mpc->speed;
+
+ if (!err) {
+ if (alloc) {
+ /*Support only multiples of 100Mbps for rate parameter*/
+ rate = max(rate, MIN_BANDWIDTH);
+ rate = rounddown(rate, MIN_BANDWIDTH);
+
+ err = mana_set_bw_clamp(mpc, rate, TRI_STATE_TRUE);
+ mpc->speed = (err) ? old_speed : rate;
+ } else {
+ err = mana_set_bw_clamp(mpc, rate, TRI_STATE_FALSE);
+ mpc->classid = (err) ? : 0;
+ }
+ }
+
+ return err;
+}
+
+static int mana_create_tc_htb(struct mana_port_context *mpc)
+{
+ int err;
+
+ /*Check for hardware support*/
+ err = mana_query_link_cfg(mpc);
+ if (err == -EINVAL)
+ netdev_info(mpc->ndev, "QoS is not configured yet\n");
+
+ return err;
+}
+
+static int mana_tc_setup_htb(struct mana_port_context *mpc,
+ struct tc_htb_qopt_offload *opt)
+{
+ int err;
+
+ switch (opt->command) {
+ case TC_HTB_CREATE:
+ err = mana_create_tc_htb(mpc);
+ return err;
+ case TC_HTB_NODE_MODIFY:
+ case TC_HTB_LEAF_ALLOC_QUEUE:
+ err = mana_tc_htb_handle_leaf_queue(mpc, opt, 1);
+ return err;
+ case TC_HTB_DESTROY:
+ case TC_HTB_LEAF_DEL:
+ case TC_HTB_LEAF_DEL_LAST:
+ case TC_HTB_LEAF_DEL_LAST_FORCE:
+ return mana_tc_htb_handle_leaf_queue(mpc, opt, 0);
+ case TC_HTB_LEAF_QUERY_QUEUE:
+ break;
+ default:
+ return -EOPNOTSUPP;
+ }
+ return 0;
+}
+
+static int mana_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ void *type_data)
+{
+ struct mana_port_context *mpc = netdev_priv(dev);
+
+ switch (type) {
+ case TC_SETUP_QDISC_HTB:
+ return mana_tc_setup_htb(mpc, type_data);
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
static const struct net_device_ops mana_devops = {
.ndo_open = mana_open,
.ndo_stop = mana_close,
@@ -729,6 +825,7 @@ static const struct net_device_ops mana_devops = {
.ndo_bpf = mana_bpf,
.ndo_xdp_xmit = mana_xdp_xmit,
.ndo_change_mtu = mana_change_mtu,
+ .ndo_setup_tc = mana_setup_tc,
};
static void mana_cleanup_port_context(struct mana_port_context *apc)
@@ -1198,6 +1295,46 @@ int mana_query_link_cfg(struct mana_port_context *apc)
return err;
}
+int mana_set_bw_clamp(struct mana_port_context *apc, u32 speed,
+ int enable_clamping)
+{
+ struct mana_set_bw_clamp_resp resp = {};
+ struct mana_set_bw_clamp_req req = {};
+ struct net_device *ndev = apc->ndev;
+ int err;
+
+ mana_gd_init_req_hdr(&req.hdr, MANA_SET_BW_CLAMP,
+ sizeof(req), sizeof(resp));
+ req.vport = apc->port_handle;
+ req.link_speed_mbps = speed;
+ req.enable_clamping = enable_clamping;
+
+ err = mana_send_request(apc->ac, &req, sizeof(req), &resp,
+ sizeof(resp));
+
+ if (err) {
+ netdev_err(ndev, "Failed to set bandwidth clamp for speed %u, err = %d",
+ speed, err);
+ return err;
+ }
+
+ err = mana_verify_resp_hdr(&resp.hdr, MANA_SET_BW_CLAMP,
+ sizeof(resp));
+
+ if (err || resp.hdr.status) {
+ netdev_err(ndev, "Failed to set bandwidth clamp: %d, 0x%x\n", err,
+ resp.hdr.status);
+ if (!err)
+ err = -EOPNOTSUPP;
+ return err;
+ }
+
+ if (resp.qos_unconfigured)
+ netdev_info(ndev, "QoS is unconfigured\n");
+
+ return 0;
+}
+
int mana_create_wq_obj(struct mana_port_context *apc,
mana_handle_t vport,
u32 wq_type, struct mana_obj_spec *wq_spec,
@@ -2942,6 +3079,7 @@ static int mana_probe_port(struct mana_context *ac, int port_idx,
ndev->hw_features |= NETIF_F_RXCSUM;
ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
ndev->hw_features |= NETIF_F_RXHASH;
+ ndev->hw_features |= NETIF_F_HW_TC;
ndev->features = ndev->hw_features | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
ndev->vlan_features = ndev->features;
diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
index 63193613c185..69687dfe7540 100644
--- a/include/net/mana/mana.h
+++ b/include/net/mana/mana.h
@@ -469,6 +469,8 @@ struct mana_port_context {
u16 port_idx;
u32 speed;
+ /*HTB class parameters*/
+ u16 classid;
bool port_is_up;
bool port_st_save; /* Saved port state */
@@ -500,6 +502,8 @@ void mana_chn_setxdp(struct mana_port_context *apc, struct bpf_prog *prog);
int mana_bpf(struct net_device *ndev, struct netdev_bpf *bpf);
void mana_query_gf_stats(struct mana_port_context *apc);
int mana_query_link_cfg(struct mana_port_context *apc);
+int mana_set_bw_clamp(struct mana_port_context *apc, u32 speed,
+ int enable_clamping);
int mana_pre_alloc_rxbufs(struct mana_port_context *apc, int mtu, int num_queues);
void mana_pre_dealloc_rxbufs(struct mana_port_context *apc);
@@ -527,6 +531,7 @@ enum mana_command_code {
MANA_CONFIG_VPORT_RX = 0x20007,
MANA_QUERY_VPORT_CONFIG = 0x20008,
MANA_QUERY_LINK_CONFIG = 0x2000A,
+ MANA_SET_BW_CLAMP = 0x2000B,
/* Privileged commands for the PF mode */
MANA_REGISTER_FILTER = 0x28000,
@@ -548,6 +553,20 @@ struct mana_query_link_config_resp {
u8 reserved[3];
}; /* HW DATA */
+/* Set Bandwidth Clamp*/
+struct mana_set_bw_clamp_req {
+ struct gdma_req_hdr hdr;
+ mana_handle_t vport;
+ enum TRI_STATE enable_clamping;
+ u32 link_speed_mbps;
+}; /* HW DATA */
+
+struct mana_set_bw_clamp_resp {
+ struct gdma_resp_hdr hdr;
+ u8 qos_unconfigured;
+ u8 reserved[7];
+}; /* HW DATA */
+
/* Query Device Configuration */
struct mana_query_device_cfg_req {
struct gdma_req_hdr hdr;
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/3] net: mana: Add sched HTB offload support
2025-04-21 6:33 ` [PATCH v2 2/3] net: mana: Add sched HTB offload support Erni Sri Satya Vennela
@ 2025-04-22 0:03 ` Jakub Kicinski
2025-04-22 19:48 ` Erni Sri Satya Vennela
0 siblings, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2025-04-22 0:03 UTC (permalink / raw)
To: Erni Sri Satya Vennela
Cc: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
pabeni, longli, kotaranov, horms, mhklinux, pasha.tatashin,
kent.overstreet, brett.creeley, schakrabarti, shradhagupta,
ssengar, rosenp, paulros, linux-hyperv, netdev, linux-kernel
On Sun, 20 Apr 2025 23:33:39 -0700 Erni Sri Satya Vennela wrote:
> This controller can offload only one HTB leaf.
This is not a reasonable use case for HTB.
If your reason not to use the shaper API is that there is no CLI
for it perhaps you should add one to iproute2.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/3] net: mana: Add sched HTB offload support
2025-04-22 0:03 ` Jakub Kicinski
@ 2025-04-22 19:48 ` Erni Sri Satya Vennela
2025-04-23 0:18 ` Jakub Kicinski
0 siblings, 1 reply; 11+ messages in thread
From: Erni Sri Satya Vennela @ 2025-04-22 19:48 UTC (permalink / raw)
To: Jakub Kicinski
Cc: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
pabeni, longli, kotaranov, horms, mhklinux, pasha.tatashin,
kent.overstreet, brett.creeley, schakrabarti, shradhagupta,
ssengar, rosenp, paulros, linux-hyperv, netdev, linux-kernel
On Mon, Apr 21, 2025 at 05:03:49PM -0700, Jakub Kicinski wrote:
> On Sun, 20 Apr 2025 23:33:39 -0700 Erni Sri Satya Vennela wrote:
> > This controller can offload only one HTB leaf.
>
We selected tc-htb for our current use case because we plan to support
multiple speed classes in the future.
> This is not a reasonable use case for HTB.
>
> If your reason not to use the shaper API is that there is no CLI
> for it perhaps you should add one to iproute2.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/3] net: mana: Add sched HTB offload support
2025-04-22 19:48 ` Erni Sri Satya Vennela
@ 2025-04-23 0:18 ` Jakub Kicinski
2025-04-23 15:27 ` [EXTERNAL] " Haiyang Zhang
0 siblings, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2025-04-23 0:18 UTC (permalink / raw)
To: Erni Sri Satya Vennela
Cc: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
pabeni, longli, kotaranov, horms, mhklinux, pasha.tatashin,
kent.overstreet, brett.creeley, schakrabarti, shradhagupta,
ssengar, rosenp, paulros, linux-hyperv, netdev, linux-kernel
On Tue, 22 Apr 2025 12:48:30 -0700 Erni Sri Satya Vennela wrote:
> On Mon, Apr 21, 2025 at 05:03:49PM -0700, Jakub Kicinski wrote:
> > On Sun, 20 Apr 2025 23:33:39 -0700 Erni Sri Satya Vennela wrote:
> > > This controller can offload only one HTB leaf.
> >
> We selected tc-htb for our current use case because we plan to support
> multiple speed classes in the future.
Which net-shapers also support.
IIRC HTB offload requires that you dynamically allocate the Tx queues.
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [EXTERNAL] Re: [PATCH v2 2/3] net: mana: Add sched HTB offload support
2025-04-23 0:18 ` Jakub Kicinski
@ 2025-04-23 15:27 ` Haiyang Zhang
2025-04-23 21:57 ` Jakub Kicinski
0 siblings, 1 reply; 11+ messages in thread
From: Haiyang Zhang @ 2025-04-23 15:27 UTC (permalink / raw)
To: Jakub Kicinski, Erni Sri Satya Vennela
Cc: KY Srinivasan, wei.liu@kernel.org, Dexuan Cui,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, Long Li, Konstantin Taranov, horms@kernel.org,
mhklinux@outlook.com, pasha.tatashin@soleen.com,
kent.overstreet@linux.dev, brett.creeley@amd.com,
schakrabarti@linux.microsoft.com,
shradhagupta@linux.microsoft.com, ssengar@linux.microsoft.com,
rosenp@gmail.com, Paul Rosswurm, linux-hyperv@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Tuesday, April 22, 2025 8:19 PM
> To: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
> Cc: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; wei.liu@kernel.org; Dexuan Cui
> <decui@microsoft.com>; andrew+netdev@lunn.ch; davem@davemloft.net;
> edumazet@google.com; pabeni@redhat.com; Long Li <longli@microsoft.com>;
> Konstantin Taranov <kotaranov@microsoft.com>; horms@kernel.org;
> mhklinux@outlook.com; pasha.tatashin@soleen.com;
> kent.overstreet@linux.dev; brett.creeley@amd.com;
> schakrabarti@linux.microsoft.com; shradhagupta@linux.microsoft.com;
> ssengar@linux.microsoft.com; rosenp@gmail.com; Paul Rosswurm
> <paulros@microsoft.com>; linux-hyperv@vger.kernel.org;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [EXTERNAL] Re: [PATCH v2 2/3] net: mana: Add sched HTB offload
> support
>
> On Tue, 22 Apr 2025 12:48:30 -0700 Erni Sri Satya Vennela wrote:
> > On Mon, Apr 21, 2025 at 05:03:49PM -0700, Jakub Kicinski wrote:
> > > On Sun, 20 Apr 2025 23:33:39 -0700 Erni Sri Satya Vennela wrote:
> > > > This controller can offload only one HTB leaf.
> > >
> > We selected tc-htb for our current use case because we plan to support
> > multiple speed classes in the future.
>
> Which net-shapers also support.
Thanks for pointing that out...
But for easier usage with existing tc tool for customers, can we still
use tc-htb offload? Does using tc-htb offload for speed clamping break
any coding convention or API specs?
Thanks,
- Haiyang
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [EXTERNAL] Re: [PATCH v2 2/3] net: mana: Add sched HTB offload support
2025-04-23 15:27 ` [EXTERNAL] " Haiyang Zhang
@ 2025-04-23 21:57 ` Jakub Kicinski
0 siblings, 0 replies; 11+ messages in thread
From: Jakub Kicinski @ 2025-04-23 21:57 UTC (permalink / raw)
To: Haiyang Zhang
Cc: Erni Sri Satya Vennela, KY Srinivasan, wei.liu@kernel.org,
Dexuan Cui, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, Long Li,
Konstantin Taranov, horms@kernel.org, mhklinux@outlook.com,
pasha.tatashin@soleen.com, kent.overstreet@linux.dev,
brett.creeley@amd.com, schakrabarti@linux.microsoft.com,
shradhagupta@linux.microsoft.com, ssengar@linux.microsoft.com,
rosenp@gmail.com, Paul Rosswurm, linux-hyperv@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
On Wed, 23 Apr 2025 15:27:16 +0000 Haiyang Zhang wrote:
> > > We selected tc-htb for our current use case because we plan to support
> > > multiple speed classes in the future.
> >
> > Which net-shapers also support.
>
> Thanks for pointing that out...
> But for easier usage with existing tc tool for customers, can we still
> use tc-htb offload? Does using tc-htb offload for speed clamping break
> any coding convention or API specs?
The only spec here is that the offloaded version is supposed to look
like the non-offloaded one. I really don't see how you can claim that
static single class HTB is a accurate offload of HTB.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 3/3] net: mana: Handle unsupported HWC commands
2025-04-21 6:33 [PATCH v2 0/3] net: mana: Add HTB Qdisc offload support Erni Sri Satya Vennela
2025-04-21 6:33 ` [PATCH v2 1/3] net: mana: Add speed support in mana_get_link_ksettings Erni Sri Satya Vennela
2025-04-21 6:33 ` [PATCH v2 2/3] net: mana: Add sched HTB offload support Erni Sri Satya Vennela
@ 2025-04-21 6:33 ` Erni Sri Satya Vennela
2 siblings, 0 replies; 11+ messages in thread
From: Erni Sri Satya Vennela @ 2025-04-21 6:33 UTC (permalink / raw)
To: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
kuba, pabeni, longli, kotaranov, horms, mhklinux, pasha.tatashin,
ernis, kent.overstreet, brett.creeley, schakrabarti, shradhagupta,
ssengar, leon, rosenp, paulros, linux-hyperv, netdev,
linux-kernel, linux-rdma
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: Shradha Gupta <shradhagupta@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
---
Changes in v2:
* No change.
---
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 1ba49602089b..58cfd247d8c5 100644
--- a/drivers/net/ethernet/microsoft/mana/hw_channel.c
+++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c
@@ -871,6 +871,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 5b62f1443716..cb6a583b32d9 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -871,6 +871,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;
@@ -1269,6 +1272,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");
+ goto out;
+ }
netdev_err(ndev, "Failed to query link config: %d\n", err);
goto out;
}
@@ -1313,6 +1320,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
^ permalink raw reply related [flat|nested] 11+ messages in thread