[PATCH net-next v2] net: mana: Fix incorrect speed reported by debugfs

Erni Sri Satya Vennela posted 1 patch 1 month, 2 weeks ago
There is a newer version of this series
drivers/net/ethernet/microsoft/mana/mana_en.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH net-next v2] net: mana: Fix incorrect speed reported by debugfs
Posted by Erni Sri Satya Vennela 1 month, 2 weeks ago
Once the netshaper is created for MANA, the current bandwidth
is reported in debugfs like this:

$ sudo ./tools/net/ynl/pyynl/cli.py \
  --spec Documentation/netlink/specs/net_shaper.yaml \
  --do set \
  --json '{"ifindex":'3',
           "handle":{ "scope": "netdev", "id":'1' },
           "bw-max": 200000000 }'
None

$ sudo cat /sys/kernel/debug/mana/1/vport0/current_speed
200

After the shaper  is deleted, it is expected to report
the maximum speed supported by the SKU. But currently it is
reporting 0, which is incorrect.

Fix this inconsistency, by resetting apc->speed to apc->max_speed
during deletion of the shaper object. This will improve
readability and debuggability.

Fixes: 75cabb46935b ("net: mana: Add support for net_shaper_ops") 
Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
---
Changes in v2:
* Add Fixes tag.
---
 drivers/net/ethernet/microsoft/mana/mana_en.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index 0142fd98392c..9d56bfefd755 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -814,7 +814,7 @@ static int mana_shaper_del(struct net_shaper_binding *binding,
 		/* Reset mana port context parameters */
 		apc->handle.id = 0;
 		apc->handle.scope = NET_SHAPER_SCOPE_UNSPEC;
-		apc->speed = 0;
+		apc->speed = apc->max_speed;
 	}
 
 	return err;
-- 
2.43.0
Re: [PATCH net-next v2] net: mana: Fix incorrect speed reported by debugfs
Posted by Jakub Kicinski 1 month, 2 weeks ago
On Wed, 29 Oct 2025 03:52:34 -0700 Erni Sri Satya Vennela wrote:
> Fixes: 75cabb46935b ("net: mana: Add support for net_shaper_ops") 

I've preferred this without the fixes tag, TBH.
It's debugfs, nobody is supposed to be using it in production.
-- 
pw-bot: cr
Re: [PATCH net-next v2] net: mana: Fix incorrect speed reported by debugfs
Posted by Erni Sri Satya Vennela 1 month, 1 week ago
On Wed, Oct 29, 2025 at 06:52:28PM -0700, Jakub Kicinski wrote:
> On Wed, 29 Oct 2025 03:52:34 -0700 Erni Sri Satya Vennela wrote:
> > Fixes: 75cabb46935b ("net: mana: Add support for net_shaper_ops") 
> 
> I've preferred this without the fixes tag, TBH.
> It's debugfs, nobody is supposed to be using it in production.
> -- 
> pw-bot: cr
I'll send v3 without the fixes tag.
Thankyou for the pointer.