Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2714139pxb; Thu, 10 Feb 2022 04:03:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBv+etgDP/XRd2ZIH1UhmBOBrxQppP73gQ+DDnSoJpl0yyJrobITw+Xw9xlu250U96g9pn X-Received: by 2002:a17:907:3f0a:: with SMTP id hq10mr4159967ejc.4.1644494592694; Thu, 10 Feb 2022 04:03:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644494592; cv=none; d=google.com; s=arc-20160816; b=u/EtLuwluo/LpZoWPSRCK6dzx2ys/A5UmJxZf3RC+ykgdlTHgNNixS3aw+7itNE62I GtqmGlqmQVKaH0zRIkZQWXUCqE3Sk2lphKWACgGEoiZunPZL2z1I5xGFZ78dCHsYZTDe xPnMxxCnXx3ZMRhk7lViSuVpjhmIyQalM+JzVOmpfgVwUnN8AmiBqVPaL528Lc5hILt3 1iftf0QASPgUFMD0vSUf7OS66x3/77B8HPh8xbYOpTFUVbuGYebJOzUbtOR85hKODiFf GYpA94grX4QSt60PIFO+Q3KhmMVxN8o7UF1EZHIGKQZM3hNNnk+9AeyZA7oSO0iMqNka fv7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :dkim-signature; bh=kmwaT6qEe++TZtD8h/O/V8ZbjOuD2J1q3t6C8ILP9QA=; b=LB28peZFS5ektCOggvK8aHpz5N9zAkTd9WAnwIDleYpYrkPNQMqkGVtXVEAcGTupW8 xZll8CRywlqKbsKRHhzxepkoaLd3BbjR+ZIXXGIOvJ07siZn3mk4IL5S1IEuef6ABqTS gflkVsvfHUbSdDJDjjzWda8eASVYb4gxErlt23iofoZ/CXu8mRvqQ8zk2b7JGLWMOejP ZbdX+Ax72U3/JHR3l8E6bX0y1gRwoXe34fxM7kc/OTfSzqtVY3cNoa7ZlZrxn3WMCL7M vysVAsOGRd4404JXdoj9apF+KLJ4tL6EaYqKhFClo/r0MsU5R8UoRZzvLUY40CPL9/64 P1ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=CVZ74q2g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3si6767360ejn.305.2022.02.10.04.02.46; Thu, 10 Feb 2022 04:03:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=CVZ74q2g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237568AbiBJIdn (ORCPT + 99 others); Thu, 10 Feb 2022 03:33:43 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237561AbiBJIdk (ORCPT ); Thu, 10 Feb 2022 03:33:40 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE782E98; Thu, 10 Feb 2022 00:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1644482018; x=1676018018; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=LzOxzSeQrSKYMob1v9yP9wi1VnFt4rvaqvnm3nMKecY=; b=CVZ74q2gc2O8MoOdLW2QdbXZIeyzkgalIv1YxyT9pLXesCgTo1jYEMSa /hdaSWXvL1Ui0qPO3MZsd2tdvfUAqtjN29PLOk+pBXwILHzz2e8vDXOHX NmLy1qJl2H0rxVv4olBTLFxywXRmbSor6Y20LJad7MlnHQ3cjTYj/MCZn /X598aY+97xpItjEg71PkAcPkkbkc5bqrh8o3PkMItvxrIG6UHy1LujAt 8oOYOSpuC2486kQbrGYtuJENPX4s0KJLfA2mAgNvLrYpwEoUJ6L4vhPE9 sTz7smbxGEufVvXr5pvNxFCsCeATvliPFlcsKoeABvpTnZpYYSMp3L3Mx Q==; IronPort-SDR: N93H+dZ4I9GuDMVEQt638SoceWSMWlGupYrkEB2K/o2uVwTPRZlp3lDxCofP6CQ3sgxJmASdPo smAxgZVtZCf8Dul7D6Gwm8su9Gzj0wJPtDC4A3FRadgIbREO8Wzphj8e66Pjhkb/RYVnAb3PeG DG+Y0K+9Gu49E2xmAhoMN87jztzpJzmkop+vbgBLSoBfcJSZv4qu3d3iB9UUJDk1s589yUSbhe KBrDvN8x/MQDRM2eh/ttLeYaqpK55ABi7Ayd6aaxaf04Hmv8l4lB+pGCIeaXSrmO3TsGTlRm2/ 7lSEA3qhmM4XkUBCSYoisobW X-IronPort-AV: E=Sophos;i="5.88,358,1635231600"; d="scan'208";a="161755490" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 10 Feb 2022 01:33:38 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Thu, 10 Feb 2022 01:33:37 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Thu, 10 Feb 2022 01:33:37 -0700 Date: Thu, 10 Feb 2022 09:36:12 +0100 From: Horatiu Vultur To: Jakub Kicinski CC: Andrew Lunn , , , , , kernel test robot Subject: Re: [PATCH net-next] net: lan966x: Fix when CONFIG_IPV6 is not set Message-ID: <20220210083612.4mszzwgcrvmn67rn@soft-dev3-1.localhost> References: <20220209101823.1270489-1-horatiu.vultur@microchip.com> <20220209180620.3699bf25@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20220209180620.3699bf25@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 02/09/2022 18:06, Jakub Kicinski wrote: Hi Andrew, Jakub > > On Wed, 9 Feb 2022 14:54:23 +0100 Andrew Lunn wrote: > > On Wed, Feb 09, 2022 at 11:18:23AM +0100, Horatiu Vultur wrote: > > > When CONFIG_IPV6 is not set, then the compilation of the lan966x driver > > compilation or linking? It is a linking error. I will fix in the next version > > > > fails with the following error: > > > > > > drivers/net/ethernet/microchip/lan966x/lan966x_main.c:444: undefined > > > reference to `ipv6_mc_check_mld' > > > > > > The fix consists in adding #ifdef around this code. > > > > It might be better to add a stub function for when IPv6 is > > disabled. We try to avoid #if in C code. What do you think if I do something like this in the lan966x_main.h --- #if IS_ENABLED(CONFIG_IPV6) static inline bool lan966x_hw_offload_ipv6(struct sk_buff *skb) { if (skb->protocol == htons(ETH_P_IPV6) && ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) && !ipv6_mc_check_mld(skb)) return false; return true; } #else static inline bool lan966x_hw_offload_ipv6(struct sk_buff *skb) { return false; } #endif --- And then in lan966x_main.c just call this function. > > If it's linking we can do: > > if (IS_ENABLED(CONFIG_IPV6) && > skb->protocol == htons(ETH_P_IPV6) && > ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) && > !ipv6_mc_check_mld(skb)) > return false; > > But beware that IPV6 can be a module, you may need a Kconfig dependency. I was also looking at other drivers on how they use 'ipv6_mc_check_mld'. Then I have seen that drivers/net/amt.c and net/bridge/br_multicast.c they wrap this function with #if. But then there is net/batman-adv/multicast.c which doesn't do that and it can compile and link without CONFIG_IPV6 and I just don't see how that is working. -- /Horatiu