From patchwork Mon Nov 13 11:07:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 164408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1127122vqg; Mon, 13 Nov 2023 03:07:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeGmxVBZDY6Ohvyd/xsWC+fu4suAU+9vEFuaNqp22+knLKf58CHxRkYra7u6TVb39JSxVJ X-Received: by 2002:a17:903:d3:b0:1cc:6ec2:d24e with SMTP id x19-20020a17090300d300b001cc6ec2d24emr5006579plc.53.1699873649595; Mon, 13 Nov 2023 03:07:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699873649; cv=none; d=google.com; s=arc-20160816; b=V0RxktZerRs7ltiMXt/bNilzJ58jQpbiCV6iY3HpJYTWGut6lQKS9XDC0dvbQnxrGD JUt00IRtO13gF4fJYBWdGnz+BhGpg1H7RZA/Mo3OpyxW2YhxVAsmHv1tIu+JCT2XnWLx uI4IR7z9GtP8Yioi5XOpPqQnpk1txHZGYUOGfsmBUbzGi8sueeIybzZy3LfYMBkxYoQt apD8Z6wnQWsqnZZvhRmHQAof5CeiDF85zXn315PtOSsDd1usH8w66/d6xFqHnh85iOfh LMid0bnnh2YeZ/A7j9nWoPNCzMW0s8id4NJQfzgaorVP7LOmA665GVepfpvKFOKwobIq Us9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vOJ2zl8i5yGORXWu7mjzwse4nu+xURX9QZ0b4Dd0YTI=; fh=5XVN7hYDrjkwKFw4bFXRK8oy6VkSo1QEqyD70rM4SXo=; b=G20rMtP9WzmgYu6FkDiIvdxdUreGOs+yfPU8ticYnaF12krwSVLrDNEioX194ZVajQ gCh4+XE+xwIqFpFFk95tbPwmSyUrZXeA78k8HmrNN/5unt7d3PFC7xzjGs/0fahFCUc2 RyVcOqhlBE0UGog3ApqLHPgdg1o9k07UQKv1YFAvi/jY4F3Xt605e2JDDwsAxiw7nfut euiAA5kYvUcOpSQx7u3Qqfy+m96d3pC8yMP+O0PPTAyv8jrXV2DwTbVHUM7562mKW9zJ C7UZIeqsH7Wu1SRWu9cmVLf6lXc9ad7J386vXKYWrcrbt+0293kriSG/BGGy/nG1qxqy Dhww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PdvLOAOa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id jc5-20020a17090325c500b001c7342b46e4si5056055plb.23.2023.11.13.03.07.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 03:07:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PdvLOAOa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 87F81804746C; Mon, 13 Nov 2023 03:07:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjKMLHZ (ORCPT + 29 others); Mon, 13 Nov 2023 06:07:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjKMLHX (ORCPT ); Mon, 13 Nov 2023 06:07:23 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33EE310D0 for ; Mon, 13 Nov 2023 03:07:20 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 370A5C433CB; Mon, 13 Nov 2023 11:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699873639; bh=bN8FSN+y+03IPg4F931v2Jh6hFvo4bxNhLJa8WipQWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PdvLOAOaU/wKIWKM1KxY60RwmGDSq1UXZlrBO3HC4IGqOiJrf7pMfcljXSe+AuLJc w9GU6NHQ2GFP50pewNlBiUM5VAnN6978gVSWzMQJpwUDqdNkS8i2FqbfajpFL+Bv1e 6W/2gJ2RpEjSoOt0M4uRgkToGDdE1wR4qGqhUWDI7GupWKNnSsN7aH/OincREAtWsx nycnYtSH7HNGIa4Ad00Ic6jM8irxC8lN3hq13l0OBDlfrzuYhLSM4pJ7VgTUpyJfG8 GimYD5hj6wXP6UoNDnpUhyMXrKJFQtL7swsCy+VrIfU7ufZaFSoiyHj8GYHBgzo7Fv 29q1iwDuN68jA== From: Roger Quadros To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: vladimir.oltean@nxp.com, s-vadapalli@ti.com, r-gunasekaran@ti.com, srk@ti.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: [PATCH net-next 1/3] net: ethernet: am65-cpsw: Add standard Ethernet MAC stats to ethtool Date: Mon, 13 Nov 2023 13:07:06 +0200 Message-Id: <20231113110708.137379-2-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231113110708.137379-1-rogerq@kernel.org> References: <20231113110708.137379-1-rogerq@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 13 Nov 2023 03:07:28 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782446711799866741 X-GMAIL-MSGID: 1782446711799866741 Gets 'ethtool -S eth0 --groups eth-mac' command to work. Signed-off-by: Roger Quadros Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ti/am65-cpsw-ethtool.c | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/net/ethernet/ti/am65-cpsw-ethtool.c b/drivers/net/ethernet/ti/am65-cpsw-ethtool.c index c51e2af91f69..ac7276f0f77a 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-ethtool.c +++ b/drivers/net/ethernet/ti/am65-cpsw-ethtool.c @@ -662,6 +662,31 @@ static void am65_cpsw_get_ethtool_stats(struct net_device *ndev, hw_stats[i].offset); } +static void am65_cpsw_get_eth_mac_stats(struct net_device *ndev, + struct ethtool_eth_mac_stats *s) +{ + struct am65_cpsw_port *port = am65_ndev_to_port(ndev); + struct am65_cpsw_stats_regs *stats; + + stats = port->stat_base; + + s->FramesTransmittedOK = readl_relaxed(&stats->tx_good_frames); + s->SingleCollisionFrames = readl_relaxed(&stats->tx_single_coll_frames); + s->MultipleCollisionFrames = readl_relaxed(&stats->tx_mult_coll_frames); + s->FramesReceivedOK = readl_relaxed(&stats->rx_good_frames); + s->FrameCheckSequenceErrors = readl_relaxed(&stats->rx_crc_errors); + s->AlignmentErrors = readl_relaxed(&stats->rx_align_code_errors); + s->OctetsTransmittedOK = readl_relaxed(&stats->tx_octets); + s->FramesWithDeferredXmissions = readl_relaxed(&stats->tx_deferred_frames); + s->LateCollisions = readl_relaxed(&stats->tx_late_collisions); + s->CarrierSenseErrors = readl_relaxed(&stats->tx_carrier_sense_errors); + s->OctetsReceivedOK = readl_relaxed(&stats->rx_octets); + s->MulticastFramesXmittedOK = readl_relaxed(&stats->tx_multicast_frames); + s->BroadcastFramesXmittedOK = readl_relaxed(&stats->tx_broadcast_frames); + s->MulticastFramesReceivedOK = readl_relaxed(&stats->rx_multicast_frames); + s->BroadcastFramesReceivedOK = readl_relaxed(&stats->rx_broadcast_frames); +}; + static int am65_cpsw_get_ethtool_ts_info(struct net_device *ndev, struct ethtool_ts_info *info) { @@ -729,6 +754,7 @@ const struct ethtool_ops am65_cpsw_ethtool_ops_slave = { .get_sset_count = am65_cpsw_get_sset_count, .get_strings = am65_cpsw_get_strings, .get_ethtool_stats = am65_cpsw_get_ethtool_stats, + .get_eth_mac_stats = am65_cpsw_get_eth_mac_stats, .get_ts_info = am65_cpsw_get_ethtool_ts_info, .get_priv_flags = am65_cpsw_get_ethtool_priv_flags, .set_priv_flags = am65_cpsw_set_ethtool_priv_flags, From patchwork Mon Nov 13 11:07:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 164410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1127345vqg; Mon, 13 Nov 2023 03:07:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9Xq76tM+yzFRjwkjuQpM4fcEedMVmAEShZlappHzDjqJjdG01FjcXepE0Dh9R6P6ZZVMi X-Received: by 2002:a05:6a20:7faa:b0:184:26d8:cf5c with SMTP id d42-20020a056a207faa00b0018426d8cf5cmr5000833pzj.0.1699873675319; Mon, 13 Nov 2023 03:07:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699873675; cv=none; d=google.com; s=arc-20160816; b=k3L5MOVQzst+agmlNrjaNlmAUy9Fd/enDZFw1ILiVcB1Pdtvnv5Y8Sn8EZl/0c5tVP gCdatOSyE3CVspEgfLaXm6Kzzg5E+qwpe1BLLzrRriJ8q27kO78L24+Mqh1pvfyaquFK KAFOB5/NJeK8YTRO+a7DseH0FKjUgDERA/M7IqlSlhcudgjvSyY4cWF/wyv51Y05hTcU FQOOuA+E7bMJxGkfuFRAQJuqM6NGqjirQ/PQYqXYnREYjbPGx1VA2c2C6Fyaa1q2N1Hk EN5/vKG1DAek4sw1WaWGdD9ATy0oDJAr9KRXRk2Ax8Rgb5wMBOQWUX5+UXDZrlgjB02Y OH9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3Ps+P2CUDkWffXDCpOeVdozOdSSYnGoThTFLBBxUZzo=; fh=5XVN7hYDrjkwKFw4bFXRK8oy6VkSo1QEqyD70rM4SXo=; b=zpnE5QC8M1NQfwzAKL9+wg1roGai4Nyh1jB2GHHsFFg1WnVImZqDx6bE9VTbLX0wdB zhSjij3wM6dU1+Vt6n+h9yMt9X2JJGmkAh2EIUVQNioRehR/BA3RwfFWY4xxkYGXA4t/ K4+i8b7T7YbIKzjiUA32uh45P95eREC8PZExq9T+wwUQhRo4UYLr/OS695qVt5VVW8Yw 7mrhVWtJsyD8d4xYJmUMCNGnj1m+uJXCGi4Vl1aS3Me20/iG52Dj9cziF/gWrxT8Q6Pt CnP+UcWufmuGAobs+FO1nrv2MWNDZf1k+5flldj+126Mm+/t7TfDf5bw8cNuDQdYVDJ2 Bp3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UcVyKSso; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bi6-20020a056a02024600b0056ad01ddc36si5532082pgb.509.2023.11.13.03.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 03:07:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UcVyKSso; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 117DB806381B; Mon, 13 Nov 2023 03:07:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbjKMLH2 (ORCPT + 29 others); Mon, 13 Nov 2023 06:07:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbjKMLH0 (ORCPT ); Mon, 13 Nov 2023 06:07:26 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C0F010D7 for ; Mon, 13 Nov 2023 03:07:23 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58709C433C8; Mon, 13 Nov 2023 11:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699873643; bh=sHCRpYWlwN1++CWChUaVlOJq1vUhjh4oC5rKbeN65HU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UcVyKSsoOi4EGz1SVIaJoOdWkdYgJk+eGaUMj+OhwJibXvmBRYctyYYSwGm1ecXWS VeRffEN7ClWQZBmD1mfCZHzqS2wEHQGjHUh4FzGxxi9ebmRXRBVum/KCcwfjPb5AXe b7FyTWeVQXayqLvsOxk1e0p47dNGOIhislNZw8zZ8aeHULkHNw8U2BIhlFI4OLk/Wd wYAvUQ7x9YVvW59RgRmWdXhS2JwDBNRBvpPe8rKTcDxF60bDu+lUnVhaTKXt/JF1g7 iZICMGQcBk4OPfJFHborcOpAb0FG9cxWf85cDpI2HHS7S3TtNdF0AFPPaiArgG/s6b gEEb7QXjhK5xA== From: Roger Quadros To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: vladimir.oltean@nxp.com, s-vadapalli@ti.com, r-gunasekaran@ti.com, srk@ti.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: [PATCH net-next 2/3] net: ethernet: am65-cpsw: Set default TX channels to maximum Date: Mon, 13 Nov 2023 13:07:07 +0200 Message-Id: <20231113110708.137379-3-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231113110708.137379-1-rogerq@kernel.org> References: <20231113110708.137379-1-rogerq@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 13 Nov 2023 03:07:53 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782446739344632717 X-GMAIL-MSGID: 1782446739344632717 am65-cpsw supports 8 TX hardware queues. Set this as default. Signed-off-by: Roger Quadros Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index ece9f8df98ae..7c440899c93c 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -136,6 +136,8 @@ NETIF_MSG_IFUP | NETIF_MSG_PROBE | NETIF_MSG_IFDOWN | \ NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) +#define AM65_CPSW_DEFAULT_TX_CHNS 8 + static void am65_cpsw_port_set_sl_mac(struct am65_cpsw_port *slave, const u8 *dev_addr) { @@ -2897,7 +2899,7 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev) common->rx_flow_id_base = -1; init_completion(&common->tdown_complete); - common->tx_ch_num = 1; + common->tx_ch_num = AM65_CPSW_DEFAULT_TX_CHNS; common->pf_p0_rx_ptype_rrobin = false; common->default_vlan = 1; From patchwork Mon Nov 13 11:07:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 164409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1127282vqg; Mon, 13 Nov 2023 03:07:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFotTtWqq3PxKFGHFKWE4aD4PNXK+peoNqZ03iCtzi/w9nav+X2jtRm1y25A34MX5Wn+dAP X-Received: by 2002:a05:6a20:2d2c:b0:171:4921:f1b7 with SMTP id g44-20020a056a202d2c00b001714921f1b7mr5482285pzl.41.1699873666518; Mon, 13 Nov 2023 03:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699873666; cv=none; d=google.com; s=arc-20160816; b=hTKWTJaIwWRZ2GPaPUjFWlf1xC2era+0iY7pYotBXiAE2ejVOwmVnouTkbzaeTkPYt 7fHSrzU5qbx8ttIvTAeqe1KyNcMOh/Oeb+8pieiuUUK294TSCM8rftziTvRzFRPBqyab kAutvZ4TtRllUWC5PWVrwRQJA7NkKqBpTT2vXhvAKmER0TmmGJMoTYspse5Ry1rK3FZH Hvlmiz9HbAeno6nkwJXmPxs+6yoUKW0Hx1J5osQsirOEvJAJCh0Tjt9qviejN4+wOqyZ PTZ7bNzKZr4CE75J4RhX6G88wM+qdRz9C6zyOBDR8hA9BRH9QpDl/4rwm8BTU/5ZG7Mb OIJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+Iiijpk/0H1FHN64iXKPcoSknydrOsuXD4FslxeKlzc=; fh=5XVN7hYDrjkwKFw4bFXRK8oy6VkSo1QEqyD70rM4SXo=; b=XuQa1g+VkHQlzNoRlmwqOTsUzzr1RaJ+IaIsDArDH70TNzQJofF6o5duJYRTtbtSWP DzASbOy8nzwcuLNXuE8aZecvgO0JT2aIgXWLLcn+EAW4h4mw12L33obpu3kEnTLiWonC x2g5ZD+AhJEn2bmp39V3C2MMhpZkZfJrhg9KUDRHGnHB/L+pUFBUdNgqtvckwf+5CPoj yzM7UQsu7XczUVOPStnHBb20MSv0Mx3s+Ka72t41mQ+fxTJ4FOsP0JdzvTkeOn1irViM 8oErf3gucweTXRwh6KU17f44H7sn8qrkEy0Xxsv+gGufosYBEerETvni7s8wY6rP9M/Z yWdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fFTOq4h4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id so10-20020a17090b1f8a00b00279020d1fb0si5868646pjb.129.2023.11.13.03.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 03:07:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fFTOq4h4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2DDA3804706A; Mon, 13 Nov 2023 03:07:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbjKMLHg (ORCPT + 29 others); Mon, 13 Nov 2023 06:07:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbjKMLH3 (ORCPT ); Mon, 13 Nov 2023 06:07:29 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D89210F0 for ; Mon, 13 Nov 2023 03:07:26 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FF6AC433C7; Mon, 13 Nov 2023 11:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699873646; bh=ZR/DMZiyPsFy+qz8rEgRfcpH4vlRg6uq7If8iaVqgDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fFTOq4h4BIeRZgABsCAYrICCROmZWg0yTLFR3qD5fmh+i5iCyUQPRjfQQGloe+CVs lbKAIqSv4CnJYPudxvm8kyBTs91R49XO6RJ6A2xp5He0htSmV9aVPldmxwsGB8rwrZ Ng8UTO3zR9LsV/fzOKooOF7ko/kbkiFsvfyj7jMGh0DDWKpUhwwuaLNF4zO8uCl6mk 7mkAxj25in57JrKMZ1+nhdbOpPMNwNOH3pkhgAqZbg/8E2U7YhD6qVQ/Xkna2IHyOZ UIiwbsQI2ssUJURO2STSw9ZqQUUHJSBYnoN4h68JvpsNEGGhTmEknEc0p1n/tGDMMo rSYeDRj26szDg== From: Roger Quadros To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: vladimir.oltean@nxp.com, s-vadapalli@ti.com, r-gunasekaran@ti.com, srk@ti.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: [PATCH net-next 3/3] net: ethernet: am65-cpsw: Error out if Enable TX/RX channel fails Date: Mon, 13 Nov 2023 13:07:08 +0200 Message-Id: <20231113110708.137379-4-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231113110708.137379-1-rogerq@kernel.org> References: <20231113110708.137379-1-rogerq@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 13 Nov 2023 03:07:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782446729774293473 X-GMAIL-MSGID: 1782446729774293473 k3_udma_glue_enable_rx/tx_chn returns error code on failure. Bail out on error while enabling TX/RX channel. Signed-off-by: Roger Quadros Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 33 +++++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 7c440899c93c..340f25bf33b1 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -372,7 +372,7 @@ static void am65_cpsw_init_port_emac_ale(struct am65_cpsw_port *port); static int am65_cpsw_nuss_common_open(struct am65_cpsw_common *common) { struct am65_cpsw_host *host_p = am65_common_get_host(common); - int port_idx, i, ret; + int port_idx, i, ret, tx; struct sk_buff *skb; u32 val, port_mask; @@ -453,13 +453,22 @@ static int am65_cpsw_nuss_common_open(struct am65_cpsw_common *common) } kmemleak_not_leak(skb); } - k3_udma_glue_enable_rx_chn(common->rx_chns.rx_chn); - for (i = 0; i < common->tx_ch_num; i++) { - ret = k3_udma_glue_enable_tx_chn(common->tx_chns[i].tx_chn); - if (ret) - return ret; - napi_enable(&common->tx_chns[i].napi_tx); + ret = k3_udma_glue_enable_rx_chn(common->rx_chns.rx_chn); + if (ret) { + dev_err(common->dev, "couldn't enable rx chn: %d\n", ret); + return ret; + } + + for (tx = 0; tx < common->tx_ch_num; tx++) { + ret = k3_udma_glue_enable_tx_chn(common->tx_chns[tx].tx_chn); + if (ret) { + dev_err(common->dev, "couldn't enable tx chn %d: %d\n", + tx, ret); + tx--; + goto fail_tx; + } + napi_enable(&common->tx_chns[tx].napi_tx); } napi_enable(&common->napi_rx); @@ -470,6 +479,16 @@ static int am65_cpsw_nuss_common_open(struct am65_cpsw_common *common) dev_dbg(common->dev, "cpsw_nuss started\n"); return 0; + +fail_tx: + while (tx >= 0) { + napi_disable(&common->tx_chns[tx].napi_tx); + k3_udma_glue_disable_tx_chn(common->tx_chns[tx].tx_chn); + tx--; + } + + k3_udma_glue_disable_rx_chn(common->rx_chns.rx_chn); + return ret; } static void am65_cpsw_nuss_tx_cleanup(void *data, dma_addr_t desc_dma);