]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - src_frescan/frescan_data.h
add the infraestructure for storing the negotiated contracts and performing the analy...
[frescor/fna.git] / src_frescan / frescan_data.h
index c935e8ffdcd55efab6f68ab818594e73d244d74d..71354326cca555412a665f2fa3ecd84bb1b9942d 100644 (file)
@@ -35,7 +35,6 @@
 #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
 
 /**
  * frescan_repl_op_t - a replenishment operation
@@ -63,7 +62,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;
 
@@ -76,7 +79,9 @@ typedef struct {
  * @repl_list: the list of pending replenishment operations
  * @repl_timer: the timer for the replenishments associated to this server
  *     NOTE: we could use a single timer for all but for now this is simpler
+ * @act_time: the last activation time for the server
  * @packet_list: the packets enqueued on this server
+ * @servers_list: the list of servers
  */
 
 typedef struct {
@@ -88,6 +93,7 @@ typedef struct {
         frescan_budget_t  pending_packets;
         frescan_repl_op_t replenishments;
         timer_t           repl_timer;
+        struct timespec   act_time;
         frescan_packet_t  packet_list;
         struct list_head  servers_list;
 } frescan_server_data_t;
@@ -104,11 +110,6 @@ extern frescan_server_data_t the_active_servers[FRESCAN_MX_NETWORKS];
  * frescan_contract_t
  */
 
-typedef struct {
-        frescan_budget_t budget;
-        struct timespec  period;
-} frescan_budget_period_t;
-
 typedef struct {
         frescan_budget_period_t min_values;
         frescan_budget_period_t max_values;
@@ -116,13 +117,31 @@ typedef struct {
 } frescan_contract_t;
 
 /**
- * return info
+ * frescan_sa_xxx scheduling analysis types
  */
 
 typedef struct {
-        int error;
-        frescan_ss_t id;
-} frescan_neg_return_info_t;
+        frescan_prio_t server_prio;
+} frescan_sa_final_values_t;
+
+typedef struct {
+        frescan_contract_t        contract;
+        frescan_node_t            node;
+        frescan_ss_t              ss;
+        frescan_sa_final_values_t final_values;
+        struct list_head          list;
+} frescan_sa_contract_t;
+
+typedef struct {
+        frescan_prio_t    max_prio;
+        frescan_prio_t    min_prio;
+} frescan_sa_init_params_t;
+
+typedef struct {
+        frescan_sa_contract_t contracts[FRESCAN_MX_NODES][FRESCAN_MX_IDS];
+        frescan_sa_contract_t contracts_head;
+        frescan_sa_init_params_t init_params;
+} frescan_sa_scenario_t;
 
 /**
  * frescan_prio_queue_t - priority queue
@@ -135,6 +154,7 @@ typedef struct {
  * 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
@@ -144,6 +164,7 @@ typedef struct {
  */
 
 typedef struct {
+        frescan_network_t net;
         frescan_packet_t *fifo_queues;
         uint32_t max_prio;
         sem_t sem;
@@ -171,7 +192,8 @@ typedef struct {
  * support several interfaces for the same network.
  * @fd: file descriptor associated to /dev/canXX
  * @repl_thread_id: replenishment thread id
- * @neg_thread_id: negotiator thread id (only master node has it)
+ * @manager_thread_id: manager thread id
+ * @acceptor_thread_id: acceptor thread id
  * @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
@@ -182,6 +204,7 @@ typedef struct {
  * @id_fp_queues: the same as id_queues but for fp messages, which have
  *                id=FRESCAN_MX_IDS and are distinguised through their
  *                priorities.
+ * @scenario: the scheduling analysis scenario for the network
  *
  * the implementation can handle several FRESCAN networks at the same time
  * in the same node, so we need a place to store its internal data. The data
@@ -194,13 +217,15 @@ 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 manager_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;
         frescan_packet_t *id_queues[FRESCAN_MX_IDS];      // TODO: alloc at init
         frescan_packet_t *id_fp_queues[FRESCAN_MX_PRIOS]; // TODO: alloc at init
+        frescan_sa_scenario_t scenario;
 } frescan_network_data_t;
 
 extern frescan_network_data_t the_networks[FRESCAN_MX_NETWORKS];
@@ -212,6 +237,4 @@ extern frescan_network_data_t the_networks[FRESCAN_MX_NETWORKS];
 
 extern int frescan_data_init(int fd, frescan_init_params_t *params);
 
-
-
 #endif // _MARTE_FRESCAN_DATA_H_