[PATCH 7/9] s390: qeth driver fixes [4/6]
From: Frank Pavlic [EMAIL PROTECTED]
- fix kernel crash due to race,
set card-state to SOFTSETUP after
card and card-dev are initialized properly.
- remove CONFIG_QETH_PERF_STATS, use sysfs attribute instead,
as we want to have the ability to turn on/off the
statistics at runtime.
Signed-off-by: Frank Pavlic [EMAIL PROTECTED]
---
drivers/s390/net/Kconfig |9 ---
drivers/s390/net/qeth.h | 10 +--
drivers/s390/net/qeth_eddp.c |5 +
drivers/s390/net/qeth_main.c | 147
--
drivers/s390/net/qeth_proc.c | 23 +++
drivers/s390/net/qeth_sys.c | 42
6 files changed, 128 insertions(+), 108 deletions(-)
1068b773a870931ccec7009a320e37f7013b268f
diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig
index 5488547..1a93fa6 100644
--- a/drivers/s390/net/Kconfig
+++ b/drivers/s390/net/Kconfig
@@ -92,15 +92,6 @@ config QETH_VLAN
If CONFIG_QETH is switched on, this option will include IEEE
802.1q VLAN support in the qeth device driver.
-config QETH_PERF_STATS
- bool Performance statistics in /proc
- depends on QETH
- help
- When switched on, this option will add a file in the proc-fs
- (/proc/qeth_perf_stats) containing performance statistics. It
- may slightly impact performance, so this is only recommended for
- internal tuning of the device driver.
-
config CCWGROUP
tristate
default (LCS || CTC || QETH)
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index c04ee91..22a7ffb 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -176,7 +176,6 @@ extern struct ccwgroup_driver qeth_ccwgr
/**
* card stuff
*/
-#ifdef CONFIG_QETH_PERF_STATS
struct qeth_perf_stats {
unsigned int bufs_rec;
unsigned int bufs_sent;
@@ -211,8 +210,10 @@ struct qeth_perf_stats {
unsigned int large_send_cnt;
unsigned int sg_skbs_sent;
unsigned int sg_frags_sent;
+ /* initial values when measuring starts */
+ unsigned long initial_rx_packets;
+ unsigned long initial_tx_packets;
};
-#endif /* CONFIG_QETH_PERF_STATS */
/* Routing stuff */
struct qeth_routing_info {
@@ -767,6 +768,7 @@ struct qeth_card_options {
int fake_ll;
int layer2;
enum qeth_large_send_types large_send;
+ int performance_stats;
};
/*
@@ -819,9 +821,7 @@ struct qeth_card {
struct list_head cmd_waiter_list;
/* QDIO buffer handling */
struct qeth_qdio_info qdio;
-#ifdef CONFIG_QETH_PERF_STATS
struct qeth_perf_stats perf_stats;
-#endif /* CONFIG_QETH_PERF_STATS */
int use_hard_stop;
int (*orig_hard_header)(struct sk_buff *,struct net_device *,
unsigned short,void *,void *,unsigned);
@@ -1049,13 +1049,11 @@ qeth_get_arphdr_type(int cardtype, int l
}
}
-#ifdef CONFIG_QETH_PERF_STATS
static inline int
qeth_get_micros(void)
{
return (int) (get_clock() 12);
}
-#endif
static inline int
qeth_get_qdio_q_format(struct qeth_card *card)
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c
index 8491598..a363721 100644
--- a/drivers/s390/net/qeth_eddp.c
+++ b/drivers/s390/net/qeth_eddp.c
@@ -179,9 +179,8 @@ out_check:
flush_cnt++;
}
} else {
-#ifdef CONFIG_QETH_PERF_STATS
- queue-card-perf_stats.skbs_sent_pack++;
-#endif
+ if (queue-card-options.performance_stats)
+ queue-card-perf_stats.skbs_sent_pack++;
QETH_DBF_TEXT(trace, 6, fillbfpa);
if (buf-next_element_to_fill =
QETH_MAX_BUFFER_ELEMENTS(queue-card)) {
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 522fb9d..0bc55a3 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -1073,6 +1073,7 @@ qeth_set_intial_options(struct qeth_card
card-options.layer2 = 1;
else
card-options.layer2 = 0;
+ card-options.performance_stats = 1;
}
/**
@@ -2564,9 +2565,8 @@ qeth_process_inbound_buffer(struct qeth_
/* get first element of current buffer */
element = (struct qdio_buffer_element *)buf-buffer-element[0];
offset = 0;
-#ifdef CONFIG_QETH_PERF_STATS
- card-perf_stats.bufs_rec++;
-#endif
+ if (card-options.performance_stats)
+ card-perf_stats.bufs_rec++;
while((skb = qeth_get_next_skb(card, buf-buffer, element,
offset, hdr))) {
skb-dev = card-dev;
@@ -2623,7 +2623,7 @@ qeth_init_input_buffer(struct qeth_card
{
struct qeth_buffer_pool_entry *pool_entry;
int i;
-
+
pool_entry = qeth_get_buffer_pool_entry(card);
/*
* since the buffer is accessed only from the input_tasklet
@@ -2697,17 +2697,18 @@ qeth_queue_input_buffer(struct qeth_card
* 'index') un-requeued - this buffer is the first buffer that
* will be requeued the next time
*/
-#ifdef CONFIG_QETH_PERF_STATS
- card-perf_stats.inbound_do_qdio_cnt++;
- card-perf_stats.inbound_do_qdio_start_time = qeth_get_micros();
-#endif
+ if (card-options.performance_stats) {
+ card-perf_stats.inbound_do_qdio_cnt++;
+ card-perf_stats.inbound_do_qdio_start_time =
+qeth_get_micros