From patchwork Mon Sep 24 08:39:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Manoil X-Patchwork-Id: 186315 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 619932C0084 for ; Mon, 24 Sep 2012 18:39:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755223Ab2IXIj3 (ORCPT ); Mon, 24 Sep 2012 04:39:29 -0400 Received: from co1ehsobe001.messaging.microsoft.com ([216.32.180.184]:53006 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751298Ab2IXIj1 (ORCPT ); Mon, 24 Sep 2012 04:39:27 -0400 Received: from mail35-co1-R.bigfish.com (10.243.78.231) by CO1EHSOBE007.bigfish.com (10.243.66.70) with Microsoft SMTP Server id 14.1.225.23; Mon, 24 Sep 2012 08:39:26 +0000 Received: from mail35-co1 (localhost [127.0.0.1]) by mail35-co1-R.bigfish.com (Postfix) with ESMTP id B1BE35C00DD for ; Mon, 24 Sep 2012 08:39:26 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 1 X-BigFish: VS1(zzd6f1izz1202h1d1ah1d2ahzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah1155h) Received: from mail35-co1 (localhost.localdomain [127.0.0.1]) by mail35-co1 (MessageSwitch) id 134847596463414_3384; Mon, 24 Sep 2012 08:39:24 +0000 (UTC) Received: from CO1EHSMHS010.bigfish.com (unknown [10.243.78.245]) by mail35-co1.bigfish.com (Postfix) with ESMTP id 0CCFB40047 for ; Mon, 24 Sep 2012 08:39:24 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO1EHSMHS010.bigfish.com (10.243.66.20) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 24 Sep 2012 08:39:22 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.2.309.3; Mon, 24 Sep 2012 03:39:20 -0500 Received: from zro04-ws574.ea.freescale.net ([10.213.130.145]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q8O8dINH018659 for ; Mon, 24 Sep 2012 01:39:19 -0700 Received: from zro04-ws574.ea.freescale.net (localhost.localdomain [127.0.0.1]) by zro04-ws574.ea.freescale.net (8.14.5/8.14.5) with ESMTP id q8O8dAcX022757; Mon, 24 Sep 2012 11:39:11 +0300 Received: (from b08782@localhost) by zro04-ws574.ea.freescale.net (8.14.5/8.14.5/Submit) id q8O8d8ow022756; Mon, 24 Sep 2012 11:39:08 +0300 From: Claudiu Manoil To: CC: "David S. Miller" , Paul Gortmaker , Claudiu Manoil Subject: [PATCH net-next v1] gianfar: Change default HW Tx queue scheduling mode Date: Mon, 24 Sep 2012 11:39:08 +0300 Message-ID: <1348475948-22721-1-git-send-email-claudiu.manoil@freescale.com> X-Mailer: git-send-email 1.7.6.5 MIME-Version: 1.0 X-OriginatorOrg: freescale.net Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is primarily to address transmission timeout occurrences, when multiple H/W Tx queues are being used concurrently. Because in the priority scheduling mode the controller does not service the Tx queues equally (but in ascending index order), Tx timeouts are being triggered rightaway for a basic test with multiple simultaneous connections like: iperf -c -n 100M -P 8 resulting in kernel trace: NETDEV WATCHDOG: eth1 (fsl-gianfar): transmit queue timed out ------------[ cut here ]------------ WARNING: at net/sched/sch_generic.c:255 ... and controller reset during intense traffic, and possibly further complications. This patch changes the default H/W Tx scheduling setting (TXSCHED) for multi-queue devices, from priority scheduling mode to a weighted round robin mode with equal weights for all H/W Tx queues, and addresses the issue above. Signed-off-by: Claudiu Manoil --- v1: removed runtime config option of tx scheduling mode (i.e. prio_sched_en) (to be provided in a distinct patch) drivers/net/ethernet/freescale/gianfar.c | 11 ++++++++++- drivers/net/ethernet/freescale/gianfar.h | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 4d5b58c..a1b52ec 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -394,7 +394,13 @@ static void gfar_init_mac(struct net_device *ndev) if (ndev->features & NETIF_F_IP_CSUM) tctrl |= TCTRL_INIT_CSUM; - tctrl |= TCTRL_TXSCHED_PRIO; + if (priv->prio_sched_en) + tctrl |= TCTRL_TXSCHED_PRIO; + else { + tctrl |= TCTRL_TXSCHED_WRRS; + gfar_write(®s->tr03wt, DEFAULT_WRRS_WEIGHT); + gfar_write(®s->tr47wt, DEFAULT_WRRS_WEIGHT); + } gfar_write(®s->tctrl, tctrl); @@ -1160,6 +1166,9 @@ static int gfar_probe(struct platform_device *ofdev) priv->rx_filer_enable = 1; /* Enable most messages by default */ priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; + /* use pritority h/w tx queue scheduling for single queue devices */ + if (priv->num_tx_queues == 1) + priv->prio_sched_en = 1; /* Carrier starts down, phylib will bring it up */ netif_carrier_off(dev); diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h index 2136c7f..4141ef2 100644 --- a/drivers/net/ethernet/freescale/gianfar.h +++ b/drivers/net/ethernet/freescale/gianfar.h @@ -301,8 +301,16 @@ extern const char gfar_driver_version[]; #define TCTRL_TFCPAUSE 0x00000008 #define TCTRL_TXSCHED_MASK 0x00000006 #define TCTRL_TXSCHED_INIT 0x00000000 +/* priority scheduling */ #define TCTRL_TXSCHED_PRIO 0x00000002 +/* weighted round-robin scheduling (WRRS) */ #define TCTRL_TXSCHED_WRRS 0x00000004 +/* default WRRS weight and policy setting, + * tailored to the tr03wt and tr47wt registers: + * equal weight for all Tx Qs, measured in 64byte units + */ +#define DEFAULT_WRRS_WEIGHT 0x18181818 + #define TCTRL_INIT_CSUM (TCTRL_TUCSEN | TCTRL_IPCSEN) #define IEVENT_INIT_CLEAR 0xffffffff @@ -1098,7 +1106,8 @@ struct gfar_private { extended_hash:1, bd_stash_en:1, rx_filer_enable:1, - wol_en:1; /* Wake-on-LAN enabled */ + wol_en:1, /* Wake-on-LAN enabled */ + prio_sched_en:1; /* Enable priorty based Tx scheduling in Hw */ unsigned short padding; /* PHY stuff */