Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5140609img; Wed, 27 Mar 2019 02:58:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbCpI8y5R2XbYWx/ngR5JbK9g84W/Hqe/8d9Z6iTyWw0KMl/PoD5QBaIoKuSqjX3TMjVVQ X-Received: by 2002:a17:902:8a8a:: with SMTP id p10mr35860183plo.92.1553680721597; Wed, 27 Mar 2019 02:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553680721; cv=none; d=google.com; s=arc-20160816; b=ksJ1bzq4G/eW3YHdR1sM7meEaSepz3zPNKx5xElnVIuLKBGbUS1p09IPChE8dM2uJh HXtQ2JOZ+c+FBFfRXZLl3u1Qb33rNR0NmvlEWCibFNcKCpIWhO6bxgZt4fKuD1MbM2cC PklIenGcmuG2WTMKx8qMLtBKGo7sDcFMZylAY2BDiDZJVfGX87z1PEUqqa9+dTD+dEMF RHf3fX/dyQ2StD7WwyghVK9mwl8ZrMizD2I8jC/47N1JG8ZjWorO7qZYpXhj5423cqd1 aQoqtyXG4mwvcsXsQPhaTwMksWtpR2/W30bjKYlYhbF9AKE3XT05ntQrxvsB6nQpRf8F JH5g== 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:dkim-signature; bh=tndweEsnu1SYspGnxv0FoaY2zcER18S8te5CmcHWPj0=; b=m5Cf9MHonp+VNYWAra9HYLZyeLGRPesfmpibvaUG2fOPjhF+nkPwCgZhFpweHVMN5/ 0EHdaZ5fneRdJpTEQTjrPvp6vw1cZP0X/J+Ja8ziZ9MhGTKSb0NmMy1RjztzhFcefZpa umCoLeC8KPGFWG8S7qM9clL7dvPWObc6L3UKiRAWhVCU/Dtd1LLCjpOQLN5L0QpGqRXL gChN4rgP/RtiNdhCtDTphTlV7+GUR0lgt7Vu8yFaVqU9AG9lQy3LtEIMOIv5/eLbLIVM C5jQW3YEOLqHen/fXU9BGD/pBqh8SHkiC1nBRqoGBfkYElb2k0vEF5K59Ly/sRNZ8RuX i1dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=Gd3Zdt2b; 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 1si19695896plw.242.2019.03.27.02.58.26; Wed, 27 Mar 2019 02:58:41 -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=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=Gd3Zdt2b; 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 S1732695AbfC0J5x (ORCPT + 99 others); Wed, 27 Mar 2019 05:57:53 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44943 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727328AbfC0J5w (ORCPT ); Wed, 27 Mar 2019 05:57:52 -0400 Received: by mail-wr1-f66.google.com with SMTP id y7so13616729wrn.11 for ; Wed, 27 Mar 2019 02:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tndweEsnu1SYspGnxv0FoaY2zcER18S8te5CmcHWPj0=; b=Gd3Zdt2bhJPrSU57c9w0JTUjRSO7CzRc/4vTjcuNcA9xI/XyPMz1V8afK8QRnJvb0F IFSbD3Ie3et8BPXCSnylKD7e0pVdv8zaG59zu/oqecpdo5TSiYF0gro9aHRSrfkFEgeo TElUFN0jhJSyFNO9dpz3fiHMRa85XpqBAtYc6USRwuSXVHUcmyUdNvvfflNXnCiVMwcP Pfi9sGMUpsOIc5GObdATq1tZcWaD1P6fqJsKVLaGNZ90IYAsOiWEU+zXAwiwT78RiHhn R6Vep21DJ35E0UYUxedpoh9XWzk1Rzv2NdCLB4YrbDQUxxoKl4Ebwzpw9TPoqOG2h82G octA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tndweEsnu1SYspGnxv0FoaY2zcER18S8te5CmcHWPj0=; b=hrGk5HK2mdEwjKvqHWiR8yaR8OqyQ2kBZ6D1xHtS3eTguEyHEYc4Ep2nrCTI5GAaV0 uRKlB1D62yy43cYkKjHb11ghPGQ9HA8z+J/sAqbg+CrnOXnPRP9q6A7pjZEerA+7KXj/ ld6+0do7SVNGHjYZ1Z9c8TD8P8VZyCp5VLZeyF33imCQIgsiYycmQoB6fXN71QGI8BnS nC8HjLXuJR6CumUv9BHRh5uo5v0/RKXIF1sInK7S9gW/gNqZ5Gp2Uxt5jW6AS3HBfruo pmhhOYu/qhf0n7ocJ37c3YW8MWfciYAJCTOI2PjAlcMmJdst2D0e5JPbPvwuRe8bpsnd cBxA== X-Gm-Message-State: APjAAAU33wMYbD7aPa9KrpWqEys8fSPKda83COPn/aHkZCZHpGNLDtKf IeIDXlwEpxNrfxCjXN10EMSnZ52untc= X-Received: by 2002:adf:e78e:: with SMTP id n14mr17575970wrm.14.1553680670940; Wed, 27 Mar 2019 02:57:50 -0700 (PDT) Received: from localhost (ip-94-113-223-73.net.upcbroadband.cz. [94.113.223.73]) by smtp.gmail.com with ESMTPSA id v184sm20963871wma.6.2019.03.27.02.57.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Mar 2019 02:57:50 -0700 (PDT) Date: Wed, 27 Mar 2019 10:57:49 +0100 From: Jiri Pirko To: Michal Kubecek 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: <20190327095749.GD6979@nanopsycho> References: <9123f942b484ef4bbb684bb1f4aa2b70d673a259.1553532199.git.mkubecek@suse.cz> <20190326155911.GA4958@nanopsycho.orion> <20190326175932.GN26076@unicorn.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326175932.GN26076@unicorn.suse.cz> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tue, Mar 26, 2019 at 06:59:32PM CET, mkubecek@suse.cz wrote: >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. Wait, could you please describe this more? > >> 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. I'm just trying to figure out if it would be possible to use existing building block instead of introducing new ones.... > >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). Okay, I have to go over those patches but this smells. > >Michal