diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-09 10:14:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-09 10:14:44 -0500 |
commit | e304dfdb030bab29888151021843bd9e1743a535 (patch) | |
tree | d1121401bd89a13585584e6baf2197fbfefc8356 | |
parent | 9f8050c4f99789d03ca96d4e625bd6637241828f (diff) | |
parent | d31b20fcc89efa8c5d3f5ea2720e08a286b69a36 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking from David Miller:
1) IPV4 routing metrics can become stale when routes are changed by the
administrator, fix from Steffen Klassert.
2) atl1c does "val |= XXX;" where XXX is a bit number not a bit mask,
fix by using set_bit. From Dan Carpenter.
3) Memory accounting bug in carl9170 driver results in wedged TX queue.
Fix from Nicolas Cavallari.
4) iwlwifi accidently uses "sizeof(ptr)" instead of "sizeof(*ptr)", fix
from Johannes Berg.
5) Openvswitch doesn't honor dp_ifindex when doing vport lookups, fix
from Ben Pfaff.
6) ehea conversion to 64-bit stats lost multicast and rx_errors
accounting, fix from Eric Dumazet.
7) Bridge state transition logging in br_stp_disable_port() is busted,
it's emitted at the wrong time and the message is in the wrong tense,
fix from Paulius Zaleckas.
8) mlx4 device erroneously invokes the queue resize firmware operation
twice, fix from Jack Morgenstein.
9) Fix deadlock in usbnet, need to drop lock when invoking usb_unlink_urb()
otherwise we recurse into taking it again. Fix from Sebastian Siewior.
10) hyperv network driver uses the wrong driver name string, fix from
Haiyang Zhang.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
net/hyperv: Use the built-in macro KBUILD_MODNAME for this driver
net/usbnet: avoid recursive locking in usbnet_stop()
route: Remove redirect_genid
inetpeer: Invalidate the inetpeer tree along with the routing cache
mlx4_core: fix bug in modify_cq wrapper for resize flow.
atl1c: set ATL1C_WORK_EVENT_RESET bit correctly
bridge: fix state reporting when port is disabled
bridge: br_log_state() s/entering/entered/
ehea: restore multicast and rx_errors fields
openvswitch: Fix checksum update for actions on UDP packets.
openvswitch: Honor dp_ifindex, when specified, for vport lookup by name.
iwlwifi: fix wowlan suspend
mwifiex: reset encryption mode flag before association
carl9170: fix frame delivery if sta is in powersave mode
carl9170: Fix memory accounting when sta is in power-save mode.
-rw-r--r-- | drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/ibm/ehea/ehea_main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 3 | ||||
-rw-r--r-- | drivers/net/hyperv/netvsc_drv.c | 4 | ||||
-rw-r--r-- | drivers/net/usb/usbnet.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/carl9170/tx.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 1 | ||||
-rw-r--r-- | include/net/inetpeer.h | 4 | ||||
-rw-r--r-- | net/bridge/br_stp.c | 2 | ||||
-rw-r--r-- | net/bridge/br_stp_if.c | 3 | ||||
-rw-r--r-- | net/ipv4/inetpeer.c | 81 | ||||
-rw-r--r-- | net/ipv4/route.c | 12 | ||||
-rw-r--r-- | net/openvswitch/actions.c | 44 | ||||
-rw-r--r-- | net/openvswitch/datapath.c | 3 |
15 files changed, 139 insertions, 37 deletions
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 1ff3c6df35a2..47a9bb2c813c 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
@@ -1710,7 +1710,7 @@ static irqreturn_t atl1c_intr(int irq, void *data) | |||
1710 | "atl1c hardware error (status = 0x%x)\n", | 1710 | "atl1c hardware error (status = 0x%x)\n", |
1711 | status & ISR_ERROR); | 1711 | status & ISR_ERROR); |
1712 | /* reset MAC */ | 1712 | /* reset MAC */ |
1713 | adapter->work_event |= ATL1C_WORK_EVENT_RESET; | 1713 | set_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event); |
1714 | schedule_work(&adapter->common_task); | 1714 | schedule_work(&adapter->common_task); |
1715 | return IRQ_HANDLED; | 1715 | return IRQ_HANDLED; |
1716 | } | 1716 | } |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 5d5fb2627184..e6893cdfd13b 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
@@ -336,7 +336,9 @@ static struct rtnl_link_stats64 *ehea_get_stats64(struct net_device *dev, | |||
336 | stats->tx_bytes = tx_bytes; | 336 | stats->tx_bytes = tx_bytes; |
337 | stats->rx_packets = rx_packets; | 337 | stats->rx_packets = rx_packets; |
338 | 338 | ||
339 | return &port->stats; | 339 | stats->multicast = port->stats.multicast; |
340 | stats->rx_errors = port->stats.rx_errors; | ||
341 | return stats; | ||
340 | } | 342 | } |
341 | 343 | ||
342 | static void ehea_update_stats(struct work_struct *work) | 344 | static void ehea_update_stats(struct work_struct *work) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index bfdb7af19e49..8752e6e08169 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -2255,8 +2255,7 @@ int mlx4_MODIFY_CQ_wrapper(struct mlx4_dev *dev, int slave, | |||
2255 | 2255 | ||
2256 | if (vhcr->op_modifier == 0) { | 2256 | if (vhcr->op_modifier == 0) { |
2257 | err = handle_resize(dev, slave, vhcr, inbox, outbox, cmd, cq); | 2257 | err = handle_resize(dev, slave, vhcr, inbox, outbox, cmd, cq); |
2258 | if (err) | 2258 | goto ex_put; |
2259 | goto ex_put; | ||
2260 | } | 2259 | } |
2261 | 2260 | ||
2262 | err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); | 2261 | err = mlx4_DMA_wrapper(dev, slave, vhcr, inbox, outbox, cmd); |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 466c58a7353d..bf01841bda5b 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -313,7 +313,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, | |||
313 | static void netvsc_get_drvinfo(struct net_device *net, | 313 | static void netvsc_get_drvinfo(struct net_device *net, |
314 | struct ethtool_drvinfo *info) | 314 | struct ethtool_drvinfo *info) |
315 | { | 315 | { |
316 | strcpy(info->driver, "hv_netvsc"); | 316 | strcpy(info->driver, KBUILD_MODNAME); |
317 | strcpy(info->version, HV_DRV_VERSION); | 317 | strcpy(info->version, HV_DRV_VERSION); |
318 | strcpy(info->fw_version, "N/A"); | 318 | strcpy(info->fw_version, "N/A"); |
319 | } | 319 | } |
@@ -485,7 +485,7 @@ MODULE_DEVICE_TABLE(vmbus, id_table); | |||
485 | 485 | ||
486 | /* The one and only one */ | 486 | /* The one and only one */ |
487 | static struct hv_driver netvsc_drv = { | 487 | static struct hv_driver netvsc_drv = { |
488 | .name = "netvsc", | 488 | .name = KBUILD_MODNAME, |
489 | .id_table = id_table, | 489 | .id_table = id_table, |
490 | .probe = netvsc_probe, | 490 | .probe = netvsc_probe, |
491 | .remove = netvsc_remove, | 491 | .remove = netvsc_remove, |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index fae0fbd8bc88..81b96e303757 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -589,6 +589,7 @@ static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) | |||
589 | entry = (struct skb_data *) skb->cb; | 589 | entry = (struct skb_data *) skb->cb; |
590 | urb = entry->urb; | 590 | urb = entry->urb; |
591 | 591 | ||
592 | spin_unlock_irqrestore(&q->lock, flags); | ||
592 | // during some PM-driven resume scenarios, | 593 | // during some PM-driven resume scenarios, |
593 | // these (async) unlinks complete immediately | 594 | // these (async) unlinks complete immediately |
594 | retval = usb_unlink_urb (urb); | 595 | retval = usb_unlink_urb (urb); |
@@ -596,6 +597,7 @@ static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) | |||
596 | netdev_dbg(dev->net, "unlink urb err, %d\n", retval); | 597 | netdev_dbg(dev->net, "unlink urb err, %d\n", retval); |
597 | else | 598 | else |
598 | count++; | 599 | count++; |
600 | spin_lock_irqsave(&q->lock, flags); | ||
599 | } | 601 | } |
600 | spin_unlock_irqrestore (&q->lock, flags); | 602 | spin_unlock_irqrestore (&q->lock, flags); |
601 | return count; | 603 | return count; |
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c index d19a9ee9d057..bbc813dee983 100644 --- a/drivers/net/wireless/ath/carl9170/tx.c +++ b/drivers/net/wireless/ath/carl9170/tx.c | |||
@@ -1234,6 +1234,7 @@ static bool carl9170_tx_ps_drop(struct ar9170 *ar, struct sk_buff *skb) | |||
1234 | { | 1234 | { |
1235 | struct ieee80211_sta *sta; | 1235 | struct ieee80211_sta *sta; |
1236 | struct carl9170_sta_info *sta_info; | 1236 | struct carl9170_sta_info *sta_info; |
1237 | struct ieee80211_tx_info *tx_info; | ||
1237 | 1238 | ||
1238 | rcu_read_lock(); | 1239 | rcu_read_lock(); |
1239 | sta = __carl9170_get_tx_sta(ar, skb); | 1240 | sta = __carl9170_get_tx_sta(ar, skb); |
@@ -1241,16 +1242,18 @@ static bool carl9170_tx_ps_drop(struct ar9170 *ar, struct sk_buff *skb) | |||
1241 | goto out_rcu; | 1242 | goto out_rcu; |
1242 | 1243 | ||
1243 | sta_info = (void *) sta->drv_priv; | 1244 | sta_info = (void *) sta->drv_priv; |
1244 | if (unlikely(sta_info->sleeping)) { | 1245 | tx_info = IEEE80211_SKB_CB(skb); |
1245 | struct ieee80211_tx_info *tx_info; | ||
1246 | 1246 | ||
1247 | if (unlikely(sta_info->sleeping) && | ||
1248 | !(tx_info->flags & (IEEE80211_TX_CTL_POLL_RESPONSE | | ||
1249 | IEEE80211_TX_CTL_CLEAR_PS_FILT))) { | ||
1247 | rcu_read_unlock(); | 1250 | rcu_read_unlock(); |
1248 | 1251 | ||
1249 | tx_info = IEEE80211_SKB_CB(skb); | ||
1250 | if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) | 1252 | if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) |
1251 | atomic_dec(&ar->tx_ampdu_upload); | 1253 | atomic_dec(&ar->tx_ampdu_upload); |
1252 | 1254 | ||
1253 | tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | 1255 | tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; |
1256 | carl9170_release_dev_space(ar, skb); | ||
1254 | carl9170_tx_status(ar, skb, false); | 1257 | carl9170_tx_status(ar, skb, false); |
1255 | return true; | 1258 | return true; |
1256 | } | 1259 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 64cf439035c3..ca78e91de86c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -1240,7 +1240,7 @@ int iwlagn_suspend(struct iwl_priv *priv, | |||
1240 | .flags = CMD_SYNC, | 1240 | .flags = CMD_SYNC, |
1241 | .data[0] = key_data.rsc_tsc, | 1241 | .data[0] = key_data.rsc_tsc, |
1242 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, | 1242 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
1243 | .len[0] = sizeof(key_data.rsc_tsc), | 1243 | .len[0] = sizeof(*key_data.rsc_tsc), |
1244 | }; | 1244 | }; |
1245 | 1245 | ||
1246 | ret = iwl_trans_send_cmd(trans(priv), &rsc_tsc_cmd); | 1246 | ret = iwl_trans_send_cmd(trans(priv), &rsc_tsc_cmd); |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 5b2972b43b0e..2210a0f9af2d 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -846,6 +846,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
846 | priv->sec_info.wpa_enabled = false; | 846 | priv->sec_info.wpa_enabled = false; |
847 | priv->sec_info.wpa2_enabled = false; | 847 | priv->sec_info.wpa2_enabled = false; |
848 | priv->wep_key_curr_index = 0; | 848 | priv->wep_key_curr_index = 0; |
849 | priv->sec_info.encryption_mode = 0; | ||
849 | ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); | 850 | ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); |
850 | 851 | ||
851 | if (mode == NL80211_IFTYPE_ADHOC) { | 852 | if (mode == NL80211_IFTYPE_ADHOC) { |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 06b795dd5906..b94765e38e80 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -35,12 +35,12 @@ struct inet_peer { | |||
35 | 35 | ||
36 | u32 metrics[RTAX_MAX]; | 36 | u32 metrics[RTAX_MAX]; |
37 | u32 rate_tokens; /* rate limiting for ICMP */ | 37 | u32 rate_tokens; /* rate limiting for ICMP */ |
38 | int redirect_genid; | ||
39 | unsigned long rate_last; | 38 | unsigned long rate_last; |
40 | unsigned long pmtu_expires; | 39 | unsigned long pmtu_expires; |
41 | u32 pmtu_orig; | 40 | u32 pmtu_orig; |
42 | u32 pmtu_learned; | 41 | u32 pmtu_learned; |
43 | struct inetpeer_addr_base redirect_learned; | 42 | struct inetpeer_addr_base redirect_learned; |
43 | struct list_head gc_list; | ||
44 | /* | 44 | /* |
45 | * Once inet_peer is queued for deletion (refcnt == -1), following fields | 45 | * Once inet_peer is queued for deletion (refcnt == -1), following fields |
46 | * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp | 46 | * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp |
@@ -96,6 +96,8 @@ static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, | |||
96 | extern void inet_putpeer(struct inet_peer *p); | 96 | extern void inet_putpeer(struct inet_peer *p); |
97 | extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); | 97 | extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); |
98 | 98 | ||
99 | extern void inetpeer_invalidate_tree(int family); | ||
100 | |||
99 | /* | 101 | /* |
100 | * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, | 102 | * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, |
101 | * tcp_ts_stamp if no refcount is taken on inet_peer | 103 | * tcp_ts_stamp if no refcount is taken on inet_peer |
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index 6751ed4e0c07..8c836d96ba76 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c | |||
@@ -31,7 +31,7 @@ static const char *const br_port_state_names[] = { | |||
31 | 31 | ||
32 | void br_log_state(const struct net_bridge_port *p) | 32 | void br_log_state(const struct net_bridge_port *p) |
33 | { | 33 | { |
34 | br_info(p->br, "port %u(%s) entering %s state\n", | 34 | br_info(p->br, "port %u(%s) entered %s state\n", |
35 | (unsigned) p->port_no, p->dev->name, | 35 | (unsigned) p->port_no, p->dev->name, |
36 | br_port_state_names[p->state]); | 36 | br_port_state_names[p->state]); |
37 | } | 37 | } |
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c index 19308e305d85..f494496373d6 100644 --- a/net/bridge/br_stp_if.c +++ b/net/bridge/br_stp_if.c | |||
@@ -98,14 +98,13 @@ void br_stp_disable_port(struct net_bridge_port *p) | |||
98 | struct net_bridge *br = p->br; | 98 | struct net_bridge *br = p->br; |
99 | int wasroot; | 99 | int wasroot; |
100 | 100 | ||
101 | br_log_state(p); | ||
102 | |||
103 | wasroot = br_is_root_bridge(br); | 101 | wasroot = br_is_root_bridge(br); |
104 | br_become_designated_port(p); | 102 | br_become_designated_port(p); |
105 | p->state = BR_STATE_DISABLED; | 103 | p->state = BR_STATE_DISABLED; |
106 | p->topology_change_ack = 0; | 104 | p->topology_change_ack = 0; |
107 | p->config_pending = 0; | 105 | p->config_pending = 0; |
108 | 106 | ||
107 | br_log_state(p); | ||
109 | br_ifinfo_notify(RTM_NEWLINK, p); | 108 | br_ifinfo_notify(RTM_NEWLINK, p); |
110 | 109 | ||
111 | del_timer(&p->message_age_timer); | 110 | del_timer(&p->message_age_timer); |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index bf4a9c4808e1..d4d61b694fab 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/net.h> | 19 | #include <linux/net.h> |
20 | #include <linux/workqueue.h> | ||
20 | #include <net/ip.h> | 21 | #include <net/ip.h> |
21 | #include <net/inetpeer.h> | 22 | #include <net/inetpeer.h> |
22 | #include <net/secure_seq.h> | 23 | #include <net/secure_seq.h> |
@@ -66,6 +67,11 @@ | |||
66 | 67 | ||
67 | static struct kmem_cache *peer_cachep __read_mostly; | 68 | static struct kmem_cache *peer_cachep __read_mostly; |
68 | 69 | ||
70 | static LIST_HEAD(gc_list); | ||
71 | static const int gc_delay = 60 * HZ; | ||
72 | static struct delayed_work gc_work; | ||
73 | static DEFINE_SPINLOCK(gc_lock); | ||
74 | |||
69 | #define node_height(x) x->avl_height | 75 | #define node_height(x) x->avl_height |
70 | 76 | ||
71 | #define peer_avl_empty ((struct inet_peer *)&peer_fake_node) | 77 | #define peer_avl_empty ((struct inet_peer *)&peer_fake_node) |
@@ -102,6 +108,50 @@ int inet_peer_threshold __read_mostly = 65536 + 128; /* start to throw entries m | |||
102 | int inet_peer_minttl __read_mostly = 120 * HZ; /* TTL under high load: 120 sec */ | 108 | int inet_peer_minttl __read_mostly = 120 * HZ; /* TTL under high load: 120 sec */ |
103 | int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min */ | 109 | int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min */ |
104 | 110 | ||
111 | static void inetpeer_gc_worker(struct work_struct *work) | ||
112 | { | ||
113 | struct inet_peer *p, *n; | ||
114 | LIST_HEAD(list); | ||
115 | |||
116 | spin_lock_bh(&gc_lock); | ||
117 | list_replace_init(&gc_list, &list); | ||
118 | spin_unlock_bh(&gc_lock); | ||
119 | |||
120 | if (list_empty(&list)) | ||
121 | return; | ||
122 | |||
123 | list_for_each_entry_safe(p, n, &list, gc_list) { | ||
124 | |||
125 | if(need_resched()) | ||
126 | cond_resched(); | ||
127 | |||
128 | if (p->avl_left != peer_avl_empty) { | ||
129 | list_add_tail(&p->avl_left->gc_list, &list); | ||
130 | p->avl_left = peer_avl_empty; | ||
131 | } | ||
132 | |||
133 | if (p->avl_right != peer_avl_empty) { | ||
134 | list_add_tail(&p->avl_right->gc_list, &list); | ||
135 | p->avl_right = peer_avl_empty; | ||
136 | } | ||
137 | |||
138 | n = list_entry(p->gc_list.next, struct inet_peer, gc_list); | ||
139 | |||
140 | if (!atomic_read(&p->refcnt)) { | ||
141 | list_del(&p->gc_list); | ||
142 | kmem_cache_free(peer_cachep, p); | ||
143 | } | ||
144 | } | ||
145 | |||
146 | if (list_empty(&list)) | ||
147 | return; | ||
148 | |||
149 | spin_lock_bh(&gc_lock); | ||
150 | list_splice(&list, &gc_list); | ||
151 | spin_unlock_bh(&gc_lock); | ||
152 | |||
153 | schedule_delayed_work(&gc_work, gc_delay); | ||
154 | } | ||
105 | 155 | ||
106 | /* Called from ip_output.c:ip_init */ | 156 | /* Called from ip_output.c:ip_init */ |
107 | void __init inet_initpeers(void) | 157 | void __init inet_initpeers(void) |
@@ -126,6 +176,7 @@ void __init inet_initpeers(void) | |||
126 | 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, | 176 | 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, |
127 | NULL); | 177 | NULL); |
128 | 178 | ||
179 | INIT_DELAYED_WORK_DEFERRABLE(&gc_work, inetpeer_gc_worker); | ||
129 | } | 180 | } |
130 | 181 | ||
131 | static int addr_compare(const struct inetpeer_addr *a, | 182 | static int addr_compare(const struct inetpeer_addr *a, |
@@ -447,9 +498,8 @@ relookup: | |||
447 | p->rate_last = 0; | 498 | p->rate_last = 0; |
448 | p->pmtu_expires = 0; | 499 | p->pmtu_expires = 0; |
449 | p->pmtu_orig = 0; | 500 | p->pmtu_orig = 0; |
450 | p->redirect_genid = 0; | ||
451 | memset(&p->redirect_learned, 0, sizeof(p->redirect_learned)); | 501 | memset(&p->redirect_learned, 0, sizeof(p->redirect_learned)); |
452 | 502 | INIT_LIST_HEAD(&p->gc_list); | |
453 | 503 | ||
454 | /* Link the node. */ | 504 | /* Link the node. */ |
455 | link_to_pool(p, base); | 505 | link_to_pool(p, base); |
@@ -509,3 +559,30 @@ bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout) | |||
509 | return rc; | 559 | return rc; |
510 | } | 560 | } |
511 | EXPORT_SYMBOL(inet_peer_xrlim_allow); | 561 | EXPORT_SYMBOL(inet_peer_xrlim_allow); |
562 | |||
563 | void inetpeer_invalidate_tree(int family) | ||
564 | { | ||
565 | struct inet_peer *old, *new, *prev; | ||
566 | struct inet_peer_base *base = family_to_base(family); | ||
567 | |||
568 | write_seqlock_bh(&base->lock); | ||
569 | |||
570 | old = base->root; | ||
571 | if (old == peer_avl_empty_rcu) | ||
572 | goto out; | ||
573 | |||
574 | new = peer_avl_empty_rcu; | ||
575 | |||
576 | prev = cmpxchg(&base->root, old, new); | ||
577 | if (prev == old) { | ||
578 | base->total = 0; | ||
579 | spin_lock(&gc_lock); | ||
580 | list_add_tail(&prev->gc_list, &gc_list); | ||
581 | spin_unlock(&gc_lock); | ||
582 | schedule_delayed_work(&gc_work, gc_delay); | ||
583 | } | ||
584 | |||
585 | out: | ||
586 | write_sequnlock_bh(&base->lock); | ||
587 | } | ||
588 | EXPORT_SYMBOL(inetpeer_invalidate_tree); | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index bcacf54e5418..019774796174 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -132,7 +132,6 @@ static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ; | |||
132 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; | 132 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; |
133 | static int ip_rt_min_advmss __read_mostly = 256; | 133 | static int ip_rt_min_advmss __read_mostly = 256; |
134 | static int rt_chain_length_max __read_mostly = 20; | 134 | static int rt_chain_length_max __read_mostly = 20; |
135 | static int redirect_genid; | ||
136 | 135 | ||
137 | static struct delayed_work expires_work; | 136 | static struct delayed_work expires_work; |
138 | static unsigned long expires_ljiffies; | 137 | static unsigned long expires_ljiffies; |
@@ -937,7 +936,7 @@ static void rt_cache_invalidate(struct net *net) | |||
937 | 936 | ||
938 | get_random_bytes(&shuffle, sizeof(shuffle)); | 937 | get_random_bytes(&shuffle, sizeof(shuffle)); |
939 | atomic_add(shuffle + 1U, &net->ipv4.rt_genid); | 938 | atomic_add(shuffle + 1U, &net->ipv4.rt_genid); |
940 | redirect_genid++; | 939 | inetpeer_invalidate_tree(AF_INET); |
941 | } | 940 | } |
942 | 941 | ||
943 | /* | 942 | /* |
@@ -1485,10 +1484,8 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1485 | 1484 | ||
1486 | peer = rt->peer; | 1485 | peer = rt->peer; |
1487 | if (peer) { | 1486 | if (peer) { |
1488 | if (peer->redirect_learned.a4 != new_gw || | 1487 | if (peer->redirect_learned.a4 != new_gw) { |
1489 | peer->redirect_genid != redirect_genid) { | ||
1490 | peer->redirect_learned.a4 = new_gw; | 1488 | peer->redirect_learned.a4 = new_gw; |
1491 | peer->redirect_genid = redirect_genid; | ||
1492 | atomic_inc(&__rt_peer_genid); | 1489 | atomic_inc(&__rt_peer_genid); |
1493 | } | 1490 | } |
1494 | check_peer_redir(&rt->dst, peer); | 1491 | check_peer_redir(&rt->dst, peer); |
@@ -1793,8 +1790,6 @@ static void ipv4_validate_peer(struct rtable *rt) | |||
1793 | if (peer) { | 1790 | if (peer) { |
1794 | check_peer_pmtu(&rt->dst, peer); | 1791 | check_peer_pmtu(&rt->dst, peer); |
1795 | 1792 | ||
1796 | if (peer->redirect_genid != redirect_genid) | ||
1797 | peer->redirect_learned.a4 = 0; | ||
1798 | if (peer->redirect_learned.a4 && | 1793 | if (peer->redirect_learned.a4 && |
1799 | peer->redirect_learned.a4 != rt->rt_gateway) | 1794 | peer->redirect_learned.a4 != rt->rt_gateway) |
1800 | check_peer_redir(&rt->dst, peer); | 1795 | check_peer_redir(&rt->dst, peer); |
@@ -1958,8 +1953,7 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4, | |||
1958 | dst_init_metrics(&rt->dst, peer->metrics, false); | 1953 | dst_init_metrics(&rt->dst, peer->metrics, false); |
1959 | 1954 | ||
1960 | check_peer_pmtu(&rt->dst, peer); | 1955 | check_peer_pmtu(&rt->dst, peer); |
1961 | if (peer->redirect_genid != redirect_genid) | 1956 | |
1962 | peer->redirect_learned.a4 = 0; | ||
1963 | if (peer->redirect_learned.a4 && | 1957 | if (peer->redirect_learned.a4 && |
1964 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1958 | peer->redirect_learned.a4 != rt->rt_gateway) { |
1965 | rt->rt_gateway = peer->redirect_learned.a4; | 1959 | rt->rt_gateway = peer->redirect_learned.a4; |
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 2725d1bdf291..48badffaafc1 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2007-2011 Nicira Networks. | 2 | * Copyright (c) 2007-2012 Nicira Networks. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of version 2 of the GNU General Public | 5 | * modify it under the terms of version 2 of the GNU General Public |
@@ -145,9 +145,16 @@ static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, | |||
145 | inet_proto_csum_replace4(&tcp_hdr(skb)->check, skb, | 145 | inet_proto_csum_replace4(&tcp_hdr(skb)->check, skb, |
146 | *addr, new_addr, 1); | 146 | *addr, new_addr, 1); |
147 | } else if (nh->protocol == IPPROTO_UDP) { | 147 | } else if (nh->protocol == IPPROTO_UDP) { |
148 | if (likely(transport_len >= sizeof(struct udphdr))) | 148 | if (likely(transport_len >= sizeof(struct udphdr))) { |
149 | inet_proto_csum_replace4(&udp_hdr(skb)->check, skb, | 149 | struct udphdr *uh = udp_hdr(skb); |
150 | *addr, new_addr, 1); | 150 | |
151 | if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) { | ||
152 | inet_proto_csum_replace4(&uh->check, skb, | ||
153 | *addr, new_addr, 1); | ||
154 | if (!uh->check) | ||
155 | uh->check = CSUM_MANGLED_0; | ||
156 | } | ||
157 | } | ||
151 | } | 158 | } |
152 | 159 | ||
153 | csum_replace4(&nh->check, *addr, new_addr); | 160 | csum_replace4(&nh->check, *addr, new_addr); |
@@ -197,8 +204,22 @@ static void set_tp_port(struct sk_buff *skb, __be16 *port, | |||
197 | skb->rxhash = 0; | 204 | skb->rxhash = 0; |
198 | } | 205 | } |
199 | 206 | ||
200 | static int set_udp_port(struct sk_buff *skb, | 207 | static void set_udp_port(struct sk_buff *skb, __be16 *port, __be16 new_port) |
201 | const struct ovs_key_udp *udp_port_key) | 208 | { |
209 | struct udphdr *uh = udp_hdr(skb); | ||
210 | |||
211 | if (uh->check && skb->ip_summed != CHECKSUM_PARTIAL) { | ||
212 | set_tp_port(skb, port, new_port, &uh->check); | ||
213 | |||
214 | if (!uh->check) | ||
215 | uh->check = CSUM_MANGLED_0; | ||
216 | } else { | ||
217 | *port = new_port; | ||
218 | skb->rxhash = 0; | ||
219 | } | ||
220 | } | ||
221 | |||
222 | static int set_udp(struct sk_buff *skb, const struct ovs_key_udp *udp_port_key) | ||
202 | { | 223 | { |
203 | struct udphdr *uh; | 224 | struct udphdr *uh; |
204 | int err; | 225 | int err; |
@@ -210,16 +231,15 @@ static int set_udp_port(struct sk_buff *skb, | |||
210 | 231 | ||
211 | uh = udp_hdr(skb); | 232 | uh = udp_hdr(skb); |
212 | if (udp_port_key->udp_src != uh->source) | 233 | if (udp_port_key->udp_src != uh->source) |
213 | set_tp_port(skb, &uh->source, udp_port_key->udp_src, &uh->check); | 234 | set_udp_port(skb, &uh->source, udp_port_key->udp_src); |
214 | 235 | ||
215 | if (udp_port_key->udp_dst != uh->dest) | 236 | if (udp_port_key->udp_dst != uh->dest) |
216 | set_tp_port(skb, &uh->dest, udp_port_key->udp_dst, &uh->check); | 237 | set_udp_port(skb, &uh->dest, udp_port_key->udp_dst); |
217 | 238 | ||
218 | return 0; | 239 | return 0; |
219 | } | 240 | } |
220 | 241 | ||
221 | static int set_tcp_port(struct sk_buff *skb, | 242 | static int set_tcp(struct sk_buff *skb, const struct ovs_key_tcp *tcp_port_key) |
222 | const struct ovs_key_tcp *tcp_port_key) | ||
223 | { | 243 | { |
224 | struct tcphdr *th; | 244 | struct tcphdr *th; |
225 | int err; | 245 | int err; |
@@ -328,11 +348,11 @@ static int execute_set_action(struct sk_buff *skb, | |||
328 | break; | 348 | break; |
329 | 349 | ||
330 | case OVS_KEY_ATTR_TCP: | 350 | case OVS_KEY_ATTR_TCP: |
331 | err = set_tcp_port(skb, nla_data(nested_attr)); | 351 | err = set_tcp(skb, nla_data(nested_attr)); |
332 | break; | 352 | break; |
333 | 353 | ||
334 | case OVS_KEY_ATTR_UDP: | 354 | case OVS_KEY_ATTR_UDP: |
335 | err = set_udp_port(skb, nla_data(nested_attr)); | 355 | err = set_udp(skb, nla_data(nested_attr)); |
336 | break; | 356 | break; |
337 | } | 357 | } |
338 | 358 | ||
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index ce64c18b8c79..2c030505b335 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -1521,6 +1521,9 @@ static struct vport *lookup_vport(struct ovs_header *ovs_header, | |||
1521 | vport = ovs_vport_locate(nla_data(a[OVS_VPORT_ATTR_NAME])); | 1521 | vport = ovs_vport_locate(nla_data(a[OVS_VPORT_ATTR_NAME])); |
1522 | if (!vport) | 1522 | if (!vport) |
1523 | return ERR_PTR(-ENODEV); | 1523 | return ERR_PTR(-ENODEV); |
1524 | if (ovs_header->dp_ifindex && | ||
1525 | ovs_header->dp_ifindex != get_dpifindex(vport->dp)) | ||
1526 | return ERR_PTR(-ENODEV); | ||
1524 | return vport; | 1527 | return vport; |
1525 | } else if (a[OVS_VPORT_ATTR_PORT_NO]) { | 1528 | } else if (a[OVS_VPORT_ATTR_PORT_NO]) { |
1526 | u32 port_no = nla_get_u32(a[OVS_VPORT_ATTR_PORT_NO]); | 1529 | u32 port_no = nla_get_u32(a[OVS_VPORT_ATTR_PORT_NO]); |