* [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29
@ 2009-03-24 12:29 Ursula Braun
2009-03-24 12:29 ` [patch 1/9] [PATCH] Use kthread instead of kernel_thread Ursula Braun
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390; +Cc: schwidefsky, heiko.carstens
Dave,
here are a couple of drivers/s390/net-patches for 2.6.29 :
1/9: lcs: exploit <linux/kthread.h> - Klaus-Dieter Wacker
2/9: lcs: hard_start_xmit return codes - Klaus-Dieter Wacker
3/9: netiucv: hard_start_xmit return codes - Ursula Braun
4/9: claw: hard_start_xmit return codes - Ursula Braun
5/9: ctcm: hard_start_xmit return codes - Ursula Braun
6/9: ctcm: avoid wraparound in length of incoming data - Roel Kluin
7/9: ctcm: minor findings from code analysis tool - Joel Fowler
8/9: claw: convert printk messages to kmsg api - Andy Richter
9/9: claw: minor findings from code analysis tool - Andy Richter
Thanks and regards,
Ursula
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 1/9] [PATCH] Use kthread instead of kernel_thread
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
@ 2009-03-24 12:29 ` Ursula Braun
2009-03-24 12:29 ` [patch 2/9] [PATCH] lcs: invalid return codes from hard_start_xmit Ursula Braun
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390
Cc: schwidefsky, heiko.carstens, Klaus-Dieter Wacker, Ursula Braun
[-- Attachment #1: 604-lcs-threads.diff --]
[-- Type: text/plain, Size: 1773 bytes --]
From: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
Lcs uses low-level kernel_thread implementation.
All drivers should use <linux/kthread.h> API instead.
Signed-off-by: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/lcs.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff -urpN linux-2.6/drivers/s390/net/lcs.c linux-2.6-patched/drivers/s390/net/lcs.c
--- linux-2.6/drivers/s390/net/lcs.c 2009-03-04 15:58:03.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/lcs.c 2009-03-04 15:58:28.000000000 +0100
@@ -39,6 +39,7 @@
#include <linux/in.h>
#include <linux/igmp.h>
#include <linux/delay.h>
+#include <linux/kthread.h>
#include <net/arp.h>
#include <net/ip.h>
@@ -1259,7 +1260,6 @@ lcs_register_mc_addresses(void *data)
struct in_device *in4_dev;
card = (struct lcs_card *) data;
- daemonize("regipm");
if (!lcs_do_run_thread(card, LCS_SET_MC_THREAD))
return 0;
@@ -1753,11 +1753,10 @@ lcs_start_kernel_thread(struct work_stru
struct lcs_card *card = container_of(work, struct lcs_card, kernel_thread_starter);
LCS_DBF_TEXT(5, trace, "krnthrd");
if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD))
- kernel_thread(lcs_recovery, (void *) card, SIGCHLD);
+ kthread_run(lcs_recovery, card, "lcs_recover");
#ifdef CONFIG_IP_MULTICAST
if (lcs_do_start_thread(card, LCS_SET_MC_THREAD))
- kernel_thread(lcs_register_mc_addresses,
- (void *) card, SIGCHLD);
+ kthread_run(lcs_register_mc_addresses, card, "regipm");
#endif
}
@@ -2258,7 +2257,6 @@ lcs_recovery(void *ptr)
int rc;
card = (struct lcs_card *) ptr;
- daemonize("lcs_recover");
LCS_DBF_TEXT(4, trace, "recover1");
if (!lcs_do_run_thread(card, LCS_RECOVERY_THREAD))
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 2/9] [PATCH] lcs: invalid return codes from hard_start_xmit.
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
2009-03-24 12:29 ` [patch 1/9] [PATCH] Use kthread instead of kernel_thread Ursula Braun
@ 2009-03-24 12:29 ` Ursula Braun
2009-03-24 12:29 ` [patch 3/9] [PATCH] netiucv: invalid return code " Ursula Braun
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390
Cc: schwidefsky, heiko.carstens, Klaus-Dieter Wacker, Ursula Braun
[-- Attachment #1: 608-lcs-rc.diff --]
[-- Type: text/plain, Size: 1159 bytes --]
From: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
Lcs hard_start_xmit routine issued return codes other than
defined for this interface. Now lcs returns only either
NETDEV_TX_OK or NETDEV_TX_BUSY.
Signed-off-by: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/lcs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -urpN linux-2.6/drivers/s390/net/lcs.c linux-2.6-patched/drivers/s390/net/lcs.c
--- linux-2.6/drivers/s390/net/lcs.c 2009-03-04 15:58:28.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/lcs.c 2009-03-04 15:58:29.000000000 +0100
@@ -1562,7 +1562,7 @@ __lcs_start_xmit(struct lcs_card *card,
if (skb == NULL) {
card->stats.tx_dropped++;
card->stats.tx_errors++;
- return -EIO;
+ return 0;
}
if (card->state != DEV_STATE_UP) {
dev_kfree_skb(skb);
@@ -1587,7 +1587,7 @@ __lcs_start_xmit(struct lcs_card *card,
card->tx_buffer = lcs_get_buffer(&card->write);
if (card->tx_buffer == NULL) {
card->stats.tx_dropped++;
- rc = -EBUSY;
+ rc = NETDEV_TX_BUSY;
goto out;
}
card->tx_buffer->callback = lcs_txbuffer_cb;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 3/9] [PATCH] netiucv: invalid return code from hard_start_xmit
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
2009-03-24 12:29 ` [patch 1/9] [PATCH] Use kthread instead of kernel_thread Ursula Braun
2009-03-24 12:29 ` [patch 2/9] [PATCH] lcs: invalid return codes from hard_start_xmit Ursula Braun
@ 2009-03-24 12:29 ` Ursula Braun
2009-03-24 12:29 ` [patch 4/9] [PATCH] claw: invalid return codes " Ursula Braun
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390; +Cc: schwidefsky, heiko.carstens, Ursula Braun
[-- Attachment #1: 610-netiucv-rc-warning.diff --]
[-- Type: text/plain, Size: 842 bytes --]
From: Ursula Braun <ursula.braun@de.ibm.com>
Avoid kernel warning by using the correct hard_start_xmit return
code NETDEV_TX_BUSY for skb requeuing.
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/netiucv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -urpN linux-2.6/drivers/s390/net/netiucv.c linux-2.6-patched/drivers/s390/net/netiucv.c
--- linux-2.6/drivers/s390/net/netiucv.c 2009-03-04 15:58:03.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/netiucv.c 2009-03-04 15:58:30.000000000 +0100
@@ -1312,7 +1312,7 @@ static int netiucv_tx(struct sk_buff *sk
if (netiucv_test_and_set_busy(dev)) {
IUCV_DBF_TEXT(data, 2, "EBUSY from netiucv_tx\n");
- return -EBUSY;
+ return NETDEV_TX_BUSY;
}
dev->trans_start = jiffies;
rc = netiucv_transmit_skb(privptr->conn, skb) != 0;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 4/9] [PATCH] claw: invalid return codes from hard_start_xmit
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
` (2 preceding siblings ...)
2009-03-24 12:29 ` [patch 3/9] [PATCH] netiucv: invalid return code " Ursula Braun
@ 2009-03-24 12:29 ` Ursula Braun
2009-03-24 12:29 ` [patch 5/9] [PATCH] ctcm: invalid return code " Ursula Braun
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390; +Cc: schwidefsky, heiko.carstens, Ursula Braun
[-- Attachment #1: 611-claw-rc-warning.diff --]
[-- Type: text/plain, Size: 823 bytes --]
From: Ursula Braun <ursula.braun@de.ibm.com>
Avoid kernel warnings by using the correct hard_start_xmit return
code NETDEV_TX_BUSY for skb requeuing.
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/claw.c | 2 ++
1 file changed, 2 insertions(+)
diff -urpN linux-2.6/drivers/s390/net/claw.c linux-2.6-patched/drivers/s390/net/claw.c
--- linux-2.6/drivers/s390/net/claw.c 2008-12-25 00:26:37.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/claw.c 2009-03-04 15:58:30.000000000 +0100
@@ -335,6 +335,8 @@ claw_tx(struct sk_buff *skb, struct net_
rc=claw_hw_tx( skb, dev, 1 );
spin_unlock_irqrestore(get_ccwdev_lock(p_ch->cdev), saveflags);
CLAW_DBF_TEXT_(4, trace, "clawtx%d", rc);
+ if (rc)
+ rc = NETDEV_TX_BUSY;
return rc;
} /* end of claw_tx */
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 5/9] [PATCH] ctcm: invalid return code from hard_start_xmit
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
` (3 preceding siblings ...)
2009-03-24 12:29 ` [patch 4/9] [PATCH] claw: invalid return codes " Ursula Braun
@ 2009-03-24 12:29 ` Ursula Braun
2009-03-24 12:29 ` [patch 6/9] [PATCH] ctcm: avoid wraparound in length of incoming data Ursula Braun
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390; +Cc: schwidefsky, heiko.carstens, Ursula Braun
[-- Attachment #1: 612-ctcm-rc-warning.diff --]
[-- Type: text/plain, Size: 858 bytes --]
From: Ursula Braun <ursula.braun@de.ibm.com>
Avoid kernel warning by using the correct hard_start_xmit return
code NETDEV_TX_BUSY for skb requeuing.
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/ctcm_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -urpN linux-2.6/drivers/s390/net/ctcm_main.c linux-2.6-patched/drivers/s390/net/ctcm_main.c
--- linux-2.6/drivers/s390/net/ctcm_main.c 2009-03-04 15:58:03.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/ctcm_main.c 2009-03-04 15:58:31.000000000 +0100
@@ -906,11 +906,11 @@ static int ctcm_tx(struct sk_buff *skb,
}
if (ctcm_test_and_set_busy(dev))
- return -EBUSY;
+ return NETDEV_TX_BUSY;
dev->trans_start = jiffies;
if (ctcm_transmit_skb(priv->channel[WRITE], skb) != 0)
- return 1;
+ return NETDEV_TX_BUSY;
return 0;
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 6/9] [PATCH] ctcm: avoid wraparound in length of incoming data
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
` (4 preceding siblings ...)
2009-03-24 12:29 ` [patch 5/9] [PATCH] ctcm: invalid return code " Ursula Braun
@ 2009-03-24 12:29 ` Ursula Braun
2009-03-24 12:29 ` [patch 7/9] [PATCH] ctcm: fix minor findings from code analysis tool Ursula Braun
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390
Cc: schwidefsky, heiko.carstens, Roel Kluin, Ursula Braun
[-- Attachment #1: 625-ctcm-wraparound.diff --]
[-- Type: text/plain, Size: 1746 bytes --]
From: Roel Kluin <roel.kluin@gmail.com>
Since the receive code should tolerate any incoming garbage, it
should be protected against a potential wraparound when manipulating
length values within incoming data.
block_len is unsigned, so a too large subtraction will cause a
wraparound.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/ctcm_fsms.c | 5 ++---
drivers/s390/net/ctcm_main.c | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)
diff -urpN linux-2.6/drivers/s390/net/ctcm_fsms.c linux-2.6-patched/drivers/s390/net/ctcm_fsms.c
--- linux-2.6/drivers/s390/net/ctcm_fsms.c 2009-03-19 11:15:52.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/ctcm_fsms.c 2009-03-19 11:16:39.000000000 +0100
@@ -410,9 +410,8 @@ static void chx_rx(fsm_instance *fi, int
priv->stats.rx_length_errors++;
goto again;
}
- block_len -= 2;
- if (block_len > 0) {
- *((__u16 *)skb->data) = block_len;
+ if (block_len > 2) {
+ *((__u16 *)skb->data) = block_len - 2;
ctcm_unpack_skb(ch, skb);
}
again:
diff -urpN linux-2.6/drivers/s390/net/ctcm_main.c linux-2.6-patched/drivers/s390/net/ctcm_main.c
--- linux-2.6/drivers/s390/net/ctcm_main.c 2009-03-19 11:16:39.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/ctcm_main.c 2009-03-19 11:16:39.000000000 +0100
@@ -105,7 +105,8 @@ void ctcm_unpack_skb(struct channel *ch,
return;
}
pskb->protocol = ntohs(header->type);
- if (header->length <= LL_HEADER_LENGTH) {
+ if ((header->length <= LL_HEADER_LENGTH) ||
+ (len <= LL_HEADER_LENGTH)) {
if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) {
CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR,
"%s(%s): Illegal packet size %d(%d,%d)"
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 7/9] [PATCH] ctcm: fix minor findings from code analysis tool
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
` (5 preceding siblings ...)
2009-03-24 12:29 ` [patch 6/9] [PATCH] ctcm: avoid wraparound in length of incoming data Ursula Braun
@ 2009-03-24 12:29 ` Ursula Braun
2009-03-24 12:29 ` [patch 8/9] [PATCH] kmsg: convert claw printk messages to kmsg api Ursula Braun
2009-03-24 12:29 ` [patch 9/9] [PATCH] claw: fix minor findings from code analysis tool Ursula Braun
8 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390
Cc: schwidefsky, heiko.carstens, Joel A. Fowler, Ursula Braun
[-- Attachment #1: 626-ctcm-beam.diff --]
[-- Type: text/plain, Size: 3262 bytes --]
From: Joel A. Fowler <fowlerja@us.ibm.com>
From: Ursula Braun <ursula.braun@de.ibm.com>
This patch fixes problems in the ctcm driver identified by
static code analysis:
o remove an unnecessary always true condition in ctcm_unpack_skb
o remove duplicate assignment in ctc_mpc_alloc_channel
o remove an unnecessary always true condition in ctcmpc_send_sweep_resp
o remove duplicate initialization in ctcmpc_unpack_skb
o shorten if condition in mpc_action_go_inop
o remove INOP event if mpc group is undefined in mpc_action_doxid7
Signed-off-by: Joel A. Fowler <fowlerja@us.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/ctcm_main.c | 8 +++-----
drivers/s390/net/ctcm_mpc.c | 17 +++++------------
2 files changed, 8 insertions(+), 17 deletions(-)
Index: linux-2.6-uschi/drivers/s390/net/ctcm_main.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/ctcm_main.c
+++ linux-2.6-uschi/drivers/s390/net/ctcm_main.c
@@ -168,11 +168,9 @@ void ctcm_unpack_skb(struct channel *ch,
if (len > 0) {
skb_pull(pskb, header->length);
if (skb_tailroom(pskb) < LL_HEADER_LENGTH) {
- if (!(ch->logflags & LOG_FLAG_OVERRUN)) {
- CTCM_DBF_DEV_NAME(TRACE, dev,
- "Overrun in ctcm_unpack_skb");
- ch->logflags |= LOG_FLAG_OVERRUN;
- }
+ CTCM_DBF_DEV_NAME(TRACE, dev,
+ "Overrun in ctcm_unpack_skb");
+ ch->logflags |= LOG_FLAG_OVERRUN;
return;
}
skb_put(pskb, LL_HEADER_LENGTH);
Index: linux-2.6-uschi/drivers/s390/net/ctcm_mpc.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/ctcm_mpc.c
+++ linux-2.6-uschi/drivers/s390/net/ctcm_mpc.c
@@ -393,7 +393,6 @@ int ctc_mpc_alloc_channel(int port_num,
} else {
/* there are problems...bail out */
/* there may be a state mismatch so restart */
- grp->port_persist = 1;
fsm_event(grp->fsm, MPCG_EVENT_INOP, dev);
grp->allocchan_callback_retries = 0;
}
@@ -699,11 +698,9 @@ static void ctcmpc_send_sweep_resp(struc
return;
done:
- if (rc != 0) {
- grp->in_sweep = 0;
- ctcm_clear_busy_do(dev);
- fsm_event(grp->fsm, MPCG_EVENT_INOP, dev);
- }
+ grp->in_sweep = 0;
+ ctcm_clear_busy_do(dev);
+ fsm_event(grp->fsm, MPCG_EVENT_INOP, dev);
return;
}
@@ -1118,7 +1115,6 @@ static void ctcmpc_unpack_skb(struct cha
if (unlikely(fsm_getstate(grp->fsm) != MPCG_STATE_READY))
goto done;
- pdu_last_seen = 0;
while ((pskb->len > 0) && !pdu_last_seen) {
curr_pdu = (struct pdu *)pskb->data;
@@ -1396,8 +1392,7 @@ static void mpc_action_go_inop(fsm_insta
CTCM_FUNTAIL, dev->name);
if ((grp->saved_state != MPCG_STATE_RESET) ||
/* dealloc_channel has been called */
- ((grp->saved_state == MPCG_STATE_RESET) &&
- (grp->port_persist == 0)))
+ (grp->port_persist == 0))
fsm_deltimer(&priv->restart_timer);
wch = priv->channel[WRITE];
@@ -1917,10 +1912,8 @@ static void mpc_action_doxid7(fsm_instan
if (priv)
grp = priv->mpcg;
- if (grp == NULL) {
- fsm_event(grp->fsm, MPCG_EVENT_INOP, dev);
+ if (grp == NULL)
return;
- }
for (direction = READ; direction <= WRITE; direction++) {
struct channel *ch = priv->channel[direction];
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 8/9] [PATCH] kmsg: convert claw printk messages to kmsg api.
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
` (6 preceding siblings ...)
2009-03-24 12:29 ` [patch 7/9] [PATCH] ctcm: fix minor findings from code analysis tool Ursula Braun
@ 2009-03-24 12:29 ` Ursula Braun
2009-03-24 12:29 ` [patch 9/9] [PATCH] claw: fix minor findings from code analysis tool Ursula Braun
8 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390
Cc: schwidefsky, heiko.carstens, Andy Richter, Ursula Braun
[-- Attachment #1: 627-kmsg-claw.diff --]
[-- Type: text/plain, Size: 35943 bytes --]
From: Andy Richter <richtera@us.ibm.com>
Signed-off-by: Andy Richter <richtera@us.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/claw.c | 428 +++++++++++++++++++++++++-----------------------
1 file changed, 231 insertions(+), 197 deletions(-)
diff -urpN linux-2.6/drivers/s390/net/claw.c linux-2.6-patched/drivers/s390/net/claw.c
--- linux-2.6/drivers/s390/net/claw.c 2009-03-19 11:16:39.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/claw.c 2009-03-19 11:16:40.000000000 +0100
@@ -60,6 +60,9 @@
* 1.25 Added Packing support
* 1.5
*/
+
+#define KMSG_COMPONENT "claw"
+
#include <asm/ccwdev.h>
#include <asm/ccwgroup.h>
#include <asm/debug.h>
@@ -94,7 +97,7 @@
CLAW uses the s390dbf file system see claw_trace and claw_setup
*/
-
+static char version[] __initdata = "CLAW driver";
static char debug_buffer[255];
/**
* Debug Facility Stuff
@@ -206,20 +209,30 @@ static struct net_device_stats *claw_sta
static int pages_to_order_of_mag(int num_of_pages);
static struct sk_buff *claw_pack_skb(struct claw_privbk *privptr);
/* sysfs Functions */
-static ssize_t claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_hname_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_hname_show(struct device *dev,
+ struct device_attribute *attr, char *buf);
+static ssize_t claw_hname_write(struct device *dev,
+ struct device_attribute *attr,
const char *buf, size_t count);
-static ssize_t claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_adname_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_adname_show(struct device *dev,
+ struct device_attribute *attr, char *buf);
+static ssize_t claw_adname_write(struct device *dev,
+ struct device_attribute *attr,
const char *buf, size_t count);
-static ssize_t claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_apname_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_apname_show(struct device *dev,
+ struct device_attribute *attr, char *buf);
+static ssize_t claw_apname_write(struct device *dev,
+ struct device_attribute *attr,
const char *buf, size_t count);
-static ssize_t claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_wbuff_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_wbuff_show(struct device *dev,
+ struct device_attribute *attr, char *buf);
+static ssize_t claw_wbuff_write(struct device *dev,
+ struct device_attribute *attr,
const char *buf, size_t count);
-static ssize_t claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_rbuff_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_rbuff_show(struct device *dev,
+ struct device_attribute *attr, char *buf);
+static ssize_t claw_rbuff_write(struct device *dev,
+ struct device_attribute *attr,
const char *buf, size_t count);
static int claw_add_files(struct device *dev);
static void claw_remove_files(struct device *dev);
@@ -298,8 +311,8 @@ claw_probe(struct ccwgroup_device *cgdev
if (rc) {
probe_error(cgdev);
put_device(&cgdev->dev);
- printk(KERN_WARNING "add_files failed %s %s Exit Line %d \n",
- dev_name(&cgdev->cdev[0]->dev), __func__, __LINE__);
+ dev_err(&cgdev->dev, "Creating the /proc files for a new"
+ " CLAW device failed\n");
CLAW_DBF_TEXT_(2, setup, "probex%d", rc);
return rc;
}
@@ -498,7 +511,8 @@ claw_open(struct net_device *dev)
~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) ||
(((privptr->channel[READ].flag |
privptr->channel[WRITE].flag) & CLAW_TIMER) != 0x00)) {
- printk(KERN_INFO "%s: remote side is not ready\n", dev->name);
+ dev_info(&privptr->channel[READ].cdev->dev,
+ "%s: remote side is not ready\n", dev->name);
CLAW_DBF_TEXT(2, trace, "notrdy");
for ( i = 0; i < 2; i++) {
@@ -584,10 +598,9 @@ claw_irq_handler(struct ccw_device *cdev
CLAW_DBF_TEXT(4, trace, "clawirq");
/* Bypass all 'unsolicited interrupts' */
if (!cdev->dev.driver_data) {
- printk(KERN_WARNING "claw: unsolicited interrupt for device:"
- "%s received c-%02x d-%02x\n",
- dev_name(&cdev->dev), irb->scsw.cmd.cstat,
- irb->scsw.cmd.dstat);
+ dev_warn(&cdev->dev, "An uninitialized CLAW device received an"
+ " IRQ, c-%02x d-%02x\n",
+ irb->scsw.cmd.cstat, irb->scsw.cmd.dstat);
CLAW_DBF_TEXT(2, trace, "badirq");
return;
}
@@ -599,8 +612,7 @@ claw_irq_handler(struct ccw_device *cdev
else if (privptr->channel[WRITE].cdev == cdev)
p_ch = &privptr->channel[WRITE];
else {
- printk(KERN_WARNING "claw: Can't determine channel for "
- "interrupt, device %s\n", dev_name(&cdev->dev));
+ dev_warn(&cdev->dev, "The device is not a CLAW device\n");
CLAW_DBF_TEXT(2, trace, "badchan");
return;
}
@@ -614,7 +626,8 @@ claw_irq_handler(struct ccw_device *cdev
/* Check for good subchannel return code, otherwise info message */
if (irb->scsw.cmd.cstat && !(irb->scsw.cmd.cstat & SCHN_STAT_PCI)) {
- printk(KERN_INFO "%s: subchannel check for device: %04x -"
+ dev_info(&cdev->dev,
+ "%s: subchannel check for device: %04x -"
" Sch Stat %02x Dev Stat %02x CPA - %04x\n",
dev->name, p_ch->devno,
irb->scsw.cmd.cstat, irb->scsw.cmd.dstat,
@@ -661,10 +674,9 @@ claw_irq_handler(struct ccw_device *cdev
p_env->host_name,
p_env->adapter_name);
} else {
- printk(KERN_WARNING "claw: unsolicited "
- "interrupt for device:"
- "%s received c-%02x d-%02x\n",
- dev_name(&cdev->dev),
+ dev_warn(&cdev->dev, "The CLAW device received"
+ " an unexpected IRQ, "
+ "c-%02x d-%02x\n",
irb->scsw.cmd.cstat,
irb->scsw.cmd.dstat);
return;
@@ -679,8 +691,8 @@ claw_irq_handler(struct ccw_device *cdev
(p_ch->irb->ecw[0] & 0x40) == 0x40 ||
(p_ch->irb->ecw[0]) == 0) {
privptr->stats.rx_errors++;
- printk(KERN_INFO "%s: Restart is "
- "required after remote "
+ dev_info(&cdev->dev,
+ "%s: Restart is required after remote "
"side recovers \n",
dev->name);
}
@@ -715,11 +727,13 @@ claw_irq_handler(struct ccw_device *cdev
return;
case CLAW_START_WRITE:
if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
- printk(KERN_INFO "%s: Unit Check Occured in "
+ dev_info(&cdev->dev,
+ "%s: Unit Check Occured in "
"write channel\n", dev->name);
clear_bit(0, (void *)&p_ch->IO_active);
if (p_ch->irb->ecw[0] & 0x80) {
- printk(KERN_INFO "%s: Resetting Event "
+ dev_info(&cdev->dev,
+ "%s: Resetting Event "
"occurred:\n", dev->name);
init_timer(&p_ch->timer);
p_ch->timer.function =
@@ -727,7 +741,8 @@ claw_irq_handler(struct ccw_device *cdev
p_ch->timer.data = (unsigned long)p_ch;
p_ch->timer.expires = jiffies + 10*HZ;
add_timer(&p_ch->timer);
- printk(KERN_INFO "%s: write connection "
+ dev_info(&cdev->dev,
+ "%s: write connection "
"restarting\n", dev->name);
}
CLAW_DBF_TEXT(4, trace, "rstrtwrt");
@@ -735,9 +750,10 @@ claw_irq_handler(struct ccw_device *cdev
}
if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) {
clear_bit(0, (void *)&p_ch->IO_active);
- printk(KERN_INFO "%s: Unit Exception "
- "Occured in write channel\n",
- dev->name);
+ dev_info(&cdev->dev,
+ "%s: Unit Exception "
+ "occurred in write channel\n",
+ dev->name);
}
if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) ||
(p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) ||
@@ -759,8 +775,9 @@ claw_irq_handler(struct ccw_device *cdev
CLAW_DBF_TEXT(4, trace, "StWtExit");
return;
default:
- printk(KERN_WARNING "%s: wrong selection code - irq "
- "state=%d\n", dev->name, p_ch->claw_state);
+ dev_warn(&cdev->dev,
+ "The CLAW device for %s received an unexpected IRQ\n",
+ dev->name, p_ch->claw_state);
CLAW_DBF_TEXT(2, trace, "badIRQ");
return;
}
@@ -912,8 +929,10 @@ claw_release(struct net_device *dev)
if (((privptr->channel[READ].last_dstat |
privptr->channel[WRITE].last_dstat) &
~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) {
- printk(KERN_WARNING "%s: channel problems during close - "
- "read: %02x - write: %02x\n",
+ dev_warn(&privptr->channel[READ].cdev->dev,
+ "Deactivating %s completed with incorrect"
+ " subchannel status "
+ "(read %02x, write %02x)\n",
dev->name,
privptr->channel[READ].last_dstat,
privptr->channel[WRITE].last_dstat);
@@ -1078,8 +1097,8 @@ add_claw_reads(struct net_device *dev, s
}
if ( privptr-> p_read_active_first ==NULL ) {
- privptr-> p_read_active_first= p_first; /* set new first */
- privptr-> p_read_active_last = p_last; /* set new last */
+ privptr-> p_read_active_first= p_first; /* set new first */
+ privptr-> p_read_active_last = p_last; /* set new last */
}
else {
@@ -1115,7 +1134,7 @@ add_claw_reads(struct net_device *dev, s
privptr->p_read_active_last->r_TIC_2.cda=
(__u32)__pa(&p_first->read);
}
- /* chain in new set of blocks */
+ /* chain in new set of blocks */
privptr->p_read_active_last->next = p_first;
privptr->p_read_active_last=p_last;
} /* end of if ( privptr-> p_read_active_first ==NULL) */
@@ -1137,21 +1156,18 @@ ccw_check_return_code(struct ccw_device
case -EBUSY: /* BUSY is a transient state no action needed */
break;
case -ENODEV:
- printk(KERN_EMERG "%s: Missing device called "
- "for IO ENODEV\n", dev_name(&cdev->dev));
- break;
- case -EIO:
- printk(KERN_EMERG "%s: Status pending... EIO \n",
- dev_name(&cdev->dev));
+ dev_err(&cdev->dev, "The remote channel adapter is not"
+ " available\n");
break;
case -EINVAL:
- printk(KERN_EMERG "%s: Invalid Dev State EINVAL \n",
- dev_name(&cdev->dev));
+ dev_err(&cdev->dev,
+ "The status of the remote channel adapter"
+ " is not valid\n");
break;
default:
- printk(KERN_EMERG "%s: Unknown error in "
- "Do_IO %d\n", dev_name(&cdev->dev),
- return_code);
+ dev_err(&cdev->dev, "The common device layer"
+ " returned error code %d\n",
+ return_code);
}
}
CLAW_DBF_TEXT(4, trace, "ccwret");
@@ -1165,40 +1181,41 @@ static void
ccw_check_unit_check(struct chbk * p_ch, unsigned char sense )
{
struct net_device *ndev = p_ch->ndev;
+ struct device *dev = &p_ch->cdev->dev;
CLAW_DBF_TEXT(4, trace, "unitchek");
- printk(KERN_INFO "%s: Unit Check with sense byte:0x%04x\n",
- ndev->name, sense);
+ dev_warn(dev, "The communication peer of %s disconnected\n",
+ ndev->name);
if (sense & 0x40) {
if (sense & 0x01) {
- printk(KERN_WARNING "%s: Interface disconnect or "
- "Selective reset "
- "occurred (remote side)\n", ndev->name);
- }
- else {
- printk(KERN_WARNING "%s: System reset occured"
- " (remote side)\n", ndev->name);
+ dev_warn(dev, "The remote channel adapter for"
+ " %s has been reset\n",
+ ndev->name);
}
}
else if (sense & 0x20) {
if (sense & 0x04) {
- printk(KERN_WARNING "%s: Data-streaming "
- "timeout)\n", ndev->name);
+ dev_warn(dev, "A data streaming timeout occurred"
+ " for %s\n",
+ ndev->name);
}
else {
- printk(KERN_WARNING "%s: Data-transfer parity"
- " error\n", ndev->name);
+ dev_warn(dev, "A data transfer parity error occurred"
+ " for %s\n",
+ ndev->name);
}
}
else if (sense & 0x10) {
if (sense & 0x20) {
- printk(KERN_WARNING "%s: Hardware malfunction "
- "(remote side)\n", ndev->name);
+ dev_warn(dev, "The remote channel adapter for %s"
+ " is faulty\n",
+ ndev->name);
}
else {
- printk(KERN_WARNING "%s: read-data parity error "
- "(remote side)\n", ndev->name);
+ dev_warn(dev, "A read data parity error occurred"
+ " for %s\n",
+ ndev->name);
}
}
@@ -1303,7 +1320,7 @@ claw_hw_tx(struct sk_buff *skb, struct n
if (privptr->write_free_count==0) {
ch = &privptr->channel[WRITE];
atomic_inc(&skb->users);
- skb_queue_tail(&ch->collect_queue, skb);
+ skb_queue_tail(&ch->collect_queue,skb);
goto Done;
}
else {
@@ -1377,7 +1394,7 @@ claw_hw_tx(struct sk_buff *skb, struct n
*/
if (p_first_ccw!=NULL) {
- /* setup ending ccw sequence for this segment */
+ /* setup ending ccw sequence for this segment */
pEnd=privptr->p_end_ccw;
if (pEnd->write1) {
pEnd->write1=0x00; /* second end ccw is now active */
@@ -1699,10 +1716,10 @@ init_ccw_bk(struct net_device *dev)
p_buf-> w_TIC_1.flags = 0;
p_buf-> w_TIC_1.count = 0;
- if (((unsigned long)p_buff+privptr->p_env->write_size) >=
+ if (((unsigned long)p_buff+privptr->p_env->write_size)>=
((unsigned long)(p_buff+2*
- (privptr->p_env->write_size) -1) & PAGE_MASK)) {
- p_buff= p_buff+privptr->p_env->write_size;
+ (privptr->p_env->write_size) -1) & PAGE_MASK)) {
+ p_buff= p_buff+privptr->p_env->write_size;
}
}
}
@@ -1842,15 +1859,16 @@ init_ccw_bk(struct net_device *dev)
p_buf->header.opcode=0xff;
p_buf->header.flag=CLAW_PENDING;
- if (((unsigned long)p_buff+privptr->p_env->read_size) >=
- ((unsigned long)(p_buff+2*(privptr->p_env->read_size) -1)
- & PAGE_MASK) ) {
+ if (((unsigned long)p_buff+privptr->p_env->read_size)>=
+ ((unsigned long)(p_buff+2*(privptr->p_env->read_size)
+ -1)
+ & PAGE_MASK) ) {
p_buff= p_buff+privptr->p_env->read_size;
}
else {
p_buff=
(void *)((unsigned long)
- (p_buff+2*(privptr->p_env->read_size) -1)
+ (p_buff+2*(privptr->p_env->read_size)-1)
& PAGE_MASK) ;
}
} /* for read_buffers */
@@ -1858,24 +1876,28 @@ init_ccw_bk(struct net_device *dev)
else { /* read Size >= PAGE_SIZE */
for (i=0 ; i< privptr->p_env->read_buffers ; i++) {
p_buff = (void *)__get_free_pages(__GFP_DMA,
- (int)pages_to_order_of_mag(privptr->p_buff_pages_perread) );
+ (int)pages_to_order_of_mag(
+ privptr->p_buff_pages_perread));
if (p_buff==NULL) {
free_pages((unsigned long)privptr->p_buff_ccw,
- (int)pages_to_order_of_mag(privptr->p_buff_ccw_num));
+ (int)pages_to_order_of_mag(privptr->
+ p_buff_ccw_num));
/* free the write pages */
p_buf=privptr->p_buff_write;
while (p_buf!=NULL) {
- free_pages((unsigned long)p_buf->p_buffer,
- (int)pages_to_order_of_mag(
- privptr->p_buff_pages_perwrite ));
+ free_pages(
+ (unsigned long)p_buf->p_buffer,
+ (int)pages_to_order_of_mag(
+ privptr->p_buff_pages_perwrite));
p_buf=p_buf->next;
}
/* free any read pages already alloc */
p_buf=privptr->p_buff_read;
while (p_buf!=NULL) {
- free_pages((unsigned long)p_buf->p_buffer,
- (int)pages_to_order_of_mag(
- privptr->p_buff_pages_perread ));
+ free_pages(
+ (unsigned long)p_buf->p_buffer,
+ (int)pages_to_order_of_mag(
+ privptr->p_buff_pages_perread ));
p_buf=p_buf->next;
}
privptr->p_buff_ccw=NULL;
@@ -2005,7 +2027,7 @@ claw_process_control( struct net_device
tdev = &privptr->channel[READ].cdev->dev;
memcpy( &temp_host_name, p_env->host_name, 8);
memcpy( &temp_ws_name, p_env->adapter_name , 8);
- printk(KERN_INFO "%s: CLAW device %.8s: "
+ dev_info(tdev, "%s: CLAW device %.8s: "
"Received Control Packet\n",
dev->name, temp_ws_name);
if (privptr->release_pend==1) {
@@ -2024,32 +2046,31 @@ claw_process_control( struct net_device
if (p_ctlbk->version != CLAW_VERSION_ID) {
claw_snd_sys_validate_rsp(dev, p_ctlbk,
CLAW_RC_WRONG_VERSION);
- printk("%s: %d is wrong version id. "
- "Expected %d\n",
- dev->name, p_ctlbk->version,
- CLAW_VERSION_ID);
+ dev_warn(tdev, "The communication peer of %s"
+ " uses an incorrect API version %d\n",
+ dev->name, p_ctlbk->version,
+ CLAW_VERSION_ID);
}
p_sysval = (struct sysval *)&(p_ctlbk->data);
- printk("%s: Recv Sys Validate Request: "
- "Vers=%d,link_id=%d,Corr=%d,WS name=%."
- "8s,Host name=%.8s\n",
- dev->name, p_ctlbk->version,
- p_ctlbk->linkid,
- p_ctlbk->correlator,
- p_sysval->WS_name,
- p_sysval->host_name);
+ dev_info(tdev, "%s: Recv Sys Validate Request: "
+ "Vers=%d,link_id=%d,Corr=%d,WS name=%.8s,"
+ "Host name=%.8s\n",
+ dev->name, p_ctlbk->version,
+ p_ctlbk->linkid,
+ p_ctlbk->correlator,
+ p_sysval->WS_name,
+ p_sysval->host_name);
if (memcmp(temp_host_name, p_sysval->host_name, 8)) {
claw_snd_sys_validate_rsp(dev, p_ctlbk,
CLAW_RC_NAME_MISMATCH);
CLAW_DBF_TEXT(2, setup, "HSTBAD");
CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->host_name);
CLAW_DBF_TEXT_(2, setup, "%s", temp_host_name);
- printk(KERN_INFO "%s: Host name mismatch\n",
- dev->name);
- printk(KERN_INFO "%s: Received :%s: "
- "expected :%s: \n",
- dev->name,
+ dev_warn(tdev,
+ "Host name %s for %s does not match the"
+ " remote adapter name %s\n",
p_sysval->host_name,
+ dev->name,
temp_host_name);
}
if (memcmp(temp_ws_name, p_sysval->WS_name, 8)) {
@@ -2058,35 +2079,38 @@ claw_process_control( struct net_device
CLAW_DBF_TEXT(2, setup, "WSNBAD");
CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->WS_name);
CLAW_DBF_TEXT_(2, setup, "%s", temp_ws_name);
- printk(KERN_INFO "%s: WS name mismatch\n",
- dev->name);
- printk(KERN_INFO "%s: Received :%s: "
- "expected :%s: \n",
- dev->name,
- p_sysval->WS_name,
- temp_ws_name);
+ dev_warn(tdev, "Adapter name %s for %s does not match"
+ " the remote host name %s\n",
+ p_sysval->WS_name,
+ dev->name,
+ temp_ws_name);
}
if ((p_sysval->write_frame_size < p_env->write_size) &&
(p_env->packing == 0)) {
claw_snd_sys_validate_rsp(dev, p_ctlbk,
CLAW_RC_HOST_RCV_TOO_SMALL);
- printk(KERN_INFO "%s: host write size is too "
- "small\n", dev->name);
+ dev_warn(tdev,
+ "The local write buffer is smaller than the"
+ " remote read buffer\n");
CLAW_DBF_TEXT(2, setup, "wrtszbad");
}
if ((p_sysval->read_frame_size < p_env->read_size) &&
(p_env->packing == 0)) {
claw_snd_sys_validate_rsp(dev, p_ctlbk,
CLAW_RC_HOST_RCV_TOO_SMALL);
- printk(KERN_INFO "%s: host read size is too "
- "small\n", dev->name);
+ dev_warn(tdev,
+ "The local read buffer is smaller than the"
+ " remote write buffer\n");
CLAW_DBF_TEXT(2, setup, "rdsizbad");
}
claw_snd_sys_validate_rsp(dev, p_ctlbk, 0);
- printk(KERN_INFO "%s: CLAW device %.8s: System validate "
- "completed.\n", dev->name, temp_ws_name);
- printk("%s: sys Validate Rsize:%d Wsize:%d\n", dev->name,
- p_sysval->read_frame_size, p_sysval->write_frame_size);
+ dev_info(tdev,
+ "CLAW device %.8s: System validate"
+ " completed.\n", temp_ws_name);
+ dev_info(tdev,
+ "%s: sys Validate Rsize:%d Wsize:%d\n",
+ dev->name, p_sysval->read_frame_size,
+ p_sysval->write_frame_size);
privptr->system_validate_comp = 1;
if (strncmp(p_env->api_type, WS_APPL_NAME_PACKED, 6) == 0)
p_env->packing = PACKING_ASK;
@@ -2094,9 +2118,10 @@ claw_process_control( struct net_device
break;
case SYSTEM_VALIDATE_RESPONSE:
p_sysval = (struct sysval *)&(p_ctlbk->data);
- printk("%s: Recv Sys Validate Resp: Vers=%d,Corr=%d,RC=%d,"
- "WS name=%.8s,Host name=%.8s\n",
- dev->name,
+ dev_info(tdev,
+ "Settings for %s validated (version=%d, "
+ "remote device=%d, rc=%d, adapter name=%.8s, "
+ "host name=%.8s)\n",
p_ctlbk->version,
p_ctlbk->correlator,
p_ctlbk->rc,
@@ -2104,41 +2129,39 @@ claw_process_control( struct net_device
p_sysval->host_name);
switch (p_ctlbk->rc) {
case 0:
- printk(KERN_INFO "%s: CLAW device "
- "%.8s: System validate "
- "completed.\n",
- dev->name, temp_ws_name);
+ dev_info(tdev, "%s: CLAW device "
+ "%.8s: System validate completed.\n",
+ dev->name, temp_ws_name);
if (privptr->system_validate_comp == 0)
claw_strt_conn_req(dev);
privptr->system_validate_comp = 1;
break;
case CLAW_RC_NAME_MISMATCH:
- printk(KERN_INFO "%s: Sys Validate "
- "Resp : Host, WS name is "
- "mismatch\n",
- dev->name);
+ dev_warn(tdev, "Validating %s failed because of"
+ " a host or adapter name mismatch\n",
+ dev->name);
break;
case CLAW_RC_WRONG_VERSION:
- printk(KERN_INFO "%s: Sys Validate "
- "Resp : Wrong version\n",
+ dev_warn(tdev, "Validating %s failed because of a"
+ " version conflict\n",
dev->name);
break;
case CLAW_RC_HOST_RCV_TOO_SMALL:
- printk(KERN_INFO "%s: Sys Validate "
- "Resp : bad frame size\n",
+ dev_warn(tdev, "Validating %s failed because of a"
+ " frame size conflict\n",
dev->name);
break;
default:
- printk(KERN_INFO "%s: Sys Validate "
- "error code=%d \n",
- dev->name, p_ctlbk->rc);
+ dev_warn(tdev, "The communication peer of %s rejected"
+ " the connection\n",
+ dev->name);
break;
}
break;
case CONNECTION_REQUEST:
p_connect = (struct conncmd *)&(p_ctlbk->data);
- printk(KERN_INFO "%s: Recv Conn Req: Vers=%d,link_id=%d,"
+ dev_info(tdev, "%s: Recv Conn Req: Vers=%d,link_id=%d,"
"Corr=%d,HOST appl=%.8s,WS appl=%.8s\n",
dev->name,
p_ctlbk->version,
@@ -2148,21 +2171,21 @@ claw_process_control( struct net_device
p_connect->WS_name);
if (privptr->active_link_ID != 0) {
claw_snd_disc(dev, p_ctlbk);
- printk(KERN_INFO "%s: Conn Req error : "
- "already logical link is active \n",
+ dev_info(tdev, "%s rejected a connection request"
+ " because it is already active\n",
dev->name);
}
if (p_ctlbk->linkid != 1) {
claw_snd_disc(dev, p_ctlbk);
- printk(KERN_INFO "%s: Conn Req error : "
- "req logical link id is not 1\n",
+ dev_info(tdev, "%s rejected a request to open multiple"
+ " connections\n",
dev->name);
}
rc = find_link(dev, p_connect->host_name, p_connect->WS_name);
if (rc != 0) {
claw_snd_disc(dev, p_ctlbk);
- printk(KERN_INFO "%s: Conn Resp error: "
- "req appl name does not match\n",
+ dev_info(tdev, "%s rejected a connection request"
+ " because of a type mismatch\n",
dev->name);
}
claw_send_control(dev,
@@ -2174,7 +2197,7 @@ claw_process_control( struct net_device
p_env->packing = PACK_SEND;
claw_snd_conn_req(dev, 0);
}
- printk(KERN_INFO "%s: CLAW device %.8s: Connection "
+ dev_info(tdev, "%s: CLAW device %.8s: Connection "
"completed link_id=%d.\n",
dev->name, temp_ws_name,
p_ctlbk->linkid);
@@ -2184,7 +2207,7 @@ claw_process_control( struct net_device
break;
case CONNECTION_RESPONSE:
p_connect = (struct conncmd *)&(p_ctlbk->data);
- printk(KERN_INFO "%s: Revc Conn Resp: Vers=%d,link_id=%d,"
+ dev_info(tdev, "%s: Recv Conn Resp: Vers=%d,link_id=%d,"
"Corr=%d,RC=%d,Host appl=%.8s, WS appl=%.8s\n",
dev->name,
p_ctlbk->version,
@@ -2195,16 +2218,18 @@ claw_process_control( struct net_device
p_connect->WS_name);
if (p_ctlbk->rc != 0) {
- printk(KERN_INFO "%s: Conn Resp error: rc=%d \n",
- dev->name, p_ctlbk->rc);
+ dev_warn(tdev, "The communication peer of %s rejected"
+ " a connection request\n",
+ dev->name);
return 1;
}
rc = find_link(dev,
p_connect->host_name, p_connect->WS_name);
if (rc != 0) {
claw_snd_disc(dev, p_ctlbk);
- printk(KERN_INFO "%s: Conn Resp error: "
- "req appl name does not match\n",
+ dev_warn(tdev, "The communication peer of %s"
+ " rejected a connection "
+ "request because of a type mismatch\n",
dev->name);
}
/* should be until CONNECTION_CONFIRM */
@@ -2212,7 +2237,8 @@ claw_process_control( struct net_device
break;
case CONNECTION_CONFIRM:
p_connect = (struct conncmd *)&(p_ctlbk->data);
- printk(KERN_INFO "%s: Recv Conn Confirm:Vers=%d,link_id=%d,"
+ dev_info(tdev,
+ "%s: Recv Conn Confirm:Vers=%d,link_id=%d,"
"Corr=%d,Host appl=%.8s,WS appl=%.8s\n",
dev->name,
p_ctlbk->version,
@@ -2223,21 +2249,21 @@ claw_process_control( struct net_device
if (p_ctlbk->linkid == -(privptr->active_link_ID)) {
privptr->active_link_ID = p_ctlbk->linkid;
if (p_env->packing > PACKING_ASK) {
- printk(KERN_INFO "%s: Confirmed Now packing\n",
- dev->name);
+ dev_info(tdev,
+ "%s: Confirmed Now packing\n", dev->name);
p_env->packing = DO_PACKED;
}
p_ch = &privptr->channel[WRITE];
wake_up(&p_ch->wait);
} else {
- printk(KERN_INFO "%s: Conn confirm: "
- "unexpected linkid=%d \n",
+ dev_warn(tdev, "Activating %s failed because of"
+ " an incorrect link ID=%d\n",
dev->name, p_ctlbk->linkid);
claw_snd_disc(dev, p_ctlbk);
}
break;
case DISCONNECT:
- printk(KERN_INFO "%s: Disconnect: "
+ dev_info(tdev, "%s: Disconnect: "
"Vers=%d,link_id=%d,Corr=%d\n",
dev->name, p_ctlbk->version,
p_ctlbk->linkid, p_ctlbk->correlator);
@@ -2249,12 +2275,13 @@ claw_process_control( struct net_device
privptr->active_link_ID = 0;
break;
case CLAW_ERROR:
- printk(KERN_INFO "%s: CLAW ERROR detected\n",
+ dev_warn(tdev, "The communication peer of %s failed\n",
dev->name);
break;
default:
- printk(KERN_INFO "%s: Unexpected command code=%d \n",
- dev->name, p_ctlbk->command);
+ dev_warn(tdev, "The communication peer of %s sent"
+ " an unknown command code\n",
+ dev->name);
break;
}
@@ -2296,12 +2323,14 @@ claw_send_control(struct net_device *dev
memcpy(&p_sysval->host_name, local_name, 8);
memcpy(&p_sysval->WS_name, remote_name, 8);
if (privptr->p_env->packing > 0) {
- p_sysval->read_frame_size=DEF_PACK_BUFSIZE;
+ p_sysval->read_frame_size=DEF_PACK_BUFSIZE;
p_sysval->write_frame_size=DEF_PACK_BUFSIZE;
} else {
/* how big is the biggest group of packets */
- p_sysval->read_frame_size=privptr->p_env->read_size;
- p_sysval->write_frame_size=privptr->p_env->write_size;
+ p_sysval->read_frame_size =
+ privptr->p_env->read_size;
+ p_sysval->write_frame_size =
+ privptr->p_env->write_size;
}
memset(&p_sysval->reserved, 0x00, 4);
break;
@@ -2513,8 +2542,10 @@ unpack_read(struct net_device *dev )
mtc_this_frm=1;
if (p_this_ccw->header.length!=
privptr->p_env->read_size ) {
- printk(KERN_INFO " %s: Invalid frame detected "
- "length is %02x\n" ,
+ dev_warn(p_dev,
+ "The communication peer of %s"
+ " sent a faulty"
+ " frame of length %02x\n",
dev->name, p_this_ccw->header.length);
}
}
@@ -2546,7 +2577,7 @@ unpack_next:
goto NextFrame;
p_packd = p_this_ccw->p_buffer+pack_off;
p_packh = (struct clawph *) p_packd;
- if ((p_packh->len == 0) || /* all done with this frame? */
+ if ((p_packh->len == 0) || /* done with this frame? */
(p_packh->flag != 0))
goto NextFrame;
bytes_to_mov = p_packh->len;
@@ -2596,9 +2627,9 @@ unpack_next:
netif_rx(skb);
}
else {
+ dev_info(p_dev, "Allocating a buffer for"
+ " incoming data failed\n");
privptr->stats.rx_dropped++;
- printk(KERN_WARNING "%s: %s() low on memory\n",
- dev->name,__func__);
}
privptr->mtc_offset=0;
privptr->mtc_logical_link=-1;
@@ -2722,7 +2753,7 @@ claw_strt_out_IO( struct net_device *dev
if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) {
parm = (unsigned long) p_ch;
CLAW_DBF_TEXT(2, trace, "StWrtIO");
- rc = ccw_device_start (p_ch->cdev,&p_first_ccw->write, parm,
+ rc = ccw_device_start (p_ch->cdev,&p_first_ccw->write,parm,
0xff, 0);
if (rc != 0) {
ccw_check_return_code(p_ch->cdev, rc);
@@ -2882,8 +2913,8 @@ claw_new_device(struct ccwgroup_device *
int ret;
struct ccw_dev_id dev_id;
- printk(KERN_INFO "claw: add for %s\n",
- dev_name(&cgdev->cdev[READ]->dev));
+ dev_info(&cgdev->dev, "add for %s\n",
+ dev_name(&cgdev->cdev[READ]->dev));
CLAW_DBF_TEXT(2, setup, "new_dev");
privptr = cgdev->dev.driver_data;
cgdev->cdev[READ]->dev.driver_data = privptr;
@@ -2899,29 +2930,28 @@ claw_new_device(struct ccwgroup_device *
if (ret == 0)
ret = add_channel(cgdev->cdev[1],1,privptr);
if (ret != 0) {
- printk(KERN_WARNING
- "add channel failed with ret = %d\n", ret);
+ dev_warn(&cgdev->dev, "Creating a CLAW group device"
+ " failed with error code %d\n", ret);
goto out;
}
ret = ccw_device_set_online(cgdev->cdev[READ]);
if (ret != 0) {
- printk(KERN_WARNING
- "claw: ccw_device_set_online %s READ failed "
- "with ret = %d\n", dev_name(&cgdev->cdev[READ]->dev),
- ret);
+ dev_warn(&cgdev->dev,
+ "Setting the read subchannel online"
+ " failed with error code %d\n", ret);
goto out;
}
ret = ccw_device_set_online(cgdev->cdev[WRITE]);
if (ret != 0) {
- printk(KERN_WARNING
- "claw: ccw_device_set_online %s WRITE failed "
- "with ret = %d\n", dev_name(&cgdev->cdev[WRITE]->dev),
- ret);
+ dev_warn(&cgdev->dev,
+ "Setting the write subchannel online "
+ "failed with error code %d\n", ret);
goto out;
}
dev = alloc_netdev(0,"claw%d",claw_init_netdevice);
if (!dev) {
- printk(KERN_WARNING "%s:alloc_netdev failed\n",__func__);
+ dev_warn(&cgdev->dev,
+ "Activating the CLAW device failed\n");
goto out;
}
dev->ml_priv = privptr;
@@ -2949,13 +2979,13 @@ claw_new_device(struct ccwgroup_device *
privptr->channel[WRITE].ndev = dev;
privptr->p_env->ndev = dev;
- printk(KERN_INFO "%s:readsize=%d writesize=%d "
+ dev_info(&cgdev->dev, "%s:readsize=%d writesize=%d "
"readbuffer=%d writebuffer=%d read=0x%04x write=0x%04x\n",
dev->name, p_env->read_size,
p_env->write_size, p_env->read_buffers,
p_env->write_buffers, p_env->devno[READ],
p_env->devno[WRITE]);
- printk(KERN_INFO "%s:host_name:%.8s, adapter_name "
+ dev_info(&cgdev->dev, "%s:host_name:%.8s, adapter_name "
":%.8s api_type: %.8s\n",
dev->name, p_env->host_name,
p_env->adapter_name , p_env->api_type);
@@ -2999,8 +3029,8 @@ claw_shutdown_device(struct ccwgroup_dev
ndev = priv->channel[READ].ndev;
if (ndev) {
/* Close the device */
- printk(KERN_INFO
- "%s: shuting down \n",ndev->name);
+ dev_info(&cgdev->dev, "%s: shutting down \n",
+ ndev->name);
if (ndev->flags & IFF_RUNNING)
ret = claw_release(ndev);
ndev->flags &=~IFF_RUNNING;
@@ -3025,8 +3055,7 @@ claw_remove_device(struct ccwgroup_devic
CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev));
priv = cgdev->dev.driver_data;
BUG_ON(!priv);
- printk(KERN_INFO "claw: %s() called %s will be removed.\n",
- __func__, dev_name(&cgdev->cdev[0]->dev));
+ dev_info(&cgdev->dev, " will be removed.\n");
if (cgdev->state == CCWGROUP_ONLINE)
claw_shutdown_device(cgdev);
claw_remove_files(&cgdev->dev);
@@ -3065,7 +3094,8 @@ claw_hname_show(struct device *dev, stru
}
static ssize_t
-claw_hname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_hname_write(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct claw_privbk *priv;
struct claw_env * p_env;
@@ -3102,7 +3132,8 @@ claw_adname_show(struct device *dev, str
}
static ssize_t
-claw_adname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_adname_write(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct claw_privbk *priv;
struct claw_env * p_env;
@@ -3140,7 +3171,8 @@ claw_apname_show(struct device *dev, str
}
static ssize_t
-claw_apname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_apname_write(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct claw_privbk *priv;
struct claw_env * p_env;
@@ -3187,7 +3219,8 @@ claw_wbuff_show(struct device *dev, stru
}
static ssize_t
-claw_wbuff_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_wbuff_write(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct claw_privbk *priv;
struct claw_env * p_env;
@@ -3228,7 +3261,8 @@ claw_rbuff_show(struct device *dev, stru
}
static ssize_t
-claw_rbuff_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_rbuff_write(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct claw_privbk *priv;
struct claw_env *p_env;
@@ -3291,7 +3325,7 @@ claw_cleanup(void)
{
unregister_cu3088_discipline(&claw_group_driver);
claw_unregister_debug_facility();
- printk(KERN_INFO "claw: Driver unloaded\n");
+ pr_info("Driver unloaded\n");
}
@@ -3305,12 +3339,12 @@ static int __init
claw_init(void)
{
int ret = 0;
- printk(KERN_INFO "claw: starting driver\n");
+ pr_info("Loading %s\n", version);
ret = claw_register_debug_facility();
if (ret) {
- printk(KERN_WARNING "claw: %s() debug_register failed %d\n",
- __func__,ret);
+ pr_err("Registering with the S/390 debug feature"
+ " failed with error code %d\n", ret);
return ret;
}
CLAW_DBF_TEXT(2, setup, "init_mod");
@@ -3318,8 +3352,8 @@ claw_init(void)
if (ret) {
CLAW_DBF_TEXT(2, setup, "init_bad");
claw_unregister_debug_facility();
- printk(KERN_WARNING "claw; %s() cu3088 register failed %d\n",
- __func__,ret);
+ pr_err("Registering with the cu3088 device driver failed "
+ "with error code %d\n", ret);
}
return ret;
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 9/9] [PATCH] claw: fix minor findings from code analysis tool
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
` (7 preceding siblings ...)
2009-03-24 12:29 ` [patch 8/9] [PATCH] kmsg: convert claw printk messages to kmsg api Ursula Braun
@ 2009-03-24 12:29 ` Ursula Braun
8 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 12:29 UTC (permalink / raw)
To: davem, netdev, linux-s390
Cc: schwidefsky, heiko.carstens, Andrew H. Richter, Ursula Braun
[-- Attachment #1: 628-claw-beam.diff --]
[-- Type: text/plain, Size: 3502 bytes --]
From: Andrew H. Richter <richtera@us.ibm.com>
This patch fixes two problems in the claw driver identified by
static code analysis:
o Change in case differentiation of received sense codes
o Use correct data length in claw hard_start_xmit routine
Signed-off-by: Andrew H. Richter <richtera@us.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/claw.c | 44 ++++++++++++++++++++------------------------
1 file changed, 20 insertions(+), 24 deletions(-)
diff -urpN linux-2.6/drivers/s390/net/claw.c linux-2.6-patched/drivers/s390/net/claw.c
--- linux-2.6/drivers/s390/net/claw.c 2009-03-19 11:16:40.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/claw.c 2009-03-19 11:16:40.000000000 +0100
@@ -1033,7 +1033,7 @@ static int
pages_to_order_of_mag(int num_of_pages)
{
int order_of_mag=1; /* assume 2 pages */
- int nump=2;
+ int nump;
CLAW_DBF_TEXT_(5, trace, "pages%d", num_of_pages);
if (num_of_pages == 1) {return 0; } /* magnitude of 0 = 1 page */
@@ -1187,37 +1187,31 @@ ccw_check_unit_check(struct chbk * p_ch,
dev_warn(dev, "The communication peer of %s disconnected\n",
ndev->name);
- if (sense & 0x40) {
- if (sense & 0x01) {
+ if (sense & 0x40) {
+ if (sense & 0x01) {
dev_warn(dev, "The remote channel adapter for"
" %s has been reset\n",
ndev->name);
- }
- }
- else if (sense & 0x20) {
- if (sense & 0x04) {
+ }
+ } else if (sense & 0x20) {
+ if (sense & 0x04) {
dev_warn(dev, "A data streaming timeout occurred"
" for %s\n",
ndev->name);
- }
- else {
- dev_warn(dev, "A data transfer parity error occurred"
- " for %s\n",
- ndev->name);
- }
- }
- else if (sense & 0x10) {
- if (sense & 0x20) {
+ } else if (sense & 0x10) {
dev_warn(dev, "The remote channel adapter for %s"
" is faulty\n",
ndev->name);
- }
- else {
- dev_warn(dev, "A read data parity error occurred"
+ } else {
+ dev_warn(dev, "A data transfer parity error occurred"
" for %s\n",
ndev->name);
- }
- }
+ }
+ } else if (sense & 0x10) {
+ dev_warn(dev, "A read data parity error occurred"
+ " for %s\n",
+ ndev->name);
+ }
} /* end of ccw_check_unit_check */
@@ -1254,7 +1248,7 @@ find_link(struct net_device *dev, char *
break;
}
- return 0;
+ return rc;
} /* end of find_link */
/*-------------------------------------------------------------------*
@@ -1366,7 +1360,10 @@ claw_hw_tx(struct sk_buff *skb, struct n
privptr->p_write_free_chain=p_this_ccw->next;
p_this_ccw->next=NULL;
--privptr->write_free_count; /* -1 */
- bytesInThisBuffer=len_of_data;
+ if (len_of_data >= privptr->p_env->write_size)
+ bytesInThisBuffer = privptr->p_env->write_size;
+ else
+ bytesInThisBuffer = len_of_data;
memcpy( p_this_ccw->p_buffer,pDataAddress, bytesInThisBuffer);
len_of_data-=bytesInThisBuffer;
pDataAddress+=(unsigned long)bytesInThisBuffer;
@@ -2516,7 +2513,6 @@ unpack_read(struct net_device *dev )
p_dev = &privptr->channel[READ].cdev->dev;
p_env = privptr->p_env;
p_this_ccw=privptr->p_read_active_first;
- i=0;
while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) {
pack_off = 0;
p = 0;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [patch 6/9] [PATCH] ctcm: avoid wraparound in length of incoming data
2009-03-24 13:27 [patch 0/9] [RESEND] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
@ 2009-03-24 13:27 ` Ursula Braun
0 siblings, 0 replies; 11+ messages in thread
From: Ursula Braun @ 2009-03-24 13:27 UTC (permalink / raw)
To: davem, netdev, linux-s390
Cc: schwidefsky, heiko.carstens, Roel Kluin, Ursula Braun
[-- Attachment #1: 625-ctcm-wraparound.diff --]
[-- Type: text/plain, Size: 1746 bytes --]
From: Roel Kluin <roel.kluin@gmail.com>
Since the receive code should tolerate any incoming garbage, it
should be protected against a potential wraparound when manipulating
length values within incoming data.
block_len is unsigned, so a too large subtraction will cause a
wraparound.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
drivers/s390/net/ctcm_fsms.c | 5 ++---
drivers/s390/net/ctcm_main.c | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)
diff -urpN linux-2.6/drivers/s390/net/ctcm_fsms.c linux-2.6-patched/drivers/s390/net/ctcm_fsms.c
--- linux-2.6/drivers/s390/net/ctcm_fsms.c 2009-03-19 11:15:52.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/ctcm_fsms.c 2009-03-19 11:16:39.000000000 +0100
@@ -410,9 +410,8 @@ static void chx_rx(fsm_instance *fi, int
priv->stats.rx_length_errors++;
goto again;
}
- block_len -= 2;
- if (block_len > 0) {
- *((__u16 *)skb->data) = block_len;
+ if (block_len > 2) {
+ *((__u16 *)skb->data) = block_len - 2;
ctcm_unpack_skb(ch, skb);
}
again:
diff -urpN linux-2.6/drivers/s390/net/ctcm_main.c linux-2.6-patched/drivers/s390/net/ctcm_main.c
--- linux-2.6/drivers/s390/net/ctcm_main.c 2009-03-19 11:16:39.000000000 +0100
+++ linux-2.6-patched/drivers/s390/net/ctcm_main.c 2009-03-19 11:16:39.000000000 +0100
@@ -105,7 +105,8 @@ void ctcm_unpack_skb(struct channel *ch,
return;
}
pskb->protocol = ntohs(header->type);
- if (header->length <= LL_HEADER_LENGTH) {
+ if ((header->length <= LL_HEADER_LENGTH) ||
+ (len <= LL_HEADER_LENGTH)) {
if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) {
CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR,
"%s(%s): Illegal packet size %d(%d,%d)"
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2009-03-24 13:27 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-24 12:29 [patch 0/9] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
2009-03-24 12:29 ` [patch 1/9] [PATCH] Use kthread instead of kernel_thread Ursula Braun
2009-03-24 12:29 ` [patch 2/9] [PATCH] lcs: invalid return codes from hard_start_xmit Ursula Braun
2009-03-24 12:29 ` [patch 3/9] [PATCH] netiucv: invalid return code " Ursula Braun
2009-03-24 12:29 ` [patch 4/9] [PATCH] claw: invalid return codes " Ursula Braun
2009-03-24 12:29 ` [patch 5/9] [PATCH] ctcm: invalid return code " Ursula Braun
2009-03-24 12:29 ` [patch 6/9] [PATCH] ctcm: avoid wraparound in length of incoming data Ursula Braun
2009-03-24 12:29 ` [patch 7/9] [PATCH] ctcm: fix minor findings from code analysis tool Ursula Braun
2009-03-24 12:29 ` [patch 8/9] [PATCH] kmsg: convert claw printk messages to kmsg api Ursula Braun
2009-03-24 12:29 ` [patch 9/9] [PATCH] claw: fix minor findings from code analysis tool Ursula Braun
-- strict thread matches above, loose matches on Subject: below --
2009-03-24 13:27 [patch 0/9] [RESEND] s390: lcs / ctcm / claw / netiucv patches for 2.6.29 Ursula Braun
2009-03-24 13:27 ` [patch 6/9] [PATCH] ctcm: avoid wraparound in length of incoming data Ursula Braun
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.