Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224455
b: refs/heads/master
c: 551eaff
h: refs/heads/master
i:
  224453: a58eee0
  224451: f3dfdc0
  224447: b026b34
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 21, 2010
1 parent a361b4c commit 454e622
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 20a95a2169d1cd3da50cf65ba882d0e27a4a2d4f
refs/heads/master: 551eaff1b384cc107eab6332ba8424b3ca1f304b
17 changes: 12 additions & 5 deletions trunk/net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ struct pktgen_hdr {
__be32 tv_usec;
};

static bool pktgen_exiting __read_mostly;

struct pktgen_thread {
spinlock_t if_lock; /* for list of devices */
struct list_head if_list; /* All device here */
Expand Down Expand Up @@ -3451,11 +3453,6 @@ static void pktgen_rem_thread(struct pktgen_thread *t)

remove_proc_entry(t->tsk->comm, pg_proc_dir);

mutex_lock(&pktgen_thread_lock);

list_del(&t->th_list);

mutex_unlock(&pktgen_thread_lock);
}

static void pktgen_resched(struct pktgen_dev *pkt_dev)
Expand Down Expand Up @@ -3602,6 +3599,8 @@ static int pktgen_thread_worker(void *arg)
pkt_dev = next_to_run(t);

if (unlikely(!pkt_dev && t->control == 0)) {
if (pktgen_exiting)
break;
wait_event_interruptible_timeout(t->queue,
t->control != 0,
HZ/10);
Expand Down Expand Up @@ -3654,6 +3653,13 @@ static int pktgen_thread_worker(void *arg)
pr_debug("%s removing thread\n", t->tsk->comm);
pktgen_rem_thread(t);

/* Wait for kthread_stop */
while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
}
__set_current_state(TASK_RUNNING);

return 0;
}

Expand Down Expand Up @@ -3928,6 +3934,7 @@ static void __exit pg_cleanup(void)
struct list_head *q, *n;

/* Stop all interfaces & threads */
pktgen_exiting = true;

list_for_each_safe(q, n, &pktgen_threads) {
t = list_entry(q, struct pktgen_thread, th_list);
Expand Down

0 comments on commit 454e622

Please sign in to comment.