Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2093512ybi; Thu, 4 Jul 2019 05:08:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfMeeoFjT2HdOsk9IyzXA/FQUeKC4e9sVHN+UKhUkXz6qlDenAA1wLfMyc06e4n5ixSSYC X-Received: by 2002:a17:90a:376f:: with SMTP id u102mr19568370pjb.5.1562242114388; Thu, 04 Jul 2019 05:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562242114; cv=none; d=google.com; s=arc-20160816; b=G0rJ/uhK73ODqT9iFmqdA0Z4Rz8n4ajzEiWKO05f+Q6iy/yyrpr0j1w5IuvjkgxANT elJWk3bSm9Lqde81EgPsuSaiTKerMm+pev8iRVbA4x8+xtYnsowBAlDVViVMfpdwqOeQ 6rsKui+D896R+ksKvn8zXX9/Kkx6U/EQwaTYvC09k5GLSBZPvUyzRFyJMuBOa8TPpfAo tHT9Taq7pHM2WX4dbIjlur7xmnnoGGSpqrrkG8WjB7OR6l1CMeZKg7F/yt5lm6v4r+Qb Mx+tEomYjUvj0H1lIRTXE7fXvkUgaCovsU6D9DiRINf9AmL6M3w5y4DRn0vMMht3BEQO 9v7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=oZ9pOHmiCP2GLMchaTGQxene/uyFq5lu40ElbAjIark=; b=Dk3WiVFLW662sFbhA1XVs2BqspWFYINbWcBacgBrkXuHtev5U9II6cvZrn0ApDs+p4 A9lbKWfqBR6q/dKjVeSqW206WNFrMprHPXtRdNVIHb1u5cpD86j9pIZW9puRMyDMZA9z yLlOqTF4AcMExolHr9s4ddGFln8Tj4VyFLyrK3ptKS1mHtiPou3eBM/3uRwQCXhZeQJV aAjFm5fbqW1HTcKflU7y8eBFj6esYis/li2ewdVxtYisQdhJv1NycYwOZMvGPZaaCwKq hiTyaNiLgEPvPeKj1u4yXLpGwbirz2o3bJoY+5Gaqi6OeCjuT3yKb8Ir+gdfMb0sDV1W d6zQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si5395447pgp.424.2019.07.04.05.08.18; Thu, 04 Jul 2019 05:08:34 -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; 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 S1727710AbfGDMHY (ORCPT + 99 others); Thu, 4 Jul 2019 08:07:24 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:33182 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727612AbfGDMHX (ORCPT ); Thu, 4 Jul 2019 08:07:23 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hj0WD-0005Xr-0v; Thu, 04 Jul 2019 14:07:17 +0200 Message-ID: <51ab673812121794b021a09073a74fca33b81210.camel@sipsolutions.net> Subject: Re: [PATCH net-next v6 06/15] ethtool: netlink bitset handling From: Johannes Berg To: Jiri Pirko Cc: Michal Kubecek , David Miller , netdev@vger.kernel.org, Jakub Kicinski , Andrew Lunn , Florian Fainelli , John Linville , Stephen Hemminger , linux-kernel@vger.kernel.org Date: Thu, 04 Jul 2019 14:07:16 +0200 In-Reply-To: <20190703143724.GD2250@nanopsycho> (sfid-20190703_163726_852714_F806A186) References: <20190703114933.GW2250@nanopsycho> <20190703143724.GD2250@nanopsycho> (sfid-20190703_163726_852714_F806A186) Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-3.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-07-03 at 16:37 +0200, Jiri Pirko wrote: > Wed, Jul 03, 2019 at 03:44:57PM CEST, johannes@sipsolutions.net wrote: > > On Wed, 2019-07-03 at 13:49 +0200, Jiri Pirko wrote: > > > > > > > +Value and mask must have length at least ETHTOOL_A_BITSET_SIZE bits rounded up > > > > +to a multiple of 32 bits. They consist of 32-bit words in host byte order, > > > > > > Looks like the blocks are similar to NLA_BITFIELD32. Why don't you user > > > nested array of NLA_BITFIELD32 instead? > > > > That would seem kind of awkward to use, IMHO. > > > > Perhaps better to make some kind of generic "arbitrary size bitfield" > > attribute type? > > Yep, I believe I was trying to make this point during bitfield32 > discussion, failed apparently. So if we have "NLA_BITFIELD" with > arbitrary size, that sounds good to me. I guess it could be the same way - just have the content be u32 value[N]; u32 select[N]; where N = nla_len(attr) / 8 That'd be compatible with NLA_BITFIELD32, and we could basically change all occurrences of NLA_BITFIELD32 to NLA_BITFIELD, and have NLA_BITFIELD take something like a "max_bit" for the .len field or something like that? And an entry in the validation union to point to a "u32 *mask" instead of the current validation_data that just points to a single u32 mask... So overall seems like a pretty simple extension to NLA_BITFIELD32 that handles NLA_BITFIELD32 as a special case with simply .len=32. (len is a 16-bit field, but a 64k bitmap should be sufficient I hope?) johannes