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: 9264285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EB9146089F for ; Thu, 4 Aug 2016 21:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB38C2841E for ; Thu, 4 Aug 2016 21:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDCE4276AE; Thu, 4 Aug 2016 21:13:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35D39276AE for ; Thu, 4 Aug 2016 21:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966276AbcHDVMQ (ORCPT ); Thu, 4 Aug 2016 17:12:16 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:36734 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966250AbcHDVMN (ORCPT ); Thu, 4 Aug 2016 17:12:13 -0400 Received: by mail-lf0-f51.google.com with SMTP id g62so190484273lfe.3 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=k4CIFlqFqvFK052HMo03k6XjYHfiwDViHdr+yBQd2o1xo4KQYAODrOMcfqVkooTe3l pWI97XMJDrg896BVz/X705vXbD3lkDoj5mgrOqNLKaqkIiokbViR7D1DsduyS11xGYcq 75YD9p/rKSidp3KSQOcqbsoN3+xDFcikV0ihmWniuI0ZPeQCTgQkiWxLg+Zm46YWzSTd SC0iJ8bFxiIRgSLUEPw7AFKCIMhnyFH07PQfZd3Vq5C4DmRYEElyyk+Rl3rBXwftBzYC V9HVRWm43zoJhmuNZKs7+wMj2eFaBbApO0SXWy5ShbpTCepXFljnUvMexEVIg03QpXIY on/g== X-Gm-Message-State: AEkoousWpYBQlxoVyq5m4JMBmj3LLmZDWXoAkearRpiIuSGhVhu5qlGDvC/5a8rRHH93/lLT 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: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 45 +++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) 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]; }