Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298462
b: refs/heads/master
c: 52f5509
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Pirko authored and Jeff Kirsher committed Mar 28, 2012
1 parent aa66032 commit 5aeef76
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc3425cdc04206f3c8b9efb2c693e89aa3cd9ec7
refs/heads/master: 52f5509fe8ccb607ff9b84ad618f244262336475
35 changes: 22 additions & 13 deletions trunk/drivers/net/ethernet/intel/e1000/e1000_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ static int e1000_82547_fifo_workaround(struct e1000_adapter *adapter,
static bool e1000_vlan_used(struct e1000_adapter *adapter);
static void e1000_vlan_mode(struct net_device *netdev,
netdev_features_t features);
static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
bool filter_on);
static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
static void e1000_restore_vlan(struct e1000_adapter *adapter);
Expand Down Expand Up @@ -1214,7 +1216,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
if (err)
goto err_register;

e1000_vlan_mode(netdev, netdev->features);
e1000_vlan_filter_on_off(adapter, false);

/* print bus type/speed/width info */
e_info(probe, "(PCI%s:%dMHz:%d-bit) %pM\n",
Expand Down Expand Up @@ -4770,6 +4772,22 @@ static bool e1000_vlan_used(struct e1000_adapter *adapter)
return false;
}

static void __e1000_vlan_mode(struct e1000_adapter *adapter,
netdev_features_t features)
{
struct e1000_hw *hw = &adapter->hw;
u32 ctrl;

ctrl = er32(CTRL);
if (features & NETIF_F_HW_VLAN_RX) {
/* enable VLAN tag insert/strip */
ctrl |= E1000_CTRL_VME;
} else {
/* disable VLAN tag insert/strip */
ctrl &= ~E1000_CTRL_VME;
}
ew32(CTRL, ctrl);
}
static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
bool filter_on)
{
Expand All @@ -4779,6 +4797,7 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
if (!test_bit(__E1000_DOWN, &adapter->flags))
e1000_irq_disable(adapter);

__e1000_vlan_mode(adapter, adapter->netdev->features);
if (filter_on) {
/* enable VLAN receive filtering */
rctl = er32(RCTL);
Expand All @@ -4799,24 +4818,14 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
}

static void e1000_vlan_mode(struct net_device *netdev,
netdev_features_t features)
netdev_features_t features)
{
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 ctrl;

if (!test_bit(__E1000_DOWN, &adapter->flags))
e1000_irq_disable(adapter);

ctrl = er32(CTRL);
if (features & NETIF_F_HW_VLAN_RX) {
/* enable VLAN tag insert/strip */
ctrl |= E1000_CTRL_VME;
} else {
/* disable VLAN tag insert/strip */
ctrl &= ~E1000_CTRL_VME;
}
ew32(CTRL, ctrl);
__e1000_vlan_mode(adapter, features);

if (!test_bit(__E1000_DOWN, &adapter->flags))
e1000_irq_enable(adapter);
Expand Down

0 comments on commit 5aeef76

Please sign in to comment.