Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp986937ybi; Wed, 3 Jul 2019 07:39:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwF9ZVKv+L68f7bWayYWQuzisFPd+dLYNJSSITY3fd0tXi2RWaIzGyDIHRygK2rOCyCJcuA X-Received: by 2002:a17:90a:350c:: with SMTP id q12mr13294684pjb.46.1562164767003; Wed, 03 Jul 2019 07:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562164766; cv=none; d=google.com; s=arc-20160816; b=fy4qE9dloN2YtQVIbCXrc61YXFLm9n3VrLS3GX5rSf4wf1K4natI1Cxi56YGA3ROTs ZiX1eo9N+wzcKBxXvf6HonOmjtllL/uTNoAgfHQ3CaGDyyTIVVB8lcRsxkCFJtC7HWds 7u6YfS0dXe3rtgUkOHm8dytY0d+p2ZNUPggIpRO9jpGvHkQURKZN8o1ctG4EmmTxy3Rh U7GQd/36Plsc3E6r3ut48QE7LWzhWd64DsP5xevr+cVIKrdy0odZiPVx/QD785ZcSTQk Lg2wo/mkqKry0glWPXkMB/kYahaOhkbdf6FL+1FGEjMseWUkODy0kmN3i/RDbccrtQEm dd9w== 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=2iVOqo4QxEZnTRA/q3n5PqocP6F2eupQadXkFNMN+/o=; b=QgReTHUMbkGLw0ORJ0jxXHt+54QfxIdd2Qj8rXPRcDDH2uKwAzWwIdWJUyMM3Wd8fD wEsgrVzM/j0rVpB8nMk/DXS/GlOAp9UtOdqF4ljGHFbu5c3tolKW31gr2pxk0OJNuIJ9 94V2U8BWXT7mPlxHqEIMCLj/jDb6ga2x/eB3slCNB9YQx3jDxutR13uJtZhZt4iFz1DD WYorrqsgpyTWuKAgKAzEeVZ6IgJgbd455Uurj6iLDfBiaBP7hq6fcScltGhUYQU8rM98 XBFM9dN/paRavCd3DqKMIMeAnMR9vTZDL4WID7GdUS3Gt8r4ICUgFuGMlIdL9uj7DilQ FAKQ== 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 m68si2572481pfb.75.2019.07.03.07.39.11; Wed, 03 Jul 2019 07:39:26 -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 S1727110AbfGCOhY (ORCPT + 99 others); Wed, 3 Jul 2019 10:37:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:51236 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725933AbfGCOhY (ORCPT ); Wed, 3 Jul 2019 10:37:24 -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 718D4AF89; Wed, 3 Jul 2019 14:37:23 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id E89DAE0159; Wed, 3 Jul 2019 16:37:22 +0200 (CEST) Date: Wed, 3 Jul 2019 16:37:22 +0200 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Jiri Pirko , David Miller , Jakub Kicinski , Andrew Lunn , Florian Fainelli , John Linville , Stephen Hemminger , Johannes Berg , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v6 08/15] ethtool: move string arrays into common file Message-ID: <20190703143722.GN20101@unicorn.suse.cz> References: <0647ac484dac2c655d0e4260d81e86405688ff5b.1562067622.git.mkubecek@suse.cz> <20190703134452.GZ2250@nanopsycho> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190703134452.GZ2250@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, Jul 03, 2019 at 03:44:52PM +0200, Jiri Pirko wrote: > Tue, Jul 02, 2019 at 01:50:19PM CEST, mkubecek@suse.cz wrote: > >Introduce file net/ethtool/common.c for code shared by ioctl and netlink > >ethtool interface. Move name tables of features, RSS hash functions, > >tunables and PHY tunables into this file. > > > >Signed-off-by: Michal Kubecek > >--- > > net/ethtool/Makefile | 2 +- > > net/ethtool/common.c | 84 ++++++++++++++++++++++++++++++++++++++++++++ > > net/ethtool/common.h | 17 +++++++++ > > net/ethtool/ioctl.c | 83 ++----------------------------------------- > > 4 files changed, 104 insertions(+), 82 deletions(-) > > create mode 100644 net/ethtool/common.c > > create mode 100644 net/ethtool/common.h > > > >diff --git a/net/ethtool/Makefile b/net/ethtool/Makefile > >index 482fdb9380fa..11782306593b 100644 > >--- a/net/ethtool/Makefile > >+++ b/net/ethtool/Makefile > >@@ -1,6 +1,6 @@ > > # SPDX-License-Identifier: GPL-2.0 > > > >-obj-y += ioctl.o > >+obj-y += ioctl.o common.o > > > > obj-$(CONFIG_ETHTOOL_NETLINK) += ethtool_nl.o > > > >diff --git a/net/ethtool/common.c b/net/ethtool/common.c > >new file mode 100644 > >index 000000000000..b0ce420e994e > >--- /dev/null > >+++ b/net/ethtool/common.c > >@@ -0,0 +1,84 @@ > >+// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note > >+ > >+#include "common.h" > >+ > >+const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { > > const char *netdev_features_strings[NETDEV_FEATURE_COUNT] = { > ? > > Same with the other arrays. These are not new tables, this patch only moves existing tables from ioctl.c (originally net/core/ethtool.c) into common.c so that they can be used by both ioctl and netlink code. This fixed size string array format is used by ETHTOOL_GSTRINGS ioctl command. So if we switch these into simple const char *table[], we can get rid of some complexity in strset.c and bitset.c (the "simple" vs. "legacy" string set mess) but we would have to convert them into the fixed size string array in ioctl ETHTOOL_GSTRINGS handler. And then we would also have to convert (or rather "index") string sets retrieved from NIC driver (e.g. private flags, stats, tests) - which also means an extra kmalloc() (or rather kmalloc_array()). It an option I'm certainly open to if we agree on it but it's not for free. Michal