Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/qeth: fix packing buffer statistics

There's two spots in qeth_send_packet() where we don't accurately
account for transmitted packing buffers in qeth's performance
statistics:

1) when flushing the current buffer due to insufficient size,
and the next buffer is not EMPTY, we need to account for that
flushed buffer.
2) when synchronizing with the TX completion code, we reset
flush_count and thus forget to account for any previously
flushed buffers.

Reported-by: Nils Hoppmann <niho@de.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Julian Wiedmann and committed by
David S. Miller
3cdc8a25 2063a5f5

+10 -7
+10 -7
drivers/s390/net/qeth_core_main.c
··· 4103 4103 flush_count); 4104 4104 atomic_set(&queue->state, 4105 4105 QETH_OUT_Q_UNLOCKED); 4106 - return -EBUSY; 4106 + rc = -EBUSY; 4107 + goto out; 4107 4108 } 4108 4109 } 4109 4110 } ··· 4123 4122 * In that case we will enter this loop 4124 4123 */ 4125 4124 while (atomic_dec_return(&queue->state)) { 4126 - flush_count = 0; 4127 4125 start_index = queue->next_buf_to_fill; 4128 4126 /* check if we can go back to non-packing state */ 4129 - flush_count += qeth_switch_to_nonpacking_if_needed(queue); 4127 + tmp = qeth_switch_to_nonpacking_if_needed(queue); 4130 4128 /* 4131 4129 * check if we need to flush a packing buffer to get a pci 4132 4130 * flag out on the queue 4133 4131 */ 4134 - if (!flush_count && !atomic_read(&queue->set_pci_flags_count)) 4135 - flush_count += qeth_prep_flush_pack_buffer(queue); 4136 - if (flush_count) 4137 - qeth_flush_buffers(queue, start_index, flush_count); 4132 + if (!tmp && !atomic_read(&queue->set_pci_flags_count)) 4133 + tmp = qeth_prep_flush_pack_buffer(queue); 4134 + if (tmp) { 4135 + qeth_flush_buffers(queue, start_index, tmp); 4136 + flush_count += tmp; 4137 + } 4138 4138 } 4139 + out: 4139 4140 /* at this point the queue is UNLOCKED again */ 4140 4141 if (queue->card->options.performance_stats && do_pack) 4141 4142 queue->card->perf_stats.bufs_sent_pack += flush_count;