aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-08-27 09:55:07 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-29 02:31:45 -0400
commit648fda7404630ba85ce462ee1279e1bc027ad915 (patch)
treeda7a3446f9369dc3a0c8c45bf1bfff7fdb3e57fd /net
parent39aa81659353becbe4ee34d72cf79e02182e858a (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')
-rw-r--r--net/core/pktgen.c25
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
510static int pktgen_if_show(struct seq_file *seq, void *v) 510static 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 = {
1670static int pktgen_thread_show(struct seq_file *seq, void *v) 1670static 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
2123static inline int f_seen(struct pktgen_dev *pkt_dev, int flow) 2123static 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
2132static inline int f_pick(struct pktgen_dev *pkt_dev) 2128static 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
3104static int thread_is_running(struct pktgen_thread *t) 3100static 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
3117static int pktgen_wait_thread_run(struct pktgen_thread *t) 3110static int pktgen_wait_thread_run(struct pktgen_thread *t)