]> rtime.felk.cvut.cz Git - frescor/fna.git/commitdiff
renegotiate_sync
authorsangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Fri, 10 Aug 2007 17:05:44 +0000 (17:05 +0000)
committersangorrin <sangorrin@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Fri, 10 Aug 2007 17:05:44 +0000 (17:05 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/fna/trunk@668 35b4ef3e-fd22-0410-ab77-dab3279adceb

src_rtep/rtep_fna_c.c

index f2a23b85b0c30ad9b3853da53c976ae2e3696bdb..e442dbb6dce27896e953454c7196f1b3fc036411 100644 (file)
@@ -236,7 +236,24 @@ int rtep_fna_contract_renegotiate_sync
        const fna_vres_id_t vres,
        const frsh_contract_t *new_contract)
 {
-   return 0;
+    rtep_bwres_contract_t rtep_contract;
+    int accepted;
+    int pos = (int) vres;
+
+    // convert FRSH contract to RTEP BWRES contract
+    rtep_contract.period_max = new_contract->period_max;
+    rtep_contract.deadline = new_contract->deadline;
+    rtep_contract.prio = new_contract->preemption_level;
+    // in RTEP BWRES, budget is given in number of packets. We do a little trick
+    // in the function bytes_to_network_budget to use a the field tv_sec from
+    // the timespec in frsh_contract to store the budget in bytes directly
+    rtep_contract.budget_min = new_contract->budget_min.tv_sec;
+
+    // renegotiate the contract
+    accepted = rtep_bwres_contract_renegotiate_sync
+            (&rtep_vres_list[pos], &rtep_contract);
+
+    return accepted;
 }
 
 /**