static indigo_error_t ind_ofdpa_queue_config_queue_set(of_packet_queue_t *of_packet_queue, uint32_t port, uint32_t queueId) { indigo_error_t err = INDIGO_ERROR_NONE; OFDPA_ERROR_t ofdpa_rv = OFDPA_E_NONE; uint32_t minRate, maxRate; of_list_queue_prop_t of_list_queue_prop; of_queue_prop_min_rate_t min_rate; of_queue_prop_max_rate_t max_rate; /* Set the queue id: id for the specific queue. */ of_packet_queue_queue_id_set(of_packet_queue, queueId); /* Set the port: Port this queue is attached to. */ of_packet_queue_port_set(of_packet_queue, port); ofdpa_rv = ofdpaQueueRateGet(port, queueId, &minRate, &maxRate); if (ofdpa_rv != OFDPA_E_NONE) { LOG_ERROR("Failed to get port queue min and max rates. (ofdpa_rv = %d)", ofdpa_rv); err = (indigoConvertOfdpaRv(ofdpa_rv)); } else { /** ROBS FIXME: logic here confuses me and I think I'm not fixing it * need to come back and make sure we're not trying to persist * stack allocated objects -- just try to compile first */ of_packet_queue_properties_bind(of_packet_queue, &of_list_queue_prop); of_queue_prop_min_rate_init(&min_rate, of_packet_queue->version, -1, 1); of_list_queue_prop_append_bind(&of_list_queue_prop, (of_queue_prop_t *)&min_rate); of_queue_prop_min_rate_rate_set(&min_rate, (uint16_t)minRate); of_queue_prop_max_rate_init(&max_rate, of_packet_queue->version, -1, 1); of_list_queue_prop_append_bind(&of_list_queue_prop, (of_queue_prop_t *)&max_rate); of_queue_prop_max_rate_rate_set(&max_rate, (uint16_t)maxRate); } return err; }
/* Generated from of10/queue_get_config_reply.data */ static int test_of10_queue_get_config_reply(void) { uint8_t binary[] = { 0x01, 0x15, 0x00, 0x50, 0x12, 0x34, 0x56, 0x78, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; of_object_t *obj; obj = of_queue_get_config_reply_new(OF_VERSION_1_0); of_queue_get_config_reply_port_set(obj, 65534); { of_object_t list; of_queue_get_config_reply_queues_bind(obj, &list); { of_object_t *obj = of_packet_queue_new(OF_VERSION_1_0); { of_object_t list; of_packet_queue_properties_bind(obj, &list); { of_object_t *obj = of_queue_prop_min_rate_new(OF_VERSION_1_0); of_queue_prop_min_rate_rate_set(obj, 5); of_list_append(&list, obj); of_object_delete(obj); } } of_packet_queue_queue_id_set(obj, 1); of_list_append(&list, obj); of_object_delete(obj); } { of_object_t *obj = of_packet_queue_new(OF_VERSION_1_0); { of_object_t list; of_packet_queue_properties_bind(obj, &list); { of_object_t *obj = of_queue_prop_min_rate_new(OF_VERSION_1_0); of_queue_prop_min_rate_rate_set(obj, 6); of_list_append(&list, obj); of_object_delete(obj); } { of_object_t *obj = of_queue_prop_min_rate_new(OF_VERSION_1_0); of_queue_prop_min_rate_rate_set(obj, 7); of_list_append(&list, obj); of_object_delete(obj); } } of_packet_queue_queue_id_set(obj, 2); of_list_append(&list, obj); of_object_delete(obj); } } of_queue_get_config_reply_xid_set(obj, 305419896); if (sizeof(binary) != WBUF_CURRENT_BYTES(OF_OBJECT_TO_WBUF(obj)) || memcmp(binary, WBUF_BUF(OF_OBJECT_TO_WBUF(obj)), sizeof(binary))) { show_failure(binary, sizeof(binary), WBUF_BUF(OF_OBJECT_TO_WBUF(obj)), WBUF_CURRENT_BYTES(OF_OBJECT_TO_WBUF(obj))); of_object_delete(obj); return TEST_FAIL; } of_object_delete(obj); return TEST_PASS; }