Hi all,

The attached patch allows pktgen to produce 802.1Q and Q-in-Q tagged frames.
I have used it for stress test a bridge and seems ok to me.
Unfortunately I have no access to net-2.6.x git tree so the diff is against
2.6.17.13.
If you have a moment look over it, I think this feature could be useful for
someone else.

mini-how-to (to be added to Documentation/networking/pktgen.txt):

pgset "vlan_id 77"   # to tag frames with VID 77
pgset "svlan_id 88" # to double tag frames with SVID 88

pgset "flag VID_RND"   # use random VID values
pgset "flag SVID_RND" # use random SVID values

you can set also p and cfi bits of Tag Control Information with:
pgset "[s]vlan_p 5"
pgset "[s]vlan_cfi 1"

pgset "vlan_id 9999" # if id is > 4095 you remove tagging


BTW I might have found a couple of bugs:

1)
At line 2432 (original code in 2.6.17.13):

2431          memcpy(eth, pkt_dev->hh, 12);
2432          *(u16 *) & eth[12] = __constant_htons(ETH_P_IPV6);
//should be = protocol

IPv6 over MPLS packets get out malformed, ethernet protocol type is set to
ETH_P_IPV6 instead of ETH_P_MPLS_UC, so I've changed it the same way
it is in IPv4 case.

2)
At line:

2221          pkt_dev->seq_num++;

in fill_packet_ipv4() or at line:

2534          pkt_dev->seq_num++;

in fill_packet_ipv6() and at line 2913:

2910                  if (likely(ret == NETDEV_TX_OK)) {
2911                          pkt_dev->last_ok = 1;
2912                          pkt_dev->sofar++;
2913                          pkt_dev->seq_num++;
2914                          pkt_dev->tx_bytes += pkt_dev->cur_pkt_size;

for each packet seq_num is incremented twice, so pktgen sequence number on wire
was 1, 3, 5, 7,... if this was intentional please change my patch
because I commented
line 2221 and line 2534 out.

Thank you
Ciao
FF

Attachment: pktgen_vlan.patch
Description: Binary data

Reply via email to