Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4158428ybl; Mon, 26 Aug 2019 06:25:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFAiAYTkszKW5GL0H+kNQVBNqArxlQQVFFvO3KJgtAhQKkuUkynnuzLoEFWuMcmwasTuBL X-Received: by 2002:a17:90a:9ea:: with SMTP id 97mr19299824pjo.68.1566825913746; Mon, 26 Aug 2019 06:25:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566825913; cv=none; d=google.com; s=arc-20160816; b=EPKj7woR2ZtzeeS3SKsPDzesssI+BgySC8OqmX8Ge4reknh75uovJQHTkayAap2lLa B1CHHSYRwA1U43ZIZ2gYS4ionvhaqdVLIJB+v+Inl5k1VQRHHfVs3tTxgfP8tpxdDk/M Itphwd8QEixqC7oEUjAjwJMc7hOCGl99whT+BpGql9ejxSj822ptZoIwW+Y0cEONNa4H xiVTfw9ULo390yN8GurkQjJN/L88xvBb2IRzUfhxZSeQERx/5w75hDbvhPBv5WxNqepA JogEWbIY4Z+wjTDsgpBmUERB/3F4shrpF40p8EtoplG8yKlhsEsO+20QZT+Wd1lQ7d9o 1uHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1ih+AgAlOAqD7WWVhbqdG9ORb7gLcSRQfi7VWfKpTPM=; b=IFfB4LvTT9YYV4bzcthSAExbn3iuw0FdTRFpMiQC1ybk8lPCb1DXZs5Fog8GV41vYP 4tfN1+pJyxa4Zab5o6dhYZhctrBVumOwYxNJzsW9dEd/vQ/HKZ1E22Q907znZAPIX8KI R9VVy786Hw+PtPXG5smn7yEMDpPHA0si5x+vEr0nJSsw6MPosdypy1wJyCrhVd7DVA7h jQ1/UKjgD+LmYxKus5nxbdZhk5gyR9CAhYviNSzPbRuintT+5oArsrS2OSn+BW7kFLmE wOAQYdhoZMHqKPjlAkTnCal91PCNVC6g03PBLHfcgY1fgnr0MoYZu8E13CIL2Vnw3PuX ySRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="lh/zn7Cc"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33si10041940pld.32.2019.08.26.06.24.58; Mon, 26 Aug 2019 06:25:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="lh/zn7Cc"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731581AbfHZMiU (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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