]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/e1000/e1000_main.c
vlan: Don't check for vlan group before vlan_tx_tag_present.
[net-next-2.6.git] / drivers / net / e1000 / e1000_main.c
index 8d9269d12a67f3b7eb69f3fbf65b0483fb14cbee..a117f2a0252e8c884f6d890f912556924635cae9 100644 (file)
@@ -123,8 +123,10 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter,
                                 struct e1000_rx_ring *rx_ring);
 static void e1000_set_rx_mode(struct net_device *netdev);
 static void e1000_update_phy_info(unsigned long data);
+static void e1000_update_phy_info_task(struct work_struct *work);
 static void e1000_watchdog(unsigned long data);
 static void e1000_82547_tx_fifo_stall(unsigned long data);
+static void e1000_82547_tx_fifo_stall_task(struct work_struct *work);
 static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
                                    struct net_device *netdev);
 static struct net_device_stats * e1000_get_stats(struct net_device *netdev);
@@ -519,8 +521,21 @@ void e1000_down(struct e1000_adapter *adapter)
        e1000_clean_all_rx_rings(adapter);
 }
 
+void e1000_reinit_safe(struct e1000_adapter *adapter)
+{
+       while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
+               msleep(1);
+       rtnl_lock();
+       e1000_down(adapter);
+       e1000_up(adapter);
+       rtnl_unlock();
+       clear_bit(__E1000_RESETTING, &adapter->flags);
+}
+
 void e1000_reinit_locked(struct e1000_adapter *adapter)
 {
+       /* if rtnl_lock is not held the call path is bogus */
+       ASSERT_RTNL();
        WARN_ON(in_interrupt());
        while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
                msleep(1);
@@ -988,8 +1003,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
           (hw->mac_type != e1000_82547))
                netdev->features |= NETIF_F_TSO;
 
-       if (pci_using_dac)
+       if (pci_using_dac) {
                netdev->features |= NETIF_F_HIGHDMA;
+               netdev->vlan_features |= NETIF_F_HIGHDMA;
+       }
 
        netdev->vlan_features |= NETIF_F_TSO;
        netdev->vlan_features |= NETIF_F_HW_CSUM;
@@ -1045,7 +1062,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
        adapter->phy_info_timer.function = e1000_update_phy_info;
        adapter->phy_info_timer.data = (unsigned long)adapter;
 
+       INIT_WORK(&adapter->fifo_stall_task, e1000_82547_tx_fifo_stall_task);
        INIT_WORK(&adapter->reset_task, e1000_reset_task);
+       INIT_WORK(&adapter->phy_info_task, e1000_update_phy_info_task);
 
        e1000_check_options(adapter);
 
@@ -2232,22 +2251,45 @@ static void e1000_set_rx_mode(struct net_device *netdev)
 static void e1000_update_phy_info(unsigned long data)
 {
        struct e1000_adapter *adapter = (struct e1000_adapter *)data;
+       schedule_work(&adapter->phy_info_task);
+}
+
+static void e1000_update_phy_info_task(struct work_struct *work)
+{
+       struct e1000_adapter *adapter = container_of(work,
+                                                    struct e1000_adapter,
+                                                    phy_info_task);
        struct e1000_hw *hw = &adapter->hw;
+
+       rtnl_lock();
        e1000_phy_get_info(hw, &adapter->phy_info);
+       rtnl_unlock();
 }
 
 /**
  * e1000_82547_tx_fifo_stall - Timer Call-back
  * @data: pointer to adapter cast into an unsigned long
  **/
-
 static void e1000_82547_tx_fifo_stall(unsigned long data)
 {
        struct e1000_adapter *adapter = (struct e1000_adapter *)data;
+       schedule_work(&adapter->fifo_stall_task);
+}
+
+/**
+ * e1000_82547_tx_fifo_stall_task - task to complete work
+ * @work: work struct contained inside adapter struct
+ **/
+static void e1000_82547_tx_fifo_stall_task(struct work_struct *work)
+{
+       struct e1000_adapter *adapter = container_of(work,
+                                                    struct e1000_adapter,
+                                                    fifo_stall_task);
        struct e1000_hw *hw = &adapter->hw;
        struct net_device *netdev = adapter->netdev;
        u32 tctl;
 
+       rtnl_lock();
        if (atomic_read(&adapter->tx_fifo_stall)) {
                if ((er32(TDT) == er32(TDH)) &&
                   (er32(TDFT) == er32(TDFH)) &&
@@ -2268,6 +2310,7 @@ static void e1000_82547_tx_fifo_stall(unsigned long data)
                        mod_timer(&adapter->tx_fifo_stall_timer, jiffies + 1);
                }
        }
+       rtnl_unlock();
 }
 
 bool e1000_has_link(struct e1000_adapter *adapter)
@@ -3076,7 +3119,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
                }
        }
 
-       if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
+       if (unlikely(vlan_tx_tag_present(skb))) {
                tx_flags |= E1000_TX_FLAGS_VLAN;
                tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
        }
@@ -3135,7 +3178,7 @@ static void e1000_reset_task(struct work_struct *work)
        struct e1000_adapter *adapter =
                container_of(work, struct e1000_adapter, reset_task);
 
-       e1000_reinit_locked(adapter);
+       e1000_reinit_safe(adapter);
 }
 
 /**
@@ -3557,7 +3600,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
        adapter->total_tx_packets += total_tx_packets;
        netdev->stats.tx_bytes += total_tx_bytes;
        netdev->stats.tx_packets += total_tx_packets;
-       return (count < tx_ring->count);
+       return count < tx_ring->count;
 }
 
 /**
@@ -3621,13 +3664,14 @@ static void e1000_consume_page(struct e1000_buffer *bi, struct sk_buff *skb,
 static void e1000_receive_skb(struct e1000_adapter *adapter, u8 status,
                              __le16 vlan, struct sk_buff *skb)
 {
-       if (unlikely(adapter->vlgrp && (status & E1000_RXD_STAT_VP))) {
-               vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
-                                        le16_to_cpu(vlan) &
-                                        E1000_RXD_SPC_VLAN_MASK);
-       } else {
-               netif_receive_skb(skb);
-       }
+       skb->protocol = eth_type_trans(skb, adapter->netdev);
+
+       if ((unlikely(adapter->vlgrp && (status & E1000_RXD_STAT_VP))))
+               vlan_gro_receive(&adapter->napi, adapter->vlgrp,
+                                le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK,
+                                skb);
+       else
+               napi_gro_receive(&adapter->napi, skb);
 }
 
 /**
@@ -3785,8 +3829,6 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
                        goto next_desc;
                }
 
-               skb->protocol = eth_type_trans(skb, netdev);
-
                e1000_receive_skb(adapter, status, rx_desc->special, skb);
 
 next_desc:
@@ -3949,8 +3991,6 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
                                  ((u32)(rx_desc->errors) << 24),
                                  le16_to_cpu(rx_desc->csum), skb);
 
-               skb->protocol = eth_type_trans(skb, netdev);
-
                e1000_receive_skb(adapter, status, rx_desc->special, skb);
 
 next_desc:
@@ -4501,7 +4541,7 @@ static void e1000_restore_vlan(struct e1000_adapter *adapter)
 
        if (adapter->vlgrp) {
                u16 vid;
-               for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
+               for (vid = 0; vid < VLAN_N_VID; vid++) {
                        if (!vlan_group_get_device(adapter->vlgrp, vid))
                                continue;
                        e1000_vlan_rx_add_vid(adapter->netdev, vid);