Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: nick.hawkins@hpe.com
Cc: christophe.jaillet@wanadoo.fr, simon.horman@corigine.com,
	verdun@hpe.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/5] net: hpe: Add GXP UMAC Driver
Date: Thu, 17 Aug 2023 03:46:34 +0200	[thread overview]
Message-ID: <01e96219-4f0c-4259-9398-bc2e6bc1794f@lunn.ch> (raw)
In-Reply-To: <20230816215220.114118-5-nick.hawkins@hpe.com>

> +static int umac_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
> +{
> +	if (!netif_running(ndev))
> +		return -EINVAL;
> +
> +	if (!ndev->phydev)
> +		return -ENODEV;
> +
> +	return phy_mii_ioctl(ndev->phydev, ifr, cmd);

Sometimes power management does not allow it, but can you use phy_do_ioctl()?

> +static int umac_init_hw(struct net_device *ndev)


> +{
> +	} else {
> +		value |= UMAC_CFG_FULL_DUPLEX;
> +
> +		if (ndev->phydev->speed == SPEED_1000) {

I'm pretty sure i pointed this out once before. It is not safe to
access phydev members outside of the adjust link callback.

> +static int umac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> +{
> +	struct umac_priv *umac = netdev_priv(ndev);
> +	struct umac_tx_desc_entry *ptxdesc;
> +	unsigned int length;
> +	u8 *pframe;
> +
> +	ptxdesc = &umac->tx_descs->entrylist[umac->tx_cur];
> +	pframe = umac->tx_descs->framelist[umac->tx_cur];
> +
> +	length = skb->len;
> +	if (length > 1514) {
> +		netdev_err(ndev, "send data %d bytes > 1514, clamp it to 1514\n",
> +			   skb->len);

Than should be rate limited.

Also, if you chop the end of the packet, it is going to be useless. It
is better to drop it, to improve your goodput.

> +		length = 1514;
> +	}
> +
> +	memset(pframe, 0, UMAC_MAX_FRAME_SIZE);
> +	memcpy(pframe, skb->data, length);

Is this cached or uncached memory? uncached is expansive so you want
to avoid touching it twice. Depending on how busy your cache is,
touching it twice might cause it to expelled from L1 on the first
write, so you could be writing to L2 twice for no reason. Do the math
and calculate the tail space you need to zero.

I would also suggest you look at the page pool code and use that for
all you buffer handling. It is likely to be more efficient than what
you have here.

> +static int umac_setup_phy(struct net_device *ndev)
> +{
> +	struct umac_priv *umac = netdev_priv(ndev);
> +	struct platform_device *pdev = umac->pdev;
> +	struct device_node *phy_handle;
> +	phy_interface_t interface;
> +	struct device_node *eth_ports_np;
> +	struct device_node *port_np;
> +	int ret;
> +	int i;
> +
> +	/* Get child node ethernet-ports. */
> +	eth_ports_np = of_get_child_by_name(pdev->dev.of_node, "ethernet-ports");
> +	if (!eth_ports_np) {
> +		dev_err(&pdev->dev, "No ethernet-ports child node found!\n");
> +		return -ENODEV;
> +	}
> +
> +	for (i = 0; i < NUMBER_OF_PORTS; i++) {
> +		/* Get port@i of node ethernet-ports */
> +		port_np = gxp_umac_get_eth_child_node(eth_ports_np, i);
> +		if (!port_np)
> +			break;
> +
> +		if (i == INTERNAL_PORT) {
> +			phy_handle = of_parse_phandle(port_np, "phy-handle", 0);
> +			if (phy_handle) {
> +				umac->int_phy_dev = of_phy_find_device(phy_handle);
> +				if (!umac->int_phy_dev)
> +					return -ENODEV;

You appear to find the PHY, and then do nothing with it?

    Andrew

  reply	other threads:[~2023-08-17  1:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 21:52 [PATCH v3 0/5] ARM: Add GXP UMAC Support nick.hawkins
2023-08-16 21:52 ` [PATCH v3 1/5] dt-bindings: net: Add HPE GXP UMAC MDIO nick.hawkins
2023-08-17  1:10   ` Andrew Lunn
2023-08-16 21:52 ` [PATCH v3 2/5] net: hpe: Add " nick.hawkins
2023-08-17  1:19   ` Andrew Lunn
2023-08-16 21:52 ` [PATCH v3 3/5] dt-bindings: net: Add HPE GXP UMAC nick.hawkins
2023-08-17  8:53   ` Conor Dooley
2023-08-16 21:52 ` [PATCH v3 4/5] net: hpe: Add GXP UMAC Driver nick.hawkins
2023-08-17  1:46   ` Andrew Lunn [this message]
2023-08-17 19:19     ` Hawkins, Nick
2023-08-17 19:44       ` Andrew Lunn
2023-08-18 20:11     ` Hawkins, Nick
2023-08-18 21:15       ` Andrew Lunn
2023-08-22 19:00         ` Hawkins, Nick
2023-08-22 20:00           ` Andrew Lunn
2023-08-25 18:54             ` Hawkins, Nick
2023-09-04  3:58               ` Andrew Lunn
2023-09-11 21:12                 ` Hawkins, Nick
2023-09-12 23:52                   ` Andrew Lunn
2023-08-17  7:45   ` Simon Horman
2023-08-16 21:52 ` [PATCH v3 5/5] MAINTAINERS: HPE: Add GXP UMAC Networking Files nick.hawkins
2023-08-17  1:47   ` Andrew Lunn
2023-08-17  1:08 ` [PATCH v3 0/5] ARM: Add GXP UMAC Support Andrew Lunn

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=01e96219-4f0c-4259-9398-bc2e6bc1794f@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nick.hawkins@hpe.com \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    --cc=simon.horman@corigine.com \
    --cc=verdun@hpe.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