s390/qeth: fixes 2020-11-20
Subsystems (4)
cover s390/qeth: fixes 2020-11-20
Hi Jakub,
please apply the following patch series to netdev's net tree.
This brings several fixes for qeth's af_iucv-specific code paths.
Also one fix by Alexandra for the recently added BR_LEARNING_SYNC support. We want to trust the feature indication bit, so that HW can mask it out if there's any issues on their end.
Thanks,
Julian
Alexandra Winter (1):
s390/qeth: Remove pnso workaround
Julian Wiedmann (3):
s390/qeth: make af_iucv TX notification call more robust s390/qeth: fix af_iucv notification race s390/qeth: fix tear down of async TX buffers
drivers/s390/net/qeth_core.h | 9 ++-- drivers/s390/net/qeth_core_main.c | 82 ++++++++++++++++++++----------- drivers/s390/net/qeth_l2_main.c | 18 +------ 3 files changed, 62 insertions(+), 47 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/4 s390/qeth: Remove pnso workaround
From: Alexandra Winter <[email protected]>
Remove workaround that supported early hardware implementations of PNSO OC3. Rely on the 'enarf' feature bit instead.
--- drivers/s390/net/qeth_l2_main.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
drivers/s390/net/qeth_l2_main.c +2 -16
@@ -985,32 +985,19 @@ static void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card)* change notification' and thus can support the learning_sync bridgeport * attribute * @card: qeth_card structure pointer -* -* This is a destructive test and must be called before dev2br or -* bridgeport address notification is enabled! */ static void qeth_l2_detect_dev2br_support (struct qeth_card *card) {struct qeth_priv *priv =netdev_priv (card->dev);bool dev2br_supported; -int rc;QETH_CARD_TEXT (card,2 ,"d2brsup" );if (!IS_IQD (card))return ;/* dev2br requires valid cssid,iid,chid */ -if (!card->info.ids_valid) { - dev2br_supported = false; - }else if (css_general_characteristics.enarf) { - dev2br_supported = true; - }else { -/* Old machines don't have the feature bit: -* Probe by testing whether a disable succeeds -*/ - rc =qeth_l2_pnso (card,PNSO_OC_NET_ADDR_INFO ,0 ,NULL ,NULL ); - dev2br_supported = !rc; - } + dev2br_supported = card->info.ids_valid && + css_general_characteristics.enarf;QETH_CARD_TEXT_ (card,2 ,"D2Bsup%02x" , dev2br_supported);if (dev2br_supported)
@@ -2233,7 +2220,6 @@ static int qeth_l2_set_online(struct qeth_card *card, bool carrier_ok)struct net_device *dev = card->dev;int rc =0 ; -/* query before bridgeport_notification may be enabled */ qeth_l2_detect_dev2br_support (card);mutex_lock (&card->sbp_lock);
Signature · 1 line
2.17.1
PATCH 2/4 s390/qeth: make af_iucv TX notification call more robust
In reply to Julian WiedmannCalling into socket code is ugly already, at least check whether we are dealing with the expected sk_family. Only looking at skb->protocol is bound to cause troubles (consider eg. af_packet).
--- drivers/s390/net/qeth_core_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/s390/net/qeth_core_main.c +2 -1
@@ -33,6 +33,7 @@#include <net/iucv/af_iucv.h> #include <net/dsfield.h> +#include <net/sock.h> #include <asm/ebcdic.h> #include <asm/chpid.h>
@@ -1405,7 +1406,7 @@ static void qeth_notify_skbs(struct qeth_qdio_out_q *q, skb_queue_walk(&buf->skb_list, skb) {QETH_CARD_TEXT_ (q->card,5 ,"skbn%d" , notification);QETH_CARD_TEXT_ (q->card,5 ,"%lx" , (long ) skb); -if (skb->protocol ==htons (ETH_P_AF_IUCV ) && skb->sk) +if (skb->sk && skb->sk->sk_family ==PF_IUCV )iucv_sk (skb->sk)->sk_txnotify (skb, notification); } }
Signature · 1 line
2.17.1
PATCH 3/4 s390/qeth: fix af_iucv notification race
In reply to Julian WiedmannThe two expected notification sequences are
1. TX_NOTIFY_PENDING with a subsequent TX_NOTIFY_DELAYED_*, when our TX completion code first observed the pending TX and the QAOB then completes at a later time; or
2. TX_NOTIFY_OK, when qeth_qdio_handle_aob() picked up the QAOB completion before our TX completion code even noticed that the TX was pending.
But as qeth_iqd_tx_complete() and qeth_qdio_handle_aob() can run concurrently, we may end up with a race that results in a sequence of TX_NOTIFY_DELAYED_* followed by TX_NOTIFY_PENDING. Which would confuse the af_iucv code in its tracking of pending transmits.
Rework the notification code, so that qeth_qdio_handle_aob() defers its notification if the TX completion code is still active.
--- drivers/s390/net/qeth_core.h | 9 ++-- drivers/s390/net/qeth_core_main.c | 73 ++++++++++++++++++++++--------- 2 files changed, 58 insertions(+), 24 deletions(-)
drivers/s390/net/qeth_core.h +6 -3
@@ -417,10 +417,13 @@ enum qeth_qdio_out_buffer_state {QETH_QDIO_BUF_EMPTY ,/* Filled by driver; owned by hardware in order to be sent. */ QETH_QDIO_BUF_PRIMED , -/* Identified to be pending in TPQ. */ +/* Discovered by the TX completion code: */ QETH_QDIO_BUF_PENDING , -/* Found in completion queue. */ -QETH_QDIO_BUF_IN_CQ , +/* Finished by the TX completion code: */ +QETH_QDIO_BUF_NEED_QAOB , +/* Received QAOB notification on CQ: */ +QETH_QDIO_BUF_QAOB_OK , +QETH_QDIO_BUF_QAOB_ERROR ,/* Handled via transfer pending / completion queue. */ QETH_QDIO_BUF_HANDLED_DELAYED, };
drivers/s390/net/qeth_core_main.c +52 -21
105 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 4/4 s390/qeth: fix tear down of async TX buffers
In reply to Julian WiedmannWhen qeth_iqd_tx_complete() detects that a TX buffer requires additional async completion via QAOB, it might fail to replace the queue entry's metadata (and ends up triggering recovery).
Assume now that the device gets torn down, overruling the recovery. If the QAOB notification then arrives before the tear down has sufficiently progressed, the buffer state is changed to QETH_QDIO_BUF_HANDLED_DELAYED by qeth_qdio_handle_aob().
The tear down code calls qeth_drain_output_queue(), where qeth_cleanup_handled_pending() will then attempt to replace such a buffer _again_. If it succeeds this time, the buffer ends up dangling in its replacement's ->next_pending list ... where it will never be freed, since there's no further call to qeth_cleanup_handled_pending().
But the second attempt isn't actually needed, we can simply leave the buffer on the queue and re-use it after a potential recovery has completed. The qeth_clear_output_buffer() in qeth_drain_output_queue() will ensure that it's in a clean state again.
--- drivers/s390/net/qeth_core_main.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/s390/net/qeth_core_main.c +0 -6
@@ -500,12 +500,6 @@ static void qeth_cleanup_handled_pending(struct qeth_qdio_out_q *q, int bidx, } } -if (forced_cleanup && (atomic_read (&(q->bufs[bidx]->state)) == -QETH_QDIO_BUF_HANDLED_DELAYED )) { -/* for recovery situations */ -qeth_init_qdio_out_buf (q, bidx); -QETH_CARD_TEXT (q->card,2 ,"clprecov" ); - } } static void qeth_qdio_handle_aob(struct qeth_card *card,
Signature · 1 line
2.17.1
Quoted 7 lines · On Fri, 20 Nov 2020 10:09:35 +0100 Julian Wiedmann wrote:
please apply the following patch series to netdev's net tree.
This brings several fixes for qeth's af_iucv-specific code paths.
Also one fix by Alexandra for the recently added
BR_LEARNING_SYNCsupport. We want to trust the feature indication bit, so that HW can mask it out if there's any issues on their end.
Applied, thank you!