netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] pktgen: Allow on loopback device
@ 2020-03-10 10:49 Lukas Wunner
  2020-03-10 22:45 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wunner @ 2020-03-10 10:49 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Florian Westphal, Pablo Neira Ayuso, Daniel Borkmann,
	Dmitry Safonov, Thomas Graf, Alexei Starovoitov

When pktgen is used to measure the performance of dev_queue_xmit()
packet handling in the core, it is preferable to not hand down
packets to a low-level Ethernet driver as it would distort the
measurements.

Allow using pktgen on the loopback device, thus constraining
measurements to core code.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 net/core/pktgen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index acc849df60b5..f2b3d8dd40f4 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2003,8 +2003,8 @@ static int pktgen_setup_dev(const struct pktgen_net *pn,
 		return -ENODEV;
 	}
 
-	if (odev->type != ARPHRD_ETHER) {
-		pr_err("not an ethernet device: \"%s\"\n", ifname);
+	if (odev->type != ARPHRD_ETHER && odev->type != ARPHRD_LOOPBACK) {
+		pr_err("not an ethernet or loopback device: \"%s\"\n", ifname);
 		err = -EINVAL;
 	} else if (!netif_running(odev)) {
 		pr_err("device is down: \"%s\"\n", ifname);
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] pktgen: Allow on loopback device
  2020-03-10 10:49 [PATCH net-next] pktgen: Allow on loopback device Lukas Wunner
@ 2020-03-10 22:45 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-03-10 22:45 UTC (permalink / raw)
  To: lukas; +Cc: kuba, netdev, fw, pablo, daniel, 0x7f454c46, tgraf, ast

From: Lukas Wunner <lukas@wunner.de>
Date: Tue, 10 Mar 2020 11:49:46 +0100

> When pktgen is used to measure the performance of dev_queue_xmit()
> packet handling in the core, it is preferable to not hand down
> packets to a low-level Ethernet driver as it would distort the
> measurements.
> 
> Allow using pktgen on the loopback device, thus constraining
> measurements to core code.
> 
> Signed-off-by: Lukas Wunner <lukas@wunner.de>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-10 22:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 10:49 [PATCH net-next] pktgen: Allow on loopback device Lukas Wunner
2020-03-10 22:45 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).