Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5159920img; Wed, 27 Mar 2019 03:21:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiKdJ5gg2o1yWbOppqQOpH21k3ZsyuMC/EpDWwKD7aqY/2pqZkEkZ1LXIMw0MeV6MPsZZT X-Received: by 2002:a17:902:1029:: with SMTP id b38mr35726571pla.204.1553682091749; Wed, 27 Mar 2019 03:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553682091; cv=none; d=google.com; s=arc-20160816; b=HM7SFZcJNUrCDNxQ6+BwsCQWLJT5brtiTJLJMBdj9PL6AV5D5e4f6kuRiI15ZWRS49 EikUr3Px9q+kKwQ7XeyzohDKGonLbGlfxSwu6hx9SKwvfMkefXalGFlJ980pOn2si/i/ HuiOEPNZt/pCGbeI7lNO622wO0GkhQZPiVDf/Qh1L9sPXwZhWu8WFIpWZ/ZkRNLSVF/B IPL2m80NEo6lz6SKIe+eglbzxNRCgim4TGPzo6bKocv96s+RMlUO5iexAmTEFpBpn4WL ZTgcUH9uSqGG66NpZlJx+rxIU5D6NqoF0OprjqttOvscNOtaJNfBqV35hogdLRfhDE4g Frnw== 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=7TIc0GypWn3dpOaFzMsenDqtor39eE3MnSXPy1uC6g8=; b=HAB/UCV79S7EQAOpln/kkbIrQFm83p7DB+UVaxiOPCz7LcQFFD7BSgMg/+rrycsBab xh+YHsAIBCWn2+hGKkLL8IaF+XhNxw3INKwoUPeJpGHAZjmvf36wNY36SxdH85cdsg4y tE+x5Uw/woAwcIrYWCpp/kASNs8Puc7qPk5qR1X3fIQq+r8EgnwxKdmVC/NOi2TvFKdD d/T3QTO1pZ/Af5rcobc0h9bE5sYuQgDEnFlLJ/CNZmutD1k6xUawZv6ZTKGaswmWO9au ZYOo9X7QBIvAKV9s7d6EhD0gUSyzlRnnGsEN/MV81yXwgKhQ9kOC1PFRoCyNTSVTJ+Jt xJpQ== 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 n15si4853998pgg.308.2019.03.27.03.21.15; Wed, 27 Mar 2019 03:21:31 -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 S1733007AbfC0KT0 (ORCPT + 99 others); Wed, 27 Mar 2019 06:19:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:35656 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725827AbfC0KTZ (ORCPT ); Wed, 27 Mar 2019 06:19:25 -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 0ED68AD2F; Wed, 27 Mar 2019 10:19:24 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 855C1E1404; Wed, 27 Mar 2019 11:19:23 +0100 (CET) Date: Wed, 27 Mar 2019 11:19:23 +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: <20190327101923.GR26076@unicorn.suse.cz> References: <9123f942b484ef4bbb684bb1f4aa2b70d673a259.1553532199.git.mkubecek@suse.cz> <20190326155911.GA4958@nanopsycho.orion> <20190326175932.GN26076@unicorn.suse.cz> <20190327095749.GD6979@nanopsycho> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190327095749.GD6979@nanopsycho> 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 Wed, Mar 27, 2019 at 10:57:49AM +0100, Jiri Pirko wrote: > 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? At the moment, there are two formats of bit name tables. Legacy format which is used by ioctl string sets, e.g. const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { ... }; (the same is provided by NIC drivers with ethtool_ops::get_strings()) and simple format used for newly added string sets, e.g. const char *const link_mode_names[] = { ... }; If the bitset implementation is to be used by other APIs, legacy format support would make little sense so I would suggest to drop legacy format support from bitset code and build a (const char **) "index" for ethtool legacy string arrays before passing it to bitset related functions. Michal