From patchwork Thu Aug 4 21:11:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 73316 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1599412qga; Thu, 4 Aug 2016 14:12:31 -0700 (PDT) X-Received: by 10.66.236.39 with SMTP id ur7mr128375932pac.6.1470345151128; Thu, 04 Aug 2016 14:12:31 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l29si16400082pfk.67.2016.08.04.14.12.31; Thu, 04 Aug 2016 14:12:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966293AbcHDVMQ (ORCPT + 4 others); Thu, 4 Aug 2016 17:12:16 -0400 Received: from mail-lf0-f52.google.com ([209.85.215.52]:32875 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966251AbcHDVMN (ORCPT ); Thu, 4 Aug 2016 17:12:13 -0400 Received: by mail-lf0-f52.google.com with SMTP id b199so190865844lfe.0 for ; Thu, 04 Aug 2016 14:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yEOLbkqbq0iERUlqBRlw2fCYIF8Oc+LPqaxj40qFP1M=; b=gkO3JXMmkzPPKiHyLdz9Tt+OGABKJFiXdlJDQDITyKjGv+5LXJs45Fl33gs1BO8D8i D5NCtISPgfRBmG720duAWIro3PJgFFmxjYOJeDax6arKa6xYX2PfEdKVDozoS4TQkils hpJVXl56kKgHPWlhfU+jIA8aBSNT3V04NzLnE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yEOLbkqbq0iERUlqBRlw2fCYIF8Oc+LPqaxj40qFP1M=; b=S5AKI1NDUTCZLo7Zs5PrbFYXf7g7oKMRBi89oprSnB8zMITSPSkkCuVnqJu2rXqaQB EGSgYUt4yVGe7CfMvPGGGGMDegkVURS9NeIXS/Su5NgDdh1QP9FyIvJ3JCS7B0S/S0LW cJZgH/EIeMvBBaYNKpu22ZNDAM4tdCIZwAovyHwDMz3YmHZMuqNeKw6wG5/DvamdSSss AzSLNuWR3Alz071zAwmDQr6LWHgWjeTmMlKZ4ZT8zjbIuPP3TpyM4yDdO/mk0/8vwr9j OJDn+2dzBtdww8pgMQOBhobYtXRnCXP0p6l/VNKnZNkAqN9tp646rZuZ0WDvCKNiXZ0j TZRw== X-Gm-Message-State: AEkoouuNhhDHOTLnh36R/UmkXAhpwPKxIj9Bz8QH0cDxD3sBgvtlmZcte+LEpNwZUjD9SC+j X-Received: by 10.25.143.20 with SMTP id r20mr23949317lfd.52.1470345126453; Thu, 04 Aug 2016 14:12:06 -0700 (PDT) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id o10sm2672255lfo.47.2016.08.04.14.12.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Aug 2016 14:12:05 -0700 (PDT) From: Ivan Khoronzhuk To: netdev@vger.kernel.org, mugunthanvnm@ti.com Cc: linux-omap@vger.kernel.org, grygorii.strashko@ti.com, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH] priority improvement Date: Fri, 5 Aug 2016 00:11:52 +0300 Message-Id: <1470345113-804-4-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470345113-804-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1470345113-804-1-git-send-email-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 45 +++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) -- 1.9.1 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 9ddaccc..cd12f52 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -788,22 +788,16 @@ static int cpsw_tx_poll(struct napi_struct *napi_tx, int budget) { struct cpsw_priv *priv = napi_to_priv(napi_tx); int num_tx, ch; - u32 ch_map; + unsigned long ch_map; /* process every unprocessed channel */ - ch_map = cpdma_ctrl_txchs_state(priv->dma); - for (ch = 0, num_tx = 0; num_tx < budget; ch_map >>= 1, ch++) { - if (!ch_map) { - ch_map = cpdma_ctrl_txchs_state(priv->dma); - if (!ch_map) - break; - - ch = 0; - } - - if (!(ch_map & 0x01)) - continue; + for (num_tx = 0; num_tx < budget;) { + ch_map = cpdma_ctrl_txchs_state(priv->dma); + if (!ch_map) + break; + /* process beginning from higher priority queue */ + ch = __fls(ch_map); num_tx += cpdma_chan_process(priv->txch[ch], budget - num_tx); } @@ -829,19 +823,13 @@ static int cpsw_rx_poll(struct napi_struct *napi_rx, int budget) u32 ch_map; /* process every unprocessed channel */ - ch_map = cpdma_ctrl_rxchs_state(priv->dma); - for (ch = 0, num_rx = 0; num_rx < budget; ch_map >>= 1, ch++) { - if (!ch_map) { - ch_map = cpdma_ctrl_rxchs_state(priv->dma); - if (!ch_map) - break; - - ch = 0; - } - - if (!(ch_map & 0x01)) - continue; + for (num_rx = 0; num_rx < budget;) { + ch_map = cpdma_ctrl_rxchs_state(priv->dma); + if (!ch_map) + break; + /* process beginning from higher priority queue */ + ch = __fls(ch_map); num_rx += cpdma_chan_process(priv->rxch[ch], budget - num_rx); } @@ -1130,8 +1118,11 @@ cpsw_tx_queue_mapping(struct cpsw_priv *priv, struct sk_buff *skb) { unsigned int q_idx = skb_get_queue_mapping(skb); - if (q_idx >= priv->tx_ch_num) - q_idx = q_idx % priv->tx_ch_num; + /* cpsw h/w has backward order queue priority, 7 - highest */ + if (likely(q_idx < priv->tx_ch_num)) + q_idx = priv->tx_ch_num - q_idx - 1; + else + q_idx = 0; return priv->txch[q_idx]; }