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=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 B8277C04AAC for ; Thu, 23 May 2019 07:37:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79B282075E for ; Thu, 23 May 2019 07:37:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="FdxZRRlJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730325AbfEWHhe (ORCPT ); Thu, 23 May 2019 03:37:34 -0400 Received: from smtprelay-out1.synopsys.com ([198.182.47.102]:43610 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1730178AbfEWHhb (ORCPT ); Thu, 23 May 2019 03:37:31 -0400 Received: from mailhost.synopsys.com (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id F3AD2C0197; Thu, 23 May 2019 07:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1558597058; bh=XUsua8QiKQIilIpw5Wo6XrXlSz3zgdfM7HiyZjxTcjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=FdxZRRlJJxMRJTZu55BB69hos4AMhBP+mYiV0/oFYOkc3svfIX7T6SoWPjIEzeyDo L9i98oX33S3DZarGzL9EIvYyQlMpmBj96+kybnLAbTbP2ovcC4T35hLZvk/AI7Oh26 U1be3V8yKih4qQl6wWBj+K1W02OmSM0FIgMYWA5zv6JNSHtNwpHGX51wqaAWAaCHTX VM92R+Sgj3+5zSerW3bNtV001Z5RM1k/rVbMrKML4NFnEMLxpjRkPrqO1IyBDX0sYY LVcrqDRH+ZYDo5qfDQQzqfLoVFZwSQVpdpuDZYR8oZSv8XkBR+aFFyTcUfYeggKoVu C1QU/G5fyWI6w== Received: from de02.synopsys.com (germany.internal.synopsys.com [10.225.17.21]) by mailhost.synopsys.com (Postfix) with ESMTP id 7B0C2A0242; Thu, 23 May 2019 07:37:30 +0000 (UTC) Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by de02.synopsys.com (Postfix) with ESMTP id 2A3223D96D; Thu, 23 May 2019 09:37:29 +0200 (CEST) From: Jose Abreu To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Jose Abreu , Joao Pinto , "David S . Miller" , Giuseppe Cavallaro , Alexandre Torgue Subject: [PATCH net-next 17/18] net: stmmac: dwmac4/5: Clear unused address entries Date: Thu, 23 May 2019 09:37:07 +0200 Message-Id: <83f187d192b6c43262d23a56a68096ffff71fa7a.1558596600.git.joabreu@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case we don't use a given address entry we need to clear it because it could contain previous values that are no longer valid. Found out while running stmmac selftests. Signed-off-by: Jose Abreu Cc: Joao Pinto Cc: David S. Miller Cc: Giuseppe Cavallaro Cc: Alexandre Torgue --- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index 094bd069c093..9f14943ca34c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -446,14 +446,20 @@ static void dwmac4_set_filter(struct mac_device_info *hw, * are required */ value |= GMAC_PACKET_FILTER_PR; - } else if (!netdev_uc_empty(dev)) { - int reg = 1; + } else { struct netdev_hw_addr *ha; + int reg = 1; netdev_for_each_uc_addr(ha, dev) { dwmac4_set_umac_addr(hw, ha->addr, reg); reg++; } + + while (reg <= GMAC_MAX_PERFECT_ADDRESSES) { + writel(0, ioaddr + GMAC_ADDR_HIGH(reg)); + writel(0, ioaddr + GMAC_ADDR_LOW(reg)); + reg++; + } } writel(value, ioaddr + GMAC_PACKET_FILTER); -- 2.7.4