]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
NTB: MFV a1413cfb: correct the spread of queues over mw's
authorcem <cem@FreeBSD.org>
Wed, 14 Oct 2015 23:47:35 +0000 (23:47 +0000)
committercem <cem@FreeBSD.org>
Wed, 14 Oct 2015 23:47:35 +0000 (23:47 +0000)
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.

Authored by: Jon Mason
Obtained from: Linux (Dual BSD/GPL driver)
Sponsored by: EMC / Isilon Storage Division

sys/dev/ntb/if_ntb/if_ntb.c

index 751d24d28f062862415da14f39f4105bee2ef9ce..13c77fab70d25d38b424c4c63e9a24caaf50f4c2 100644 (file)
@@ -566,7 +566,7 @@ ntb_transport_init_queue(struct ntb_netdev *nt, unsigned int qp_num)
        qp->client_ready = NTB_LINK_DOWN;
        qp->event_handler = NULL;
 
-       if (nt->max_qps % NTB_NUM_MW && mw_num < nt->max_qps % NTB_NUM_MW)
+       if (nt->max_qps % NTB_NUM_MW && mw_num + 1 < nt->max_qps / NTB_NUM_MW)
                num_qps_mw = nt->max_qps / NTB_NUM_MW + 1;
        else
                num_qps_mw = nt->max_qps / NTB_NUM_MW;
@@ -1197,7 +1197,7 @@ ntb_transport_setup_qp_mw(struct ntb_netdev *nt, unsigned int qp_num)
        uint8_t mw_num = QP_TO_MW(qp_num);
        unsigned int i;
 
-       if (nt->max_qps % NTB_NUM_MW && mw_num < nt->max_qps % NTB_NUM_MW)
+       if (nt->max_qps % NTB_NUM_MW && mw_num + 1 < nt->max_qps / NTB_NUM_MW)
                num_qps_mw = nt->max_qps / NTB_NUM_MW + 1;
        else
                num_qps_mw = nt->max_qps / NTB_NUM_MW;