Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753195AbdLUMdZ (ORCPT ); Thu, 21 Dec 2017 07:33:25 -0500 Received: from mail-co1nam03on0069.outbound.protection.outlook.com ([104.47.40.69]:55601 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752007AbdLUMdY (ORCPT ); Thu, 21 Dec 2017 07:33:24 -0500 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; From: Ioana Radulescu To: CC: , , Subject: [PATCH 2/2] staging: fsl-dpaa2/eth: Flow affinity for non-forwarded traffic Date: Thu, 21 Dec 2017 06:33:21 -0600 Message-ID: <20171221123321.22064-2-ruxandra.radulescu@nxp.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171221123321.22064-1-ruxandra.radulescu@nxp.com> References: <20171221123321.22064-1-ruxandra.radulescu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131583331883233317;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(336005)(39860400002)(346002)(396003)(376002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(81156014)(105606002)(36756003)(8676002)(51416003)(356003)(97736004)(50226002)(8936002)(76176011)(2906002)(59450400001)(104016004)(53936002)(47776003)(305945005)(77096006)(316002)(50466002)(48376002)(54906003)(498600001)(4326008)(2950100002)(16586007)(5660300001)(106466001)(8656006)(86362001)(68736007)(6916009)(85426001)(81166006)(2351001)(1076002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR03MB2368;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD048;1:HDpm4+UYXA5/TwJALIRNcxkQ2UCTykv3DScAYbhN6HwoNPLF6WWx58QNuIqxe8YabMGcFNIq8E3Rqo5I/lixt+TelkJj763aIzaGavyR/thQtIdW6Zvn9mcKK8t+kvBA MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d06dc057-e711-4a94-3025-08d5486efdba X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307);SRVR:SN2PR03MB2368; X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB2368;3:BJsoBUFNzPOPd8eLAEeMj/o6LnhrcTd46axrMBzfyItI8QfiurDeFTuy19Lq7Hs0x82MD3Ya8Xb3APa3509of10vtXRfhUSoZ4dWx7uqsLwMBUnQnGW0RjpWCnc+MtvSPPayq5mye0gEYzaoB9MLoMZYiDmpo6j0XgTcZDumyd605K/O6VuH4Wf8VD9qD3DsKtFv88TurIUcQKBkfV4ftD7bn+fwZZyBjSZJCqSbsmn1TQ7RoaStW+GfiirzHWkeTd2xHGa+/Kgr+MEqHOEHx9h6rLoGVYNHoIGjsNy/xa1EC9t+WxeaxoMB2U3MMsGr9VIn9Yu+pOot4jpLc3k82s927rMqxSFi8+VTeiGU59k=;25:3v3T3ElGRnRTl1CMwK0wnjvMNQFvxj45MsGG3JLrIckGv4SU4Q1I8HsbOJncJ1C9Jb3IGQN9C6bmFlU34C4HG+vCkaWEek9ynBX94Evx7+luOnselQs7i0AjIBqC0ZSGLFj0TmUtNTe7FKxJC+wLpIGaWIfKHA8or3Mnx5z+2GGbSWLDs8tNPRL2+MlLp0n2rs2giO4KcrV5OB9kWd6Shd3kH03exJuN2xfghZPYEY85yY5Jfvxd6E9ckCy/ufqOcIHmAjpsFKvtKx1QYBbOoJib4hxQfFDbmHPY2dMRH+CNK0YUq8FVKLFP2UZEb00LgsP4aE7Myxg+O1qeE/5vMO5qN1RUz7XnN0kn2spsyak= X-MS-TrafficTypeDiagnostic: SN2PR03MB2368: X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB2368;31:lVxTVWBCrC2qCrkQQf12csphdgd0l5QLiDINxVD2euZ65RaAuhJhZZlCcoqBCzyJIjXfnLkp7grgu237R/QmcFrzAAUpDnPXhJNQ1umMsuLt06kB1Oc4X7blXJTjc9YjVsAmUhnte9wuo/pniKIGLvyNaC7+VWzPtNeZ/0c6RfAJ1f8yMawxzaZQVdVphrU7EvaD01r9+bRjLs0uJcZJdis3Fykg4YUvzZqK1BfQjRc=;4:TmSQdJO52FOVrsW5rAWSrFDGoVPRZYS/NfpMcFCF1xOdSpH6iT8nQzt2QToRRF4Ce4auMvukObn8twCHQ9NUXOQ8sGjshenN+NVBA5aBDujmMwVIfau2qbgJpFgr6ADwC1CQTUUc28crRgafvhsFWGDIRJ8TtlROm5bMuv6l8LnKPcaltLf0IO531enmsEoJoPnwg0i131pPeziP61vDHnYMCgvUz+fraotl9VjjO9fGFCpGonh9v6KKR1RNjCdnSAtzdyvfZ6vFJzSZgoDrA9DD6JWIhdk2aDLwGqJBqHNfoVzCD5PuAa5rrPBVwp1W X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(2401047)(5005006)(8121501046)(10201501046)(3231023)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123563025)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(20161123556025)(20161123561025)(201708071742011);SRVR:SN2PR03MB2368;BCL:0;PCL:0;RULEID:(100000803101)(100110400095)(400006);SRVR:SN2PR03MB2368; X-Forefront-PRVS: 0528942FD8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR03MB2368;23:+ikJc169f+2QWXDn6i62bm9EoR8hcMf7witrYgqPc?= =?us-ascii?Q?1VrcsqCLx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avJ+/NoKdEbq6MdPtc698Ba2E4hYxIpM9YB6oQTPOrHwnE7RqF6nvVOLolebBppvKsJZ/sEv44a1hhyxeUgHrlHQ1Cj1T8FTDZzNmkQtuY3Gk4sbt+kv3lPKAn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 12:33:08.1517 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d06dc057-e711-4a94-3025-08d5486efdba X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2368 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1893 Lines: 50 The previous patch ensures Tx flow affinity for forwarded frames, but for termination traffic the initial flow affinity is determined based on the skb hash, which is expected to hit only a few Tx queues when there is a small number of flows. Instead, use XPS (transmit packet steering) to set netdevice queue affinity to the sending core. Signed-off-by: Bogdan Purcareata Signed-off-by: Ioana Radulescu --- drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c index b63ae09..824c4ad 100644 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c @@ -1620,9 +1620,10 @@ static struct dpaa2_eth_channel *get_affine_channel(struct dpaa2_eth_priv *priv, static void set_fq_affinity(struct dpaa2_eth_priv *priv) { struct device *dev = priv->net_dev->dev.parent; + struct cpumask xps_mask; struct dpaa2_eth_fq *fq; int rx_cpu, txc_cpu; - int i; + int i, err; /* For each FQ, pick one channel/CPU to deliver frames to. * This may well change at runtime, either through irqbalance or @@ -1641,6 +1642,17 @@ static void set_fq_affinity(struct dpaa2_eth_priv *priv) break; case DPAA2_TX_CONF_FQ: fq->target_cpu = txc_cpu; + + /* Tell the stack to affine to txc_cpu the Tx queue + * associated with the confirmation one + */ + cpumask_clear(&xps_mask); + cpumask_set_cpu(txc_cpu, &xps_mask); + err = netif_set_xps_queue(priv->net_dev, &xps_mask, + fq->flowid); + if (err) + dev_err(dev, "Error setting XPS queue\n"); + txc_cpu = cpumask_next(txc_cpu, &priv->dpio_cpumask); if (txc_cpu >= nr_cpu_ids) txc_cpu = cpumask_first(&priv->dpio_cpumask); -- 2.7.4