CPqD / ofsoftswitch13

OpenFlow 1.3 switch.
http://cpqd.github.com/ofsoftswitch13
304 stars 192 forks source link

send packet with threads #205

Open JAHuah opened 9 years ago

JAHuah commented 9 years ago

Hi

we want to propose one change in the code, we observed that perfoming broadcast the switch take too, because it send the packets to a sequential form, it take a packet and send.

We propose to do this action through thread. the code will be this:

int dp_ports_output_all(struct datapath dp, struct ofpbuf buffer, int in_port, bool flood) { struct sw_port *p; int i = 0; pid_t idProcess[dp->ports_num]; //id threads

LIST_FOR_EACH (p, struct sw_port, node, &dp->port_list) {
    if (p->stats->port_no == in_port) {
        continue;
    }
    if (flood && p->conf->config & OFPPC_NO_FWD) {
        continue;
    }
            idProceso[i] = fork();
            switch(idProcess[i])
            {
                    case -1:
                        break;
                    case 0:
                        if( p->stats->port_no > 0)
                            dp_ports_output(dp, buffer, p->stats->port_no, 0);
                        exit(0);
                    default:
                        i++;
                        break;
            }
            //i++;
}
return 0;

}