All of lore.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,
	Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Mike Marciniszyn
	<mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Arthur Kepner
	<arthur.kepner-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Vennila Megavannan
	<vennila.megavannan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 17/54] staging/rdma/hfi1: Method to toggle "fast ECN" detection
Date: Wed, 03 Feb 2016 14:32:57 -0800	[thread overview]
Message-ID: <20160203223254.5923.60805.stgit@scvm10.sc.intel.com> (raw)
In-Reply-To: <20160203222512.5923.30980.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>

From: Vennila Megavannan <vennila.megavannan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Add a per port sysfs paramter to toggle cc_prescan/Fast ECN Detection and
remove the Kconfig option which was previously used to control this.

While am updating the sysfs documentation, fix the name of CCMgtA.

Reviewed-by: Arthur Kepner <arthur.kepner-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Vennila Megavannan <vennila.megavannan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

---
Changes from V1:
	Redo commit message as well as Kconfig help to make it clear what the
	compile and module options do.

Changes from V2:
	Remove Kconfig option completely

Changes from V3:
	convert module parameter to sysfs parameter
	The use of a sysfs parameter was discussed:
		https://www.mail-archive.com/linux-rdma%40vger.kernel.org/msg29694.html
---
 Documentation/infiniband/sysfs.txt |    3 +-
 drivers/staging/rdma/hfi1/Kconfig  |   10 -----
 drivers/staging/rdma/hfi1/driver.c |   24 ++++++-------
 drivers/staging/rdma/hfi1/hfi.h    |    2 +
 drivers/staging/rdma/hfi1/sysfs.c  |   66 ++++++++++++++++++++++++++++++++++--
 5 files changed, 77 insertions(+), 28 deletions(-)

diff --git a/Documentation/infiniband/sysfs.txt b/Documentation/infiniband/sysfs.txt
index 9028b02..3ecf0c3 100644
--- a/Documentation/infiniband/sysfs.txt
+++ b/Documentation/infiniband/sysfs.txt
@@ -78,9 +78,10 @@ HFI1
    chip_reset - diagnostic (root only)
    boardversion - board version
    ports/1/
-          CMgtA/
+          CCMgtA/
                cc_settings_bin - CCA tables used by PSM2
                cc_table_bin
+               cc_prescan - enable prescaning for faster BECN response
           sc2v/ - 32 files (0 - 31) used to translate sl->vl
           sl2sc/ - 32 files (0 - 31) used to translate sl->sc
           vl2mtu/ - 16 (0 - 15) files used to determine MTU for vl
diff --git a/drivers/staging/rdma/hfi1/Kconfig b/drivers/staging/rdma/hfi1/Kconfig
index 846c240..3e668d8 100644
--- a/drivers/staging/rdma/hfi1/Kconfig
+++ b/drivers/staging/rdma/hfi1/Kconfig
@@ -26,13 +26,3 @@ config SDMA_VERBOSITY
 	---help---
 	This is a configuration flag to enable verbose
 	SDMA debug
-config PRESCAN_RXQ
-	bool "Enable prescanning of the RX queue for ECNs"
-	depends on INFINIBAND_HFI1
-	default n
-	---help---
-	This option toggles the prescanning of the receive queue for
-	Explicit Congestion Notifications. If an ECN is detected, it
-	is processed as quickly as possible, the ECN is toggled off.
-	After the prescanning step, the receive queue is processed as
-	usual.
diff --git a/drivers/staging/rdma/hfi1/driver.c b/drivers/staging/rdma/hfi1/driver.c
index d848cc0..59ce85f 100644
--- a/drivers/staging/rdma/hfi1/driver.c
+++ b/drivers/staging/rdma/hfi1/driver.c
@@ -453,11 +453,6 @@ static inline void init_packet(struct hfi1_ctxtdata *rcd,
 	packet->rcv_flags = 0;
 }
 
