netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>
Cc: vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com,
	netdev@vger.kernel.org, volodymyr.bendiuga@westermo.se
Subject: Re: [PATCH net-next 2/3] net:dsa:mv88e6xxx: add helper functions to operate on hashtable
Date: Mon, 12 Dec 2016 15:03:49 +0100	[thread overview]
Message-ID: <20161212140349.GE27057@lunn.ch> (raw)
In-Reply-To: <1481550031-3227-1-git-send-email-volodymyr.bendiuga@gmail.com>

On Mon, Dec 12, 2016 at 02:40:31PM +0100, Volodymyr Bendiuga wrote:
> This implementation is similar to rocker driver: drivers/net/ethernet/rocker_ofdpa.c
> 
> mv88e6xxx_pvec_tbl_find - iterates through entries in the hashtable
> and looks for a match.
> 
> mv88e6xxx_pvec_tbl_get - returns en entry if it is found in the
> hashtable
> 
> mv88e6xxx_pvec_tbl_update - updates the hashtable: inserts new entry,
> deletes/modifies existing one.
> 
> Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>

Hi Volodymyr

It looks like your white space is all messed up. Please use checkpatch.

> +
> +static int mv88e6xxx_pvec_tbl_update(struct mv88e6xxx_chip *chip, u16 fid,
> +			      const unsigned char *addr, u16 pvec)
> +{
> +        struct pvec_tbl_entry *obj;
> +        struct pvec_tbl_entry *found;
> +        bool remove = pvec ? false : true;
> +
> +        obj = kzalloc(sizeof(*obj), GFP_KERNEL);
> +        if (!obj)
> +                return -ENOMEM;

So we need to look at the memory model here.

Currently the driver is stateless. This now introduces state. That
means we need to look at the prepare calls switchdev has, since we are
only allowed to fail in the prepare call. You need to allocate the
memory in the port_fdb_prepare() and then use the memory in
port_fdb_add() etc.

I don't think your third patch does any of this.

  Andrew

      reply	other threads:[~2016-12-12 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12 13:40 [PATCH net-next 2/3] net:dsa:mv88e6xxx: add helper functions to operate on hashtable Volodymyr Bendiuga
2016-12-12 14:03 ` Andrew Lunn [this message]

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=20161212140349.GE27057@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    --cc=volodymyr.bendiuga@gmail.com \
    --cc=volodymyr.bendiuga@westermo.se \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).