diff options
author | Julian Wiedmann <jwi@linux.vnet.ibm.com> | 2017-08-15 17:02:42 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-15 10:58:39 -0700 |
commit | 5258830bf6a2af4fd4c3521a37541ee59095d010 (patch) | |
tree | bb21e60cb6ac329fafe294f139f331e6956b77a1 /drivers/s390 | |
parent | 699d3fe53702e993af9bdafa70542d96d3f3ee5c (diff) |
s390/qeth: simplify fragment type selection
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 23 |
1 files 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++; |