Re: [PATCH RESEND v4 net-next 11/14] net: enetc: move enetc_set_si_vlan_promisc() to enetc_pf_common.c
From: Joe Damato
Date: Mon Jul 20 2026 - 12:17:31 EST
On Mon, Jul 20, 2026 at 09:43:13AM +0800, wei.fang@xxxxxxxxxxx wrote:
> From: Wei Fang <wei.fang@xxxxxxx>
>
> The PSIPVMR in ENETC v4 has the same bit layout and functionality as the
> PSIPVMR register in ENETC v1: bit n (n <= 15) controls VLAN promiscuous
> mode for SI n. The only difference between the two hardware generations
> is the register address offset.
>
> Since the register functionality is identical, the VLAN promiscuous mode
> setting code can be shared between ENETC v1 and v4 drivers.
>
> Move enetc_set_si_vlan_promisc() from enetc_pf.c to enetc_pf_common.c
> and export it so that it can be shared between the two drivers. Add a
> revision check using is_enetc_rev1() to select the correct register
> offset (ENETC_PSIPVMR for v1 and ENETC4_PSIPVMR for v4) while keeping
> the same logic.
>
> Remove the v4-specific enetc4_pf_set_si_vlan_promisc() from enetc4_pf.c
> and replace its call site with the new common enetc_set_si_vlan_promisc()
> to eliminate code duplication.
>
> Signed-off-by: Wei Fang <wei.fang@xxxxxxx>
> ---
> .../net/ethernet/freescale/enetc/enetc4_pf.c | 17 ++------------
> .../net/ethernet/freescale/enetc/enetc_pf.c | 16 --------------
> .../freescale/enetc/enetc_pf_common.c | 22 +++++++++++++++++++
> .../freescale/enetc/enetc_pf_common.h | 1 +
> 4 files changed, 25 insertions(+), 31 deletions(-)
Reviewed-by: Joe Damato <joe@xxxxxxx>