Ejemplo n.º 1
0
static int dctcp_rcvr_flow_control(struct dtcp_ps * ps, const struct pci * pci)
{
    struct dtcp * dtcp = ps->dm;
    struct dctcp_dtcp_ps_data * data = ps->priv;
    seq_num_t new_credit;
    uint_t alpha_old = 0;

    spin_lock_bh(&dtcp->parent->sv_lock);
    new_credit = dtcp->sv->rcvr_credit;
    if (data->state == SLOW_START) {
        new_credit++;
        if (new_credit >= data->sshtresh) {
            data->state = CONG_AVOID;
        }
    } else {
        data->dec_credit += DEC_PRECISION/new_credit;
        if (data->dec_credit >= DEC_PRECISION) {
            new_credit++;
            data->dec_credit -= DEC_PRECISION;
        }
    }
    spin_unlock_bh(&dtcp->parent->sv_lock);
    data->sent_total++;
    alpha_old = data->dctcp_alpha;
    if ((pci_flags_get(pci) & PDU_FLAGS_EXPLICIT_CONGESTION)) {
        data->ecn_total++;
        /* alpha = (1-g) * alpha + g * F according DCTCP kernel patch */
        data->dctcp_alpha = alpha_old - (alpha_old >> data->shift_g) + (data->ecn_total << (10 - data->shift_g)) / data->sent_total;
        new_credit = max(new_credit - ((new_credit * data->dctcp_alpha) >> 11U), 2U);
        data->sshtresh = new_credit;
        data->state = CONG_AVOID;
        LOG_DBG("DCTCP DTCP: dctcp_alpha: %d, new_credit %d", data->dctcp_alpha, new_credit);
    }
Ejemplo n.º 2
0
static int mark_pdu(struct du * ret_pdu)
{
        pdu_flags_t     pci_flags;

        pci_flags = pci_flags_get(&ret_pdu->pci);
        pci_flags_set(&ret_pdu->pci, pci_flags |= PDU_FLAGS_EXPLICIT_CONGESTION);
        LOG_DBG("ECN bit marked");
	return 0;
}
Ejemplo n.º 3
0
Archivo: serdes.c Proyecto: msune/irati
static int serialize_base_pci(const struct serdes * instance,
                              char *                data,
                              const struct pci *    pci,
                              size_t                pdu_len)
{
        int              offset;
        address_t        addr;
        cep_id_t         cep;
        qos_id_t         qos;
        pdu_type_t       type;
        pdu_flags_t      flags;
        struct dt_cons * dt_cons;

        ASSERT(instance);
        ASSERT(data);
        ASSERT(pci_is_ok(pci));
        ASSERT(pdu_len);

        dt_cons = instance->dt_cons;
        ASSERT(dt_cons);

        /*
         * Putting 1 as version number for now
         * If another version is needed, this will have to change
         * Always 8 bit long
         */
        offset = 0;
        memcpy(data + offset, &version, VERSION_SIZE);
        offset += VERSION_SIZE;
        LOG_DBG("Serialized version %d, with size %d", version, VERSION_SIZE);

        addr = pci_destination(pci);
        memcpy(data + offset, &addr, dt_cons->address_length);
        offset += dt_cons->address_length;

        addr = pci_source(pci);
        memcpy(data + offset, &addr, dt_cons->address_length);
        offset += dt_cons->address_length;

        qos = pci_qos_id(pci);
        memcpy(data + offset, &qos, dt_cons->qos_id_length);
        offset += dt_cons->qos_id_length;

        cep = pci_cep_source(pci);
        memcpy(data + offset, &cep, dt_cons->cep_id_length);
        offset += dt_cons->cep_id_length;

        cep = pci_cep_destination(pci);
        memcpy(data + offset, &cep, dt_cons->cep_id_length);
        offset += dt_cons->cep_id_length;

        type = pci_type(pci);
        memcpy(data + offset, &type, PDU_TYPE_SIZE);
        offset += PDU_TYPE_SIZE;

        flags = pci_flags_get(pci);
        memcpy(data + offset, &flags, FLAGS_SIZE);
        offset += FLAGS_SIZE;

        memcpy(data + offset, &pdu_len, dt_cons->length_length);
        offset += dt_cons->length_length;

        return 0;
}