All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@savoirfairelinux.com,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH net-next v2 2/6] net: dsa: mv88e6xxx: move ATU code in its own file
Date: Fri, 17 Feb 2017 22:35:18 +0100	[thread overview]
Message-ID: <20170217213518.GH6096@lunn.ch> (raw)
In-Reply-To: <20170217150531.2181-3-vivien.didelot@savoirfairelinux.com>

On Fri, Feb 17, 2017 at 10:05:27AM -0500, Vivien Didelot wrote:
> Move the Global (1) ATU related code in its own file, and export the
> necessary primitives.
> 
> Use that opportunity to provide a cleaner API for the ATU, by renaming a
> few underscore prefixed functions, and members of the
> mv88e6xxx_atu_entry structures.

>  static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
>  					const unsigned char *addr, u16 vid,
>  					u8 state)
>  {
> +	struct mv88e6xxx_atu_entry entry = { 0 };
>  	struct mv88e6xxx_vtu_entry vlan;
> -	struct mv88e6xxx_atu_entry entry;
>  	int err;
>  
>  	/* Null VLAN ID corresponds to the port private database */
> @@ -2107,21 +1918,32 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
>  	if (err)
>  		return err;
>  
> -	err = mv88e6xxx_atu_get(chip, vlan.fid, addr, &entry);
> +	entry.fid = vlan.fid;
> +	ether_addr_copy(entry.mac, addr);
> +	eth_addr_dec(entry.mac);
> +	err = mv88e6xxx_atu_getnext(chip, &entry);
>  	if (err)
>  		return err;
>  
> +	/* Initialize a fresh ATU entry if it isn't found */
> +	if (entry.state == GLOBAL_ATU_DATA_STATE_UNUSED ||
> +	    !ether_addr_equal(entry.mac, addr)) {
> +		memset(&entry, 0, sizeof(entry));
> +		ether_addr_copy(entry.mac, addr);
> +		entry.fid = vlan.fid;
> +	}
> +

This seems to be more than renaming a few functions. There looks to be
real changes here. I think these changes should be split out into a
separate patch with an explanation what is being changed. Keep this
patch for plain renames.

It would also be easier to review if the patch just moved the code, no
changes. Then have patches which clean up the API. It is hard to see
what is move and what is cleanup. Plain move needs little review,
cleanup needs more review. With the current patch, it is hard to see
which is which.

      Andrew

  reply	other threads:[~2017-02-17 21:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 15:05 [PATCH net-next v2 0/6] net: dsa: mv88e6xxx: 88E6390 ATU/VTU Vivien Didelot
2017-02-17 15:05 ` [PATCH net-next v2 1/6] net: dsa: mv88e6xxx: add port mask helper Vivien Didelot
2017-02-17 21:26   ` Andrew Lunn
2017-02-17 15:05 ` [PATCH net-next v2 2/6] net: dsa: mv88e6xxx: move ATU code in its own file Vivien Didelot
2017-02-17 21:35   ` Andrew Lunn [this message]
2017-02-17 21:54     ` Vivien Didelot
2017-02-17 22:36       ` Andrew Lunn
2017-02-17 23:35         ` David Miller
2017-02-17 15:05 ` [PATCH net-next v2 3/6] net: dsa: mv88e6xxx: add support for 6390 ATU Move Vivien Didelot
2017-02-17 21:38   ` Andrew Lunn
2017-02-17 15:05 ` [PATCH net-next v2 4/6] net: dsa: mv88e6xxx: move VTU code to its own file Vivien Didelot
2017-02-17 21:46   ` Andrew Lunn
2017-02-17 15:05 ` [PATCH net-next v2 5/6] net: dsa: mv88e6xxx: add VTU ops Vivien Didelot
2017-02-17 21:49   ` Andrew Lunn
2017-02-17 15:05 ` [PATCH net-next v2 6/6] net: dsa: mv88e6xxx: add support for 6390 VTU Vivien Didelot
2017-02-17 21:53   ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170217213518.GH6096@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.