aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJohn Fastabend <john.r.fastabend@intel.com>2010-11-16 14:12:28 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-18 13:43:07 -0500
commit9e50e3ac5a5bbb1fd2949bdd57444ad1b93e5f41 (patch)
treec1c0e72f7f17e91109b05e6b28b6c84859664895 /net/core
parentf72f2f4cdeb67bc262d80a6d474292f00182a4dc (diff)
net: add priority field to pktgen
Add option to set skb priority to pktgen. Useful for testing QOS features. Also by running pktgen on the vlan device the qdisc on the real device can be tested. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/pktgen.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 33bc3823ac6f..52fc1e08a7c4 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -378,6 +378,7 @@ struct pktgen_dev {
378 378
379 u16 queue_map_min; 379 u16 queue_map_min;
380 u16 queue_map_max; 380 u16 queue_map_max;
381 __u32 skb_priority; /* skb priority field */
381 int node; /* Memory node */ 382 int node; /* Memory node */
382 383
383#ifdef CONFIG_XFRM 384#ifdef CONFIG_XFRM
@@ -547,6 +548,10 @@ static int pktgen_if_show(struct seq_file *seq, void *v)
547 pkt_dev->queue_map_min, 548 pkt_dev->queue_map_min,
548 pkt_dev->queue_map_max); 549 pkt_dev->queue_map_max);
549 550
551 if (pkt_dev->skb_priority)
552 seq_printf(seq, " skb_priority: %u\n",
553 pkt_dev->skb_priority);
554
550 if (pkt_dev->flags & F_IPV6) { 555 if (pkt_dev->flags & F_IPV6) {
551 char b1[128], b2[128], b3[128]; 556 char b1[128], b2[128], b3[128];
552 fmt_ip6(b1, pkt_dev->in6_saddr.s6_addr); 557 fmt_ip6(b1, pkt_dev->in6_saddr.s6_addr);
@@ -1711,6 +1716,18 @@ static ssize_t pktgen_if_write(struct file *file,
1711 return count; 1716 return count;
1712 } 1717 }
1713 1718
1719 if (!strcmp(name, "skb_priority")) {
1720 len = num_arg(&user_buffer[i], 9, &value);
1721 if (len < 0)
1722 return len;
1723
1724 i += len;
1725 pkt_dev->skb_priority = value;
1726 sprintf(pg_result, "OK: skb_priority=%i",
1727 pkt_dev->skb_priority);
1728 return count;
1729 }
1730
1714 sprintf(pkt_dev->result, "No such parameter \"%s\"", name); 1731 sprintf(pkt_dev->result, "No such parameter \"%s\"", name);
1715 return -EINVAL; 1732 return -EINVAL;
1716} 1733}
@@ -2671,6 +2688,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
2671 skb->transport_header = skb->network_header + sizeof(struct iphdr); 2688 skb->transport_header = skb->network_header + sizeof(struct iphdr);
2672 skb_put(skb, sizeof(struct iphdr) + sizeof(struct udphdr)); 2689 skb_put(skb, sizeof(struct iphdr) + sizeof(struct udphdr));
2673 skb_set_queue_mapping(skb, queue_map); 2690 skb_set_queue_mapping(skb, queue_map);
2691 skb->priority = pkt_dev->skb_priority;
2692
2674 iph = ip_hdr(skb); 2693 iph = ip_hdr(skb);
2675 udph = udp_hdr(skb); 2694 udph = udp_hdr(skb);
2676 2695
@@ -3016,6 +3035,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
3016 skb->transport_header = skb->network_header + sizeof(struct ipv6hdr); 3035 skb->transport_header = skb->network_header + sizeof(struct ipv6hdr);
3017 skb_put(skb, sizeof(struct ipv6hdr) + sizeof(struct udphdr)); 3036 skb_put(skb, sizeof(struct ipv6hdr) + sizeof(struct udphdr));
3018 skb_set_queue_mapping(skb, queue_map); 3037 skb_set_queue_mapping(skb, queue_map);
3038 skb->priority = pkt_dev->skb_priority;
3019 iph = ipv6_hdr(skb); 3039 iph = ipv6_hdr(skb);
3020 udph = udp_hdr(skb); 3040 udph = udp_hdr(skb);
3021 3041