aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/qeth_l3_main.c
diff options
context:
space:
mode:
authorJulian Wiedmann <jwi@linux.ibm.com>2018-07-19 12:43:56 +0200
committerDavid S. Miller <davem@davemloft.net>2018-07-21 10:12:30 -0700
commitba86ceee9d1b5aa71fe3db75b2ec5452c9a48307 (patch)
treed4af4b1cab727029b75e594f83c5cf99ecefed75 /drivers/s390/net/qeth_l3_main.c
parents390/qeth: add statistics for consumed buffer elements (diff)
downloadlinux-dev-ba86ceee9d1b5aa71fe3db75b2ec5452c9a48307.tar.xz
linux-dev-ba86ceee9d1b5aa71fe3db75b2ec5452c9a48307.zip
s390/qeth: merge linearize-check into HW header construction
When checking whether an skb needs to be linearized to fit into an IO buffer, it's desirable to consider the skb's final size and layout (ie. after the HW header was added). But a subsequent linearization can then cause the re-positioned HW header to violate its alignment restrictions. Dealing with this situation in two different code paths is quite tricky. This patch integrates a) linearize-check and b) HW header construction into one 3 step-sequence: 1. evaluate how the HW header needs to be added (to identify if it takes up an additional buffer element), then 2. check if the required buffer elements exceed the device's limit. Linearize when necessary and re-evaluate the HW header placement. 3. Add the HW header in the best-possible way: a) push, without taking up an additional buffer element b) push, but consume another buffer element c) allocate a header object from the cache. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/s390/net/qeth_l3_main.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index c12aeb7d8f26..f7bcc4853c45 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2166,28 +2166,13 @@ static int qeth_l3_xmit_offload(struct qeth_card *card, struct sk_buff *skb,
int cast_type)
{
const unsigned int hw_hdr_len = sizeof(struct qeth_hdr);
+ unsigned int frame_len, elements;
unsigned char eth_hdr[ETH_HLEN];
- unsigned int hdr_elements = 0;
struct qeth_hdr *hdr = NULL;
- int elements, push_len, rc;
unsigned int hd_len = 0;
- unsigned int frame_len;
+ int push_len, rc;
bool is_sg;
- /* compress skb to fit into one IO buffer: */
- if (!qeth_get_elements_no(card, skb, 0, 0)) {
- rc = skb_linearize(skb);
-
- if (card->options.performance_stats) {
- if (rc)
- card->perf_stats.tx_linfail++;
- else
- card->perf_stats.tx_lin++;
- }
- if (rc)
- return rc;
- }
-
/* re-use the L2 header area for the HW header: */
rc = skb_cow_head(skb, hw_hdr_len - ETH_HLEN);
if (rc)
@@ -2196,22 +2181,14 @@ static int qeth_l3_xmit_offload(struct qeth_card *card, struct sk_buff *skb,
skb_pull(skb, ETH_HLEN);
frame_len = skb->len;
- push_len = qeth_push_hdr(skb, &hdr, hw_hdr_len);
+ push_len = qeth_add_hw_header(card, skb, &hdr, hw_hdr_len, &elements);
if (push_len < 0)
return push_len;
if (!push_len) {
/* hdr was added discontiguous from skb->data */
hd_len = hw_hdr_len;
- hdr_elements = 1;
}
- elements = qeth_get_elements_no(card, skb, hdr_elements, 0);
- if (!elements) {
- rc = -E2BIG;
- goto out;
- }
- elements += hdr_elements;
-
if (skb->protocol == htons(ETH_P_AF_IUCV))
qeth_l3_fill_af_iucv_hdr(hdr, skb, frame_len);
else
@@ -2226,7 +2203,7 @@ static int qeth_l3_xmit_offload(struct qeth_card *card, struct sk_buff *skb,
rc = qeth_do_send_packet(card, queue, skb, hdr, 0, hd_len,
elements);
}
-out:
+
if (!rc) {
if (card->options.performance_stats) {
card->perf_stats.buf_elements_sent += elements;