All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Wiedmann <jwi@linux.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-s390@vger.kernel.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Stefan Raspl <raspl@linux.ibm.com>,
	Ursula Braun <ubraun@linux.ibm.com>,
	Julian Wiedmann <jwi@linux.ibm.com>
Subject: [PATCH net-next 08/15] s390/qeth: re-use qeth_notify_skbs()
Date: Wed, 26 Sep 2018 18:29:09 +0200	[thread overview]
Message-ID: <20180926162916.102720-9-jwi@linux.ibm.com> (raw)
In-Reply-To: <20180926162916.102720-1-jwi@linux.ibm.com>

When not using the CQ, this allows us avoid the second skb queue walk
in qeth_release_skbs().

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 drivers/s390/net/qeth_core_main.c | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 012519ffd8de..1b853f900720 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -1180,38 +1180,19 @@ 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 (be16_to_cpu(skb->protocol) == ETH_P_AF_IUCV) {
-			if (skb->sk) {
-				struct iucv_sock *iucv = iucv_sk(skb->sk);
-				iucv->sk_txnotify(skb, notification);
-			}
-		}
+		if (skb->protocol == htons(ETH_P_AF_IUCV) && skb->sk)
+			iucv_sk(skb->sk)->sk_txnotify(skb, notification);
 	}
 }
 
 static void qeth_release_skbs(struct qeth_qdio_out_buffer *buf)
 {
-	struct sk_buff *skb;
-	struct iucv_sock *iucv;
-	int notify_general_error = 0;
-
-	if (atomic_read(&buf->state) == QETH_QDIO_BUF_PENDING)
-		notify_general_error = 1;
-
 	/* release may never happen from within CQ tasklet scope */
 	WARN_ON_ONCE(atomic_read(&buf->state) == QETH_QDIO_BUF_IN_CQ);
 
-	skb_queue_walk(&buf->skb_list, skb) {
-		QETH_CARD_TEXT(buf->q->card, 5, "skbr");
-		QETH_CARD_TEXT_(buf->q->card, 5, "%lx", (long) skb);
-		if (notify_general_error &&
-		    be16_to_cpu(skb->protocol) == ETH_P_AF_IUCV) {
-			if (skb->sk) {
-				iucv = iucv_sk(skb->sk);
-				iucv->sk_txnotify(skb, TX_NOTIFY_GENERALERROR);
-			}
-		}
-	}
+	if (atomic_read(&buf->state) == QETH_QDIO_BUF_PENDING)
+		qeth_notify_skbs(buf->q, buf, TX_NOTIFY_GENERALERROR);
+
 	__skb_queue_purge(&buf->skb_list);
 }
 
-- 
2.16.4

WARNING: multiple messages have this Message-ID (diff)
From: Julian Wiedmann <jwi@linux.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Stefan Raspl <raspl@linux.ibm.com>,
	Ursula Braun <ubraun@linux.ibm.com>,
	Julian Wiedmann <jwi@linux.ibm.com>
Subject: [PATCH net-next 08/15] s390/qeth: re-use qeth_notify_skbs()
Date: Wed, 26 Sep 2018 18:29:09 +0200	[thread overview]
Message-ID: <20180926162916.102720-9-jwi@linux.ibm.com> (raw)
In-Reply-To: <20180926162916.102720-1-jwi@linux.ibm.com>

When not using the CQ, this allows us avoid the second skb queue walk
in qeth_release_skbs().

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 drivers/s390/net/qeth_core_main.c | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 012519ffd8de..1b853f900720 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -1180,38 +1180,19 @@ 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 (be16_to_cpu(skb->protocol) == ETH_P_AF_IUCV) {
-			if (skb->sk) {
-				struct iucv_sock *iucv = iucv_sk(skb->sk);
-				iucv->sk_txnotify(skb, notification);
-			}
-		}
+		if (skb->protocol == htons(ETH_P_AF_IUCV) && skb->sk)
+			iucv_sk(skb->sk)->sk_txnotify(skb, notification);
 	}
 }
 
 static void qeth_release_skbs(struct qeth_qdio_out_buffer *buf)
 {
-	struct sk_buff *skb;
-	struct iucv_sock *iucv;
-	int notify_general_error = 0;
-
-	if (atomic_read(&buf->state) == QETH_QDIO_BUF_PENDING)
-		notify_general_error = 1;
-
 	/* release may never happen from within CQ tasklet scope */
 	WARN_ON_ONCE(atomic_read(&buf->state) == QETH_QDIO_BUF_IN_CQ);
 
-	skb_queue_walk(&buf->skb_list, skb) {
-		QETH_CARD_TEXT(buf->q->card, 5, "skbr");
-		QETH_CARD_TEXT_(buf->q->card, 5, "%lx", (long) skb);
-		if (notify_general_error &&
-		    be16_to_cpu(skb->protocol) == ETH_P_AF_IUCV) {
-			if (skb->sk) {
-				iucv = iucv_sk(skb->sk);
-				iucv->sk_txnotify(skb, TX_NOTIFY_GENERALERROR);
-			}
-		}
-	}
+	if (atomic_read(&buf->state) == QETH_QDIO_BUF_PENDING)
+		qeth_notify_skbs(buf->q, buf, TX_NOTIFY_GENERALERROR);
+
 	__skb_queue_purge(&buf->skb_list);
 }
 
-- 
2.16.4

  parent reply	other threads:[~2018-09-26 22:43 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 16:29 [PATCH net-next 00/15] s390/net: updates 2018-09-26 Julian Wiedmann
2018-09-26 16:29 ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 01/15] s390/qeth: convert layer attribute to enum Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 02/15] s390/qeth: use DEFINE_MUTEX for qeth_mod_mutex Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 03/15] s390/qeth: fix discipline unload after setup error Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 04/15] s390/qeth: on gdev release, reset drvdata Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 05/15] net/af_iucv: locate IUCV header via skb_network_header() Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 06/15] s390/qeth: replace open-coded skb_queue_walk() Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 07/15] s390/qeth: remove additional skb refcount Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` Julian Wiedmann [this message]
2018-09-26 16:29   ` [PATCH net-next 08/15] s390/qeth: re-use qeth_notify_skbs() Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 09/15] s390/qeth: pass card pointer in iob callback Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 10/15] s390/qeth: remove CARD_FROM_CDEV helper Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 11/15] s390/qeth: remove various redundant code Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 12/15] s390/qeth: consume local address events Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 13/15] s390/qeth: re-indent qeth_check_ipa_data() Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 14/15] s390/qeth: clean up drop conditions for received cmds Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 16:29 ` [PATCH net-next 15/15] s390/qeth: remove duplicated carrier state tracking Julian Wiedmann
2018-09-26 16:29   ` Julian Wiedmann
2018-09-26 17:02 ` [PATCH net-next 00/15] s390/net: updates 2018-09-26 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180926162916.102720-9-jwi@linux.ibm.com \
    --to=jwi@linux.ibm.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=raspl@linux.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=ubraun@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.