From patchwork Thu Nov 5 02:10:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 7556721 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6D185BEEA4 for ; Thu, 5 Nov 2015 02:10:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 796312082F for ; Thu, 5 Nov 2015 02:10:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69E792082C for ; Thu, 5 Nov 2015 02:10:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756325AbbKECKX (ORCPT ); Wed, 4 Nov 2015 21:10:23 -0500 Received: from mga02.intel.com ([134.134.136.20]:7839 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756354AbbKECKX (ORCPT ); Wed, 4 Nov 2015 21:10:23 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 04 Nov 2015 18:10:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,245,1444719600"; d="scan'208";a="842902588" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by orsmga002.jf.intel.com with ESMTP; 04 Nov 2015 18:10:21 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id tA52AKHo022600; Wed, 4 Nov 2015 21:10:20 -0500 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id tA52AJxs022597; Wed, 4 Nov 2015 21:10:19 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: iweiny set sender to ira.weiny@intel.com using -f From: ira.weiny@intel.com To: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org Cc: dledford@redhat.com, linux-rdma@vger.kernel.org, mike.marciniszyn@intel.com, Vennila Megavannan , Ira Weiny Subject: [PATCH 3/3] staging/rdma/hfi1: Method to toggle "fast ECN" detection Date: Wed, 4 Nov 2015 21:10:11 -0500 Message-Id: <1446689411-22263-4-git-send-email-ira.weiny@intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1446689411-22263-1-git-send-email-ira.weiny@intel.com> References: <1446689411-22263-1-git-send-email-ira.weiny@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vennila Megavannan Add a module paramter to toggle prescan/Fast ECN Detection. In addition change the PRESCAN_RXQ Kconfig default to "yes". Reviewed-by: Arthur Kepner Reviewed-by: Mike Marciniszyn Signed-off-by: Vennila Megavannan Signed-off-by: Ira Weiny --- drivers/staging/rdma/hfi1/Kconfig | 14 +++++++------- drivers/staging/rdma/hfi1/driver.c | 24 +++++++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rdma/hfi1/Kconfig b/drivers/staging/rdma/hfi1/Kconfig index fd25078ee923..cfc9f9324b8d 100644 --- a/drivers/staging/rdma/hfi1/Kconfig +++ b/drivers/staging/rdma/hfi1/Kconfig @@ -26,12 +26,12 @@ config SDMA_VERBOSITY This is a configuration flag to enable verbose SDMA debug config PRESCAN_RXQ - bool "Enable prescanning of the RX queue for ECNs" + bool "Enable optional prescanning of the RX queue for ECNs" depends on INFINIBAND_HFI1 - default n + default y ---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. + This option enables code for the prescanning of the receive queue for + Explicit Congestion Notifications. Pre-scanning can be controlled via a + module option at run time. 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 9a4ec09af020..4c1dd7130d7a 100644 --- a/drivers/staging/rdma/hfi1/driver.c +++ b/drivers/staging/rdma/hfi1/driver.c @@ -83,6 +83,14 @@ unsigned int hfi1_cu = 1; module_param_named(cu, hfi1_cu, uint, S_IRUGO); MODULE_PARM_DESC(cu, "Credit return units"); +#ifdef CONFIG_PRESCAN_RXQ +static unsigned int prescan_rx_queue; +module_param_named(prescan_rxq, prescan_rx_queue, uint, + S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(prescan_rxq, + "Used to toggle rx prescan. Set to 1 to enable prescan"); +#endif /* CONFIG_PRESCAN_RXQ */ + unsigned long hfi1_cap_mask = HFI1_CAP_MASK_DEFAULT; static int hfi1_caps_set(const char *, const struct kernel_param *); static int hfi1_caps_get(char *, const struct kernel_param *); @@ -435,10 +443,8 @@ static inline void init_packet(struct hfi1_ctxtdata *rcd, } #ifndef CONFIG_PRESCAN_RXQ -static void prescan_rxq(struct hfi1_packet *packet) {} +#define prescan_rxq(packet) #else /* !CONFIG_PRESCAN_RXQ */ -static int prescan_receive_queue; - static void process_ecn(struct hfi1_qp *qp, struct hfi1_ib_header *hdr, struct hfi1_other_headers *ohdr, u64 rhf, u32 bth1, struct ib_grh *grh) @@ -541,15 +547,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 module param and + * avoid the overhead of a function call if not enabled. */ -static void prescan_rxq(struct hfi1_packet *packet) +#define prescan_rxq(packet) \ + do { \ + if (prescan_rx_queue) \ + __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) {