Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933447AbcCIRnR (ORCPT ); Wed, 9 Mar 2016 12:43:17 -0500 Received: from mail.savoirfairelinux.com ([208.88.110.44]:58624 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751912AbcCIRnI (ORCPT ); Wed, 9 Mar 2016 12:43:08 -0500 From: Vivien Didelot To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Florian Fainelli , Andrew Lunn , Scott Feldman , Jiri Pirko , Ido Schimmel , nikolay@cumulusnetworks.com, Elad Raz , Vivien Didelot Subject: [RFC PATCH net-next 0/2] net: switchdev: add attribute for port bridging Date: Wed, 9 Mar 2016 12:42:46 -0500 Message-Id: <1457545368-20647-1-git-send-email-vivien.didelot@savoirfairelinux.com> X-Mailer: git-send-email 2.7.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1347 Lines: 34 Current switchdev users implement notifier blocks to filter global netdev events, in order to correctly offload bridging to their hardware ports. Such code could be replaced with the support of a simple switchdev attribute set when adding/deleting a port to/from a bridge. Also, we can imagine a switch driver or network layer wanting to restrict the number of logical bridges on top of a physical device. That could be done by returning -EOPNOTSUPP when setting such attribute. The first patch adds a new SWITCHDEV_ATTR_ID_PORT_BRIDGE_IF switchdev attribute containing a boolean, set when joining or leaving a bridge. The second patch shows the benefit of supporting such attribute in the DSA layer. Similar change should be doable to other switchdev users, like Rocker. Note: I send this as an RFC since I am not really sure about the attribute flags, and the exact place to set it in del_nbp(). Comments needed :-) Thanks, Vivien Didelot (2): net: bridge: add switchdev attr for port bridging net: dsa: support SWITCHDEV_ATTR_ID_PORT_BRIDGE_IF include/net/switchdev.h | 2 + net/bridge/br_if.c | 27 ++++++++++++ net/dsa/dsa.c | 7 --- net/dsa/dsa_priv.h | 2 - net/dsa/slave.c | 113 +++++++++++++----------------------------------- 5 files changed, 59 insertions(+), 92 deletions(-) -- 2.7.2