aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macvlan.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-20 16:43:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-20 16:43:21 -0400
commit06f4e926d256d902dd9a53dcb400fd74974ce087 (patch)
tree0b438b67f5f0eff6fd617bc497a9dace6164a488 /drivers/net/macvlan.c
parent8e7bfcbab3825d1b404d615cb1b54f44ff81f981 (diff)
parentd93515611bbc70c2fe4db232e5feb448ed8e4cc9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1446 commits) macvlan: fix panic if lowerdev in a bond tg3: Add braces around 5906 workaround. tg3: Fix NETIF_F_LOOPBACK error macvlan: remove one synchronize_rcu() call networking: NET_CLS_ROUTE4 depends on INET irda: Fix error propagation in ircomm_lmp_connect_response() irda: Kill set but unused variable 'bytes' in irlan_check_command_param() irda: Kill set but unused variable 'clen' in ircomm_connect_indication() rxrpc: Fix set but unused variable 'usage' in rxrpc_get_transport() be2net: Kill set but unused variable 'req' in lancer_fw_download() irda: Kill set but unused vars 'saddr' and 'daddr' in irlan_provider_connect_indication() atl1c: atl1c_resume() is only used when CONFIG_PM_SLEEP is defined. rxrpc: Fix set but unused variable 'usage' in rxrpc_get_peer(). rxrpc: Kill set but unused variable 'local' in rxrpc_UDP_error_handler() rxrpc: Kill set but unused variable 'sp' in rxrpc_process_connection() rxrpc: Kill set but unused variable 'sp' in rxrpc_rotate_tx_window() pkt_sched: Kill set but unused variable 'protocol' in tc_classify() isdn: capi: Use pr_debug() instead of ifdefs. tg3: Update version to 3.119 tg3: Apply rx_discards fix to 5719/5720 ... Fix up trivial conflicts in arch/x86/Kconfig and net/mac80211/agg-tx.c as per Davem.
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r--drivers/net/macvlan.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index d8e4e69ad0b9..d72a70615c0f 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -70,16 +70,17 @@ static void macvlan_hash_add(struct macvlan_dev *vlan)
70 hlist_add_head_rcu(&vlan->hlist, &port->vlan_hash[addr[5]]); 70 hlist_add_head_rcu(&vlan->hlist, &port->vlan_hash[addr[5]]);
71} 71}
72 72
73static void macvlan_hash_del(struct macvlan_dev *vlan) 73static void macvlan_hash_del(struct macvlan_dev *vlan, bool sync)
74{ 74{
75 hlist_del_rcu(&vlan->hlist); 75 hlist_del_rcu(&vlan->hlist);
76 synchronize_rcu(); 76 if (sync)
77 synchronize_rcu();
77} 78}
78 79
79static void macvlan_hash_change_addr(struct macvlan_dev *vlan, 80static void macvlan_hash_change_addr(struct macvlan_dev *vlan,
80 const unsigned char *addr) 81 const unsigned char *addr)
81{ 82{
82 macvlan_hash_del(vlan); 83 macvlan_hash_del(vlan, true);
83 /* Now that we are unhashed it is safe to change the device 84 /* Now that we are unhashed it is safe to change the device
84 * address without confusing packet delivery. 85 * address without confusing packet delivery.
85 */ 86 */
@@ -345,7 +346,7 @@ static int macvlan_stop(struct net_device *dev)
345 dev_uc_del(lowerdev, dev->dev_addr); 346 dev_uc_del(lowerdev, dev->dev_addr);
346 347
347hash_del: 348hash_del:
348 macvlan_hash_del(vlan); 349 macvlan_hash_del(vlan, !dev->dismantle);
349 return 0; 350 return 0;
350} 351}
351 352
@@ -415,7 +416,7 @@ static struct lock_class_key macvlan_netdev_addr_lock_key;
415#define MACVLAN_FEATURES \ 416#define MACVLAN_FEATURES \
416 (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ 417 (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
417 NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ 418 NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \
418 NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO) 419 NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM)
419 420
420#define MACVLAN_STATE_MASK \ 421#define MACVLAN_STATE_MASK \
421 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT)) 422 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
@@ -517,12 +518,6 @@ static void macvlan_ethtool_get_drvinfo(struct net_device *dev,
517 snprintf(drvinfo->version, 32, "0.1"); 518 snprintf(drvinfo->version, 32, "0.1");
518} 519}
519 520
520static u32 macvlan_ethtool_get_rx_csum(struct net_device *dev)
521{
522 const struct macvlan_dev *vlan = netdev_priv(dev);
523 return dev_ethtool_get_rx_csum(vlan->lowerdev);
524}
525
526static int macvlan_ethtool_get_settings(struct net_device *dev, 521static int macvlan_ethtool_get_settings(struct net_device *dev,
527 struct ethtool_cmd *cmd) 522 struct ethtool_cmd *cmd)
528{ 523{
@@ -530,18 +525,10 @@ static int macvlan_ethtool_get_settings(struct net_device *dev,
530 return dev_ethtool_get_settings(vlan->lowerdev, cmd); 525 return dev_ethtool_get_settings(vlan->lowerdev, cmd);
531} 526}
532 527
533static u32 macvlan_ethtool_get_flags(struct net_device *dev)
534{
535 const struct macvlan_dev *vlan = netdev_priv(dev);
536 return dev_ethtool_get_flags(vlan->lowerdev);
537}
538
539static const struct ethtool_ops macvlan_ethtool_ops = { 528static const struct ethtool_ops macvlan_ethtool_ops = {
540 .get_link = ethtool_op_get_link, 529 .get_link = ethtool_op_get_link,
541 .get_settings = macvlan_ethtool_get_settings, 530 .get_settings = macvlan_ethtool_get_settings,
542 .get_rx_csum = macvlan_ethtool_get_rx_csum,
543 .get_drvinfo = macvlan_ethtool_get_drvinfo, 531 .get_drvinfo = macvlan_ethtool_get_drvinfo,
544 .get_flags = macvlan_ethtool_get_flags,
545}; 532};
546 533
547static const struct net_device_ops macvlan_netdev_ops = { 534static const struct net_device_ops macvlan_netdev_ops = {
@@ -598,8 +585,8 @@ static int macvlan_port_create(struct net_device *dev)
598 err = netdev_rx_handler_register(dev, macvlan_handle_frame, port); 585 err = netdev_rx_handler_register(dev, macvlan_handle_frame, port);
599 if (err) 586 if (err)
600 kfree(port); 587 kfree(port);
601 588 else
602 dev->priv_flags |= IFF_MACVLAN_PORT; 589 dev->priv_flags |= IFF_MACVLAN_PORT;
603 return err; 590 return err;
604} 591}
605 592
@@ -791,6 +778,7 @@ static int macvlan_device_event(struct notifier_block *unused,
791 struct net_device *dev = ptr; 778 struct net_device *dev = ptr;
792 struct macvlan_dev *vlan, *next; 779 struct macvlan_dev *vlan, *next;
793 struct macvlan_port *port; 780 struct macvlan_port *port;
781 LIST_HEAD(list_kill);
794 782
795 if (!macvlan_port_exists(dev)) 783 if (!macvlan_port_exists(dev))
796 return NOTIFY_DONE; 784 return NOTIFY_DONE;
@@ -816,7 +804,9 @@ static int macvlan_device_event(struct notifier_block *unused,
816 break; 804 break;
817 805
818 list_for_each_entry_safe(vlan, next, &port->vlans, list) 806 list_for_each_entry_safe(vlan, next, &port->vlans, list)
819 vlan->dev->rtnl_link_ops->dellink(vlan->dev, NULL); 807 vlan->dev->rtnl_link_ops->dellink(vlan->dev, &list_kill);
808 unregister_netdevice_many(&list_kill);
809 list_del(&list_kill);
820 break; 810 break;
821 case NETDEV_PRE_TYPE_CHANGE: 811 case NETDEV_PRE_TYPE_CHANGE:
822 /* Forbid underlaying device to change its type. */ 812 /* Forbid underlaying device to change its type. */