diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-08-27 09:55:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-29 02:31:45 -0400 |
commit | 648fda7404630ba85ce462ee1279e1bc027ad915 (patch) | |
tree | da7a3446f9369dc3a0c8c45bf1bfff7fdb3e57fd /net/core/pktgen.c | |
parent | 39aa81659353becbe4ee34d72cf79e02182e858a (diff) |
pktgen: minor cleanup
A couple of minor functions can be written more compactly.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r-- | net/core/pktgen.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 19b8c20e98a4..bb4631329b03 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -509,7 +509,7 @@ static const struct file_operations pktgen_fops = { | |||
509 | 509 | ||
510 | static int pktgen_if_show(struct seq_file *seq, void *v) | 510 | static int pktgen_if_show(struct seq_file *seq, void *v) |
511 | { | 511 | { |
512 | struct pktgen_dev *pkt_dev = seq->private; | 512 | const struct pktgen_dev *pkt_dev = seq->private; |
513 | __u64 sa; | 513 | __u64 sa; |
514 | __u64 stopped; | 514 | __u64 stopped; |
515 | __u64 now = getCurUs(); | 515 | __u64 now = getCurUs(); |
@@ -1670,7 +1670,7 @@ static const struct file_operations pktgen_if_fops = { | |||
1670 | static int pktgen_thread_show(struct seq_file *seq, void *v) | 1670 | static int pktgen_thread_show(struct seq_file *seq, void *v) |
1671 | { | 1671 | { |
1672 | struct pktgen_thread *t = seq->private; | 1672 | struct pktgen_thread *t = seq->private; |
1673 | struct pktgen_dev *pkt_dev; | 1673 | const struct pktgen_dev *pkt_dev; |
1674 | 1674 | ||
1675 | BUG_ON(!t); | 1675 | BUG_ON(!t); |
1676 | 1676 | ||
@@ -2120,13 +2120,9 @@ static inline void set_pkt_overhead(struct pktgen_dev *pkt_dev) | |||
2120 | pkt_dev->pkt_overhead += SVLAN_TAG_SIZE(pkt_dev); | 2120 | pkt_dev->pkt_overhead += SVLAN_TAG_SIZE(pkt_dev); |
2121 | } | 2121 | } |
2122 | 2122 | ||
2123 | static inline int f_seen(struct pktgen_dev *pkt_dev, int flow) | 2123 | static inline int f_seen(const struct pktgen_dev *pkt_dev, int flow) |
2124 | { | 2124 | { |
2125 | 2125 | return !!(pkt_dev->flows[flow].flags & F_INIT); | |
2126 | if (pkt_dev->flows[flow].flags & F_INIT) | ||
2127 | return 1; | ||
2128 | else | ||
2129 | return 0; | ||
2130 | } | 2126 | } |
2131 | 2127 | ||
2132 | static inline int f_pick(struct pktgen_dev *pkt_dev) | 2128 | static inline int f_pick(struct pktgen_dev *pkt_dev) |
@@ -3101,17 +3097,14 @@ static void pktgen_stop_all_threads_ifs(void) | |||
3101 | mutex_unlock(&pktgen_thread_lock); | 3097 | mutex_unlock(&pktgen_thread_lock); |
3102 | } | 3098 | } |
3103 | 3099 | ||
3104 | static int thread_is_running(struct pktgen_thread *t) | 3100 | static int thread_is_running(const struct pktgen_thread *t) |
3105 | { | 3101 | { |
3106 | struct pktgen_dev *pkt_dev; | 3102 | const struct pktgen_dev *pkt_dev; |
3107 | int res = 0; | ||
3108 | 3103 | ||
3109 | list_for_each_entry(pkt_dev, &t->if_list, list) | 3104 | list_for_each_entry(pkt_dev, &t->if_list, list) |
3110 | if (pkt_dev->running) { | 3105 | if (pkt_dev->running) |
3111 | res = 1; | 3106 | return 1; |
3112 | break; | 3107 | return 0; |
3113 | } | ||
3114 | return res; | ||
3115 | } | 3108 | } |
3116 | 3109 | ||
3117 | static int pktgen_wait_thread_run(struct pktgen_thread *t) | 3110 | static int pktgen_wait_thread_run(struct pktgen_thread *t) |