diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-10-18 11:43:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-19 18:58:45 -0400 |
commit | 080a06e1a9a5d2c55884d5fba8755d0af838cd5c (patch) | |
tree | 76ae7b1b4ad438555b4a89bd61b3279229dcc9bd /drivers | |
parent | d9e32b21cb394c0816f206539b8c7e9c023db332 (diff) |
bonding: remove bond_ioctl_change_active()
no longer needed since bond_option_active_slave_set() can be used
instead.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 59 |
1 files changed, 2 insertions, 57 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index a113e4212486..d90734fca918 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1910,61 +1910,6 @@ static int bond_release_and_destroy(struct net_device *bond_dev, | |||
1910 | return ret; | 1910 | return ret; |
1911 | } | 1911 | } |
1912 | 1912 | ||
1913 | /* | ||
1914 | * This function changes the active slave to slave <slave_dev>. | ||
1915 | * It returns -EINVAL in the following cases. | ||
1916 | * - <slave_dev> is not found in the list. | ||
1917 | * - There is not active slave now. | ||
1918 | * - <slave_dev> is already active. | ||
1919 | * - The link state of <slave_dev> is not BOND_LINK_UP. | ||
1920 | * - <slave_dev> is not running. | ||
1921 | * In these cases, this function does nothing. | ||
1922 | * In the other cases, current_slave pointer is changed and 0 is returned. | ||
1923 | */ | ||
1924 | static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_device *slave_dev) | ||
1925 | { | ||
1926 | struct bonding *bond = netdev_priv(bond_dev); | ||
1927 | struct slave *old_active = NULL; | ||
1928 | struct slave *new_active = NULL; | ||
1929 | int res = 0; | ||
1930 | |||
1931 | if (!USES_PRIMARY(bond->params.mode)) | ||
1932 | return -EINVAL; | ||
1933 | |||
1934 | /* Verify that bond_dev is indeed the master of slave_dev */ | ||
1935 | if (!(slave_dev->flags & IFF_SLAVE) || | ||
1936 | !netdev_has_upper_dev(slave_dev, bond_dev)) | ||
1937 | return -EINVAL; | ||
1938 | |||
1939 | read_lock(&bond->lock); | ||
1940 | |||
1941 | old_active = bond->curr_active_slave; | ||
1942 | new_active = bond_get_slave_by_dev(bond, slave_dev); | ||
1943 | /* | ||
1944 | * Changing to the current active: do nothing; return success. | ||
1945 | */ | ||
1946 | if (new_active && new_active == old_active) { | ||
1947 | read_unlock(&bond->lock); | ||
1948 | return 0; | ||
1949 | } | ||
1950 | |||
1951 | if (new_active && | ||
1952 | old_active && | ||
1953 | new_active->link == BOND_LINK_UP && | ||
1954 | IS_UP(new_active->dev)) { | ||
1955 | block_netpoll_tx(); | ||
1956 | write_lock_bh(&bond->curr_slave_lock); | ||
1957 | bond_change_active_slave(bond, new_active); | ||
1958 | write_unlock_bh(&bond->curr_slave_lock); | ||
1959 | unblock_netpoll_tx(); | ||
1960 | } else | ||
1961 | res = -EINVAL; | ||
1962 | |||
1963 | read_unlock(&bond->lock); | ||
1964 | |||
1965 | return res; | ||
1966 | } | ||
1967 | |||
1968 | static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) | 1913 | static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) |
1969 | { | 1914 | { |
1970 | struct bonding *bond = netdev_priv(bond_dev); | 1915 | struct bonding *bond = netdev_priv(bond_dev); |
@@ -3257,6 +3202,7 @@ static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev, | |||
3257 | 3202 | ||
3258 | static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd) | 3203 | static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd) |
3259 | { | 3204 | { |
3205 | struct bonding *bond = netdev_priv(bond_dev); | ||
3260 | struct net_device *slave_dev = NULL; | 3206 | struct net_device *slave_dev = NULL; |
3261 | struct ifbond k_binfo; | 3207 | struct ifbond k_binfo; |
3262 | struct ifbond __user *u_binfo = NULL; | 3208 | struct ifbond __user *u_binfo = NULL; |
@@ -3287,7 +3233,6 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd | |||
3287 | 3233 | ||
3288 | 3234 | ||
3289 | if (mii->reg_num == 1) { | 3235 | if (mii->reg_num == 1) { |
3290 | struct bonding *bond = netdev_priv(bond_dev); | ||
3291 | mii->val_out = 0; | 3236 | mii->val_out = 0; |
3292 | read_lock(&bond->lock); | 3237 | read_lock(&bond->lock); |
3293 | read_lock(&bond->curr_slave_lock); | 3238 | read_lock(&bond->curr_slave_lock); |
@@ -3359,7 +3304,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd | |||
3359 | break; | 3304 | break; |
3360 | case BOND_CHANGE_ACTIVE_OLD: | 3305 | case BOND_CHANGE_ACTIVE_OLD: |
3361 | case SIOCBONDCHANGEACTIVE: | 3306 | case SIOCBONDCHANGEACTIVE: |
3362 | res = bond_ioctl_change_active(bond_dev, slave_dev); | 3307 | res = bond_option_active_slave_set(bond, slave_dev); |
3363 | break; | 3308 | break; |
3364 | default: | 3309 | default: |
3365 | res = -EOPNOTSUPP; | 3310 | res = -EOPNOTSUPP; |