From patchwork Thu Jun 18 21:35:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lennert Buytenhek X-Patchwork-Id: 28881 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 25B71B723A for ; Fri, 19 Jun 2009 07:21:22 +1000 (EST) Received: by ozlabs.org (Postfix) id 1753BDDDA2; Fri, 19 Jun 2009 07:21:22 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 9D7B2DDDA1 for ; Fri, 19 Jun 2009 07:21:21 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753850AbZFRVVN (ORCPT ); Thu, 18 Jun 2009 17:21:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751960AbZFRVVM (ORCPT ); Thu, 18 Jun 2009 17:21:12 -0400 Received: from xi.wantstofly.org ([80.101.37.227]:54994 "EHLO mail.wantstofly.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751842AbZFRVVM (ORCPT ); Thu, 18 Jun 2009 17:21:12 -0400 Received: by mail.wantstofly.org (Postfix, from userid 500) id 228E618E1FC; Thu, 18 Jun 2009 23:35:02 +0200 (CEST) Date: Thu, 18 Jun 2009 23:35:02 +0200 From: Lennert Buytenhek To: netdev@vger.kernel.org, davem@davemloft.net Cc: stable@kernel.org Subject: [PATCH] mv643xx_eth: fix unicast filter programming in promiscuous mode Message-ID: <20090618213502.GM12752@mail.wantstofly.org> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Prabhanjan Sarnaik The Unicast Promiscious Mode (UPM) bit in the mv643xx_eth port configuration register doesn't do exactly what its name would suggest: setting this bit merely enables reception of all unicast frames with a destination address that differs from our local MAC address in bits [47:4]. In particular, it doesn't have any effect on unicast frames with a destination address that matches our MAC address in bits [47:4] -- these will still be tested against the 16-entry unicast address filter table. Therefore, if the interface is set to promiscuous mode, just setting the unicast promiscuous bit isn't enough -- we need to set all filter bits in the unicast filter table to 1 as well. Reported-by: Sachin Sanap Signed-off-by: Prabhanjan Sarnaik Tested-by: Siddarth Gore Tested-by: Mahavir Jain Signed-off-by: Lennert Buytenhek Cc: stable@kernel.org --- This patch is relevant for 2.6.29 and 2.6.30 as well. diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 6bb5af3..305e0d1 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c @@ -1751,12 +1751,12 @@ static void mv643xx_eth_program_unicast_filter(struct net_device *dev) uc_addr_set(mp, dev->dev_addr); - port_config = rdlp(mp, PORT_CONFIG); + port_config = rdlp(mp, PORT_CONFIG) & ~UNICAST_PROMISCUOUS_MODE; + nibbles = uc_addr_filter_mask(dev); if (!nibbles) { port_config |= UNICAST_PROMISCUOUS_MODE; - wrlp(mp, PORT_CONFIG, port_config); - return; + nibbles = 0xffff; } for (i = 0; i < 16; i += 4) { @@ -1777,7 +1777,6 @@ static void mv643xx_eth_program_unicast_filter(struct net_device *dev) wrl(mp, off, v); } - port_config &= ~UNICAST_PROMISCUOUS_MODE; wrlp(mp, PORT_CONFIG, port_config); }