From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] net: airoha: Initialize PPE UPDMEM source-mac table
Date: Tue, 27 May 2025 16:22:57 +0200 [thread overview]
Message-ID: <aDXKwWzmE1YSg67u@lore-desk> (raw)
In-Reply-To: <20250523-b4-airoha-flowtable-pppoe-v1-1-8584401568e0@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 6004 bytes --]
> UPDMEM source-mac table is a key-value map used to store devices mac
> addresses according to the port identifier. UPDMEM source mac table is
> used during IPv6 traffic hw acceleration since PPE entries, for space
> constraints, do not contain the full source mac address but just the
> identifier in the UPDMEM source-mac table.
This patch has now a conflict with the following commit:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=c683e378c0907e66cee939145edf936c254ff1e3
Since this is actually a fix, I can repost targeting net tree as soon as
it is aligned to net-next.
Regards,
Lorenzo
>
> Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> drivers/net/ethernet/airoha/airoha_eth.c | 2 ++
> drivers/net/ethernet/airoha/airoha_eth.h | 1 +
> drivers/net/ethernet/airoha/airoha_ppe.c | 25 ++++++++++++++++++++++++-
> drivers/net/ethernet/airoha/airoha_regs.h | 10 ++++++++++
> 4 files changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> index 0d627e511266d94e079e8a87d2f812fb14b4ad07..e4c67c7bbf215d448640f978cd0d9d50abd73644 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.c
> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> @@ -92,6 +92,8 @@ static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
> val = (addr[3] << 16) | (addr[4] << 8) | addr[5];
> airoha_fe_wr(eth, REG_FE_MAC_LMIN(reg), val);
> airoha_fe_wr(eth, REG_FE_MAC_LMAX(reg), val);
> +
> + airoha_ppe_init_upd_mem(port);
> }
>
> static void airoha_set_gdm_port_fwd_cfg(struct airoha_eth *eth, u32 addr,
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.h b/drivers/net/ethernet/airoha/airoha_eth.h
> index 531a3c49c1562a986111a1ce1c215c8751c16e09..a951246c0171e14497b510d3029fc0a7f891efe6 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.h
> +++ b/drivers/net/ethernet/airoha/airoha_eth.h
> @@ -611,6 +611,7 @@ void airoha_ppe_check_skb(struct airoha_ppe *ppe, struct sk_buff *skb,
> int airoha_ppe_setup_tc_block_cb(struct net_device *dev, void *type_data);
> int airoha_ppe_init(struct airoha_eth *eth);
> void airoha_ppe_deinit(struct airoha_eth *eth);
> +void airoha_ppe_init_upd_mem(struct airoha_gdm_port *port);
> struct airoha_foe_entry *airoha_ppe_foe_get_entry(struct airoha_ppe *ppe,
> u32 hash);
> void airoha_ppe_foe_entry_get_stats(struct airoha_ppe *ppe, u32 hash,
> diff --git a/drivers/net/ethernet/airoha/airoha_ppe.c b/drivers/net/ethernet/airoha/airoha_ppe.c
> index 2d273937f19cf304ab4b821241fdc3ea93604f0e..1d5a04eb82a6645e2b6a22ff4e694275ef1727d8 100644
> --- a/drivers/net/ethernet/airoha/airoha_ppe.c
> +++ b/drivers/net/ethernet/airoha/airoha_ppe.c
> @@ -223,6 +223,7 @@ static int airoha_ppe_foe_entry_prepare(struct airoha_eth *eth,
> int dsa_port = airoha_get_dsa_port(&dev);
> struct airoha_foe_mac_info_common *l2;
> u32 qdata, ports_pad, val;
> + u8 smac_id = 0xf;
>
> memset(hwe, 0, sizeof(*hwe));
>
> @@ -251,6 +252,7 @@ static int airoha_ppe_foe_entry_prepare(struct airoha_eth *eth,
> else
> pse_port = 2; /* uplink relies on GDM2 loopback */
> val |= FIELD_PREP(AIROHA_FOE_IB2_PSE_PORT, pse_port);
> + smac_id = port->id;
> }
>
> if (is_multicast_ether_addr(data->eth.h_dest))
> @@ -285,7 +287,7 @@ static int airoha_ppe_foe_entry_prepare(struct airoha_eth *eth,
> hwe->ipv4.l2.src_mac_lo =
> get_unaligned_be16(data->eth.h_source + 4);
> } else {
> - l2->src_mac_hi = FIELD_PREP(AIROHA_FOE_MAC_SMAC_ID, 0xf);
> + l2->src_mac_hi = FIELD_PREP(AIROHA_FOE_MAC_SMAC_ID, smac_id);
> }
>
> if (data->vlan.num) {
> @@ -1232,6 +1234,27 @@ void airoha_ppe_check_skb(struct airoha_ppe *ppe, struct sk_buff *skb,
> airoha_ppe_foe_insert_entry(ppe, skb, hash);
> }
>
> +void airoha_ppe_init_upd_mem(struct airoha_gdm_port *port)
> +{
> + struct airoha_eth *eth = port->qdma->eth;
> + struct net_device *dev = port->dev;
> + const u8 *addr = dev->dev_addr;
> + u32 val;
> +
> + val = (addr[2] << 24) | (addr[3] << 16) | (addr[4] << 8) | addr[5];
> + airoha_fe_wr(eth, REG_UPDMEM_DATA(0), val);
> + airoha_fe_wr(eth, REG_UPDMEM_CTRL(0),
> + FIELD_PREP(PPE_UPDMEM_ADDR_MASK, port->id) |
> + PPE_UPDMEM_WR_MASK | PPE_UPDMEM_REQ_MASK);
> +
> + val = (addr[0] << 8) | addr[1];
> + airoha_fe_wr(eth, REG_UPDMEM_DATA(0), val);
> + airoha_fe_wr(eth, REG_UPDMEM_CTRL(0),
> + FIELD_PREP(PPE_UPDMEM_ADDR_MASK, port->id) |
> + FIELD_PREP(PPE_UPDMEM_OFFSET_MASK, 1) |
> + PPE_UPDMEM_WR_MASK | PPE_UPDMEM_REQ_MASK);
> +}
> +
> int airoha_ppe_init(struct airoha_eth *eth)
> {
> struct airoha_ppe *ppe;
> diff --git a/drivers/net/ethernet/airoha/airoha_regs.h b/drivers/net/ethernet/airoha/airoha_regs.h
> index d931530fc96fb00ada36a6ad37fa295865a6f0a8..04187eb40ec674ec5a4ccfc968bb4bd579a53095 100644
> --- a/drivers/net/ethernet/airoha/airoha_regs.h
> +++ b/drivers/net/ethernet/airoha/airoha_regs.h
> @@ -313,6 +313,16 @@
> #define REG_PPE_RAM_BASE(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x320)
> #define REG_PPE_RAM_ENTRY(_m, _n) (REG_PPE_RAM_BASE(_m) + ((_n) << 2))
>
> +#define REG_UPDMEM_CTRL(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x370)
> +#define PPE_UPDMEM_ACK_MASK BIT(31)
> +#define PPE_UPDMEM_ADDR_MASK GENMASK(11, 8)
> +#define PPE_UPDMEM_OFFSET_MASK GENMASK(7, 4)
> +#define PPE_UPDMEM_SEL_MASK GENMASK(3, 2)
> +#define PPE_UPDMEM_WR_MASK BIT(1)
> +#define PPE_UPDMEM_REQ_MASK BIT(0)
> +
> +#define REG_UPDMEM_DATA(_n) (((_n) ? PPE2_BASE : PPE1_BASE) + 0x374)
> +
> #define REG_FE_GDM_TX_OK_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x280)
> #define REG_FE_GDM_TX_OK_BYTE_CNT_H(_n) (GDM_BASE(_n) + 0x284)
> #define REG_FE_GDM_TX_ETH_PKT_CNT_H(_n) (GDM_BASE(_n) + 0x288)
>
> --
> 2.49.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-05-27 14:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-23 19:23 [PATCH net-next 0/2] net: airoha: Enable hw acceleration for PPPoE traffic Lorenzo Bianconi
2025-05-23 19:23 ` [PATCH net-next 1/2] net: airoha: Initialize PPE UPDMEM source-mac table Lorenzo Bianconi
2025-05-27 14:22 ` Lorenzo Bianconi [this message]
2025-05-23 19:23 ` [PATCH net-next 2/2] net: airoha: Add PPPoE offload 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=aDXKwWzmE1YSg67u@lore-desk \
--to=lorenzo@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.