mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: filipp.dunsky@gmail.com
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Hans Ulli Kroll <ulli.kroll@googlemail.com>,
	Linus Walleij <linusw@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 4/5] net: cortina: Add CS7542 CPU network datapath
Date: Mon, 23 Nov 2026 23:24:35 +0100	[thread overview]
Message-ID: <560efd8b-44a6-4b3f-9f88-d1a891b4f253@lunn.ch> (raw)
In-Reply-To: <20261123-b4-cs7542-ethernet-v1-4-fdb5e8c2d508@gmail.com>

> +static bool internal_buf;
> +module_param(internal_buf, bool, 0444);
> +static int napi_budget = 16;
> +module_param(napi_budget, int, 0444);

No module parameters.

Also, this napi budget is lower than typical. Why?

> +
> +static inline u32 ni_rd(struct cs_ne *ne, u32 off)
> +{
> +	return readl(ne->ni + off);
> +}

No inline functions in a .c file. Let the compiler decide.

> +static int cs_ne_open(struct net_device *ndev)
> +{
> +	struct cs_ne_port *port = netdev_priv(ndev);
> +	struct cs_ne *ne = port->ne;
> +	unsigned long flags;
> +	int ret;
> +
> +	/* RTNL also protects the final probe activation. */
> +	if (ne->rx_stopping)
> +		return -ENODEV;
> +	if (READ_ONCE(ne->txq.fault))
> +		return -EIO;
> +
> +	ret = phylink_of_phy_connect(port->phylink, port->np, 0);
> +	if (ret) {
> +		netdev_err(ndev, "phylink connect failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	port->rd = ni_rd(ne, NI_CPUXRAM_CPU_CFG_RX(port->id)) & NI_XRAM_PTR_MASK;
> +	napi_enable(&port->napi);
> +	ret = request_irq(port->irq, cs_ne_rx_irq, 0, ndev->name, port);
> +	if (ret) {
> +		napi_disable(&port->napi);
> +		phylink_disconnect_phy(port->phylink);
> +		return ret;
> +	}
> +	spin_lock_bh(&ne->txq.lock);
> +	if (ne->txq.fault) {
> +		spin_unlock_bh(&ne->txq.lock);
> +		free_irq(port->irq, port);
> +		napi_disable(&port->napi);
> +		phylink_disconnect_phy(port->phylink);
> +		return -EIO;

Please put cleanup at the end and use goto statements. That is the
general pattern in the kernel when there is more than one thing to
cleanup.

> +	}
> +	WRITE_ONCE(port->opened, true);
> +	ne->txq.stopping = false;

I've not looked at the details, but such flags are often not
needed. They generally indicate there is not a full understanding of
the driver API. Please review them, and see if they are really needed.

    Andrew

  reply	other threads:[~2026-11-23 22:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 18:44 [PATCH net-next 0/5] net: cortina: Add CS7542 network engine support Fil Dunsky via B4 Relay
2026-11-23 18:44 ` [PATCH net-next 1/5] dt-bindings: reset: Add Cortina CS7542 network engine reset domain Fil Dunsky via B4 Relay
2026-11-23 18:44 ` [PATCH net-next 2/5] reset: Add Cortina CS7542 network engine domain control Fil Dunsky via B4 Relay
2026-11-23 18:44 ` [PATCH net-next 3/5] dt-bindings: net: Add Cortina CS7542 network engine Fil Dunsky via B4 Relay
2026-11-23 22:05   ` Andrew Lunn
2026-11-23 22:31     ` Fil Dunsky
2026-11-23 18:44 ` [PATCH net-next 4/5] net: cortina: Add CS7542 CPU network datapath Fil Dunsky via B4 Relay
2026-11-23 22:24   ` Andrew Lunn [this message]
2026-11-23 18:44 ` [PATCH net-next 5/5] MAINTAINERS: Add CS7542 network engine support Fil Dunsky via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=560efd8b-44a6-4b3f-9f88-d1a891b4f253@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=filipp.dunsky@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=ulli.kroll@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®