diff options
author | David S. Miller <davem@davemloft.net> | 2014-05-24 00:32:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-24 00:32:30 -0400 |
commit | 54e5c4def0614ab540fbdf68e45342a4af141702 (patch) | |
tree | 95a2f61c72336932e83d9e4180cd9739106d624b /drivers/net/bonding/bond_main.c | |
parent | be65de7174123e02477bd488db1a657caf0f9947 (diff) | |
parent | 1ee1ceafb572f1a925809168267a7962a4289de8 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/bonding/bond_alb.c
drivers/net/ethernet/altera/altera_msgdma.c
drivers/net/ethernet/altera/altera_sgdma.c
net/ipv6/xfrm6_output.c
Several cases of overlapping changes.
The xfrm6_output.c has a bug fix which overlaps the renaming
of skb->local_df to skb->ignore_df.
In the Altera TSE driver cases, the register access cleanups
in net-next overlapped with bug fixes done in net.
Similarly a bug fix to send ALB packets in the bonding driver using
the right source address overlaps with cleanups in net-next.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 134 |
1 files changed, 65 insertions, 69 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 499645b0925c..59a12c61ceb4 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2157,10 +2157,10 @@ static bool bond_has_this_ip(struct bonding *bond, __be32 ip) | |||
2157 | */ | 2157 | */ |
2158 | static void bond_arp_send(struct net_device *slave_dev, int arp_op, | 2158 | static void bond_arp_send(struct net_device *slave_dev, int arp_op, |
2159 | __be32 dest_ip, __be32 src_ip, | 2159 | __be32 dest_ip, __be32 src_ip, |
2160 | struct bond_vlan_tag *inner, | 2160 | struct bond_vlan_tag *tags) |
2161 | struct bond_vlan_tag *outer) | ||
2162 | { | 2161 | { |
2163 | struct sk_buff *skb; | 2162 | struct sk_buff *skb; |
2163 | int i; | ||
2164 | 2164 | ||
2165 | pr_debug("arp %d on slave %s: dst %pI4 src %pI4\n", | 2165 | pr_debug("arp %d on slave %s: dst %pI4 src %pI4\n", |
2166 | arp_op, slave_dev->name, &dest_ip, &src_ip); | 2166 | arp_op, slave_dev->name, &dest_ip, &src_ip); |
@@ -2172,21 +2172,26 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, | |||
2172 | net_err_ratelimited("ARP packet allocation failed\n"); | 2172 | net_err_ratelimited("ARP packet allocation failed\n"); |
2173 | return; | 2173 | return; |
2174 | } | 2174 | } |
2175 | if (outer->vlan_id) { | ||
2176 | if (inner->vlan_id) { | ||
2177 | pr_debug("inner tag: proto %X vid %X\n", | ||
2178 | ntohs(inner->vlan_proto), inner->vlan_id); | ||
2179 | skb = __vlan_put_tag(skb, inner->vlan_proto, | ||
2180 | inner->vlan_id); | ||
2181 | if (!skb) { | ||
2182 | net_err_ratelimited("failed to insert inner VLAN tag\n"); | ||
2183 | return; | ||
2184 | } | ||
2185 | } | ||
2186 | 2175 | ||
2187 | pr_debug("outer reg: proto %X vid %X\n", | 2176 | /* Go through all the tags backwards and add them to the packet */ |
2188 | ntohs(outer->vlan_proto), outer->vlan_id); | 2177 | for (i = BOND_MAX_VLAN_ENCAP - 1; i > 0; i--) { |
2189 | skb = vlan_put_tag(skb, outer->vlan_proto, outer->vlan_id); | 2178 | if (!tags[i].vlan_id) |
2179 | continue; | ||
2180 | |||
2181 | pr_debug("inner tag: proto %X vid %X\n", | ||
2182 | ntohs(tags[i].vlan_proto), tags[i].vlan_id); | ||
2183 | skb = __vlan_put_tag(skb, tags[i].vlan_proto, | ||
2184 | tags[i].vlan_id); | ||
2185 | if (!skb) { | ||
2186 | net_err_ratelimited("failed to insert inner VLAN tag\n"); | ||
2187 | return; | ||
2188 | } | ||
2189 | } | ||
2190 | /* Set the outer tag */ | ||
2191 | if (tags[0].vlan_id) { | ||
2192 | pr_debug("outer tag: proto %X vid %X\n", | ||
2193 | ntohs(tags[0].vlan_proto), tags[0].vlan_id); | ||
2194 | skb = vlan_put_tag(skb, tags[0].vlan_proto, tags[0].vlan_id); | ||
2190 | if (!skb) { | 2195 | if (!skb) { |
2191 | net_err_ratelimited("failed to insert outer VLAN tag\n"); | 2196 | net_err_ratelimited("failed to insert outer VLAN tag\n"); |
2192 | return; | 2197 | return; |
@@ -2195,22 +2200,52 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, | |||
2195 | arp_xmit(skb); | 2200 | arp_xmit(skb); |
2196 | } | 2201 | } |
2197 | 2202 | ||
2203 | /* Validate the device path between the @start_dev and the @end_dev. | ||
2204 | * The path is valid if the @end_dev is reachable through device | ||
2205 | * stacking. | ||
2206 | * When the path is validated, collect any vlan information in the | ||
2207 | * path. | ||
2208 | */ | ||
2209 | static bool bond_verify_device_path(struct net_device *start_dev, | ||
2210 | struct net_device *end_dev, | ||
2211 | struct bond_vlan_tag *tags) | ||
2212 | { | ||
2213 | struct net_device *upper; | ||
2214 | struct list_head *iter; | ||
2215 | int idx; | ||
2216 | |||
2217 | if (start_dev == end_dev) | ||
2218 | return true; | ||
2219 | |||
2220 | netdev_for_each_upper_dev_rcu(start_dev, upper, iter) { | ||
2221 | if (bond_verify_device_path(upper, end_dev, tags)) { | ||
2222 | if (is_vlan_dev(upper)) { | ||
2223 | idx = vlan_get_encap_level(upper); | ||
2224 | if (idx >= BOND_MAX_VLAN_ENCAP) | ||
2225 | return false; | ||
2226 | |||
2227 | tags[idx].vlan_proto = | ||
2228 | vlan_dev_vlan_proto(upper); | ||
2229 | tags[idx].vlan_id = vlan_dev_vlan_id(upper); | ||
2230 | } | ||
2231 | return true; | ||
2232 | } | ||
2233 | } | ||
2234 | |||
2235 | return false; | ||
2236 | } | ||
2198 | 2237 | ||
2199 | static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | 2238 | static void bond_arp_send_all(struct bonding *bond, struct slave *slave) |
2200 | { | 2239 | { |
2201 | struct net_device *upper, *vlan_upper; | ||
2202 | struct list_head *iter, *vlan_iter; | ||
2203 | struct rtable *rt; | 2240 | struct rtable *rt; |
2204 | struct bond_vlan_tag inner, outer; | 2241 | struct bond_vlan_tag tags[BOND_MAX_VLAN_ENCAP]; |
2205 | __be32 *targets = bond->params.arp_targets, addr; | 2242 | __be32 *targets = bond->params.arp_targets, addr; |
2206 | int i; | 2243 | int i; |
2244 | bool ret; | ||
2207 | 2245 | ||
2208 | for (i = 0; i < BOND_MAX_ARP_TARGETS && targets[i]; i++) { | 2246 | for (i = 0; i < BOND_MAX_ARP_TARGETS && targets[i]; i++) { |
2209 | pr_debug("basa: target %pI4\n", &targets[i]); | 2247 | pr_debug("basa: target %pI4\n", &targets[i]); |
2210 | inner.vlan_proto = 0; | 2248 | memset(tags, 0, sizeof(tags)); |
2211 | inner.vlan_id = 0; | ||
2212 | outer.vlan_proto = 0; | ||
2213 | outer.vlan_id = 0; | ||
2214 | 2249 | ||
2215 | /* Find out through which dev should the packet go */ | 2250 | /* Find out through which dev should the packet go */ |
2216 | rt = ip_route_output(dev_net(bond->dev), targets[i], 0, | 2251 | rt = ip_route_output(dev_net(bond->dev), targets[i], 0, |
@@ -2223,7 +2258,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2223 | net_warn_ratelimited("%s: no route to arp_ip_target %pI4 and arp_validate is set\n", | 2258 | net_warn_ratelimited("%s: no route to arp_ip_target %pI4 and arp_validate is set\n", |
2224 | bond->dev->name, | 2259 | bond->dev->name, |
2225 | &targets[i]); | 2260 | &targets[i]); |
2226 | bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], 0, &inner, &outer); | 2261 | bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], |
2262 | 0, tags); | ||
2227 | continue; | 2263 | continue; |
2228 | } | 2264 | } |
2229 | 2265 | ||
@@ -2232,52 +2268,12 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2232 | goto found; | 2268 | goto found; |
2233 | 2269 | ||
2234 | rcu_read_lock(); | 2270 | rcu_read_lock(); |
2235 | /* first we search only for vlan devices. for every vlan | 2271 | ret = bond_verify_device_path(bond->dev, rt->dst.dev, tags); |
2236 | * found we verify its upper dev list, searching for the | ||
2237 | * rt->dst.dev. If found we save the tag of the vlan and | ||
2238 | * proceed to send the packet. | ||
2239 | */ | ||
2240 | netdev_for_each_all_upper_dev_rcu(bond->dev, vlan_upper, | ||
2241 | vlan_iter) { | ||
2242 | if (!is_vlan_dev(vlan_upper)) | ||
2243 | continue; | ||
2244 | |||
2245 | if (vlan_upper == rt->dst.dev) { | ||
2246 | outer.vlan_proto = vlan_dev_vlan_proto(vlan_upper); | ||
2247 | outer.vlan_id = vlan_dev_vlan_id(vlan_upper); | ||
2248 | rcu_read_unlock(); | ||
2249 | goto found; | ||
2250 | } | ||
2251 | netdev_for_each_all_upper_dev_rcu(vlan_upper, upper, | ||
2252 | iter) { | ||
2253 | if (upper == rt->dst.dev) { | ||
2254 | /* If the upper dev is a vlan dev too, | ||
2255 | * set the vlan tag to inner tag. | ||
2256 | */ | ||
2257 | if (is_vlan_dev(upper)) { | ||
2258 | inner.vlan_proto = vlan_dev_vlan_proto(upper); | ||
2259 | inner.vlan_id = vlan_dev_vlan_id(upper); | ||
2260 | } | ||
2261 | outer.vlan_proto = vlan_dev_vlan_proto(vlan_upper); | ||
2262 | outer.vlan_id = vlan_dev_vlan_id(vlan_upper); | ||
2263 | rcu_read_unlock(); | ||
2264 | goto found; | ||
2265 | } | ||
2266 | } | ||
2267 | } | ||
2268 | |||
2269 | /* if the device we're looking for is not on top of any of | ||
2270 | * our upper vlans, then just search for any dev that | ||
2271 | * matches, and in case it's a vlan - save the id | ||
2272 | */ | ||
2273 | netdev_for_each_all_upper_dev_rcu(bond->dev, upper, iter) { | ||
2274 | if (upper == rt->dst.dev) { | ||
2275 | rcu_read_unlock(); | ||
2276 | goto found; | ||
2277 | } | ||
2278 | } | ||
2279 | rcu_read_unlock(); | 2272 | rcu_read_unlock(); |
2280 | 2273 | ||
2274 | if (ret) | ||
2275 | goto found; | ||
2276 | |||
2281 | /* Not our device - skip */ | 2277 | /* Not our device - skip */ |
2282 | pr_debug("%s: no path to arp_ip_target %pI4 via rt.dev %s\n", | 2278 | pr_debug("%s: no path to arp_ip_target %pI4 via rt.dev %s\n", |
2283 | bond->dev->name, &targets[i], | 2279 | bond->dev->name, &targets[i], |
@@ -2290,7 +2286,7 @@ found: | |||
2290 | addr = bond_confirm_addr(rt->dst.dev, targets[i], 0); | 2286 | addr = bond_confirm_addr(rt->dst.dev, targets[i], 0); |
2291 | ip_rt_put(rt); | 2287 | ip_rt_put(rt); |
2292 | bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], | 2288 | bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i], |
2293 | addr, &inner, &outer); | 2289 | addr, tags); |
2294 | } | 2290 | } |
2295 | } | 2291 | } |
2296 | 2292 | ||