diff options
author | Eugene Crosser <Eugene.Crosser@ru.ibm.com> | 2016-06-16 16:18:52 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-16 22:16:11 -0700 |
commit | 2863c61334aa9fd82000da500075b7c959361919 (patch) | |
tree | 872a8ead65c8aed5a00590dcf9cb827556f1587f /drivers/s390/net/qeth_core.h | |
parent | 1b05cf6285c108c8c2acfec47dd02ed50d973823 (diff) |
qeth: refactor calculation of SBALE count
Rewrite the functions that calculate the required number of buffer
elements needed to represent SKB data, to make them hopefully more
comprehensible. Plus a few cleanups.
Signed-off-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390/net/qeth_core.h')
-rw-r--r-- | drivers/s390/net/qeth_core.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index ec2e014e885c..eb8f434a2681 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h @@ -844,6 +844,19 @@ struct qeth_trap_id { /*some helper functions*/ #define QETH_CARD_IFNAME(card) (((card)->dev)? (card)->dev->name : "") +/** + * qeth_get_elements_for_range() - find number of SBALEs to cover range. + * @start: Start of the address range. + * @end: Address after the end of the range. + * + * Returns the number of pages, and thus QDIO buffer elements, needed to cover + * the specified address range. + */ +static inline int qeth_get_elements_for_range(addr_t start, addr_t end) +{ + return PFN_UP(end - 1) - PFN_DOWN(start); +} + static inline int qeth_get_micros(void) { return (int) (get_tod_clock() >> 12); |