Commit 14003958 authored by Erni Sri Satya Vennela's avatar Erni Sri Satya Vennela Committed by Jakub Kicinski
Browse files

net: mana: Fix incorrect speed reported by debugfs



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.

Signed-off-by: default avatarErni Sri Satya Vennela <ernis@linux.microsoft.com>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/1762369468-32570-1-git-send-email-ernis@linux.microsoft.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3f47e67d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -854,7 +854,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;