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.hor...@netronome.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.hor...@netronome.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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html