From patchwork Thu Nov 9 22:10:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 836530 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yXy8y0Rqjz9sPt for ; Fri, 10 Nov 2017 09:13:06 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754744AbdKIWNE (ORCPT ); Thu, 9 Nov 2017 17:13:04 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:51339 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751174AbdKIWND (ORCPT ); Thu, 9 Nov 2017 17:13:03 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1eCv2W-0006X4-CI; Thu, 09 Nov 2017 23:11:12 +0100 From: Andrew Lunn To: David Miller Cc: Vivien Didelot , Florian Fainelli , netdev , Andrew Lunn Subject: [PATCH v4 net-next 0/6] IGMP snooping for local traffic Date: Thu, 9 Nov 2017 23:10:56 +0100 Message-Id: <1510265462-25077-1-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 2.1.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The linux bridge supports IGMP snooping. It will listen to IGMP reports on bridge ports and keep track of which groups have been joined on an interface. It will then forward multicast based on this group membership. When the bridge adds or removed groups from an interface, it uses switchdev to request the hardware add an mdb to a port, so the hardware can perform the selective forwarding between ports. What is not covered by the current bridge code, is IGMP joins/leaves from the host on the brX interface. These are not reported via switchdev so that hardware knows the local host is interested in the multicast frames. Luckily, the bridge does track joins/leaves on the brX interface. The code is obfusticated, which is why i missed it with my first attempt. So the first patch tries to remove this obfustication. Currently, there is no notifications sent when the bridge interface joins a group. The second patch adds them. bridge monitor then shows joins/leaves in the same way as for other ports of the bridge. Then starts the work passing down to the hardware that the host has joined/left a group. The existing switchdev mdb object cannot be used, since the semantics are different. The existing SWITCHDEV_OBJ_ID_PORT_MDB is used to indicate a specific multicast group should be forwarded out that port of the switch. However here we require the exact opposite. We want multicast frames for the group received on the port to the forwarded to the host. Hence add a new object SWITCHDEV_OBJ_ID_HOST_MDB, a multicast database entry to forward to the host. This new object is then propagated through the DSA layers. No DSA driver changes should be needed, this should just work... This version fixes up the nitpick from Nikolay, removes an unrelated white space change, and adds in a patch adding a few const attributes to a couple of functions taking a port parameter, in order to stop the following patch produces warnings. Acked-by: Stephen Hemminger Andrew Lunn (6): net: bridge: Rename mglist to host_joined net: bridge: Send notification when host join/leaves a group net: bridge: Add/del switchdev object on host join/leave net: dsa: slave: Handle switchdev host mdb add/del net: dsa: add more const attributes net: dsa: switch: Don't add CPU port to an mdb by default include/net/switchdev.h | 1 + net/bridge/br_input.c | 2 +- net/bridge/br_mdb.c | 54 +++++++++++++++++++++++++++++++++++++++++++---- net/bridge/br_multicast.c | 18 ++++++++++------ net/bridge/br_private.h | 2 +- net/dsa/dsa_priv.h | 4 ++-- net/dsa/port.c | 6 +++--- net/dsa/slave.c | 13 ++++++++++++ net/dsa/switch.c | 2 +- net/switchdev/switchdev.c | 2 ++ 10 files changed, 85 insertions(+), 19 deletions(-)