aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c93
-rw-r--r--net/core/ethtool.c64
-rw-r--r--net/core/pktgen.c106
-rw-r--r--net/core/rtnetlink.c2
4 files changed, 150 insertions, 115 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index ee4035571c..6cc8a70350 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -817,7 +817,9 @@ int dev_alloc_name(struct net_device *dev, const char *name)
817 */ 817 */
818int dev_change_name(struct net_device *dev, char *newname) 818int dev_change_name(struct net_device *dev, char *newname)
819{ 819{
820 char oldname[IFNAMSIZ];
820 int err = 0; 821 int err = 0;
822 int ret;
821 823
822 ASSERT_RTNL(); 824 ASSERT_RTNL();
823 825
@@ -827,6 +829,8 @@ int dev_change_name(struct net_device *dev, char *newname)
827 if (!dev_valid_name(newname)) 829 if (!dev_valid_name(newname))
828 return -EINVAL; 830 return -EINVAL;
829 831
832 memcpy(oldname, dev->name, IFNAMSIZ);
833
830 if (strchr(newname, '%')) { 834 if (strchr(newname, '%')) {
831 err = dev_alloc_name(dev, newname); 835 err = dev_alloc_name(dev, newname);
832 if (err < 0) 836 if (err < 0)
@@ -838,10 +842,28 @@ int dev_change_name(struct net_device *dev, char *newname)
838 else 842 else
839 strlcpy(dev->name, newname, IFNAMSIZ); 843 strlcpy(dev->name, newname, IFNAMSIZ);
840 844
845rollback:
841 device_rename(&dev->dev, dev->name); 846 device_rename(&dev->dev, dev->name);
847
848 write_lock_bh(&dev_base_lock);
842 hlist_del(&dev->name_hlist); 849 hlist_del(&dev->name_hlist);
843 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); 850 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
844 raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); 851 write_unlock_bh(&dev_base_lock);
852
853 ret = raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
854 ret = notifier_to_errno(ret);
855
856 if (ret) {
857 if (err) {
858 printk(KERN_ERR
859 "%s: name change rollback failed: %d.\n",
860 dev->name, ret);
861 } else {
862 err = ret;
863 memcpy(dev->name, oldname, IFNAMSIZ);
864 goto rollback;
865 }
866 }
845 867
846 return err; 868 return err;
847} 869}
@@ -1054,20 +1076,43 @@ int dev_close(struct net_device *dev)
1054int register_netdevice_notifier(struct notifier_block *nb) 1076int register_netdevice_notifier(struct notifier_block *nb)
1055{ 1077{
1056 struct net_device *dev; 1078 struct net_device *dev;
1079 struct net_device *last;
1057 int err; 1080 int err;
1058 1081
1059 rtnl_lock(); 1082 rtnl_lock();
1060 err = raw_notifier_chain_register(&netdev_chain, nb); 1083 err = raw_notifier_chain_register(&netdev_chain, nb);
1061 if (!err) { 1084 if (err)
1062 for_each_netdev(dev) { 1085 goto unlock;
1063 nb->notifier_call(nb, NETDEV_REGISTER, dev);
1064 1086
1065 if (dev->flags & IFF_UP) 1087 for_each_netdev(dev) {
1066 nb->notifier_call(nb, NETDEV_UP, dev); 1088 err = nb->notifier_call(nb, NETDEV_REGISTER, dev);
1067 } 1089 err = notifier_to_errno(err);
1090 if (err)
1091 goto rollback;
1092
1093 if (!(dev->flags & IFF_UP))
1094 continue;
1095
1096 nb->notifier_call(nb, NETDEV_UP, dev);
1068 } 1097 }
1098
1099unlock:
1069 rtnl_unlock(); 1100 rtnl_unlock();
1070 return err; 1101 return err;
1102
1103rollback:
1104 last = dev;
1105 for_each_netdev(dev) {
1106 if (dev == last)
1107 break;
1108
1109 if (dev->flags & IFF_UP) {
1110 nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
1111 nb->notifier_call(nb, NETDEV_DOWN, dev);
1112 }
1113 nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
1114 }
1115 goto unlock;
1071} 1116}
1072 1117
1073/** 1118/**
@@ -2718,9 +2763,11 @@ int __dev_addr_add(struct dev_addr_list **list, int *count,
2718/** 2763/**
2719 * dev_unicast_delete - Release secondary unicast address. 2764 * dev_unicast_delete - Release secondary unicast address.
2720 * @dev: device 2765 * @dev: device
2766 * @addr: address to delete
2767 * @alen: length of @addr
2721 * 2768 *
2722 * Release reference to a secondary unicast address and remove it 2769 * Release reference to a secondary unicast address and remove it
2723 * from the device if the reference count drop to zero. 2770 * from the device if the reference count drops to zero.
2724 * 2771 *
2725 * The caller must hold the rtnl_mutex. 2772 * The caller must hold the rtnl_mutex.
2726 */ 2773 */
@@ -2742,6 +2789,8 @@ EXPORT_SYMBOL(dev_unicast_delete);
2742/** 2789/**
2743 * dev_unicast_add - add a secondary unicast address 2790 * dev_unicast_add - add a secondary unicast address
2744 * @dev: device 2791 * @dev: device
2792 * @addr: address to delete
2793 * @alen: length of @addr
2745 * 2794 *
2746 * Add a secondary unicast address to the device or increase 2795 * Add a secondary unicast address to the device or increase
2747 * the reference count if it already exists. 2796 * the reference count if it already exists.
@@ -3333,7 +3382,7 @@ int register_netdevice(struct net_device *dev)
3333 3382
3334 if (!dev_valid_name(dev->name)) { 3383 if (!dev_valid_name(dev->name)) {
3335 ret = -EINVAL; 3384 ret = -EINVAL;
3336 goto out; 3385 goto err_uninit;
3337 } 3386 }
3338 3387
3339 dev->ifindex = dev_new_index(); 3388 dev->ifindex = dev_new_index();
@@ -3347,7 +3396,7 @@ int register_netdevice(struct net_device *dev)
3347 = hlist_entry(p, struct net_device, name_hlist); 3396 = hlist_entry(p, struct net_device, name_hlist);
3348 if (!strncmp(d->name, dev->name, IFNAMSIZ)) { 3397 if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
3349 ret = -EEXIST; 3398 ret = -EEXIST;
3350 goto out; 3399 goto err_uninit;
3351 } 3400 }
3352 } 3401 }
3353 3402
@@ -3407,7 +3456,7 @@ int register_netdevice(struct net_device *dev)
3407 3456
3408 ret = netdev_register_sysfs(dev); 3457 ret = netdev_register_sysfs(dev);
3409 if (ret) 3458 if (ret)
3410 goto out; 3459 goto err_uninit;
3411 dev->reg_state = NETREG_REGISTERED; 3460 dev->reg_state = NETREG_REGISTERED;
3412 3461
3413 /* 3462 /*
@@ -3426,12 +3475,18 @@ int register_netdevice(struct net_device *dev)
3426 write_unlock_bh(&dev_base_lock); 3475 write_unlock_bh(&dev_base_lock);
3427 3476
3428 /* Notify protocols, that a new device appeared. */ 3477 /* Notify protocols, that a new device appeared. */
3429 raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev); 3478 ret = raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev);
3430 3479 ret = notifier_to_errno(ret);
3431 ret = 0; 3480 if (ret)
3481 unregister_netdevice(dev);
3432 3482
3433out: 3483out:
3434 return ret; 3484 return ret;
3485
3486err_uninit:
3487 if (dev->uninit)
3488 dev->uninit(dev);
3489 goto out;
3435} 3490}
3436 3491
3437/** 3492/**
@@ -3830,9 +3885,11 @@ static int dev_cpu_callback(struct notifier_block *nfb,
3830 3885
3831#ifdef CONFIG_NET_DMA 3886#ifdef CONFIG_NET_DMA
3832/** 3887/**
3833 * net_dma_rebalance - 3888 * net_dma_rebalance - try to maintain one DMA channel per CPU
3834 * This is called when the number of channels allocated to the net_dma_client 3889 * @net_dma: DMA client and associated data (lock, channels, channel_mask)
3835 * changes. The net_dma_client tries to have one DMA channel per CPU. 3890 *
3891 * This is called when the number of channels allocated to the net_dma client
3892 * changes. The net_dma client tries to have one DMA channel per CPU.
3836 */ 3893 */
3837 3894
3838static void net_dma_rebalance(struct net_dma *net_dma) 3895static void net_dma_rebalance(struct net_dma *net_dma)
@@ -3869,7 +3926,7 @@ static void net_dma_rebalance(struct net_dma *net_dma)
3869 * netdev_dma_event - event callback for the net_dma_client 3926 * netdev_dma_event - event callback for the net_dma_client
3870 * @client: should always be net_dma_client 3927 * @client: should always be net_dma_client
3871 * @chan: DMA channel for the event 3928 * @chan: DMA channel for the event
3872 * @event: event type 3929 * @state: DMA state to be handled
3873 */ 3930 */
3874static enum dma_state_client 3931static enum dma_state_client
3875netdev_dma_event(struct dma_client *client, struct dma_chan *chan, 3932netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 0b531e98ec..2ab0a60046 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -3,10 +3,12 @@
3 * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx> 3 * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
4 * 4 *
5 * This file is where we call all the ethtool_ops commands to get 5 * This file is where we call all the ethtool_ops commands to get
6 * the information ethtool needs. We fall back to calling do_ioctl() 6 * the information ethtool needs.
7 * for drivers which haven't been converted to ethtool_ops yet.
8 * 7 *
9 * It's GPL, stupid. 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
10 */ 12 */
11 13
12#include <linux/module.h> 14#include <linux/module.h>
@@ -93,18 +95,6 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data)
93 return 0; 95 return 0;
94} 96}
95 97
96int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *addr, u8 *data)
97{
98 unsigned char len = dev->addr_len;
99 if ( addr->size < len )
100 return -ETOOSMALL;
101
102 addr->size = len;
103 memcpy(data, dev->perm_addr, len);
104 return 0;
105}
106
107
108u32 ethtool_op_get_ufo(struct net_device *dev) 98u32 ethtool_op_get_ufo(struct net_device *dev)
109{ 99{
110 return (dev->features & NETIF_F_UFO) != 0; 100 return (dev->features & NETIF_F_UFO) != 0;
@@ -777,34 +767,20 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr)
777static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr) 767static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr)
778{ 768{
779 struct ethtool_perm_addr epaddr; 769 struct ethtool_perm_addr epaddr;
780 u8 *data;
781 int ret;
782
783 if (!dev->ethtool_ops->get_perm_addr)
784 return -EOPNOTSUPP;
785 770
786 if (copy_from_user(&epaddr,useraddr,sizeof(epaddr))) 771 if (copy_from_user(&epaddr, useraddr, sizeof(epaddr)))
787 return -EFAULT; 772 return -EFAULT;
788 773
789 data = kmalloc(epaddr.size, GFP_USER); 774 if (epaddr.size < dev->addr_len)
790 if (!data) 775 return -ETOOSMALL;
791 return -ENOMEM; 776 epaddr.size = dev->addr_len;
792
793 ret = dev->ethtool_ops->get_perm_addr(dev,&epaddr,data);
794 if (ret)
795 return ret;
796 777
797 ret = -EFAULT;
798 if (copy_to_user(useraddr, &epaddr, sizeof(epaddr))) 778 if (copy_to_user(useraddr, &epaddr, sizeof(epaddr)))
799 goto out; 779 return -EFAULT;
800 useraddr += sizeof(epaddr); 780 useraddr += sizeof(epaddr);
801 if (copy_to_user(useraddr, data, epaddr.size)) 781 if (copy_to_user(useraddr, dev->perm_addr, epaddr.size))
802 goto out; 782 return -EFAULT;
803 ret = 0; 783 return 0;
804
805 out:
806 kfree(data);
807 return ret;
808} 784}
809 785
810/* The main entry point in this file. Called from net/core/dev.c */ 786/* The main entry point in this file. Called from net/core/dev.c */
@@ -821,7 +797,7 @@ int dev_ethtool(struct ifreq *ifr)
821 return -ENODEV; 797 return -ENODEV;
822 798
823 if (!dev->ethtool_ops) 799 if (!dev->ethtool_ops)
824 goto ioctl; 800 return -EOPNOTSUPP;
825 801
826 if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd))) 802 if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
827 return -EFAULT; 803 return -EFAULT;
@@ -960,7 +936,7 @@ int dev_ethtool(struct ifreq *ifr)
960 rc = ethtool_set_gso(dev, useraddr); 936 rc = ethtool_set_gso(dev, useraddr);
961 break; 937 break;
962 default: 938 default:
963 rc = -EOPNOTSUPP; 939 rc = -EOPNOTSUPP;
964 } 940 }
965 941
966 if (dev->ethtool_ops->complete) 942 if (dev->ethtool_ops->complete)
@@ -970,20 +946,10 @@ int dev_ethtool(struct ifreq *ifr)
970 netdev_features_change(dev); 946 netdev_features_change(dev);
971 947
972 return rc; 948 return rc;
973
974 ioctl:
975 /* Keep existing behaviour for the moment. */
976 if (!capable(CAP_NET_ADMIN))
977 return -EPERM;
978
979 if (dev->do_ioctl)
980 return dev->do_ioctl(dev, ifr, SIOCETHTOOL);
981 return -EOPNOTSUPP;
982} 949}
983 950
984EXPORT_SYMBOL(dev_ethtool); 951EXPORT_SYMBOL(dev_ethtool);
985EXPORT_SYMBOL(ethtool_op_get_link); 952EXPORT_SYMBOL(ethtool_op_get_link);
986EXPORT_SYMBOL_GPL(ethtool_op_get_perm_addr);
987EXPORT_SYMBOL(ethtool_op_get_sg); 953EXPORT_SYMBOL(ethtool_op_get_sg);
988EXPORT_SYMBOL(ethtool_op_get_tso); 954EXPORT_SYMBOL(ethtool_op_get_tso);
989EXPORT_SYMBOL(ethtool_op_get_tx_csum); 955EXPORT_SYMBOL(ethtool_op_get_tx_csum);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index bca787fdbc..7bae576ac1 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -567,7 +567,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user * buf,
567 pktgen_run_all_threads(); 567 pktgen_run_all_threads();
568 568
569 else 569 else
570 printk("pktgen: Unknown command: %s\n", data); 570 printk(KERN_WARNING "pktgen: Unknown command: %s\n", data);
571 571
572 err = count; 572 err = count;
573 573
@@ -908,14 +908,14 @@ static ssize_t pktgen_if_write(struct file *file,
908 pg_result = &(pkt_dev->result[0]); 908 pg_result = &(pkt_dev->result[0]);
909 909
910 if (count < 1) { 910 if (count < 1) {
911 printk("pktgen: wrong command format\n"); 911 printk(KERN_WARNING "pktgen: wrong command format\n");
912 return -EINVAL; 912 return -EINVAL;
913 } 913 }
914 914
915 max = count - i; 915 max = count - i;
916 tmp = count_trail_chars(&user_buffer[i], max); 916 tmp = count_trail_chars(&user_buffer[i], max);
917 if (tmp < 0) { 917 if (tmp < 0) {
918 printk("pktgen: illegal format\n"); 918 printk(KERN_WARNING "pktgen: illegal format\n");
919 return tmp; 919 return tmp;
920 } 920 }
921 i += tmp; 921 i += tmp;
@@ -943,7 +943,7 @@ static ssize_t pktgen_if_write(struct file *file,
943 if (copy_from_user(tb, user_buffer, count)) 943 if (copy_from_user(tb, user_buffer, count))
944 return -EFAULT; 944 return -EFAULT;
945 tb[count] = 0; 945 tb[count] = 0;
946 printk("pktgen: %s,%lu buffer -:%s:-\n", name, 946 printk(KERN_DEBUG "pktgen: %s,%lu buffer -:%s:-\n", name,
947 (unsigned long)count, tb); 947 (unsigned long)count, tb);
948 } 948 }
949 949
@@ -1248,7 +1248,7 @@ static ssize_t pktgen_if_write(struct file *file,
1248 pkt_dev->cur_daddr = pkt_dev->daddr_min; 1248 pkt_dev->cur_daddr = pkt_dev->daddr_min;
1249 } 1249 }
1250 if (debug) 1250 if (debug)
1251 printk("pktgen: dst_min set to: %s\n", 1251 printk(KERN_DEBUG "pktgen: dst_min set to: %s\n",
1252 pkt_dev->dst_min); 1252 pkt_dev->dst_min);
1253 i += len; 1253 i += len;
1254 sprintf(pg_result, "OK: dst_min=%s", pkt_dev->dst_min); 1254 sprintf(pg_result, "OK: dst_min=%s", pkt_dev->dst_min);
@@ -1271,7 +1271,7 @@ static ssize_t pktgen_if_write(struct file *file,
1271 pkt_dev->cur_daddr = pkt_dev->daddr_max; 1271 pkt_dev->cur_daddr = pkt_dev->daddr_max;
1272 } 1272 }
1273 if (debug) 1273 if (debug)
1274 printk("pktgen: dst_max set to: %s\n", 1274 printk(KERN_DEBUG "pktgen: dst_max set to: %s\n",
1275 pkt_dev->dst_max); 1275 pkt_dev->dst_max);
1276 i += len; 1276 i += len;
1277 sprintf(pg_result, "OK: dst_max=%s", pkt_dev->dst_max); 1277 sprintf(pg_result, "OK: dst_max=%s", pkt_dev->dst_max);
@@ -1294,7 +1294,7 @@ static ssize_t pktgen_if_write(struct file *file,
1294 ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr); 1294 ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr);
1295 1295
1296 if (debug) 1296 if (debug)
1297 printk("pktgen: dst6 set to: %s\n", buf); 1297 printk(KERN_DEBUG "pktgen: dst6 set to: %s\n", buf);
1298 1298
1299 i += len; 1299 i += len;
1300 sprintf(pg_result, "OK: dst6=%s", buf); 1300 sprintf(pg_result, "OK: dst6=%s", buf);
@@ -1317,7 +1317,7 @@ static ssize_t pktgen_if_write(struct file *file,
1317 ipv6_addr_copy(&pkt_dev->cur_in6_daddr, 1317 ipv6_addr_copy(&pkt_dev->cur_in6_daddr,
1318 &pkt_dev->min_in6_daddr); 1318 &pkt_dev->min_in6_daddr);
1319 if (debug) 1319 if (debug)
1320 printk("pktgen: dst6_min set to: %s\n", buf); 1320 printk(KERN_DEBUG "pktgen: dst6_min set to: %s\n", buf);
1321 1321
1322 i += len; 1322 i += len;
1323 sprintf(pg_result, "OK: dst6_min=%s", buf); 1323 sprintf(pg_result, "OK: dst6_min=%s", buf);
@@ -1338,7 +1338,7 @@ static ssize_t pktgen_if_write(struct file *file,
1338 fmt_ip6(buf, pkt_dev->max_in6_daddr.s6_addr); 1338 fmt_ip6(buf, pkt_dev->max_in6_daddr.s6_addr);
1339 1339
1340 if (debug) 1340 if (debug)
1341 printk("pktgen: dst6_max set to: %s\n", buf); 1341 printk(KERN_DEBUG "pktgen: dst6_max set to: %s\n", buf);
1342 1342
1343 i += len; 1343 i += len;
1344 sprintf(pg_result, "OK: dst6_max=%s", buf); 1344 sprintf(pg_result, "OK: dst6_max=%s", buf);
@@ -1361,7 +1361,7 @@ static ssize_t pktgen_if_write(struct file *file,
1361 ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr); 1361 ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr);
1362 1362
1363 if (debug) 1363 if (debug)
1364 printk("pktgen: src6 set to: %s\n", buf); 1364 printk(KERN_DEBUG "pktgen: src6 set to: %s\n", buf);
1365 1365
1366 i += len; 1366 i += len;
1367 sprintf(pg_result, "OK: src6=%s", buf); 1367 sprintf(pg_result, "OK: src6=%s", buf);
@@ -1382,7 +1382,7 @@ static ssize_t pktgen_if_write(struct file *file,
1382 pkt_dev->cur_saddr = pkt_dev->saddr_min; 1382 pkt_dev->cur_saddr = pkt_dev->saddr_min;
1383 } 1383 }
1384 if (debug) 1384 if (debug)
1385 printk("pktgen: src_min set to: %s\n", 1385 printk(KERN_DEBUG "pktgen: src_min set to: %s\n",
1386 pkt_dev->src_min); 1386 pkt_dev->src_min);
1387 i += len; 1387 i += len;
1388 sprintf(pg_result, "OK: src_min=%s", pkt_dev->src_min); 1388 sprintf(pg_result, "OK: src_min=%s", pkt_dev->src_min);
@@ -1403,7 +1403,7 @@ static ssize_t pktgen_if_write(struct file *file,
1403 pkt_dev->cur_saddr = pkt_dev->saddr_max; 1403 pkt_dev->cur_saddr = pkt_dev->saddr_max;
1404 } 1404 }
1405 if (debug) 1405 if (debug)
1406 printk("pktgen: src_max set to: %s\n", 1406 printk(KERN_DEBUG "pktgen: src_max set to: %s\n",
1407 pkt_dev->src_max); 1407 pkt_dev->src_max);
1408 i += len; 1408 i += len;
1409 sprintf(pg_result, "OK: src_max=%s", pkt_dev->src_max); 1409 sprintf(pg_result, "OK: src_max=%s", pkt_dev->src_max);
@@ -1533,7 +1533,7 @@ static ssize_t pktgen_if_write(struct file *file,
1533 pkt_dev->svlan_id = 0xffff; 1533 pkt_dev->svlan_id = 0xffff;
1534 1534
1535 if (debug) 1535 if (debug)
1536 printk("pktgen: VLAN/SVLAN auto turned off\n"); 1536 printk(KERN_DEBUG "pktgen: VLAN/SVLAN auto turned off\n");
1537 } 1537 }
1538 return count; 1538 return count;
1539 } 1539 }
@@ -1548,10 +1548,10 @@ static ssize_t pktgen_if_write(struct file *file,
1548 pkt_dev->vlan_id = value; /* turn on VLAN */ 1548 pkt_dev->vlan_id = value; /* turn on VLAN */
1549 1549
1550 if (debug) 1550 if (debug)
1551 printk("pktgen: VLAN turned on\n"); 1551 printk(KERN_DEBUG "pktgen: VLAN turned on\n");
1552 1552
1553 if (debug && pkt_dev->nr_labels) 1553 if (debug && pkt_dev->nr_labels)
1554 printk("pktgen: MPLS auto turned off\n"); 1554 printk(KERN_DEBUG "pktgen: MPLS auto turned off\n");
1555 1555
1556 pkt_dev->nr_labels = 0; /* turn off MPLS */ 1556 pkt_dev->nr_labels = 0; /* turn off MPLS */
1557 sprintf(pg_result, "OK: vlan_id=%u", pkt_dev->vlan_id); 1557 sprintf(pg_result, "OK: vlan_id=%u", pkt_dev->vlan_id);
@@ -1560,7 +1560,7 @@ static ssize_t pktgen_if_write(struct file *file,
1560 pkt_dev->svlan_id = 0xffff; 1560 pkt_dev->svlan_id = 0xffff;
1561 1561
1562 if (debug) 1562 if (debug)
1563 printk("pktgen: VLAN/SVLAN turned off\n"); 1563 printk(KERN_DEBUG "pktgen: VLAN/SVLAN turned off\n");
1564 } 1564 }
1565 return count; 1565 return count;
1566 } 1566 }
@@ -1605,10 +1605,10 @@ static ssize_t pktgen_if_write(struct file *file,
1605 pkt_dev->svlan_id = value; /* turn on SVLAN */ 1605 pkt_dev->svlan_id = value; /* turn on SVLAN */
1606 1606
1607 if (debug) 1607 if (debug)
1608 printk("pktgen: SVLAN turned on\n"); 1608 printk(KERN_DEBUG "pktgen: SVLAN turned on\n");
1609 1609
1610 if (debug && pkt_dev->nr_labels) 1610 if (debug && pkt_dev->nr_labels)
1611 printk("pktgen: MPLS auto turned off\n"); 1611 printk(KERN_DEBUG "pktgen: MPLS auto turned off\n");
1612 1612
1613 pkt_dev->nr_labels = 0; /* turn off MPLS */ 1613 pkt_dev->nr_labels = 0; /* turn off MPLS */
1614 sprintf(pg_result, "OK: svlan_id=%u", pkt_dev->svlan_id); 1614 sprintf(pg_result, "OK: svlan_id=%u", pkt_dev->svlan_id);
@@ -1617,7 +1617,7 @@ static ssize_t pktgen_if_write(struct file *file,
1617 pkt_dev->svlan_id = 0xffff; 1617 pkt_dev->svlan_id = 0xffff;
1618 1618
1619 if (debug) 1619 if (debug)
1620 printk("pktgen: VLAN/SVLAN turned off\n"); 1620 printk(KERN_DEBUG "pktgen: VLAN/SVLAN turned off\n");
1621 } 1621 }
1622 return count; 1622 return count;
1623 } 1623 }
@@ -1777,10 +1777,11 @@ static ssize_t pktgen_thread_write(struct file *file,
1777 i += len; 1777 i += len;
1778 1778
1779 if (debug) 1779 if (debug)
1780 printk("pktgen: t=%s, count=%lu\n", name, (unsigned long)count); 1780 printk(KERN_DEBUG "pktgen: t=%s, count=%lu\n",
1781 name, (unsigned long)count);
1781 1782
1782 if (!t) { 1783 if (!t) {
1783 printk("pktgen: ERROR: No thread\n"); 1784 printk(KERN_ERR "pktgen: ERROR: No thread\n");
1784 ret = -EINVAL; 1785 ret = -EINVAL;
1785 goto out; 1786 goto out;
1786 } 1787 }
@@ -1891,8 +1892,8 @@ static void pktgen_mark_device(const char *ifname)
1891 mutex_lock(&pktgen_thread_lock); 1892 mutex_lock(&pktgen_thread_lock);
1892 1893
1893 if (++i >= max_tries) { 1894 if (++i >= max_tries) {
1894 printk("pktgen_mark_device: timed out after waiting " 1895 printk(KERN_ERR "pktgen_mark_device: timed out after "
1895 "%d msec for device %s to be removed\n", 1896 "waiting %d msec for device %s to be removed\n",
1896 msec_per_try * i, ifname); 1897 msec_per_try * i, ifname);
1897 break; 1898 break;
1898 } 1899 }
@@ -1962,15 +1963,15 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname)
1962 1963
1963 odev = dev_get_by_name(ifname); 1964 odev = dev_get_by_name(ifname);
1964 if (!odev) { 1965 if (!odev) {
1965 printk("pktgen: no such netdevice: \"%s\"\n", ifname); 1966 printk(KERN_ERR "pktgen: no such netdevice: \"%s\"\n", ifname);
1966 return -ENODEV; 1967 return -ENODEV;
1967 } 1968 }
1968 1969
1969 if (odev->type != ARPHRD_ETHER) { 1970 if (odev->type != ARPHRD_ETHER) {
1970 printk("pktgen: not an ethernet device: \"%s\"\n", ifname); 1971 printk(KERN_ERR "pktgen: not an ethernet device: \"%s\"\n", ifname);
1971 err = -EINVAL; 1972 err = -EINVAL;
1972 } else if (!netif_running(odev)) { 1973 } else if (!netif_running(odev)) {
1973 printk("pktgen: device is down: \"%s\"\n", ifname); 1974 printk(KERN_ERR "pktgen: device is down: \"%s\"\n", ifname);
1974 err = -ENETDOWN; 1975 err = -ENETDOWN;
1975 } else { 1976 } else {
1976 pkt_dev->odev = odev; 1977 pkt_dev->odev = odev;
@@ -1987,7 +1988,8 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname)
1987static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) 1988static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
1988{ 1989{
1989 if (!pkt_dev->odev) { 1990 if (!pkt_dev->odev) {
1990 printk("pktgen: ERROR: pkt_dev->odev == NULL in setup_inject.\n"); 1991 printk(KERN_ERR "pktgen: ERROR: pkt_dev->odev == NULL in "
1992 "setup_inject.\n");
1991 sprintf(pkt_dev->result, 1993 sprintf(pkt_dev->result,
1992 "ERROR: pkt_dev->odev == NULL in setup_inject.\n"); 1994 "ERROR: pkt_dev->odev == NULL in setup_inject.\n");
1993 return; 1995 return;
@@ -2049,7 +2051,8 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2049 } 2051 }
2050 rcu_read_unlock(); 2052 rcu_read_unlock();
2051 if (err) 2053 if (err)
2052 printk("pktgen: ERROR: IPv6 link address not availble.\n"); 2054 printk(KERN_ERR "pktgen: ERROR: IPv6 link "
2055 "address not availble.\n");
2053 } 2056 }
2054#endif 2057#endif
2055 } else { 2058 } else {
@@ -2156,8 +2159,7 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
2156/* If there was already an IPSEC SA, we keep it as is, else 2159/* If there was already an IPSEC SA, we keep it as is, else
2157 * we go look for it ... 2160 * we go look for it ...
2158*/ 2161*/
2159inline 2162static void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow)
2160void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow)
2161{ 2163{
2162 struct xfrm_state *x = pkt_dev->flows[flow].x; 2164 struct xfrm_state *x = pkt_dev->flows[flow].x;
2163 if (!x) { 2165 if (!x) {
@@ -2441,7 +2443,8 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
2441 if (nhead >0) { 2443 if (nhead >0) {
2442 ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); 2444 ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC);
2443 if (ret < 0) { 2445 if (ret < 0) {
2444 printk("Error expanding ipsec packet %d\n",ret); 2446 printk(KERN_ERR "Error expanding "
2447 "ipsec packet %d\n",ret);
2445 return 0; 2448 return 0;
2446 } 2449 }
2447 } 2450 }
@@ -2450,7 +2453,8 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
2450 skb_pull(skb, ETH_HLEN); 2453 skb_pull(skb, ETH_HLEN);
2451 ret = pktgen_output_ipsec(skb, pkt_dev); 2454 ret = pktgen_output_ipsec(skb, pkt_dev);
2452 if (ret) { 2455 if (ret) {
2453 printk("Error creating ipsec packet %d\n",ret); 2456 printk(KERN_ERR "Error creating ipsec "
2457 "packet %d\n",ret);
2454 kfree_skb(skb); 2458 kfree_skb(skb);
2455 return 0; 2459 return 0;
2456 } 2460 }
@@ -3184,8 +3188,8 @@ static int pktgen_stop_device(struct pktgen_dev *pkt_dev)
3184 int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1; 3188 int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1;
3185 3189
3186 if (!pkt_dev->running) { 3190 if (!pkt_dev->running) {
3187 printk("pktgen: interface: %s is already stopped\n", 3191 printk(KERN_WARNING "pktgen: interface: %s is already "
3188 pkt_dev->odev->name); 3192 "stopped\n", pkt_dev->odev->name);
3189 return -EINVAL; 3193 return -EINVAL;
3190 } 3194 }
3191 3195
@@ -3360,7 +3364,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
3360 3364
3361 pkt_dev->skb = fill_packet(odev, pkt_dev); 3365 pkt_dev->skb = fill_packet(odev, pkt_dev);
3362 if (pkt_dev->skb == NULL) { 3366 if (pkt_dev->skb == NULL) {
3363 printk("pktgen: ERROR: couldn't allocate skb in fill_packet.\n"); 3367 printk(KERN_ERR "pktgen: ERROR: couldn't "
3368 "allocate skb in fill_packet.\n");
3364 schedule(); 3369 schedule();
3365 pkt_dev->clone_count--; /* back out increment, OOM */ 3370 pkt_dev->clone_count--; /* back out increment, OOM */
3366 goto out; 3371 goto out;
@@ -3565,7 +3570,8 @@ static int add_dev_to_thread(struct pktgen_thread *t,
3565 if_lock(t); 3570 if_lock(t);
3566 3571
3567 if (pkt_dev->pg_thread) { 3572 if (pkt_dev->pg_thread) {
3568 printk("pktgen: ERROR: already assigned to a thread.\n"); 3573 printk(KERN_ERR "pktgen: ERROR: already assigned "
3574 "to a thread.\n");
3569 rv = -EBUSY; 3575 rv = -EBUSY;
3570 goto out; 3576 goto out;
3571 } 3577 }
@@ -3590,7 +3596,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3590 3596
3591 pkt_dev = __pktgen_NN_threads(ifname, FIND); 3597 pkt_dev = __pktgen_NN_threads(ifname, FIND);
3592 if (pkt_dev) { 3598 if (pkt_dev) {
3593 printk("pktgen: ERROR: interface already used.\n"); 3599 printk(KERN_ERR "pktgen: ERROR: interface already used.\n");
3594 return -EBUSY; 3600 return -EBUSY;
3595 } 3601 }
3596 3602
@@ -3632,7 +3638,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3632 3638
3633 pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir); 3639 pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir);
3634 if (!pkt_dev->entry) { 3640 if (!pkt_dev->entry) {
3635 printk("pktgen: cannot create %s/%s procfs entry.\n", 3641 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
3636 PG_PROC_DIR, ifname); 3642 PG_PROC_DIR, ifname);
3637 err = -EINVAL; 3643 err = -EINVAL;
3638 goto out2; 3644 goto out2;
@@ -3665,7 +3671,8 @@ static int __init pktgen_create_thread(int cpu)
3665 3671
3666 t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL); 3672 t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL);
3667 if (!t) { 3673 if (!t) {
3668 printk("pktgen: ERROR: out of memory, can't create new thread.\n"); 3674 printk(KERN_ERR "pktgen: ERROR: out of memory, can't "
3675 "create new thread.\n");
3669 return -ENOMEM; 3676 return -ENOMEM;
3670 } 3677 }
3671 3678
@@ -3678,7 +3685,8 @@ static int __init pktgen_create_thread(int cpu)
3678 3685
3679 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); 3686 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu);
3680 if (IS_ERR(p)) { 3687 if (IS_ERR(p)) {
3681 printk("pktgen: kernel_thread() failed for cpu %d\n", t->cpu); 3688 printk(KERN_ERR "pktgen: kernel_thread() failed "
3689 "for cpu %d\n", t->cpu);
3682 list_del(&t->th_list); 3690 list_del(&t->th_list);
3683 kfree(t); 3691 kfree(t);
3684 return PTR_ERR(p); 3692 return PTR_ERR(p);
@@ -3688,7 +3696,7 @@ static int __init pktgen_create_thread(int cpu)
3688 3696
3689 pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir); 3697 pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir);
3690 if (!pe) { 3698 if (!pe) {
3691 printk("pktgen: cannot create %s/%s procfs entry.\n", 3699 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
3692 PG_PROC_DIR, t->tsk->comm); 3700 PG_PROC_DIR, t->tsk->comm);
3693 kthread_stop(p); 3701 kthread_stop(p);
3694 list_del(&t->th_list); 3702 list_del(&t->th_list);
@@ -3727,7 +3735,8 @@ static int pktgen_remove_device(struct pktgen_thread *t,
3727 pr_debug("pktgen: remove_device pkt_dev=%p\n", pkt_dev); 3735 pr_debug("pktgen: remove_device pkt_dev=%p\n", pkt_dev);
3728 3736
3729 if (pkt_dev->running) { 3737 if (pkt_dev->running) {
3730 printk("pktgen:WARNING: trying to remove a running interface, stopping it now.\n"); 3738 printk(KERN_WARNING "pktgen: WARNING: trying to remove a "
3739 "running interface, stopping it now.\n");
3731 pktgen_stop_device(pkt_dev); 3740 pktgen_stop_device(pkt_dev);
3732 } 3741 }
3733 3742
@@ -3759,7 +3768,7 @@ static int __init pg_init(void)
3759 int cpu; 3768 int cpu;
3760 struct proc_dir_entry *pe; 3769 struct proc_dir_entry *pe;
3761 3770
3762 printk(version); 3771 printk(KERN_INFO "%s", version);
3763 3772
3764 pg_proc_dir = proc_mkdir(PG_PROC_DIR, proc_net); 3773 pg_proc_dir = proc_mkdir(PG_PROC_DIR, proc_net);
3765 if (!pg_proc_dir) 3774 if (!pg_proc_dir)
@@ -3768,8 +3777,8 @@ static int __init pg_init(void)
3768 3777
3769 pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir); 3778 pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir);
3770 if (pe == NULL) { 3779 if (pe == NULL) {
3771 printk("pktgen: ERROR: cannot create %s procfs entry.\n", 3780 printk(KERN_ERR "pktgen: ERROR: cannot create %s "
3772 PGCTRL); 3781 "procfs entry.\n", PGCTRL);
3773 proc_net_remove(PG_PROC_DIR); 3782 proc_net_remove(PG_PROC_DIR);
3774 return -EINVAL; 3783 return -EINVAL;
3775 } 3784 }
@@ -3785,12 +3794,13 @@ static int __init pg_init(void)
3785 3794
3786 err = pktgen_create_thread(cpu); 3795 err = pktgen_create_thread(cpu);
3787 if (err) 3796 if (err)
3788 printk("pktgen: WARNING: Cannot create thread for cpu %d (%d)\n", 3797 printk(KERN_WARNING "pktgen: WARNING: Cannot create "
3789 cpu, err); 3798 "thread for cpu %d (%d)\n", cpu, err);
3790 } 3799 }
3791 3800
3792 if (list_empty(&pktgen_threads)) { 3801 if (list_empty(&pktgen_threads)) {
3793 printk("pktgen: ERROR: Initialization failed for all threads\n"); 3802 printk(KERN_ERR "pktgen: ERROR: Initialization failed for "
3803 "all threads\n");
3794 unregister_netdevice_notifier(&pktgen_notifier_block); 3804 unregister_netdevice_notifier(&pktgen_notifier_block);
3795 remove_proc_entry(PGCTRL, pg_proc_dir); 3805 remove_proc_entry(PGCTRL, pg_proc_dir);
3796 proc_net_remove(PG_PROC_DIR); 3806 proc_net_remove(PG_PROC_DIR);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 06eccca8cb..4756d5857a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -952,7 +952,9 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
952 struct nlattr *linkinfo[IFLA_INFO_MAX+1]; 952 struct nlattr *linkinfo[IFLA_INFO_MAX+1];
953 int err; 953 int err;
954 954
955#ifdef CONFIG_KMOD
955replay: 956replay:
957#endif
956 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); 958 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
957 if (err < 0) 959 if (err < 0)
958 return err; 960 return err;