X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fs390%2Fnet%2Fqeth_proc.c;h=66f2da14e6e3a0bd2bbd5250a9b25efa585637b2;hb=1465887cfe79889273e3fd3aaf862e7ec3ee244f;hp=f2ccfea8fdb89cabe2bf65a7885c3fbcde3b4798;hpb=2fc2991175bf77395e6b15fe6b2304d3bf72da40;p=powerpc.git diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c index f2ccfea8fd..66f2da14e6 100644 --- a/drivers/s390/net/qeth_proc.c +++ b/drivers/s390/net/qeth_proc.c @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_fs.c ($Revision: 1.13 $) + * linux/drivers/s390/net/qeth_fs.c * * Linux on zSeries OSA Express and HiperSockets support * This file contains code related to procfs. @@ -21,8 +21,6 @@ #include "qeth_mpc.h" #include "qeth_fs.h" -const char *VERSION_QETH_PROC_C = "$Revision: 1.13 $"; - /***** /proc/qeth *****/ #define QETH_PROCFILE_NAME "qeth" static struct proc_dir_entry *qeth_procfile; @@ -30,30 +28,26 @@ static struct proc_dir_entry *qeth_procfile; static int qeth_procfile_seq_match(struct device *dev, void *data) { - return 1; + return(dev ? 1 : 0); } static void * qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) { - struct device *dev; - loff_t nr; + struct device *dev = NULL; + loff_t nr = 0; down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - - nr = *offset; - if (nr == 0) + if (*offset == 0) return SEQ_START_TOKEN; - - dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, - NULL, qeth_procfile_seq_match); - - /* get card at pos *offset */ - nr = *offset; - while (nr-- > 1 && dev) + while (1) { dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, NULL, qeth_procfile_seq_match); - return (void *) dev; + if (++nr == *offset) + break; + put_device(dev); + } + return dev; } static void @@ -67,27 +61,22 @@ qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) { struct device *prev, *next; - if (it == SEQ_START_TOKEN) { - next = driver_find_device(&qeth_ccwgroup_driver.driver, - NULL, NULL, qeth_procfile_seq_match); - if (next) - (*offset)++; - return (void *) next; - } - prev = (struct device *) it; + if (it == SEQ_START_TOKEN) + prev = NULL; + else + prev = (struct device *) it; next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, NULL, qeth_procfile_seq_match); - if (next) - (*offset)++; + (*offset)++; return (void *) next; } static inline const char * qeth_get_router_str(struct qeth_card *card, int ipv) { - int routing_type = 0; + enum qeth_routing_types routing_type = NO_ROUTER; - if (ipv == 4){ + if (ipv == 4) { routing_type = card->options.route4.type; } else { #ifdef CONFIG_QETH_IPV6 @@ -97,26 +86,26 @@ qeth_get_router_str(struct qeth_card *card, int ipv) #endif /* CONFIG_QETH_IPV6 */ } - if (routing_type == PRIMARY_ROUTER) + switch (routing_type){ + case PRIMARY_ROUTER: return "pri"; - else if (routing_type == SECONDARY_ROUTER) + case SECONDARY_ROUTER: return "sec"; - else if (routing_type == MULTICAST_ROUTER) { + case MULTICAST_ROUTER: if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) return "mc+"; return "mc"; - } else if (routing_type == PRIMARY_CONNECTOR) { + case PRIMARY_CONNECTOR: if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) return "p+c"; return "p.c"; - } else if (routing_type == SECONDARY_CONNECTOR) { + case SECONDARY_CONNECTOR: if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) return "s+c"; return "s.c"; - } else if (routing_type == NO_ROUTER) + default: /* NO_ROUTER */ return "no"; - else - return "unk"; + } } static int @@ -154,6 +143,7 @@ qeth_procfile_seq_show(struct seq_file *s, void *it) card->qdio.in_buf_pool.buf_count); else seq_printf(s, " +++ LAN OFFLINE +++\n"); + put_device(device); } return 0; } @@ -184,51 +174,16 @@ static struct file_operations qeth_procfile_fops = { static struct proc_dir_entry *qeth_perf_procfile; #ifdef CONFIG_QETH_PERF_STATS - -static void * -qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset) -{ - struct device *dev = NULL; - int nr; - - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - /* get card at pos *offset */ - dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, - qeth_procfile_seq_match); - - /* get card at pos *offset */ - nr = *offset; - while (nr-- > 1 && dev) - dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, - NULL, qeth_procfile_seq_match); - return (void *) dev; -} - -static void -qeth_perf_procfile_seq_stop(struct seq_file *s, void* it) -{ - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); -} - -static void * -qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) -{ - struct device *prev, *next; - - prev = (struct device *) it; - next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, - NULL, qeth_procfile_seq_match); - if (next) - (*offset)++; - return (void *) next; -} - 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; + device = (struct device *) it; card = device->driver_data; seq_printf(s, "For card with devnos %s/%s/%s (%s):\n", @@ -237,27 +192,27 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) CARD_DDEV_ID(card), QETH_CARD_IFNAME(card) ); - seq_printf(s, " Skb's/buffers received : %li/%i\n" - " Skb's/buffers sent : %li/%i\n\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.bufs_rec, card->stats.tx_packets, card->perf_stats.bufs_sent ); - seq_printf(s, " Skb's/buffers sent without packing : %li/%i\n" - " Skb's/buffers sent with packing : %i/%i\n\n", + 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.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 : %i\n" - " Skb fragments sent in SG mode : %i\n\n", + seq_printf(s, " Skbs sent in SG mode : %u\n" + " Skb fragments sent in SG mode : %u\n\n", card->perf_stats.sg_skbs_sent, card->perf_stats.sg_frags_sent); - seq_printf(s, " large_send tx (in Kbytes) : %i\n" - " large_send count : %i\n\n", + seq_printf(s, " large_send tx (in Kbytes) : %u\n" + " large_send count : %u\n\n", card->perf_stats.large_send_bytes >> 10, card->perf_stats.large_send_cnt); - seq_printf(s, " Packing state changes no pkg.->packing : %i/%i\n" + seq_printf(s, " Packing state changes no pkg.->packing : %u/%u\n" " Watermarks L/H : %i/%i\n" " Current buffer usage (outbound q's) : " "%i/%i/%i/%i\n\n", @@ -274,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) : %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", + 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", card->perf_stats.inbound_time, card->perf_stats.inbound_cnt, card->perf_stats.inbound_do_qdio_time, @@ -295,13 +250,14 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) card->perf_stats.outbound_do_qdio_time, card->perf_stats.outbound_do_qdio_cnt ); + put_device(device); return 0; } static struct seq_operations qeth_perf_procfile_seq_ops = { - .start = qeth_perf_procfile_seq_start, - .stop = qeth_perf_procfile_seq_stop, - .next = qeth_perf_procfile_seq_next, + .start = qeth_procfile_seq_start, + .stop = qeth_procfile_seq_stop, + .next = qeth_procfile_seq_next, .show = qeth_perf_procfile_seq_show, }; @@ -324,93 +280,6 @@ static struct file_operations qeth_perf_procfile_fops = { #define qeth_perf_procfile_created 1 #endif /* CONFIG_QETH_PERF_STATS */ -/***** /proc/qeth_ipa_takeover *****/ -#define QETH_IPATO_PROCFILE_NAME "qeth_ipa_takeover" -static struct proc_dir_entry *qeth_ipato_procfile; - -static void * -qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) -{ - struct device *dev; - loff_t nr; - - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - /* TODO: finish this */ - /* - * maybe SEQ_SATRT_TOKEN can be returned for offset 0 - * output driver settings then; - * else output setting for respective card - */ - - dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, - qeth_procfile_seq_match); - - /* get card at pos *offset */ - nr = *offset; - while (nr-- > 1 && dev) - dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, - NULL, qeth_procfile_seq_match); - return (void *) dev; -} - -static void -qeth_ipato_procfile_seq_stop(struct seq_file *s, void* it) -{ - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); -} - -static void * -qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) -{ - struct device *prev, *next; - - prev = (struct device *) it; - next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, - NULL, qeth_procfile_seq_match); - if (next) - (*offset)++; - return (void *) next; -} - -static int -qeth_ipato_procfile_seq_show(struct seq_file *s, void *it) -{ - struct device *device; - struct qeth_card *card; - - /* TODO: finish this */ - /* - * maybe SEQ_SATRT_TOKEN can be returned for offset 0 - * output driver settings then; - * else output setting for respective card - */ - device = (struct device *) it; - card = device->driver_data; - - return 0; -} - -static struct seq_operations qeth_ipato_procfile_seq_ops = { - .start = qeth_ipato_procfile_seq_start, - .stop = qeth_ipato_procfile_seq_stop, - .next = qeth_ipato_procfile_seq_next, - .show = qeth_ipato_procfile_seq_show, -}; - -static int -qeth_ipato_procfile_open(struct inode *inode, struct file *file) -{ - return seq_open(file, &qeth_ipato_procfile_seq_ops); -} - -static struct file_operations qeth_ipato_procfile_fops = { - .owner = THIS_MODULE, - .open = qeth_ipato_procfile_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - int __init qeth_create_procfs_entries(void) { @@ -426,13 +295,7 @@ qeth_create_procfs_entries(void) qeth_perf_procfile->proc_fops = &qeth_perf_procfile_fops; #endif /* CONFIG_QETH_PERF_STATS */ - qeth_ipato_procfile = create_proc_entry(QETH_IPATO_PROCFILE_NAME, - S_IFREG | 0444, NULL); - if (qeth_ipato_procfile) - qeth_ipato_procfile->proc_fops = &qeth_ipato_procfile_fops; - if (qeth_procfile && - qeth_ipato_procfile && qeth_perf_procfile_created) return 0; else @@ -446,62 +309,5 @@ qeth_remove_procfs_entries(void) remove_proc_entry(QETH_PROCFILE_NAME, NULL); if (qeth_perf_procfile) remove_proc_entry(QETH_PERF_PROCFILE_NAME, NULL); - if (qeth_ipato_procfile) - remove_proc_entry(QETH_IPATO_PROCFILE_NAME, NULL); -} - - -/* ONLY FOR DEVELOPMENT! -> make it as module */ -/* -static void -qeth_create_sysfs_entries(void) -{ - struct device *dev; - - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - - list_for_each_entry(dev, &qeth_ccwgroup_driver.driver.devices, - driver_list) - qeth_create_device_attributes(dev); - - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); } -static void -qeth_remove_sysfs_entries(void) -{ - struct device *dev; - - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - - list_for_each_entry(dev, &qeth_ccwgroup_driver.driver.devices, - driver_list) - qeth_remove_device_attributes(dev); - - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); -} - -static int __init -qeth_fs_init(void) -{ - printk(KERN_INFO "qeth_fs_init\n"); - qeth_create_procfs_entries(); - qeth_create_sysfs_entries(); - - return 0; -} - -static void __exit -qeth_fs_exit(void) -{ - printk(KERN_INFO "qeth_fs_exit\n"); - qeth_remove_procfs_entries(); - qeth_remove_sysfs_entries(); -} - - -module_init(qeth_fs_init); -module_exit(qeth_fs_exit); - -MODULE_LICENSE("GPL"); -*/