Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 907 → Rev 908

/shark/trunk/ports/first/first-server.c
139,7 → 139,7
break;
}
 
if (contract->d_equals_t == false) {
if (contract->d_equals_t == true) {
*budget = SERVER_setbudget(fsf_server_level,
TIMESPEC2USEC(&(contract->budget_min)),
TIMESPEC2USEC(&(contract->period_max)),
204,6 → 204,8
 
T=TIMESPEC2USEC(&contract->period_min);
Q=TIMESPEC2USEC(&contract->budget_max);
server_list[i].Cmax=Q;
 
mul32div32to32(MAX_BANDWIDTH,Q,T,server_list[current_server].Umax);
T=TIMESPEC2USEC(&contract->period_min);
218,12 → 220,12
mul32div32to32(MAX_BANDWIDTH,Q,T,server_list[i].Umin);
server_list[i].U=server_list[i].Umin;
 
if (contract->d_equals_t == false) {
if (contract->d_equals_t == true) {
server_list[i].deadline = 0;
server_list[i].d_equals_t = false;
server_list[i].d_equals_t = true;
} else {
server_list[i].deadline = TIMESPEC2USEC(&contract->deadline);;
server_list[i].d_equals_t = true;
server_list[i].d_equals_t = false;
}
server_list[i].Qs = contract->quality;
294,6 → 296,7
server_list[i].U=server_list[i+1].Umin;
server_list[i].Umax=server_list[i+1].Umax;
server_list[i].Cmin=server_list[i+1].Cmin;
server_list[i].Cmax=server_list[i+1].Cmax;
server_list[i].Tmin=server_list[i+1].Tmin;
server_list[i].Tmax=server_list[i+1].Tmax;
server_list[i].Qs=server_list[i+1].Qs;
336,6 → 339,9
 
// send response server is -1 if the operation fail
m.type=CHANGE_PARAMETER;
m.server=server;
m.qi.quality = new_quality;
m.qi.importance = new_importance;
//memmove(&m.contract,contract, sizeof(fsf_contract_parameters_t));
 
port_send(channel[1],&m,BLOCK);
347,7 → 353,7
 
//*server=m.server;
 
 
return 0;
}
 
 
899,7 → 905,7
kern_printf("(1 - Q %ld T %ld)", server_list[i].actual_budget, server_list[i].actual_period);
#endif
if (server_list[i].d_equals_t == false)
if (server_list[i].d_equals_t == true)
adjust_SERVER_budget(server_list[i].server,server_list[i].Cmin, T, T);
else
adjust_SERVER_budget(server_list[i].server,server_list[i].Cmin, T, server_list[i].deadline);
912,7 → 918,7
kern_printf("(2 - Q %ld T %ld)", server_list[i].actual_budget, server_list[i].actual_period);
#endif
if (server_list[i].d_equals_t == false)
if (server_list[i].d_equals_t == true)
adjust_SERVER_budget(server_list[i].server,Q, server_list[i].Tmin, server_list[i].Tmin);
else
adjust_SERVER_budget(server_list[i].server,Q, server_list[i].Tmin, server_list[i].deadline);
955,13 → 961,13
#ifdef FSF_DEBUG
int temp;
kern_printf("(Recalculate contract)");
kern_printf("(RC)");
#endif
 
/* The current bandwidth is the min bandwidth */
current_bandwidth=SERVER_return_bandwidth(fsf_server_level);
#ifdef FSF_DEBUG
kern_printf("(nserver %d)", current_server);
kern_printf("(SER%d)", current_server);
#endif
//kern_printf("(CS:%d)", current_server);
do {
978,7 → 984,7
}
 
#ifdef FSF_DEBUG
kern_printf("(Total Quality %d)", Qt);
kern_printf("(TQ%d)", Qt);
#endif
isok=1;
for (i=0; i<current_server; i++) {
997,7 → 1003,7
#ifdef FSF_DEBUG
mul32div32to32(server_list[i].U,100, MAX_BANDWIDTH, temp);
kern_printf("(Server %d bw %d)", server_list[i].server, temp);
kern_printf("(SER %d BW %d)", server_list[i].server, temp);
#endif
}
}
1012,18 → 1018,19
fsf_server_id_t server)
{
struct mess message;
struct mess msg;
 
// send response server is -1 if the operation fail
message.type=RENEGOTIATE_CONTRACT;
memmove(&message.contract,new_contract, sizeof(fsf_contract_parameters_t));
message.server = server;
msg.type=RENEGOTIATE_CONTRACT;
memmove(&msg.contract,new_contract, sizeof(fsf_contract_parameters_t));
msg.server = server;
//kern_printf("(REN %d)", server);
port_send(channel[1],&msg,BLOCK);
 
port_send(channel[1],&message,BLOCK);
port_receive(channel[0], &msg, BLOCK);
 
port_receive(channel[0], &message, BLOCK);
 
if (message.server==-1) return FSF_ERR_CONTRACT_REJECTED;
//kern_printf("(REN %d)", msg.server);
if (msg.server==-1) return FSF_ERR_CONTRACT_REJECTED;
return 0;
}
1035,18 → 1042,18
union sigval sig_value)
{
struct mess message;
struct mess msg;
 
// send response server is -1 if the operation fail
message.type=REQUEST_RENEGOTIATE_CONTRACT;
memmove(&message.contract,new_contract, sizeof(fsf_contract_parameters_t));
message.server = server;
msg.type=REQUEST_RENEGOTIATE_CONTRACT;
memmove(&msg.contract,new_contract, sizeof(fsf_contract_parameters_t));
msg.server = server;
 
port_send(channel[1],&message,BLOCK);
port_send(channel[1],&msg,BLOCK);
 
port_receive(channel[0], &message, BLOCK);
port_receive(channel[0], &msg, BLOCK);
 
if (message.server==-1) return FSF_ERR_CONTRACT_REJECTED;
if (msg.server==-1) return FSF_ERR_CONTRACT_REJECTED;
return 0;
}