Re: [PATCH net-next 12/13] dpaa2-switch: add support for imprecise source port
From: Ioana Ciornei
Date: Mon May 11 2026 - 07:33:03 EST
On Wed, May 06, 2026 at 06:15:39PM +0300, Ioana Ciornei wrote:
> Switch ports configured as part of a LAG group are not able to provide
> a precise source port for all packets which reach the control interface.
>
> The only frames which will have a precise source port are those that are
> explicitly trapped, for example STP and LCAP frames. For any other
> frames (for example, those which are flooded) we can only know the
> ingress LAG group.
>
> Take into account the DPAA2_ETHSW_FLC_IMPRECISE_IF_ID bit and based on
> its value target the bond device or the specific source netdevice.
>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@xxxxxxx>
> ---
> drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 10 ++++++++--
> drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h | 3 +++
> 2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
> index 59ed06ed7ef6..8353d2230c72 100644
> --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
> +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
> @@ -3075,9 +3075,12 @@ static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq,
> struct sk_buff *skb;
> u16 vlan_tci, vid;
> int if_id, err;
> + u64 flc;
> +
> + flc = dpaa2_fd_get_flc(fd);
>
> /* get switch ingress interface ID */
> - if_id = upper_32_bits(dpaa2_fd_get_flc(fd)) & 0x0000FFFF;
> + if_id = DPAA2_ETHSW_FLC_IF_ID(flc);
>
> if (if_id >= ethsw->sw_attr.num_ifs) {
> dev_err(ethsw->dev, "Frame received from unknown interface!\n");
Sashiko noted:
This isn't a regression introduced by this commit, but does
jumping to err_free_fd cause a kernel panic here?
Since dpaa2_switch_free_fd() is a TX-specific cleanup function
that expects the first 8 bytes of the DMA buffer to contain a
valid skb pointer, will calling it on an RX buffer read
uninitialized memory and crash when passed to dev_kfree_skb()?
Good point, instead of the dpaa2_switch_free_fd() call there should be a
simple free_pages(). On the other hand, I will not add the fix to this
patch set since it's already quite substantial.