Message ID | 20231026-ethtool_puts_impl-v2-1-0d67cbdd0538@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp192613vqb; Thu, 26 Oct 2023 14:57:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF98U9aHVoyjVWjDYZvR0av6lS74bUt9iTs3NUvqT5ZNJCgfJpagS8ByMalf7zqlieiLpM3 X-Received: by 2002:a17:907:3da8:b0:9c3:bd63:4245 with SMTP id he40-20020a1709073da800b009c3bd634245mr762003ejc.47.1698357447449; Thu, 26 Oct 2023 14:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698357447; cv=none; d=google.com; s=arc-20160816; b=MVA26wCkDOZD60LiArqyPpNSUt9iZY9xL4MpQro83R7CnYgj0JcxuxfvMFapGpFFfv f2mQAnaHOLqmxU7sizx2Q2482WlAAErc2teyzwKaJHdMzXcHCU5aHuC00LCn6Jmc1Exv 4i1d2PymSmQQ7fLUH8A5Ii6znbgRzg7nPx1GPre2Ow4Pz+9PFUMsVnha+1nllQ9JSHBD +/s9wM2j3lq8wXenJPfemN2d2KFdJC9l2l51q4rW8vVRY6XitiSP0lSJBtexFKAv/Fjh TKOG5plhhiDCVFDOheXSsuwpMh3t8MZOpUFVZ5FR18SWewH/n8GSfJOVawXQoRwfw/wI pxTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=BGnfO5yo1brrl3JG1fuz3XeacVop9nGYIXct/GsCbHA=; fh=KbtZdS+g7EcIXF6IkhyVCA7RdLprHttm0sN0x6fLY0g=; b=iIb5OqHrtZWRwnGyISEy0oulBYDDZPhZ+msfHZnpj6ehPgVuZmN3dzrwHsXt0UYhll bdeqxq1d/EKYOTvwI/rz9lMhSiC45ObTfzdza+I6pNyuDki3jgXoHmLy8rBUNGhumYxd Pb4iUMAeLzH/QOEsoqT18Wmxa1GhpfnqwwxTmHl19xg5fWfoWdMLairDd7fyn1if6wcV JzNjjK1BwfHCrp4FoXGjV6hs5bfS6WIGHwd9kpM1Oq4Zl/acm3rijroOAIdKqayuouYq 7YD6VBdRU0E0kS0cg1Rb1t4rXsi4MPqK6BJDgCta9hN/7T6qxcC5ai7ZeYXmHZ4LfAAX Pmww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YPj55n2C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id be14-20020a1709070a4e00b00977e10fafd3si145047ejc.1045.2023.10.26.14.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 14:57:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YPj55n2C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 251E78028432; Thu, 26 Oct 2023 14:56:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbjJZV4Y (ORCPT <rfc822;aposhian.dev@gmail.com> + 26 others); Thu, 26 Oct 2023 17:56:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231977AbjJZV4U (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 26 Oct 2023 17:56:20 -0400 Received: from mail-oi1-x24a.google.com (mail-oi1-x24a.google.com [IPv6:2607:f8b0:4864:20::24a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 913CE1B2 for <linux-kernel@vger.kernel.org>; Thu, 26 Oct 2023 14:56:15 -0700 (PDT) Received: by mail-oi1-x24a.google.com with SMTP id 5614622812f47-3b2e7ae47d1so2122896b6e.0 for <linux-kernel@vger.kernel.org>; Thu, 26 Oct 2023 14:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698357375; x=1698962175; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=BGnfO5yo1brrl3JG1fuz3XeacVop9nGYIXct/GsCbHA=; b=YPj55n2CVrwECELqBp1BWiRdDeiahWrh09vlZ9y4NuNIM4rkt4JjSTqAD3G14/dtDN s9qy7TH1VNXFRWZRxvyV8chlR75DGWEb8DHwpyan3CMTpFapkWaO+0Vdbwaff7HzQotA 2wsba9jbSdhe9m3ytUGelfD2m5nszW3EMaTmjhwE7kjyctQaGJ6wSpPY1JBk/8mOG4IK e0Lfr3qz3Krsqf3x0jI5dko8CEbdQ2TdfXUaIyhK86nUQpuN36EuhYopTbPE+gGu2CYu kqY2vs8KI8byVCUOC064QBGruHUGWvdsrbkg7r9XFBZpMXhKyWNgBjL0Pb4SEaK2emWS v6SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698357375; x=1698962175; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BGnfO5yo1brrl3JG1fuz3XeacVop9nGYIXct/GsCbHA=; b=nEHHRft6MscZpBCpFisGe19KRRUkQ33MSXxkuXqmbAPZTDXRbrxUciuSyP9AK1FJza mkqpT8rlAX1uq+q4VOqoppB2fEtA1b4YZMW4Q+PVXiI4He9hSIOgA9wxGf81bTWQurB8 0B4Qw070hq8wk6MdO8oggjNVpmFwjHZwzy5ynE1UGfIUu0/nagL/ERX2r29DxezB3C9Y 89CjDaI9HhUNmFgDTzuu4m3WJq5yGGH2WO00m/1bAsMNDMMhx46BZqCsVYkVclF5GmdT DWclecXrd5Ktmr0LDCFqQoWLuc9EjYo3JqKnLnwHiJ/+pH3dGkjEPos5VZwvh3+d7+wR nIZA== X-Gm-Message-State: AOJu0YwDlVnDdNMItCHR2aDhoHwQLEanJI4pUcIRTZE+sFY5riSyUFvs MTYPn1mjG/qZK6dVsHPS9njBsUm3IerLIl48JA== X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5]) (user=justinstitt job=sendgmr) by 2002:a05:6808:f01:b0:3ad:f860:b315 with SMTP id m1-20020a0568080f0100b003adf860b315mr220107oiw.2.1698357374848; Thu, 26 Oct 2023 14:56:14 -0700 (PDT) Date: Thu, 26 Oct 2023 21:56:07 +0000 In-Reply-To: <20231026-ethtool_puts_impl-v2-0-0d67cbdd0538@google.com> Mime-Version: 1.0 References: <20231026-ethtool_puts_impl-v2-0-0d67cbdd0538@google.com> X-Developer-Key: i=justinstitt@google.com; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1698357372; l=2655; i=justinstitt@google.com; s=20230717; h=from:subject:message-id; bh=8djdPmMRDp1kcBXDhs8ygPXLuTfgtvGs7Yo95u6cw0k=; b=oxdmPg9KABeZlWyohpoRER6suttzISQsU1pFrM2utjhSx+ViWnRXf8IVNcElP/r+ITJcWQj9E seeyc13ojC5BXu0aQZG5KcerhesMEYloY+EmDxWK7pulBdKUNUGMRBN X-Mailer: b4 0.12.3 Message-ID: <20231026-ethtool_puts_impl-v2-1-0d67cbdd0538@google.com> Subject: [PATCH next v2 1/3] ethtool: Implement ethtool_puts() From: Justin Stitt <justinstitt@google.com> To: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Shay Agroskin <shayagr@amazon.com>, Arthur Kiyanovski <akiyano@amazon.com>, David Arinzon <darinzon@amazon.com>, Noam Dagan <ndagan@amazon.com>, Saeed Bishara <saeedb@amazon.com>, Rasesh Mody <rmody@marvell.com>, Sudarsana Kalluru <skalluru@marvell.com>, GR-Linux-NIC-Dev@marvell.com, Dimitris Michailidis <dmichail@fungible.com>, Yisen Zhuang <yisen.zhuang@huawei.com>, Salil Mehta <salil.mehta@huawei.com>, Jesse Brandeburg <jesse.brandeburg@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, Louis Peens <louis.peens@corigine.com>, Shannon Nelson <shannon.nelson@amd.com>, Brett Creeley <brett.creeley@amd.com>, drivers@pensando.io, "K. Y. Srinivasan" <kys@microsoft.com>, Haiyang Zhang <haiyangz@microsoft.com>, Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>, Ronak Doshi <doshir@vmware.com>, VMware PV-Drivers Reviewers <pv-drivers@vmware.com>, Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>, Dwaipayan Ray <dwaipayanray1@gmail.com>, Lukas Bulwahn <lukas.bulwahn@gmail.com>, Hauke Mehrtens <hauke@hauke-m.de>, Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, " =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= " <arinc.unal@arinc9.com>, Daniel Golle <daniel@makrotopia.org>, Landen Chao <Landen.Chao@mediatek.com>, DENG Qingfang <dqfext@gmail.com>, Sean Wang <sean.wang@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Linus Walleij <linus.walleij@linaro.org>, " =?utf-8?q?Alvin_=C5=A0ipraga?= " <alsi@bang-olufsen.dk>, Wei Fang <wei.fang@nxp.com>, Shenwei Wang <shenwei.wang@nxp.com>, Clark Wang <xiaoning.wang@nxp.com>, NXP Linux Team <linux-imx@nxp.com>, Lars Povlsen <lars.povlsen@microchip.com>, Steen Hegelund <Steen.Hegelund@microchip.com>, Daniel Machon <daniel.machon@microchip.com>, UNGLinuxDriver@microchip.com, Jiawen Wu <jiawenwu@trustnetic.com>, Mengyuan Lou <mengyuanlou@net-swift.com>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com> Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Nick Desaulniers <ndesaulniers@google.com>, Nathan Chancellor <nathan@kernel.org>, Kees Cook <keescook@chromium.org>, intel-wired-lan@lists.osuosl.org, oss-drivers@corigine.com, linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, bpf@vger.kernel.org, Justin Stitt <justinstitt@google.com> Content-Type: text/plain; charset="utf-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 26 Oct 2023 14:56:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780856858873734108 X-GMAIL-MSGID: 1780856858873734108 |
Series |
ethtool: Add ethtool_puts()
|
|
Commit Message
Justin Stitt
Oct. 26, 2023, 9:56 p.m. UTC
Use strscpy() to implement ethtool_puts().
Functionally the same as ethtool_sprintf() when it's used with two
arguments or with just "%s" format specifier.
Signed-off-by: Justin Stitt <justinstitt@google.com>
---
include/linux/ethtool.h | 34 +++++++++++++++++++++++-----------
net/ethtool/ioctl.c | 7 +++++++
2 files changed, 30 insertions(+), 11 deletions(-)
Comments
Hi Justin, On Thu, Oct 26, 2023 at 09:56:07PM +0000, Justin Stitt wrote: > Use strscpy() to implement ethtool_puts(). > > Functionally the same as ethtool_sprintf() when it's used with two > arguments or with just "%s" format specifier. > > Signed-off-by: Justin Stitt <justinstitt@google.com> > --- > include/linux/ethtool.h | 34 +++++++++++++++++++++++----------- > net/ethtool/ioctl.c | 7 +++++++ > 2 files changed, 30 insertions(+), 11 deletions(-) > > diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h > index 226a36ed5aa1..7129dd2e227c 100644 > --- a/include/linux/ethtool.h > +++ b/include/linux/ethtool.h > @@ -1053,22 +1053,34 @@ static inline int ethtool_mm_frag_size_min_to_add(u32 val_min, u32 *val_add, > */ > extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...); > > +/** > + * ethtool_puts - Write string to ethtool string data > + * @data: Pointer to start of string to update > + * @str: String to write > + * > + * Write string to data. Update data to point at start of next > + * string. > + * > + * Prefer this function to ethtool_sprintf() when given only > + * two arguments or if @fmt is just "%s". > + */ > +extern void ethtool_puts(u8 **data, const char *str); > + > /* Link mode to forced speed capabilities maps */ > struct ethtool_forced_speed_map { > - u32 speed; > + u32 speed; > __ETHTOOL_DECLARE_LINK_MODE_MASK(caps); > > - const u32 *cap_arr; > - u32 arr_size; > + const u32 *cap_arr; > + u32 arr_size; > }; > > -#define ETHTOOL_FORCED_SPEED_MAP(prefix, value) \ > -{ \ > - .speed = SPEED_##value, \ > - .cap_arr = prefix##_##value, \ > - .arr_size = ARRAY_SIZE(prefix##_##value), \ > -} > +#define ETHTOOL_FORCED_SPEED_MAP(prefix, value) \ > + { \ > + .speed = SPEED_##value, .cap_arr = prefix##_##value, \ > + .arr_size = ARRAY_SIZE(prefix##_##value), \ > + } > > -void > -ethtool_forced_speed_maps_init(struct ethtool_forced_speed_map *maps, u32 size); > +void ethtool_forced_speed_maps_init(struct ethtool_forced_speed_map *maps, > + u32 size); > #endif /* _LINUX_ETHTOOL_H */ Maybe this is due to an incorrect rebase conflict resolution, but you shouldn't have touched any of the ethtool force speed maps. Please wait for at least 24 hours to pass before posting a new version, to allow for more comments to come in.
On Thu, Oct 26, 2023 at 3:02 PM Vladimir Oltean <olteanv@gmail.com> wrote: > > Hi Justin, > > On Thu, Oct 26, 2023 at 09:56:07PM +0000, Justin Stitt wrote: > > Use strscpy() to implement ethtool_puts(). > > > > Functionally the same as ethtool_sprintf() when it's used with two > > arguments or with just "%s" format specifier. > > > > Signed-off-by: Justin Stitt <justinstitt@google.com> > > --- > > include/linux/ethtool.h | 34 +++++++++++++++++++++++----------- > > net/ethtool/ioctl.c | 7 +++++++ > > 2 files changed, 30 insertions(+), 11 deletions(-) > > > > diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h > > index 226a36ed5aa1..7129dd2e227c 100644 > > --- a/include/linux/ethtool.h > > +++ b/include/linux/ethtool.h > > @@ -1053,22 +1053,34 @@ static inline int ethtool_mm_frag_size_min_to_add(u32 val_min, u32 *val_add, > > */ > > extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...); > > > > +/** > > + * ethtool_puts - Write string to ethtool string data > > + * @data: Pointer to start of string to update > > + * @str: String to write > > + * > > + * Write string to data. Update data to point at start of next > > + * string. > > + * > > + * Prefer this function to ethtool_sprintf() when given only > > + * two arguments or if @fmt is just "%s". > > + */ > > +extern void ethtool_puts(u8 **data, const char *str); > > + > > /* Link mode to forced speed capabilities maps */ > > struct ethtool_forced_speed_map { > > - u32 speed; > > + u32 speed; > > __ETHTOOL_DECLARE_LINK_MODE_MASK(caps); > > > > - const u32 *cap_arr; > > - u32 arr_size; > > + const u32 *cap_arr; > > + u32 arr_size; > > }; > > > > -#define ETHTOOL_FORCED_SPEED_MAP(prefix, value) \ > > -{ \ > > - .speed = SPEED_##value, \ > > - .cap_arr = prefix##_##value, \ > > - .arr_size = ARRAY_SIZE(prefix##_##value), \ > > -} > > +#define ETHTOOL_FORCED_SPEED_MAP(prefix, value) \ > > + { \ > > + .speed = SPEED_##value, .cap_arr = prefix##_##value, \ > > + .arr_size = ARRAY_SIZE(prefix##_##value), \ > > + } > > > > -void > > -ethtool_forced_speed_maps_init(struct ethtool_forced_speed_map *maps, u32 size); > > +void ethtool_forced_speed_maps_init(struct ethtool_forced_speed_map *maps, > > + u32 size); > > #endif /* _LINUX_ETHTOOL_H */ > > Maybe this is due to an incorrect rebase conflict resolution, but you > shouldn't have touched any of the ethtool force speed maps. Ah, I did have a conflict and resolved by simply moving the hunks out of each other's way. Trivial resolution. Should I undo this? I want my patch against next since it's targeting some stuff in-flight over there. BUT, I also want ethtool_puts() to be directly below ethtool_sprintf() in the source code. What to do? > > Please wait for at least 24 hours to pass before posting a new version, > to allow for more comments to come in. Ok :) Thanks Justin
On Thu, Oct 26, 2023 at 3:09 PM Justin Stitt <justinstitt@google.com> wrote: > > On Thu, Oct 26, 2023 at 3:02 PM Vladimir Oltean <olteanv@gmail.com> wrote: > > > > Hi Justin, > > > > On Thu, Oct 26, 2023 at 09:56:07PM +0000, Justin Stitt wrote: > > > Use strscpy() to implement ethtool_puts(). > > > > > > Functionally the same as ethtool_sprintf() when it's used with two > > > arguments or with just "%s" format specifier. > > > > > > Signed-off-by: Justin Stitt <justinstitt@google.com> > > > --- > > > include/linux/ethtool.h | 34 +++++++++++++++++++++++----------- > > > net/ethtool/ioctl.c | 7 +++++++ > > > 2 files changed, 30 insertions(+), 11 deletions(-) > > > > > > diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h > > > index 226a36ed5aa1..7129dd2e227c 100644 > > > --- a/include/linux/ethtool.h > > > +++ b/include/linux/ethtool.h > > > @@ -1053,22 +1053,34 @@ static inline int ethtool_mm_frag_size_min_to_add(u32 val_min, u32 *val_add, > > > */ > > > extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...); > > > > > > +/** > > > + * ethtool_puts - Write string to ethtool string data > > > + * @data: Pointer to start of string to update > > > + * @str: String to write > > > + * > > > + * Write string to data. Update data to point at start of next > > > + * string. > > > + * > > > + * Prefer this function to ethtool_sprintf() when given only > > > + * two arguments or if @fmt is just "%s". > > > + */ > > > +extern void ethtool_puts(u8 **data, const char *str); > > > + > > > /* Link mode to forced speed capabilities maps */ > > > struct ethtool_forced_speed_map { > > > - u32 speed; > > > + u32 speed; > > > __ETHTOOL_DECLARE_LINK_MODE_MASK(caps); > > > > > > - const u32 *cap_arr; > > > - u32 arr_size; > > > + const u32 *cap_arr; > > > + u32 arr_size; > > > }; > > > > > > -#define ETHTOOL_FORCED_SPEED_MAP(prefix, value) \ > > > -{ \ > > > - .speed = SPEED_##value, \ > > > - .cap_arr = prefix##_##value, \ > > > - .arr_size = ARRAY_SIZE(prefix##_##value), \ > > > -} > > > +#define ETHTOOL_FORCED_SPEED_MAP(prefix, value) \ > > > + { \ > > > + .speed = SPEED_##value, .cap_arr = prefix##_##value, \ > > > + .arr_size = ARRAY_SIZE(prefix##_##value), \ > > > + } > > > > > > -void > > > -ethtool_forced_speed_maps_init(struct ethtool_forced_speed_map *maps, u32 size); > > > +void ethtool_forced_speed_maps_init(struct ethtool_forced_speed_map *maps, > > > + u32 size); > > > #endif /* _LINUX_ETHTOOL_H */ > > > > Maybe this is due to an incorrect rebase conflict resolution, but you > > shouldn't have touched any of the ethtool force speed maps. > > Ah, I did have a conflict and resolved by simply moving the hunks > out of each other's way. Trivial resolution. > > Should I undo this? I want my patch against next since it's targeting > some stuff in-flight over there. BUT, I also want ethtool_puts() to be > directly below ethtool_sprintf() in the source code. What to do? Oh, I just realized my auto formatter had a field day with that function. I will rectify this in a new version after waiting 24hrs for comments to trickle in as well. > > > > > Please wait for at least 24 hours to pass before posting a new version, > > to allow for more comments to come in. > > Ok :) > > Thanks > Justin Thanks Justin
On Thu, Oct 26, 2023 at 03:11:28PM -0700, Justin Stitt wrote: > On Thu, Oct 26, 2023 at 3:09 PM Justin Stitt <justinstitt@google.com> wrote: > > On Thu, Oct 26, 2023 at 3:02 PM Vladimir Oltean <olteanv@gmail.com> wrote: > > > Maybe this is due to an incorrect rebase conflict resolution, but you > > > shouldn't have touched any of the ethtool force speed maps. > > > > Ah, I did have a conflict and resolved by simply moving the hunks > > out of each other's way. Trivial resolution. > > > > Should I undo this? I want my patch against next since it's targeting > > some stuff in-flight over there. BUT, I also want ethtool_puts() to be > > directly below ethtool_sprintf() in the source code. What to do? > > Oh, I just realized my auto formatter had a field day with that function. > I will rectify this in a new version after waiting 24hrs for comments to > trickle in as well. Nothing other than ethtool_puts() should appear in the patch delta. pw-bot: cr
On Thu, Oct 26, 2023 at 03:09:59PM -0700, Justin Stitt wrote: > Should I undo this? I want my patch against next since it's targeting > some stuff in-flight over there. BUT, I also want ethtool_puts() to be > directly below ethtool_sprintf() in the source code. What to do? (removing everyone except the lists from CC, I don't want to go to email arest because of spamming too many recipients) What is the stuff in-flight in next that this is targeting? And why would anything prevent you from putting ethtool_puts() directly below ethtool_sprintf()?
On Thu, Oct 26, 2023 at 3:25 PM Vladimir Oltean <olteanv@gmail.com> wrote: > > On Thu, Oct 26, 2023 at 03:09:59PM -0700, Justin Stitt wrote: > > Should I undo this? I want my patch against next since it's targeting > > some stuff in-flight over there. BUT, I also want ethtool_puts() to be > > directly below ethtool_sprintf() in the source code. What to do? > > (removing everyone except the lists from CC, I don't want to go to email > arest because of spamming too many recipients) > > What is the stuff in-flight in next that this is targeting? > > And why would anything prevent you from putting ethtool_puts() directly > below ethtool_sprintf()? The in-flight stuff consists of patches I sent changing some strncpy() usage to ethtool_sprintf(&data, "%s", something[i].name); We can see them here [1]. I went for this approach initially but then discussion came up about introducing ethtool_puts() which now made my patches (some accepted into next already) semi-outdated and in need of another swap from sprintf->puts() -- hence this series. As far as the rebase, I simply took my commits and placed them on top of next/master and got merge conflicts when ethtool_puts() was placed below ethtool_sprintf(). All I have to do is move the hunks around but since I formatted the file it's appearing in the diff. v3 will be a clean diff. [1]: https://lore.kernel.org/all/?q=dfb:ethtool_sprintf%20AND%20f:justinstitt Thanks Justin
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 226a36ed5aa1..7129dd2e227c 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -1053,22 +1053,34 @@ static inline int ethtool_mm_frag_size_min_to_add(u32 val_min, u32 *val_add, */ extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...); +/** + * ethtool_puts - Write string to ethtool string data + * @data: Pointer to start of string to update + * @str: String to write + * + * Write string to data. Update data to point at start of next + * string. + * + * Prefer this function to ethtool_sprintf() when given only + * two arguments or if @fmt is just "%s". + */ +extern void ethtool_puts(u8 **data, const char *str); + /* Link mode to forced speed capabilities maps */ struct ethtool_forced_speed_map { - u32 speed; + u32 speed; __ETHTOOL_DECLARE_LINK_MODE_MASK(caps); - const u32 *cap_arr; - u32 arr_size; + const u32 *cap_arr; + u32 arr_size; }; -#define ETHTOOL_FORCED_SPEED_MAP(prefix, value) \ -{ \ - .speed = SPEED_##value, \ - .cap_arr = prefix##_##value, \ - .arr_size = ARRAY_SIZE(prefix##_##value), \ -} +#define ETHTOOL_FORCED_SPEED_MAP(prefix, value) \ + { \ + .speed = SPEED_##value, .cap_arr = prefix##_##value, \ + .arr_size = ARRAY_SIZE(prefix##_##value), \ + } -void -ethtool_forced_speed_maps_init(struct ethtool_forced_speed_map *maps, u32 size); +void ethtool_forced_speed_maps_init(struct ethtool_forced_speed_map *maps, + u32 size); #endif /* _LINUX_ETHTOOL_H */ diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 0b0ce4f81c01..abdf05edf804 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1991,6 +1991,13 @@ __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...) } EXPORT_SYMBOL(ethtool_sprintf); +void ethtool_puts(u8 **data, const char *str) +{ + strscpy(*data, str, ETH_GSTRING_LEN); + *data += ETH_GSTRING_LEN; +} +EXPORT_SYMBOL(ethtool_puts); + static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) { struct ethtool_value id;