mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Rui Sousa <rui.sousa@nxp.com>, Fugang Duan <fugang.duan@nxp.com>,
	"David S . Miller" <davem@davemloft.net>,
	alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 3.18 9/9] net: fec: fix multicast filtering hardware setup
Date: Wed, 22 Nov 2017 22:24:52 +0000	[thread overview]
Message-ID: <20171122222445.19957-9-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171122222445.19957-1-alexander.levin@verizon.com>

From: Rui Sousa <rui.sousa@nxp.com>

[ 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 <rui.sousa@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 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/ethernet/freescale/fec_main.c
index 51f65299094b..065a7616e961 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2793,6 +2793,7 @@ static void set_multicast_list(struct net_device *ndev)
 	struct netdev_hw_addr *ha;
 	unsigned int i, bit, data, crc, tmp;
 	unsigned char hash;
+	unsigned int hash_high = 0, hash_low = 0;
 
 	if (ndev->flags & IFF_PROMISC) {
 		tmp = readl(fep->hwp + FEC_R_CNTRL);
@@ -2815,11 +2816,7 @@ static void set_multicast_list(struct net_device *ndev)
 		return;
 	}
 
-	/* 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 = 0xffffffff;
@@ -2837,16 +2834,14 @@ static void set_multicast_list(struct net_device *ndev)
 		 */
 		hash = (crc >> (32 - HASH_BITS)) & 0x3f;
 
-		if (hash > 31) {
-			tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
-			tmp |= 1 << (hash - 32);
-			writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
-		} else {
-			tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_LOW);
-			tmp |= 1 << hash;
-			writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
-		}
+		if (hash > 31)
+			hash_high |= 1 << (hash - 32);
+		else
+			hash_low |= 1 << hash;
 	}
+
+	writel(hash_high, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
+	writel(hash_low, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
 }
 
 /* Set a MAC change in hardware. */
-- 
2.11.0

  parent reply	other threads:[~2017-11-22 23:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 22:24 [PATCH AUTOSEL for 3.18 1/9] ARM: OMAP1: DMA: Correct the number of logical channels alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 3.18 2/9] vti6: fix device register to report IFLA_INFO_KIND alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 3.18 4/9] nfs: Don't take a reference on fl->fl_file for LOCK operation alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 3.18 3/9] net/appletalk: Fix kernel memory disclosure alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 3.18 6/9] net: sctp: fix array overrun read on sctp_timer_tbl alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 3.18 5/9] NFSv4: Fix client recovery when server reboots multiple times alexander.levin
2017-11-22 22:24 ` alexander.levin [this message]
2017-11-22 22:24 ` [PATCH AUTOSEL for 3.18 7/9] tipc: fix cleanup at module unload alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 3.18 8/9] mm: avoid returning VM_FAULT_RETRY from ->page_mkwrite handlers alexander.levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171122222445.19957-9-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=davem@davemloft.net \
    --cc=fugang.duan@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rui.sousa@nxp.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®