Hi all,

Can anybody explain me the logic how the meter drops packet in a software
switch? I am not able to understand the below code snippet. Please help.

static bool
consume_tokens(struct ofl_meter_band_stats *band, uint16_t meter_flag,
struct packet *pkt){

    if(meter_flag & OFPMF_KBPS){
        uint32_t pkt_size = (pkt->buffer->size*8)/1024;
        if (band->tokens >= pkt_size) {
            band->tokens -= pkt_size;
            return true;
        } else {
            return false;
        }

    }
    else if(meter_flag & OFPMF_PKTPS) {
        if (band->tokens >= 1000) {
            band->tokens -= 1000;
            return true;
        } else {
            return false;
        }
    }
    return false;
}

-> What are band->tokens? I am not able to find them in the code.
-> What is the significance of 1000?


-- 
*Regards,*
*Purnima*
_______________________________________________
openflow-discuss mailing list
openflow-discuss@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/openflow-discuss

Reply via email to