Commit 648fda74 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

pktgen: minor cleanup

A couple of minor functions can be written more compactly.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39aa8165
...@@ -509,7 +509,7 @@ static const struct file_operations pktgen_fops = { ...@@ -509,7 +509,7 @@ static const struct file_operations pktgen_fops = {
static int pktgen_if_show(struct seq_file *seq, void *v) static int pktgen_if_show(struct seq_file *seq, void *v)
{ {
struct pktgen_dev *pkt_dev = seq->private; const struct pktgen_dev *pkt_dev = seq->private;
__u64 sa; __u64 sa;
__u64 stopped; __u64 stopped;
__u64 now = getCurUs(); __u64 now = getCurUs();
...@@ -1670,7 +1670,7 @@ static const struct file_operations pktgen_if_fops = { ...@@ -1670,7 +1670,7 @@ static const struct file_operations pktgen_if_fops = {
static int pktgen_thread_show(struct seq_file *seq, void *v) static int pktgen_thread_show(struct seq_file *seq, void *v)
{ {
struct pktgen_thread *t = seq->private; struct pktgen_thread *t = seq->private;
struct pktgen_dev *pkt_dev; const struct pktgen_dev *pkt_dev;
BUG_ON(!t); BUG_ON(!t);
...@@ -2120,13 +2120,9 @@ static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev) ...@@ -2120,13 +2120,9 @@ static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev)
pkt_dev->pkt_overhead += SVLAN_TAG_SIZE(pkt_dev); pkt_dev->pkt_overhead += SVLAN_TAG_SIZE(pkt_dev);
} }
static inline int f_seen(struct pktgen_dev *pkt_dev, int flow) static inline int f_seen(const struct pktgen_dev *pkt_dev, int flow)
{ {
return !!(pkt_dev->flows[flow].flags & F_INIT);
if (pkt_dev->flows[flow].flags & F_INIT)
return 1;
else
return 0;
} }
static inline int f_pick(struct pktgen_dev *pkt_dev) static inline int f_pick(struct pktgen_dev *pkt_dev)
...@@ -3101,17 +3097,14 @@ static void pktgen_stop_all_threads_ifs(void) ...@@ -3101,17 +3097,14 @@ static void pktgen_stop_all_threads_ifs(void)
mutex_unlock(&pktgen_thread_lock); mutex_unlock(&pktgen_thread_lock);
} }
static int thread_is_running(struct pktgen_thread *t) static int thread_is_running(const struct pktgen_thread *t)
{ {
struct pktgen_dev *pkt_dev; const struct pktgen_dev *pkt_dev;
int res = 0;
list_for_each_entry(pkt_dev, &t->if_list, list) list_for_each_entry(pkt_dev, &t->if_list, list)
if (pkt_dev->running) { if (pkt_dev->running)
res = 1; return 1;
break; return 0;
}
return res;
} }
static int pktgen_wait_thread_run(struct pktgen_thread *t) static int pktgen_wait_thread_run(struct pktgen_thread *t)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment