diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-20 16:43:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-20 16:43:21 -0400 |
commit | 06f4e926d256d902dd9a53dcb400fd74974ce087 (patch) | |
tree | 0b438b67f5f0eff6fd617bc497a9dace6164a488 /net/core | |
parent | 8e7bfcbab3825d1b404d615cb1b54f44ff81f981 (diff) | |
parent | d93515611bbc70c2fe4db232e5feb448ed8e4cc9 (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 'net/core')
-rw-r--r-- | net/core/dev.c | 187 | ||||
-rw-r--r-- | net/core/dst.c | 54 | ||||
-rw-r--r-- | net/core/ethtool.c | 196 | ||||
-rw-r--r-- | net/core/fib_rules.c | 3 | ||||
-rw-r--r-- | net/core/filter.c | 65 | ||||
-rw-r--r-- | net/core/net-sysfs.c | 26 | ||||
-rw-r--r-- | net/core/net_namespace.c | 12 | ||||
-rw-r--r-- | net/core/netpoll.c | 28 | ||||
-rw-r--r-- | net/core/pktgen.c | 199 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 25 | ||||
-rw-r--r-- | net/core/skbuff.c | 3 | ||||
-rw-r--r-- | net/core/sysctl_net_core.c | 9 | ||||
-rw-r--r-- | net/core/utils.c | 24 |
13 files changed, 423 insertions, 408 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index b624fe4d9bd7..d94537914a71 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -948,7 +948,7 @@ int dev_alloc_name(struct net_device *dev, const char *name) | |||
948 | } | 948 | } |
949 | EXPORT_SYMBOL(dev_alloc_name); | 949 | EXPORT_SYMBOL(dev_alloc_name); |
950 | 950 | ||
951 | static int dev_get_valid_name(struct net_device *dev, const char *name, bool fmt) | 951 | static int dev_get_valid_name(struct net_device *dev, const char *name) |
952 | { | 952 | { |
953 | struct net *net; | 953 | struct net *net; |
954 | 954 | ||
@@ -958,7 +958,7 @@ static int dev_get_valid_name(struct net_device *dev, const char *name, bool fmt | |||
958 | if (!dev_valid_name(name)) | 958 | if (!dev_valid_name(name)) |
959 | return -EINVAL; | 959 | return -EINVAL; |
960 | 960 | ||
961 | if (fmt && strchr(name, '%')) | 961 | if (strchr(name, '%')) |
962 | return dev_alloc_name(dev, name); | 962 | return dev_alloc_name(dev, name); |
963 | else if (__dev_get_by_name(net, name)) | 963 | else if (__dev_get_by_name(net, name)) |
964 | return -EEXIST; | 964 | return -EEXIST; |
@@ -995,7 +995,7 @@ int dev_change_name(struct net_device *dev, const char *newname) | |||
995 | 995 | ||
996 | memcpy(oldname, dev->name, IFNAMSIZ); | 996 | memcpy(oldname, dev->name, IFNAMSIZ); |
997 | 997 | ||
998 | err = dev_get_valid_name(dev, newname, 1); | 998 | err = dev_get_valid_name(dev, newname); |
999 | if (err < 0) | 999 | if (err < 0) |
1000 | return err; | 1000 | return err; |
1001 | 1001 | ||
@@ -1007,7 +1007,7 @@ rollback: | |||
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | write_lock_bh(&dev_base_lock); | 1009 | write_lock_bh(&dev_base_lock); |
1010 | hlist_del(&dev->name_hlist); | 1010 | hlist_del_rcu(&dev->name_hlist); |
1011 | write_unlock_bh(&dev_base_lock); | 1011 | write_unlock_bh(&dev_base_lock); |
1012 | 1012 | ||
1013 | synchronize_rcu(); | 1013 | synchronize_rcu(); |
@@ -1317,7 +1317,8 @@ void dev_disable_lro(struct net_device *dev) | |||
1317 | return; | 1317 | return; |
1318 | 1318 | ||
1319 | __ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO); | 1319 | __ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO); |
1320 | WARN_ON(dev->features & NETIF_F_LRO); | 1320 | if (unlikely(dev->features & NETIF_F_LRO)) |
1321 | netdev_WARN(dev, "failed to disable LRO!\n"); | ||
1321 | } | 1322 | } |
1322 | EXPORT_SYMBOL(dev_disable_lro); | 1323 | EXPORT_SYMBOL(dev_disable_lro); |
1323 | 1324 | ||
@@ -2504,8 +2505,8 @@ static inline void ____napi_schedule(struct softnet_data *sd, | |||
2504 | __u32 __skb_get_rxhash(struct sk_buff *skb) | 2505 | __u32 __skb_get_rxhash(struct sk_buff *skb) |
2505 | { | 2506 | { |
2506 | int nhoff, hash = 0, poff; | 2507 | int nhoff, hash = 0, poff; |
2507 | struct ipv6hdr *ip6; | 2508 | const struct ipv6hdr *ip6; |
2508 | struct iphdr *ip; | 2509 | const struct iphdr *ip; |
2509 | u8 ip_proto; | 2510 | u8 ip_proto; |
2510 | u32 addr1, addr2, ihl; | 2511 | u32 addr1, addr2, ihl; |
2511 | union { | 2512 | union { |
@@ -2520,7 +2521,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb) | |||
2520 | if (!pskb_may_pull(skb, sizeof(*ip) + nhoff)) | 2521 | if (!pskb_may_pull(skb, sizeof(*ip) + nhoff)) |
2521 | goto done; | 2522 | goto done; |
2522 | 2523 | ||
2523 | ip = (struct iphdr *) (skb->data + nhoff); | 2524 | ip = (const struct iphdr *) (skb->data + nhoff); |
2524 | if (ip->frag_off & htons(IP_MF | IP_OFFSET)) | 2525 | if (ip->frag_off & htons(IP_MF | IP_OFFSET)) |
2525 | ip_proto = 0; | 2526 | ip_proto = 0; |
2526 | else | 2527 | else |
@@ -2533,7 +2534,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb) | |||
2533 | if (!pskb_may_pull(skb, sizeof(*ip6) + nhoff)) | 2534 | if (!pskb_may_pull(skb, sizeof(*ip6) + nhoff)) |
2534 | goto done; | 2535 | goto done; |
2535 | 2536 | ||
2536 | ip6 = (struct ipv6hdr *) (skb->data + nhoff); | 2537 | ip6 = (const struct ipv6hdr *) (skb->data + nhoff); |
2537 | ip_proto = ip6->nexthdr; | 2538 | ip_proto = ip6->nexthdr; |
2538 | addr1 = (__force u32) ip6->saddr.s6_addr32[3]; | 2539 | addr1 = (__force u32) ip6->saddr.s6_addr32[3]; |
2539 | addr2 = (__force u32) ip6->daddr.s6_addr32[3]; | 2540 | addr2 = (__force u32) ip6->daddr.s6_addr32[3]; |
@@ -3078,25 +3079,6 @@ void netdev_rx_handler_unregister(struct net_device *dev) | |||
3078 | } | 3079 | } |
3079 | EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); | 3080 | EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); |
3080 | 3081 | ||
3081 | static void vlan_on_bond_hook(struct sk_buff *skb) | ||
3082 | { | ||
3083 | /* | ||
3084 | * Make sure ARP frames received on VLAN interfaces stacked on | ||
3085 | * bonding interfaces still make their way to any base bonding | ||
3086 | * device that may have registered for a specific ptype. | ||
3087 | */ | ||
3088 | if (skb->dev->priv_flags & IFF_802_1Q_VLAN && | ||
3089 | vlan_dev_real_dev(skb->dev)->priv_flags & IFF_BONDING && | ||
3090 | skb->protocol == htons(ETH_P_ARP)) { | ||
3091 | struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); | ||
3092 | |||
3093 | if (!skb2) | ||
3094 | return; | ||
3095 | skb2->dev = vlan_dev_real_dev(skb->dev); | ||
3096 | netif_rx(skb2); | ||
3097 | } | ||
3098 | } | ||
3099 | |||
3100 | static int __netif_receive_skb(struct sk_buff *skb) | 3082 | static int __netif_receive_skb(struct sk_buff *skb) |
3101 | { | 3083 | { |
3102 | struct packet_type *ptype, *pt_prev; | 3084 | struct packet_type *ptype, *pt_prev; |
@@ -3132,6 +3114,12 @@ another_round: | |||
3132 | 3114 | ||
3133 | __this_cpu_inc(softnet_data.processed); | 3115 | __this_cpu_inc(softnet_data.processed); |
3134 | 3116 | ||
3117 | if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) { | ||
3118 | skb = vlan_untag(skb); | ||
3119 | if (unlikely(!skb)) | ||
3120 | goto out; | ||
3121 | } | ||
3122 | |||
3135 | #ifdef CONFIG_NET_CLS_ACT | 3123 | #ifdef CONFIG_NET_CLS_ACT |
3136 | if (skb->tc_verd & TC_NCLS) { | 3124 | if (skb->tc_verd & TC_NCLS) { |
3137 | skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); | 3125 | skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); |
@@ -3179,15 +3167,13 @@ ncls: | |||
3179 | ret = deliver_skb(skb, pt_prev, orig_dev); | 3167 | ret = deliver_skb(skb, pt_prev, orig_dev); |
3180 | pt_prev = NULL; | 3168 | pt_prev = NULL; |
3181 | } | 3169 | } |
3182 | if (vlan_hwaccel_do_receive(&skb)) { | 3170 | if (vlan_do_receive(&skb)) { |
3183 | ret = __netif_receive_skb(skb); | 3171 | ret = __netif_receive_skb(skb); |
3184 | goto out; | 3172 | goto out; |
3185 | } else if (unlikely(!skb)) | 3173 | } else if (unlikely(!skb)) |
3186 | goto out; | 3174 | goto out; |
3187 | } | 3175 | } |
3188 | 3176 | ||
3189 | vlan_on_bond_hook(skb); | ||
3190 | |||
3191 | /* deliver only exact match when indicated */ | 3177 | /* deliver only exact match when indicated */ |
3192 | null_or_dev = deliver_exact ? skb->dev : NULL; | 3178 | null_or_dev = deliver_exact ? skb->dev : NULL; |
3193 | 3179 | ||
@@ -4512,6 +4498,30 @@ void dev_set_rx_mode(struct net_device *dev) | |||
4512 | } | 4498 | } |
4513 | 4499 | ||
4514 | /** | 4500 | /** |
4501 | * dev_ethtool_get_settings - call device's ethtool_ops::get_settings() | ||
4502 | * @dev: device | ||
4503 | * @cmd: memory area for ethtool_ops::get_settings() result | ||
4504 | * | ||
4505 | * The cmd arg is initialized properly (cleared and | ||
4506 | * ethtool_cmd::cmd field set to ETHTOOL_GSET). | ||
4507 | * | ||
4508 | * Return device's ethtool_ops::get_settings() result value or | ||
4509 | * -EOPNOTSUPP when device doesn't expose | ||
4510 | * ethtool_ops::get_settings() operation. | ||
4511 | */ | ||
4512 | int dev_ethtool_get_settings(struct net_device *dev, | ||
4513 | struct ethtool_cmd *cmd) | ||
4514 | { | ||
4515 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings) | ||
4516 | return -EOPNOTSUPP; | ||
4517 | |||
4518 | memset(cmd, 0, sizeof(struct ethtool_cmd)); | ||
4519 | cmd->cmd = ETHTOOL_GSET; | ||
4520 | return dev->ethtool_ops->get_settings(dev, cmd); | ||
4521 | } | ||
4522 | EXPORT_SYMBOL(dev_ethtool_get_settings); | ||
4523 | |||
4524 | /** | ||
4515 | * dev_get_flags - get flags reported to userspace | 4525 | * dev_get_flags - get flags reported to userspace |
4516 | * @dev: device | 4526 | * @dev: device |
4517 | * | 4527 | * |
@@ -5116,7 +5126,7 @@ static void rollback_registered_many(struct list_head *head) | |||
5116 | list_del(&dev->unreg_list); | 5126 | list_del(&dev->unreg_list); |
5117 | continue; | 5127 | continue; |
5118 | } | 5128 | } |
5119 | 5129 | dev->dismantle = true; | |
5120 | BUG_ON(dev->reg_state != NETREG_REGISTERED); | 5130 | BUG_ON(dev->reg_state != NETREG_REGISTERED); |
5121 | } | 5131 | } |
5122 | 5132 | ||
@@ -5242,11 +5252,13 @@ u32 netdev_fix_features(struct net_device *dev, u32 features) | |||
5242 | } | 5252 | } |
5243 | EXPORT_SYMBOL(netdev_fix_features); | 5253 | EXPORT_SYMBOL(netdev_fix_features); |
5244 | 5254 | ||
5245 | void netdev_update_features(struct net_device *dev) | 5255 | int __netdev_update_features(struct net_device *dev) |
5246 | { | 5256 | { |
5247 | u32 features; | 5257 | u32 features; |
5248 | int err = 0; | 5258 | int err = 0; |
5249 | 5259 | ||
5260 | ASSERT_RTNL(); | ||
5261 | |||
5250 | features = netdev_get_wanted_features(dev); | 5262 | features = netdev_get_wanted_features(dev); |
5251 | 5263 | ||
5252 | if (dev->netdev_ops->ndo_fix_features) | 5264 | if (dev->netdev_ops->ndo_fix_features) |
@@ -5256,24 +5268,60 @@ void netdev_update_features(struct net_device *dev) | |||
5256 | features = netdev_fix_features(dev, features); | 5268 | features = netdev_fix_features(dev, features); |
5257 | 5269 | ||
5258 | if (dev->features == features) | 5270 | if (dev->features == features) |
5259 | return; | 5271 | return 0; |
5260 | 5272 | ||
5261 | netdev_info(dev, "Features changed: 0x%08x -> 0x%08x\n", | 5273 | netdev_dbg(dev, "Features changed: 0x%08x -> 0x%08x\n", |
5262 | dev->features, features); | 5274 | dev->features, features); |
5263 | 5275 | ||
5264 | if (dev->netdev_ops->ndo_set_features) | 5276 | if (dev->netdev_ops->ndo_set_features) |
5265 | err = dev->netdev_ops->ndo_set_features(dev, features); | 5277 | err = dev->netdev_ops->ndo_set_features(dev, features); |
5266 | 5278 | ||
5267 | if (!err) | 5279 | if (unlikely(err < 0)) { |
5268 | dev->features = features; | ||
5269 | else if (err < 0) | ||
5270 | netdev_err(dev, | 5280 | netdev_err(dev, |
5271 | "set_features() failed (%d); wanted 0x%08x, left 0x%08x\n", | 5281 | "set_features() failed (%d); wanted 0x%08x, left 0x%08x\n", |
5272 | err, features, dev->features); | 5282 | err, features, dev->features); |
5283 | return -1; | ||
5284 | } | ||
5285 | |||
5286 | if (!err) | ||
5287 | dev->features = features; | ||
5288 | |||
5289 | return 1; | ||
5290 | } | ||
5291 | |||
5292 | /** | ||
5293 | * netdev_update_features - recalculate device features | ||
5294 | * @dev: the device to check | ||
5295 | * | ||
5296 | * Recalculate dev->features set and send notifications if it | ||
5297 | * has changed. Should be called after driver or hardware dependent | ||
5298 | * conditions might have changed that influence the features. | ||
5299 | */ | ||
5300 | void netdev_update_features(struct net_device *dev) | ||
5301 | { | ||
5302 | if (__netdev_update_features(dev)) | ||
5303 | netdev_features_change(dev); | ||
5273 | } | 5304 | } |
5274 | EXPORT_SYMBOL(netdev_update_features); | 5305 | EXPORT_SYMBOL(netdev_update_features); |
5275 | 5306 | ||
5276 | /** | 5307 | /** |
5308 | * netdev_change_features - recalculate device features | ||
5309 | * @dev: the device to check | ||
5310 | * | ||
5311 | * Recalculate dev->features set and send notifications even | ||
5312 | * if they have not changed. Should be called instead of | ||
5313 | * netdev_update_features() if also dev->vlan_features might | ||
5314 | * have changed to allow the changes to be propagated to stacked | ||
5315 | * VLAN devices. | ||
5316 | */ | ||
5317 | void netdev_change_features(struct net_device *dev) | ||
5318 | { | ||
5319 | __netdev_update_features(dev); | ||
5320 | netdev_features_change(dev); | ||
5321 | } | ||
5322 | EXPORT_SYMBOL(netdev_change_features); | ||
5323 | |||
5324 | /** | ||
5277 | * netif_stacked_transfer_operstate - transfer operstate | 5325 | * netif_stacked_transfer_operstate - transfer operstate |
5278 | * @rootdev: the root or lower level device to transfer state from | 5326 | * @rootdev: the root or lower level device to transfer state from |
5279 | * @dev: the device to transfer operstate to | 5327 | * @dev: the device to transfer operstate to |
@@ -5389,6 +5437,10 @@ int register_netdevice(struct net_device *dev) | |||
5389 | 5437 | ||
5390 | dev->iflink = -1; | 5438 | dev->iflink = -1; |
5391 | 5439 | ||
5440 | ret = dev_get_valid_name(dev, dev->name); | ||
5441 | if (ret < 0) | ||
5442 | goto out; | ||
5443 | |||
5392 | /* Init, if this function is available */ | 5444 | /* Init, if this function is available */ |
5393 | if (dev->netdev_ops->ndo_init) { | 5445 | if (dev->netdev_ops->ndo_init) { |
5394 | ret = dev->netdev_ops->ndo_init(dev); | 5446 | ret = dev->netdev_ops->ndo_init(dev); |
@@ -5399,10 +5451,6 @@ int register_netdevice(struct net_device *dev) | |||
5399 | } | 5451 | } |
5400 | } | 5452 | } |
5401 | 5453 | ||
5402 | ret = dev_get_valid_name(dev, dev->name, 0); | ||
5403 | if (ret) | ||
5404 | goto err_uninit; | ||
5405 | |||
5406 | dev->ifindex = dev_new_index(net); | 5454 | dev->ifindex = dev_new_index(net); |
5407 | if (dev->iflink == -1) | 5455 | if (dev->iflink == -1) |
5408 | dev->iflink = dev->ifindex; | 5456 | dev->iflink = dev->ifindex; |
@@ -5414,6 +5462,14 @@ int register_netdevice(struct net_device *dev) | |||
5414 | dev->features |= NETIF_F_SOFT_FEATURES; | 5462 | dev->features |= NETIF_F_SOFT_FEATURES; |
5415 | dev->wanted_features = dev->features & dev->hw_features; | 5463 | dev->wanted_features = dev->features & dev->hw_features; |
5416 | 5464 | ||
5465 | /* Turn on no cache copy if HW is doing checksum */ | ||
5466 | dev->hw_features |= NETIF_F_NOCACHE_COPY; | ||
5467 | if ((dev->features & NETIF_F_ALL_CSUM) && | ||
5468 | !(dev->features & NETIF_F_NO_CSUM)) { | ||
5469 | dev->wanted_features |= NETIF_F_NOCACHE_COPY; | ||
5470 | dev->features |= NETIF_F_NOCACHE_COPY; | ||
5471 | } | ||
5472 | |||
5417 | /* Enable GRO and NETIF_F_HIGHDMA for vlans by default, | 5473 | /* Enable GRO and NETIF_F_HIGHDMA for vlans by default, |
5418 | * vlan_dev_init() will do the dev->features check, so these features | 5474 | * vlan_dev_init() will do the dev->features check, so these features |
5419 | * are enabled only if supported by underlying device. | 5475 | * are enabled only if supported by underlying device. |
@@ -5430,7 +5486,7 @@ int register_netdevice(struct net_device *dev) | |||
5430 | goto err_uninit; | 5486 | goto err_uninit; |
5431 | dev->reg_state = NETREG_REGISTERED; | 5487 | dev->reg_state = NETREG_REGISTERED; |
5432 | 5488 | ||
5433 | netdev_update_features(dev); | 5489 | __netdev_update_features(dev); |
5434 | 5490 | ||
5435 | /* | 5491 | /* |
5436 | * Default initial state at registry is that the | 5492 | * Default initial state at registry is that the |
@@ -5527,19 +5583,7 @@ int register_netdev(struct net_device *dev) | |||
5527 | int err; | 5583 | int err; |
5528 | 5584 | ||
5529 | rtnl_lock(); | 5585 | rtnl_lock(); |
5530 | |||
5531 | /* | ||
5532 | * If the name is a format string the caller wants us to do a | ||
5533 | * name allocation. | ||
5534 | */ | ||
5535 | if (strchr(dev->name, '%')) { | ||
5536 | err = dev_alloc_name(dev, dev->name); | ||
5537 | if (err < 0) | ||
5538 | goto out; | ||
5539 | } | ||
5540 | |||
5541 | err = register_netdevice(dev); | 5586 | err = register_netdevice(dev); |
5542 | out: | ||
5543 | rtnl_unlock(); | 5587 | rtnl_unlock(); |
5544 | return err; | 5588 | return err; |
5545 | } | 5589 | } |
@@ -6021,7 +6065,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
6021 | /* We get here if we can't use the current device name */ | 6065 | /* We get here if we can't use the current device name */ |
6022 | if (!pat) | 6066 | if (!pat) |
6023 | goto out; | 6067 | goto out; |
6024 | if (dev_get_valid_name(dev, pat, 1)) | 6068 | if (dev_get_valid_name(dev, pat) < 0) |
6025 | goto out; | 6069 | goto out; |
6026 | } | 6070 | } |
6027 | 6071 | ||
@@ -6153,29 +6197,20 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
6153 | */ | 6197 | */ |
6154 | u32 netdev_increment_features(u32 all, u32 one, u32 mask) | 6198 | u32 netdev_increment_features(u32 all, u32 one, u32 mask) |
6155 | { | 6199 | { |
6156 | /* If device needs checksumming, downgrade to it. */ | 6200 | if (mask & NETIF_F_GEN_CSUM) |
6157 | if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM)) | 6201 | mask |= NETIF_F_ALL_CSUM; |
6158 | all ^= NETIF_F_NO_CSUM | (one & NETIF_F_ALL_CSUM); | 6202 | mask |= NETIF_F_VLAN_CHALLENGED; |
6159 | else if (mask & NETIF_F_ALL_CSUM) { | ||
6160 | /* If one device supports v4/v6 checksumming, set for all. */ | ||
6161 | if (one & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM) && | ||
6162 | !(all & NETIF_F_GEN_CSUM)) { | ||
6163 | all &= ~NETIF_F_ALL_CSUM; | ||
6164 | all |= one & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); | ||
6165 | } | ||
6166 | 6203 | ||
6167 | /* If one device supports hw checksumming, set for all. */ | 6204 | all |= one & (NETIF_F_ONE_FOR_ALL|NETIF_F_ALL_CSUM) & mask; |
6168 | if (one & NETIF_F_GEN_CSUM && !(all & NETIF_F_GEN_CSUM)) { | 6205 | all &= one | ~NETIF_F_ALL_FOR_ALL; |
6169 | all &= ~NETIF_F_ALL_CSUM; | ||
6170 | all |= NETIF_F_HW_CSUM; | ||
6171 | } | ||
6172 | } | ||
6173 | 6206 | ||
6174 | one |= NETIF_F_ALL_CSUM; | 6207 | /* If device needs checksumming, downgrade to it. */ |
6208 | if (all & (NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM)) | ||
6209 | all &= ~NETIF_F_NO_CSUM; | ||
6175 | 6210 | ||
6176 | one |= all & NETIF_F_ONE_FOR_ALL; | 6211 | /* If one device supports hw checksumming, set for all. */ |
6177 | all &= one | NETIF_F_LLTX | NETIF_F_GSO | NETIF_F_UFO; | 6212 | if (all & NETIF_F_GEN_CSUM) |
6178 | all |= one & mask & NETIF_F_ONE_FOR_ALL; | 6213 | all &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM); |
6179 | 6214 | ||
6180 | return all; | 6215 | return all; |
6181 | } | 6216 | } |
diff --git a/net/core/dst.c b/net/core/dst.c index 0a3920bf3613..81a4fa1c95ed 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -34,9 +34,6 @@ | |||
34 | * 3) This list is guarded by a mutex, | 34 | * 3) This list is guarded by a mutex, |
35 | * so that the gc_task and dst_dev_event() can be synchronized. | 35 | * so that the gc_task and dst_dev_event() can be synchronized. |
36 | */ | 36 | */ |
37 | #if RT_CACHE_DEBUG >= 2 | ||
38 | static atomic_t dst_total = ATOMIC_INIT(0); | ||
39 | #endif | ||
40 | 37 | ||
41 | /* | 38 | /* |
42 | * We want to keep lock & list close together | 39 | * We want to keep lock & list close together |
@@ -70,10 +67,6 @@ static void dst_gc_task(struct work_struct *work) | |||
70 | unsigned long expires = ~0L; | 67 | unsigned long expires = ~0L; |
71 | struct dst_entry *dst, *next, head; | 68 | struct dst_entry *dst, *next, head; |
72 | struct dst_entry *last = &head; | 69 | struct dst_entry *last = &head; |
73 | #if RT_CACHE_DEBUG >= 2 | ||
74 | ktime_t time_start = ktime_get(); | ||
75 | struct timespec elapsed; | ||
76 | #endif | ||
77 | 70 | ||
78 | mutex_lock(&dst_gc_mutex); | 71 | mutex_lock(&dst_gc_mutex); |
79 | next = dst_busy_list; | 72 | next = dst_busy_list; |
@@ -147,15 +140,6 @@ loop: | |||
147 | 140 | ||
148 | spin_unlock_bh(&dst_garbage.lock); | 141 | spin_unlock_bh(&dst_garbage.lock); |
149 | mutex_unlock(&dst_gc_mutex); | 142 | mutex_unlock(&dst_gc_mutex); |
150 | #if RT_CACHE_DEBUG >= 2 | ||
151 | elapsed = ktime_to_timespec(ktime_sub(ktime_get(), time_start)); | ||
152 | printk(KERN_DEBUG "dst_total: %d delayed: %d work_perf: %d" | ||
153 | " expires: %lu elapsed: %lu us\n", | ||
154 | atomic_read(&dst_total), delayed, work_performed, | ||
155 | expires, | ||
156 | elapsed.tv_sec * USEC_PER_SEC + | ||
157 | elapsed.tv_nsec / NSEC_PER_USEC); | ||
158 | #endif | ||
159 | } | 143 | } |
160 | 144 | ||
161 | int dst_discard(struct sk_buff *skb) | 145 | int dst_discard(struct sk_buff *skb) |
@@ -167,7 +151,8 @@ EXPORT_SYMBOL(dst_discard); | |||
167 | 151 | ||
168 | const u32 dst_default_metrics[RTAX_MAX]; | 152 | const u32 dst_default_metrics[RTAX_MAX]; |
169 | 153 | ||
170 | void *dst_alloc(struct dst_ops *ops, int initial_ref) | 154 | void *dst_alloc(struct dst_ops *ops, struct net_device *dev, |
155 | int initial_ref, int initial_obsolete, int flags) | ||
171 | { | 156 | { |
172 | struct dst_entry *dst; | 157 | struct dst_entry *dst; |
173 | 158 | ||
@@ -175,18 +160,36 @@ void *dst_alloc(struct dst_ops *ops, int initial_ref) | |||
175 | if (ops->gc(ops)) | 160 | if (ops->gc(ops)) |
176 | return NULL; | 161 | return NULL; |
177 | } | 162 | } |
178 | dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC); | 163 | dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); |
179 | if (!dst) | 164 | if (!dst) |
180 | return NULL; | 165 | return NULL; |
181 | atomic_set(&dst->__refcnt, initial_ref); | 166 | dst->child = NULL; |
167 | dst->dev = dev; | ||
168 | if (dev) | ||
169 | dev_hold(dev); | ||
182 | dst->ops = ops; | 170 | dst->ops = ops; |
183 | dst->lastuse = jiffies; | ||
184 | dst->path = dst; | ||
185 | dst->input = dst->output = dst_discard; | ||
186 | dst_init_metrics(dst, dst_default_metrics, true); | 171 | dst_init_metrics(dst, dst_default_metrics, true); |
187 | #if RT_CACHE_DEBUG >= 2 | 172 | dst->expires = 0UL; |
188 | atomic_inc(&dst_total); | 173 | dst->path = dst; |
174 | dst->neighbour = NULL; | ||
175 | dst->hh = NULL; | ||
176 | #ifdef CONFIG_XFRM | ||
177 | dst->xfrm = NULL; | ||
178 | #endif | ||
179 | dst->input = dst_discard; | ||
180 | dst->output = dst_discard; | ||
181 | dst->error = 0; | ||
182 | dst->obsolete = initial_obsolete; | ||
183 | dst->header_len = 0; | ||
184 | dst->trailer_len = 0; | ||
185 | #ifdef CONFIG_IP_ROUTE_CLASSID | ||
186 | dst->tclassid = 0; | ||
189 | #endif | 187 | #endif |
188 | atomic_set(&dst->__refcnt, initial_ref); | ||
189 | dst->__use = 0; | ||
190 | dst->lastuse = jiffies; | ||
191 | dst->flags = flags; | ||
192 | dst->next = NULL; | ||
190 | dst_entries_add(ops, 1); | 193 | dst_entries_add(ops, 1); |
191 | return dst; | 194 | return dst; |
192 | } | 195 | } |
@@ -246,9 +249,6 @@ again: | |||
246 | dst->ops->destroy(dst); | 249 | dst->ops->destroy(dst); |
247 | if (dst->dev) | 250 | if (dst->dev) |
248 | dev_put(dst->dev); | 251 | dev_put(dst->dev); |
249 | #if RT_CACHE_DEBUG >= 2 | ||
250 | atomic_dec(&dst_total); | ||
251 | #endif | ||
252 | kmem_cache_free(dst->ops->kmem_cachep, dst); | 252 | kmem_cache_free(dst->ops->kmem_cachep, dst); |
253 | 253 | ||
254 | dst = child; | 254 | dst = child; |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 74ead9eca126..84e7304532e6 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/uaccess.h> | 21 | #include <linux/uaccess.h> |
22 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/rtnetlink.h> | ||
25 | #include <linux/sched.h> | ||
24 | 26 | ||
25 | /* | 27 | /* |
26 | * Some useful ethtool_ops methods that're device independent. | 28 | * Some useful ethtool_ops methods that're device independent. |
@@ -317,7 +319,7 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr) | |||
317 | 319 | ||
318 | dev->wanted_features &= ~features[0].valid; | 320 | dev->wanted_features &= ~features[0].valid; |
319 | dev->wanted_features |= features[0].valid & features[0].requested; | 321 | dev->wanted_features |= features[0].valid & features[0].requested; |
320 | netdev_update_features(dev); | 322 | __netdev_update_features(dev); |
321 | 323 | ||
322 | if ((dev->wanted_features ^ dev->features) & features[0].valid) | 324 | if ((dev->wanted_features ^ dev->features) & features[0].valid) |
323 | ret |= ETHTOOL_F_WISH; | 325 | ret |= ETHTOOL_F_WISH; |
@@ -330,7 +332,7 @@ static const char netdev_features_strings[ETHTOOL_DEV_FEATURE_WORDS * 32][ETH_GS | |||
330 | /* NETIF_F_IP_CSUM */ "tx-checksum-ipv4", | 332 | /* NETIF_F_IP_CSUM */ "tx-checksum-ipv4", |
331 | /* NETIF_F_NO_CSUM */ "tx-checksum-unneeded", | 333 | /* NETIF_F_NO_CSUM */ "tx-checksum-unneeded", |
332 | /* NETIF_F_HW_CSUM */ "tx-checksum-ip-generic", | 334 | /* NETIF_F_HW_CSUM */ "tx-checksum-ip-generic", |
333 | /* NETIF_F_IPV6_CSUM */ "tx_checksum-ipv6", | 335 | /* NETIF_F_IPV6_CSUM */ "tx-checksum-ipv6", |
334 | /* NETIF_F_HIGHDMA */ "highdma", | 336 | /* NETIF_F_HIGHDMA */ "highdma", |
335 | /* NETIF_F_FRAGLIST */ "tx-scatter-gather-fraglist", | 337 | /* NETIF_F_FRAGLIST */ "tx-scatter-gather-fraglist", |
336 | /* NETIF_F_HW_VLAN_TX */ "tx-vlan-hw-insert", | 338 | /* NETIF_F_HW_VLAN_TX */ "tx-vlan-hw-insert", |
@@ -359,8 +361,8 @@ static const char netdev_features_strings[ETHTOOL_DEV_FEATURE_WORDS * 32][ETH_GS | |||
359 | /* NETIF_F_NTUPLE */ "rx-ntuple-filter", | 361 | /* NETIF_F_NTUPLE */ "rx-ntuple-filter", |
360 | /* NETIF_F_RXHASH */ "rx-hashing", | 362 | /* NETIF_F_RXHASH */ "rx-hashing", |
361 | /* NETIF_F_RXCSUM */ "rx-checksum", | 363 | /* NETIF_F_RXCSUM */ "rx-checksum", |
362 | "", | 364 | /* NETIF_F_NOCACHE_COPY */ "tx-nocache-copy", |
363 | "", | 365 | /* NETIF_F_LOOPBACK */ "loopback", |
364 | }; | 366 | }; |
365 | 367 | ||
366 | static int __ethtool_get_sset_count(struct net_device *dev, int sset) | 368 | static int __ethtool_get_sset_count(struct net_device *dev, int sset) |
@@ -499,7 +501,7 @@ static int ethtool_set_one_feature(struct net_device *dev, | |||
499 | else | 501 | else |
500 | dev->wanted_features &= ~mask; | 502 | dev->wanted_features &= ~mask; |
501 | 503 | ||
502 | netdev_update_features(dev); | 504 | __netdev_update_features(dev); |
503 | return 0; | 505 | return 0; |
504 | } | 506 | } |
505 | 507 | ||
@@ -544,14 +546,14 @@ int __ethtool_set_flags(struct net_device *dev, u32 data) | |||
544 | } | 546 | } |
545 | 547 | ||
546 | /* allow changing only bits set in hw_features */ | 548 | /* allow changing only bits set in hw_features */ |
547 | changed = (data ^ dev->wanted_features) & flags_dup_features; | 549 | changed = (data ^ dev->features) & flags_dup_features; |
548 | if (changed & ~dev->hw_features) | 550 | if (changed & ~dev->hw_features) |
549 | return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP; | 551 | return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP; |
550 | 552 | ||
551 | dev->wanted_features = | 553 | dev->wanted_features = |
552 | (dev->wanted_features & ~changed) | data; | 554 | (dev->wanted_features & ~changed) | (data & dev->hw_features); |
553 | 555 | ||
554 | netdev_update_features(dev); | 556 | __netdev_update_features(dev); |
555 | 557 | ||
556 | return 0; | 558 | return 0; |
557 | } | 559 | } |
@@ -908,6 +910,9 @@ static noinline_for_stack int ethtool_set_rx_ntuple(struct net_device *dev, | |||
908 | struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL; | 910 | struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL; |
909 | int ret; | 911 | int ret; |
910 | 912 | ||
913 | if (!ops->set_rx_ntuple) | ||
914 | return -EOPNOTSUPP; | ||
915 | |||
911 | if (!(dev->features & NETIF_F_NTUPLE)) | 916 | if (!(dev->features & NETIF_F_NTUPLE)) |
912 | return -EINVAL; | 917 | return -EINVAL; |
913 | 918 | ||
@@ -1441,6 +1446,35 @@ static int ethtool_set_ringparam(struct net_device *dev, void __user *useraddr) | |||
1441 | return dev->ethtool_ops->set_ringparam(dev, &ringparam); | 1446 | return dev->ethtool_ops->set_ringparam(dev, &ringparam); |
1442 | } | 1447 | } |
1443 | 1448 | ||
1449 | static noinline_for_stack int ethtool_get_channels(struct net_device *dev, | ||
1450 | void __user *useraddr) | ||
1451 | { | ||
1452 | struct ethtool_channels channels = { .cmd = ETHTOOL_GCHANNELS }; | ||
1453 | |||
1454 | if (!dev->ethtool_ops->get_channels) | ||
1455 | return -EOPNOTSUPP; | ||
1456 | |||
1457 | dev->ethtool_ops->get_channels(dev, &channels); | ||
1458 | |||
1459 | if (copy_to_user(useraddr, &channels, sizeof(channels))) | ||
1460 | return -EFAULT; | ||
1461 | return 0; | ||
1462 | } | ||
1463 | |||
1464 | static noinline_for_stack int ethtool_set_channels(struct net_device *dev, | ||
1465 | void __user *useraddr) | ||
1466 | { | ||
1467 | struct ethtool_channels channels; | ||
1468 | |||
1469 | if (!dev->ethtool_ops->set_channels) | ||
1470 | return -EOPNOTSUPP; | ||
1471 | |||
1472 | if (copy_from_user(&channels, useraddr, sizeof(channels))) | ||
1473 | return -EFAULT; | ||
1474 | |||
1475 | return dev->ethtool_ops->set_channels(dev, &channels); | ||
1476 | } | ||
1477 | |||
1444 | static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr) | 1478 | static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr) |
1445 | { | 1479 | { |
1446 | struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM }; | 1480 | struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM }; |
@@ -1618,14 +1652,60 @@ out: | |||
1618 | static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) | 1652 | static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) |
1619 | { | 1653 | { |
1620 | struct ethtool_value id; | 1654 | struct ethtool_value id; |
1655 | static bool busy; | ||
1656 | int rc; | ||
1621 | 1657 | ||
1622 | if (!dev->ethtool_ops->phys_id) | 1658 | if (!dev->ethtool_ops->set_phys_id) |
1623 | return -EOPNOTSUPP; | 1659 | return -EOPNOTSUPP; |
1624 | 1660 | ||
1661 | if (busy) | ||
1662 | return -EBUSY; | ||
1663 | |||
1625 | if (copy_from_user(&id, useraddr, sizeof(id))) | 1664 | if (copy_from_user(&id, useraddr, sizeof(id))) |
1626 | return -EFAULT; | 1665 | return -EFAULT; |
1627 | 1666 | ||
1628 | return dev->ethtool_ops->phys_id(dev, id.data); | 1667 | rc = dev->ethtool_ops->set_phys_id(dev, ETHTOOL_ID_ACTIVE); |
1668 | if (rc < 0) | ||
1669 | return rc; | ||
1670 | |||
1671 | /* Drop the RTNL lock while waiting, but prevent reentry or | ||
1672 | * removal of the device. | ||
1673 | */ | ||
1674 | busy = true; | ||
1675 | dev_hold(dev); | ||
1676 | rtnl_unlock(); | ||
1677 | |||
1678 | if (rc == 0) { | ||
1679 | /* Driver will handle this itself */ | ||
1680 | schedule_timeout_interruptible( | ||
1681 | id.data ? (id.data * HZ) : MAX_SCHEDULE_TIMEOUT); | ||
1682 | } else { | ||
1683 | /* Driver expects to be called at twice the frequency in rc */ | ||
1684 | int n = rc * 2, i, interval = HZ / n; | ||
1685 | |||
1686 | /* Count down seconds */ | ||
1687 | do { | ||
1688 | /* Count down iterations per second */ | ||
1689 | i = n; | ||
1690 | do { | ||
1691 | rtnl_lock(); | ||
1692 | rc = dev->ethtool_ops->set_phys_id(dev, | ||
1693 | (i & 1) ? ETHTOOL_ID_OFF : ETHTOOL_ID_ON); | ||
1694 | rtnl_unlock(); | ||
1695 | if (rc) | ||
1696 | break; | ||
1697 | schedule_timeout_interruptible(interval); | ||
1698 | } while (!signal_pending(current) && --i != 0); | ||
1699 | } while (!signal_pending(current) && | ||
1700 | (id.data == 0 || --id.data != 0)); | ||
1701 | } | ||
1702 | |||
1703 | rtnl_lock(); | ||
1704 | dev_put(dev); | ||
1705 | busy = false; | ||
1706 | |||
1707 | (void)dev->ethtool_ops->set_phys_id(dev, ETHTOOL_ID_INACTIVE); | ||
1708 | return rc; | ||
1629 | } | 1709 | } |
1630 | 1710 | ||
1631 | static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) | 1711 | static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) |
@@ -1743,6 +1823,87 @@ static noinline_for_stack int ethtool_flash_device(struct net_device *dev, | |||
1743 | return dev->ethtool_ops->flash_device(dev, &efl); | 1823 | return dev->ethtool_ops->flash_device(dev, &efl); |
1744 | } | 1824 | } |
1745 | 1825 | ||
1826 | static int ethtool_set_dump(struct net_device *dev, | ||
1827 | void __user *useraddr) | ||
1828 | { | ||
1829 | struct ethtool_dump dump; | ||
1830 | |||
1831 | if (!dev->ethtool_ops->set_dump) | ||
1832 | return -EOPNOTSUPP; | ||
1833 | |||
1834 | if (copy_from_user(&dump, useraddr, sizeof(dump))) | ||
1835 | return -EFAULT; | ||
1836 | |||
1837 | return dev->ethtool_ops->set_dump(dev, &dump); | ||
1838 | } | ||
1839 | |||
1840 | static int ethtool_get_dump_flag(struct net_device *dev, | ||
1841 | void __user *useraddr) | ||
1842 | { | ||
1843 | int ret; | ||
1844 | struct ethtool_dump dump; | ||
1845 | const struct ethtool_ops *ops = dev->ethtool_ops; | ||
1846 | |||
1847 | if (!dev->ethtool_ops->get_dump_flag) | ||
1848 | return -EOPNOTSUPP; | ||
1849 | |||
1850 | if (copy_from_user(&dump, useraddr, sizeof(dump))) | ||
1851 | return -EFAULT; | ||
1852 | |||
1853 | ret = ops->get_dump_flag(dev, &dump); | ||
1854 | if (ret) | ||
1855 | return ret; | ||
1856 | |||
1857 | if (copy_to_user(useraddr, &dump, sizeof(dump))) | ||
1858 | return -EFAULT; | ||
1859 | return 0; | ||
1860 | } | ||
1861 | |||
1862 | static int ethtool_get_dump_data(struct net_device *dev, | ||
1863 | void __user *useraddr) | ||
1864 | { | ||
1865 | int ret; | ||
1866 | __u32 len; | ||
1867 | struct ethtool_dump dump, tmp; | ||
1868 | const struct ethtool_ops *ops = dev->ethtool_ops; | ||
1869 | void *data = NULL; | ||
1870 | |||
1871 | if (!dev->ethtool_ops->get_dump_data || | ||
1872 | !dev->ethtool_ops->get_dump_flag) | ||
1873 | return -EOPNOTSUPP; | ||
1874 | |||
1875 | if (copy_from_user(&dump, useraddr, sizeof(dump))) | ||
1876 | return -EFAULT; | ||
1877 | |||
1878 | memset(&tmp, 0, sizeof(tmp)); | ||
1879 | tmp.cmd = ETHTOOL_GET_DUMP_FLAG; | ||
1880 | ret = ops->get_dump_flag(dev, &tmp); | ||
1881 | if (ret) | ||
1882 | return ret; | ||
1883 | |||
1884 | len = (tmp.len > dump.len) ? dump.len : tmp.len; | ||
1885 | if (!len) | ||
1886 | return -EFAULT; | ||
1887 | |||
1888 | data = vzalloc(tmp.len); | ||
1889 | if (!data) | ||
1890 | return -ENOMEM; | ||
1891 | ret = ops->get_dump_data(dev, &dump, data); | ||
1892 | if (ret) | ||
1893 | goto out; | ||
1894 | |||
1895 | if (copy_to_user(useraddr, &dump, sizeof(dump))) { | ||
1896 | ret = -EFAULT; | ||
1897 | goto out; | ||
1898 | } | ||
1899 | useraddr += offsetof(struct ethtool_dump, data); | ||
1900 | if (copy_to_user(useraddr, data, len)) | ||
1901 | ret = -EFAULT; | ||
1902 | out: | ||
1903 | vfree(data); | ||
1904 | return ret; | ||
1905 | } | ||
1906 | |||
1746 | /* The main entry point in this file. Called from net/core/dev.c */ | 1907 | /* The main entry point in this file. Called from net/core/dev.c */ |
1747 | 1908 | ||
1748 | int dev_ethtool(struct net *net, struct ifreq *ifr) | 1909 | int dev_ethtool(struct net *net, struct ifreq *ifr) |
@@ -1953,6 +2114,21 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) | |||
1953 | case ETHTOOL_SGRO: | 2114 | case ETHTOOL_SGRO: |
1954 | rc = ethtool_set_one_feature(dev, useraddr, ethcmd); | 2115 | rc = ethtool_set_one_feature(dev, useraddr, ethcmd); |
1955 | break; | 2116 | break; |
2117 | case ETHTOOL_GCHANNELS: | ||
2118 | rc = ethtool_get_channels(dev, useraddr); | ||
2119 | break; | ||
2120 | case ETHTOOL_SCHANNELS: | ||
2121 | rc = ethtool_set_channels(dev, useraddr); | ||
2122 | break; | ||
2123 | case ETHTOOL_SET_DUMP: | ||
2124 | rc = ethtool_set_dump(dev, useraddr); | ||
2125 | break; | ||
2126 | case ETHTOOL_GET_DUMP_FLAG: | ||
2127 | rc = ethtool_get_dump_flag(dev, useraddr); | ||
2128 | break; | ||
2129 | case ETHTOOL_GET_DUMP_DATA: | ||
2130 | rc = ethtool_get_dump_data(dev, useraddr); | ||
2131 | break; | ||
1956 | default: | 2132 | default: |
1957 | rc = -EOPNOTSUPP; | 2133 | rc = -EOPNOTSUPP; |
1958 | } | 2134 | } |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 8248ebb5891d..3911586e12e4 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -590,7 +590,8 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb, | |||
590 | int idx = 0; | 590 | int idx = 0; |
591 | struct fib_rule *rule; | 591 | struct fib_rule *rule; |
592 | 592 | ||
593 | list_for_each_entry(rule, &ops->rules_list, list) { | 593 | rcu_read_lock(); |
594 | list_for_each_entry_rcu(rule, &ops->rules_list, list) { | ||
594 | if (idx < cb->args[1]) | 595 | if (idx < cb->args[1]) |
595 | goto skip; | 596 | goto skip; |
596 | 597 | ||
diff --git a/net/core/filter.c b/net/core/filter.c index afb8afb066bb..0eb8c4466eaa 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -39,65 +39,6 @@ | |||
39 | #include <linux/filter.h> | 39 | #include <linux/filter.h> |
40 | #include <linux/reciprocal_div.h> | 40 | #include <linux/reciprocal_div.h> |
41 | 41 | ||
42 | enum { | ||
43 | BPF_S_RET_K = 1, | ||
44 | BPF_S_RET_A, | ||
45 | BPF_S_ALU_ADD_K, | ||
46 | BPF_S_ALU_ADD_X, | ||
47 | BPF_S_ALU_SUB_K, | ||
48 | BPF_S_ALU_SUB_X, | ||
49 | BPF_S_ALU_MUL_K, | ||
50 | BPF_S_ALU_MUL_X, | ||
51 | BPF_S_ALU_DIV_X, | ||
52 | BPF_S_ALU_AND_K, | ||
53 | BPF_S_ALU_AND_X, | ||
54 | BPF_S_ALU_OR_K, | ||
55 | BPF_S_ALU_OR_X, | ||
56 | BPF_S_ALU_LSH_K, | ||
57 | BPF_S_ALU_LSH_X, | ||
58 | BPF_S_ALU_RSH_K, | ||
59 | BPF_S_ALU_RSH_X, | ||
60 | BPF_S_ALU_NEG, | ||
61 | BPF_S_LD_W_ABS, | ||
62 | BPF_S_LD_H_ABS, | ||
63 | BPF_S_LD_B_ABS, | ||
64 | BPF_S_LD_W_LEN, | ||
65 | BPF_S_LD_W_IND, | ||
66 | BPF_S_LD_H_IND, | ||
67 | BPF_S_LD_B_IND, | ||
68 | BPF_S_LD_IMM, | ||
69 | BPF_S_LDX_W_LEN, | ||
70 | BPF_S_LDX_B_MSH, | ||
71 | BPF_S_LDX_IMM, | ||
72 | BPF_S_MISC_TAX, | ||
73 | BPF_S_MISC_TXA, | ||
74 | BPF_S_ALU_DIV_K, | ||
75 | BPF_S_LD_MEM, | ||
76 | BPF_S_LDX_MEM, | ||
77 | BPF_S_ST, | ||
78 | BPF_S_STX, | ||
79 | BPF_S_JMP_JA, | ||
80 | BPF_S_JMP_JEQ_K, | ||
81 | BPF_S_JMP_JEQ_X, | ||
82 | BPF_S_JMP_JGE_K, | ||
83 | BPF_S_JMP_JGE_X, | ||
84 | BPF_S_JMP_JGT_K, | ||
85 | BPF_S_JMP_JGT_X, | ||
86 | BPF_S_JMP_JSET_K, | ||
87 | BPF_S_JMP_JSET_X, | ||
88 | /* Ancillary data */ | ||
89 | BPF_S_ANC_PROTOCOL, | ||
90 | BPF_S_ANC_PKTTYPE, | ||
91 | BPF_S_ANC_IFINDEX, | ||
92 | BPF_S_ANC_NLATTR, | ||
93 | BPF_S_ANC_NLATTR_NEST, | ||
94 | BPF_S_ANC_MARK, | ||
95 | BPF_S_ANC_QUEUE, | ||
96 | BPF_S_ANC_HATYPE, | ||
97 | BPF_S_ANC_RXHASH, | ||
98 | BPF_S_ANC_CPU, | ||
99 | }; | ||
100 | |||
101 | /* No hurry in this branch */ | 42 | /* No hurry in this branch */ |
102 | static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size) | 43 | static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size) |
103 | { | 44 | { |
@@ -145,7 +86,7 @@ int sk_filter(struct sock *sk, struct sk_buff *skb) | |||
145 | rcu_read_lock(); | 86 | rcu_read_lock(); |
146 | filter = rcu_dereference(sk->sk_filter); | 87 | filter = rcu_dereference(sk->sk_filter); |
147 | if (filter) { | 88 | if (filter) { |
148 | unsigned int pkt_len = sk_run_filter(skb, filter->insns); | 89 | unsigned int pkt_len = SK_RUN_FILTER(filter, skb); |
149 | 90 | ||
150 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; | 91 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; |
151 | } | 92 | } |
@@ -638,6 +579,7 @@ void sk_filter_release_rcu(struct rcu_head *rcu) | |||
638 | { | 579 | { |
639 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); | 580 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); |
640 | 581 | ||
582 | bpf_jit_free(fp); | ||
641 | kfree(fp); | 583 | kfree(fp); |
642 | } | 584 | } |
643 | EXPORT_SYMBOL(sk_filter_release_rcu); | 585 | EXPORT_SYMBOL(sk_filter_release_rcu); |
@@ -672,6 +614,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) | |||
672 | 614 | ||
673 | atomic_set(&fp->refcnt, 1); | 615 | atomic_set(&fp->refcnt, 1); |
674 | fp->len = fprog->len; | 616 | fp->len = fprog->len; |
617 | fp->bpf_func = sk_run_filter; | ||
675 | 618 | ||
676 | err = sk_chk_filter(fp->insns, fp->len); | 619 | err = sk_chk_filter(fp->insns, fp->len); |
677 | if (err) { | 620 | if (err) { |
@@ -679,6 +622,8 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) | |||
679 | return err; | 622 | return err; |
680 | } | 623 | } |
681 | 624 | ||
625 | bpf_jit_compile(fp); | ||
626 | |||
682 | old_fp = rcu_dereference_protected(sk->sk_filter, | 627 | old_fp = rcu_dereference_protected(sk->sk_filter, |
683 | sock_owned_by_user(sk)); | 628 | sock_owned_by_user(sk)); |
684 | rcu_assign_pointer(sk->sk_filter, fp); | 629 | rcu_assign_pointer(sk->sk_filter, fp); |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 80b2aad3b73d..11b98bc2aa8f 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -28,6 +28,7 @@ | |||
28 | static const char fmt_hex[] = "%#x\n"; | 28 | static const char fmt_hex[] = "%#x\n"; |
29 | static const char fmt_long_hex[] = "%#lx\n"; | 29 | static const char fmt_long_hex[] = "%#lx\n"; |
30 | static const char fmt_dec[] = "%d\n"; | 30 | static const char fmt_dec[] = "%d\n"; |
31 | static const char fmt_udec[] = "%u\n"; | ||
31 | static const char fmt_ulong[] = "%lu\n"; | 32 | static const char fmt_ulong[] = "%lu\n"; |
32 | static const char fmt_u64[] = "%llu\n"; | 33 | static const char fmt_u64[] = "%llu\n"; |
33 | 34 | ||
@@ -145,13 +146,10 @@ static ssize_t show_speed(struct device *dev, | |||
145 | if (!rtnl_trylock()) | 146 | if (!rtnl_trylock()) |
146 | return restart_syscall(); | 147 | return restart_syscall(); |
147 | 148 | ||
148 | if (netif_running(netdev) && | 149 | if (netif_running(netdev)) { |
149 | netdev->ethtool_ops && | 150 | struct ethtool_cmd cmd; |
150 | netdev->ethtool_ops->get_settings) { | 151 | if (!dev_ethtool_get_settings(netdev, &cmd)) |
151 | struct ethtool_cmd cmd = { ETHTOOL_GSET }; | 152 | ret = sprintf(buf, fmt_udec, ethtool_cmd_speed(&cmd)); |
152 | |||
153 | if (!netdev->ethtool_ops->get_settings(netdev, &cmd)) | ||
154 | ret = sprintf(buf, fmt_dec, ethtool_cmd_speed(&cmd)); | ||
155 | } | 153 | } |
156 | rtnl_unlock(); | 154 | rtnl_unlock(); |
157 | return ret; | 155 | return ret; |
@@ -166,13 +164,11 @@ static ssize_t show_duplex(struct device *dev, | |||
166 | if (!rtnl_trylock()) | 164 | if (!rtnl_trylock()) |
167 | return restart_syscall(); | 165 | return restart_syscall(); |
168 | 166 | ||
169 | if (netif_running(netdev) && | 167 | if (netif_running(netdev)) { |
170 | netdev->ethtool_ops && | 168 | struct ethtool_cmd cmd; |
171 | netdev->ethtool_ops->get_settings) { | 169 | if (!dev_ethtool_get_settings(netdev, &cmd)) |
172 | struct ethtool_cmd cmd = { ETHTOOL_GSET }; | 170 | ret = sprintf(buf, "%s\n", |
173 | 171 | cmd.duplex ? "full" : "half"); | |
174 | if (!netdev->ethtool_ops->get_settings(netdev, &cmd)) | ||
175 | ret = sprintf(buf, "%s\n", cmd.duplex ? "full" : "half"); | ||
176 | } | 172 | } |
177 | rtnl_unlock(); | 173 | rtnl_unlock(); |
178 | return ret; | 174 | return ret; |
@@ -946,7 +942,7 @@ static ssize_t store_xps_map(struct netdev_queue *queue, | |||
946 | } else | 942 | } else |
947 | pos = map_len = alloc_len = 0; | 943 | pos = map_len = alloc_len = 0; |
948 | 944 | ||
949 | need_set = cpu_isset(cpu, *mask) && cpu_online(cpu); | 945 | need_set = cpumask_test_cpu(cpu, mask) && cpu_online(cpu); |
950 | #ifdef CONFIG_NUMA | 946 | #ifdef CONFIG_NUMA |
951 | if (need_set) { | 947 | if (need_set) { |
952 | if (numa_node == -2) | 948 | if (numa_node == -2) |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 297bb9272240..2e2dce6583e1 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -208,11 +208,14 @@ static void net_free(struct net *net) | |||
208 | kmem_cache_free(net_cachep, net); | 208 | kmem_cache_free(net_cachep, net); |
209 | } | 209 | } |
210 | 210 | ||
211 | static struct net *net_create(void) | 211 | struct net *copy_net_ns(unsigned long flags, struct net *old_net) |
212 | { | 212 | { |
213 | struct net *net; | 213 | struct net *net; |
214 | int rv; | 214 | int rv; |
215 | 215 | ||
216 | if (!(flags & CLONE_NEWNET)) | ||
217 | return get_net(old_net); | ||
218 | |||
216 | net = net_alloc(); | 219 | net = net_alloc(); |
217 | if (!net) | 220 | if (!net) |
218 | return ERR_PTR(-ENOMEM); | 221 | return ERR_PTR(-ENOMEM); |
@@ -231,13 +234,6 @@ static struct net *net_create(void) | |||
231 | return net; | 234 | return net; |
232 | } | 235 | } |
233 | 236 | ||
234 | struct net *copy_net_ns(unsigned long flags, struct net *old_net) | ||
235 | { | ||
236 | if (!(flags & CLONE_NEWNET)) | ||
237 | return get_net(old_net); | ||
238 | return net_create(); | ||
239 | } | ||
240 | |||
241 | static DEFINE_SPINLOCK(cleanup_list_lock); | 237 | static DEFINE_SPINLOCK(cleanup_list_lock); |
242 | static LIST_HEAD(cleanup_list); /* Must hold cleanup_list_lock to touch */ | 238 | static LIST_HEAD(cleanup_list); /* Must hold cleanup_list_lock to touch */ |
243 | 239 | ||
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 06be2431753e..2d7d6d473781 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -539,7 +539,7 @@ int __netpoll_rx(struct sk_buff *skb) | |||
539 | { | 539 | { |
540 | int proto, len, ulen; | 540 | int proto, len, ulen; |
541 | int hits = 0; | 541 | int hits = 0; |
542 | struct iphdr *iph; | 542 | const struct iphdr *iph; |
543 | struct udphdr *uh; | 543 | struct udphdr *uh; |
544 | struct netpoll_info *npinfo = skb->dev->npinfo; | 544 | struct netpoll_info *npinfo = skb->dev->npinfo; |
545 | struct netpoll *np, *tmp; | 545 | struct netpoll *np, *tmp; |
@@ -698,32 +698,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt) | |||
698 | 698 | ||
699 | if (*cur != 0) { | 699 | if (*cur != 0) { |
700 | /* MAC address */ | 700 | /* MAC address */ |
701 | if ((delim = strchr(cur, ':')) == NULL) | 701 | if (!mac_pton(cur, np->remote_mac)) |
702 | goto parse_failed; | ||
703 | *delim = 0; | ||
704 | np->remote_mac[0] = simple_strtol(cur, NULL, 16); | ||
705 | cur = delim + 1; | ||
706 | if ((delim = strchr(cur, ':')) == NULL) | ||
707 | goto parse_failed; | ||
708 | *delim = 0; | ||
709 | np->remote_mac[1] = simple_strtol(cur, NULL, 16); | ||
710 | cur = delim + 1; | ||
711 | if ((delim = strchr(cur, ':')) == NULL) | ||
712 | goto parse_failed; | 702 | goto parse_failed; |
713 | *delim = 0; | ||
714 | np->remote_mac[2] = simple_strtol(cur, NULL, 16); | ||
715 | cur = delim + 1; | ||
716 | if ((delim = strchr(cur, ':')) == NULL) | ||
717 | goto parse_failed; | ||
718 | *delim = 0; | ||
719 | np->remote_mac[3] = simple_strtol(cur, NULL, 16); | ||
720 | cur = delim + 1; | ||
721 | if ((delim = strchr(cur, ':')) == NULL) | ||
722 | goto parse_failed; | ||
723 | *delim = 0; | ||
724 | np->remote_mac[4] = simple_strtol(cur, NULL, 16); | ||
725 | cur = delim + 1; | ||
726 | np->remote_mac[5] = simple_strtol(cur, NULL, 16); | ||
727 | } | 703 | } |
728 | 704 | ||
729 | netpoll_print_options(np); | 705 | netpoll_print_options(np); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 6ed9e27d8202..67870e9fd097 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -450,7 +450,6 @@ static void pktgen_stop(struct pktgen_thread *t); | |||
450 | static void pktgen_clear_counters(struct pktgen_dev *pkt_dev); | 450 | static void pktgen_clear_counters(struct pktgen_dev *pkt_dev); |
451 | 451 | ||
452 | static unsigned int scan_ip6(const char *s, char ip[16]); | 452 | static unsigned int scan_ip6(const char *s, char ip[16]); |
453 | static unsigned int fmt_ip6(char *s, const char ip[16]); | ||
454 | 453 | ||
455 | /* Module parameters, defaults. */ | 454 | /* Module parameters, defaults. */ |
456 | static int pg_count_d __read_mostly = 1000; | 455 | static int pg_count_d __read_mostly = 1000; |
@@ -557,21 +556,13 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
557 | pkt_dev->skb_priority); | 556 | pkt_dev->skb_priority); |
558 | 557 | ||
559 | if (pkt_dev->flags & F_IPV6) { | 558 | if (pkt_dev->flags & F_IPV6) { |
560 | char b1[128], b2[128], b3[128]; | ||
561 | fmt_ip6(b1, pkt_dev->in6_saddr.s6_addr); | ||
562 | fmt_ip6(b2, pkt_dev->min_in6_saddr.s6_addr); | ||
563 | fmt_ip6(b3, pkt_dev->max_in6_saddr.s6_addr); | ||
564 | seq_printf(seq, | 559 | seq_printf(seq, |
565 | " saddr: %s min_saddr: %s max_saddr: %s\n", b1, | 560 | " saddr: %pI6c min_saddr: %pI6c max_saddr: %pI6c\n" |
566 | b2, b3); | 561 | " daddr: %pI6c min_daddr: %pI6c max_daddr: %pI6c\n", |
567 | 562 | &pkt_dev->in6_saddr, | |
568 | fmt_ip6(b1, pkt_dev->in6_daddr.s6_addr); | 563 | &pkt_dev->min_in6_saddr, &pkt_dev->max_in6_saddr, |
569 | fmt_ip6(b2, pkt_dev->min_in6_daddr.s6_addr); | 564 | &pkt_dev->in6_daddr, |
570 | fmt_ip6(b3, pkt_dev->max_in6_daddr.s6_addr); | 565 | &pkt_dev->min_in6_daddr, &pkt_dev->max_in6_daddr); |
571 | seq_printf(seq, | ||
572 | " daddr: %s min_daddr: %s max_daddr: %s\n", b1, | ||
573 | b2, b3); | ||
574 | |||
575 | } else { | 566 | } else { |
576 | seq_printf(seq, | 567 | seq_printf(seq, |
577 | " dst_min: %s dst_max: %s\n", | 568 | " dst_min: %s dst_max: %s\n", |
@@ -707,10 +698,9 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
707 | pkt_dev->cur_src_mac_offset); | 698 | pkt_dev->cur_src_mac_offset); |
708 | 699 | ||
709 | if (pkt_dev->flags & F_IPV6) { | 700 | if (pkt_dev->flags & F_IPV6) { |
710 | char b1[128], b2[128]; | 701 | seq_printf(seq, " cur_saddr: %pI6c cur_daddr: %pI6c\n", |
711 | fmt_ip6(b1, pkt_dev->cur_in6_daddr.s6_addr); | 702 | &pkt_dev->cur_in6_saddr, |
712 | fmt_ip6(b2, pkt_dev->cur_in6_saddr.s6_addr); | 703 | &pkt_dev->cur_in6_daddr); |
713 | seq_printf(seq, " cur_saddr: %s cur_daddr: %s\n", b2, b1); | ||
714 | } else | 704 | } else |
715 | seq_printf(seq, " cur_saddr: 0x%x cur_daddr: 0x%x\n", | 705 | seq_printf(seq, " cur_saddr: 0x%x cur_daddr: 0x%x\n", |
716 | pkt_dev->cur_saddr, pkt_dev->cur_daddr); | 706 | pkt_dev->cur_saddr, pkt_dev->cur_daddr); |
@@ -1310,7 +1300,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1310 | buf[len] = 0; | 1300 | buf[len] = 0; |
1311 | 1301 | ||
1312 | scan_ip6(buf, pkt_dev->in6_daddr.s6_addr); | 1302 | scan_ip6(buf, pkt_dev->in6_daddr.s6_addr); |
1313 | fmt_ip6(buf, pkt_dev->in6_daddr.s6_addr); | 1303 | snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->in6_daddr); |
1314 | 1304 | ||
1315 | ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr); | 1305 | ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr); |
1316 | 1306 | ||
@@ -1333,7 +1323,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1333 | buf[len] = 0; | 1323 | buf[len] = 0; |
1334 | 1324 | ||
1335 | scan_ip6(buf, pkt_dev->min_in6_daddr.s6_addr); | 1325 | scan_ip6(buf, pkt_dev->min_in6_daddr.s6_addr); |
1336 | fmt_ip6(buf, pkt_dev->min_in6_daddr.s6_addr); | 1326 | snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->min_in6_daddr); |
1337 | 1327 | ||
1338 | ipv6_addr_copy(&pkt_dev->cur_in6_daddr, | 1328 | ipv6_addr_copy(&pkt_dev->cur_in6_daddr, |
1339 | &pkt_dev->min_in6_daddr); | 1329 | &pkt_dev->min_in6_daddr); |
@@ -1356,7 +1346,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1356 | buf[len] = 0; | 1346 | buf[len] = 0; |
1357 | 1347 | ||
1358 | scan_ip6(buf, pkt_dev->max_in6_daddr.s6_addr); | 1348 | scan_ip6(buf, pkt_dev->max_in6_daddr.s6_addr); |
1359 | fmt_ip6(buf, pkt_dev->max_in6_daddr.s6_addr); | 1349 | snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->max_in6_daddr); |
1360 | 1350 | ||
1361 | if (debug) | 1351 | if (debug) |
1362 | printk(KERN_DEBUG "pktgen: dst6_max set to: %s\n", buf); | 1352 | printk(KERN_DEBUG "pktgen: dst6_max set to: %s\n", buf); |
@@ -1377,7 +1367,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1377 | buf[len] = 0; | 1367 | buf[len] = 0; |
1378 | 1368 | ||
1379 | scan_ip6(buf, pkt_dev->in6_saddr.s6_addr); | 1369 | scan_ip6(buf, pkt_dev->in6_saddr.s6_addr); |
1380 | fmt_ip6(buf, pkt_dev->in6_saddr.s6_addr); | 1370 | snprintf(buf, sizeof(buf), "%pI6c", &pkt_dev->in6_saddr); |
1381 | 1371 | ||
1382 | ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr); | 1372 | ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr); |
1383 | 1373 | ||
@@ -1431,11 +1421,6 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1431 | return count; | 1421 | return count; |
1432 | } | 1422 | } |
1433 | if (!strcmp(name, "dst_mac")) { | 1423 | if (!strcmp(name, "dst_mac")) { |
1434 | char *v = valstr; | ||
1435 | unsigned char old_dmac[ETH_ALEN]; | ||
1436 | unsigned char *m = pkt_dev->dst_mac; | ||
1437 | memcpy(old_dmac, pkt_dev->dst_mac, ETH_ALEN); | ||
1438 | |||
1439 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); | 1424 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); |
1440 | if (len < 0) | 1425 | if (len < 0) |
1441 | return len; | 1426 | return len; |
@@ -1443,35 +1428,16 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1443 | memset(valstr, 0, sizeof(valstr)); | 1428 | memset(valstr, 0, sizeof(valstr)); |
1444 | if (copy_from_user(valstr, &user_buffer[i], len)) | 1429 | if (copy_from_user(valstr, &user_buffer[i], len)) |
1445 | return -EFAULT; | 1430 | return -EFAULT; |
1446 | i += len; | ||
1447 | |||
1448 | for (*m = 0; *v && m < pkt_dev->dst_mac + 6; v++) { | ||
1449 | int value; | ||
1450 | |||
1451 | value = hex_to_bin(*v); | ||
1452 | if (value >= 0) | ||
1453 | *m = *m * 16 + value; | ||
1454 | |||
1455 | if (*v == ':') { | ||
1456 | m++; | ||
1457 | *m = 0; | ||
1458 | } | ||
1459 | } | ||
1460 | 1431 | ||
1432 | if (!mac_pton(valstr, pkt_dev->dst_mac)) | ||
1433 | return -EINVAL; | ||
1461 | /* Set up Dest MAC */ | 1434 | /* Set up Dest MAC */ |
1462 | if (compare_ether_addr(old_dmac, pkt_dev->dst_mac)) | 1435 | memcpy(&pkt_dev->hh[0], pkt_dev->dst_mac, ETH_ALEN); |
1463 | memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN); | ||
1464 | 1436 | ||
1465 | sprintf(pg_result, "OK: dstmac"); | 1437 | sprintf(pg_result, "OK: dstmac %pM", pkt_dev->dst_mac); |
1466 | return count; | 1438 | return count; |
1467 | } | 1439 | } |
1468 | if (!strcmp(name, "src_mac")) { | 1440 | if (!strcmp(name, "src_mac")) { |
1469 | char *v = valstr; | ||
1470 | unsigned char old_smac[ETH_ALEN]; | ||
1471 | unsigned char *m = pkt_dev->src_mac; | ||
1472 | |||
1473 | memcpy(old_smac, pkt_dev->src_mac, ETH_ALEN); | ||
1474 | |||
1475 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); | 1441 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); |
1476 | if (len < 0) | 1442 | if (len < 0) |
1477 | return len; | 1443 | return len; |
@@ -1479,26 +1445,13 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1479 | memset(valstr, 0, sizeof(valstr)); | 1445 | memset(valstr, 0, sizeof(valstr)); |
1480 | if (copy_from_user(valstr, &user_buffer[i], len)) | 1446 | if (copy_from_user(valstr, &user_buffer[i], len)) |
1481 | return -EFAULT; | 1447 | return -EFAULT; |
1482 | i += len; | ||
1483 | |||
1484 | for (*m = 0; *v && m < pkt_dev->src_mac + 6; v++) { | ||
1485 | int value; | ||
1486 | |||
1487 | value = hex_to_bin(*v); | ||
1488 | if (value >= 0) | ||
1489 | *m = *m * 16 + value; | ||
1490 | |||
1491 | if (*v == ':') { | ||
1492 | m++; | ||
1493 | *m = 0; | ||
1494 | } | ||
1495 | } | ||
1496 | 1448 | ||
1449 | if (!mac_pton(valstr, pkt_dev->src_mac)) | ||
1450 | return -EINVAL; | ||
1497 | /* Set up Src MAC */ | 1451 | /* Set up Src MAC */ |
1498 | if (compare_ether_addr(old_smac, pkt_dev->src_mac)) | 1452 | memcpy(&pkt_dev->hh[6], pkt_dev->src_mac, ETH_ALEN); |
1499 | memcpy(&(pkt_dev->hh[6]), pkt_dev->src_mac, ETH_ALEN); | ||
1500 | 1453 | ||
1501 | sprintf(pg_result, "OK: srcmac"); | 1454 | sprintf(pg_result, "OK: srcmac %pM", pkt_dev->src_mac); |
1502 | return count; | 1455 | return count; |
1503 | } | 1456 | } |
1504 | 1457 | ||
@@ -2515,7 +2468,6 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev) | |||
2515 | { | 2468 | { |
2516 | struct xfrm_state *x = pkt_dev->flows[pkt_dev->curfl].x; | 2469 | struct xfrm_state *x = pkt_dev->flows[pkt_dev->curfl].x; |
2517 | int err = 0; | 2470 | int err = 0; |
2518 | struct iphdr *iph; | ||
2519 | 2471 | ||
2520 | if (!x) | 2472 | if (!x) |
2521 | return 0; | 2473 | return 0; |
@@ -2525,7 +2477,6 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev) | |||
2525 | return 0; | 2477 | return 0; |
2526 | 2478 | ||
2527 | spin_lock(&x->lock); | 2479 | spin_lock(&x->lock); |
2528 | iph = ip_hdr(skb); | ||
2529 | 2480 | ||
2530 | err = x->outer_mode->output(x, skb); | 2481 | err = x->outer_mode->output(x, skb); |
2531 | if (err) | 2482 | if (err) |
@@ -2625,6 +2576,7 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb, | |||
2625 | } else { | 2576 | } else { |
2626 | int frags = pkt_dev->nfrags; | 2577 | int frags = pkt_dev->nfrags; |
2627 | int i, len; | 2578 | int i, len; |
2579 | int frag_len; | ||
2628 | 2580 | ||
2629 | 2581 | ||
2630 | if (frags > MAX_SKB_FRAGS) | 2582 | if (frags > MAX_SKB_FRAGS) |
@@ -2636,6 +2588,8 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb, | |||
2636 | } | 2588 | } |
2637 | 2589 | ||
2638 | i = 0; | 2590 | i = 0; |
2591 | frag_len = (datalen/frags) < PAGE_SIZE ? | ||
2592 | (datalen/frags) : PAGE_SIZE; | ||
2639 | while (datalen > 0) { | 2593 | while (datalen > 0) { |
2640 | if (unlikely(!pkt_dev->page)) { | 2594 | if (unlikely(!pkt_dev->page)) { |
2641 | int node = numa_node_id(); | 2595 | int node = numa_node_id(); |
@@ -2649,38 +2603,18 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb, | |||
2649 | skb_shinfo(skb)->frags[i].page = pkt_dev->page; | 2603 | skb_shinfo(skb)->frags[i].page = pkt_dev->page; |
2650 | get_page(pkt_dev->page); | 2604 | get_page(pkt_dev->page); |
2651 | skb_shinfo(skb)->frags[i].page_offset = 0; | 2605 | skb_shinfo(skb)->frags[i].page_offset = 0; |
2652 | skb_shinfo(skb)->frags[i].size = | 2606 | /*last fragment, fill rest of data*/ |
2653 | (datalen < PAGE_SIZE ? datalen : PAGE_SIZE); | 2607 | if (i == (frags - 1)) |
2608 | skb_shinfo(skb)->frags[i].size = | ||
2609 | (datalen < PAGE_SIZE ? datalen : PAGE_SIZE); | ||
2610 | else | ||
2611 | skb_shinfo(skb)->frags[i].size = frag_len; | ||
2654 | datalen -= skb_shinfo(skb)->frags[i].size; | 2612 | datalen -= skb_shinfo(skb)->frags[i].size; |
2655 | skb->len += skb_shinfo(skb)->frags[i].size; | 2613 | skb->len += skb_shinfo(skb)->frags[i].size; |
2656 | skb->data_len += skb_shinfo(skb)->frags[i].size; | 2614 | skb->data_len += skb_shinfo(skb)->frags[i].size; |
2657 | i++; | 2615 | i++; |
2658 | skb_shinfo(skb)->nr_frags = i; | 2616 | skb_shinfo(skb)->nr_frags = i; |
2659 | } | 2617 | } |
2660 | |||
2661 | while (i < frags) { | ||
2662 | int rem; | ||
2663 | |||
2664 | if (i == 0) | ||
2665 | break; | ||
2666 | |||
2667 | rem = skb_shinfo(skb)->frags[i - 1].size / 2; | ||
2668 | if (rem == 0) | ||
2669 | break; | ||
2670 | |||
2671 | skb_shinfo(skb)->frags[i - 1].size -= rem; | ||
2672 | |||
2673 | skb_shinfo(skb)->frags[i] = | ||
2674 | skb_shinfo(skb)->frags[i - 1]; | ||
2675 | get_page(skb_shinfo(skb)->frags[i].page); | ||
2676 | skb_shinfo(skb)->frags[i].page = | ||
2677 | skb_shinfo(skb)->frags[i - 1].page; | ||
2678 | skb_shinfo(skb)->frags[i].page_offset += | ||
2679 | skb_shinfo(skb)->frags[i - 1].size; | ||
2680 | skb_shinfo(skb)->frags[i].size = rem; | ||
2681 | i++; | ||
2682 | skb_shinfo(skb)->nr_frags = i; | ||
2683 | } | ||
2684 | } | 2618 | } |
2685 | 2619 | ||
2686 | /* Stamp the time, and sequence number, | 2620 | /* Stamp the time, and sequence number, |
@@ -2918,79 +2852,6 @@ static unsigned int scan_ip6(const char *s, char ip[16]) | |||
2918 | return len; | 2852 | return len; |
2919 | } | 2853 | } |
2920 | 2854 | ||
2921 | static char tohex(char hexdigit) | ||
2922 | { | ||
2923 | return hexdigit > 9 ? hexdigit + 'a' - 10 : hexdigit + '0'; | ||
2924 | } | ||
2925 | |||
2926 | static int fmt_xlong(char *s, unsigned int i) | ||
2927 | { | ||
2928 | char *bak = s; | ||
2929 | *s = tohex((i >> 12) & 0xf); | ||
2930 | if (s != bak || *s != '0') | ||
2931 | ++s; | ||
2932 | *s = tohex((i >> 8) & 0xf); | ||
2933 | if (s != bak || *s != '0') | ||
2934 | ++s; | ||
2935 | *s = tohex((i >> 4) & 0xf); | ||
2936 | if (s != bak || *s != '0') | ||
2937 | ++s; | ||
2938 | *s = tohex(i & 0xf); | ||
2939 | return s - bak + 1; | ||
2940 | } | ||
2941 | |||
2942 | static unsigned int fmt_ip6(char *s, const char ip[16]) | ||
2943 | { | ||
2944 | unsigned int len; | ||
2945 | unsigned int i; | ||
2946 | unsigned int temp; | ||
2947 | unsigned int compressing; | ||
2948 | int j; | ||
2949 | |||
2950 | len = 0; | ||
2951 | compressing = 0; | ||
2952 | for (j = 0; j < 16; j += 2) { | ||
2953 | |||
2954 | #ifdef V4MAPPEDPREFIX | ||
2955 | if (j == 12 && !memcmp(ip, V4mappedprefix, 12)) { | ||
2956 | inet_ntoa_r(*(struct in_addr *)(ip + 12), s); | ||
2957 | temp = strlen(s); | ||
2958 | return len + temp; | ||
2959 | } | ||
2960 | #endif | ||
2961 | temp = ((unsigned long)(unsigned char)ip[j] << 8) + | ||
2962 | (unsigned long)(unsigned char)ip[j + 1]; | ||
2963 | if (temp == 0) { | ||
2964 | if (!compressing) { | ||
2965 | compressing = 1; | ||
2966 | if (j == 0) { | ||
2967 | *s++ = ':'; | ||
2968 | ++len; | ||
2969 | } | ||
2970 | } | ||
2971 | } else { | ||
2972 | if (compressing) { | ||
2973 | compressing = 0; | ||
2974 | *s++ = ':'; | ||
2975 | ++len; | ||
2976 | } | ||
2977 | i = fmt_xlong(s, temp); | ||
2978 | len += i; | ||
2979 | s += i; | ||
2980 | if (j < 14) { | ||
2981 | *s++ = ':'; | ||
2982 | ++len; | ||
2983 | } | ||
2984 | } | ||
2985 | } | ||
2986 | if (compressing) { | ||
2987 | *s++ = ':'; | ||
2988 | ++len; | ||
2989 | } | ||
2990 | *s = 0; | ||
2991 | return len; | ||
2992 | } | ||
2993 | |||
2994 | static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | 2855 | static struct sk_buff *fill_packet_ipv6(struct net_device *odev, |
2995 | struct pktgen_dev *pkt_dev) | 2856 | struct pktgen_dev *pkt_dev) |
2996 | { | 2857 | { |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index d7c4bb4b1820..d2ba2597c75a 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1007,10 +1007,11 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
1007 | s_h = cb->args[0]; | 1007 | s_h = cb->args[0]; |
1008 | s_idx = cb->args[1]; | 1008 | s_idx = cb->args[1]; |
1009 | 1009 | ||
1010 | rcu_read_lock(); | ||
1010 | for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { | 1011 | for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { |
1011 | idx = 0; | 1012 | idx = 0; |
1012 | head = &net->dev_index_head[h]; | 1013 | head = &net->dev_index_head[h]; |
1013 | hlist_for_each_entry(dev, node, head, index_hlist) { | 1014 | hlist_for_each_entry_rcu(dev, node, head, index_hlist) { |
1014 | if (idx < s_idx) | 1015 | if (idx < s_idx) |
1015 | goto cont; | 1016 | goto cont; |
1016 | if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK, | 1017 | if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK, |
@@ -1023,6 +1024,7 @@ cont: | |||
1023 | } | 1024 | } |
1024 | } | 1025 | } |
1025 | out: | 1026 | out: |
1027 | rcu_read_unlock(); | ||
1026 | cb->args[1] = idx; | 1028 | cb->args[1] = idx; |
1027 | cb->args[0] = h; | 1029 | cb->args[0] = h; |
1028 | 1030 | ||
@@ -1499,6 +1501,7 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
1499 | char ifname[IFNAMSIZ]; | 1501 | char ifname[IFNAMSIZ]; |
1500 | struct nlattr *tb[IFLA_MAX+1]; | 1502 | struct nlattr *tb[IFLA_MAX+1]; |
1501 | int err; | 1503 | int err; |
1504 | LIST_HEAD(list_kill); | ||
1502 | 1505 | ||
1503 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); | 1506 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); |
1504 | if (err < 0) | 1507 | if (err < 0) |
@@ -1522,7 +1525,9 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
1522 | if (!ops) | 1525 | if (!ops) |
1523 | return -EOPNOTSUPP; | 1526 | return -EOPNOTSUPP; |
1524 | 1527 | ||
1525 | ops->dellink(dev, NULL); | 1528 | ops->dellink(dev, &list_kill); |
1529 | unregister_netdevice_many(&list_kill); | ||
1530 | list_del(&list_kill); | ||
1526 | return 0; | 1531 | return 0; |
1527 | } | 1532 | } |
1528 | 1533 | ||
@@ -1570,12 +1575,6 @@ struct net_device *rtnl_create_link(struct net *src_net, struct net *net, | |||
1570 | dev->rtnl_link_state = RTNL_LINK_INITIALIZING; | 1575 | dev->rtnl_link_state = RTNL_LINK_INITIALIZING; |
1571 | dev->real_num_tx_queues = real_num_queues; | 1576 | dev->real_num_tx_queues = real_num_queues; |
1572 | 1577 | ||
1573 | if (strchr(dev->name, '%')) { | ||
1574 | err = dev_alloc_name(dev, dev->name); | ||
1575 | if (err < 0) | ||
1576 | goto err_free; | ||
1577 | } | ||
1578 | |||
1579 | if (tb[IFLA_MTU]) | 1578 | if (tb[IFLA_MTU]) |
1580 | dev->mtu = nla_get_u32(tb[IFLA_MTU]); | 1579 | dev->mtu = nla_get_u32(tb[IFLA_MTU]); |
1581 | if (tb[IFLA_ADDRESS]) | 1580 | if (tb[IFLA_ADDRESS]) |
@@ -1595,8 +1594,6 @@ struct net_device *rtnl_create_link(struct net *src_net, struct net *net, | |||
1595 | 1594 | ||
1596 | return dev; | 1595 | return dev; |
1597 | 1596 | ||
1598 | err_free: | ||
1599 | free_netdev(dev); | ||
1600 | err: | 1597 | err: |
1601 | return ERR_PTR(err); | 1598 | return ERR_PTR(err); |
1602 | } | 1599 | } |
@@ -1879,7 +1876,6 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
1879 | int min_len; | 1876 | int min_len; |
1880 | int family; | 1877 | int family; |
1881 | int type; | 1878 | int type; |
1882 | int err; | ||
1883 | 1879 | ||
1884 | type = nlh->nlmsg_type; | 1880 | type = nlh->nlmsg_type; |
1885 | if (type > RTM_MAX) | 1881 | if (type > RTM_MAX) |
@@ -1906,11 +1902,8 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
1906 | if (dumpit == NULL) | 1902 | if (dumpit == NULL) |
1907 | return -EOPNOTSUPP; | 1903 | return -EOPNOTSUPP; |
1908 | 1904 | ||
1909 | __rtnl_unlock(); | ||
1910 | rtnl = net->rtnl; | 1905 | rtnl = net->rtnl; |
1911 | err = netlink_dump_start(rtnl, skb, nlh, dumpit, NULL); | 1906 | return netlink_dump_start(rtnl, skb, nlh, dumpit, NULL); |
1912 | rtnl_lock(); | ||
1913 | return err; | ||
1914 | } | 1907 | } |
1915 | 1908 | ||
1916 | memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *))); | 1909 | memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *))); |
@@ -1980,7 +1973,7 @@ static int __net_init rtnetlink_net_init(struct net *net) | |||
1980 | { | 1973 | { |
1981 | struct sock *sk; | 1974 | struct sock *sk; |
1982 | sk = netlink_kernel_create(net, NETLINK_ROUTE, RTNLGRP_MAX, | 1975 | sk = netlink_kernel_create(net, NETLINK_ROUTE, RTNLGRP_MAX, |
1983 | rtnetlink_rcv, &rtnl_mutex, THIS_MODULE); | 1976 | rtnetlink_rcv, NULL, THIS_MODULE); |
1984 | if (!sk) | 1977 | if (!sk) |
1985 | return -ENOMEM; | 1978 | return -ENOMEM; |
1986 | net->rtnl = sk; | 1979 | net->rtnl = sk; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 960ea899c864..46cbd28f40f9 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2994,6 +2994,9 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | |||
2994 | skb->destructor = sock_rmem_free; | 2994 | skb->destructor = sock_rmem_free; |
2995 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); | 2995 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); |
2996 | 2996 | ||
2997 | /* before exiting rcu section, make sure dst is refcounted */ | ||
2998 | skb_dst_force(skb); | ||
2999 | |||
2997 | skb_queue_tail(&sk->sk_error_queue, skb); | 3000 | skb_queue_tail(&sk->sk_error_queue, skb); |
2998 | if (!sock_flag(sk, SOCK_DEAD)) | 3001 | if (!sock_flag(sk, SOCK_DEAD)) |
2999 | sk->sk_data_ready(sk, skb->len); | 3002 | sk->sk_data_ready(sk, skb->len); |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 385b6095fdc4..a829e3f60aeb 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -122,6 +122,15 @@ static struct ctl_table net_core_table[] = { | |||
122 | .mode = 0644, | 122 | .mode = 0644, |
123 | .proc_handler = proc_dointvec | 123 | .proc_handler = proc_dointvec |
124 | }, | 124 | }, |
125 | #ifdef CONFIG_BPF_JIT | ||
126 | { | ||
127 | .procname = "bpf_jit_enable", | ||
128 | .data = &bpf_jit_enable, | ||
129 | .maxlen = sizeof(int), | ||
130 | .mode = 0644, | ||
131 | .proc_handler = proc_dointvec | ||
132 | }, | ||
133 | #endif | ||
125 | { | 134 | { |
126 | .procname = "netdev_tstamp_prequeue", | 135 | .procname = "netdev_tstamp_prequeue", |
127 | .data = &netdev_tstamp_prequeue, | 136 | .data = &netdev_tstamp_prequeue, |
diff --git a/net/core/utils.c b/net/core/utils.c index 5fea0ab21902..2012bc797f9c 100644 --- a/net/core/utils.c +++ b/net/core/utils.c | |||
@@ -296,3 +296,27 @@ void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, | |||
296 | csum_unfold(*sum))); | 296 | csum_unfold(*sum))); |
297 | } | 297 | } |
298 | EXPORT_SYMBOL(inet_proto_csum_replace4); | 298 | EXPORT_SYMBOL(inet_proto_csum_replace4); |
299 | |||
300 | int mac_pton(const char *s, u8 *mac) | ||
301 | { | ||
302 | int i; | ||
303 | |||
304 | /* XX:XX:XX:XX:XX:XX */ | ||
305 | if (strlen(s) < 3 * ETH_ALEN - 1) | ||
306 | return 0; | ||
307 | |||
308 | /* Don't dirty result unless string is valid MAC. */ | ||
309 | for (i = 0; i < ETH_ALEN; i++) { | ||
310 | if (!strchr("0123456789abcdefABCDEF", s[i * 3])) | ||
311 | return 0; | ||
312 | if (!strchr("0123456789abcdefABCDEF", s[i * 3 + 1])) | ||
313 | return 0; | ||
314 | if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':') | ||
315 | return 0; | ||
316 | } | ||
317 | for (i = 0; i < ETH_ALEN; i++) { | ||
318 | mac[i] = (hex_to_bin(s[i * 3]) << 4) | hex_to_bin(s[i * 3 + 1]); | ||
319 | } | ||
320 | return 1; | ||
321 | } | ||
322 | EXPORT_SYMBOL(mac_pton); | ||