Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2910441pxb; Thu, 10 Feb 2022 08:09:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6v4PIaBwo6IXeIRSLZRox37eFewyHfvKGie18zBe0tmyld5euenIX7+zS8yO5VAVYJ0ZB X-Received: by 2002:a17:903:2448:: with SMTP id l8mr8143621pls.84.1644509398984; Thu, 10 Feb 2022 08:09:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644509398; cv=none; d=google.com; s=arc-20160816; b=ae4f/Wm1U5cbyRqYoq2Y2G2vpCmopJJmi4JQugPr6rE6AJQ2CV+L+7jU0rMt7PcJWY lepL8IVACd4jfpGXL2ou3Gi9QtkwqLzlDsXsynFxZru9Ev1Ok536tdTOxAh+cW3XKtte +nEyWbgdBYqzNZrCWDz9mq2RKoIQtsDs7MbXo4Zi4RriX6wogd/Wl2OQS2470m/uUrTy TX7MM74fCXPuJrpvzRQO5kmmGvaE8K6TEt8PkdyrDOMm783HfXtz6RSBm9vKOhAotXq8 l6HTGUXnTTlYaudYEHZ8zXIh+LOT9mdE1Xqvq0rIyLUAHygbmnNB+NvKJn0METJPI1YN dqFA== 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:dkim-signature; bh=a3sjCPkuo/yp/xxSnVr5f3pnRVPuuMGoup115Dij2eQ=; b=jQ5Oai8fSpBWmG0uW5qRjw8+LFAYYA16G+CcklceOQ4ciUuZTExLpqql2WE1qlqf95 98XZKOreaau8zrmLplIzA301YAs1ck+ipJ8Bp3nFYX2ViPqNzXuk+c/IQxVfsKJq+yQ6 01Y0Mq/Zo5PTT33gOMdZfhdEGHwNTWolbvrUuEqJ2F0oeTyOEF0AlRLUl0UMKAzKZhi7 jf0eNoToxleng1LaBA8FayumAxaDibLVtiTK9Hoc0xRs+J4Yr6X3+a+lOk1pY7+NYr87 pHz+9ZDSy3stmeSOnMtOg3/JcszXZvKC6N/rT0N2hSPpkThCPiCarQudHLXwx/raPsy8 LgAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=zHo7Abkp; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b24si1776324pji.13.2022.02.10.08.09.43; Thu, 10 Feb 2022 08:09:58 -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=pass header.i=@lunn.ch header.s=20171124 header.b=zHo7Abkp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242060AbiBJNOf (ORCPT + 99 others); Thu, 10 Feb 2022 08:14:35 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239881AbiBJNOe (ORCPT ); Thu, 10 Feb 2022 08:14:34 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53DFC1157; Thu, 10 Feb 2022 05:14:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=a3sjCPkuo/yp/xxSnVr5f3pnRVPuuMGoup115Dij2eQ=; b=zHo7AbkpDJzLDPt3595KfZw3Gn wkORiO4MvrO3tVWySWtQ4xpum5LQbEc13cPDc4XmABICv8qRnitfaMBd8ZAytUfYLgrKxga1vk8Ue O9X6NZI4qBBKjM6CyZJV/jjUJkeHyN4QnJ56N7cNQc8eiXnfzWqQX1G244Yg1BL7v4sM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nI9HH-005IYz-S9; Thu, 10 Feb 2022 14:14:27 +0100 Date: Thu, 10 Feb 2022 14:14:27 +0100 From: Andrew Lunn To: Horatiu Vultur Cc: Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com, davem@davemloft.net, kernel test robot Subject: Re: [PATCH net-next] net: lan966x: Fix when CONFIG_IPV6 is not set Message-ID: References: <20220209101823.1270489-1-horatiu.vultur@microchip.com> <20220209180620.3699bf25@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20220210083612.4mszzwgcrvmn67rn@soft-dev3-1.localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220210083612.4mszzwgcrvmn67rn@soft-dev3-1.localhost> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 > 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 > --- The reason we prefer not to use #if is that it reduced compile testing coverage. The block of code inside gets compiled a lot less. > 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; Jakub solution results in the code always being compiled, but the IS_ENABLED(CONFIG_IPV6) gets turned into a constant 0 or 1. The optimizer can then remove the whole block of code in the 0 case. > 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. Maybe it is to do with this at the end of net/ip6/Makefile ifneq ($(CONFIG_IPV6),) obj-$(CONFIG_NET_UDP_TUNNEL) += ip6_udp_tunnel.o obj-y += mcast_snoop.o endif