From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out1.informatik.tu-muenchen.de (mail-out1.informatik.tu-muenchen.de [131.159.0.8]) by dpdk.org (Postfix) with ESMTP id F05AD688B for ; Tue, 9 May 2017 16:13:37 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail.net.in.tum.de (Postfix) with ESMTPSA id B9E; Tue, 9 May 2017 16:13:31 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Paul Emmerich In-Reply-To: Date: Tue, 9 May 2017 16:13:30 +0200 Cc: "Wiles, Keith" , "users@dpdk.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: To: James Bensley X-Mailer: Apple Mail (2.3124) Subject: Re: [dpdk-users] PktGen Ethertype X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 May 2017 14:13:38 -0000 Hi, I usually don't hijack threads about pktgen with an ad for my packet = generator. But I'll make an exception here (sorry) since that kind of = weird packet modification requirements was one of the main reasons for = me to build my own packet generator: https://github.com/emmericp/MoonGen MoonGen runs Lua code for each single packet that is sent out (instead = of just configuring some existing logic in C), so modifying any field is = easy. Also, all fields in commonly used protocol stacks are exposed via = sensible names and all these messy offsets are calculated automatically. You can have a look at one of the example scripts to see packet = modifications in action: = https://github.com/emmericp/MoonGen/blob/master/examples/l3-load-latency.l= ua Basically, you can add=20 pkt.eth.type =3D (network byte order) or pkt.eth:setType() (automatic byte order swap) In the main loop at line 92 where it currently modifies the IP = addresses. This is still fast because we dynamically build and compile the = necessary structs for the protocol stack. You can also receive packets to find out which ethertypes are dropped = (if any), an example of packet reception can be found in this example: = https://github.com/emmericp/MoonGen/blob/master/examples/quality-of-servic= e-test.lua#L108 By default, we use the NIC's hardware counters for rx/tx stats (another = important difference from pktgen which receives and drops packets by = default). Paul > Wiles, Keith : >=20 >>=20 >> On May 9, 2017, at 3:55 AM, James Bensley = wrote: >>=20 >> Hi All, >>=20 >> I hope this is a suitable place to ask, if not please point me at >> somewhere more appropriate. >>=20 >> I've been reading through the Pktgen docs >> (http://pktgen.readthedocs.io/en/latest/commands.html for example) = and >> I'm trying to find out if I can set the EtherType field in the layer = 2 >> headers to any value I like. I can't seem to find anything on this. >>=20 >> I want to use some Lua scripts to generate traffic with every = possible >> EtherType (from 0x0000 to 0xFFFF) and send that through a switch and >> test that all frames were received on the other side. Is there a >> function like pktgen.set_eth_type() so I can wrap it in loop? >>=20 >> // Build an entire frame then just loop over the ethertype for each = frame: >>=20 >> build_entire_frame_with_payload(); >>=20 >> for (i =3D 0; i <=3D 0xFFFF; i++) { >>=20 >> pktgen.set_eth_type(i); >> send_frame(); >> } >=20 > Yes this would be nice, but at this point pktgen is not able to do = this type of feature. > This would be a nice feature for scripting, I have not had time to add = that support :-( >=20 > The range command can allow you to adjust the type field and then send = those in a burst. The problem is pktgen was designed to send packets at = a high rate if needed and that means setting up the packets before hand. = The number of packets being able to be setup before hand is 8192. The = random command can adjust the ether type randomly for each packet with a = performance hit. Maybe one of these would help. Also I am more then = willing to take patches :-) >=20 >>=20 >> Cheers, >> James. >=20 > Regards, > Keith --=20 Chair of Network Architectures and Services Department of Informatics TU M=C3=BCnchen Boltzmannstr. 3 85748 Garching bei M=C3=BCnchen, Germany=20