-#ifndef CONFIG_PRESCAN_RXQ
-static void prescan_rxq(struct hfi1_packet *packet) {}
-#else /* !CONFIG_PRESCAN_RXQ */
-static int prescan_receive_queue;
-
 static void process_ecn(struct rvt_qp *qp, struct hfi1_ib_header *hdr,
 			struct hfi1_other_headers *ohdr,
 			u64 rhf, u32 bth1, struct ib_grh *grh)
@@ -581,15 +576,19 @@ static inline void update_ps_mdata(struct ps_mdata *mdata,
  * containing Excplicit Congestion Notifications (FECNs, or BECNs).
  * When an ECN is found, process the Congestion Notification, and toggle
  * it off.
+ * This is declared as a macro to allow quick checking of the port to avoid
+ * the overhead of a function call if not enabled.
  */
-static void prescan_rxq(struct hfi1_packet *packet)
+#define prescan_rxq(rcd, packet) \
+	do { \
+		if (rcd->ppd->cc_prescan) \
+			__prescan_rxq(packet); \
+	} while (0)
+static void __prescan_rxq(struct hfi1_packet *packet)
 {
 	struct hfi1_ctxtdata *rcd = packet->rcd;
 	struct ps_mdata mdata;
 
-	if (!prescan_receive_queue)
-		return;
-
 	init_ps_mdata(&mdata, packet);
 
 	while (1) {
@@ -653,7 +652,6 @@ next:
 		update_ps_mdata(&mdata, rcd);
 	}
 }
-#endif /* CONFIG_PRESCAN_RXQ */
 
 static inline int skip_rcv_packet(struct hfi1_packet *packet, int thread)
 {
@@ -819,7 +817,7 @@ int handle_receive_interrupt_nodma_rtail(struct hfi1_ctxtdata *rcd, int thread)
 		goto bail;
 	}
 
-	prescan_rxq(&packet);
+	prescan_rxq(rcd, &packet);
 
 	while (last == RCV_PKT_OK) {
 		last = process_rcv_packet(&packet, thread);
@@ -850,7 +848,7 @@ int handle_receive_interrupt_dma_rtail(struct hfi1_ctxtdata *rcd, int thread)
 	}
 	smp_rmb();  /* prevent speculative reads of dma'ed hdrq */
 
-	prescan_rxq(&packet);
+	prescan_rxq(rcd, &packet);
 
 	while (last == RCV_PKT_OK) {
 		last = process_rcv_packet(&packet, thread);
@@ -961,7 +959,7 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread)
 		}
 	}
 
-	prescan_rxq(&packet);
+	prescan_rxq(rcd, &packet);
 
 	while (last == RCV_PKT_OK) {
 
diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h
index 76c369a..d19d6b7 100644
--- a/drivers/staging/rdma/hfi1/hfi.h
+++ b/drivers/staging/rdma/hfi1/hfi.h
@@ -734,6 +734,8 @@ struct hfi1_pportdata {
 	/* Error events that will cause a port bounce. */
 	u32 port_error_action;
 	struct work_struct linkstate_active_work;
+	/* Does this port need to prescan for FECNs */
+	bool cc_prescan;
 };
 
 typedef int (*rhf_rcv_function_ptr)(struct hfi1_packet *packet);
diff --git a/drivers/staging/rdma/hfi1/sysfs.c b/drivers/staging/rdma/hfi1/sysfs.c
index d05b9f3..f1d47e7 100644
--- a/drivers/staging/rdma/hfi1/sysfs.c
+++ b/drivers/staging/rdma/hfi1/sysfs.c
@@ -99,10 +99,6 @@ static void port_release(struct kobject *kobj)
 	/* nothing to do since memory is freed by hfi1_free_devdata() */
 }
 
