lkml.org 
[lkml]   [2021]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 2/2] net: ethernet: Add driver for Sunplus SP7021
Date
Hi, 


> > > > +static const char def_mac_addr[ETHERNET_MAC_ADDR_LEN] = {
> > > > + 0xfc, 0x4b, 0xbc, 0x00, 0x00, 0x00
> > >
> > > This does not have the locally administered bit set. Should it? Or
> > > is this and address from your OUI?
> >
> > This is default MAC address when MAC address in NVMEM is not found.
> > Fc:4b:bc:00:00:00 is OUI of "Sunplus Technology Co., Ltd.".
> > Can I keep this? or it should be removed?
>
> Please add a comment about whos OUI it is.
>
> It is however more normal to use a random MAC address if no other MAC address is available.
> That way, you avoid multiple devices on one LAN using the same default MAC address.

Yes, I'll add a comment about the OUI and also use 'get_random_int() % 255'
to generate the latest 3 octets (controller specific).


> > > > + if (mac->next_ndev) {
> > > > + struct net_device *ndev2 = mac->next_ndev;
> > > > +
> > > > + if (!netif_carrier_ok(ndev2) && (reg & PORT_ABILITY_LINK_ST_P1)) {
> > > > + netif_carrier_on(ndev2);
> > > > + netif_start_queue(ndev2);
> > > > + } else if (netif_carrier_ok(ndev2) && !(reg & PORT_ABILITY_LINK_ST_P1)) {
> > > > + netif_carrier_off(ndev2);
> > > > + netif_stop_queue(ndev2);
> > > > + }
> > >
> > > Looks very odd. The two netdev should be independent.
> >
> > I don't understand your comment.
> > ndev checks PORT_ABILITY_LINK_ST_P0
> > ndev2 checks PORT_ABILITY_LINK_ST_P1
> > They are independent already.
>
> I would try to remove the mac->next_ndev. I think without that, you will get a cleaner
> abstraction. You might want to keep an array of mac pointers in your top level shared
> structure.

Yes, I'll define a array (pointer to struct net_dev or mac) in driver private (shared)
structure to access to all net devices. No more mac->next_ndev;.


> Andrew

Thank you very much for your review.

Best regards,
Wells
\
 
 \ /
  Last update: 2021-11-18 09:23    [W:0.086 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site