aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-05-16 22:17:37 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-16 22:17:37 -0400
commit028940342a906db8da014a7603a0deddc2c323dd (patch)
tree688dbc38a3e218f2493d311b1d70a67668837347 /net/core
parentbe3eed2e96340d3c7a4d1ea1d63e7bd6095d1e34 (diff)
parent0e93b4b304ae052ba1bc73f6d34a68556fe93429 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c36
-rw-r--r--net/core/pktgen.c10
2 files changed, 13 insertions, 33 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 66cae6e975d9..33684b6e95e2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1616,10 +1616,14 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1616 return NET_RX_DROP; 1616 return NET_RX_DROP;
1617 } 1617 }
1618 skb->skb_iif = 0; 1618 skb->skb_iif = 0;
1619 skb_set_dev(skb, dev); 1619 skb->dev = dev;
1620 skb_dst_drop(skb);
1620 skb->tstamp.tv64 = 0; 1621 skb->tstamp.tv64 = 0;
1621 skb->pkt_type = PACKET_HOST; 1622 skb->pkt_type = PACKET_HOST;
1622 skb->protocol = eth_type_trans(skb, dev); 1623 skb->protocol = eth_type_trans(skb, dev);
1624 skb->mark = 0;
1625 secpath_reset(skb);
1626 nf_reset(skb);
1623 return netif_rx(skb); 1627 return netif_rx(skb);
1624} 1628}
1625EXPORT_SYMBOL_GPL(dev_forward_skb); 1629EXPORT_SYMBOL_GPL(dev_forward_skb);
@@ -1867,36 +1871,6 @@ void netif_device_attach(struct net_device *dev)
1867} 1871}
1868EXPORT_SYMBOL(netif_device_attach); 1872EXPORT_SYMBOL(netif_device_attach);
1869 1873
1870/**
1871 * skb_dev_set -- assign a new device to a buffer
1872 * @skb: buffer for the new device
1873 * @dev: network device
1874 *
1875 * If an skb is owned by a device already, we have to reset
1876 * all data private to the namespace a device belongs to
1877 * before assigning it a new device.
1878 */
1879#ifdef CONFIG_NET_NS
1880void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
1881{
1882 skb_dst_drop(skb);
1883 if (skb->dev && !net_eq(dev_net(skb->dev), dev_net(dev))) {
1884 secpath_reset(skb);
1885 nf_reset(skb);
1886 skb_init_secmark(skb);
1887 skb->mark = 0;
1888 skb->priority = 0;
1889 skb->nf_trace = 0;
1890 skb->ipvs_property = 0;
1891#ifdef CONFIG_NET_SCHED
1892 skb->tc_index = 0;
1893#endif
1894 }
1895 skb->dev = dev;
1896}
1897EXPORT_SYMBOL(skb_set_dev);
1898#endif /* CONFIG_NET_NS */
1899
1900static void skb_warn_bad_offload(const struct sk_buff *skb) 1874static void skb_warn_bad_offload(const struct sk_buff *skb)
1901{ 1875{
1902 static const netdev_features_t null_features = 0; 1876 static const netdev_features_t null_features = 0;
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 33912573959d..70236db0fb4f 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1931,7 +1931,7 @@ static int pktgen_device_event(struct notifier_block *unused,
1931{ 1931{
1932 struct net_device *dev = ptr; 1932 struct net_device *dev = ptr;
1933 1933
1934 if (!net_eq(dev_net(dev), &init_net)) 1934 if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting)
1935 return NOTIFY_DONE; 1935 return NOTIFY_DONE;
1936 1936
1937 /* It is OK that we do not hold the group lock right now, 1937 /* It is OK that we do not hold the group lock right now,
@@ -3754,12 +3754,18 @@ static void __exit pg_cleanup(void)
3754{ 3754{
3755 struct pktgen_thread *t; 3755 struct pktgen_thread *t;
3756 struct list_head *q, *n; 3756 struct list_head *q, *n;
3757 struct list_head list;
3757 3758
3758 /* Stop all interfaces & threads */ 3759 /* Stop all interfaces & threads */
3759 pktgen_exiting = true; 3760 pktgen_exiting = true;
3760 3761
3761 list_for_each_safe(q, n, &pktgen_threads) { 3762 mutex_lock(&pktgen_thread_lock);
3763 list_splice(&list, &pktgen_threads);
3764 mutex_unlock(&pktgen_thread_lock);
3765
3766 list_for_each_safe(q, n, &list) {
3762 t = list_entry(q, struct pktgen_thread, th_list); 3767 t = list_entry(q, struct pktgen_thread, th_list);
3768 list_del(&t->th_list);
3763 kthread_stop(t->tsk); 3769 kthread_stop(t->tsk);
3764 kfree(t); 3770 kfree(t);
3765 } 3771 }