X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvm_power_manager%2Fchannel_monitor.c;h=7892d75ded0467a243e911c7494272879fdee0b5;hb=d7b713d0dc85234936d85fbbf9014445b1b68efe;hp=85622e7cb102714f3ee8eb17a2313e451bfce799;hpb=5776b7a371d1635aea5f15dd5f79fdc0cafdb63d;p=dpdk.git diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index 85622e7cb1..7892d75ded 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -435,7 +435,7 @@ update_policy(struct channel_packet *pkt) /* Copy the contents of *pkt into the policy.pkt */ policies[i].pkt = *pkt; get_pcpu_to_control(&policies[i]); - if (get_pfid(&policies[i]) == -1) { + if (get_pfid(&policies[i]) < 0) { updated = 1; break; } @@ -449,7 +449,7 @@ update_policy(struct channel_packet *pkt) if (policies[i].enabled == 0) { policies[i].pkt = *pkt; get_pcpu_to_control(&policies[i]); - if (get_pfid(&policies[i]) == -1) + if (get_pfid(&policies[i]) < 0) break; core_share_status(i); policies[i].enabled = 1; @@ -630,6 +630,8 @@ apply_policy(struct policy *pol) static int process_request(struct channel_packet *pkt, struct channel_info *chan_info) { + int ret; + if (chan_info == NULL) return -1; @@ -640,7 +642,13 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info) if (pkt->command == CPU_POWER) { unsigned int core_num; - core_num = get_pcpu(chan_info, pkt->resource_id); + if (pkt->core_type == CORE_TYPE_VIRTUAL) + core_num = get_pcpu(chan_info, pkt->resource_id); + else + core_num = pkt->resource_id; + + RTE_LOG(DEBUG, CHANNEL_MONITOR, "Processing requested cmd for cpu:%d\n", + core_num); switch (pkt->unit) { case(CPU_POWER_SCALE_MIN): @@ -674,9 +682,13 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info) } if (pkt->command == PKT_POLICY_REMOVE) { - RTE_LOG(INFO, CHANNEL_MONITOR, - "Removing policy %s\n", pkt->vm_name); - remove_policy(pkt); + ret = remove_policy(pkt); + if (ret == 0) + RTE_LOG(INFO, CHANNEL_MONITOR, + "Removed policy %s\n", pkt->vm_name); + else + RTE_LOG(INFO, CHANNEL_MONITOR, + "Policy %s does not exist\n", pkt->vm_name); } /* @@ -753,7 +765,7 @@ read_binary_packet(struct channel_info *chan_info) buffer, buffer_len); if (n_bytes == buffer_len) break; - if (n_bytes == -1) { + if (n_bytes < 0) { err = errno; RTE_LOG(DEBUG, CHANNEL_MONITOR, "Received error on "