Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754160AbcJSVjC (ORCPT ); Wed, 19 Oct 2016 17:39:02 -0400 Received: from mail.savoirfairelinux.com ([208.88.110.44]:52134 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753800AbcJSVjB (ORCPT ); Wed, 19 Oct 2016 17:39:01 -0400 From: Vivien Didelot To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Stephen Hemminger , Florian Fainelli , Andrew Lunn , Ido Schimmel , Jiri Pirko , Nikolay Aleksandrov , cphealy@gmail.com, bridge@lists.linux-foundation.org, Vivien Didelot Subject: [RFC net 0/3] net: bridge: fast ageing on topology change Date: Wed, 19 Oct 2016 17:38:00 -0400 Message-Id: <20161019213803.22837-1-vivien.didelot@savoirfairelinux.com> X-Mailer: git-send-email 2.10.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2560 Lines: 70 802.1D [1] specifies that the bridges in a network must use a short value to age out dynamic entries in the Filtering Database for a period, once a topology change has been communicated by the root bridge. This patchset fixes this for the in-kernel STP implementation. Once the topology change flag is set in a net_bridge instance, the ageing time value is shorten to twice the forward delay used by the topology. When the topology change flag is cleared, the ageing time configured for the bridge is restored. To accomplish that, a new bridge_ageing_time member is added to the net_bridge structure, to store the user configured bridge ageing time. Two helpers are added to offload the ageing time and set the topology change flag in the net_bridge instance. Then the required logic is added in the topology change helper if in-kernel STP is used. This has been tested on the following topology: +--------------+ | root bridge | | 1 2 3 4 | +--+--+--+--+--+ | | | | +--------+ | | | +------| laptop | | | | +--------+ +--+--+--+-----+ | 1 2 3 | | slave bridge | +--------------+ When unplugging/replugging the laptop, the slave bridge (under test) gets the topology change flag sent by the root bridge, and fast ageing is triggered on the bridges. Once the topology change timer of the root bridge expires, the topology change flag is cleared and the configured ageing time is restored on the bridges. A similar test has been done between two bridges under test. When changing the forward delay of the root bridge with: # echo 3000 > /sys/class/net/br0/bridge/forward_delay the ageing time correctly changes on both bridges from 300s to 60s while the TOPOLOGY_CHANGE flag is present. [1] "8.3.5 Notifying topology changes", http://profesores.elo.utfsm.cl/~agv/elo309/doc/802.1D-1998.pdf [ Feedbacks are needed, especially for the usage of the bridge lock and the defered ageing time attribute. It works fine so far but might raise concerns. ] Vivien Didelot (3): net: bridge: add helper to offload ageing time net: bridge: add helper to set topology change net: dsa: shorten ageing time on topology change net/bridge/br_device.c | 2 +- net/bridge/br_private.h | 4 ++- net/bridge/br_private_stp.h | 1 + net/bridge/br_stp.c | 65 ++++++++++++++++++++++++++++++++++++++------- net/bridge/br_stp_if.c | 14 +++------- net/bridge/br_stp_timer.c | 2 +- 6 files changed, 65 insertions(+), 23 deletions(-) -- 2.10.0