s390: network driver fixes for net-next
Subsystems (5)
cover s390: network driver fixes for net-next
Hi Dave,
here is a couple of s390 network driver fixes for net-next
shortlog:
Ursula Braun (4)af_iucv: handle netdev eventsaf_iucv: add shutdown for HS transport
ctcm: make ctcmpc debugging compilable
qeth: meaningful return code for set_mac_address
Frank Blaschka (1)
qeth: synchronize discipline module loading
Belinda Thompson(1)
ctcm: use correct idal word list for ctcmpc
Klaus-Dieter Wacker (1)
lcs: Return zero from ccwgroup devs set_offline function
Thanks,
Frank
PATCH 1/7 af_iucv: handle netdev events
From: Ursula Braun <[email protected]>
In case of transport through HiperSockets the underlying network interface may switch to DOWN state or the underlying network device may recover. In both cases the socket must change to IUCV_DISCONN state. If the interface goes down, af_iucv has a chance to notify its connection peer in addition.
---
net/iucv/af_iucv.c | 106 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 44 deletions(-)
net/iucv/af_iucv.c +62 -44
@@ -453,14 +453,28 @@ static void iucv_sever_path(struct sock } } +/* Send FIN through an IUCV socket for HIPER transport */ +static int iucv_send_ctrl (struct sock *sk,u8 flags) +{ +int err =0 ; +int blen; +struct sk_buff *skb; + + blen =sizeof (struct af_iucv_trans_hdr ) +ETH_HLEN ; + skb =sock_alloc_send_skb (sk, blen,1 , &err); +if (skb) { +skb_reserve (skb, blen); + err =afiucv_hs_send (NULL , sk, skb, flags); + } +return err; +} +/* Close an IUCV socket */ static void iucv_sock_close (struct sock *sk) {struct iucv_sock *iucv =iucv_sk (sk);unsigned long timeo;int err =0 ; -int blen; -struct sk_buff *skb;lock_sock (sk);
@@ -471,14 +485,7 @@ static void iucv_sock_close(struct sockcase IUCV_CONNECTED :if (iucv->transport ==AF_IUCV_TRANS_HIPER ) { -/* send fin */ - blen =sizeof (struct af_iucv_trans_hdr ) +ETH_HLEN ; - skb =sock_alloc_send_skb (sk, blen,1 , &err); -if (skb) { -skb_reserve (skb, blen); - err =afiucv_hs_send (NULL , sk, skb, -AF_IUCV_FLAG_FIN ); - } + err =iucv_send_ctrl (sk,AF_IUCV_FLAG_FIN ); sk->sk_state =IUCV_DISCONN ; sk->sk_state_change (sk); }
@@ -782,26 +789,6 @@ static int iucv_sock_autobind(struct socreturn err; } -static int afiucv_hs_connect (struct socket *sock) -{ -struct sock *sk = sock->sk; -struct sk_buff *skb; -int blen =sizeof (struct af_iucv_trans_hdr ) +ETH_HLEN ; -int err =0 ; - -/* send syn */ - skb =sock_alloc_send_skb (sk, blen,1 , &err); -if (!skb) { - err = -ENOMEM ; - goto done; - } - skb->dev =NULL ; -skb_reserve (skb, blen); - err =afiucv_hs_send (NULL , sk, skb,AF_IUCV_FLAG_SYN ); -done: -return err; -} -static int afiucv_path_connect (struct socket *sock,struct sockaddr *addr) {struct sockaddr_iucv *sa = (struct sockaddr_iucv *) addr;
@@ -882,7 +869,7 @@ static int iucv_sock_connect(struct sockmemcpy (iucv->dst_name, sa->siucv_name,8 );if (iucv->transport ==AF_IUCV_TRANS_HIPER ) - err =afiucv_hs_connect (sock); + err =iucv_send_ctrl (sock->sk,AF_IUCV_FLAG_SYN );else err =afiucv_path_connect (sock, addr);if (err)
@@ -1332,8 +1319,7 @@ static int iucv_sock_recvmsg(struct kiocstruct sock *sk = sock->sk;struct iucv_sock *iucv =iucv_sk (sk);unsigned int copied, rlen; -struct sk_buff *skb, *rskb, *cskb, *sskb; -int blen; +struct sk_buff *skb, *rskb, *cskb;int err =0 ; if ((sk->sk_state == IUCV_DISCONN) &&
@@ -1422,15 +1408,7 @@ static int iucv_sock_recvmsg(struct kiociucv_process_message_q (sk);if (atomic_read (&iucv->msg_recv) >= iucv->msglimit /2 ) { -/* send WIN to peer */ - blen =sizeof (struct af_iucv_trans_hdr ) + -ETH_HLEN ; - sskb =sock_alloc_send_skb (sk, blen,1 , &err); -if (sskb) { -skb_reserve (sskb, blen); - err =afiucv_hs_send (NULL , sk, sskb, -AF_IUCV_FLAG_WIN ); - } + err =iucv_send_ctrl (sk,AF_IUCV_FLAG_WIN );if (err) { sk->sk_state =IUCV_DISCONN ; sk->sk_state_change (sk);
@@ -2289,6 +2267,44 @@ out_unlock: } } + +/* +* afiucv_netdev_event: handle netdev notifier chain events +*/ +static int afiucv_netdev_event (struct notifier_block *this, +unsigned long event,void *ptr) +{ +struct net_device *event_dev = (struct net_device *)ptr; +struct hlist_node *node; +struct sock *sk; +struct iucv_sock *iucv; + +switch (event) { +case NETDEV_REBOOT : +case NETDEV_GOING_DOWN : +sk_for_each (sk, node, &iucv_sk_list.head) { + iucv =iucv_sk (sk); +if ((iucv->hs_dev == event_dev) && + (sk->sk_state ==IUCV_CONNECTED )) { +if (event ==NETDEV_GOING_DOWN ) +iucv_send_ctrl (sk,AF_IUCV_FLAG_FIN ); + sk->sk_state =IUCV_DISCONN ; + sk->sk_state_change (sk); + } + } +break ; +case NETDEV_DOWN : +case NETDEV_UNREGISTER : +default : +break ; + } +return NOTIFY_DONE ; +} + +static struct notifier_block afiucv_netdev_notifier = { + .notifier_call = afiucv_netdev_event, +}; +static const struct proto_ops iucv_sock_ops = { .family =PF_IUCV , .owner =THIS_MODULE ,
@@ -2388,7 +2404,8 @@ static int __init afiucv_init(void) err =afiucv_iucv_init ();if (err) goto out_sock; - } + }else +register_netdevice_notifier (&afiucv_netdev_notifier);dev_add_pack (&iucv_packet_type);return 0 ;
@@ -2409,7 +2426,8 @@ static void __exit afiucv_exit(void)driver_unregister (&af_iucv_driver); pr_iucv->iucv_unregister (&af_iucv_handler,0 );symbol_put (iucv_if); - } + }else +unregister_netdevice_notifier (&afiucv_netdev_notifier);dev_remove_pack (&iucv_packet_type);sock_unregister (PF_IUCV );proto_unregister (&iucv_proto);
PATCH 2/7 af_iucv: add shutdown for HS transport
In reply to [email protected]From: Ursula Braun <[email protected]>
AF_IUCV sockets offer a shutdown function. This patch makes sure shutdown works for HS transport as well.
---
include/net/iucv/af_iucv.h | 1 net/iucv/af_iucv.c | 79 +++++++++++++++++++++++++++++---------------- 2 files changed, 53 insertions(+), 27 deletions(-)
include/net/iucv/af_iucv.h +1 -0
@@ -62,6 +62,7 @@ struct sock_msg_q {#define AF_IUCV_FLAG_SYN 0x2#define AF_IUCV_FLAG_FIN 0x4#define AF_IUCV_FLAG_WIN 0x8 +#define AF_IUCV_FLAG_SHT 0x10struct af_iucv_trans_hdr {u16 magic;
net/iucv/af_iucv.c +52 -27
130 lines not on this page · raw message
PATCH 3/7 qeth: synchronize discipline module loading
In reply to [email protected]From: Frank Blaschka <[email protected]>
During system startup udev may try to configure devices in parallel so we have to synchronize discipline module loading.
---
drivers/s390/net/qeth_core_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/s390/net/qeth_core_main.c +4 -0
@@ -51,6 +51,7 @@ static struct kmem_cache *qeth_qdio_outbstatic struct device *qeth_core_root_dev;static unsigned int known_devices[][6 ] =QETH_MODELLIST_ARRAY ;static struct lock_class_key qdio_out_skb_queue_key; +static struct mutex qeth_mod_mutex;static void qeth_send_control_data_cb (struct qeth_channel *,struct qeth_cmd_buffer *);
@@ -5040,6 +5041,7 @@ int qeth_core_load_discipline(struct qet enum qeth_discipline_id discipline) {int rc =0 ; +mutex_lock (&qeth_mod_mutex);switch (discipline) {case QETH_DISCIPLINE_LAYER3 : card->discipline.ccwgdriver = try_then_request_module(
@@ -5057,6 +5059,7 @@ int qeth_core_load_discipline(struct qet "support discipline %d\n", discipline); rc = -EINVAL ; } +mutex_unlock (&qeth_mod_mutex);return rc; }
@@ -5540,6 +5543,7 @@ static int __init qeth_core_init(void)pr_info ("loading core functions\n" );INIT_LIST_HEAD (&qeth_core_card_list.list);rwlock_init (&qeth_core_card_list.rwlock); +mutex_init (&qeth_mod_mutex); rc =qeth_register_dbf_views ();if (rc)
PATCH 4/7 ctcm: make ctcmpc debugging compilable
In reply to [email protected]From: Ursula Braun <[email protected]>
ctcmpc debugging can be activated defining constant DEBUGCCW. The debugging part contains wrong checks for 64 bit addresses. Thus the debugging version does not compile.
This patch corrects the 64-bit address checks to make it compilable.
---
drivers/s390/net/ctcm_main.c | 3 +++ drivers/s390/net/ctcm_mpc.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/s390/net/ctcm_main.c +3 -0
@@ -562,6 +562,9 @@ static int ctcm_transmit_skb(struct chanskb_queue_tail (&ch->io_queue, skb); ccw_idx =3 ; } +if (do_debug_ccw) +ctcmpc_dumpit ((char *)&ch->ccw[ccw_idx], +sizeof (struct ccw1 ) *3 ); ch->retry =0 ;fsm_newstate (ch->fsm,CTC_STATE_TX );fsm_addtimer (&ch->timer,CTCM_TIME_5_SEC ,CTC_EVENT_TIMER , ch);
drivers/s390/net/ctcm_mpc.c +6 -6
@@ -53,8 +53,8 @@#include <linux/moduleparam.h> #include <asm/idals.h> -#include "ctcm_mpc.h" #include "ctcm_main.h" +#include "ctcm_mpc.h" #include "ctcm_fsms.h" static const struct xid2 init_xid = {
@@ -132,7 +132,7 @@ void ctcmpc_dumpit(char *buf, int len)__u32 ct, sw, rm, dup;char *ptr, *rptr;char tbuf[82 ], tdup[82 ]; -#if (UTS_MACHINE == s390x) +#ifdef CONFIG_64BIT char addr[22 ];#else char addr[12 ];
@@ -149,8 +149,8 @@ void ctcmpc_dumpit(char *buf, int len)for (ct =0 ; ct < len; ct++, ptr++, rptr++) {if (sw ==0 ) { -#if (UTS_MACHINE == s390x) -sprintf (addr,"%16.16lx" , (__u64 )rptr); +#ifdef CONFIG_64BIT +sprintf (addr,"%16.16llx" , (__u64 )rptr);#else sprintf (addr,"%8.8X" , (__u32 )rptr);#endif
@@ -164,8 +164,8 @@ void ctcmpc_dumpit(char *buf, int len)if (sw ==8 )strcat (bhex," " ); -#if (UTS_MACHINE == s390x) -sprintf (tbuf,"%2.2lX" , (__u64)*ptr); +#if CONFIG_64BIT +sprintf (tbuf,"%2.2llX" , (__u64)*ptr);#else sprintf (tbuf,"%2.2X" , (__u32)*ptr);#endif
RE: [patch 4/7] [PATCH] ctcm: make ctcmpc debugging compilable
Quoted 11 lines
static const struct xid2
init_xid= {drivers/s390/net/ctcm_mpc.c +1
-1@@ -132,7 +132,7 @@ void ctcmpc_dumpit(char *buf, int len)__u32 ct, sw, rm, dup;char *ptr, *rptr;char tbuf[82 ], tdup[82 ]; -#if (UTS_MACHINE == s390x) +#ifdef CONFIG_64BIT char addr[22 ];#else char addr[12 ];
drivers/s390/net/ctcm_mpc.c void ctcmpc_dumpit(char *buf, int len) · line 156
Quoted 10 lines
drivers/s390/net/ctcm_mpc.c +2
-2@@ -149,8 +149,8 @@ void ctcmpc_dumpit(char *buf, int len)for (ct =0 ; ct < len; ct++, ptr++, rptr++) {if (sw ==0 ) { -#if (UTS_MACHINE == s390x) -sprintf (addr,"%16.16lx" , (__u64 )rptr); +#ifdef CONFIG_64BIT +sprintf (addr,"%16.16llx" , (__u64 )rptr);#else sprintf (addr,"%8.8X" , (__u32 )rptr);#endif
What is wrong with:
char addr[24]; snprintf(addr, sizeof addr, "%p", rptr);
There seemed to be other 'dangerous' unbounded string operations in that code as well.
David
PATCH 5/7 ctcm: use correct idal word list for ctcmpc
In reply to [email protected]From: Belinda Thompson <[email protected]>
Communication Server Linux uses the ctcmpc code of the ctcm driver. Sending problems have shown up caused by a wrong idal word list for the first ccw. Function ctcmpc_chx_txdone() invokes the function to prepare the idal word list without setting an appropriate length for the first ccw, which may lead to an incomplete idal word list. This patch sets the maximum buffer size as data length of the first ccw. Thus correct idal word lists are guaranteed in all cases.
---
drivers/s390/net/ctcm_fsms.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/s390/net/ctcm_fsms.c +11 -0
@@ -1341,6 +1341,12 @@ static void ctcmpc_chx_txdone(fsm_instanspin_unlock (&ch->collect_lock);clear_normalized_cda (&ch->ccw[1 ]); + +CTCM_PR_DBGDATA ("ccwcda=0x%p data=0x%p\n" , + (void *)(unsigned long )ch->ccw[1 ].cda, + ch->trans_skb->data); + ch->ccw[1 ].count = ch->max_bufsize; +if (set_normalized_cda (&ch->ccw[1 ], ch->trans_skb->data)) {dev_kfree_skb_any (ch->trans_skb); ch->trans_skb =NULL ;
@@ -1350,6 +1356,11 @@ static void ctcmpc_chx_txdone(fsm_instanfsm_event (priv->mpcg->fsm,MPCG_EVENT_INOP , dev);return ; } + +CTCM_PR_DBGDATA ("ccwcda=0x%p data=0x%p\n" , + (void *)(unsigned long )ch->ccw[1 ].cda, + ch->trans_skb->data); + ch->ccw[1 ].count = ch->trans_skb->len;fsm_addtimer (&ch->timer,CTCM_TIME_5_SEC ,CTC_EVENT_TIMER , ch); ch->prof.send_stamp =current_kernel_time ();/* xtime */
PATCH 6/7 qeth: meaningful return code for set_mac_address
In reply to [email protected]From: Ursula Braun <[email protected]>
Setting an invalid mac-address for a qeth layer2 device returns with a strange error code:
# ip link set hsi1 address 00:00:00:00:00:01 RTNETLINK answers: Unknown error 18446744073709486085 Problem is caused by wrong usage of the return_code field within structure qeth_ipa_cmd. With this patch the ip command above returns SIOCSIFHWADDR: Invalid argument
---
drivers/s390/net/qeth_core_main.c | 6 +++--- drivers/s390/net/qeth_core_mpc.c | 1 + drivers/s390/net/qeth_core_mpc.h | 1 + drivers/s390/net/qeth_l2_main.c | 4 +--- drivers/s390/net/qeth_l3_main.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
drivers/s390/net/qeth_core_main.c +3 -3
@@ -2945,8 +2945,8 @@ static int qeth_query_ipassists_cb(struc card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled; }QETH_DBF_TEXT (SETUP ,2 ,"suppenbl" ); -QETH_DBF_TEXT_ (SETUP ,2 ,"%x" , cmd->hdr.ipa_supported); -QETH_DBF_TEXT_ (SETUP ,2 ,"%x" , cmd->hdr.ipa_enabled); +QETH_DBF_TEXT_ (SETUP ,2 ,"%08x" , (__u32 )cmd->hdr.ipa_supported); +QETH_DBF_TEXT_ (SETUP ,2 ,"%08x" , (__u32 )cmd->hdr.ipa_enabled);return 0 ; }
@@ -4322,7 +4322,7 @@ static int qeth_snmp_command_cb(struct q/* check if there is enough room in userspace */ if ((qinfo->udata_len - qinfo->udata_offset) < data_len) {QETH_CARD_TEXT_ (card,4 ,"scer3%i" , -ENOMEM ); - cmd->hdr.return_code = -ENOMEM ; + cmd->hdr.return_code =IPA_RC_ENOMEM ;return 0 ; } QETH_CARD_TEXT_(card, 4, "snore%i",
drivers/s390/net/qeth_core_mpc.c +1 -0
@@ -207,6 +207,7 @@ static struct ipa_rc_msg qeth_ipa_rc_msg {IPA_RC_MC_ADDR_ALREADY_DEFINED, "Multicast address already defined"}, {IPA_RC_LAN_OFFLINE, "STRTLAN_LAN_DISABLED - LAN offline"}, {IPA_RC_INVALID_IP_VERSION2, "Invalid IP version"}, + {IPA_RC_ENOMEM, "Memory problem"}, {IPA_RC_FFFF, "Unknown Error"} };
drivers/s390/net/qeth_core_mpc.h +1 -0
@@ -190,6 +190,7 @@ enum qeth_ipa_return_codes {IPA_RC_MC_ADDR_ALREADY_DEFINED =0xe013 ,IPA_RC_LAN_OFFLINE =0xe080 ,IPA_RC_INVALID_IP_VERSION2 =0xf001 , +IPA_RC_ENOMEM =0xfffe , IPA_RC_FFFF = 0xffff };/* for DELIP */
drivers/s390/net/qeth_l2_main.c +1 -3
@@ -576,7 +576,6 @@ static int qeth_l2_send_setmac_cb(structdefault :break ; } - cmd->hdr.return_code = -EIO ; }else { card->info.mac_bits |=QETH_LAYER2_MAC_REGISTERED ; memcpy(card->dev->dev_addr, cmd->data.setdelmac.mac,
@@ -605,7 +604,6 @@ static int qeth_l2_send_delmac_cb(struct cmd = (struct qeth_ipa_cmd *) data;if (cmd->hdr.return_code) {QETH_CARD_TEXT_ (card,2 ,"err%d" , cmd->hdr.return_code); - cmd->hdr.return_code = -EIO ;return 0 ; } card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED ;
@@ -682,7 +680,7 @@ static int qeth_l2_set_mac_address(struc rc =qeth_l2_send_delmac (card, &card->dev->dev_addr[0 ]);if (!rc) rc =qeth_l2_send_setmac (card, addr->sa_data); -return rc; +return rc ? -EINVAL :0 ; }static void qeth_l2_set_multicast_list (struct net_device *dev)
drivers/s390/net/qeth_l3_main.c +1 -1
@@ -2430,7 +2430,7 @@ static int qeth_l3_arp_query_cb(struct qif ((qinfo->udata_len - qinfo->udata_offset) < esize) {QETH_CARD_TEXT_ (card,4 ,"qaer3%i" , -ENOMEM ); - cmd->hdr.return_code = -ENOMEM ; + cmd->hdr.return_code =IPA_RC_ENOMEM ; goto out_error; }
PATCH 7/7 lcs: Return zero from ccwgroup devs set_offline function
In reply to [email protected]From: Klaus-Dieter Wacker <[email protected]>
A return code of non-zero of the devs ccwgroup set_offline function leaves the dev in online state. Having done a partly offlining may leave the dev in unusable state. To make sure the dev is set to offline, zero is returned. A setup trace entry is written in case the offlining steps encountered some trouble.
---
drivers/s390/net/lcs.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/s390/net/lcs.c +7 -5
@@ -2240,7 +2240,7 @@ __lcs_shutdown_device(struct ccwgroup_de {struct lcs_card *card;enum lcs_dev_states recover_state; -int ret; +int ret =0 , ret2 =0 , ret3 =0 ;LCS_DBF_TEXT (3 , setup,"shtdndev" ); card =dev_get_drvdata (&ccwgdev->dev);
@@ -2255,13 +2255,15 @@ __lcs_shutdown_device(struct ccwgroup_de recover_state = card->state; ret =lcs_stop_device (card->dev); - ret =ccw_device_set_offline (card->read.ccwdev); - ret =ccw_device_set_offline (card->write.ccwdev); + ret2 =ccw_device_set_offline (card->read.ccwdev); + ret3 =ccw_device_set_offline (card->write.ccwdev); +if (!ret) + ret = (ret2) ? ret2 : ret3; +if (ret) +LCS_DBF_TEXT_ (3 , setup,"1err:%d" , ret);if (recover_state ==DEV_STATE_UP ) { card->state =DEV_STATE_RECOVER ; } -if (ret) -return ret;return 0 ; }
David Miller
maintainerFrom: [email protected]
Date: Wed, 07 Mar 2012 13:06:22 +0100
Quoted 1 line
here is a couple of s390 network driver fixes for net-next
All applied, thanks.