public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mike Marciniszyn
	<mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Jianxin Xiong
	<jianxin.xiong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 10/10] IB/hfi1: Fix credit return threshold adjustment
Date: Tue, 24 May 2016 12:51:12 -0700	[thread overview]
Message-ID: <20160524195111.19706.76829.stgit@scvm10.sc.intel.com> (raw)
In-Reply-To: <20160524194746.19706.42976.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>

From: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

The credit return threshold adjustment on mtu change algorithm does not
take into account all the kernel send contexts that are assigned per VL.
Use the pio send context map to adjust the credit return thresholds for
all the allocated and assigned kernel send contexts based on the MTU
adjustment per VL.

The pio send context map can be changed dynamically based on the actual
number of operational vls which is set by the fabric manager. When this
happens update the credit return threshold values for all the remapped
kernel send contexts.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Jianxin Xiong <jianxin.xiong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/hfi1/chip.c |    7 +++++--
 drivers/infiniband/hw/hfi1/pio.c  |   21 +++++++++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index 3b876da..be4fd3e 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -9777,7 +9777,7 @@ static void set_send_length(struct hfi1_pportdata *ppd)
 	u64 len1 = 0, len2 = (((dd->vld[15].mtu + max_hb) >> 2)
 			      & SEND_LEN_CHECK1_LEN_VL15_MASK) <<
 		SEND_LEN_CHECK1_LEN_VL15_SHIFT;
-	int i;
+	int i, j;
 	u32 thres;
 
 	for (i = 0; i < ppd->vls_supported; i++) {
@@ -9801,7 +9801,10 @@ static void set_send_length(struct hfi1_pportdata *ppd)
 			    sc_mtu_to_threshold(dd->vld[i].sc,
 						dd->vld[i].mtu,
 						dd->rcd[0]->rcvhdrqentsize));
-		sc_set_cr_threshold(dd->vld[i].sc, thres);
+		for (j = 0; j < INIT_SC_PER_VL; j++)
+			sc_set_cr_threshold(
+					pio_select_send_context_vl(dd, j, i),
+					    thres);
 	}
 	thres = min(sc_percent_to_threshold(dd->vld[15].sc, 50),
 		    sc_mtu_to_threshold(dd->vld[15].sc,
diff --git a/drivers/infiniband/hw/hfi1/pio.c b/drivers/infiniband/hw/hfi1/pio.c
index d5edb1a..d5a9a5c 100644
--- a/drivers/infiniband/hw/hfi1/pio.c
+++ b/drivers/infiniband/hw/hfi1/pio.c
@@ -1832,6 +1832,7 @@ int pio_map_init(struct hfi1_devdata *dd, u8 port, u8 num_vls, u8 *vl_scontexts)
 	int scontext = 1;
 	int num_kernel_send_contexts = 0;
 	u8 lvl_scontexts[OPA_MAX_VLS];
+	u32 thres;
 	struct pio_vl_map *oldmap, *newmap;
 
 	if (!vl_scontexts) {
@@ -1872,11 +1873,27 @@ int pio_map_init(struct hfi1_devdata *dd, u8 port, u8 num_vls, u8 *vl_scontexts)
 			if (!newmap->map[i])
 				goto bail;
 			newmap->map[i]->mask = (1 << ilog2(sz)) - 1;
-			/* assign send contexts */
+			/*
+			 * assign send contexts and
+			 * adjust credit return threshold
+			 */
 			for (j = 0; j < sz; j++) {
-				if (dd->kernel_send_context[scontext])
+				if (dd->kernel_send_context[scontext]) {
 					newmap->map[i]->ksc[j] =
 					dd->kernel_send_context[scontext];
+					thres = min(sc_percent_to_threshold(
+						    dd->kernel_send_context
+						    [scontext], 50),
+						    sc_mtu_to_threshold(
+						    dd->kernel_send_context
+						    [scontext], dd->vld[i].mtu,
+						    dd->rcd[0]->rcvhdrqentsize)
+						    );
+					sc_set_cr_threshold(
+						dd->
+						kernel_send_context[scontext],
+						thres);
+				}
 				if (++scontext >= first_scontext +
 						  vl_scontexts[i])
 					/* wrap back to first send context */

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-05-24 19:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 19:50 [PATCH 00/10] IB/hfi1,rdmavt: Another set of fixes for 4.7 Dennis Dalessandro
     [not found] ` <20160524194746.19706.42976.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2016-05-24 19:50   ` [PATCH 01/10] IB/hfi1, qib: Add ieth to the packet header definitions Dennis Dalessandro
2016-05-24 19:50   ` [PATCH 02/10] IB/hfi1: Add tracing support for send with invalidate opcode Dennis Dalessandro
2016-05-24 19:50   ` [PATCH 03/10] IB/hfi1: Fix hard lockup due to not using save/restore spin lock Dennis Dalessandro
2016-05-24 19:50   ` [PATCH 04/10] IB/rdmavt: Max atomic value should be a u8 Dennis Dalessandro
2016-05-24 19:50   ` [PATCH 05/10] IB/rdamvt: Fix rdmavt s_ack_queue sizing Dennis Dalessandro
     [not found]     ` <20160524195039.19706.66866.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2016-05-25 18:29       ` Leon Romanovsky
     [not found]         ` <20160525182928.GP25500-2ukJVAZIZ/Y@public.gmane.org>
2016-05-25 19:05           ` Dennis Dalessandro
2016-05-24 19:50   ` [PATCH 06/10] IB/hfi1: Update pkey table properly after link down or FM start Dennis Dalessandro
2016-05-24 19:50   ` [PATCH 07/10] IB/hfi1: Add a retry for the first-time QSFP access Dennis Dalessandro
     [not found]     ` <6395227d-617c-bd70-2822-6b53843f8611@redhat.com>
     [not found]       ` <6395227d-617c-bd70-2822-6b53843f8611-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-26 17:39         ` Dennis Dalessandro
2016-05-24 19:51   ` [PATCH 08/10] IB/hfi1: Correct 8051 link parameter settings Dennis Dalessandro
2016-05-24 19:51   ` [PATCH 09/10] IB/hfi1: Fix pio map initialization Dennis Dalessandro
2016-05-24 19:51   ` Dennis Dalessandro [this message]
     [not found]     ` <20160524195111.19706.76829.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2016-05-25 13:36       ` [PATCH 10/10] IB/hfi1: Fix credit return threshold adjustment Leon Romanovsky
     [not found]         ` <20160525133613.GN25500-2ukJVAZIZ/Y@public.gmane.org>
2016-05-25 15:27           ` Bart Van Assche
     [not found]             ` <602d7329-b8ee-0e90-3afb-726ec44fb190-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-25 18:52               ` Dennis Dalessandro
2016-05-26 16:25   ` [PATCH 00/10] IB/hfi1,rdmavt: Another set of fixes for 4.7 Doug Ledford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160524195111.19706.76829.stgit@scvm10.sc.intel.com \
    --to=dennis.dalessandro-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=jianxin.xiong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox