Lines Matching defs:pkt
111 set_policy_mac(struct rte_power_channel_packet *pkt, int idx, char *mac)
122 pkt->vfid[idx] = 0;
130 pkt->vfid[idx] = pfid.pfid;
166 parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
174 memset(pkt, 0, sizeof(*pkt));
176 pkt->nb_mac_to_monitor = 0;
177 pkt->t_boost_status.tbEnabled = false;
178 pkt->workload = RTE_POWER_WL_LOW;
179 pkt->policy_to_use = RTE_POWER_POLICY_TIME;
180 pkt->command = RTE_POWER_PKT_POLICY;
181 pkt->core_type = RTE_POWER_CORE_TYPE_PHYSICAL;
192 ret = parse_json_to_pkt(value, pkt, vm_name);
197 ret = parse_json_to_pkt(value, pkt, vm_name);
204 pkt->command = RTE_POWER_CPU_POWER;
206 pkt->command = RTE_POWER_PKT_POLICY;
208 pkt->command = RTE_POWER_PKT_POLICY_REMOVE;
218 pkt->policy_to_use =
221 pkt->policy_to_use =
224 pkt->policy_to_use =
227 pkt->policy_to_use =
238 pkt->workload = RTE_POWER_WL_HIGH;
240 pkt->workload = RTE_POWER_WL_MEDIUM;
242 pkt->workload = RTE_POWER_WL_LOW;
255 pkt->timer_policy.busy_hours[i] = hour;
264 pkt->timer_policy.quiet_hours[i] = hour;
275 set_policy_mac(pkt, i, mac);
277 pkt->nb_mac_to_monitor = size;
279 pkt->traffic_policy.avg_max_packet_thresh =
282 pkt->traffic_policy.max_max_packet_thresh =
288 pkt->unit = RTE_POWER_SCALE_UP;
290 pkt->unit = RTE_POWER_SCALE_DOWN;
292 pkt->unit = RTE_POWER_SCALE_MAX;
294 pkt->unit = RTE_POWER_SCALE_MIN;
296 pkt->unit = RTE_POWER_ENABLE_TURBO;
298 pkt->unit = RTE_POWER_DISABLE_TURBO;
317 strlcpy(pkt->vm_name, vm_name, RTE_POWER_VM_MAX_NAME_SZ);
318 pkt->resource_id = resource_id;
334 if (strcmp(policies[pNo].pkt.vm_name,
356 for (z = 0; z < policies[pNo].pkt.num_vcpu; z++) {
372 if (pol->pkt.policy_to_use == RTE_POWER_POLICY_BRANCH_RATIO) {
378 pcpu, pol->pkt.vm_name);
382 pcpu, pol->pkt.vm_name);
388 pcpu, pol->pkt.vm_name);
405 "Looking for pcpu for %s\n", pol->pkt.vm_name);
412 if (pol->pkt.core_type == RTE_POWER_CORE_TYPE_VIRTUAL) {
418 get_info_vm(pol->pkt.vm_name, &info);
419 for (count = 0; count < pol->pkt.num_vcpu; count++) {
420 pcpu = info.pcpu_map[pol->pkt.vcpu_to_control[count]];
428 for (count = 0; count < pol->pkt.num_vcpu; count++) {
429 pcpu = pol->pkt.vcpu_to_control[count];
441 for (i = 0; i < pol->pkt.nb_mac_to_monitor; i++) {
446 (struct rte_ether_addr *)&(pol->pkt.vfid[i]));
468 update_policy(struct rte_power_channel_packet *pkt)
476 "Applying policy for %s\n", pkt->vm_name);
479 if (strcmp(policies[i].pkt.vm_name, pkt->vm_name) == 0) {
480 /* Copy the contents of *pkt into the policy.pkt */
481 policies[i].pkt = *pkt;
484 if (policies[i].pkt.policy_to_use ==
499 policies[i].pkt = *pkt;
502 if (policies[i].pkt.policy_to_use ==
519 remove_policy(struct rte_power_channel_packet *pkt __rte_unused)
528 if (strcmp(policies[i].pkt.vm_name, pkt->vm_name) == 0) {
549 for (x = 0; x < pol->pkt.nb_mac_to_monitor; x++) {
586 if (diff >= (pol->pkt.traffic_policy.max_max_packet_thresh)) {
587 for (count = 0; count < pol->pkt.num_vcpu; count++) {
592 } else if (diff >= (pol->pkt.traffic_policy.avg_max_packet_thresh)) {
593 for (count = 0; count < pol->pkt.num_vcpu; count++) {
598 } else if (diff < (pol->pkt.traffic_policy.avg_max_packet_thresh)) {
599 for (count = 0; count < pol->pkt.num_vcpu; count++) {
624 if (ptm->tm_hour == pol->pkt.timer_policy.busy_hours[x]) {
625 for (count = 0; count < pol->pkt.num_vcpu; count++) {
633 pol->pkt.timer_policy.quiet_hours[x]) {
634 for (count = 0; count < pol->pkt.num_vcpu; count++) {
642 pol->pkt.timer_policy.hours_to_use_traffic_profile[x]) {
655 if (pol->pkt.workload == RTE_POWER_WL_HIGH) {
656 for (count = 0; count < pol->pkt.num_vcpu; count++) {
661 } else if (pol->pkt.workload == RTE_POWER_WL_MEDIUM) {
662 for (count = 0; count < pol->pkt.num_vcpu; count++) {
667 } else if (pol->pkt.workload == RTE_POWER_WL_LOW) {
668 for (count = 0; count < pol->pkt.num_vcpu; count++) {
680 struct rte_power_channel_packet *pkt = &pol->pkt;
683 if (pkt->policy_to_use == RTE_POWER_POLICY_TRAFFIC)
685 else if (pkt->policy_to_use == RTE_POWER_POLICY_TIME)
687 else if (pkt->policy_to_use == RTE_POWER_POLICY_WORKLOAD)
722 send_freq(struct rte_power_channel_packet *pkt,
726 unsigned int vcore_id = pkt->resource_id;
730 if (get_info_vm(pkt->vm_name, &info) != 0)
758 send_capabilities(struct rte_power_channel_packet *pkt,
762 unsigned int vcore_id = pkt->resource_id;
768 if (get_info_vm(pkt->vm_name, &info) != 0)
812 send_ack_for_received_cmd(struct rte_power_channel_packet *pkt,
816 pkt->command = command;
817 return write_binary_packet(pkt,
818 sizeof(*pkt),
823 process_request(struct rte_power_channel_packet *pkt,
837 if (pkt->command == RTE_POWER_CPU_POWER) {
840 if (pkt->core_type == RTE_POWER_CORE_TYPE_VIRTUAL)
841 core_num = get_pcpu(chan_info, pkt->resource_id);
843 core_num = pkt->resource_id;
851 switch (pkt->unit) {
876 ret = send_ack_for_received_cmd(pkt,
888 if (pkt->command == RTE_POWER_PKT_POLICY) {
890 pkt->vm_name);
891 int ret = send_ack_for_received_cmd(pkt,
896 update_policy(pkt);
900 if (pkt->command == RTE_POWER_PKT_POLICY_REMOVE) {
901 ret = remove_policy(pkt);
904 "Removed policy %s\n", pkt->vm_name);
907 "Policy %s does not exist\n", pkt->vm_name);
910 if (pkt->command == RTE_POWER_QUERY_FREQ_LIST ||
911 pkt->command == RTE_POWER_QUERY_FREQ) {
914 "Frequency for %s requested.\n", pkt->vm_name);
915 int ret = send_freq(pkt,
917 pkt->command == RTE_POWER_QUERY_FREQ_LIST);
922 if (pkt->command == RTE_POWER_QUERY_CAPS_LIST ||
923 pkt->command == RTE_POWER_QUERY_CAPS) {
926 "Capabilities for %s requested.\n", pkt->vm_name);
927 int ret = send_capabilities(pkt,
929 pkt->command == RTE_POWER_QUERY_CAPS_LIST);
999 struct rte_power_channel_packet pkt;
1000 void *buffer = &pkt;
1001 int buffer_len = sizeof(pkt);
1023 process_request(&pkt, chan_info);
1030 struct rte_power_channel_packet pkt;
1073 * object, we can overwrite the pkt
1077 ret = parse_json_to_pkt(root, &pkt, resource_name);
1084 start = strstr(pkt.vm_name,
1095 pkt.num_vcpu = 1;
1096 pkt.vcpu_to_control[0] = n;
1097 process_request(&pkt, chan_info);
1103 process_request(&pkt, chan_info);