Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2256667ybl; Thu, 29 Aug 2019 05:56:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFAoBPTTSDtywEPitKahvKaR4dP/yrUjM8OPyhhJ1baEA/gTEsHTsdFVXZpHl30gUKGFPz X-Received: by 2002:a17:902:8348:: with SMTP id z8mr9986926pln.38.1567083418575; Thu, 29 Aug 2019 05:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567083418; cv=none; d=google.com; s=arc-20160816; b=0AkL3SY+RoOORR/Pj+b10eC0kc6rR3SofGZmSWFDejwRce02ANpGvFvia1v2hwTR6V /EGMXUn2FIkG2ToQjOfM+TFGOZbgenSuq2cPGiuw42MxrrMDkDA2ZBvZKeokjepcZpvp hDP84Ua/O3HXlbjC+T9t96KIfuHX8LKygohaYiAxUwDHBcvVSCr4gztceYj83PtYYpQW BRrnYPG2Gu2L3fqSozHVwwLvLsSEBZ3954HvIXCZy10hYeX1hrbXTfHgEqAftRiRtn9B 74/XZkoI+BNl6jHqIvuSkzXwCno4u4rGjo54eQyyxsk/OinziBUCdtechC8xhWECAz8P JcfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=M5E+odUregbIP0euC+va2XJ0i/klliS1IqoHpvC5p20=; b=RswnUTvoLUyDneJk4wGLlMXDRRG9g8vJleAev64MDR3LBwH+EFQWnM1n8HlrXj87u8 frKhttMpqUQmedQSWgXSOxt4uZw+c6BSgJdjZES1FMwwyDvpECIVwlYjEuLa0dlJAjsC XTPmj7grcNU5jPI9Tkoe5ah69P/ipalJI6J8Po2ocB25iKQsNgoLjzsIdluGzHuEPqJP hxLmK7IMo6io2u6Pma6nElSZKNIadGsTNSeLWNVhx8SekHhe7WbALSfa5yDM8k7Wf7qA ToQYKmNr8pbcxq3wU/jvqWJ6yJs8MstIGdmny+GojcDSpveKgEd5fhwRN7AmsOMjRRH0 Ujng== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si1775325plo.375.2019.08.29.05.56.42; Thu, 29 Aug 2019 05:56:58 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727578AbfH2MzX (ORCPT + 99 others); Thu, 29 Aug 2019 08:55:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33160 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726283AbfH2MzX (ORCPT ); Thu, 29 Aug 2019 08:55:23 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF5BF7EB88; Thu, 29 Aug 2019 12:55:22 +0000 (UTC) Received: from ceranb (ovpn-204-112.brq.redhat.com [10.40.204.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88B171001B14; Thu, 29 Aug 2019 12:55:19 +0000 (UTC) Date: Thu, 29 Aug 2019 14:55:18 +0200 From: Ivan Vecera To: Horatiu Vultur Cc: Jiri Pirko , , , , , , , , Subject: Re: [PATCH v3 1/2] net: core: Notify on changes to dev->promiscuity. Message-ID: <20190829145518.393fb99d@ceranb> In-Reply-To: <20190829124412.nrlpz5tzx3fkdoiw@soft-dev3.microsemi.net> References: <1567070549-29255-1-git-send-email-horatiu.vultur@microchip.com> <1567070549-29255-2-git-send-email-horatiu.vultur@microchip.com> <20190829095100.GH2312@nanopsycho> <20190829105650.btgvytgja63sx6wx@soft-dev3.microsemi.net> <20190829121811.GI2312@nanopsycho> <20190829124412.nrlpz5tzx3fkdoiw@soft-dev3.microsemi.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Thu, 29 Aug 2019 12:55:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Aug 2019 14:44:14 +0200 Horatiu Vultur wrote: > When a port is added to a bridge, then the port gets in promisc mode. > But in our case the HW has bridge capabilities so it is not required > to set the port in promisc mode. > But if someone else requires the port to be in promisc mode (tcpdump > or any other application) then I would like to set the port in promisc > mode. > In previous emails Andrew came with the suggestion to look at > dev->promiscuity and check if the port is a bridge port. Using this > information I could see when to add the port in promisc mode. He also > suggested to add a new switchdev call(maybe I missunderstood him, or I > have done it at the wrong place) in case there are no callbacks in the > driver to get this information. I would use the 1st suggestion. for/in your driver: if (dev->promiscuity > 0) { if (dev->promiscuity == 1 && netif_is_bridge_port(dev)) { /* no need to set promisc mode because promiscuity * was requested by bridge */ ... } else { /* need to set promisc mode as someone else requested * promiscuity */ } } Thanks, Ivan