From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sn1nam01on0134.outbound.protection.outlook.com ([104.47.32.134]:63889 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753638AbeARVCz (ORCPT ); Thu, 18 Jan 2018 16:02:55 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Rui Sousa , Fugang Duan , "David S . Miller" , Sasha Levin Subject: [added to the 4.1 stable tree] net: fec: fix multicast filtering hardware setup Date: Thu, 18 Jan 2018 21:00:35 +0000 Message-ID: <20180118205908.3220-134-alexander.levin@microsoft.com> References: <20180118205908.3220-1-alexander.levin@microsoft.com> In-Reply-To: <20180118205908.3220-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Rui Sousa This patch has been added to the stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 01f8902bcf3ff124d0aeb88a774180ebcec20ace ] Fix hardware setup of multicast address hash: - Never clear the hardware hash (to avoid packet loss) - Construct the hash register values in software and then write once to hardware Signed-off-by: Rui Sousa Signed-off-by: Fugang Duan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/fec_main.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethern= et/freescale/fec_main.c index 67aec18dd76c..fe5a7d207b1d 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -2850,6 +2850,7 @@ static void set_multicast_list(struct net_device *nde= v) struct netdev_hw_addr *ha; unsigned int i, bit, data, crc, tmp; unsigned char hash; + unsigned int hash_high =3D 0, hash_low =3D 0; =20 if (ndev->flags & IFF_PROMISC) { tmp =3D readl(fep->hwp + FEC_R_CNTRL); @@ -2872,11 +2873,7 @@ static void set_multicast_list(struct net_device *nd= ev) return; } =20 - /* Clear filter and add the addresses in hash register - */ - writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH); - writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW); - + /* Add the addresses in hash register */ netdev_for_each_mc_addr(ha, ndev) { /* calculate crc32 value of mac address */ crc =3D 0xffffffff; @@ -2894,16 +2891,14 @@ static void set_multicast_list(struct net_device *n= dev) */ hash =3D (crc >> (32 - HASH_BITS)) & 0x3f; =20 - if (hash > 31) { - tmp =3D readl(fep->hwp + FEC_GRP_HASH_TABLE_HIGH); - tmp |=3D 1 << (hash - 32); - writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_HIGH); - } else { - tmp =3D readl(fep->hwp + FEC_GRP_HASH_TABLE_LOW); - tmp |=3D 1 << hash; - writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_LOW); - } + if (hash > 31) + hash_high |=3D 1 << (hash - 32); + else + hash_low |=3D 1 << hash; } + + writel(hash_high, fep->hwp + FEC_GRP_HASH_TABLE_HIGH); + writel(hash_low, fep->hwp + FEC_GRP_HASH_TABLE_LOW); } =20 /* Set a MAC change in hardware. */ --=20 2.11.0