devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Felix Fietkau <nbd@nbd.name>,
	Sean Wang <sean.wang@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	"Chester A. Unal" <chester.a.unal@arinc9.com>,
	Daniel Golle <daniel@makrotopia.org>,
	DENG Qingfang <dqfext@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <olteanv@gmail.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org,
	upstream@airoha.com
Subject: Re: [PATCH net-next v5 05/15] net: airoha: Move DSA tag in DMA descriptor
Date: Thu, 20 Feb 2025 14:25:35 -0800	[thread overview]
Message-ID: <20250220142535.584b0423@kernel.org> (raw)
In-Reply-To: <20250217-airoha-en7581-flowtable-offload-v5-5-28be901cb735@kernel.org>

On Mon, 17 Feb 2025 14:01:09 +0100 Lorenzo Bianconi wrote:
> +static u32 airoha_get_dsa_tag(struct sk_buff *skb, struct net_device *dev)
> +{
> +#if IS_ENABLED(CONFIG_NET_DSA)
> +	struct ethhdr *ehdr;
> +	struct dsa_port *dp;
> +	u8 xmit_tpid;
> +	u16 tag;
> +
> +	if (!netdev_uses_dsa(dev))
> +		return 0;
> +
> +	dp = dev->dsa_ptr;
> +	if (IS_ERR(dp))
> +		return 0;
> +
> +	if (dp->tag_ops->proto != DSA_TAG_PROTO_MTK)
> +		return 0;
> +
> +	if (skb_ensure_writable(skb, ETH_HLEN))
> +		return 0;

skb_cow_head() is a lot cheaper (for TCP)

> +	ehdr = (struct ethhdr *)skb->data;
> +	tag = be16_to_cpu(ehdr->h_proto);
> +	xmit_tpid = tag >> 8;

> @@ -2390,8 +2498,10 @@ static int airoha_probe(struct platform_device *pdev)
>  	for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
>  		struct airoha_gdm_port *port = eth->ports[i];
>  
> -		if (port && port->dev->reg_state == NETREG_REGISTERED)
> +		if (port && port->dev->reg_state == NETREG_REGISTERED) {
> +			airoha_metadata_dst_free(port);
>  			unregister_netdev(port->dev);

Looks a tiny bit reversed, isn't it?
First unregister the netdev, then free its metadata.

> +		}
>  	}
>  	free_netdev(eth->napi_dev);
>  	platform_set_drvdata(pdev, NULL);
> @@ -2416,6 +2526,7 @@ static void airoha_remove(struct platform_device *pdev)
>  			continue;
>  
>  		airoha_dev_stop(port->dev);
> +		airoha_metadata_dst_free(port);
>  		unregister_netdev(port->dev);

same here

>  	}
>  	free_netdev(eth->napi_dev);

  reply	other threads:[~2025-02-20 22:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 13:01 [PATCH net-next v5 00/15] Introduce flowtable hw offloading in airoha_eth driver Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 01/15] net: airoha: Move airoha_eth driver in a dedicated folder Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 02/15] net: airoha: Move definitions in airoha_eth.h Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 03/15] net: airoha: Move reg/write utility routines " Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 04/15] net: airoha: Move register definitions in airoha_regs.h Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 05/15] net: airoha: Move DSA tag in DMA descriptor Lorenzo Bianconi
2025-02-20 22:25   ` Jakub Kicinski [this message]
2025-02-21 10:20     ` Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 06/15] net: dsa: mt7530: Enable Rx sptag for EN7581 SoC Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 07/15] net: airoha: Enable support for multiple net_devices Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 08/15] net: airoha: Move REG_GDM_FWD_CFG() initialization in airoha_dev_init() Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 09/15] net: airoha: Rename airoha_set_gdm_port_fwd_cfg() in airoha_set_vip_for_gdm_port() Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 10/15] dt-bindings: net: airoha: Add the NPU node for EN7581 SoC Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 11/15] dt-bindings: net: airoha: Add airoha,npu phandle property Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 12/15] net: airoha: Introduce Airoha NPU support Lorenzo Bianconi
2025-02-20 22:38   ` Jakub Kicinski
2025-02-21 10:21     ` Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 13/15] net: airoha: Introduce flowtable offload support Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 14/15] net: airoha: Add loopback support for GDM2 Lorenzo Bianconi
2025-02-17 13:01 ` [PATCH net-next v5 15/15] net: airoha: Introduce PPE debugfs support Lorenzo Bianconi

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=20250220142535.584b0423@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chester.a.unal@arinc9.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=sean.wang@mediatek.com \
    --cc=upstream@airoha.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;
as well as URLs for NNTP newsgroup(s).