Changeset 10895


Ignore:
Timestamp:
11/13/08 01:51:20 (5 years ago)
Author:
BrainSlayer
Message:

two duplex modes, one for master, one for slave

Location:
src/linux/pb42/linux-2.6.22
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/linux/pb42/linux-2.6.22/drivers/net/bonding/bond_main.c

    r10887 r10895  
    116116                       "1 for active-backup, 2 for balance-xor, " 
    117117                       "3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, " 
    118                        "6 for balance-alb, 7 for weighted-rr, 8 duplex"); 
     118                       "6 for balance-alb, 7 for weighted-rr, 8 duplex-master, 9 duplex-slave"); 
    119119module_param(primary, charp, 0); 
    120120MODULE_PARM_DESC(primary, "Primary network device to use"); 
     
    166166{       "balance-alb",          BOND_MODE_ALB}, 
    167167{       "weighted-rr",          BOND_MODE_WEIGHTED_RR}, 
    168 {       "duplex",               BOND_MODE_DUPLEX}, 
     168{       "duplex-master",                BOND_MODE_DUPLEX}, 
     169{       "duplex-slave",         BOND_MODE_DUPLEX_SLAVE}, 
    169170{       NULL,                   -1}, 
    170171}; 
     
    210211                return "weighted round robin (weighted-rr)"; 
    211212        case BOND_MODE_DUPLEX: 
    212                 return "duplex mode"; 
     213                return "duplex master mode"; 
     214        case BOND_MODE_DUPLEX_SLAVE: 
     215                return "duplex slave mode"; 
    213216        default: 
    214217                return "unknown"; 
     
    41174120 
    41184121 
    4119 static int bond_xmit_duplex(struct sk_buff *skb, struct net_device *bond_dev) 
     4122static int bond_xmit_duplex_master(struct sk_buff *skb, struct net_device *bond_dev) 
    41204123{ 
    41214124        struct bonding *bond = bond_dev->priv; 
     
    41414144        bond_for_each_slave_from(bond, slave, i, start_at) { 
    41424145                if ((i % 2) && IS_UP(slave->dev) && 
     4146                        (slave->link == BOND_LINK_UP) && 
     4147                    (slave->state == BOND_STATE_ACTIVE)) { 
     4148                         
     4149                        res = bond_dev_queue_xmit(bond, skb, slave->dev); 
     4150                        write_lock(&bond->curr_slave_lock); 
     4151                        bond->curr_active_slave = slave->next; 
     4152                        write_unlock(&bond->curr_slave_lock); 
     4153 
     4154                        goto out; 
     4155                } 
     4156        } 
     4157out: 
     4158        if (res) { 
     4159                /* no suitable interface, frame not sent */ 
     4160                dev_kfree_skb(skb); 
     4161        } 
     4162        read_unlock(&bond->lock); 
     4163        return 0; 
     4164} 
     4165 
     4166static int bond_xmit_duplex_slave(struct sk_buff *skb, struct net_device *bond_dev) 
     4167{ 
     4168        struct bonding *bond = bond_dev->priv; 
     4169        struct slave *slave, *start_at; 
     4170        int i; 
     4171        int res = 1; 
     4172 
     4173        read_lock(&bond->lock); 
     4174 
     4175        if (!BOND_IS_OK(bond)) { 
     4176                goto out; 
     4177        } 
     4178 
     4179        read_lock(&bond->curr_slave_lock); 
     4180        slave = start_at = bond->curr_active_slave; 
     4181        read_unlock(&bond->curr_slave_lock); 
     4182 
     4183        if (!slave) { 
     4184                goto out; 
     4185        } 
     4186 
     4187try_send: 
     4188        bond_for_each_slave_from(bond, slave, i, start_at) { 
     4189                if (!(i % 2) && IS_UP(slave->dev) && 
    41434190                        (slave->link == BOND_LINK_UP) && 
    41444191                    (slave->state == BOND_STATE_ACTIVE)) { 
     
    43214368                break; 
    43224369        case BOND_MODE_DUPLEX: 
    4323                 bond_dev->hard_start_xmit = bond_xmit_duplex; 
     4370                bond_dev->hard_start_xmit = bond_xmit_duplex_master; 
     4371                break; 
     4372        case BOND_MODE_DUPLEX_SLAVE: 
     4373                bond_dev->hard_start_xmit = bond_xmit_duplex_slave; 
    43244374                break; 
    43254375        case BOND_MODE_ACTIVEBACKUP: 
  • src/linux/pb42/linux-2.6.22/include/linux/if_bonding.h

    r10887 r10895  
    7373#define BOND_MODE_WEIGHTED_RR   7 
    7474#define BOND_MODE_DUPLEX   8 
     75#define BOND_MODE_DUPLEX_SLAVE   9 
    7576 
    7677/* each slave's link has 4 states */ 
Note: See TracChangeset for help on using the changeset viewer.