aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2008-11-13 02:37:49 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-13 02:37:49 -0500
commit454d7c9b14e20fd1949e2686e9de4a2926e01476 (patch)
treefae8bd1bfb5fd496977a0639ad71c54a2ee278ae /drivers/net/bonding/bond_main.c
parent7a12122c7a00347da9669cfcde82954c9e3d6f5e (diff)
netdevice: safe convert to netdev_priv() #part-1
We have some reasons to kill netdev->priv: 1. netdev->priv is equal to netdev_priv(). 2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously netdev_priv() is more flexible than netdev->priv. But we cann't kill netdev->priv, because so many drivers reference to it directly. This patch is a safe convert for netdev->priv to netdev_priv(netdev). Since all of the netdev->priv is only for read. But it is too big to be sent in one mail. I split it to 4 parts and make every part smaller than 100,000 bytes, which is max size allowed by vger. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 02de3e031237..a08ea4808056 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -454,7 +454,7 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_de
454 */ 454 */
455static void bond_vlan_rx_register(struct net_device *bond_dev, struct vlan_group *grp) 455static void bond_vlan_rx_register(struct net_device *bond_dev, struct vlan_group *grp)
456{ 456{
457 struct bonding *bond = bond_dev->priv; 457 struct bonding *bond = netdev_priv(bond_dev);
458 struct slave *slave; 458 struct slave *slave;
459 int i; 459 int i;
460 460
@@ -477,7 +477,7 @@ static void bond_vlan_rx_register(struct net_device *bond_dev, struct vlan_group
477 */ 477 */
478static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid) 478static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid)
479{ 479{
480 struct bonding *bond = bond_dev->priv; 480 struct bonding *bond = netdev_priv(bond_dev);
481 struct slave *slave; 481 struct slave *slave;
482 int i, res; 482 int i, res;
483 483
@@ -505,7 +505,7 @@ static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid)
505 */ 505 */
506static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid) 506static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid)
507{ 507{
508 struct bonding *bond = bond_dev->priv; 508 struct bonding *bond = netdev_priv(bond_dev);
509 struct slave *slave; 509 struct slave *slave;
510 struct net_device *vlan_dev; 510 struct net_device *vlan_dev;
511 int i, res; 511 int i, res;
@@ -939,7 +939,7 @@ static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond,
939 */ 939 */
940static void bond_mc_list_flush(struct net_device *bond_dev, struct net_device *slave_dev) 940static void bond_mc_list_flush(struct net_device *bond_dev, struct net_device *slave_dev)
941{ 941{
942 struct bonding *bond = bond_dev->priv; 942 struct bonding *bond = netdev_priv(bond_dev);
943 struct dev_mc_list *dmi; 943 struct dev_mc_list *dmi;
944 944
945 for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { 945 for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) {
@@ -1383,7 +1383,7 @@ done:
1383static void bond_setup_by_slave(struct net_device *bond_dev, 1383static void bond_setup_by_slave(struct net_device *bond_dev,
1384 struct net_device *slave_dev) 1384 struct net_device *slave_dev)
1385{ 1385{
1386 struct bonding *bond = bond_dev->priv; 1386 struct bonding *bond = netdev_priv(bond_dev);
1387 1387
1388 bond_dev->neigh_setup = slave_dev->neigh_setup; 1388 bond_dev->neigh_setup = slave_dev->neigh_setup;
1389 bond_dev->header_ops = slave_dev->header_ops; 1389 bond_dev->header_ops = slave_dev->header_ops;
@@ -1400,7 +1400,7 @@ static void bond_setup_by_slave(struct net_device *bond_dev,
1400/* enslave device <slave> to bond device <master> */ 1400/* enslave device <slave> to bond device <master> */
1401int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) 1401int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1402{ 1402{
1403 struct bonding *bond = bond_dev->priv; 1403 struct bonding *bond = netdev_priv(bond_dev);
1404 struct slave *new_slave = NULL; 1404 struct slave *new_slave = NULL;
1405 struct dev_mc_list *dmi; 1405 struct dev_mc_list *dmi;
1406 struct sockaddr addr; 1406 struct sockaddr addr;
@@ -1802,7 +1802,7 @@ err_undo_flags:
1802 */ 1802 */
1803int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) 1803int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1804{ 1804{
1805 struct bonding *bond = bond_dev->priv; 1805 struct bonding *bond = netdev_priv(bond_dev);
1806 struct slave *slave, *oldcurrent; 1806 struct slave *slave, *oldcurrent;
1807 struct sockaddr addr; 1807 struct sockaddr addr;
1808 int mac_addr_differ; 1808 int mac_addr_differ;
@@ -2013,7 +2013,7 @@ static void bond_destructor(struct net_device *bond_dev)
2013*/ 2013*/
2014int bond_release_and_destroy(struct net_device *bond_dev, struct net_device *slave_dev) 2014int bond_release_and_destroy(struct net_device *bond_dev, struct net_device *slave_dev)
2015{ 2015{
2016 struct bonding *bond = bond_dev->priv; 2016 struct bonding *bond = netdev_priv(bond_dev);
2017 int ret; 2017 int ret;
2018 2018
2019 ret = bond_release(bond_dev, slave_dev); 2019 ret = bond_release(bond_dev, slave_dev);
@@ -2030,7 +2030,7 @@ int bond_release_and_destroy(struct net_device *bond_dev, struct net_device *sl
2030 */ 2030 */
2031static int bond_release_all(struct net_device *bond_dev) 2031static int bond_release_all(struct net_device *bond_dev)
2032{ 2032{
2033 struct bonding *bond = bond_dev->priv; 2033 struct bonding *bond = netdev_priv(bond_dev);
2034 struct slave *slave; 2034 struct slave *slave;
2035 struct net_device *slave_dev; 2035 struct net_device *slave_dev;
2036 struct sockaddr addr; 2036 struct sockaddr addr;
@@ -2161,7 +2161,7 @@ out:
2161 */ 2161 */
2162static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_device *slave_dev) 2162static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_device *slave_dev)
2163{ 2163{
2164 struct bonding *bond = bond_dev->priv; 2164 struct bonding *bond = netdev_priv(bond_dev);
2165 struct slave *old_active = NULL; 2165 struct slave *old_active = NULL;
2166 struct slave *new_active = NULL; 2166 struct slave *new_active = NULL;
2167 int res = 0; 2167 int res = 0;
@@ -2210,7 +2210,7 @@ static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_devi
2210 2210
2211static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) 2211static int bond_info_query(struct net_device *bond_dev, struct ifbond *info)
2212{ 2212{
2213 struct bonding *bond = bond_dev->priv; 2213 struct bonding *bond = netdev_priv(bond_dev);
2214 2214
2215 info->bond_mode = bond->params.mode; 2215 info->bond_mode = bond->params.mode;
2216 info->miimon = bond->params.miimon; 2216 info->miimon = bond->params.miimon;
@@ -2224,7 +2224,7 @@ static int bond_info_query(struct net_device *bond_dev, struct ifbond *info)
2224 2224
2225static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info) 2225static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info)
2226{ 2226{
2227 struct bonding *bond = bond_dev->priv; 2227 struct bonding *bond = netdev_priv(bond_dev);
2228 struct slave *slave; 2228 struct slave *slave;
2229 int i, found = 0; 2229 int i, found = 0;
2230 2230
@@ -2717,7 +2717,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
2717 if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER)) 2717 if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
2718 goto out; 2718 goto out;
2719 2719
2720 bond = dev->priv; 2720 bond = netdev_priv(dev);
2721 read_lock(&bond->lock); 2721 read_lock(&bond->lock);
2722 2722
2723 dprintk("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n", 2723 dprintk("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n",
@@ -3526,7 +3526,7 @@ static int bond_event_changename(struct bonding *bond)
3526 3526
3527static int bond_master_netdev_event(unsigned long event, struct net_device *bond_dev) 3527static int bond_master_netdev_event(unsigned long event, struct net_device *bond_dev)
3528{ 3528{
3529 struct bonding *event_bond = bond_dev->priv; 3529 struct bonding *event_bond = netdev_priv(bond_dev);
3530 3530
3531 switch (event) { 3531 switch (event) {
3532 case NETDEV_CHANGENAME: 3532 case NETDEV_CHANGENAME:
@@ -3544,7 +3544,7 @@ static int bond_master_netdev_event(unsigned long event, struct net_device *bond
3544static int bond_slave_netdev_event(unsigned long event, struct net_device *slave_dev) 3544static int bond_slave_netdev_event(unsigned long event, struct net_device *slave_dev)
3545{ 3545{
3546 struct net_device *bond_dev = slave_dev->master; 3546 struct net_device *bond_dev = slave_dev->master;
3547 struct bonding *bond = bond_dev->priv; 3547 struct bonding *bond = netdev_priv(bond_dev);
3548 3548
3549 switch (event) { 3549 switch (event) {
3550 case NETDEV_UNREGISTER: 3550 case NETDEV_UNREGISTER:
@@ -3795,7 +3795,7 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb,
3795 3795
3796static int bond_open(struct net_device *bond_dev) 3796static int bond_open(struct net_device *bond_dev)
3797{ 3797{
3798 struct bonding *bond = bond_dev->priv; 3798 struct bonding *bond = netdev_priv(bond_dev);
3799 3799
3800 bond->kill_timers = 0; 3800 bond->kill_timers = 0;
3801 3801
@@ -3844,7 +3844,7 @@ static int bond_open(struct net_device *bond_dev)
3844 3844
3845static int bond_close(struct net_device *bond_dev) 3845static int bond_close(struct net_device *bond_dev)
3846{ 3846{
3847 struct bonding *bond = bond_dev->priv; 3847 struct bonding *bond = netdev_priv(bond_dev);
3848 3848
3849 if (bond->params.mode == BOND_MODE_8023AD) { 3849 if (bond->params.mode == BOND_MODE_8023AD) {
3850 /* Unregister the receive of LACPDUs */ 3850 /* Unregister the receive of LACPDUs */
@@ -3898,7 +3898,7 @@ static int bond_close(struct net_device *bond_dev)
3898 3898
3899static struct net_device_stats *bond_get_stats(struct net_device *bond_dev) 3899static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)
3900{ 3900{
3901 struct bonding *bond = bond_dev->priv; 3901 struct bonding *bond = netdev_priv(bond_dev);
3902 struct net_device_stats *stats = &(bond->stats), *sstats; 3902 struct net_device_stats *stats = &(bond->stats), *sstats;
3903 struct net_device_stats local_stats; 3903 struct net_device_stats local_stats;
3904 struct slave *slave; 3904 struct slave *slave;
@@ -3976,7 +3976,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
3976 } 3976 }
3977 3977
3978 if (mii->reg_num == 1) { 3978 if (mii->reg_num == 1) {
3979 struct bonding *bond = bond_dev->priv; 3979 struct bonding *bond = netdev_priv(bond_dev);
3980 mii->val_out = 0; 3980 mii->val_out = 0;
3981 read_lock(&bond->lock); 3981 read_lock(&bond->lock);
3982 read_lock(&bond->curr_slave_lock); 3982 read_lock(&bond->curr_slave_lock);
@@ -4068,7 +4068,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
4068 4068
4069static void bond_set_multicast_list(struct net_device *bond_dev) 4069static void bond_set_multicast_list(struct net_device *bond_dev)
4070{ 4070{
4071 struct bonding *bond = bond_dev->priv; 4071 struct bonding *bond = netdev_priv(bond_dev);
4072 struct dev_mc_list *dmi; 4072 struct dev_mc_list *dmi;
4073 4073
4074 /* 4074 /*
@@ -4129,7 +4129,7 @@ static void bond_set_multicast_list(struct net_device *bond_dev)
4129 */ 4129 */
4130static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) 4130static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
4131{ 4131{
4132 struct bonding *bond = bond_dev->priv; 4132 struct bonding *bond = netdev_priv(bond_dev);
4133 struct slave *slave, *stop_at; 4133 struct slave *slave, *stop_at;
4134 int res = 0; 4134 int res = 0;
4135 int i; 4135 int i;
@@ -4201,7 +4201,7 @@ unwind:
4201 */ 4201 */
4202static int bond_set_mac_address(struct net_device *bond_dev, void *addr) 4202static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
4203{ 4203{
4204 struct bonding *bond = bond_dev->priv; 4204 struct bonding *bond = netdev_priv(bond_dev);
4205 struct sockaddr *sa = addr, tmp_sa; 4205 struct sockaddr *sa = addr, tmp_sa;
4206 struct slave *slave, *stop_at; 4206 struct slave *slave, *stop_at;
4207 int res = 0; 4207 int res = 0;
@@ -4282,7 +4282,7 @@ unwind:
4282 4282
4283static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev) 4283static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev)
4284{ 4284{
4285 struct bonding *bond = bond_dev->priv; 4285 struct bonding *bond = netdev_priv(bond_dev);
4286 struct slave *slave, *start_at; 4286 struct slave *slave, *start_at;
4287 int i, slave_no, res = 1; 4287 int i, slave_no, res = 1;
4288 4288
@@ -4331,7 +4331,7 @@ out:
4331 */ 4331 */
4332static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_dev) 4332static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_dev)
4333{ 4333{
4334 struct bonding *bond = bond_dev->priv; 4334 struct bonding *bond = netdev_priv(bond_dev);
4335 int res = 1; 4335 int res = 1;
4336 4336
4337 read_lock(&bond->lock); 4337 read_lock(&bond->lock);
@@ -4363,7 +4363,7 @@ out:
4363 */ 4363 */
4364static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) 4364static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
4365{ 4365{
4366 struct bonding *bond = bond_dev->priv; 4366 struct bonding *bond = netdev_priv(bond_dev);
4367 struct slave *slave, *start_at; 4367 struct slave *slave, *start_at;
4368 int slave_no; 4368 int slave_no;
4369 int i; 4369 int i;
@@ -4409,7 +4409,7 @@ out:
4409 */ 4409 */
4410static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) 4410static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev)
4411{ 4411{
4412 struct bonding *bond = bond_dev->priv; 4412 struct bonding *bond = netdev_priv(bond_dev);
4413 struct slave *slave, *start_at; 4413 struct slave *slave, *start_at;
4414 struct net_device *tx_dev = NULL; 4414 struct net_device *tx_dev = NULL;
4415 int i; 4415 int i;
@@ -4552,7 +4552,7 @@ static const struct ethtool_ops bond_ethtool_ops = {
4552 */ 4552 */
4553static int bond_init(struct net_device *bond_dev, struct bond_params *params) 4553static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4554{ 4554{
4555 struct bonding *bond = bond_dev->priv; 4555 struct bonding *bond = netdev_priv(bond_dev);
4556 4556
4557 dprintk("Begin bond_init for %s\n", bond_dev->name); 4557 dprintk("Begin bond_init for %s\n", bond_dev->name);
4558 4558
@@ -4657,7 +4657,7 @@ static void bond_work_cancel_all(struct bonding *bond)
4657 */ 4657 */
4658static void bond_deinit(struct net_device *bond_dev) 4658static void bond_deinit(struct net_device *bond_dev)
4659{ 4659{
4660 struct bonding *bond = bond_dev->priv; 4660 struct bonding *bond = netdev_priv(bond_dev);
4661 4661
4662 list_del(&bond->bond_list); 4662 list_del(&bond->bond_list);
4663 4663
@@ -5149,7 +5149,7 @@ int bond_create(char *name, struct bond_params *params)
5149 5149
5150 up_write(&bonding_rwsem); 5150 up_write(&bonding_rwsem);
5151 rtnl_unlock(); /* allows sysfs registration of net device */ 5151 rtnl_unlock(); /* allows sysfs registration of net device */
5152 res = bond_create_sysfs_entry(bond_dev->priv); 5152 res = bond_create_sysfs_entry(netdev_priv(bond_dev));
5153 if (res < 0) { 5153 if (res < 0) {
5154 rtnl_lock(); 5154 rtnl_lock();
5155 down_write(&bonding_rwsem); 5155 down_write(&bonding_rwsem);