]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - src_frescan/frescan_data.h
renamings... redo the request and messages part... also now there will be two threads...
[frescor/fna.git] / src_frescan / frescan_data.h
index 3d76a0d9c2b9a51197c7d30fed06f7c8176b1270..88ca6c3d7d523b5ad9270d0def564183864f325d 100644 (file)
@@ -32,7 +32,7 @@
 #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
@@ -63,7 +63,11 @@ typedef struct {
 
 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;
 
@@ -100,6 +104,16 @@ extern frescan_server_data_t the_servers_pool[FRESCAN_MX_NETWORKS][FRESCAN_MX_ID
 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
  *
@@ -111,6 +125,7 @@ extern frescan_server_data_t the_active_servers[FRESCAN_MX_NETWORKS];
  * 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
@@ -120,6 +135,7 @@ extern frescan_server_data_t the_active_servers[FRESCAN_MX_NETWORKS];
  */
 
 typedef struct {
+        frescan_network_t net;
         frescan_packet_t *fifo_queues;
         uint32_t max_prio;
         sem_t sem;
@@ -146,6 +162,10 @@ typedef struct {
  * @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.
@@ -167,6 +187,9 @@ typedef struct {
         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;