X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fs390%2Fnet%2Fqeth_proc.c;fp=drivers%2Fs390%2Fnet%2Fqeth_proc.c;h=3c6339df879d185bd45f7eb30cc1dc644af1b2c0;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=faa768e5925715075b7c998b6fed9464edb1936e;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c index faa768e59..3c6339df8 100644 --- a/drivers/s390/net/qeth_proc.c +++ b/drivers/s390/net/qeth_proc.c @@ -36,7 +36,7 @@ qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) { struct device *dev = NULL; loff_t nr = 0; - + down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); if (*offset == 0) return SEQ_START_TOKEN; @@ -60,8 +60,8 @@ static void * qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) { struct device *prev, *next; - - if (it == SEQ_START_TOKEN) + + if (it == SEQ_START_TOKEN) prev = NULL; else prev = (struct device *) it; @@ -74,7 +74,7 @@ qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) static inline const char * qeth_get_router_str(struct qeth_card *card, int ipv) { - enum qeth_routing_types routing_type = NO_ROUTER; + int routing_type = 0; if (ipv == 4) { routing_type = card->options.route4.type; @@ -86,26 +86,26 @@ qeth_get_router_str(struct qeth_card *card, int ipv) #endif /* CONFIG_QETH_IPV6 */ } - switch (routing_type){ - case PRIMARY_ROUTER: + if (routing_type == PRIMARY_ROUTER) return "pri"; - case SECONDARY_ROUTER: + else if (routing_type == SECONDARY_ROUTER) return "sec"; - case MULTICAST_ROUTER: + else if (routing_type == MULTICAST_ROUTER) { if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) return "mc+"; return "mc"; - case PRIMARY_CONNECTOR: + } else if (routing_type == PRIMARY_CONNECTOR) { if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) return "p+c"; return "p.c"; - case SECONDARY_CONNECTOR: + } else if (routing_type == SECONDARY_CONNECTOR) { if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) return "s+c"; return "s.c"; - default: /* NO_ROUTER */ + } else if (routing_type == NO_ROUTER) return "no"; - } + else + return "unk"; } static int @@ -173,13 +173,14 @@ static struct file_operations qeth_procfile_fops = { #define QETH_PERF_PROCFILE_NAME "qeth_perf" static struct proc_dir_entry *qeth_perf_procfile; +#ifdef CONFIG_QETH_PERF_STATS static int qeth_perf_procfile_seq_show(struct seq_file *s, void *it) { struct device *device; struct qeth_card *card; - + if (it == SEQ_START_TOKEN) return 0; @@ -191,34 +192,27 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) CARD_DDEV_ID(card), QETH_CARD_IFNAME(card) ); - if (!card->options.performance_stats) - seq_printf(s, "Performance statistics are deactivated.\n"); - seq_printf(s, " Skb's/buffers received : %lu/%u\n" - " Skb's/buffers sent : %lu/%u\n\n", - card->stats.rx_packets - - card->perf_stats.initial_rx_packets, - card->perf_stats.bufs_rec, - card->stats.tx_packets - - card->perf_stats.initial_tx_packets, - card->perf_stats.bufs_sent + seq_printf(s, " Skb's/buffers received : %li/%i\n" + " Skb's/buffers sent : %li/%i\n\n", + card->stats.rx_packets, card->perf_stats.bufs_rec, + card->stats.tx_packets, card->perf_stats.bufs_sent ); - seq_printf(s, " Skb's/buffers sent without packing : %lu/%u\n" - " Skb's/buffers sent with packing : %u/%u\n\n", - card->stats.tx_packets - card->perf_stats.initial_tx_packets - - card->perf_stats.skbs_sent_pack, + seq_printf(s, " Skb's/buffers sent without packing : %li/%i\n" + " Skb's/buffers sent with packing : %i/%i\n\n", + card->stats.tx_packets - card->perf_stats.skbs_sent_pack, card->perf_stats.bufs_sent - card->perf_stats.bufs_sent_pack, card->perf_stats.skbs_sent_pack, card->perf_stats.bufs_sent_pack ); - seq_printf(s, " Skbs sent in SG mode : %u\n" - " Skb fragments sent in SG mode : %u\n\n", + seq_printf(s, " Skbs sent in SG mode : %i\n" + " Skb fragments sent in SG mode : %i\n\n", card->perf_stats.sg_skbs_sent, card->perf_stats.sg_frags_sent); - seq_printf(s, " large_send tx (in Kbytes) : %u\n" - " large_send count : %u\n\n", + seq_printf(s, " large_send tx (in Kbytes) : %i\n" + " large_send count : %i\n\n", card->perf_stats.large_send_bytes >> 10, card->perf_stats.large_send_cnt); - seq_printf(s, " Packing state changes no pkg.->packing : %u/%u\n" + seq_printf(s, " Packing state changes no pkg.->packing : %i/%i\n" " Watermarks L/H : %i/%i\n" " Current buffer usage (outbound q's) : " "%i/%i/%i/%i\n\n", @@ -235,16 +229,16 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) atomic_read(&card->qdio.out_qs[3]->used_buffers) : 0 ); - seq_printf(s, " Inbound handler time (in us) : %u\n" - " Inbound handler count : %u\n" - " Inbound do_QDIO time (in us) : %u\n" - " Inbound do_QDIO count : %u\n\n" - " Outbound handler time (in us) : %u\n" - " Outbound handler count : %u\n\n" - " Outbound time (in us, incl QDIO) : %u\n" - " Outbound count : %u\n" - " Outbound do_QDIO time (in us) : %u\n" - " Outbound do_QDIO count : %u\n\n", + seq_printf(s, " Inbound handler time (in us) : %i\n" + " Inbound handler count : %i\n" + " Inbound do_QDIO time (in us) : %i\n" + " Inbound do_QDIO count : %i\n\n" + " Outbound handler time (in us) : %i\n" + " Outbound handler count : %i\n\n" + " Outbound time (in us, incl QDIO) : %i\n" + " Outbound count : %i\n" + " Outbound do_QDIO time (in us) : %i\n" + " Outbound do_QDIO count : %i\n\n", card->perf_stats.inbound_time, card->perf_stats.inbound_cnt, card->perf_stats.inbound_do_qdio_time, @@ -281,6 +275,11 @@ static struct file_operations qeth_perf_procfile_fops = { .release = seq_release, }; +#define qeth_perf_procfile_created qeth_perf_procfile +#else +#define qeth_perf_procfile_created 1 +#endif /* CONFIG_QETH_PERF_STATS */ + int __init qeth_create_procfs_entries(void) { @@ -289,13 +288,15 @@ qeth_create_procfs_entries(void) if (qeth_procfile) qeth_procfile->proc_fops = &qeth_procfile_fops; +#ifdef CONFIG_QETH_PERF_STATS qeth_perf_procfile = create_proc_entry(QETH_PERF_PROCFILE_NAME, S_IFREG | 0444, NULL); if (qeth_perf_procfile) qeth_perf_procfile->proc_fops = &qeth_perf_procfile_fops; +#endif /* CONFIG_QETH_PERF_STATS */ if (qeth_procfile && - qeth_perf_procfile) + qeth_perf_procfile_created) return 0; else return -ENOMEM;