From: Peter Seiderer <ps.report@gmx.net>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
Nam Cao <namcao@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Artem Chernyshev <artem.chernyshev@red-soft.ru>,
Peter Seiderer <ps.report@gmx.net>
Subject: [PATCH net-next v3 04/10] net: pktgen: fix 'rate 0' error handling (return -EINVAL)
Date: Mon, 3 Feb 2025 18:01:55 +0100 [thread overview]
Message-ID: <20250203170201.1661703-5-ps.report@gmx.net> (raw)
In-Reply-To: <20250203170201.1661703-1-ps.report@gmx.net>
Given an invalid 'rate' command e.g. 'rate 0' the return value is '1',
leading to the following misleading output:
- the good case
$ echo "rate 100" > /proc/net/pktgen/lo\@0
$ grep "Result:" /proc/net/pktgen/lo\@0
Result: OK: rate=100
- the bad case (before the patch)
$ echo "rate 0" > /proc/net/pktgen/lo\@0"
-bash: echo: write error: Invalid argument
$ grep "Result:" /proc/net/pktgen/lo\@0
Result: No such parameter "ate"
- with patch applied
$ echo "rate 0" > /proc/net/pktgen/lo\@0
-bash: echo: write error: Invalid argument
$ grep "Result:" /proc/net/pktgen/lo\@0
Result: Idle
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v2 -> v3:
- no changes
Changes v1 -> v2:
- new patch
---
net/core/pktgen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 28dbbf70e142..75c7511bf492 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1115,7 +1115,7 @@ static ssize_t pktgen_if_write(struct file *file,
i += len;
if (!value)
- return len;
+ return -EINVAL;
pkt_dev->delay = pkt_dev->min_pkt_size*8*NSEC_PER_USEC/value;
if (debug)
pr_info("Delay set at: %llu ns\n", pkt_dev->delay);
--
2.48.1
next prev parent reply other threads:[~2025-02-03 17:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 17:01 [PATCH net-next v3 00/10] Some pktgen fixes/improvments Peter Seiderer
2025-02-03 17:01 ` [PATCH net-next v3 01/10] net: pktgen: replace ENOTSUPP with EOPNOTSUPP Peter Seiderer
2025-02-04 14:42 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 02/10] net: pktgen: enable 'param=value' parsing Peter Seiderer
2025-02-04 10:55 ` Paolo Abeni
2025-02-05 13:06 ` Peter Seiderer
2025-02-03 17:01 ` [PATCH net-next v3 03/10] net: pktgen: fix hex32_arg parsing for short reads Peter Seiderer
2025-02-04 14:43 ` Simon Horman
2025-02-03 17:01 ` Peter Seiderer [this message]
2025-02-04 14:44 ` [PATCH net-next v3 04/10] net: pktgen: fix 'rate 0' error handling (return -EINVAL) Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 05/10] net: pktgen: fix 'ratep " Peter Seiderer
2025-02-04 14:44 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 06/10] net: pktgen: fix ctrl interface command parsing Peter Seiderer
2025-02-04 14:44 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 07/10] net: pktgen: fix access outside of user given buffer in pktgen_thread_write() Peter Seiderer
2025-02-04 14:45 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 08/10] net: pktgen: fix access outside of user given buffer in pktgen_if_write() Peter Seiderer
2025-02-04 10:40 ` Paolo Abeni
2025-02-05 13:09 ` Peter Seiderer
2025-02-04 10:52 ` Simon Horman
2025-02-05 13:10 ` Peter Seiderer
2025-02-03 17:02 ` [PATCH net-next v3 09/10] net: pktgen: fix mpls reset parsing Peter Seiderer
2025-02-04 14:45 ` Simon Horman
2025-02-03 17:02 ` [PATCH net-next v3 10/10] selftest: net: add proc_net_pktgen Peter Seiderer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250203170201.1661703-5-ps.report@gmx.net \
--to=ps.report@gmx.net \
--cc=artem.chernyshev@red-soft.ru \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=frederic@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox