lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <18980367-e2d0-43b8-8643-45b800eb34c9@lunn.ch>
Date: Fri, 25 Jul 2025 18:17:59 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Wen Gu <guwen@...ux.alibaba.com>,
	Philo Lu <lulie@...ux.alibaba.com>,
	Lorenzo Bianconi <lorenzo@...nel.org>,
	Lukas Bulwahn <lukas.bulwahn@...hat.com>,
	Parthiban Veerasooran <Parthiban.Veerasooran@...rochip.com>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Dust Li <dust.li@...ux.alibaba.com>
Subject: Re: [PATCH net-next v1] eea: Add basic driver framework for Alibaba
 Elastic Ethernet Adaptor

> > > +static int eea_netdev_stop(struct net_device *netdev)
> > > +{
> > > +	struct eea_net *enet = netdev_priv(netdev);
> > > +
> > > +	if (!enet->started) {
> > > +		netdev_warn(netdev, "eea netdev stop: but dev is not started.\n");
> > > +		return 0;
> > > +	}
> >
> > How does this happen?
> 
> This function can be called from other contexts.
> 
> When we receive an HA interrupt, it may indicate that there is an error inside
> the device, and this function may be called as a result.

So maybe a comment would be good.

But if this is intended behaviour, why the netdev_warn()?

The fact there is a HA interrupt and the device is broken should be
reported at a higher level, in the HA interrupt handler.

> > > +static int eea_netdev_open(struct net_device *netdev)
> > > +{
> > > +	struct eea_net *enet = netdev_priv(netdev);
> > > +	struct eea_net_tmp tmp = {};
> > > +	int err;
> > > +
> > > +	if (enet->link_err) {
> > > +		netdev_err(netdev, "netdev open err, because link error: %d\n",
> > > +			   enet->link_err);
> >
> > What is a link error? You should be able to admin an interface up if
> > the cable is not plugged in.
> 
> 
> The device may send an interrupt to the driver, and then the driver can query
> the device. If there is an error inside the device, the driver will stop
> the device. If the user tries to bring up the network device, we will
> attempt to prevent that operation.

So maybe enet->link_err is a bad name? enet->device_crashed? It makes
it clear it has nothing to do with the link, but the device.

> > > +static int __eea_pci_probe(struct pci_dev *pci_dev,
> > > +			   struct eea_pci_device *ep_dev);
> > > +static void __eea_pci_remove(struct pci_dev *pci_dev, bool flush_ha_work);
> >
> > No forward declarations. Put the code in the correct order so they are
> > not needed.
> 
> Here A calls B, B calls C, and C calls A. Please believe me, I don't like this
> approach either, but this is the simplest way and allows us to keep the related
> code together.

If you need to do something which breaks the usual conventions, add a
comment why it is needed. You are then less likely to be asked to
change it/explain it.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