summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/pktgen.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 31c20a25b301..689db7d8df9b 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -148,7 +148,7 @@
#include <asm/timex.h>
-#define VERSION "pktgen v2.54: Packet Generator for packet performance testing.\n"
+#define VERSION "pktgen v2.56: Packet Generator for packet performance testing.\n"
/* #define PG_DEBUG(a) a */
#define PG_DEBUG(a)
@@ -167,9 +167,6 @@
#define F_TXSIZE_RND (1<<6) /* Transmit size is random */
#define F_IPV6 (1<<7) /* Interface in IPV6 Mode */
-#define L_PUSH(t, i) {i->next = t; t=i;}
-#define L_POP(t, i) {i=t; if(i) t = i->next;}
-
/* Thread control flag bits */
#define T_TERMINATE (1<<0)
#define T_STOP (1<<1) /* Stop run */
@@ -1366,19 +1363,15 @@ static int proc_thread_read(char *buf , char **start, off_t offset,
p += sprintf(p, "Running: ");
if_lock(t);
- pkt_dev = t->if_list;
- while (pkt_dev && pkt_dev->running) {
- p += sprintf(p, "%s ", pkt_dev->ifname);
- pkt_dev = pkt_dev->next;
- }
+ for(pkt_dev = t->if_list;pkt_dev; pkt_dev = pkt_dev->next)
+ if(pkt_dev->running)
+ p += sprintf(p, "%s ", pkt_dev->ifname);
+
p += sprintf(p, "\nStopped: ");
- pkt_dev = t->if_list;
- while (pkt_dev && !pkt_dev->running) {
- p += sprintf(p, "%s ", pkt_dev->ifname);
- pkt_dev = pkt_dev->next;
- }
-
+ for(pkt_dev = t->if_list;pkt_dev; pkt_dev = pkt_dev->next)
+ if(!pkt_dev->running)
+ p += sprintf(p, "%s ", pkt_dev->ifname);
if (t->result[0])
p += sprintf(p, "\nResult: %s\n", t->result);
@@ -2393,7 +2386,7 @@ static void pktgen_stop_all_threads_ifs(void)
thread_unlock();
}
-static int running(struct pktgen_thread *t )
+static int thread_is_running(struct pktgen_thread *t )
{
struct pktgen_dev *next;
int res = 0;
@@ -2415,7 +2408,7 @@ static int pktgen_wait_thread_run(struct pktgen_thread *t )
if_lock(t);
- while(running(t)) {
+ while(thread_is_running(t)) {
if_unlock(t);
interruptible_sleep_on_timeout(&queue, HZ/10);
@@ -2520,13 +2513,15 @@ static int pktgen_stop_device(struct pktgen_dev *pkt_dev)
return -EINVAL;
}
- if (pkt_dev->skb)
- kfree_skb(pkt_dev->skb);
-
pkt_dev->stopped_at = getCurUs();
pkt_dev->running = 0;
show_results(pkt_dev, skb_shinfo(pkt_dev->skb)->nr_frags);
+
+ if (pkt_dev->skb)
+ kfree_skb(pkt_dev->skb);
+
+ pkt_dev->skb = NULL;
return 0;
}
@@ -2860,10 +2855,10 @@ static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, const char* i
for(pkt_dev=t->if_list; pkt_dev; pkt_dev = pkt_dev->next ) {
if (strcmp(pkt_dev->ifname, ifname) == 0) {
- goto out;
+ break;
}
}
- out:
+
if_unlock(t);
PG_DEBUG(printk("pktgen: find_dev(%s) returning %p\n", ifname,pkt_dev));
return pkt_dev;
@@ -2884,8 +2879,7 @@ static int add_dev_to_thread(struct pktgen_thread *t, struct pktgen_dev *pkt_dev
rv = -EBUSY;
goto out;
}
-
- L_PUSH(t->if_list, pkt_dev);
+ pkt_dev->next =t->if_list; t->if_list=pkt_dev;
pkt_dev->pg_thread = t;
pkt_dev->running = 0;