From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35965C3A59F for ; Mon, 26 Aug 2019 12:38:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0CA3C2070B for ; Mon, 26 Aug 2019 12:38:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="lh/zn7Cc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731557AbfHZMiU (ORCPT ); Mon, 26 Aug 2019 08:38:20 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:59746 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730339AbfHZMiU (ORCPT ); Mon, 26 Aug 2019 08:38:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=1ih+AgAlOAqD7WWVhbqdG9ORb7gLcSRQfi7VWfKpTPM=; b=lh/zn7CcjkTcSNCReHm8+IH4Xi 0yqiH49nK/6cMItUaLCrvoVKR1E3JcwiwkaJnte2wOiWQbCLy1TaxKEpwLdgdt94Abit612MIU1wj GPFFEjlOvnaMJ45gssN0NiIr3YXiUWHv0UuFCWYgUNfwa6HasQFvkX12vj7t2D8nT09g=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1i2EGB-0003lc-GP; Mon, 26 Aug 2019 14:38:11 +0200 Date: Mon, 26 Aug 2019 14:38:11 +0200 From: Andrew Lunn To: Horatiu Vultur Cc: roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, davem@davemloft.net, UNGLinuxDriver@microchip.com, alexandre.belloni@bootlin.com, allan.nielsen@microchip.com, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org Subject: Re: [PATCH v2 0/3] Add NETIF_F_HW_BR_CAP feature Message-ID: <20190826123811.GA13411@lunn.ch> References: <1566807075-775-1-git-send-email-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1566807075-775-1-git-send-email-horatiu.vultur@microchip.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Aug 26, 2019 at 10:11:12AM +0200, Horatiu Vultur wrote: > When a network port is added to a bridge then the port is added in > promisc mode. Some HW that has bridge capabilities(can learn, forward, > flood etc the frames) they are disabling promisc mode in the network > driver when the port is added to the SW bridge. > > This patch adds the feature NETIF_F_HW_BR_CAP so that the network ports > that have this feature will not be set in promisc mode when they are > added to a SW bridge. > > In this way the HW that has bridge capabilities don't need to send all the > traffic to the CPU and can also implement the promisc mode and toggle it > using the command 'ip link set dev swp promisc on' Hi Horatiu I'm still not convinced this is needed. The model is, the hardware is there to accelerate what Linux can do in software. Any peculiarities of the accelerator should be hidden in the driver. If the accelerator can do its job without needing promisc mode, do that in the driver. So you are trying to differentiate between promisc mode because the interface is a member of a bridge, and promisc mode because some application, like pcap, has asked for promisc mode. dev->promiscuity is a counter. So what you can do it look at its value, and how the interface is being used. If the interface is not a member of a bridge, and the count > 0, enable promisc mode in the accelerator. If the interface is a member of a bridge, and the count > 1, enable promisc mode in the accelerator. Andrew