Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4520650img; Tue, 26 Mar 2019 11:00:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYUzz9op6pCsIVBM6Gskn3tyjoGN36KF/AqKQaWGABHASEmOSuzGWBQZMo+znF66ZAvWJJ X-Received: by 2002:a62:388d:: with SMTP id f135mr16706947pfa.103.1553623242462; Tue, 26 Mar 2019 11:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553623242; cv=none; d=google.com; s=arc-20160816; b=lULwMWNQrp65EQNDLrKMx4AcEE8DhVip2p1IUe+saUJ2muX1bpF/Lkoxi3YSfpAPfb UKmq8EZoVk/IW9ZOhlUedhm6M1U2jMfkxisYdd5pJmGVzwCbpKFoKdI2FAQQLNZizhMi SHxNiEg6W5+1AxTsXeJoTrobjggLW1OhRFW7vb2T3JKaEN6FnxrgocmGga1PXZij9yfm 3aepNlCsZTLVY8REeCRwc+Y5T95GGJtQ4gmEh3PaXZlA7tF3QDcQi5SLqCg9C+4bdc5l Nh/hcQtJ+EqdYXpYNWECAAXD4bUO/dMLfF3cBzGvU6XBmbsM4mDifs28vOSJmcZF+fPC 2X8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=mg0UCbcekxu06mL/yfqvHq+OpSS11ucpYb7O9l2ZKrU=; b=GlBXpIMZtreaFpuMk5WNGHsVOtgghp9s8rg4mXyq2wYqqsBMhsIhK/Sy2eLzaYQF76 NtKaJzBED3JrYvimAkqd3WOiDHZNEdUgA5SHDB6Y2NlC7/tvHkAiDIt1kCe71J0Ljh5D S8+t3TOvDfg8SqnZ8Lhz3sSswC2s9nYY2ullf9xHpGan6D404iiI78tTOuZ/oo0G7bUd 0rjmE+iXqau2/eEwMOJJFsBZ2E0U8gxR7jykREBRKOa7vn5ZLnvH4OB9meTNftCMT9nz qXZLx/av0n3nhgHZIEAp2fYXCMQx4bosY0/908wTNRE4NZAy+wHNpyN+qdHz5LRKajaB 3M1Q== 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 h35si18180022plb.180.2019.03.26.11.00.26; Tue, 26 Mar 2019 11:00:42 -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 S1732325AbfCZR7e (ORCPT + 99 others); Tue, 26 Mar 2019 13:59:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:55640 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731828AbfCZR7d (ORCPT ); Tue, 26 Mar 2019 13:59:33 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 70064AEF8; Tue, 26 Mar 2019 17:59:32 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 12056E1404; Tue, 26 Mar 2019 18:59:32 +0100 (CET) Date: Tue, 26 Mar 2019 18:59:32 +0100 From: Michal Kubecek To: Jiri Pirko Cc: David Miller , netdev@vger.kernel.org, Jakub Kicinski , Andrew Lunn , Florian Fainelli , John Linville , Stephen Hemminger , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v5 07/22] ethtool: netlink bitset handling Message-ID: <20190326175932.GN26076@unicorn.suse.cz> References: <9123f942b484ef4bbb684bb1f4aa2b70d673a259.1553532199.git.mkubecek@suse.cz> <20190326155911.GA4958@nanopsycho.orion> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326155911.GA4958@nanopsycho.orion> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 26, 2019 at 04:59:11PM +0100, Jiri Pirko wrote: > Mon, Mar 25, 2019 at 06:08:15PM CET, mkubecek@suse.cz wrote: > >Declare attribute type constants and add helper functions to generate and > >parse arbitrary length bit sets. > > Hmm, this looks like a lot of work. Two things: > 1) This is generic. Not really related to ethtool in any way. Could this > be done in netlink common code? I suppose it could if other netlink based APIs would be interested in using it. The only ethtool specific part is the support for "legacy style names" (fixed size strings) but that is something I'm not really happy about. Perhaps it's time to return to the original idea of supporting only arrays of (char *) and creating them around existing fixed size ones. > 2) Did you think about leveraging NLA_BITFIELD32? What I mean is this: > NEST_START > NLA_BITFIELD32 index 0 (bit 0-31) > NLA_BITFIELD32 index 1 (bit 32-63) > NLA_BITFIELD32 index 2 (bit 64-95) > NLA_BITFIELD32 index 3 (bit 96-127) > .... > NEST_END > It is basically an array of NLA_BITFIELD32. That would be similar to compact form but it would introduce the interleaving and extra struct nlattr header for each block. I don't think it would make things easier. The verbose form is meant to allow requests like ethtool -K eth0 tx-vlan-stag-hw-insert on ethtool -s eth0 advertise 1000baseT/Full off without either keeping the table of available flags in sync between kernel and userspace (all userspace users of the API) or having to ask for the list first (in case of one shot requests as above; long running tools like "ethtool --monitor" or config management daemons would keep the tables and use compact form). Michal