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; }
static int deserialize_base_pci(const struct serdes * instance, struct pci * new_pci, int * offset, const uint8_t * ptr, ssize_t * pdu_len) { int vers; address_t addr; cep_id_t cep; qos_id_t qos; pdu_type_t pdu_type; pdu_flags_t pdu_flags; struct dt_cons * dt_cons; ASSERT(instance); ASSERT(new_pci); ASSERT(ptr); dt_cons = instance->dt_cons; ASSERT(dt_cons); vers = 0; addr = 0; cep = 0; qos = 0; pdu_type = 0x00; pdu_flags = 0x0; *offset = 0; memcpy(&vers, ptr + *offset, VERSION_SIZE); *offset += VERSION_SIZE; if (vers != version) { LOG_ERR("Received an unknown version of the EFCP PDU (%d)", vers); return -1; } memcpy(&addr, ptr + *offset, dt_cons->address_length); *offset += dt_cons->address_length; if (pci_destination_set(new_pci, addr)) return -1; memcpy(&addr, ptr + *offset, dt_cons->address_length); *offset += dt_cons->address_length; if (pci_source_set(new_pci, addr)) return -1; memcpy(&qos, ptr + *offset, dt_cons->qos_id_length); *offset += dt_cons->qos_id_length; if (pci_qos_id_set(new_pci, qos)) return -1; memcpy(&cep, ptr + *offset, dt_cons->cep_id_length); *offset += dt_cons->cep_id_length; if (pci_cep_source_set(new_pci, cep)) return -1; memcpy(&cep, ptr + *offset, dt_cons->cep_id_length); *offset += dt_cons->cep_id_length; if (pci_cep_destination_set(new_pci, cep)) return -1; memcpy(&pdu_type, ptr + *offset, PDU_TYPE_SIZE); *offset += PDU_TYPE_SIZE; if (pci_type_set(new_pci, pdu_type)) return -1; memcpy(&pdu_flags, ptr + *offset, FLAGS_SIZE); *offset += FLAGS_SIZE; if (pci_flags_set(new_pci, pdu_flags)) return -1; memcpy(pdu_len, ptr + *offset, dt_cons->length_length); *offset += dt_cons->length_length; return 0; }