#include <misc/linux_list.h> // struct list_head
#include <misc/freelist.h> // freelist_t
-#include <drivers/frescan.h> // frescan_node_t, _prio_t, _budget_t
+#include "frescan.h" // frescan_node_t, _prio_t, _budget_t
#include "frescan_config.h" // FRESCAN_MLOCK_T, FRESCAN_MX_XXX
#include "frescan_packets.h" // frescan_packet_t
#include "frescan_servers_replenishments.h" // frescan_repl_op_t
typedef struct {
frescan_budget_t budget;
- struct timespec period;
+ struct timespec period;
+} frescan_budget_period_t;
+
+typedef struct {
+ frescan_budget_period_t values;
frescan_prio_t prio;
} frescan_server_params_t;
extern freelist_t the_servers_pool_freelist[FRESCAN_MX_NETWORKS];
extern frescan_server_data_t the_active_servers[FRESCAN_MX_NETWORKS];
+/**
+ * frescan_contract_t
+ */
+
+typedef struct {
+ frescan_budget_period_t min_values;
+ frescan_budget_period_t max_values;
+ frescan_prio_t prio;
+} frescan_contract_t;
+
/**
* frescan_prio_queue_t - priority queue
*
* synchronization is done using a semaphore. This is because the queues
* are accesed concurrently from user threads and the IRQ handler.
*
+ * @net: the network this priority queue belongs to (mainly for locking)
* @fifo_queues: an array of packets for each priority where each packet
* is just the head of a fifo_list. The array is allocated
* from the heap, using malloc, at initialization with range
*/
typedef struct {
+ frescan_network_t net;
frescan_packet_t *fifo_queues;
uint32_t max_prio;
sem_t sem;
* @local_node: the local node id for that network. The implementation does not
* support several interfaces for the same network.
* @fd: file descriptor associated to /dev/canXX
+ * @repl_thread_id: replenishment thread id
+ * @neg_thread_id: master local negotiator thread id (only master node has it)
+ * @acceptor_thread_id: acceptor negotiation thread id (all nodes have one)
+ * @neg_messages_ss_id: sporadic server for negotiation messages
* @queues: the queues of this network instance
* @last_packet: pointer to the last packet from which a frame was inserted
* in the chip and its transmission is not complete.
frescan_node_t local_node;
int fd;
fosa_thread_id_t repl_thread_id;
+ fosa_thread_id_t neg_thread_id;
+ fosa_thread_id_t acceptor_thread_id;
+ frescan_ss_t neg_messages_ss_id;
frescan_queues_t queues;
frescan_packet_t *last_packet;
frescan_prio_t last_packet_prio;