[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7092c728df06e762aa659119c057b4ee308967d4.camel@microchip.com>
Date: Thu, 28 Apr 2022 16:05:15 +0000
From: <Arun.Ramadoss@...rochip.com>
To: <olteanv@...il.com>
CC: <andrew@...n.ch>, <linux-kernel@...r.kernel.org>,
<UNGLinuxDriver@...rochip.com>, <vivien.didelot@...il.com>,
<f.fainelli@...il.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
<netdev@...r.kernel.org>, <Woojung.Huh@...rochip.com>,
<davem@...emloft.net>
Subject: Re: [RFC patch net-next 3/3] net: dsa: ksz: moved ksz9477 port mirror
to ksz_common.c
On Thu, 2022-04-28 at 18:22 +0300, Vladimir Oltean wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> On Thu, Apr 28, 2022 at 03:09:50PM +0000, Arun.Ramadoss@...rochip.com
> wrote:
> > > > +#define
> > > > P_MIRROR_CTRL REG_PORT_MRI_MIRROR_CTRL
> > > > +
> > > > +#define S_MIRROR_CTRL REG_SW_MRI_CTRL_0
> > >
> > > Small comment: if P_MIRROR_CTRL and S_MIRROR_CTRL are expected to
> > > be
> > > at
> > > the same register offset for all switch families, why is there a
> > > macro
> > > behind a macro for their addresses?
> >
> > ksz8795 and ksz9477 have different address/register for the
> > Mirror_ctrl. To make it common for the both, P_MIRROR_CTRL is
> > defined
> > in ksz8795_reg.h and ksz9477_reg.h file.
> > I just carried forward to ksz_reg.h.
>
> So if P_MIRROR_CTRL has different values for ksz9477 and ksz8795, how
> exactly do you plan to mask that difference away through the C
> preprocessor
> at the level of ksz_reg.h included by ksz_common.c, depending on
> which
> switch driver calls ksz_port_mirror_add()?
>
> This can't work, you need to provide the offset of P_MIRROR_CTRL as
> argument to the common function. What am I missing?
I compared the ksz8795 and ksz9447 mirror_add/del implementation, they
are different. Ksz9477 writes S_MIRROR_CTRL in addition to
P_MIRROL_CTRL. KSZ9477 and LAN937x have similar register set but
KSZ8795 has only limited registers/functionality.
Similar to port_mirror, few other functionality like mib counter, vlan
registers are same for both KSZ9477 & LAN937x.But ksz8795 has different
set of register implementation for that.
So I thought of not to disturb the existing ksz8795 implementation
except for any conflicts, just move the ksz9477 to ksz_common, and call
this for KSZ9477 and LAN937x dsa hooks.
Powered by blists - more mailing lists