Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Pirko and committed by
David S. Miller
dadcd65f 6dacaddd

+19 -53
+3 -3
drivers/net/ixgbevf/ixgbevf.h
··· 29 29 #define _IXGBEVF_H_ 30 30 31 31 #include <linux/types.h> 32 + #include <linux/bitops.h> 32 33 #include <linux/timer.h> 33 34 #include <linux/io.h> 34 35 #include <linux/netdevice.h> 36 + #include <linux/if_vlan.h> 35 37 36 38 #include "vf.h" 37 39 ··· 187 185 /* board specific private data structure */ 188 186 struct ixgbevf_adapter { 189 187 struct timer_list watchdog_timer; 190 - #ifdef NETIF_F_HW_VLAN_TX 191 - struct vlan_group *vlgrp; 192 - #endif 188 + unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 193 189 u16 bd_number; 194 190 struct work_struct reset_task; 195 191 struct ixgbevf_q_vector *q_vector[MAX_MSIX_Q_VECTORS];
+16 -50
drivers/net/ixgbevf/ixgbevf_main.c
··· 30 30 Copyright (c)2006 - 2007 Myricom, Inc. for some LRO specific code 31 31 ******************************************************************************/ 32 32 #include <linux/types.h> 33 + #include <linux/bitops.h> 33 34 #include <linux/module.h> 34 35 #include <linux/pci.h> 35 36 #include <linux/netdevice.h> ··· 289 288 { 290 289 struct ixgbevf_adapter *adapter = q_vector->adapter; 291 290 bool is_vlan = (status & IXGBE_RXD_STAT_VP); 292 - u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan); 293 291 294 - if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { 295 - if (adapter->vlgrp && is_vlan) 296 - vlan_gro_receive(&q_vector->napi, 297 - adapter->vlgrp, 298 - tag, skb); 299 - else 300 - napi_gro_receive(&q_vector->napi, skb); 301 - } else { 302 - if (adapter->vlgrp && is_vlan) 303 - vlan_hwaccel_rx(skb, adapter->vlgrp, tag); 304 - else 305 - netif_rx(skb); 292 + if (is_vlan) { 293 + u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan); 294 + 295 + __vlan_hwaccel_put_tag(skb, tag); 306 296 } 297 + 298 + if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) 299 + napi_gro_receive(&q_vector->napi, skb); 300 + else 301 + netif_rx(skb); 307 302 } 308 303 309 304 /** ··· 1398 1401 } 1399 1402 } 1400 1403 1401 - static void ixgbevf_vlan_rx_register(struct net_device *netdev, 1402 - struct vlan_group *grp) 1403 - { 1404 - struct ixgbevf_adapter *adapter = netdev_priv(netdev); 1405 - struct ixgbe_hw *hw = &adapter->hw; 1406 - int i, j; 1407 - u32 ctrl; 1408 - 1409 - adapter->vlgrp = grp; 1410 - 1411 - for (i = 0; i < adapter->num_rx_queues; i++) { 1412 - j = adapter->rx_ring[i].reg_idx; 1413 - ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)); 1414 - ctrl |= IXGBE_RXDCTL_VME; 1415 - IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(j), ctrl); 1416 - } 1417 - } 1418 - 1419 1404 static void ixgbevf_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 1420 1405 { 1421 1406 struct ixgbevf_adapter *adapter = netdev_priv(netdev); ··· 1406 1427 /* add VID to filter table */ 1407 1428 if (hw->mac.ops.set_vfta) 1408 1429 hw->mac.ops.set_vfta(hw, vid, 0, true); 1430 + set_bit(vid, adapter->active_vlans); 1409 1431 } 1410 1432 1411 1433 static void ixgbevf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) ··· 1414 1434 struct ixgbevf_adapter *adapter = netdev_priv(netdev); 1415 1435 struct ixgbe_hw *hw = &adapter->hw; 1416 1436 1417 - if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) 1418 - ixgbevf_irq_disable(adapter); 1419 - 1420 - vlan_group_set_device(adapter->vlgrp, vid, NULL); 1421 - 1422 - if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) 1423 - ixgbevf_irq_enable(adapter, true, true); 1424 - 1425 1437 /* remove VID from filter table */ 1426 1438 if (hw->mac.ops.set_vfta) 1427 1439 hw->mac.ops.set_vfta(hw, vid, 0, false); 1440 + clear_bit(vid, adapter->active_vlans); 1428 1441 } 1429 1442 1430 1443 static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter) 1431 1444 { 1432 - ixgbevf_vlan_rx_register(adapter->netdev, adapter->vlgrp); 1445 + u16 vid; 1433 1446 1434 - if (adapter->vlgrp) { 1435 - u16 vid; 1436 - for (vid = 0; vid < VLAN_N_VID; vid++) { 1437 - if (!vlan_group_get_device(adapter->vlgrp, vid)) 1438 - continue; 1439 - ixgbevf_vlan_rx_add_vid(adapter->netdev, vid); 1440 - } 1441 - } 1447 + for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) 1448 + ixgbevf_vlan_rx_add_vid(adapter->netdev, vid); 1442 1449 } 1443 1450 1444 1451 static int ixgbevf_write_uc_addr_list(struct net_device *netdev) ··· 1615 1648 for (i = 0; i < num_rx_rings; i++) { 1616 1649 j = adapter->rx_ring[i].reg_idx; 1617 1650 rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(j)); 1618 - rxdctl |= IXGBE_RXDCTL_ENABLE; 1651 + rxdctl |= IXGBE_RXDCTL_ENABLE | IXGBE_RXDCTL_VME; 1619 1652 if (hw->mac.type == ixgbe_mac_X540_vf) { 1620 1653 rxdctl &= ~IXGBE_RXDCTL_RLPMLMASK; 1621 1654 rxdctl |= ((netdev->mtu + ETH_HLEN + ETH_FCS_LEN) | ··· 3225 3258 .ndo_set_mac_address = ixgbevf_set_mac, 3226 3259 .ndo_change_mtu = ixgbevf_change_mtu, 3227 3260 .ndo_tx_timeout = ixgbevf_tx_timeout, 3228 - .ndo_vlan_rx_register = ixgbevf_vlan_rx_register, 3229 3261 .ndo_vlan_rx_add_vid = ixgbevf_vlan_rx_add_vid, 3230 3262 .ndo_vlan_rx_kill_vid = ixgbevf_vlan_rx_kill_vid, 3231 3263 };