From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: for_each_netdev_feature() broken on big endian Date: Fri, 07 Sep 2018 08:25:04 -0700 (PDT) Message-ID: <20180907.082504.1277807183056339898.davem@davemloft.net> References: <9231D502B07C5E4A8B32D5115C9F19991EE57330@IRSMSX101.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, zahari.doychev@intel.com, thomas.langer@intel.com To: hauke.mehrtens@intel.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:49160 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728215AbeIGUGc (ORCPT ); Fri, 7 Sep 2018 16:06:32 -0400 In-Reply-To: <9231D502B07C5E4A8B32D5115C9F19991EE57330@IRSMSX101.ger.corp.intel.com> Sender: netdev-owner@vger.kernel.org List-ID: From: "Mehrtens, Hauke" Date: Fri, 7 Sep 2018 15:10:53 +0000 > On a MIPS 32 Big endian system the netdev_sync_upper_features() function does not work correctly. > It does not disbale bit 15 (NETIF_F_LRO, 0x0000000000008000), but 47 (NETIF_F_HW_TC, 0x0000800000000000). > > The for_each_netdev_feature() macro is used to go over all netdev feature flags and calls for_each_set_bit() with a u64. > This is the code: > #define for_each_netdev_feature(mask_addr, bit) \ > for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) > https://elixir.bootlin.com/linux/v4.19-rc2/source/include/linux/netdev_features.h#L157 Good catch, yes we cannot use the the generic bit handling macros on the netdev feature flags because the feature flags are a u64 operated on as a unit whereas "long" may be 32-bit or 64-bit depending upon the architecture.