Re: [PATCH 1/3] net: mana: Add speed support in mana_get_link_ksettings
From: Andrew Lunn
Date: Mon Mar 24 2025 - 14:46:43 EST
On Mon, Mar 24, 2025 at 10:43:39AM -0700, Erni Sri Satya Vennela wrote:
> On Thu, Mar 20, 2025 at 02:37:47PM +0100, Andrew Lunn wrote:
> > > +int mana_query_link_cfg(struct mana_port_context *apc)
> > > +{
> > > + struct net_device *ndev = apc->ndev;
> > > + struct mana_query_link_config_req req = {};
> > > + struct mana_query_link_config_resp resp = {};
> > > + 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 = -EPROTO;
> > > + goto out;
> > > + }
> > > +
> > > + if (resp.qos_unconfigured) {
> > > + err = -EINVAL;
> > > + goto out;
> > > + }
> > > + apc->speed = resp.link_speed;
> >
> > Might be worth adding a comment that the firmware is returning speed
> > in Mbps.
> >
> > Or name the struct member link_speed_mbps.
> >
> Thank you for your suggestion. I'll make this change for the next
> version of this patchset.
Please answer my other questions before posting the next version of
the patch. I'm really questioning if this is the correct uAPI to be
using. You have a very poor description of what you are trying to
do. Maybe TC is the better fit? Does this speed apply to ingress and
egress? If so, there are two leaky buckets, so why only one
configuration value? Or can you only configure ingress?
Also, if i understand correctly MANA is a virtual device and this is
the VM side of it. If this is used for bandwidth limitation, why is
the VM controlling this, not the hypervisor? What is the security
model?
Andrew