s390 - qeth patches for 2.6.23-rc3 (resend)
Subsystems (4)
cover s390 - qeth patches for 2.6.23-rc3 (resend)
Signature · 16 lines
Jeff, this is a resend of the s390 / qeth patches sent on monday. This time I have changed the wrong Subject line prefix of the patches from "qeth" to "s390". Sorry! qeth patches for 2.6.23-rc3: - do not allow interruption of "ungroup" - scatter gather mode: enforce rate limit - don't return void function return values - add tx checkumming for TSO/EDDP mode - invoke qeth_clear_output_buffer only for allocated qdio queues. - add specific message for exclusively used OSA-adapters - drop ARP packets on HiperSockets Regards, Ursula Braun
PATCH 1/7 s390: ungrouping a device must not be interruptible
From: Ursula Braun <[email protected]>
Problem:
A recovery thread must not be active when device is removed. In qeth_remove_device() an interruptible wait operation is used to wait until a qeth recovery thread is finished. If a user really interrupts the ungroup operation of a qeth device while a recovery is running, cio and qeth are out of sync (device already removed from cio, but kept in qeth). A following module unload of qeth results in a kernel OOPS here.
Solution:
Do not allow interruption of ungroup operation to guarantee finishing of a potentially running qeth recovery thread.
---
drivers/s390/net/qeth_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/s390/net/qeth_main.c +2 -3
@@ -561,7 +561,7 @@ qeth_set_offline(struct ccwgroup_device }static int -qeth_wait_for_threads (struct qeth_card *card,unsigned long threads); +qeth_threads_running (struct qeth_card *card,unsigned long threads); static void
@@ -576,8 +576,7 @@ qeth_remove_device(struct ccwgroup_devicif (!card)return ; -if (qeth_wait_for_threads (card,0xffffffff )) -return ; +wait_event (card->wait_q,qeth_threads_running (card,0xffffffff ) ==0 );if (cgdev->state ==CCWGROUP_ONLINE ){ card->use_hard_stop =1 ;
PATCH 2/7 s390: enforce a rate limit for inbound scatter gather messages
In reply to Ursula BraunFrom: Frank Blaschka <[email protected]>
under memory pressure scatter gather mode switching messages must be rate limited.
---
drivers/s390/net/qeth_main.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/s390/net/qeth_main.c +8 -5
@@ -2803,13 +2803,16 @@ qeth_queue_input_buffer(struct qeth_cardif (newcount < count) {/* we are in memory shortage so we switch back to traditional skb allocation and drop packages */ -if (atomic_cmpxchg (&card->force_alloc_skb,0 ,1 )) -printk (KERN_WARNING -"qeth: switch to alloc skb\n" ); +if (!atomic_read (&card->force_alloc_skb) && +net_ratelimit ()) +PRINT_WARN ("Switch to alloc skb\n" ); +atomic_set (&card->force_alloc_skb,3 ); count = newcount; }else { -if (atomic_cmpxchg (&card->force_alloc_skb,1 ,0 )) -printk (KERN_WARNING "qeth: switch to sg\n" ); +if ((atomic_read (&card->force_alloc_skb) ==1 ) && +net_ratelimit ()) +PRINT_WARN ("Switch to sg\n" ); +atomic_add_unless (&card->force_alloc_skb,-1 ,0 ); }/*
PATCH 3/7 s390: dont return the return values of void functions.
In reply to Ursula BraunFrom: Heiko Carstens <[email protected]>
---
drivers/s390/net/qeth.h | 4 ++-- drivers/s390/net/qeth_sys.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/s390/net/qeth.h +2 -2
@@ -1178,9 +1178,9 @@ qeth_ipaddr_to_string(enum qeth_prot_ver char *buf) {if (proto ==QETH_PROT_IPV4 ) -return qeth_ipaddr4_to_string (addr, buf); +qeth_ipaddr4_to_string (addr, buf);else if (proto ==QETH_PROT_IPV6 ) -return qeth_ipaddr6_to_string (addr, buf); +qeth_ipaddr6_to_string (addr, buf); } static inline int
drivers/s390/net/qeth_sys.c +4 -4
@@ -1760,10 +1760,10 @@ qeth_remove_device_attributes(struct dev {struct qeth_card *card = dev->driver_data; -if (card->info.type ==QETH_CARD_TYPE_OSN ) -return sysfs_remove_group (&dev->kobj, - &qeth_osn_device_attr_group); - +if (card->info.type ==QETH_CARD_TYPE_OSN ) { +sysfs_remove_group (&dev->kobj, &qeth_osn_device_attr_group); +return ; + }sysfs_remove_group (&dev->kobj, &qeth_device_attr_group);sysfs_remove_group (&dev->kobj, &qeth_device_ipato_group);sysfs_remove_group (&dev->kobj, &qeth_device_vipa_group);
PATCH 4/7 s390: Announce tx checksumming for qeth devices in TSO/EDDP mode
In reply to Ursula BraunFrom: Frank Blaschka <[email protected]>
TSO requires tx checksumming. For non GSO frames in TSO/EDDP mode we have to manually calculate the checksum.
---
Subject: [patch 4/7] [PATCH] qeth: Announce tx checksumming for qeth devices in TSO/EDDP mode
From: Frank Blaschka <[email protected]>
TSO requires tx checksumming. For non GSO frames in TSO/EDDP mode we have to manually calculate the checksum.
---
drivers/s390/net/qeth_main.c | 82 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 14 deletions(-)
drivers/s390/net/qeth_main.c +68 -14
@@ -4555,6 +4555,53 @@ qeth_get_elements_no(struct qeth_card *creturn elements_needed; } +static void qeth_tx_csum (struct sk_buff *skb) +{ +int tlen; + +if (skb->protocol ==htons (ETH_P_IP )) { + tlen =ntohs (ip_hdr (skb)->tot_len) - (ip_hdr (skb)->ihl <<2 ); +switch (ip_hdr (skb)->protocol) { +case IPPROTO_TCP : +tcp_hdr (skb)->check =0 ; +tcp_hdr (skb)->check =csum_tcpudp_magic ( +ip_hdr (skb)->saddr,ip_hdr (skb)->daddr, + tlen,ip_hdr (skb)->protocol, +skb_checksum (skb,skb_transport_offset (skb), + tlen,0 )); +break ; +case IPPROTO_UDP : +udp_hdr (skb)->check =0 ; +udp_hdr (skb)->check =csum_tcpudp_magic ( +ip_hdr (skb)->saddr,ip_hdr (skb)->daddr, + tlen,ip_hdr (skb)->protocol, +skb_checksum (skb,skb_transport_offset (skb), + tlen,0 )); +break ; + } + }else if (skb->protocol ==htons (ETH_P_IPV6 )) { +switch (ipv6_hdr (skb)->nexthdr) { +case IPPROTO_TCP : +tcp_hdr (skb)->check =0 ; +tcp_hdr (skb)->check =csum_ipv6_magic ( + &ipv6_hdr (skb)->saddr, &ipv6_hdr (skb)->daddr, +ipv6_hdr (skb)->payload_len, +ipv6_hdr (skb)->nexthdr, +skb_checksum (skb,skb_transport_offset (skb), +ipv6_hdr (skb)->payload_len,0 )); +break ; +case IPPROTO_UDP : +udp_hdr (skb)->check =0 ; +udp_hdr (skb)->check =csum_ipv6_magic ( + &ipv6_hdr (skb)->saddr, &ipv6_hdr (skb)->daddr, +ipv6_hdr (skb)->payload_len, +ipv6_hdr (skb)->nexthdr, +skb_checksum (skb,skb_transport_offset (skb), +ipv6_hdr (skb)->payload_len,0 )); +break ; + } + } +}static int qeth_send_packet (struct qeth_card *card,struct sk_buff *skb)
@@ -4640,6 +4687,10 @@ qeth_send_packet(struct qeth_card *card, elements_needed += elems; } +if ((large_send ==QETH_LARGE_SEND_NO ) && + (skb->ip_summed ==CHECKSUM_PARTIAL )) +qeth_tx_csum (new_skb); +if (card->info.type !=QETH_CARD_TYPE_IQD ) rc =qeth_do_send_packet (card, queue, new_skb, hdr, elements_needed, ctx);
@@ -6387,20 +6438,18 @@ qeth_deregister_addr_entry(struct qeth_cstatic u32 qeth_ethtool_get_tx_csum (struct net_device *dev) { -/* We may need to say that we support tx csum offload if -* we do EDDP or TSO. There are discussions going on to -* enforce rules in the stack and in ethtool that make -* SG and TSO depend on HW_CSUM. At the moment there are -* no such rules.... -* If we say yes here, we have to checksum outbound packets -* any time. */ -return 0 ; +return (dev->features &NETIF_F_HW_CSUM ) !=0 ; }static int qeth_ethtool_set_tx_csum (struct net_device *dev,u32 data) { -return -EINVAL ; +if (data) + dev->features |=NETIF_F_HW_CSUM ; +else + dev->features &= ~NETIF_F_HW_CSUM ; + +return 0 ; } static u32
@@ -7414,7 +7463,8 @@ qeth_start_ipa_tso(struct qeth_card *car }if (rc && (card->options.large_send ==QETH_LARGE_SEND_TSO )){ card->options.large_send =QETH_LARGE_SEND_NO ; - card->dev->features &= ~ (NETIF_F_TSO |NETIF_F_SG ); + card->dev->features &= ~(NETIF_F_TSO |NETIF_F_SG | +NETIF_F_HW_CSUM ); }return rc; }
@@ -7554,22 +7604,26 @@ qeth_set_large_send(struct qeth_card *ca card->options.large_send = type;switch (card->options.large_send) {case QETH_LARGE_SEND_EDDP : - card->dev->features |=NETIF_F_TSO |NETIF_F_SG ; + card->dev->features |=NETIF_F_TSO |NETIF_F_SG | +NETIF_F_HW_CSUM ;break ;case QETH_LARGE_SEND_TSO :if (qeth_is_supported (card,IPA_OUTBOUND_TSO )){ - card->dev->features |=NETIF_F_TSO |NETIF_F_SG ; + card->dev->features |=NETIF_F_TSO |NETIF_F_SG | +NETIF_F_HW_CSUM ; }else {PRINT_WARN ("TSO not supported on %s. " "large_send set to 'no'.\n" , card->dev->name); - card->dev->features &= ~(NETIF_F_TSO |NETIF_F_SG ); + card->dev->features &= ~(NETIF_F_TSO |NETIF_F_SG | +NETIF_F_HW_CSUM ); card->options.large_send =QETH_LARGE_SEND_NO ; rc = -EOPNOTSUPP ; }break ;default :/* includes QETH_LARGE_SEND_NO */ - card->dev->features &= ~(NETIF_F_TSO |NETIF_F_SG ); + card->dev->features &= ~(NETIF_F_TSO |NETIF_F_SG | +NETIF_F_HW_CSUM );break ; }if (card->state ==CARD_STATE_UP )
PATCH 5/7 s390: crash during reboot after failing online setting
In reply to Ursula BraunFrom: Ursula Braun <[email protected]>
Online setting of a qeth device may fail for instance because of:
- out-of-memory condition when allocating qdio queues
- IDX ACTIVATE problem
- ...
Such a device is still returned in a driver_for_each_device loop processed in qeth_reboot_event(), which calls qeth_clear_qdio_buffers(). Make sure qeth_clear_output_buffer() is called only, if the qdio queues have been successfully allocated during initialization of a qeth device.
---
drivers/s390/net/qeth_main.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/s390/net/qeth_main.c +13 -7
@@ -3356,10 +3356,12 @@ out_freeoutq:while (i >0 )kfree (card->qdio.out_qs[--i]);kfree (card->qdio.out_qs); + card->qdio.out_qs =NULL ; out_freepool:qeth_free_buffer_pool (card); out_freeinq:kfree (card->qdio.in_q); + card->qdio.in_q =NULL ; out_nomem:atomic_set (&card->qdio.state,QETH_QDIO_UNINITIALIZED );return -ENOMEM ;
@@ -3375,16 +3377,20 @@ qeth_free_qdio_buffers(struct qeth_card QETH_QDIO_UNINITIALIZED)return ;kfree (card->qdio.in_q); + card->qdio.in_q =NULL ;/* inbound buffer pool */ qeth_free_buffer_pool (card);/* free outbound qdio_qs */ -for (i =0 ; i < card->qdio.no_out_queues; ++i){ -for (j =0 ; j <QDIO_MAX_BUFFERS_PER_Q ; ++j) -qeth_clear_output_buffer (card->qdio.out_qs[i], - &card->qdio.out_qs[i]->bufs[j]); -kfree (card->qdio.out_qs[i]); +if (card->qdio.out_qs) { +for (i =0 ; i < card->qdio.no_out_queues; ++i) { +for (j =0 ; j <QDIO_MAX_BUFFERS_PER_Q ; ++j) +qeth_clear_output_buffer (card->qdio.out_qs[i], + &card->qdio.out_qs[i]->bufs[j]); +kfree (card->qdio.out_qs[i]); + } +kfree (card->qdio.out_qs); + card->qdio.out_qs =NULL ; } -kfree (card->qdio.out_qs); } static void
@@ -3395,7 +3401,7 @@ qeth_clear_qdio_buffers(struct qeth_cardQETH_DBF_TEXT (trace,2 ,"clearqdbf" );/* clear outbound buffers to free skbs */ for (i =0 ; i < card->qdio.no_out_queues; ++i) -if (card->qdio.out_qs[i]){ +if (card->qdio.out_qs && card->qdio.out_qs[i]) {for (j =0 ; j <QDIO_MAX_BUFFERS_PER_Q ; ++j)qeth_clear_output_buffer (card->qdio.out_qs[i], &card->qdio.out_qs[i]->bufs[j]);
PATCH 6/7 s390: provide specific message for OSA-adapters exclusively used
In reply to Ursula BraunFrom: Ursula Braun <[email protected]>
Exclusive usage of OSA-cards has been introduced. Even though Linux does not make use of it, qeth should be prepared to receive a bad RC for some initialization steps. A meaningful message is now given, if an OSA-device is set online, even though the OSA-adapter is already exclusively used by another host.
---
drivers/s390/net/qeth_main.c | 28 +++++++++++++++++++--------- drivers/s390/net/qeth_mpc.h | 1 + 2 files changed, 20 insertions(+), 9 deletions(-)
drivers/s390/net/qeth_main.c +19 -9
@@ -1541,16 +1541,21 @@ qeth_idx_write_cb(struct qeth_channel *c card =CARD_FROM_CDEV (channel->ccwdev);if (!(QETH_IS_IDX_ACT_POS_REPLY (iob->data))) { -PRINT_ERR ("IDX_ACTIVATE on write channel device %s: negative " -"reply\n" ,CARD_WDEV_ID (card)); +if (QETH_IDX_ACT_CAUSE_CODE (iob->data) ==0x19 ) +PRINT_ERR ("IDX_ACTIVATE on write channel device %s: " +"adapter exclusively used by another host\n" , +CARD_WDEV_ID (card)); +else +PRINT_ERR ("IDX_ACTIVATE on write channel device %s: " +"negative reply\n" ,CARD_WDEV_ID (card)); goto out; }memcpy (&temp,QETH_IDX_ACT_FUNC_LEVEL (iob->data),2 );if ((temp & ~0x0100 ) !=qeth_peer_func_level (card->info.func_level)) {PRINT_WARN ("IDX_ACTIVATE on write channel device %s: " -"function level mismatch " -"(sent: 0x%x, received: 0x%x)\n" , -CARD_WDEV_ID (card), card->info.func_level, temp); +"function level mismatch " +"(sent: 0x%x, received: 0x%x)\n" , +CARD_WDEV_ID (card), card->info.func_level, temp); goto out; } channel->state =CH_STATE_UP ;
@@ -1596,8 +1601,13 @@ qeth_idx_read_cb(struct qeth_channel *ch goto out; }if (!(QETH_IS_IDX_ACT_POS_REPLY (iob->data))) { -PRINT_ERR ("IDX_ACTIVATE on read channel device %s: negative " -"reply\n" ,CARD_RDEV_ID (card)); +if (QETH_IDX_ACT_CAUSE_CODE (iob->data) ==0x19 ) +PRINT_ERR ("IDX_ACTIVATE on read channel device %s: " +"adapter exclusively used by another host\n" , +CARD_RDEV_ID (card)); +else +PRINT_ERR ("IDX_ACTIVATE on read channel device %s: " +"negative reply\n" ,CARD_RDEV_ID (card)); goto out; }
@@ -1612,8 +1622,8 @@ qeth_idx_read_cb(struct qeth_channel *chmemcpy (&temp,QETH_IDX_ACT_FUNC_LEVEL (iob->data),2 );if (temp !=qeth_peer_func_level (card->info.func_level)) {PRINT_WARN ("IDX_ACTIVATE on read channel device %s: function " -"level mismatch (sent: 0x%x, received: 0x%x)\n" , -CARD_RDEV_ID (card), card->info.func_level, temp); +"level mismatch (sent: 0x%x, received: 0x%x)\n" , +CARD_RDEV_ID (card), card->info.func_level, temp); goto out; } memcpy(&card->token.issuer_rm_r,
drivers/s390/net/qeth_mpc.h +1 -0
@@ -565,6 +565,7 @@ extern unsigned char IDX_ACTIVATE_WRITE[#define QETH_IDX_ACT_QDIO_DEV_REALADDR (buffer) (buffer+0x20)#define QETH_IS_IDX_ACT_POS_REPLY (buffer) (((buffer)[0x08]&3)==2)#define QETH_IDX_REPLY_LEVEL (buffer) (buffer+0x12) +#define QETH_IDX_ACT_CAUSE_CODE (buffer) (buffer)[0x09]#define PDU_ENCAPSULATION (buffer) \ (buffer + *(buffer + (*(buffer+0x0b)) + \
PATCH 7/7 s390: Drop ARP packages on HiperSockets interface with NOARP attribute.
In reply to Ursula BraunFrom: Klaus D. Wacker <[email protected]>
A network interface can get ARP packets even when the interface has NOARP specified. In a HiperSockets environment this disturbs receiving systems when packets are sent on the multicast queue. (E.g. TCP/IP on z/VM issues messages reporting invalid data on the HiperSockets interface.)
Qeth will no longer send ARP packets on HiperSockets interface when interface has the NOARP attribute.
---
drivers/s390/net/qeth_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/s390/net/qeth_main.c +8 -2
@@ -2505,7 +2505,7 @@ qeth_rebuild_skb_fake_ll_tr(struct qeth_struct iphdr *ip_hdr;QETH_DBF_TEXT (trace,5 ,"skbfktr" ); -skb_set_mac_header (skb, -QETH_FAKE_LL_LEN_TR ); +skb_set_mac_header (skb, (int )-QETH_FAKE_LL_LEN_TR );/* this is a fake ethernet header */ fake_hdr =tr_hdr (skb);
@@ -4710,9 +4710,15 @@ qeth_send_packet(struct qeth_card *card,if (card->info.type !=QETH_CARD_TYPE_IQD ) rc =qeth_do_send_packet (card, queue, new_skb, hdr, elements_needed, ctx); -else +else { +if ((skb->protocol ==htons (ETH_P_ARP )) && + (card->dev->flags &IFF_NOARP )) { +__qeth_free_new_skb (skb, new_skb); +return -EPERM ; + } rc =qeth_do_send_packet_fast (card, queue, new_skb, hdr, elements_needed, ctx); + }if (!rc) { card->stats.tx_packets++; card->stats.tx_bytes += tx_bytes;
Jeff Garzik
AppliedRe: [patch 1/7] s390: ungrouping a device must not be interruptible
In reply to Ursula BraunApplied patches 1-7, after changing the prefix back to "qeth: "
"s390: " prefix should be applied to changes that affect S/390 architecture platform in general.
This was a patchset specific to a single driver, thus the "qeth: " prefix is more informative when looking at a long list of one-line change summaries.