-static struct kobj_type port_cc_ktype = {
-	.release = port_release,
-};
-
 static struct bin_attribute cc_table_bin_attr = {
 	.attr = {.name = "cc_table_bin", .mode = 0444},
 	.read = read_cc_table_bin,
@@ -151,6 +147,68 @@ static struct bin_attribute cc_setting_bin_attr = {
 	.size = PAGE_SIZE,
 };
 
+struct hfi1_port_attr {
+	struct attribute attr;
+	ssize_t	(*show)(struct hfi1_pportdata *, char *);
+	ssize_t	(*store)(struct hfi1_pportdata *, const char *, size_t);
+};
+
+static ssize_t cc_prescan_show(struct hfi1_pportdata *ppd, char *buf)
+{
+	return sprintf(buf, "%s\n", ppd->cc_prescan ? "on" : "off");
+}
+
+static ssize_t cc_prescan_store(struct hfi1_pportdata *ppd, const char *buf,
+				size_t count)
+{
+	if (!memcmp(buf, "on", 2))
+		ppd->cc_prescan = true;
+	else if (!memcmp(buf, "off", 3))
+		ppd->cc_prescan = false;
+
+	return count;
+}
+
+static struct hfi1_port_attr cc_prescan_attr =
+		__ATTR(cc_prescan, 0600, cc_prescan_show, cc_prescan_store);
+
+static ssize_t cc_attr_show(struct kobject *kobj, struct attribute *attr,
+			    char *buf)
+{
+	struct hfi1_port_attr *port_attr =
+		container_of(attr, struct hfi1_port_attr, attr);
+	struct hfi1_pportdata *ppd =
+		container_of(kobj, struct hfi1_pportdata, pport_cc_kobj);
+
+	return port_attr->show(ppd, buf);
+}
+
+static ssize_t cc_attr_store(struct kobject *kobj, struct attribute *attr,
+			     const char *buf, size_t count)
+{
+	struct hfi1_port_attr *port_attr =
+		container_of(attr, struct hfi1_port_attr, attr);
+	struct hfi1_pportdata *ppd =
+		container_of(kobj, struct hfi1_pportdata, pport_cc_kobj);
+
+	return port_attr->store(ppd, buf, count);
+}
+
+static const struct sysfs_ops port_cc_sysfs_ops = {
+	.show = cc_attr_show,
+	.store = cc_attr_store
+};
+
+static struct attribute *port_cc_default_attributes[] = {
+	&cc_prescan_attr.attr
+};
+
+static struct kobj_type port_cc_ktype = {
+	.release = port_release,
+	.sysfs_ops = &port_cc_sysfs_ops,
+	.default_attrs = port_cc_default_attributes
+};
+
 /* Start sc2vl */
 #define HFI1_SC2VL_ATTR(N)				    \
 	static struct hfi1_sc2vl_attr hfi1_sc2vl_attr_##N = { \

--
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-02-03 22:32 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 22:30 [PATCH 00/54] staging/rdma/hfi1: Various bug fixes for hfi1 post rdmavt Dennis Dalessandro
     [not found] ` <20160203222512.5923.30980.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2016-02-03 22:30   ` [PATCH 01/54] staging/rdma/hfi1: Remove srq functionality Dennis Dalessandro
2016-02-03 22:30   ` [PATCH 02/54] staging/rdma/hfi1: HFI reports wrong offline disabled reason when cable removed Dennis Dalessandro
2016-02-03 22:30   ` [PATCH 03/54] staging/rdma/hfi1: cleanup messages on qsfp_read() failure Dennis Dalessandro
2016-02-03 22:31   ` [PATCH 04/54] staging/rdma/hfi1: Fix QSFP memory read/write across 128 byte boundary Dennis Dalessandro
2016-02-03 22:31   ` [PATCH 05/54] staging/rdma/hfi1: Add active and optical cable support Dennis Dalessandro
2016-02-03 22:31   ` [PATCH 06/54] staging/rdma/hfi1: Get port type from configuration file Dennis Dalessandro
2016-02-03 22:31   ` [PATCH 07/54] staging/rdma/hfi1: Support external device configuration requests from 8051 Dennis Dalessandro
2016-02-03 22:31   ` [PATCH 08/54] staging/rdma/hfi1: Fix missing firmware NULL dereference Dennis Dalessandro
2016-02-03 22:31   ` [PATCH 09/54] staging/rdma/hfi1: Fix per-VL transmit discard counts Dennis Dalessandro
2016-02-03 22:31   ` [PATCH 10/54] staging/rdma/hfi1: Only warn when board description is not found Dennis Dalessandro
2016-02-03 22:32   ` [PATCH 11/54] staging/rdma/hfi1: Make firmware failure messages warnings Dennis Dalessandro
2016-02-03 22:32   ` [PATCH 12/54] staging/rdma/hfi1: Don't attempt to qualify or tune loopback plugs Dennis Dalessandro
2016-02-03 22:32   ` [PATCH 13/54] staging/rdma/hfi1: No firmware retry for simulation Dennis Dalessandro
2016-02-03 22:32   ` [PATCH 14/54] staging/rdma/hfi1: Skip lcb init " Dennis Dalessandro
2016-02-03 22:32   ` [PATCH 15/54] staging/rdma/hfi1: Fix for 32-bit counter overflow in driver and hfi1stats Dennis Dalessandro
2016-02-03 22:32   ` [PATCH 16/54] staging/rdma/hfi1: Correctly set RcvCtxtCtrl register Dennis Dalessandro
2016-02-03 22:32   ` Dennis Dalessandro [this message]
2016-02-03 22:33   ` [PATCH 18/54] staging/rdma/hfi1: Add support for enabling/disabling PCIe ASPM Dennis Dalessandro
     [not found]     ` <20160203223302.5923.92377.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2016-02-23 11:57       ` Andy Shevchenko
     [not found]         ` <20160223115728.GA6058-XvqNBM/wLWRrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2016-02-25  3:00           ` Ashutosh Dixit
     [not found]             ` <tnm1t60xd334v.fsf-f6XKxGr23Gihg59KIB+fZth3ngVCH38I@public.gmane.org>
2016-02-25 13:38               ` Shevchenko, Andriy
2016-02-03 22:33   ` [PATCH 19/54] staging/rdma/hfi1: Fix SL->SC checks Dennis Dalessandro
2016-02-03 22:33   ` [PATCH 20/54] staging/rdma/hfi1: Remove unused code Dennis Dalessandro
2016-02-03 22:33   ` [PATCH 21/54] staging/rdma/hfi1: Remove unnecessary duplicated variable Dennis Dalessandro
2016-02-03 22:33   ` [PATCH 22/54] staging/rdma/hfi1: Consolidate CPU/IRQ affinity support Dennis Dalessandro
2016-02-03 22:33   ` [PATCH 23/54] staging/rdma/hfi1: Allocate send ctxt on device NUMA node Dennis Dalessandro
2016-02-03 22:33   ` [PATCH 24/54] staging/rdma/hfi1: Verbs Mem affinity support Dennis Dalessandro
2016-02-03 22:34   ` [PATCH 25/54] staging/rdma/hfi1: Change send_schedule counter to a per cpu counter Dennis Dalessandro
2016-02-03 22:34   ` [PATCH 26/54] staging/rdma/hfi1: Fix for generic I2C interface Dennis Dalessandro
2016-02-03 22:34   ` [PATCH 27/54] staging/rdma/hfi1: Allow a fair scheduling of QPs Dennis Dalessandro
2016-02-03 22:34   ` [PATCH 28/54] staging/rdma/hfi1: Fix for module parameter rcvhdrcnt when it's 2097152 Dennis Dalessandro
2016-02-03 22:34   ` [PATCH 29/54] staging/rdma/hfi1: Improve performance of TID cache look up Dennis Dalessandro
2016-02-03 22:34   ` [PATCH 30/54] staging/rdma/hfi1: Reduce syslog message severity and provide speed information Dennis Dalessandro
2016-02-03 22:34   ` [PATCH 31/54] staging/rdma/hfi1: Use device file minor to identify EPROM Dennis Dalessandro
2016-02-03 22:35   ` [PATCH 32/54] staging/rdma/hfi1: Improve performance of SDMA transfers Dennis Dalessandro
2016-02-03 22:35   ` [PATCH 33/54] staging/rdma/hfi1: correctly check for post-interrupt packets Dennis Dalessandro
2016-02-03 22:35   ` [PATCH 34/54] staging/rdma/hfi1: Properly determine error status of SDMA slots Dennis Dalessandro
2016-02-03 22:35   ` [PATCH 35/54] staging/rdma/hfi1: Report physical state changes per device instead of globally Dennis Dalessandro
2016-02-03 22:35   ` [PATCH 36/54] staging/rdma/hfi1: Fix fabric serdes reset by re-downloading firmware Dennis Dalessandro
2016-02-03 22:35   ` [PATCH 37/54] staging/rdma/hfi1: Split last 8 bytes of copy to user buffer Dennis Dalessandro
2016-02-03 22:35   ` [PATCH 38/54] staging/rdma/hfi1: Implement LED beaconing for maintenance Dennis Dalessandro
2016-02-03 22:36   ` [PATCH 39/54] staging/rdma/hfi1: Remove PCIe AER diagnostic message Dennis Dalessandro
2016-02-03 22:36   ` [PATCH 40/54] staging/rdma/hfi1: Correct TWSI reset Dennis Dalessandro
2016-02-03 22:36   ` [PATCH 41/54] staging/rdma/hfi1: Fix snoop packet length calculation Dennis Dalessandro
2016-02-03 22:36   ` [PATCH 42/54] staging/rdma/hfi1: Clean up init_cntrs() Dennis Dalessandro
2016-02-03 22:36   ` [PATCH 43/54] staging/rdma/hfi1: Support query gid in rdmavt Dennis Dalessandro
2016-02-03 22:36   ` [PATCH 44/54] staging/rdma/hfi1: Remove modify_port and port_immutable functions Dennis Dalessandro
2016-02-03 22:36   ` [PATCH 45/54] staging/rdma/hfi1, IB/core: Fix LinkDownReason define for consistency Dennis Dalessandro
2016-02-03 22:37   ` [PATCH 46/54] staging/rdma/hfi1: Improve performance of user SDMA Dennis Dalessandro
2016-02-03 22:37   ` [PATCH 47/54] staging/rdma/hfi1: Add credits for VL0 to VL7 in snoop mode Dennis Dalessandro
2016-02-03 22:37   ` [PATCH 48/54] staging/rdma/hfi1: Make EPROM check per device Dennis Dalessandro
2016-02-03 22:37   ` [PATCH 49/54] staging/rdma/hfi1: Remove unused variable nsbr Dennis Dalessandro
2016-02-03 22:37   ` [PATCH 50/54] staging/rdma/hfi1: Fix bug that could block the process on context exit Dennis Dalessandro
2016-02-03 22:37   ` [PATCH 51/54] staging/rdma/hfi1: Change for data type of port number Dennis Dalessandro
2016-02-03 22:37   ` [PATCH 52/54] staging/rdma/hfi1: Replacement of goto's for break/returns Dennis Dalessandro
2016-02-03 22:38   ` [PATCH 53/54] staging/rdma/hfi1: Adding support for hfi counters via sysfs Dennis Dalessandro
2016-02-03 22:38   ` [PATCH 54/54] staging/rdma/hfi1: Removing unused struct hfi1_verbs_counters Dennis Dalessandro

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=20160203223254.5923.60805.stgit@scvm10.sc.intel.com \
    --to=dennis.dalessandro-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=arthur.kepner-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=vennila.megavannan-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.