From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=unavailable 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 AFE1EC04AB1 for ; Thu, 9 May 2019 09:04:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DA61216C4 for ; Thu, 9 May 2019 09:04:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PiVaQAlR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726195AbfEIJEV (ORCPT ); Thu, 9 May 2019 05:04:21 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43897 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725847AbfEIJEV (ORCPT ); Thu, 9 May 2019 05:04:21 -0400 Received: by mail-wr1-f68.google.com with SMTP id r4so1867390wro.10; Thu, 09 May 2019 02:04:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JpLDmJ7s889veboW3Rv53oO/LHxCjZWmDgHuSW3TagQ=; b=PiVaQAlRCqcaxH/t1Ma0i3Mv3txU3+BTLiQ709cQeQESh9ShOWallWzcSJfmgI/jKx yXPtQXSV9IO2sowYJ8/0mMEdlDC1houJq2slnF41bqMBfMb7r3LB8NuA7fRN0sIrm87S tH6iyFvGktgqAlJgR6nOnRaHCkB+jutadvwTQWA7wDhq8alYs4JmpYmSShEsu2qOcTtS 9XqO1NN9gPhPv71gscI6jmzlp+j08Yt9Q2Gg4QqCnO5ii/muZz6ZgLnzq8ZaGeA2RzH5 +9OsLguIkPPQsuiL1RyJXa5tZmyNw8ZXEqysIMg3Zurs8TaMSpMTeqjSVrGab3JuvgEK rJfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JpLDmJ7s889veboW3Rv53oO/LHxCjZWmDgHuSW3TagQ=; b=EufEkL9LpuwGhPjzAch28uRj06Y4XUIRS7FoCThJAwLz5QSsKjGbXfjVaFzGVpp9Xl URYkY4uFC6MmMJ3bTZdtfcWLttsLXw8eQ+6D0JtI/2gVW0TxLllaxP9392qOB6HEOgfc W7ySvHWIBzGi6sN1b7LKnJHSWw+rk1VkEU6aOVwZxPu3880/ShtI1JxS/npMaiuDPFob igF8du5uYQzKAdR0ozoGEHBk1jA26D1jvYp1Cm0pouQo8pgr7gXh+6YtVLm1TZlc4ARN lMzb/ZM2nYr0rVgyXusPF0eNOMpnC6atv0OT1di284HcQdhgQzvbLgm28dlkGKW3RmSP SoVw== X-Gm-Message-State: APjAAAUwZqnCjlkT7DGAgm81W/+Cvqyt+XGiRS6/Liv3NyWVdF0wjBAk 9U4KScm6Zunu/evigp0h2EM= X-Google-Smtp-Source: APXvYqyttn1Qx8cKR4bIGf+yaqR0e3OpYZiBxXqTERuvfXIerrcaq5xBFdU42WbLdfKODFctvuI9xA== X-Received: by 2002:adf:e845:: with SMTP id d5mr2295362wrn.154.1557392659400; Thu, 09 May 2019 02:04:19 -0700 (PDT) Received: from Red ([2a01:cb1d:147:7200:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id l12sm975072wmj.0.2019.05.09.02.04.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 02:04:18 -0700 (PDT) Date: Thu, 9 May 2019 11:04:16 +0200 From: Corentin Labbe To: Jose Abreu Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Joao Pinto , "David S . Miller" , Giuseppe Cavallaro , Alexandre Torgue Subject: Re: [PATCH net-next 00/11] net: stmmac: Selftests Message-ID: <20190509090416.GB1605@Red> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, May 08, 2019 at 09:51:00AM +0200, Jose Abreu wrote: > [ Submitting with net-next closed for proper review and testing. ] > > This introduces selftests support in stmmac driver. We add 4 basic sanity > checks and MAC loopback support for all cores within the driver. This way > more tests can easily be added in the future and can be run in virtually > any MAC/GMAC/QoS/XGMAC platform. > > Having this we can find regressions and missing features in the driver > while at the same time we can check if the IP is correctly working. > > We have been using this for some time now and I do have more tests to > submit in the feature. My experience is that although writing the tests > adds more development time, the gain results are obvious. > > I let this feature optional within the driver under a Kconfig option. > > For this series the output result will be something like this > (e.g. for dwmac1000): > ---- > # ethtool -t eth0 > The test result is PASS > The test extra info: > 1. MAC Loopback 0 > 2. PHY Loopback -95 > 3. MMC Counters 0 > 4. EEE -95 > 5. Hash Filter MC 0 > 6. Perfect Filter UC 0 > 7. Flow Control 0 > ---- > > (Error code -95 means EOPNOTSUPP in current HW). > Hello I have started to patch dwmac_sun8i for using your patchset and get the following: The test result is FAIL The test extra info: 1. MAC Loopback 0 2. PHY Loopback -95 3. MMC Counters -95 4. EEE -95 5. Hash Filter MC 0 6. Perfect Filter UC 1 7. Flow Control -95 What means 1 for "Perfect Filter UC" ? I have added my patch below Regards --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -976,6 +976,18 @@ static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv) regulator_disable(gmac->regulator); } +static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable) +{ + u32 value = readl(ioaddr + EMAC_BASIC_CTL0); + + if (enable) + value |= EMAC_LOOPBACK; + else + value &= ~EMAC_LOOPBACK; + + writel(value, ioaddr + EMAC_BASIC_CTL0); +} + static const struct stmmac_ops sun8i_dwmac_ops = { .core_init = sun8i_dwmac_core_init, .set_mac = sun8i_dwmac_set_mac, @@ -985,6 +997,7 @@ static const struct stmmac_ops sun8i_dwmac_ops = { .flow_ctrl = sun8i_dwmac_flow_ctrl, .set_umac_addr = sun8i_dwmac_set_umac_addr, .get_umac_addr = sun8i_dwmac_get_umac_addr, + .set_mac_loopback = sun8i_dwmac_set_mac_loopback, }; static struct mac_device_info *sun8i_dwmac_setup(void *ppriv)