netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julian Wiedmann <jwi@linux.vnet.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.vnet.ibm.com>,
	Ursula Braun <ubraun@linux.vnet.ibm.com>,
	Julian Wiedmann <jwi@linux.vnet.ibm.com>
Subject: [PATCH net-next 04/12] s390/qeth: simplify fragment type selection
Date: Tue, 15 Aug 2017 17:02:42 +0200	[thread overview]
Message-ID: <20170815150250.67158-5-jwi@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170815150250.67158-1-jwi@linux.vnet.ibm.com>

Improve readability of the code that determines a buffer element's
fragment type, and reduce the number of cases down from 5 to 3.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_core_main.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 4792cabb862e..3623ba23ff0b 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3918,23 +3918,16 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
 		buffer->element[element].addr = data;
 		buffer->element[element].length = length_here;
 		length -= length_here;
-		if (!length) {
-			if (first_lap)
-				if (skb_shinfo(skb)->nr_frags)
-					buffer->element[element].eflags =
-						SBAL_EFLAGS_FIRST_FRAG;
-				else
-					buffer->element[element].eflags = 0;
-			else
-				buffer->element[element].eflags =
-				    SBAL_EFLAGS_MIDDLE_FRAG;
-		} else {
-			if (first_lap)
+		if (first_lap) {
+			if (length || skb_is_nonlinear(skb))
+				/* skb needs additional elements */
 				buffer->element[element].eflags =
-				    SBAL_EFLAGS_FIRST_FRAG;
+					SBAL_EFLAGS_FIRST_FRAG;
 			else
-				buffer->element[element].eflags =
-				    SBAL_EFLAGS_MIDDLE_FRAG;
+				buffer->element[element].eflags = 0;
+		} else {
+			buffer->element[element].eflags =
+				SBAL_EFLAGS_MIDDLE_FRAG;
 		}
 		data += length_here;
 		element++;
-- 
2.11.2

  parent reply	other threads:[~2017-08-15 15:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 15:02 [PATCH net-next 00/12] s390/net: updates for 4.14 Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 01/12] s390/qeth: don't access skb after transmission Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 02/12] s390/qeth: remove extra L2 adapterparms query Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 03/12] s390/qeth: remove extra L3 " Julian Wiedmann
2017-08-15 15:02 ` Julian Wiedmann [this message]
2017-08-15 15:02 ` [PATCH net-next 05/12] s390/qeth: straighten out fill_buffer() interface Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 06/12] s390/qeth: clean up fill_buffer() offset logic Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 07/12] s390/qeth: make more use of skb API Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 08/12] s390/net: reduce inlining Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 09/12] s390/qeth: extract bridgeport cmd builder Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 10/12] s390/qeth: reject multicast rxip addresses Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 11/12] s390/qeth: fix trace-messages for deleting " Julian Wiedmann
2017-08-15 15:02 ` [PATCH net-next 12/12] s390/qeth: fix using of ref counter for " Julian Wiedmann
2017-08-15 18:00 ` [PATCH net-next 00/12] s390/net: updates for 4.14 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=20170815150250.67158-5-jwi@linux.vnet.ibm.com \
    --to=jwi@linux.vnet.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.vnet.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=ubraun@linux.vnet.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).