netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Patrick McHardy <kaber@trash.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>,
	Ben Greear <greearb@candelatech.com>
Subject: [PATCH]: sky2: Fix VLAN unregistration
Date: Thu, 31 May 2007 10:19:45 -0700	[thread overview]
Message-ID: <20070531101945.2b19faa7@freepuppy> (raw)
In-Reply-To: <4659D174.70301@trash.net>

On Sun, 27 May 2007 20:44:04 +0200
Patrick McHardy <kaber@trash.net> wrote:

> Fix sky2 disabling VLAN completely when the first vid is unregistered.
> 
> For some reason the VLAN code insists on the driver providing a
> vlan_rx_kill_vid function even if only NETIF_F_HW_VLAN_RX and not
> NETIF_F_HW_VLAN_FILTER is set, so this patch keeps an empty
> function. This seems to be a bug though, vlan_rx_add_vid is only
> required with NETIF_F_HW_VLAN_FILTER. Ben?
> 

Reading other drivers, it looks like a better patch would be to
handle mode change in both set and kill.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

 drivers/net/sky2.c |   32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

--- a/drivers/net/sky2.c	2007-05-31 10:00:34.000000000 -0700
+++ b/drivers/net/sky2.c	2007-05-31 10:15:53.000000000 -0700
@@ -1042,34 +1042,50 @@ static int sky2_ioctl(struct net_device 
 }
 
 #ifdef SKY2_VLAN_TAG_USED
-static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
+static void sky2_set_vlan_mode(struct sky2_port *sky2)
 {
-	struct sky2_port *sky2 = netdev_priv(dev);
 	struct sky2_hw *hw = sky2->hw;
 	u16 port = sky2->port;
 
+	if (sky2->vlgrp) {
+		sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
+			     RX_VLAN_STRIP_ON);
+		sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
+			     TX_VLAN_TAG_ON);
+	} else {
+		sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
+			     RX_VLAN_STRIP_OFF);
+		sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
+			     TX_VLAN_TAG_OFF);
+	}
+}
+
+static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
+{
+	struct sky2_port *sky2 = netdev_priv(dev);
+
 	netif_tx_lock_bh(dev);
+	netif_poll_disable(sky2->hw->dev[0]);
 
-	sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_ON);
-	sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_ON);
 	sky2->vlgrp = grp;
+	sky2_set_vlan_mode(sky2);
 
 	netif_tx_unlock_bh(dev);
+	netif_poll_enable(sky2->hw->dev[0]);
 }
 
 static void sky2_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
 {
 	struct sky2_port *sky2 = netdev_priv(dev);
-	struct sky2_hw *hw = sky2->hw;
-	u16 port = sky2->port;
 
 	netif_tx_lock_bh(dev);
+	netif_poll_disable(sky2->hw->dev[0]);
 
-	sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_OFF);
-	sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF);
 	vlan_group_set_device(sky2->vlgrp, vid, NULL);
+	sky2_set_vlan_mode(sky2);
 
 	netif_tx_unlock_bh(dev);
+	netif_poll_enable(sky2->hw->dev[0]);
 }
 #endif
 

  parent reply	other threads:[~2007-05-31 17:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-27 18:44 [SKY2]: Fix VLAN unregistration Patrick McHardy
2007-05-28 21:42 ` Ben Greear
2007-05-29 10:57   ` Patrick McHardy
2007-05-29 17:16 ` Stephen Hemminger
2007-05-31 17:19 ` Stephen Hemminger [this message]
2007-05-31 17:37   ` [PATCH]: sky2: " Patrick McHardy
2007-05-31 18:21     ` Stephen Hemminger
2007-06-01 15:16       ` Patrick McHardy
2007-06-01 16:16         ` Stephen Hemminger

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=20070531101945.2b19faa7@freepuppy \
    --to=shemminger@linux-foundation.org \
    --cc=greearb@candelatech.com \
    --cc=kaber@trash.net \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).