Skip to content

Commit

Permalink
NTB: correct the spread of queues over mw's
Browse files Browse the repository at this point in the history
The detection of an uneven number of queues on the given memory windows
was not correct.  The mw_num is zero based and the mod should be
division to spread them evenly over the mw's.

Signed-off-by: Jon Mason <jon.mason@intel.com>
  • Loading branch information
Jon Mason authored and Jon Mason committed Sep 14, 2014
1 parent 2ce7598 commit a1413cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/ntb/ntb_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ static void ntb_transport_setup_qp_mw(struct ntb_transport *nt,

WARN_ON(nt->mw[mw_num].virt_addr == NULL);

if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max)
if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max)
num_qps_mw = nt->max_qps / mw_max + 1;
else
num_qps_mw = nt->max_qps / mw_max;
Expand Down Expand Up @@ -856,7 +856,7 @@ static int ntb_transport_init_queue(struct ntb_transport *nt,
qp->client_ready = NTB_LINK_DOWN;
qp->event_handler = NULL;

if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max)
if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max)
num_qps_mw = nt->max_qps / mw_max + 1;
else
num_qps_mw = nt->max_qps / mw_max;
Expand Down

0 comments on commit a1413cf

Please sign in to comment.