diff options
author | Julian Wiedmann <jwi@linux.vnet.ibm.com> | 2017-08-18 11:19:09 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-18 20:21:30 +0300 |
commit | eaf3cc087f6e15073dd4b02b7ad2f1301702bd74 (patch) | |
tree | ceb7e9ceb284201f45c4a6e91843b57896d66c62 /drivers/s390 | |
parent | f1588177b259e75a9fabcf3d4d0be4d6b0981d24 (diff) | |
download | linux-eaf3cc087f6e15073dd4b02b7ad2f1301702bd74.tar.xz |
s390/qeth: unify code to build header elements
After plenty of refactoring, use hd_len as single indication that
the skb needs a dedicated header element.
This preserves existing behaviour for TSO, as 'hdr' always points
to skb->data.
Signed-off-by: Julian Wiedmann <jwi@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 | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index cef9f54d0eb9..ffefdd97abca 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -3953,37 +3953,38 @@ static void __qeth_fill_buffer(struct sk_buff *skb, buf->next_element_to_fill = element; } +/** + * qeth_fill_buffer() - map skb into an output buffer + * @queue: QDIO queue to submit the buffer on + * @buf: buffer to transport the skb + * @skb: skb to map into the buffer + * @hdr: qeth_hdr for this skb. Either at skb->data, or allocated + * from qeth_core_header_cache. + * @offset: when mapping the skb, start at skb->data + offset + * @hd_len: if > 0, build a dedicated header element of this size + */ static int qeth_fill_buffer(struct qeth_qdio_out_q *queue, struct qeth_qdio_out_buffer *buf, struct sk_buff *skb, struct qeth_hdr *hdr, unsigned int offset, unsigned int hd_len) { - struct qdio_buffer *buffer; + struct qdio_buffer *buffer = buf->buffer; bool is_first_elem = true; int flush_cnt = 0; - buffer = buf->buffer; refcount_inc(&skb->users); skb_queue_tail(&buf->skb_list, skb); - if (hdr->hdr.l3.id == QETH_HEADER_TYPE_TSO) { - int element = buf->next_element_to_fill; - is_first_elem = false; - - /*fill first buffer entry only with header information */ - buffer->element[element].addr = skb->data; - buffer->element[element].length = hd_len; - buffer->element[element].eflags = SBAL_EFLAGS_FIRST_FRAG; - buf->next_element_to_fill++; - /* IQD */ - } else if (offset) { + /* build dedicated header element */ + if (hd_len) { int element = buf->next_element_to_fill; is_first_elem = false; buffer->element[element].addr = hdr; buffer->element[element].length = hd_len; buffer->element[element].eflags = SBAL_EFLAGS_FIRST_FRAG; - buf->is_header[element] = 1; + /* remember to free cache-allocated qeth_hdr: */ + buf->is_header[element] = ((void *)hdr != skb->data); buf->next_element_to_fill++; } |