[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150519223325.GA18883@penelope.isobedori.kobe.vergenet.net>
Date: Wed, 20 May 2015 07:33:27 +0900
From: Simon Horman <simon.horman@...ronome.com>
To: Scott Feldman <sfeldma@...il.com>
Cc: Jiri Pirko <jiri@...nulli.us>, David Miller <davem@...emloft.net>,
Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 3/4] rocker: do not make neighbour entry changes
when preparing transactions
On Tue, May 19, 2015 at 09:11:29AM -0700, Scott Feldman wrote:
> On Mon, May 18, 2015 at 11:24 PM, Simon Horman
> <simon.horman@...ronome.com> wrote:
> > rocker_port_ipv4_nh() and in turn rocker_port_ipv4_neigh() may be
> > be called with trans == SWITCHDEV_TRANS_PREPARE and then
> > trans == SWITCHDEV_TRANS_COMMIT from switchdev_port_obj_set() via
> > fib_table_insert().
> >
> > Although I have been unable to find a scenario where a bug manifests
> > I do see some incorrect behaviour when adding a fib entry with a gateway.
> >
> > The first time that rocker_port_ipv4_nh() is called, with
> > trans == SWITCHDEV_TRANS_PREPARE, _rocker_neigh_add()
> > adds a new entry to the neigh table.
> >
> > And the second time rocker_port_ipv4_nh() is called, with
> > trans == SWITCHDEV_TRANS_COMMIT, that entry is found and
> > _rocker_neigh_update() is called.
> >
> > Assuming the transaction runs to completion this appears to be harmless.
> > I suspect it would be not correct if the transaction was aborted.
> >
> > This problem does not appear to affect deletion as my analysis is
> > that deletion is always performed with trans == SWITCHDEV_TRANS_NONE.
> >
> > For completeness _rocker_neigh_{add,del,prepare} are updated not
> > to manipulate fib table entries if trans == SWITCHDEV_TRANS_PREPARE.
> >
> > Fixes: c4f20321d968 ("rocker: support prepare-commit transaction model")
> > Signed-off-by: Simon Horman <simon.horman@...ronome.com>
> > ---
> > drivers/net/ethernet/rocker/rocker.c | 16 ++++++++++++----
> > 1 file changed, 12 insertions(+), 4 deletions(-)
> >
>
> [cut]
>
> > @@ -2928,8 +2933,11 @@ static void _rocker_neigh_del(struct rocker_port *rocker_port,
> > }
> >
> > static void _rocker_neigh_update(struct rocker_neigh_tbl_entry *entry,
> > + enum switchdev_trans trans,
> > u8 *eth_dst, bool ttl_check)
> > {
> > + if (trans == SWITCHDEV_TRANS_PREPARE)
> > + return;
>
> On this one, let move the trans==PREPARE test to the else branch, in
> case someone down the line is dependent on eth_dst and ttl_check being
> copied over.
>
> Everything else in the patch looks good.
Thanks Scott, I'll adjust things as you suggest.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists