Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp499017ybh; Tue, 10 Mar 2020 02:51:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuxvhHSLLhuQ02dWUaumSus7qcwegYY3/9OogVEdMPdsmXKvx4+lOHwLZhyO/7CajIyulOJ X-Received: by 2002:a9d:228:: with SMTP id 37mr9981019otb.52.1583833907243; Tue, 10 Mar 2020 02:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583833907; cv=none; d=google.com; s=arc-20160816; b=GoG8WkT+lBFMimtUGQd9s8N7BoCY6KdeCzJzYWnMdyof5B40HFb4eHvCysFKT7+ayk QNMQ9f7nxAgt16cGxeQyFnliXoKnjhAQL/NALbef2QDU/QgQF9/lDDs2fl1Oh+hRSw+l 6JcGXFLGlq+ftG1DiCYpO1fyFcuMqy/mdpj6oDg6T0SukShPXiLOKpFX67LcDemUM2E4 fO7FvDAPEKlAb3mhVLZNpqNS1j1k+UUt4wN8VTnnYCjxrcxQT8iZzVBrjy75ti1/ZTHz jDvX6eOTd+kq88XJbon3CdIvrkzfPCaCCoa8ji+OoimMBVlhXiej6wIoDSPkCp6a0Dti eREg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=1hrKuktu1BZtcl/7ErmYnkDGSjPrzdB7x6KnFy+OReQ=; b=B4RvO/H/YHe/EDIJ4Ca3EyO8iqA15oV41V7r8nhc7XoBEybLIfb0IMp9AJF6xwKQH5 vXGEzD1hE3MinEeNPWP1tbyYNvP8uDUOHtf/kKBhMK5zoXxlBVVgJxvGrfLMtF+RUrEk OtHNJIWoePp/icd168lGtO5SOWHbTo880lmaiOfGXpff1iD5eEKDoXvYLisd6gJAPA+6 uAuDIEhq4dDQ1rW0eDOgQzARvqA3dVw0ZwxYU9m0px2b1kRiyTwzp7eS2AESckER5Lfz j4THdcyxLqPtUwHErq/goPNYDZe3J/e6wcD0AJiLUc2raWQdid62ukVzGE2TaL73t+LD P67A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cZWYPiuk; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si2213765oib.135.2020.03.10.02.51.35; Tue, 10 Mar 2020 02:51:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b=cZWYPiuk; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726443AbgCJJuQ (ORCPT + 99 others); Tue, 10 Mar 2020 05:50:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:33542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbgCJJuQ (ORCPT ); Tue, 10 Mar 2020 05:50:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C6692467D; Tue, 10 Mar 2020 09:50:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583833814; bh=Zu/l5fryMW6NbrP4kqlO7eEbl7l/EtuRNKW9VU2dTOo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cZWYPiukgKFacUoodHREbVxDOxigTZzXF4VAOl5wFscRpq7DlS/TVQ+3rNtlWREUO k9voy+NeQzCD8D7fAS8va/5qrZZx51k4Ql7uH6EKgkhgbEVgg7BpbxykGGLjxlJ1sQ VJMVJ5RXrlc76ZTnuWPjJlVWNSm5bCJXnsdFV5Og= Date: Tue, 10 Mar 2020 10:50:11 +0100 From: Greg Kroah-Hartman To: Malcolm Priestley Cc: Oscar Carter , devel@driverdev.osuosl.org, Colin Ian King , Forest Bond , Gabriela Bittencourt , linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: vt6656: Use BIT_ULL() macro instead of bit shift operation Message-ID: <20200310095011.GC2516963@kroah.com> References: <20200307104929.7710-1-oscar.carter@gmx.com> <20200308065538.GF3983392@kroah.com> <20200308161047.GA3285@ubuntu> <561bc968-f88c-40e3-f53c-5c03f74f75ea@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <561bc968-f88c-40e3-f53c-5c03f74f75ea@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 08, 2020 at 07:22:07PM +0000, Malcolm Priestley wrote: > >>> */ > >>> #undef __NO_VERSION__ > >>> > >>> +#include > >>> #include > >>> #include > >>> #include "device.h" > >>> @@ -802,8 +803,7 @@ static u64 vnt_prepare_multicast(struct ieee80211_hw *hw, > >>> > >>> netdev_hw_addr_list_for_each(ha, mc_list) { > >>> bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; > >>> - > >>> - mc_filter |= 1ULL << (bit_nr & 0x3f); > >>> + mc_filter |= BIT_ULL(bit_nr); > >> > >> Are you sure this does the same thing? You are not masking off bit_nr > >> anymore, why not? > > > > My reasons are exposed below: > > > > The ether_crc function returns an u32 type (unsigned of 32 bits). Then the right > > shift operand discards the 26 lsb bits (the bits shifted off the right side are > > discarded). The 6 msb bits of the u32 returned by the ether_crc function are > > positioned in bit 5 to bit 0 of the variable bit_nr. Due to the right shift > > happens over an unsigned type, the 26 new bits added on the left side will be 0. > > > > In summary, after the right bit shift operation we obtain in the variable bit_nr > > (unsigned of 32 bits) the value represented by the 6 msb bits of the value > > returned by the ether_crc function. So, only the 6 lsb bits of the variable > > bit_nr are important. The 26 msb bits of this variable are 0. > > > > In this situation, the "and" operation with the mask 0x3f (mask of 6 lsb bits) > > is unnecessary due to its purpose is to reset (set to 0 value) the 26 msb bits > > that are yet 0. > > The mask is only there out of legacy originally it was 31(0x1f) and the > bit_nr spread across two mc_filter u32 arrays. > > The mask is not needed now it is u64. > > The patch is fine. Ok, then the changelog needs to be fixed up to explain all of this and resent. thanks, greg k-h