From patchwork Tue Aug 3 16:57:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 491349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56E96C4338F for ; Tue, 3 Aug 2021 16:58:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 395CE60EE7 for ; Tue, 3 Aug 2021 16:58:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237547AbhHCQ6f (ORCPT ); Tue, 3 Aug 2021 12:58:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237530AbhHCQ4J (ORCPT ); Tue, 3 Aug 2021 12:56:09 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11C41C0613D5 for ; Tue, 3 Aug 2021 09:55:56 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id y12so29856520edo.6 for ; Tue, 03 Aug 2021 09:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EacamUE2d3pNQji3i01hsIr9Xh5RtDwmJAOVG/8Hf2Q=; b=kquZS0CeVDrTb9Sv82xW/rdVsketMOIB9HXtlNtej4MMjpxP5Y1U9WzyX4qpwBMU/X OdhqXt4hpwBfOSEluNscoryCGGUb5O3GWUHCi92X1Z5bYSle78OLeP3J21i8+fzOgPAx 2lb1fkxaCTMPWn6w1aPquJrA/gRElEZdZpxcMIMwNTKy1LMtLe09r/17XkwUgRx+CGRR xG6kBz178eOB6ONMWnTrX5OhrBaPCROPLx5UHJ7wsy3IsIXidO1Hkt1YfZLEbwjsCnlv rOI7LJNYj7nCem9pUgkKMsvea1iHqvfZ78MtTosDR2lmaKVBSxsak1T7g24sHidSo/Cb tmdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EacamUE2d3pNQji3i01hsIr9Xh5RtDwmJAOVG/8Hf2Q=; b=pzn0HMaYzqTidwuqJ+k2JDGzXOSk7Kgr5C17H9AiDTYSjemZuxO027qaH6ydnu3EjA YAoVRzSkV3+OzVJKvRJFWLHOiyVOuS4pE7u9LFbDUjse6F5nz/D/SX49xAHYagiXI9Xu ovgpd2CehYEei/tCnfE/bWVrr820G1Jhpur7Fp+urnwKaZAxGW30QLfnVO0R3d57018K TUmQXsGsn+Adl4wtYYTzpx3xzqJdNRJEMlVPlGIsnroOv6ahNHy8km8ER48xe6zy8A1W uOsjVriLJCWWbLUVDtNjSJ/9xYMEPyA/5FGtg7nLp7LmI/p4EOMiLufUvkDJZfzPE1MU xLUQ== X-Gm-Message-State: AOAM530lePOI3uY/bIe2BtMykTxMjGBUSXuUCiQRnjKwScb1get1RBKP XahmmESFqH3/MteF36rhpsc= X-Google-Smtp-Source: ABdhPJzIqMY7TzcOZsL3xub0RWXP+6k1oggvEinqXSX+PFTW1gOkdXq0zrOHXZi4YlQfMEozbvW09g== X-Received: by 2002:a05:6402:60b:: with SMTP id n11mr27663232edv.235.1628009754690; Tue, 03 Aug 2021 09:55:54 -0700 (PDT) Received: from yoga-910.localhost ([188.25.144.60]) by smtp.gmail.com with ESMTPSA id e7sm8754630edk.3.2021.08.03.09.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 09:55:54 -0700 (PDT) From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: laurentiu.tudor@nxp.com, Ioana Ciornei Subject: [PATCH net-next 2/8] dpaa2-switch: use the port index in the IRQ handler Date: Tue, 3 Aug 2021 19:57:39 +0300 Message-Id: <20210803165745.138175-3-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210803165745.138175-1-ciorneiioana@gmail.com> References: <20210803165745.138175-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ioana Ciornei The MC firmware supplies us the switch interface index for which an interrupt was triggered. Use this to our advantage instead of looping through all the switch ports and doing unnecessary work. Signed-off-by: Ioana Ciornei --- .../ethernet/freescale/dpaa2/dpaa2-switch.c | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index 42d31a4a7da6..f8b7601dc9e4 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -594,7 +594,7 @@ static int dpaa2_switch_port_change_mtu(struct net_device *netdev, int mtu) return 0; } -static int dpaa2_switch_port_carrier_state_sync(struct net_device *netdev) +static int dpaa2_switch_port_link_state_update(struct net_device *netdev) { struct ethsw_port_priv *port_priv = netdev_priv(netdev); struct dpsw_link_state state; @@ -693,10 +693,10 @@ static int dpaa2_switch_port_open(struct net_device *netdev) } /* sync carrier state */ - err = dpaa2_switch_port_carrier_state_sync(netdev); + err = dpaa2_switch_port_link_state_update(netdev); if (err) { netdev_err(netdev, - "dpaa2_switch_port_carrier_state_sync err %d\n", err); + "dpaa2_switch_port_link_state_update err %d\n", err); goto err_carrier_sync; } @@ -1419,22 +1419,13 @@ bool dpaa2_switch_port_dev_check(const struct net_device *netdev) return netdev->netdev_ops == &dpaa2_switch_port_ops; } -static void dpaa2_switch_links_state_update(struct ethsw_core *ethsw) -{ - int i; - - for (i = 0; i < ethsw->sw_attr.num_ifs; i++) { - dpaa2_switch_port_carrier_state_sync(ethsw->ports[i]->netdev); - dpaa2_switch_port_set_mac_addr(ethsw->ports[i]); - } -} - static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg) { struct device *dev = (struct device *)arg; struct ethsw_core *ethsw = dev_get_drvdata(dev); + struct ethsw_port_priv *port_priv; u32 status = ~0; - int err; + int err, if_id; err = dpsw_get_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle, DPSW_IRQ_INDEX_IF, &status); @@ -1443,9 +1434,13 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg) goto out; } - if (status & DPSW_IRQ_EVENT_LINK_CHANGED) - dpaa2_switch_links_state_update(ethsw); + if_id = (status & 0xFFFF0000) >> 16; + port_priv = ethsw->ports[if_id]; + if (status & DPSW_IRQ_EVENT_LINK_CHANGED) { + dpaa2_switch_port_link_state_update(port_priv->netdev); + dpaa2_switch_port_set_mac_addr(port_priv); + } out: err = dpsw_clear_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle, DPSW_IRQ_INDEX_IF, status); From patchwork Tue Aug 3 16:57:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 491348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA8B2C4338F for ; Tue, 3 Aug 2021 17:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF1BC60F0F for ; Tue, 3 Aug 2021 17:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234615AbhHCRBk (ORCPT ); Tue, 3 Aug 2021 13:01:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237540AbhHCQ4K (ORCPT ); Tue, 3 Aug 2021 12:56:10 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9C8AC061798 for ; Tue, 3 Aug 2021 09:55:57 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id yk17so29683165ejb.11 for ; Tue, 03 Aug 2021 09:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YX0tPqUP8lnGLjyXtWNv7Fjs5lqIGLwPOAH1PTRfU9Y=; b=X5JkuM3YZZztO/XOfM/aRedPFb+jyN8d3JhkIozoLvD4hkx4Xo/i99NK9jJAEA6RsG EOUScylVBmamLnTJ0oVRC+y+cteQEoy4Bkd07TyEz8ayIaZp8cm1Ci5HVuqoJHaekmu2 sfCsl1WBuK2QDeFt9/W6znTS7R6MfXkmq01HxiAm0abmDK6Pp6Eeffia8BSENBKrLORi ouBLoLzEu5t1IyVK3QXp7NbgXWxUTM3rnqP+MsdItFE2LW2QZE1Q3/wYZW1yUgZ3tFO5 vup+t0frreGsxSX1aKrHcHab28vsHR5p6Y88SwDTWCQ3S68pwxL2rsNgjXLHKswpYcJ+ ewnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YX0tPqUP8lnGLjyXtWNv7Fjs5lqIGLwPOAH1PTRfU9Y=; b=DTV7XuW4YXwBBs4iWmFYe2re9iIZvciRvj0o24gqdKZenCjV9xQ3eLfgmRWWvzWEbx 19eyqOl+t2Av8vBxgsf+GtIy9zud/7GUhtjUXeMSb19/AjtuqDX43opiqbYkrSJvhSaJ T71iQsPY3fB+LWeCYNhIm6/uep5f3zcNJ35Kb7UnU3JPqntsu4HNHnA5gc86DRcwW3HB ETMpsLGGDrvlHI6U1ICkRoV9su3NKtUlzg0VmB2qmE/vniO55YEjErREPiirGEPfT9nh 2wVB7a2a0Q3XYG2Mc+6AeB84W4tPDnY/4TUkEAjGoZHWc5XikmQZxHfJxB3N8GAStTCX y/Rg== X-Gm-Message-State: AOAM531lzTTJ66/xq2zdIePRvxTHuqenWKkunIbC1KcEf66tSkHzF1ln zpoYp2OfkTiD5f2ozQ99XOE= X-Google-Smtp-Source: ABdhPJxqspBkCLackoqUF14JnD9ikL2qZQpee7yc984r/6Z2Yj07j3D8rDaYyTEd3yUYpH8BppbLWw== X-Received: by 2002:a17:906:388b:: with SMTP id q11mr21236007ejd.113.1628009756499; Tue, 03 Aug 2021 09:55:56 -0700 (PDT) Received: from yoga-910.localhost ([188.25.144.60]) by smtp.gmail.com with ESMTPSA id e7sm8754630edk.3.2021.08.03.09.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 09:55:56 -0700 (PDT) From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: laurentiu.tudor@nxp.com, Ioana Ciornei Subject: [PATCH net-next 3/8] dpaa2-switch: do not enable the DPSW at probe time Date: Tue, 3 Aug 2021 19:57:40 +0300 Message-Id: <20210803165745.138175-4-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210803165745.138175-1-ciorneiioana@gmail.com> References: <20210803165745.138175-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ioana Ciornei We should not enable the switch interfaces at probe time since this is trigged by the open callback. Remove the call dpsw_enable() which does exactly this. Signed-off-by: Ioana Ciornei --- drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index f8b7601dc9e4..36a6cfe9eaeb 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -3281,12 +3281,6 @@ static int dpaa2_switch_probe(struct fsl_mc_device *sw_dev) ðsw->fq[i].napi, dpaa2_switch_poll, NAPI_POLL_WEIGHT); - err = dpsw_enable(ethsw->mc_io, 0, ethsw->dpsw_handle); - if (err) { - dev_err(ethsw->dev, "dpsw_enable err %d\n", err); - goto err_free_netdev; - } - /* Setup IRQs */ err = dpaa2_switch_setup_irqs(sw_dev); if (err) From patchwork Tue Aug 3 16:57:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 491346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D506C4320A for ; Tue, 3 Aug 2021 17:01:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5529861037 for ; Tue, 3 Aug 2021 17:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237498AbhHCRB6 (ORCPT ); Tue, 3 Aug 2021 13:01:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237457AbhHCQ5r (ORCPT ); Tue, 3 Aug 2021 12:57:47 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2486CC06179E for ; Tue, 3 Aug 2021 09:56:02 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id f13so29771049edq.13 for ; Tue, 03 Aug 2021 09:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eBJZV4O8XqLZmUle+XYxNsAo4PLygqVj1lvOHmXGbrk=; b=WnyDdptfkBp/K5nPQjxXqIgv75CUc6nd0Lj3hMeU+gD3xeYZETv7cl2BFx85Fia7+b hUH/Xm6Clv+XA2YQDkzyRwWoCWofkTGrpfUmH9vyK1HpgpCpw0Viy+6g+LUbDfDzcsfg rCYcGSFhVEz8iU4G5tRSQTs9/+bBWkdXiKeCCTS7V5u2AL9kFg4YSXY5VNSZIQEkhCaT ppO9jLOFnVTfalP0K+0W4U4U7Wh25KWhqVQI8830huZsO3ixAPJ9ABRBy5GZD3YAFWa0 JOMxlMqovrmSgte1q67zvi2+FPC70uLTvZOiCayEW94Ekx1IvZHvXVf+MDjasHj6ZzCf xzaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eBJZV4O8XqLZmUle+XYxNsAo4PLygqVj1lvOHmXGbrk=; b=s0eETKJYva+yPLenhW+TzNwl1cghhwZJ9r5zomK+CtTEdNnbIklfXhgDgYjIoet23q yx4oqCi53avbfFGoNN5J/nwQmwhL2tw4kEXrY9owxz767tSRjpDgxqSvrpFtkVODiAZq IvUzQlfNopNGmheLi4yA6Zfj3laXD6+SdsVncKkxBNEWh6df9YdWZDHC8YYXBMTkqrpD NWLDzHHdGxC9nSmMob6M2Pa4XDlWX99W5VMdpVa5IIJvv+2XlBuW0hkqvpVK0Vmxn7G9 PrjlscONt28jzSs0o38B6QaOiXQoJlyyhxs7iEJePmaFuG6Y9ylpAXwDuXB5K9KUJdOX uxng== X-Gm-Message-State: AOAM5312G7A0bGtVCEyiy82IKIB97S07XXN7X5D5JObtJqU39zgC3rlr uIxP9jCQv6R8yABqJGAFUPc= X-Google-Smtp-Source: ABdhPJxb8HP73h9zqwTR14yN1DGkMWWXzvujubdU0J5HfGqA0BhmbFvDiA+AKbMxXuj1Nq61gppC2g== X-Received: by 2002:a05:6402:1458:: with SMTP id d24mr26983001edx.281.1628009760742; Tue, 03 Aug 2021 09:56:00 -0700 (PDT) Received: from yoga-910.localhost ([188.25.144.60]) by smtp.gmail.com with ESMTPSA id e7sm8754630edk.3.2021.08.03.09.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 09:56:00 -0700 (PDT) From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: laurentiu.tudor@nxp.com, Ioana Ciornei Subject: [PATCH net-next 7/8] dpaa2-switch: add a prefix to HW ethtool stats Date: Tue, 3 Aug 2021 19:57:44 +0300 Message-Id: <20210803165745.138175-8-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210803165745.138175-1-ciorneiioana@gmail.com> References: <20210803165745.138175-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ioana Ciornei In the next patch, we'll add support for also exporting the MAC statistics in the ethtool stats. Annotate already present HW stats with a suggestive prefix. Signed-off-by: Ioana Ciornei --- .../freescale/dpaa2/dpaa2-switch-ethtool.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c index 5a460dcc6f4e..20912fb67b9e 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c @@ -15,18 +15,18 @@ static struct { enum dpsw_counter id; char name[ETH_GSTRING_LEN]; } dpaa2_switch_ethtool_counters[] = { - {DPSW_CNT_ING_FRAME, "rx frames"}, - {DPSW_CNT_ING_BYTE, "rx bytes"}, - {DPSW_CNT_ING_FLTR_FRAME, "rx filtered frames"}, - {DPSW_CNT_ING_FRAME_DISCARD, "rx discarded frames"}, - {DPSW_CNT_ING_BCAST_FRAME, "rx b-cast frames"}, - {DPSW_CNT_ING_BCAST_BYTES, "rx b-cast bytes"}, - {DPSW_CNT_ING_MCAST_FRAME, "rx m-cast frames"}, - {DPSW_CNT_ING_MCAST_BYTE, "rx m-cast bytes"}, - {DPSW_CNT_EGR_FRAME, "tx frames"}, - {DPSW_CNT_EGR_BYTE, "tx bytes"}, - {DPSW_CNT_EGR_FRAME_DISCARD, "tx discarded frames"}, - {DPSW_CNT_ING_NO_BUFF_DISCARD, "rx discarded no buffer frames"}, + {DPSW_CNT_ING_FRAME, "[hw] rx frames"}, + {DPSW_CNT_ING_BYTE, "[hw] rx bytes"}, + {DPSW_CNT_ING_FLTR_FRAME, "[hw] rx filtered frames"}, + {DPSW_CNT_ING_FRAME_DISCARD, "[hw] rx discarded frames"}, + {DPSW_CNT_ING_BCAST_FRAME, "[hw] rx bcast frames"}, + {DPSW_CNT_ING_BCAST_BYTES, "[hw] rx bcast bytes"}, + {DPSW_CNT_ING_MCAST_FRAME, "[hw] rx mcast frames"}, + {DPSW_CNT_ING_MCAST_BYTE, "[hw] rx mcast bytes"}, + {DPSW_CNT_EGR_FRAME, "[hw] tx frames"}, + {DPSW_CNT_EGR_BYTE, "[hw] tx bytes"}, + {DPSW_CNT_EGR_FRAME_DISCARD, "[hw] tx discarded frames"}, + {DPSW_CNT_ING_NO_BUFF_DISCARD, "[hw] rx nobuffer discards"}, }; #define DPAA2_SWITCH_NUM_COUNTERS ARRAY_SIZE(dpaa2_switch_ethtool_counters) From patchwork Tue Aug 3 16:57:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 491347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5025DC4320A for ; Tue, 3 Aug 2021 17:01:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3132660F0F for ; Tue, 3 Aug 2021 17:01:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237694AbhHCRBw (ORCPT ); Tue, 3 Aug 2021 13:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237518AbhHCQ5w (ORCPT ); Tue, 3 Aug 2021 12:57:52 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C879C0617A0 for ; Tue, 3 Aug 2021 09:56:03 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id x14so29805059edr.12 for ; Tue, 03 Aug 2021 09:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qNwutdTPtPzMvhFLvrhFDo49zFNUEnkpKIp2KgXt3ys=; b=JR0LMPPDEy0WxQgKw3Kv9H7GdseDx9ecjZelGhl+OTeQUJfFGPabmjisCwFQgGB70F BGIlk7+7xJXjiarmoHaUfUDr5Ct5B2SGBC0/b3QwVPNPOfYCJ1dAjwpM4No0F5Etx3zF a2zGSrE6mewE3QsCkolo1UfvrAULlJMNj/eavTHmzguKeCoUnLc02CzirykFqU45bZtL UmeG7b5O/56S1vtuEo5Jo9zQZT9l60O3Xf7HZkCt3fQjR6WbRKRkl4K6F8x9gN5WbLL0 fyfjZnxhXfxMMqg+XkZ+vVkQkryhrbs+bRrIDDoYqyh/smKkVCBItvxK+44qDnCDSXlC CFNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qNwutdTPtPzMvhFLvrhFDo49zFNUEnkpKIp2KgXt3ys=; b=OjPGzUHfG8IAdJ2ywylYRJO6bLzH1tY/aoR5JEIpdHcYVCt/i9WXn3hqRlQoyEYWHl EAgKcNGNdVfxznAFPrC/k6kDAU2CiMH/QKWbbxM7isbrN0MuHSRTvw3wfGrAZwtGScHl /RKVgzUwReehOntjBYsp+Nstz4YtvtrFvSSzrDwcQFVOstGbHYyiAd2nO1U/gK3T5e3c 9iRDvMbr2f0dfb11FzpGK7MYOn3rGcnLRIfmwjiPkaGR5SL6T7rnClKN9pIZO8J9QBRN XpWHj3yZPezfTJZnIjh/f03KHLWruUMygEMXbsNmCuTHtz7EUJuBEJv2u2Wpzip6eE9I 9dag== X-Gm-Message-State: AOAM533qMhngDJqs08m4FewPOBjTzUvGPIoeZUWVdcuAp05L1WpkxfGf QOjLXko73tQUEJ1Mshoia0Y= X-Google-Smtp-Source: ABdhPJzFwLGEbKPV0sIZv+Ms1iOo5mjOdrdTV17rtQedJCSR2hI4Bzh0zv6TE6Z6AkDgWbpmP8MRtg== X-Received: by 2002:a50:fe10:: with SMTP id f16mr26930875edt.208.1628009761748; Tue, 03 Aug 2021 09:56:01 -0700 (PDT) Received: from yoga-910.localhost ([188.25.144.60]) by smtp.gmail.com with ESMTPSA id e7sm8754630edk.3.2021.08.03.09.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 09:56:01 -0700 (PDT) From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: laurentiu.tudor@nxp.com, Ioana Ciornei Subject: [PATCH net-next 8/8] dpaa2-switch: export MAC statistics in ethtool Date: Tue, 3 Aug 2021 19:57:45 +0300 Message-Id: <20210803165745.138175-9-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210803165745.138175-1-ciorneiioana@gmail.com> References: <20210803165745.138175-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ioana Ciornei If a switch port is connected to a MAC, use the common dpaa2-mac support for exporting the available MAC statistics. Signed-off-by: Ioana Ciornei --- .../freescale/dpaa2/dpaa2-switch-ethtool.c | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c index 20912fb67b9e..720c9230cab5 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c @@ -142,11 +142,17 @@ dpaa2_switch_set_link_ksettings(struct net_device *netdev, return err; } -static int dpaa2_switch_ethtool_get_sset_count(struct net_device *dev, int sset) +static int +dpaa2_switch_ethtool_get_sset_count(struct net_device *netdev, int sset) { + struct ethsw_port_priv *port_priv = netdev_priv(netdev); + int num_ss_stats = DPAA2_SWITCH_NUM_COUNTERS; + switch (sset) { case ETH_SS_STATS: - return DPAA2_SWITCH_NUM_COUNTERS; + if (port_priv->mac) + num_ss_stats += dpaa2_mac_get_sset_count(); + return num_ss_stats; default: return -EOPNOTSUPP; } @@ -155,14 +161,19 @@ static int dpaa2_switch_ethtool_get_sset_count(struct net_device *dev, int sset) static void dpaa2_switch_ethtool_get_strings(struct net_device *netdev, u32 stringset, u8 *data) { + struct ethsw_port_priv *port_priv = netdev_priv(netdev); + u8 *p = data; int i; switch (stringset) { case ETH_SS_STATS: - for (i = 0; i < DPAA2_SWITCH_NUM_COUNTERS; i++) - memcpy(data + i * ETH_GSTRING_LEN, - dpaa2_switch_ethtool_counters[i].name, + for (i = 0; i < DPAA2_SWITCH_NUM_COUNTERS; i++) { + memcpy(p, dpaa2_switch_ethtool_counters[i].name, ETH_GSTRING_LEN); + p += ETH_GSTRING_LEN; + } + if (port_priv->mac) + dpaa2_mac_get_strings(p); break; } } @@ -184,6 +195,9 @@ static void dpaa2_switch_ethtool_get_stats(struct net_device *netdev, netdev_err(netdev, "dpsw_if_get_counter[%s] err %d\n", dpaa2_switch_ethtool_counters[i].name, err); } + + if (port_priv->mac) + dpaa2_mac_get_ethtool_stats(port_priv->mac, data + i); } const struct ethtool_ops dpaa2_switch_port_ethtool_ops = {