Re: [PATCH net-next 9/9] net: pse-pd: Add PD692x0 PSE controller driver

From: Köry Maincent
Date: Wed Nov 22 2023 - 11:11:21 EST


Thanks for your reviews!

On Thu, 16 Nov 2023 23:54:02 +0100
Andrew Lunn <andrew@xxxxxxx> wrote:

> I'm reading this patch first, so this might be a dumb question...
>
> > +static int pd692x0_recv_msg(struct pd692x0_priv *priv,
> > + struct pd692x0_msg *msg,
> > + struct pd692x0_msg_content *buf)
> > +{
>
> ...
>
> > + i2c_master_recv(client, (u8 *)buf, sizeof(*buf));
> > + if (buf->key)
> > + goto out;
> > +
> > + msleep(10000);
>
> That is 10 seconds, right?

Yes, it is in the communication loss procedure.

>
> > +static int pd692x0_sendrecv_msg(struct pd692x0_priv *priv,
> > + struct pd692x0_msg *msg,
> > + struct pd692x0_msg_content *buf)
> > +{
> > + struct device *dev = &priv->client->dev;
> > + int ret;
> > +
> > + ret = pd692x0_send_msg(priv, msg);
> > + if (ret)
> > + return ret;
> > +
> > + ret = pd692x0_recv_msg(priv, msg, buf);
>
> So this function takes at least 10 seconds?

No, on normal communication it takes a bit more than 30ms.
It could be more if there are communication loss, even reset the controller.
See the communication loss procedure in "PD692x0 BT Serial Communication
Protocol User Guide" for details.

> > +static int pd692x0_ethtool_set_config(struct pse_controller_dev *pcdev,
> > + unsigned long id,
> > + struct netlink_ext_ack *extack,
> > + const struct pse_control_config
> > *config) +{
>
> ....
>
> > + switch (config->admin_control) {
> > + case ETHTOOL_PSE_ADMIN_STATE_ENABLED:
> > + msg.content.data[0] = 0x1;
> > + break;
> > + case ETHTOOL_PSE_ADMIN_STATE_DISABLED:
> > + msg.content.data[0] = 0x0;
> > + break;
> > + default:
> > + return -EOPNOTSUPP;
> > + }
> > +
> > + msg.content.sub[2] = id;
> > + ret = pd692x0_sendrecv_msg(priv, &msg, &buf);
>
> So this is also 10 seconds?
>
> Given its name, it looks like this is called via ethtool? Is the
> ethtool core holding RTNL? It is generally considered bad to hold RTNL for
> that long.

Yes it is holding RTNL lock. Should I consider another behavior in case of
communication loss to not holding RTNL lock so long?

Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com