encode SL in sched_queue field to improve hardware QoS guarantees
for connected QPs.

Signed-off-by: Michael S. Tsirkin <[EMAIL PROTECTED]>

---

Index: linux-2.6/drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/hw/mthca/mthca_qp.c
+++ linux-2.6/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -49,6 +49,10 @@
 #include "mthca_memfree.h"
 #include "mthca_wqe.h"
 
+static int mthca_qos_support = 0;
+module_param_named(qos_support, mthca_qos_support, int, 0644);
+MODULE_PARM_DESC(qos_support, "Enable QoS support if > 0");
+
 enum {
        MTHCA_MAX_DIRECT_QP_SIZE = 4 * PAGE_SIZE,
        MTHCA_ACK_REQ_FREQ       = 10,
@@ -694,6 +698,19 @@ int mthca_modify_qp(struct ib_qp *ibqp, 
                        goto out_mailbox;
 
                qp_param->opt_param_mask |= 
cpu_to_be32(MTHCA_QP_OPTPAR_PRIMARY_ADDR_PATH);
+               if (mthca_qos_support) {
+                       u8 sl = attr->ah_attr.sl;
+                       u8 sched_queue = (sl & 0x8) | (sl & (~(sl >> 1)) & 0x4) 
|
+                               ((sl >> 1) & (sl >> 2) & 0x2) | ((sl >> 1) & 
0x1);
+
+                       if (mthca_is_memfree(dev)) {
+                               qp_context->rlkey_arbel_sched_queue |= 
sched_queue;
+                       } else {
+                               qp_context->tavor_sched_queue |= sched_queue;
+                       }
+                       qp_param->opt_param_mask |=
+                               cpu_to_be32(MTHCA_QP_OPTPAR_SCHED_QUEUE);
+               }
        }
 
        if (attr_mask & IB_QP_TIMEOUT) {


-- 
MST

_______________________________________________
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to