kernel: backport ethtool_puts
authorRosen Penev <[email protected]>
Sun, 17 Dec 2023 01:12:33 +0000 (17:12 -0800)
committerChristian Marangi <[email protected]>
Fri, 5 Jan 2024 15:12:46 +0000 (16:12 +0100)
Will be used for conversions in the following commit.

Signed-off-by: Rosen Penev <[email protected]>
target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch [new file with mode: 0644]
target/linux/generic/backport-6.1/894-v6.8-net-ethtool-implement-ethtool_puts.patch [new file with mode: 0644]

diff --git a/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch b/target/linux/generic/backport-5.15/894-v6.8-net-ethtool-implement-ethtool_puts.patch
new file mode 100644 (file)
index 0000000..ef9e706
--- /dev/null
@@ -0,0 +1,139 @@
+From mboxrd@z Thu Jan  1 00:00:00 1970
+Authentication-Results: smtp.subspace.kernel.org;
+       dkim=pass (2048-bit key) header.d=google.com [email protected] header.b="sMUeie/T"
+Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49])
+       by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BB8D6D
+       for <[email protected]>; Wed,  6 Dec 2023 15:16:16 -0800 (PST)
+Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db5416d0fccso403298276.1
+        for <[email protected]>; Wed, 06 Dec 2023 15:16:16 -0800 (PST)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=google.com; s=20230601; t=1701904575; x=1702509375; 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=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=;
+        b=sMUeie/TxdytzC0EyT11QWi1TqTtiv7KCTs1F2vLmUUvPKNA3+1MHFo8ECW+0gQuDE
+         FGrgdZKGK5mXQgkF0N3JiSLvKO8tpQOIB57JLCG5IVy5dr2vVv0ExU3Dag2Cc4oBIBIO
+         w/cH95O1oPlvluIpATmAsxenVr7mFomU63BqYiRGLaEhWeb2hJ636GO8lubtsDfdFFoi
+         GPOL2tQwV93VnqmywBBpFaNAULN0UoCFhfkKv5prvpkXq19sWI7zyorVZ+rdTYem5m4T
+         dXsDaLXPtC3Dh2JOad1duSQIah/wCHYYUcV3IoFhwj2y0Uk/TTCrnZPORweSADcEy6Ho
+         vDrA==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=1e100.net; s=20230601; t=1701904575; x=1702509375;
+        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=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=;
+        b=Dmc6aSntxPlxAk72zVO1G9WoZnFtLolxENlLscYYAHG3VE+PQ8gGN2rPzcGoKb2Btb
+         4b0PvjOzSlPQyghahdhdlz04RtAeeGG/MkfNiYjFql5OifIoovb51kroiPYrVsa7Ps7Y
+         +Pxug0+NPdTm5s9TNz940ZKl3GRME8UTmVxpWJRX03XMOqb6Wgsh2SK9ahXKc4yRsi62
+         3a3J72WmmSgvimxwM/99fXwvoUQpiv2J1xCoqc1Ng4q4qSuZvzmHN7ZTGaUhLxOqLeLK
+         3W4RKHW6rZ7UjppuB6I3NXW+D344By2rdKp1sRXpjdQ0GS3YUcvlRETcJBXJudHfQP5Y
+         CLOw==
+X-Gm-Message-State: AOJu0YzdCTLdwny+N99zeMgyKqFsEZhfIhL2cbgKA6zC1U/OLkxxRLoM
+       XrYVBC9DmxCGmP4o+M/Z/kHUew/9faHlCiLGxw==
+X-Google-Smtp-Source: AGHT+IFRXxBV6JuX5Cl/k2o1+WKkCwkR8j20MJSkmoGCedPAtqFttH8OVh1/6vdfnq8MPN++A2h89peZQhyG8OsJ8A==
+X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5])
+ (user=justinstitt job=sendgmr) by 2002:a25:dac7:0:b0:da0:3117:f35 with SMTP
+ id n190-20020a25dac7000000b00da031170f35mr28652ybf.3.1701904575576; Wed, 06
+ Dec 2023 15:16:15 -0800 (PST)
+Date: Wed, 06 Dec 2023 23:16:10 +0000
+In-Reply-To: <[email protected]>
+Precedence: bulk
+X-Mailing-List: [email protected]
+List-Id: <bpf.vger.kernel.org>
+List-Subscribe: <mailto:[email protected]>
+List-Unsubscribe: <mailto:[email protected]>
+Mime-Version: 1.0
+References: <[email protected]>
+X-Developer-Key: [email protected]; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE=
+X-Developer-Signature: v=1; a=ed25519-sha256; t=1701904573; l=1840;
[email protected]; s=20230717; h=from:subject:message-id;
+ bh=UMdetIL2ZsPIkSodqhw2fM21NHJVjCu0lRImFuNhVoM=; b=a8rMnXfVVQ5gsxHWG4WRMwOLxZgflqXZtNuKx26vv4DwYvvCtCiYjl3f1frOjV/Ul2kaxq5g/
+ b/UOv678JKCDASVokxG5GJifAnU7/kqRxdhcwfRkrD8RUfcsmiZOfyF
+X-Mailer: b4 0.12.3
+Message-ID: <[email protected]>
+Subject: [PATCH net-next v5 1/3] ethtool: Implement ethtool_puts()
+To: "David S. Miller" <[email protected]>, Eric Dumazet <[email protected]>, 
+       Jakub Kicinski <[email protected]>, Paolo Abeni <[email protected]>, Shay Agroskin <[email protected]>, 
+       Arthur Kiyanovski <[email protected]>, David Arinzon <[email protected]>, Noam Dagan <[email protected]>, 
+       Saeed Bishara <[email protected]>, Rasesh Mody <[email protected]>, 
+       Sudarsana Kalluru <[email protected]>, [email protected]
+       Dimitris Michailidis <[email protected]>, Yisen Zhuang <[email protected]>, 
+       Salil Mehta <[email protected]>, Jesse Brandeburg <[email protected]>, 
+       Tony Nguyen <[email protected]>, Louis Peens <[email protected]>, 
+       Shannon Nelson <[email protected]>, Brett Creeley <[email protected]>, [email protected]
+       "K. Y. Srinivasan" <[email protected]>, Haiyang Zhang <[email protected]>, Wei Liu <[email protected]>, 
+       Dexuan Cui <[email protected]>, Ronak Doshi <[email protected]>, 
+       VMware PV-Drivers Reviewers <[email protected]>, Andy Whitcroft <[email protected]>, Joe Perches <[email protected]>, 
+       Dwaipayan Ray <[email protected]>, Lukas Bulwahn <[email protected]>, 
+       Hauke Mehrtens <[email protected]>, Andrew Lunn <[email protected]>, 
+       Florian Fainelli <[email protected]>, Vladimir Oltean <[email protected]>, 
+       "=?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?=" <[email protected]>, Daniel Golle <[email protected]>, 
+       Landen Chao <[email protected]>, DENG Qingfang <[email protected]>, 
+       Sean Wang <[email protected]>, Matthias Brugger <[email protected]>, 
+       AngeloGioacchino Del Regno <[email protected]>, 
+       Linus Walleij <[email protected]>, 
+       "=?utf-8?q?Alvin_=C5=A0ipraga?=" <[email protected]>, Wei Fang <[email protected]>, 
+       Shenwei Wang <[email protected]>, Clark Wang <[email protected]>, 
+       NXP Linux Team <[email protected]>, Lars Povlsen <[email protected]>, 
+       Steen Hegelund <[email protected]>, Daniel Machon <[email protected]>, 
+       [email protected], Jiawen Wu <[email protected]>, 
+       Mengyuan Lou <[email protected]>, Heiner Kallweit <[email protected]>, 
+       Russell King <[email protected]>, Alexei Starovoitov <[email protected]>, 
+       Daniel Borkmann <[email protected]>, Jesper Dangaard Brouer <[email protected]>, 
+       John Fastabend <[email protected]>
+       Nick Desaulniers <[email protected]>, Nathan Chancellor <[email protected]>, 
+       Kees Cook <[email protected]>, [email protected]
+       [email protected], Justin Stitt <[email protected]>
+Content-Type: text/plain; charset="utf-8"
+
+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 <[email protected]>
+---
+ include/linux/ethtool.h | 13 +++++++++++++
+ net/ethtool/ioctl.c     |  7 +++++++
+ 2 files changed, 20 insertions(+)
+
+--- a/include/linux/ethtool.h
++++ b/include/linux/ethtool.h
+@@ -788,4 +788,17 @@ int ethtool_get_phc_vclocks(struct net_d
+  * next string.
+  */
+ extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...);
++
++/**
++ * ethtool_puts - Write string to ethtool string data
++ * @data: Pointer to a pointer to the start of string to update
++ * @str: String to write
++ *
++ * Write string to *data without a trailing newline. 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);
+ #endif /* _LINUX_ETHTOOL_H */
+--- a/net/ethtool/ioctl.c
++++ b/net/ethtool/ioctl.c
+@@ -1953,6 +1953,13 @@ __printf(2, 3) void ethtool_sprintf(u8 *
+ }
+ 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;
diff --git a/target/linux/generic/backport-6.1/894-v6.8-net-ethtool-implement-ethtool_puts.patch b/target/linux/generic/backport-6.1/894-v6.8-net-ethtool-implement-ethtool_puts.patch
new file mode 100644 (file)
index 0000000..5094a6d
--- /dev/null
@@ -0,0 +1,139 @@
+From mboxrd@z Thu Jan  1 00:00:00 1970
+Authentication-Results: smtp.subspace.kernel.org;
+       dkim=pass (2048-bit key) header.d=google.com [email protected] header.b="sMUeie/T"
+Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49])
+       by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BB8D6D
+       for <[email protected]>; Wed,  6 Dec 2023 15:16:16 -0800 (PST)
+Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db5416d0fccso403298276.1
+        for <[email protected]>; Wed, 06 Dec 2023 15:16:16 -0800 (PST)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=google.com; s=20230601; t=1701904575; x=1702509375; 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=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=;
+        b=sMUeie/TxdytzC0EyT11QWi1TqTtiv7KCTs1F2vLmUUvPKNA3+1MHFo8ECW+0gQuDE
+         FGrgdZKGK5mXQgkF0N3JiSLvKO8tpQOIB57JLCG5IVy5dr2vVv0ExU3Dag2Cc4oBIBIO
+         w/cH95O1oPlvluIpATmAsxenVr7mFomU63BqYiRGLaEhWeb2hJ636GO8lubtsDfdFFoi
+         GPOL2tQwV93VnqmywBBpFaNAULN0UoCFhfkKv5prvpkXq19sWI7zyorVZ+rdTYem5m4T
+         dXsDaLXPtC3Dh2JOad1duSQIah/wCHYYUcV3IoFhwj2y0Uk/TTCrnZPORweSADcEy6Ho
+         vDrA==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=1e100.net; s=20230601; t=1701904575; x=1702509375;
+        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=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=;
+        b=Dmc6aSntxPlxAk72zVO1G9WoZnFtLolxENlLscYYAHG3VE+PQ8gGN2rPzcGoKb2Btb
+         4b0PvjOzSlPQyghahdhdlz04RtAeeGG/MkfNiYjFql5OifIoovb51kroiPYrVsa7Ps7Y
+         +Pxug0+NPdTm5s9TNz940ZKl3GRME8UTmVxpWJRX03XMOqb6Wgsh2SK9ahXKc4yRsi62
+         3a3J72WmmSgvimxwM/99fXwvoUQpiv2J1xCoqc1Ng4q4qSuZvzmHN7ZTGaUhLxOqLeLK
+         3W4RKHW6rZ7UjppuB6I3NXW+D344By2rdKp1sRXpjdQ0GS3YUcvlRETcJBXJudHfQP5Y
+         CLOw==
+X-Gm-Message-State: AOJu0YzdCTLdwny+N99zeMgyKqFsEZhfIhL2cbgKA6zC1U/OLkxxRLoM
+       XrYVBC9DmxCGmP4o+M/Z/kHUew/9faHlCiLGxw==
+X-Google-Smtp-Source: AGHT+IFRXxBV6JuX5Cl/k2o1+WKkCwkR8j20MJSkmoGCedPAtqFttH8OVh1/6vdfnq8MPN++A2h89peZQhyG8OsJ8A==
+X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5])
+ (user=justinstitt job=sendgmr) by 2002:a25:dac7:0:b0:da0:3117:f35 with SMTP
+ id n190-20020a25dac7000000b00da031170f35mr28652ybf.3.1701904575576; Wed, 06
+ Dec 2023 15:16:15 -0800 (PST)
+Date: Wed, 06 Dec 2023 23:16:10 +0000
+In-Reply-To: <[email protected]>
+Precedence: bulk
+X-Mailing-List: [email protected]
+List-Id: <bpf.vger.kernel.org>
+List-Subscribe: <mailto:[email protected]>
+List-Unsubscribe: <mailto:[email protected]>
+Mime-Version: 1.0
+References: <[email protected]>
+X-Developer-Key: [email protected]; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE=
+X-Developer-Signature: v=1; a=ed25519-sha256; t=1701904573; l=1840;
[email protected]; s=20230717; h=from:subject:message-id;
+ bh=UMdetIL2ZsPIkSodqhw2fM21NHJVjCu0lRImFuNhVoM=; b=a8rMnXfVVQ5gsxHWG4WRMwOLxZgflqXZtNuKx26vv4DwYvvCtCiYjl3f1frOjV/Ul2kaxq5g/
+ b/UOv678JKCDASVokxG5GJifAnU7/kqRxdhcwfRkrD8RUfcsmiZOfyF
+X-Mailer: b4 0.12.3
+Message-ID: <[email protected]>
+Subject: [PATCH net-next v5 1/3] ethtool: Implement ethtool_puts()
+To: "David S. Miller" <[email protected]>, Eric Dumazet <[email protected]>, 
+       Jakub Kicinski <[email protected]>, Paolo Abeni <[email protected]>, Shay Agroskin <[email protected]>, 
+       Arthur Kiyanovski <[email protected]>, David Arinzon <[email protected]>, Noam Dagan <[email protected]>, 
+       Saeed Bishara <[email protected]>, Rasesh Mody <[email protected]>, 
+       Sudarsana Kalluru <[email protected]>, [email protected]
+       Dimitris Michailidis <[email protected]>, Yisen Zhuang <[email protected]>, 
+       Salil Mehta <[email protected]>, Jesse Brandeburg <[email protected]>, 
+       Tony Nguyen <[email protected]>, Louis Peens <[email protected]>, 
+       Shannon Nelson <[email protected]>, Brett Creeley <[email protected]>, [email protected]
+       "K. Y. Srinivasan" <[email protected]>, Haiyang Zhang <[email protected]>, Wei Liu <[email protected]>, 
+       Dexuan Cui <[email protected]>, Ronak Doshi <[email protected]>, 
+       VMware PV-Drivers Reviewers <[email protected]>, Andy Whitcroft <[email protected]>, Joe Perches <[email protected]>, 
+       Dwaipayan Ray <[email protected]>, Lukas Bulwahn <[email protected]>, 
+       Hauke Mehrtens <[email protected]>, Andrew Lunn <[email protected]>, 
+       Florian Fainelli <[email protected]>, Vladimir Oltean <[email protected]>, 
+       "=?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?=" <[email protected]>, Daniel Golle <[email protected]>, 
+       Landen Chao <[email protected]>, DENG Qingfang <[email protected]>, 
+       Sean Wang <[email protected]>, Matthias Brugger <[email protected]>, 
+       AngeloGioacchino Del Regno <[email protected]>, 
+       Linus Walleij <[email protected]>, 
+       "=?utf-8?q?Alvin_=C5=A0ipraga?=" <[email protected]>, Wei Fang <[email protected]>, 
+       Shenwei Wang <[email protected]>, Clark Wang <[email protected]>, 
+       NXP Linux Team <[email protected]>, Lars Povlsen <[email protected]>, 
+       Steen Hegelund <[email protected]>, Daniel Machon <[email protected]>, 
+       [email protected], Jiawen Wu <[email protected]>, 
+       Mengyuan Lou <[email protected]>, Heiner Kallweit <[email protected]>, 
+       Russell King <[email protected]>, Alexei Starovoitov <[email protected]>, 
+       Daniel Borkmann <[email protected]>, Jesper Dangaard Brouer <[email protected]>, 
+       John Fastabend <[email protected]>
+       Nick Desaulniers <[email protected]>, Nathan Chancellor <[email protected]>, 
+       Kees Cook <[email protected]>, [email protected]
+       [email protected], Justin Stitt <[email protected]>
+Content-Type: text/plain; charset="utf-8"
+
+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 <[email protected]>
+---
+ include/linux/ethtool.h | 13 +++++++++++++
+ net/ethtool/ioctl.c     |  7 +++++++
+ 2 files changed, 20 insertions(+)
+
+--- a/include/linux/ethtool.h
++++ b/include/linux/ethtool.h
+@@ -843,4 +843,17 @@ int ethtool_get_phc_vclocks(struct net_d
+  * next string.
+  */
+ extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...);
++
++/**
++ * ethtool_puts - Write string to ethtool string data
++ * @data: Pointer to a pointer to the start of string to update
++ * @str: String to write
++ *
++ * Write string to *data without a trailing newline. 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);
+ #endif /* _LINUX_ETHTOOL_H */
+--- a/net/ethtool/ioctl.c
++++ b/net/ethtool/ioctl.c
+@@ -1974,6 +1974,13 @@ __printf(2, 3) void ethtool_sprintf(u8 *
+ }
+ 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;