From patchwork Sat Aug 6 10:48:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 9266083 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 A816A6075A for ; Sat, 6 Aug 2016 21:45:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 997EB28365 for ; Sat, 6 Aug 2016 21:45:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E1B928403; Sat, 6 Aug 2016 21:45:41 +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=unavailable 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 3D2E728365 for ; Sat, 6 Aug 2016 21:45:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752168AbcHFVpj (ORCPT ); Sat, 6 Aug 2016 17:45:39 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:32925 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751937AbcHFVpi (ORCPT ); Sat, 6 Aug 2016 17:45:38 -0400 Received: by mail-lf0-f51.google.com with SMTP id b199so225067268lfe.0 for ; Sat, 06 Aug 2016 14:45:37 -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=AzRgzEV9rqb5SZ/Xg1RbCFLObG5z82sb/fcA12Md9yI=; b=gYF5eOODkr1pLrTYsPQBn5XSn3l805/RqQat1vBnzdcPJMAHoNC1bQ8yLvQB/LZNAy kxf1ivEMJD/HG9IGHZQ6Vvf7ZB5PRagPFzBbJVD2NSyhIXs+rftHn9cUv6438F5JOxkD 4Iyr4G26bDbP7oRgL3N1GgBVpqnui8+C64sg0= 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=AzRgzEV9rqb5SZ/Xg1RbCFLObG5z82sb/fcA12Md9yI=; b=MlJblhBPrWkEIgKXPgYMRt+7uux3f3gfMlgAmdfU6R2vsyLmieuvK9Hyi35fzVfkRB QvP1maA3+a7h+sDJw4qOPaGwvXGZltsuvvfRIGvgvkVY503QMqQzibAvB/nc9i31vVgx ssK8RMN8Li2ty8GshNM+uFkcrf8dJOmngyPE38Ir91pLc9g0CcHQQJsxKARsxZ8wohwT z73xqEm7vG7MDkor7r1VVo8NKqFZzTzx37gtUnjVzQYe0QzI0KezgFiAY0MJiVhJzqyJ KdxPRQirBvjGa/bu6dNvP7szNmJrfwe3WgzPj63NWdT6tT2JAK5vXGobCMoWwKP65fRo 15bA== X-Gm-Message-State: AEkoouuaon2MpIQlpTvnEfk7HJ3vPHjnI0HCM8awNndKShNz2irx4xg1W0ojBqxohnv/s5nk X-Received: by 10.25.21.197 with SMTP id 66mr20694294lfv.99.1470480551688; Sat, 06 Aug 2016 03:49:11 -0700 (PDT) Received: from localhost.localdomain (153-224-132-95.pool.ukrtel.net. [95.132.224.153]) by smtp.gmail.com with ESMTPSA id p128sm3916360lfb.32.2016.08.06.03.49.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 06 Aug 2016 03:49:11 -0700 (PDT) From: Ivan Khoronzhuk To: netdev@vger.kernel.org, mugunthanvnm@ti.com, grygorii.strashko@ti.com Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, dlide@ti.com, Ivan Khoronzhuk Subject: [PATCH v2 12/14] net: ethernet: ti: cpsw: fix int dbg message Date: Sat, 6 Aug 2016 13:48:42 +0300 Message-Id: <1470480524-6851-13-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470480524-6851-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1470480524-6851-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 While poll handlers there is no possibility to figure out which network device is handling packets, as cpdma channels are common for both network devices in dual_emac mode. Currently, the messages are printed only for one device, in fact, there is two. So, better to print integrated num_tx value for both devices if any of them is allowed to. Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 29ff489..395531d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -378,6 +378,7 @@ struct cpsw_common { bool rx_irq_disabled; bool tx_irq_disabled; u32 irqs_table[IRQ_NUM]; + int intr_dbg_msg; }; struct cpsw_priv { @@ -802,7 +803,9 @@ static int cpsw_tx_poll(struct napi_struct *napi_tx, int budget) } } - cpsw_dbg(priv, intr, "poll %d tx pkts\n", num_tx); + if (cpsw->intr_dbg_msg && net_ratelimit()) + dev_dbg(cpsw->dev, "poll %d tx pkts\n", num_tx); + return num_tx; } @@ -822,7 +825,9 @@ static int cpsw_rx_poll(struct napi_struct *napi_rx, int budget) } } - cpsw_dbg(priv, intr, "poll %d rx pkts\n", num_rx); + if (cpsw->intr_dbg_msg && net_ratelimit()) + dev_dbg(cpsw->dev, "poll %d tx pkts\n", num_rx); + return num_rx; } @@ -1848,8 +1853,35 @@ static u32 cpsw_get_msglevel(struct net_device *ndev) static void cpsw_set_msglevel(struct net_device *ndev, u32 value) { + int i; + struct cpsw_priv *sl_priv; struct cpsw_priv *priv = netdev_priv(ndev); + struct cpsw_common *cpsw = priv->cpsw; + priv->msg_enable = value; + + /* There is no possibility to at napi poll level + * to know which netdev is handled, so enable + * common dbg msg print if any interface is enabled to + */ + cpsw->intr_dbg_msg = 0; + if (!cpsw->data.dual_emac) { + if (netif_msg_intr(priv)) + cpsw->intr_dbg_msg = 1; + return; + } + + for (i = 0; i < cpsw->data.slaves; i++) { + ndev = netdev_priv(cpsw->slaves[i].ndev); + if (!ndev) + continue; + + sl_priv = netdev_priv(ndev); + if (netif_msg_intr(sl_priv)) { + cpsw->intr_dbg_msg = 1; + break; + } + } } static int cpsw_get_ts_info(struct net_device *ndev,