From patchwork Tue Aug 3 16:57:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12416843 X-Patchwork-Delegate: kuba@kernel.org 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 39872C4338F for ; Tue, 3 Aug 2021 16:57:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F9CE60F9C for ; Tue, 3 Aug 2021 16:57:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237479AbhHCQ5v (ORCPT ); Tue, 3 Aug 2021 12:57:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237526AbhHCQ4I (ORCPT ); Tue, 3 Aug 2021 12:56:08 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 288ABC06175F for ; Tue, 3 Aug 2021 09:55:55 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id c25so664479ejb.3 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=ZA/VmrYcR7bRHhdKZDac6LEdob5bPlkHZymtysuTxu4=; b=CNgyjNTUrhVGalib1Qhgb3p01mYOtN93cPZAKYkae2nGoxt/oVVe2FTelllIW5o3r6 lbgwoo2kL57nbP3Pk+UTN2idDfX5VBDm3Yz2o5S1VBPWGxZACspqNikMe4sK6pDUvACk HEYigyI30MIdZWbHMxTtuLDUA2S6FWDgJSBpQYNntfOfvhcI11RRBT7wy5VAuNfK3si+ BAlnzE60U35tYPtj19ZtkLGjhlfNR3VdJoZ5c5Yo81z95YFGFDOoB5wFofortnIr5pSL kjZ/u1+Cgu9f5Yk5bAupIgwVkQ1Ejvrqq+4jD7+yKbn5qoxkWG3ceANhGroQHnS7YQOj VYSA== 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=ZA/VmrYcR7bRHhdKZDac6LEdob5bPlkHZymtysuTxu4=; b=b32qJTfFDWNqXGTcdgF6MGo2R+bm1CiHtpsaN/P8qQgyK3LgGbFUMkd/zNSTVb47IY MVpEDn6Rj//nfdS8eZwJ9wCBYxnGxSTPmct4HasfyzwnpJllJF+aCqaeyvwLnziiqBkR /0CEVKkEloCrlOJj1YpNr8wSonTHrc1e1J58e99RoiQ4GK9xI5na1t0wr7uJndGtTNTY SHHnqF6Hs7mWol1asZlI573J7j/zdtY1uE5McSg/vqOJxcsrTcAXRiqfkXnIB2Vx5fNR qbqrK0Gt0b4nD/QMot+HrT5MehTQoK66pooX635Iz4llzGWP2gQ61DhMwUqBWvhAGuOh qB/w== X-Gm-Message-State: AOAM530+uELVRC9MVSSPkm85pZyBaT3SaFDEox5knbE66+Ski4SIl0wn LAFaCpp9ZIZ4qUQr/6MDviKmM/73Z4UMVQ== X-Google-Smtp-Source: ABdhPJwhNC9BL61XE/65WIuJ+t0V2ED5vUYCTgLPNjUhvI9JZk9obFp3fo6BIsVBKjfHZ2ntZxy26w== X-Received: by 2002:a17:906:e21a:: with SMTP id gf26mr21337483ejb.313.1628009753698; Tue, 03 Aug 2021 09:55:53 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 09:55:53 -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 1/8] dpaa2-switch: request all interrupts sources on the DPSW Date: Tue, 3 Aug 2021 19:57:38 +0300 Message-Id: <20210803165745.138175-2-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 X-Patchwork-Delegate: kuba@kernel.org From: Ioana Ciornei Request all interrupt sources to be read and then cleared on the DPSW object. In the next patches we'll also add support for treating other interrupts. Signed-off-by: Ioana Ciornei --- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index 71129724d9ca..42d31a4a7da6 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -1433,20 +1433,13 @@ 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); - - /* Mask the events and the if_id reserved bits to be cleared on read */ - u32 status = DPSW_IRQ_EVENT_LINK_CHANGED | 0xFFFF0000; + u32 status = ~0; int err; err = dpsw_get_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle, DPSW_IRQ_INDEX_IF, &status); if (err) { dev_err(dev, "Can't get irq status (err %d)\n", err); - - err = dpsw_clear_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle, - DPSW_IRQ_INDEX_IF, 0xFFFFFFFF); - if (err) - dev_err(dev, "Can't clear irq status (err %d)\n", err); goto out; } @@ -1454,6 +1447,11 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg) dpaa2_switch_links_state_update(ethsw); out: + err = dpsw_clear_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle, + DPSW_IRQ_INDEX_IF, status); + if (err) + dev_err(dev, "Can't clear irq status (err %d)\n", err); + return IRQ_HANDLED; } 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: 12416845 X-Patchwork-Delegate: kuba@kernel.org 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 X-Patchwork-Delegate: kuba@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: 12416849 X-Patchwork-Delegate: kuba@kernel.org 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 X-Patchwork-Delegate: kuba@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:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12416855 X-Patchwork-Delegate: kuba@kernel.org 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 29BB8C4338F for ; Tue, 3 Aug 2021 17:01:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1301261037 for ; Tue, 3 Aug 2021 17:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237609AbhHCRB4 (ORCPT ); Tue, 3 Aug 2021 13:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237551AbhHCQ5d (ORCPT ); Tue, 3 Aug 2021 12:57:33 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFA46C06179A for ; Tue, 3 Aug 2021 09:55:58 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id z11so7409385edb.11 for ; Tue, 03 Aug 2021 09:55:58 -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=WcpJLFMuyKDTsryqscypG2jHuqXU5BfE82h5fqfdiOk=; b=VTtkF/81nmBXS1IdoZrf20plgAHDM/Fs8Cl+SsR3XW5c46txsiy+6LbF5Qpw1q+Min 4dEF9T8LXew2GBQOtYI4TNJozeURSxRwNypijYgEsgOujpQO2TXcC7SSc6ZQKvSU1u+J gUCxEdiREVsXOiboeMW0qgo8I39gpdnX2VxoRqhL7nfNpROIyTRBUyggKc2u4yyOZj+2 58O7RDCOQu7/hiBr93OiP43S4olx6Mswa/sFWiE01FTfoV9MrbPS+Z7Jfsi4f3/S73LT MbOn/p4JQxbCzKourKEunib4UGwy26JvHHNcPMSgI6Mxf/Cx6IsXXRc6YKI1lvJqokD/ BE6Q== 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=WcpJLFMuyKDTsryqscypG2jHuqXU5BfE82h5fqfdiOk=; b=WmU0qdBFcdDftRNFkaMyHLW5oc94lqxCMlgjL83wSUumMoDIzI3LpaMjIxn2b49iJH FLJBfjHbUjJaJnqOPquvu2OY7YQsCvJMDqRuJw/Lkp+7H8559XvSfTWcDnvL5ba+al3R HdZ2lPequTucU95mOoL31Ow5J6iZfODHKkxmOVt094jf1n+hXD93/aixairNYSb86v5x LrvLA5/t54xNVY3QKzTEH2ujrSB9QqPtrU+yR6+nMKkbmwHOK2kh8BoM3kqrG9mphyfq GHcpE1Lk5wlW7yz5lSY76QcfDPaRG3zP8ETG8G1Fx3COPoQFv5Fz0Ses/lZL6qriBT2X oR3g== X-Gm-Message-State: AOAM531AryXc09LUkkVXcJui8K875MGdwa6s3noDuqHIA1j/4PiyhtjJ h1k9NSv1yHHkr1JUormN4WY= X-Google-Smtp-Source: ABdhPJx1tGtMmN86Z8KGmVPC8UywDWs2DHA31fKbETuNXYNEObKw7h88Y8vh3b3PLCQGYRvvyIkvcQ== X-Received: by 2002:a05:6402:1d3a:: with SMTP id dh26mr4701688edb.250.1628009757519; Tue, 03 Aug 2021 09:55:57 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 09:55:57 -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 4/8] dpaa2-switch: no need to check link state right after ndo_open Date: Tue, 3 Aug 2021 19:57:41 +0300 Message-Id: <20210803165745.138175-5-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 X-Patchwork-Delegate: kuba@kernel.org From: Ioana Ciornei The call to dpaa2_switch_port_link_state_update is a leftover from the time when on DPAA2 platforms the PHYs were started at boot time so when an ifconfig was issued on the associated interface, the link status needed to be checked directly from the ndo_open() callback. This is not needed anymore since we are now properly integrated with the PHY layer thus a link interrupt will come directly from the PHY eventually without the need to call the sync function. Fix this up by removing the call to dpaa2_switch_port_link_state_update. Signed-off-by: Ioana Ciornei --- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index 36a6cfe9eaeb..aad7f9abfa93 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -692,23 +692,9 @@ static int dpaa2_switch_port_open(struct net_device *netdev) return err; } - /* sync carrier state */ - err = dpaa2_switch_port_link_state_update(netdev); - if (err) { - netdev_err(netdev, - "dpaa2_switch_port_link_state_update err %d\n", err); - goto err_carrier_sync; - } - dpaa2_switch_enable_ctrl_if_napi(ethsw); return 0; - -err_carrier_sync: - dpsw_if_disable(port_priv->ethsw_data->mc_io, 0, - port_priv->ethsw_data->dpsw_handle, - port_priv->idx); - return err; } static int dpaa2_switch_port_stop(struct net_device *netdev) From patchwork Tue Aug 3 16:57:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12416851 X-Patchwork-Delegate: kuba@kernel.org 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 904C3C4320A for ; Tue, 3 Aug 2021 17:01:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76A6C60F0F for ; Tue, 3 Aug 2021 17:01:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237530AbhHCRBn (ORCPT ); Tue, 3 Aug 2021 13:01:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237477AbhHCQ5d (ORCPT ); Tue, 3 Aug 2021 12:57:33 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3888C06179B for ; Tue, 3 Aug 2021 09:55:59 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id x14so29804817edr.12 for ; Tue, 03 Aug 2021 09:55:59 -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=+EPYcaX3CGR6fdD8iidPM1vuQj/8EScCk9Ihcu/BcLM=; b=lus0/h2VlRSuqGhqBjNs74DotStClboolaUWJaT1PAirGa3NR45tpqDP17thwiV34C XxaMy8AJ2fAQ5rahAHKmFIxLW+/7LfCh442kMFoiLdoZljpEDcZZsugAF8dEbpgBkqhf pcLfLbPocubqKdBmtjI1oaCTDweru4Z5DnC1ME1m+O2+18A17+mErGRdbrsrppgy3Sjt HeFv91Jk7PmwUW9VxfEmUWhN+WpXJ5BhaMhOnDkcI060wReDPSuEPfq9Ifuixfs8Gh8W eP89sH3GVTsOljlEcS3ptzgOVfs/bql7fDaZalWgvqNoYYyD90doB3sYVvY3XUk0kqpj 1OvQ== 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=+EPYcaX3CGR6fdD8iidPM1vuQj/8EScCk9Ihcu/BcLM=; b=TUsL55UJlKc86buJEeiEe3vi2pUk8VKLLl2C6WjY8tGFzt/K0I/8HhRlk2KgAhQiEO pmMbEybBuv0HfJRafJm6wJvY3xUQWt3CyNEPW4vU0hzS/Pk2TfGIWsuQQjDufyGTU0Xv //otjm3OLQzc3sCf0LT4qqwexJEqQlH1TMhue/FgLg3YXJnJpbHJrZy4VmqAdc7xrIex StFWkqtAfp2FNMZpOFVrT4lzmbbPcHvXwqMZoHiVbHFyFWGXRgSb+4uY5AayqVdFXtXT 9bdDdBJC/K39V5x9ZE/XjLaP2rlmf0yGykpTslXcfbdZwybv/XtsziuJ7mhurWXTuKUQ Gw3A== X-Gm-Message-State: AOAM53205ZRNbzF0k5nVK2mdwiHjSZ1VNCtb6XOEBmVmsX9otaFY8v0s /vet9bYTPC+KMxeZBpz72To= X-Google-Smtp-Source: ABdhPJy5apG0obtdJSYO8gA2PqZR4n7SGGuGMtAdoMG2AfbCF1OLXIhqzG1y+jULJ/HxdjEtXFy49g== X-Received: by 2002:aa7:c042:: with SMTP id k2mr27250312edo.104.1628009758337; Tue, 03 Aug 2021 09:55:58 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 09:55:57 -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 5/8] bus: fsl-mc: extend fsl_mc_get_endpoint() to pass interface ID Date: Tue, 3 Aug 2021 19:57:42 +0300 Message-Id: <20210803165745.138175-6-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 X-Patchwork-Delegate: kuba@kernel.org From: Ioana Ciornei In case of a switch DPAA2 object, the interface ID is also needed when querying for the object endpoint. Extend fsl_mc_get_endpoint() so that users can also pass the interface ID that are interested in. Signed-off-by: Ioana Ciornei --- drivers/bus/fsl-mc/fsl-mc-bus.c | 4 +++- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +- include/linux/fsl/mc.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c index 09c8ab5e0959..b3691de8ac06 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -914,7 +914,8 @@ void fsl_mc_device_remove(struct fsl_mc_device *mc_dev) } EXPORT_SYMBOL_GPL(fsl_mc_device_remove); -struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev) +struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev, + u16 if_id) { struct fsl_mc_device *mc_bus_dev, *endpoint; struct fsl_mc_obj_desc endpoint_desc = {{ 0 }}; @@ -925,6 +926,7 @@ struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev) mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); strcpy(endpoint1.type, mc_dev->obj_desc.type); endpoint1.id = mc_dev->obj_desc.id; + endpoint1.if_id = if_id; err = dprc_get_connection(mc_bus_dev->mc_io, 0, mc_bus_dev->mc_handle, diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index f664021c3ad1..7065c71ed7b8 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -4138,7 +4138,7 @@ static int dpaa2_eth_connect_mac(struct dpaa2_eth_priv *priv) int err; dpni_dev = to_fsl_mc_device(priv->net_dev->dev.parent); - dpmac_dev = fsl_mc_get_endpoint(dpni_dev); + dpmac_dev = fsl_mc_get_endpoint(dpni_dev, 0); if (PTR_ERR(dpmac_dev) == -EPROBE_DEFER) return PTR_ERR(dpmac_dev); diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h index 63b56aba925a..30ece3ae6df7 100644 --- a/include/linux/fsl/mc.h +++ b/include/linux/fsl/mc.h @@ -423,7 +423,8 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev); void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev); -struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev); +struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev, + u16 if_id); extern struct bus_type fsl_mc_bus_type; From patchwork Tue Aug 3 16:57:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12416859 X-Patchwork-Delegate: kuba@kernel.org 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 2F70FC4338F for ; Tue, 3 Aug 2021 17:01:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B26660F0F for ; Tue, 3 Aug 2021 17:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237442AbhHCRBy (ORCPT ); Tue, 3 Aug 2021 13:01:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237531AbhHCQ5d (ORCPT ); Tue, 3 Aug 2021 12:57:33 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E8FFC06179C for ; Tue, 3 Aug 2021 09:56:01 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id p21so29835109edi.9 for ; Tue, 03 Aug 2021 09:56:00 -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=xQD7Al/xWqy/c7eSkcmEaAiTTWdgKPQlL8d5Y2SFKFc=; b=rOUEbCXW2tt8czoc7gvHIXvxU4H+tmBOcNSwpnJ4jyGxu+vbSXUhCsUNyj7M69EA2d O1onMpRQ7zNuFgZS7a3i/E6vx1EP96UoskQtSIkZZZ+Yyf1qEIV0Z53z3bT2UcqerAAn ThA38o6QAt2zpClJiP1+EeR9mjjf//qHgsAbfJrncl9gTaKsK0UXyZmPHIcJr4oA+W+v H1R/Ua/2fTf1YDDkGUP2PtLHXuWPE9wNgvpv/WJn0jKUkAZ7s9/731o000j08VG2Uf8R 8npXdOcXwG/5A7gA8nCdMu+Cb/CONvYZV8zvU3mFKGsrQvWw+I0eUrh2qWb3wr+emVAo rhMA== 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=xQD7Al/xWqy/c7eSkcmEaAiTTWdgKPQlL8d5Y2SFKFc=; b=Pc+XfOE+fcxdJTuq3Hw4oGGvosTsMnE0N2/YgNJTpxlyLRrzaEQvG0ZKEFkkKBq+vE o5mkIZ/+ZCaCGHSR1QuXT7r2L8PRaFTxoJJna8GGC8ktqgT+yNvH4HtNfqGZ992LZ/53 LR/jJRsv5f5gpmWNP176eGQDSIh3tEBcqNIbxZEB76PxISXTvCO5gaQJOq5Lb8z2HiP5 OWc3SWIYB61rQaN6euYKDY0M+cqP2+VTo3P6vB0DluYnRPkl8xGA2jmGFkc5zfI7Irpp 2pkqoL2kdjYERYmUyDirbLtgSL0fQpRjgFsHCAbHzB3N9hcACv6+MR9p3wJrn15dazSQ XUZA== X-Gm-Message-State: AOAM530CxORUdTIbZRKW4SEyTEO4/20sN2kdhN6GsTY/+ZUbwTP4Fmo1 4qFhQGFaz4d2kJGfA5kJSj0= X-Google-Smtp-Source: ABdhPJypLO8OSOwQq0BCyCfHClvY2YxDsowQstu1p7nkUvxyjsWLzmESYLnXtq6Xy/+6vYVK8zlGMA== X-Received: by 2002:aa7:c6d3:: with SMTP id b19mr26268314eds.303.1628009759614; Tue, 03 Aug 2021 09:55:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 09:55:59 -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 6/8] dpaa2-switch: integrate the MAC endpoint support Date: Tue, 3 Aug 2021 19:57:43 +0300 Message-Id: <20210803165745.138175-7-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 X-Patchwork-Delegate: kuba@kernel.org From: Ioana Ciornei Integrate the common MAC endpoint management support into the dpaa2-switch driver as well. Nothing special happens here, just that the already available dpaa2-mac functions are also called from dpaa2-switch. Signed-off-by: Ioana Ciornei --- drivers/net/ethernet/freescale/dpaa2/Makefile | 2 +- .../freescale/dpaa2/dpaa2-switch-ethtool.c | 8 ++ .../ethernet/freescale/dpaa2/dpaa2-switch.c | 104 +++++++++++++++++- .../ethernet/freescale/dpaa2/dpaa2-switch.h | 18 +++ drivers/net/ethernet/freescale/dpaa2/dpsw.h | 5 + 5 files changed, 130 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/Makefile b/drivers/net/ethernet/freescale/dpaa2/Makefile index c2ef74052ef8..3d9842af7f10 100644 --- a/drivers/net/ethernet/freescale/dpaa2/Makefile +++ b/drivers/net/ethernet/freescale/dpaa2/Makefile @@ -11,7 +11,7 @@ fsl-dpaa2-eth-objs := dpaa2-eth.o dpaa2-ethtool.o dpni.o dpaa2-mac.o dpmac.o dpa fsl-dpaa2-eth-${CONFIG_FSL_DPAA2_ETH_DCB} += dpaa2-eth-dcb.o fsl-dpaa2-eth-${CONFIG_DEBUG_FS} += dpaa2-eth-debugfs.o fsl-dpaa2-ptp-objs := dpaa2-ptp.o dprtc.o -fsl-dpaa2-switch-objs := dpaa2-switch.o dpaa2-switch-ethtool.o dpsw.o dpaa2-switch-flower.o +fsl-dpaa2-switch-objs := dpaa2-switch.o dpaa2-switch-ethtool.o dpsw.o dpaa2-switch-flower.o dpaa2-mac.o dpmac.o # Needed by the tracing framework CFLAGS_dpaa2-eth.o := -I$(src) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c index 70e04321c420..5a460dcc6f4e 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c @@ -62,6 +62,10 @@ dpaa2_switch_get_link_ksettings(struct net_device *netdev, struct dpsw_link_state state = {0}; int err = 0; + if (dpaa2_switch_port_is_type_phy(port_priv)) + return phylink_ethtool_ksettings_get(port_priv->mac->phylink, + link_ksettings); + err = dpsw_if_get_link_state(port_priv->ethsw_data->mc_io, 0, port_priv->ethsw_data->dpsw_handle, port_priv->idx, @@ -95,6 +99,10 @@ dpaa2_switch_set_link_ksettings(struct net_device *netdev, bool if_running; int err = 0, ret; + if (dpaa2_switch_port_is_type_phy(port_priv)) + return phylink_ethtool_ksettings_set(port_priv->mac->phylink, + link_ksettings); + /* Interface needs to be down to change link settings */ if_running = netif_running(netdev); if (if_running) { diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index aad7f9abfa93..d260993ab2dc 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -600,6 +600,12 @@ static int dpaa2_switch_port_link_state_update(struct net_device *netdev) struct dpsw_link_state state; int err; + /* When we manage the MAC/PHY using phylink there is no need + * to manually update the netif_carrier. + */ + if (dpaa2_switch_port_is_type_phy(port_priv)) + return 0; + /* Interrupts are received even though no one issued an 'ifconfig up' * on the switch interface. Ignore these link state update interrupts */ @@ -677,12 +683,14 @@ static int dpaa2_switch_port_open(struct net_device *netdev) struct ethsw_core *ethsw = port_priv->ethsw_data; int err; - /* Explicitly set carrier off, otherwise - * netif_carrier_ok() will return true and cause 'ip link show' - * to report the LOWER_UP flag, even though the link - * notification wasn't even received. - */ - netif_carrier_off(netdev); + if (!dpaa2_switch_port_is_type_phy(port_priv)) { + /* Explicitly set carrier off, otherwise + * netif_carrier_ok() will return true and cause 'ip link show' + * to report the LOWER_UP flag, even though the link + * notification wasn't even received. + */ + netif_carrier_off(netdev); + } err = dpsw_if_enable(port_priv->ethsw_data->mc_io, 0, port_priv->ethsw_data->dpsw_handle, @@ -694,6 +702,9 @@ static int dpaa2_switch_port_open(struct net_device *netdev) dpaa2_switch_enable_ctrl_if_napi(ethsw); + if (dpaa2_switch_port_is_type_phy(port_priv)) + phylink_start(port_priv->mac->phylink); + return 0; } @@ -703,6 +714,13 @@ static int dpaa2_switch_port_stop(struct net_device *netdev) struct ethsw_core *ethsw = port_priv->ethsw_data; int err; + if (dpaa2_switch_port_is_type_phy(port_priv)) { + phylink_stop(port_priv->mac->phylink); + } else { + netif_tx_stop_all_queues(netdev); + netif_carrier_off(netdev); + } + err = dpsw_if_disable(port_priv->ethsw_data->mc_io, 0, port_priv->ethsw_data->dpsw_handle, port_priv->idx); @@ -1405,6 +1423,67 @@ bool dpaa2_switch_port_dev_check(const struct net_device *netdev) return netdev->netdev_ops == &dpaa2_switch_port_ops; } +static int dpaa2_switch_port_connect_mac(struct ethsw_port_priv *port_priv) +{ + struct fsl_mc_device *dpsw_port_dev, *dpmac_dev; + struct dpaa2_mac *mac; + int err; + + dpsw_port_dev = to_fsl_mc_device(port_priv->netdev->dev.parent); + dpmac_dev = fsl_mc_get_endpoint(dpsw_port_dev, port_priv->idx); + + if (PTR_ERR(dpmac_dev) == -EPROBE_DEFER) + return PTR_ERR(dpmac_dev); + + if (IS_ERR(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type) + return 0; + + mac = kzalloc(sizeof(*mac), GFP_KERNEL); + if (!mac) + return -ENOMEM; + + mac->mc_dev = dpmac_dev; + mac->mc_io = port_priv->ethsw_data->mc_io; + mac->net_dev = port_priv->netdev; + + err = dpaa2_mac_open(mac); + if (err) + goto err_free_mac; + port_priv->mac = mac; + + if (dpaa2_switch_port_is_type_phy(port_priv)) { + err = dpaa2_mac_connect(mac); + if (err) { + netdev_err(port_priv->netdev, + "Error connecting to the MAC endpoint %pe\n", + ERR_PTR(err)); + goto err_close_mac; + } + } + + return 0; + +err_close_mac: + dpaa2_mac_close(mac); + port_priv->mac = NULL; +err_free_mac: + kfree(mac); + return err; +} + +static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv) +{ + if (dpaa2_switch_port_is_type_phy(port_priv)) + dpaa2_mac_disconnect(port_priv->mac); + + if (!dpaa2_switch_port_has_mac(port_priv)) + return; + + dpaa2_mac_close(port_priv->mac); + kfree(port_priv->mac); + port_priv->mac = NULL; +} + static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg) { struct device *dev = (struct device *)arg; @@ -1427,6 +1506,14 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg) dpaa2_switch_port_link_state_update(port_priv->netdev); dpaa2_switch_port_set_mac_addr(port_priv); } + + if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) { + if (dpaa2_switch_port_has_mac(port_priv)) + dpaa2_switch_port_disconnect_mac(port_priv); + else + dpaa2_switch_port_connect_mac(port_priv); + } + out: err = dpsw_clear_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle, DPSW_IRQ_INDEX_IF, status); @@ -3112,6 +3199,7 @@ static int dpaa2_switch_remove(struct fsl_mc_device *sw_dev) for (i = 0; i < ethsw->sw_attr.num_ifs; i++) { port_priv = ethsw->ports[i]; unregister_netdev(port_priv->netdev); + dpaa2_switch_port_disconnect_mac(port_priv); free_netdev(port_priv->netdev); } @@ -3191,6 +3279,10 @@ static int dpaa2_switch_probe_port(struct ethsw_core *ethsw, goto err_port_probe; port_priv->learn_ena = false; + err = dpaa2_switch_port_connect_mac(port_priv); + if (err) + goto err_port_probe; + return 0; err_port_probe: diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h index f69d940f3c5b..0002dca4d417 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h @@ -21,6 +21,7 @@ #include #include +#include "dpaa2-mac.h" #include "dpsw.h" /* Number of IRQs supported */ @@ -159,6 +160,7 @@ struct ethsw_port_priv { bool learn_ena; struct dpaa2_switch_filter_block *filter_block; + struct dpaa2_mac *mac; }; /* Switch data */ @@ -225,6 +227,22 @@ static inline bool dpaa2_switch_supports_cpu_traffic(struct ethsw_core *ethsw) return true; } +static inline bool +dpaa2_switch_port_is_type_phy(struct ethsw_port_priv *port_priv) +{ + if (port_priv->mac && + (port_priv->mac->attr.link_type == DPMAC_LINK_TYPE_PHY || + port_priv->mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE)) + return true; + + return false; +} + +static inline bool dpaa2_switch_port_has_mac(struct ethsw_port_priv *port_priv) +{ + return port_priv->mac ? true : false; +} + bool dpaa2_switch_port_dev_check(const struct net_device *netdev); int dpaa2_switch_port_vlans_add(struct net_device *netdev, diff --git a/drivers/net/ethernet/freescale/dpaa2/dpsw.h b/drivers/net/ethernet/freescale/dpaa2/dpsw.h index 892df905b876..b90bd363f47a 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpsw.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpsw.h @@ -98,6 +98,11 @@ int dpsw_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token); */ #define DPSW_IRQ_EVENT_LINK_CHANGED 0x0001 +/** + * DPSW_IRQ_EVENT_ENDPOINT_CHANGED - Indicates a change in endpoint + */ +#define DPSW_IRQ_EVENT_ENDPOINT_CHANGED 0x0002 + /** * struct dpsw_irq_cfg - IRQ configuration * @addr: Address that must be written to signal a message-based interrupt 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: 12416857 X-Patchwork-Delegate: kuba@kernel.org 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 X-Patchwork-Delegate: kuba@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: 12416853 X-Patchwork-Delegate: kuba@kernel.org 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 X-Patchwork-Delegate: kuba@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 = {