android_kernel_oneplus_msm8998/drivers/ntb
Logan Gunthorpe 4e5f2c2041 ntb_transport: fix bug calculating num_qps_mw
commit 8e8496e0e9564b66165f5219a4e8ed20b0d3fc6b upstream.

A divide by zero error occurs if qp_count is less than mw_count because
num_qps_mw is calculated to be zero. The calculation appears to be
incorrect.

The requirement is for num_qps_mw to be set to qp_count / mw_count
with any remainder divided among the earlier mws.

For example, if mw_count is 5 and qp_count is 12 then mws 0 and 1
will have 3 qps per window and mws 2 through 4 will have 2 qps per window.
Thus, when mw_num < qp_count % mw_count, num_qps_mw is 1 higher
than when mw_num >= qp_count.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Fixes: e26a5843f7 ("NTB: Split ntb_hw_intel and ntb_transport drivers")
Acked-by: Allen Hubbe <Allen.Hubbe@dell.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-30 10:19:29 +02:00
..
hw NTB: unify translation addresses 2015-11-08 16:11:21 -05:00
test NTB: Add tool test client 2015-07-04 14:08:17 -04:00
Kconfig NTB: Add ping pong test client 2015-07-04 14:07:42 -04:00
Makefile NTB: Add ping pong test client 2015-07-04 14:07:42 -04:00
ntb.c ntb: avoid format string in dev_set_name 2015-08-09 16:32:22 -04:00
ntb_transport.c ntb_transport: fix bug calculating num_qps_mw 2017-08-30 10:19:29 +02:00