Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp757711rdh; Thu, 26 Oct 2023 15:11:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3REzifZsS2JQ2EupHvX4SVoxxl29fBsCkcsDMxfMuzb1qeFozbtjdC5xBS9QpA9Z3e6Ts X-Received: by 2002:a05:6870:6ec8:b0:1e9:64f1:9c30 with SMTP id qv8-20020a0568706ec800b001e964f19c30mr1111087oab.18.1698358288745; Thu, 26 Oct 2023 15:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698358288; cv=none; d=google.com; s=arc-20160816; b=X9bgo9ETy30+rxM0JL6tfzatHjwGQpsezpFQkspDzVyO9237dAigLl66Bnh2VBgrVr 6AUOmfzQ6UQhiIQV+2sxwrjnvrAovF7PUQY7vyduhtArrksM86hbzue27n3e7ENz+x5p yq7582c2PghgC0hUCSUy8sPIHxzq8VU9l4JtAcwo7Pj9Sf8jsZXEQdO5CyF92oColcpq AMVroVnOn7rTTSIB+eRb/l+GrMnAk3ZTOT+lH3wb3HoOCLtVxtZ6LoOCJ936cbUpR4Xk o8jhwP0V4EECyjtXJJuvAYLNVGYdCuAGDj0ihUY+/lSfALC0WGbj00N8w5eKZ3FtyaKO eybA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VYkYcPfrdjdF13EUZZ4eE7TIV+DAr//+SL8WC077uOs=; fh=E+O6lB+WksfCgT0P8JRY9LGebRJ8IEjJgrBLhq6dx78=; b=oQkOESEDeKPbmJV/b7lyRL/NXlDR4+pvtaIl9FUu7xF4Ei6hTzzW5MOkW8YTkA/hWR QC+xSWBdI24452JulvWJPGJON73k9u8aqATfw827Kwjs/W8u58aW2krWA8B4gomfnG63 FwQtoPo/veQ6AisPqZWbbLf99pF509MEDJL3M0soeBEFL8NLb2ujUHlpLCrlEQlRqf/c FDf4lU+8Fs9wIvHOaLhIs+meaZZK/OhEWmWYcss7BJKH19idnMguFo+CFspibPefaRw4 ZyebLRf0EqUiaq054UHgdwm+9dj3v5RGS7aA5fm2Kh9typ9IvzWvRJgbkAPycpziKdFt LW+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=J2j7S08R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id f4-20020a256a04000000b00d9a49bac80dsi539572ybc.53.2023.10.26.15.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 15:11:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=J2j7S08R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 092A28078290; Thu, 26 Oct 2023 15:10:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344897AbjJZWKS (ORCPT + 99 others); Thu, 26 Oct 2023 18:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjJZWKR (ORCPT ); Thu, 26 Oct 2023 18:10:17 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB397CC for ; Thu, 26 Oct 2023 15:10:13 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-53fc7c67a41so5341039a12.0 for ; Thu, 26 Oct 2023 15:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698358212; x=1698963012; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VYkYcPfrdjdF13EUZZ4eE7TIV+DAr//+SL8WC077uOs=; b=J2j7S08RIHdtE5P9LPqWSBmyk4JHy8o0zMHOmCUxJ6ex6gtuzLsOyVnrMcjETdt2my aMWugK8ndDJSbiDSwZtZ3UHf6hLc21mR0kfIJuWsP843otfXTHdMtPWVB6DWEjF6jAvo dKb3bUr/D9d6/CjNzhGa/2kFkg3of1YD3rpsViEouTud9mlyJvZ3egsu134wJnAZppla PH8df/P9K4J6HSuJTPKBgIeEii29VDLq4gtZszfRO4HAaXEjs2qNvKIgcvf0et/1iWR1 Bhdr9p+K04toNFsaZlhw0lxk8QKmA/g/C7wE5qjar9deQc6EsbiVR7ymUK4MJTqE8RUL A3+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698358212; x=1698963012; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VYkYcPfrdjdF13EUZZ4eE7TIV+DAr//+SL8WC077uOs=; b=w2e3MbR75fIGcta2b1BD19EeMVyxEffdIBr2GINfYhRf/QI4MjAhqE5EXc5DUfYIt9 wvaRiBgl/m8adtCoXFy90XhzvO/emgt79eNMmZrdUJbKQIjFFTr1MZtIK+LS82nAcr8u JZ0N5lc8Ghqtz70DJoNWo4JwclgC3MfMGFtxgwje2Q5XL4euDMqd59+bfRt0RVZMmG3M V8T7/doZUSviUKJyF9cLRSzkmRmz+G53+GKmudVzqrt8y7hPfBBnchxWNUiIa5/ZbPt4 sGQDpkORdV727k5ZXvfGnpDkrB6ym0E0Je/nTmUBGWE5fUC7plMlcHNGZtmkoec5G8GV DKTg== X-Gm-Message-State: AOJu0YzHsZhvIHf7rYnCNQcr2iowa5JVa/Dvqe3dUCGP6FIXxVjp1JVH 32s9OdQUBgDgB0I3yejdppEOg1q+v7N+xd+w2pz2jg== X-Received: by 2002:a50:fa83:0:b0:52a:38c3:1b4b with SMTP id w3-20020a50fa83000000b0052a38c31b4bmr1216507edr.15.1698358211957; Thu, 26 Oct 2023 15:10:11 -0700 (PDT) MIME-Version: 1.0 References: <20231026-ethtool_puts_impl-v2-0-0d67cbdd0538@google.com> <20231026-ethtool_puts_impl-v2-1-0d67cbdd0538@google.com> <20231026220248.blgf7kgt5fkkbg7f@skbuf> In-Reply-To: <20231026220248.blgf7kgt5fkkbg7f@skbuf> From: Justin Stitt Date: Thu, 26 Oct 2023 15:09:59 -0700 Message-ID: Subject: Re: [PATCH next v2 1/3] ethtool: Implement ethtool_puts() To: Vladimir Oltean Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shay Agroskin , Arthur Kiyanovski , David Arinzon , Noam Dagan , Saeed Bishara , Rasesh Mody , Sudarsana Kalluru , GR-Linux-NIC-Dev@marvell.com, Dimitris Michailidis , Yisen Zhuang , Salil Mehta , Jesse Brandeburg , Tony Nguyen , Louis Peens , Shannon Nelson , Brett Creeley , drivers@pensando.io, "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Ronak Doshi , VMware PV-Drivers Reviewers , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Hauke Mehrtens , Andrew Lunn , Florian Fainelli , =?UTF-8?B?QXLEsW7DpyDDnE5BTA==?= , Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Linus Walleij , =?UTF-8?Q?Alvin_=C5=A0ipraga?= , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , Lars Povlsen , Steen Hegelund , Daniel Machon , UNGLinuxDriver@microchip.com, Jiawen Wu , Mengyuan Lou , Heiner Kallweit , Russell King , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Nick Desaulniers , Nathan Chancellor , Kees Cook , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 26 Oct 2023 15:10:26 -0700 (PDT) On Thu, Oct 26, 2023 at 3:02=E2=80=AFPM Vladimir Oltean = 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 > > --- > > 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_a= dd(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 =3D SPEED_##value, = \ > > - .cap_arr =3D prefix##_##value, = \ > > - .arr_size =3D ARRAY_SIZE(prefix##_##value), = \ > > -} > > +#define ETHTOOL_FORCED_SPEED_MAP(prefix, value) \ > > + { \ > > + .speed =3D SPEED_##value, .cap_arr =3D prefix##_##value, = \ > > + .arr_size =3D 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 *m= aps, > > + 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