From patchwork Fri Apr 28 16:31:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadi Sharshevsky X-Patchwork-Id: 756483 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wDzlk0cYGz9s7r for ; Sat, 29 Apr 2017 02:28:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423991AbdD1Q2r (ORCPT ); Fri, 28 Apr 2017 12:28:47 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:33493 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936246AbdD1Q2p (ORCPT ); Fri, 28 Apr 2017 12:28:45 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from arkadis@mellanox.com) with ESMTPS (AES256-SHA encrypted); 28 Apr 2017 19:28:37 +0300 Received: from dev-r-vrt-156.mtr.labs.mlnx (dev-r-vrt-156.mtr.labs.mlnx [10.212.156.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v3SGSbLE001280; Fri, 28 Apr 2017 19:28:37 +0300 From: Arkadi Sharshevsky To: netdev@vger.kernel.org Cc: davem@davemloft.net, stephen@networkplumber.org, bridge@lists.linux-foundation.org, Arkadi Sharshevsky , Ido Schimmel , Nikolay Aleksandrov Subject: [PATCH net-next v2] net: bridge: Fix improper taking over HW learned FDB Date: Fri, 28 Apr 2017 19:31:38 +0300 Message-Id: <1493397098-38756-1-git-send-email-arkadis@mellanox.com> X-Mailer: git-send-email 2.4.11 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit 7e26bf45e4cb ("net: bridge: allow SW learn to take over HW fdb entries") added the ability to "take over an entry which was previously learned via HW when it shows up from a SW port". However, if an entry was learned via HW and then a control packet (e.g., ARP request) was trapped to the CPU, the bridge driver will update the entry and remove the externally learned flag, although the entry is still present in HW. Instead, only clear the externally learned flag in case of roaming. Fixes: 7e26bf45e4cb ("net: bridge: allow SW learn to take over HW fdb entries") Signed-off-by: Ido Schimmel Signed-off-by: Arkadi Sharashevsky Cc: Nikolay Aleksandrov --- v1->v2 - net-next rebase. --- net/bridge/br_fdb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index de7988b..5905eb7 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -589,16 +589,16 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source, if (unlikely(source != fdb->dst)) { fdb->dst = source; fdb_modified = true; + /* Take over HW learned entry */ + if (unlikely(fdb->added_by_external_learn)) { + fdb->added_by_external_learn = 0; + fdb_modified = true; + } } if (now != fdb->updated) fdb->updated = now; if (unlikely(added_by_user)) fdb->added_by_user = 1; - /* Take over HW learned entry */ - if (unlikely(fdb->added_by_external_learn)) { - fdb->added_by_external_learn = 0; - fdb_modified = true; - } if (unlikely(fdb_modified)) fdb_notify(br, fdb, RTM_NEWNEIGH); }