Robert Olsson wrote:
Simon Kirby writes:

 > Just tried to do some benchmarks for outgoing packet rates with the
 > e1000 and tg3.  When I tried some vlan tagging with pktgen, it blew
 > up immediately:
Hello!

 No pktgen has no support vlan as-is .Guess there should be some config
option to select vlan and enable it and fill vlan header in the packet. If you're motivated give it a try.

VLAN devices will add the header for you...pktgen should work with
no modification.

It will work *best* if you use my patch to give stack feedback so
that pktgen + vlan doesn't drop so many pkts on transmit.

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -1,4 +1,4 @@
-/*
+/* -*- linux-c -*-
  * INET                802.1Q VLAN
  *             Ethernet-type device handling.
  *
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -438,6 +438,11 @@ int vlan_dev_hard_start_xmit(struct sk_b
        struct net_device_stats *stats = vlan_dev_get_stats(dev);
        struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);

+       /* Please note, dev_queue_xmit consumes the pkt regardless of the
+        * return value.  So, will copy the skb first and free if successful.
+        */
+       struct sk_buff* skb2 = skb_get(skb);
+
        /* Handle non-VLAN frames if they are sent to us, for example by DHCP.
         *
         * NOTE: THIS ASSUMES DIX ETHERNET, SPECIFICALLY NOT SUPPORTING
@@ -467,6 +472,10 @@ int vlan_dev_hard_start_xmit(struct sk_b
                skb = __vlan_put_tag(skb, veth_TCI);
                if (!skb) {
                        stats->tx_dropped++;
+                       /* Free the extra copy, assuming this is a 
non-recoverable
+                        * issue and we don't want calling code to retry.
+                        */
+                       kfree_skb(skb2);
                        return 0;
                }

@@ -484,13 +493,24 @@ int vlan_dev_hard_start_xmit(struct sk_b
               veth->h_vlan_proto, veth->h_vlan_TCI, 
veth->h_vlan_encapsulated_proto);
 #endif

-       stats->tx_packets++; /* for statics only */
-       stats->tx_bytes += skb->len;
-
        skb->dev = VLAN_DEV_INFO(dev)->real_dev;
-       dev_queue_xmit(skb);

-       return 0;
+       {
+               int rv = dev_queue_xmit(skb);
+               if (rv == 0) {
+                       /* Was success, need to free the skb reference since
+                        * we bumped up the user count above.  If there was an
+                        * error instead, then the skb2 will not be freed, and 
so
+                        * the calling code will be able to re-send it.
+                        */
+
+                       stats->tx_packets++; /* for statics only */
+                       stats->tx_bytes += skb2->len;
+
+                       kfree_skb(skb2);
+               }
+               return rv;
+       }
 }

 int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device 
*dev)


Thanks,
Ben

--
Ben Greear <[EMAIL PROTECTED]>
Candela Technologies Inc  http://www.candelatech.com

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to