Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2527013ybl; Sun, 26 Jan 2020 04:50:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzQE195Cl9Cor6N//9T8UtU+Kdr6Vg7XrLvFPQKeNRpG+FvkH9FXcjxO8zfCI0rqcW0zPZ/ X-Received: by 2002:a9d:774e:: with SMTP id t14mr9047149otl.358.1580043047771; Sun, 26 Jan 2020 04:50:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580043047; cv=none; d=google.com; s=arc-20160816; b=w9o6dXilxUlvqfARaS+R+C5xy3ALGEOFoGf2pK1Eww0pwkkzNJIQqMOsSGxFMQkrt9 7ANcTqHx21hhPb0fQVtyu3NtQn/edaqOiFfSJJ+Vog7rGtjjX86lTw71uIh6jFzXFEHf viHxCPj+bQRJ+AfZVTj3Icu/WWYLL8CEZsd6R5uqNJH7ZdajlgtTBKJ/BEfHwETJac+J vBj82pXfrC8tkndqBIygLU0OkB5D0lLmzuT2KXarRGciZV6koawdc0PMpVH8WRV6welX DzHZFKfc7L78yyGabfM5V2COUEHR7F+I9o2RenFaQU+XR19XQtdZIwkf7lDtS9760PHk foRg== 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:ironport-sdr; bh=/1GmbTfTRTzHrWGtLsI9soJRNCCKglyYu9LktnE7xUM=; b=ptBAw5uHEPSA13GmoPMw8+2/2eYAXfS9KlnPO3DosYkrfkhLOKMnPe9+wSSUkiU65f xkihQrf0EFsD3Mh4zLpuKmMoOi8v4RPx3Omm0vGG/uNf2NjniwNRmX+9N9/O0gqw8Y1d SdEhvKz5Qx/jO5gBGZLgKNcxXW1Kmr+ZVaBY0NFGWJb+ttwPXs7nNaCmBjmxz9xmOqQV zv1jEUj5j/7AUHzt+YwTEqCQWYVQKRU6helMhqL27eWr8/pa/6m+4PSobH73l62vbEzW 4xUa4kgVdZeLQzpn2TKVimypoKssLRNWmsZihSZ+WgMJpSBO35pUhuBC1GTLDcUdUFoZ p8hg== 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=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n139si2375744oig.121.2020.01.26.04.50.36; Sun, 26 Jan 2020 04:50:47 -0800 (PST) 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=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387446AbgAZMtS (ORCPT + 99 others); Sun, 26 Jan 2020 07:49:18 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:54874 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387398AbgAZMtR (ORCPT ); Sun, 26 Jan 2020 07:49:17 -0500 Received-SPF: Pass (esa3.microchip.iphmx.com: domain of Horatiu.Vultur@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa3.microchip.iphmx.com; envelope-from="Horatiu.Vultur@microchip.com"; x-sender="Horatiu.Vultur@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa3.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa3.microchip.iphmx.com; envelope-from="Horatiu.Vultur@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa3.microchip.iphmx.com; dkim=none (message not signed) header.i=none; spf=Pass smtp.mailfrom=Horatiu.Vultur@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: pSDVn3chmLQfhl0uygt7Pv6ND1lo09LprktTom4Xw4jam8/UUciMtrMe5cMlLKvmmhaiasrWiU vUrtVuZrMnEJpmTBDPduve/PAZC7fzA9Meubjb/kWekJyP29CR8DvlYPHhmMcYglC7pk6bEwK5 hYCDnbFL/I+dk7AjfRGm5Y2tr9m+ZfsjtOLuDuHnFCiRQdxrrNLfdDaMDhazIUmTRWtTMXA9Iw RErzsVpVFgzc1VEkJSoqur6Xib6LTge35ek9kCslUbS4rSI4H98jshEau6FVeR0nR/ImKNcUcz D94= X-IronPort-AV: E=Sophos;i="5.70,365,1574146800"; d="scan'208";a="64538482" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Jan 2020 05:49:16 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 26 Jan 2020 05:49:14 -0700 Received: from localhost (10.10.85.251) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Sun, 26 Jan 2020 05:49:13 -0700 Date: Sun, 26 Jan 2020 13:49:11 +0100 From: Horatiu Vultur To: Andrew Lunn CC: , , , , , , , , , , , Subject: Re: [RFC net-next v3 09/10] net: bridge: mrp: Integrate MRP into the bridge Message-ID: <20200126124911.z5zh44agxbe6lwhh@soft-dev3.microsemi.net> References: <20200124161828.12206-1-horatiu.vultur@microchip.com> <20200124161828.12206-10-horatiu.vultur@microchip.com> <20200125154248.GC18311@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20200125154248.GC18311@lunn.ch> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 01/25/2020 16:42, Andrew Lunn wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Fri, Jan 24, 2020 at 05:18:27PM +0100, Horatiu Vultur wrote: > > To integrate MRP into the bridge, the bridge needs to do the following: > > - initialized and destroy the generic netlink used by MRP > > - detect if the MRP frame was received on a port that is part of a MRP ring. In > > case it was not, then forward the frame as usual, otherwise redirect the frame > > to the upper layer. > > > > Signed-off-by: Horatiu Vultur > > --- > > net/bridge/br.c | 11 +++++++++++ > > net/bridge/br_device.c | 3 +++ > > net/bridge/br_if.c | 6 ++++++ > > net/bridge/br_input.c | 14 ++++++++++++++ > > net/bridge/br_private.h | 14 ++++++++++++++ > > 5 files changed, 48 insertions(+) > > > > diff --git a/net/bridge/br.c b/net/bridge/br.c > > index b6fe30e3768f..d5e556eed4ba 100644 > > --- a/net/bridge/br.c > > +++ b/net/bridge/br.c > > @@ -344,6 +344,12 @@ static int __init br_init(void) > > if (err) > > goto err_out5; > > > > +#ifdef CONFIG_BRIDGE_MRP > > + err = br_mrp_netlink_init(); > > + if (err) > > + goto err_out6; > > +#endif > > Please try to avoid #ifdef's like this in C code. Add a stub function > to br_private_mrp.h. > > If you really cannot avoid #ifdef, please use #if IS_ENABLED(CONFIG_BRIDGE_MRP). > That expands to > > if (0) { > > } > > So the compiler will compile it and then optimize it out. That gives > us added benefit of build testing, we don't suddenly find the code no > longer compiles when we enable the option. > > > --- a/net/bridge/br_input.c > > +++ b/net/bridge/br_input.c > > @@ -21,6 +21,9 @@ > > #include > > #include "br_private.h" > > #include "br_private_tunnel.h" > > +#ifdef CONFIG_BRIDGE_MRP > > +#include "br_private_mrp.h" > > +#endif > > It should always be safe to include a header file. > > Andrew Thanks for pointing out these mistakes. I will try to avoid all these #ifdef's in the next patch series. -- /Horatiu