diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-07-20 23:25:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-21 16:47:56 -0400 |
commit | dadcd65f52921456112183fde543fc214bb0a227 (patch) | |
tree | 0909d94a29e176558ee80af3d0dfc6359ab16de7 /drivers | |
parent | 6dacaddd4850cbd6390d4f87548262b5ed79b4a5 (diff) |
ixgbevf: do vlan cleanup
- unify vlan and nonvlan rx path
- kill adapter->vlgrp and ixgbevf_vlan_rx_register
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ixgbevf/ixgbevf.h | 6 | ||||
-rw-r--r-- | drivers/net/ixgbevf/ixgbevf_main.c | 64 |
2 files changed, 18 insertions, 52 deletions
diff --git a/drivers/net/ixgbevf/ixgbevf.h b/drivers/net/ixgbevf/ixgbevf.h index a2bbbb35816..8857df4dd3b 100644 --- a/drivers/net/ixgbevf/ixgbevf.h +++ b/drivers/net/ixgbevf/ixgbevf.h | |||
@@ -29,9 +29,11 @@ | |||
29 | #define _IXGBEVF_H_ | 29 | #define _IXGBEVF_H_ |
30 | 30 | ||
31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
32 | #include <linux/bitops.h> | ||
32 | #include <linux/timer.h> | 33 | #include <linux/timer.h> |
33 | #include <linux/io.h> | 34 | #include <linux/io.h> |
34 | #include <linux/netdevice.h> | 35 | #include <linux/netdevice.h> |
36 | #include <linux/if_vlan.h> | ||
35 | 37 | ||
36 | #include "vf.h" | 38 | #include "vf.h" |
37 | 39 | ||
@@ -185,9 +187,7 @@ struct ixgbevf_q_vector { | |||
185 | /* board specific private data structure */ | 187 | /* board specific private data structure */ |
186 | struct ixgbevf_adapter { | 188 | struct ixgbevf_adapter { |
187 | struct timer_list watchdog_timer; | 189 | struct timer_list watchdog_timer; |
188 | #ifdef NETIF_F_HW_VLAN_TX | 190 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
189 | struct vlan_group *vlgrp; | ||
190 | #endif | ||
191 | u16 bd_number; | 191 | u16 bd_number; |
192 | struct work_struct reset_task; | 192 | struct work_struct reset_task; |
193 | struct ixgbevf_q_vector *q_vector[MAX_MSIX_Q_VECTORS]; | 193 | struct ixgbevf_q_vector *q_vector[MAX_MSIX_Q_VECTORS]; |
diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c index fec36bde199..3b880a27f8d 100644 --- a/drivers/net/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ixgbevf/ixgbevf_main.c | |||
@@ -30,6 +30,7 @@ | |||
30 | Copyright (c)2006 - 2007 Myricom, Inc. for some LRO specific code | 30 | Copyright (c)2006 - 2007 Myricom, Inc. for some LRO specific code |
31 | ******************************************************************************/ | 31 | ******************************************************************************/ |
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/bitops.h> | ||
33 | #include <linux/module.h> | 34 | #include <linux/module.h> |
34 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
35 | #include <linux/netdevice.h> | 36 | #include <linux/netdevice.h> |
@@ -288,21 +289,17 @@ static void ixgbevf_receive_skb(struct ixgbevf_q_vector *q_vector, | |||
288 | { | 289 | { |
289 | struct ixgbevf_adapter *adapter = q_vector->adapter; | 290 | struct ixgbevf_adapter *adapter = q_vector->adapter; |
290 | bool is_vlan = (status & IXGBE_RXD_STAT_VP); | 291 | bool is_vlan = (status & IXGBE_RXD_STAT_VP); |
291 | u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan); | ||
292 | 292 | ||
293 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { | 293 | if (is_vlan) { |
294 | if (adapter->vlgrp && is_vlan) | 294 | u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan); |
295 | vlan_gro_receive(&q_vector->napi, | 295 | |
296 | adapter->vlgrp, | 296 | __vlan_hwaccel_put_tag(skb, tag); |
297 | tag, skb); | 297 | } |
298 | else | 298 | |
299 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) | ||
299 | napi_gro_receive(&q_vector->napi, skb); | 300 | napi_gro_receive(&q_vector->napi, skb); |
300 | } else { | 301 | else |
301 | if (adapter->vlgrp && is_vlan) | ||
302 | vlan_hwaccel_rx(skb, adapter->vlgrp, tag); | ||
303 | else | ||
304 | netif_rx(skb); | 302 | netif_rx(skb); |
305 | } | ||
306 | } | 303 | } |
307 | 304 | ||
308 | /** | 305 | /** |
@@ -1401,24 +1398,6 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter) | |||
1401 | } | 1398 | } |
1402 | } | 1399 | } |
1403 | 1400 | ||
1404 | static void ixgbevf_vlan_rx_register(struct net_device *netdev, | ||
1405 | struct vlan_group *grp) | ||
1406 | { | ||
1407 | struct ixgbevf_adapter *adapter = netdev_priv(netdev); | ||
1408 | struct ixgbe_hw *hw = &adapter->hw; | ||
1409 | int i, j; | ||
1410 | u32 ctrl; | ||
1411 | |||
1412 | adapter->vlgrp = grp; | ||
1413 | |||
1414 | for (i = 0; i < adapter->num_rx_queues; i++) { | ||
1415 | j = adapter->rx_ring[i].reg_idx; | ||
1416 | ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)); | ||
1417 | ctrl |= IXGBE_RXDCTL_VME; | ||
1418 | IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(j), ctrl); | ||
1419 | } | ||
1420 | } | ||
1421 | |||
1422 | static void ixgbevf_vlan_rx_add_vid(struct net_device *netdev, u16 vid) | 1401 | static void ixgbevf_vlan_rx_add_vid(struct net_device *netdev, u16 vid) |
1423 | { | 1402 | { |
1424 | struct ixgbevf_adapter *adapter = netdev_priv(netdev); | 1403 | struct ixgbevf_adapter *adapter = netdev_priv(netdev); |
@@ -1427,6 +1406,7 @@ static void ixgbevf_vlan_rx_add_vid(struct net_device *netdev, u16 vid) | |||
1427 | /* add VID to filter table */ | 1406 | /* add VID to filter table */ |
1428 | if (hw->mac.ops.set_vfta) | 1407 | if (hw->mac.ops.set_vfta) |
1429 | hw->mac.ops.set_vfta(hw, vid, 0, true); | 1408 | hw->mac.ops.set_vfta(hw, vid, 0, true); |
1409 | set_bit(vid, adapter->active_vlans); | ||
1430 | } | 1410 | } |
1431 | 1411 | ||
1432 | static void ixgbevf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) | 1412 | static void ixgbevf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) |
@@ -1434,31 +1414,18 @@ static void ixgbevf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) | |||
1434 | struct ixgbevf_adapter *adapter = netdev_priv(netdev); | 1414 | struct ixgbevf_adapter *adapter = netdev_priv(netdev); |
1435 | struct ixgbe_hw *hw = &adapter->hw; | 1415 | struct ixgbe_hw *hw = &adapter->hw; |
1436 | 1416 | ||
1437 | if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) | ||
1438 | ixgbevf_irq_disable(adapter); | ||
1439 | |||
1440 | vlan_group_set_device(adapter->vlgrp, vid, NULL); | ||
1441 | |||
1442 | if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) | ||
1443 | ixgbevf_irq_enable(adapter, true, true); | ||
1444 | |||
1445 | /* remove VID from filter table */ | 1417 | /* remove VID from filter table */ |
1446 | if (hw->mac.ops.set_vfta) | 1418 | if (hw->mac.ops.set_vfta) |
1447 | hw->mac.ops.set_vfta(hw, vid, 0, false); | 1419 | hw->mac.ops.set_vfta(hw, vid, 0, false); |
1420 | clear_bit(vid, adapter->active_vlans); | ||
1448 | } | 1421 | } |
1449 | 1422 | ||
1450 | static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter) | 1423 | static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter) |
1451 | { | 1424 | { |
1452 | ixgbevf_vlan_rx_register(adapter->netdev, adapter->vlgrp); | 1425 | u16 vid; |
1453 | 1426 | ||
1454 | if (adapter->vlgrp) { | 1427 | for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) |
1455 | u16 vid; | 1428 | ixgbevf_vlan_rx_add_vid(adapter->netdev, vid); |
1456 | for (vid = 0; vid < VLAN_N_VID; vid++) { | ||
1457 | if (!vlan_group_get_device(adapter->vlgrp, vid)) | ||
1458 | continue; | ||
1459 | ixgbevf_vlan_rx_add_vid(adapter->netdev, vid); | ||
1460 | } | ||
1461 | } | ||
1462 | } | 1429 | } |
1463 | 1430 | ||
1464 | static int ixgbevf_write_uc_addr_list(struct net_device *netdev) | 1431 | static int ixgbevf_write_uc_addr_list(struct net_device *netdev) |
@@ -1648,7 +1615,7 @@ static int ixgbevf_up_complete(struct ixgbevf_adapter *adapter) | |||
1648 | for (i = 0; i < num_rx_rings; i++) { | 1615 | for (i = 0; i < num_rx_rings; i++) { |
1649 | j = adapter->rx_ring[i].reg_idx; | 1616 | j = adapter->rx_ring[i].reg_idx; |
1650 | rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)); | 1617 | rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)); |
1651 | rxdctl |= IXGBE_RXDCTL_ENABLE; | 1618 | rxdctl |= IXGBE_RXDCTL_ENABLE | IXGBE_RXDCTL_VME; |
1652 | if (hw->mac.type == ixgbe_mac_X540_vf) { | 1619 | if (hw->mac.type == ixgbe_mac_X540_vf) { |
1653 | rxdctl &= ~IXGBE_RXDCTL_RLPMLMASK; | 1620 | rxdctl &= ~IXGBE_RXDCTL_RLPMLMASK; |
1654 | rxdctl |= ((netdev->mtu + ETH_HLEN + ETH_FCS_LEN) | | 1621 | rxdctl |= ((netdev->mtu + ETH_HLEN + ETH_FCS_LEN) | |
@@ -3258,7 +3225,6 @@ static const struct net_device_ops ixgbe_netdev_ops = { | |||
3258 | .ndo_set_mac_address = ixgbevf_set_mac, | 3225 | .ndo_set_mac_address = ixgbevf_set_mac, |
3259 | .ndo_change_mtu = ixgbevf_change_mtu, | 3226 | .ndo_change_mtu = ixgbevf_change_mtu, |
3260 | .ndo_tx_timeout = ixgbevf_tx_timeout, | 3227 | .ndo_tx_timeout = ixgbevf_tx_timeout, |
3261 | .ndo_vlan_rx_register = ixgbevf_vlan_rx_register, | ||
3262 | .ndo_vlan_rx_add_vid = ixgbevf_vlan_rx_add_vid, | 3228 | .ndo_vlan_rx_add_vid = ixgbevf_vlan_rx_add_vid, |
3263 | .ndo_vlan_rx_kill_vid = ixgbevf_vlan_rx_kill_vid, | 3229 | .ndo_vlan_rx_kill_vid = ixgbevf_vlan_rx_kill_vid, |
3264 | }; | 3230 | }; |