[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211018070845.68ba815d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Mon, 18 Oct 2021 07:08:45 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Ido Schimmel <idosch@...sch.org>
Cc: netdev@...r.kernel.org, olteanv@...il.com, andrew@...n.ch,
f.fainelli@...il.com, jiri@...dia.com, idosch@...dia.com,
lars.povlsen@...rochip.com, Steen.Hegelund@...rochip.com,
UNGLinuxDriver@...rochip.com, bjarni.jonasson@...rochip.com,
linux-arm-kernel@...ts.infradead.org, qiangqing.zhang@....com,
vkochan@...vell.com, tchornyi@...vell.com, vladimir.oltean@....com,
claudiu.manoil@....com, alexandre.belloni@...tlin.com
Subject: Re: [RFC net-next 1/6] ethernet: add a helper for assigning port
addresses
On Sun, 17 Oct 2021 18:06:17 +0300 Ido Schimmel wrote:
> On Fri, Oct 15, 2021 at 12:38:43PM -0700, Jakub Kicinski wrote:
> > +/**
> > + * eth_hw_addr_set_port - Generate and assign Ethernet address to a port
> > + * @dev: pointer to port's net_device structure
> > + * @base_addr: base Ethernet address
> > + * @id: offset to add to the base address
> > + *
> > + * Assign a MAC address to the net_device using a base address and an offset.
> > + * Commonly used by switch drivers which need to compute addresses for all
> > + * their ports. addr_assign_type is not changed.
> > + */
> > +static inline void eth_hw_addr_set_port(struct net_device *dev,
> > + const u8 *base_addr, u8 id)
>
> If necessary, would it be possible to change 'id' to u16?
Let me make it an unsigned int, I had u8 initially because I wasn't
planning on doing the wrapping and wanted the compiler to warn.
> I'm asking because currently in mlxsw we set the MAC of each netdev to
> 'base_mac + local_port' where 'local_port' is u8. In Spectrum-4 we are
> going to have more than 256 logical ports, so 'local_port' becomes u16.
>
> Regarding the naming, eth_hw_addr_gen() sounds good to me.
Powered by blists - more mailing lists