X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Fpower%2Fguest_channel.c;h=969a9e5aaa0697578e8adab50c3552616c01e7c1;hb=080c84cde42fd06443b02f495cd0397a490a1f71;hp=2f7507a03cf266de28bcdebde02f07d7dec5e55f;hpb=99a2dd955fba6e4cc23b77d590a033650ced9c45;p=dpdk.git diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c index 2f7507a03c..969a9e5aaa 100644 --- a/lib/power/guest_channel.c +++ b/lib/power/guest_channel.c @@ -4,9 +4,7 @@ #include #include -#include #include -#include #include #include #include @@ -166,6 +164,17 @@ int power_guest_channel_read_msg(void *pkt, if (pkt_len == 0 || pkt == NULL) return -1; + if (lcore_id >= RTE_MAX_LCORE) { + RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n", + lcore_id, RTE_MAX_LCORE-1); + return -1; + } + + if (global_fds[lcore_id] < 0) { + RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not connected\n"); + return -1; + } + fds.fd = global_fds[lcore_id]; fds.events = POLLIN; @@ -179,17 +188,6 @@ int power_guest_channel_read_msg(void *pkt, return -1; } - if (lcore_id >= RTE_MAX_LCORE) { - RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n", - lcore_id, RTE_MAX_LCORE-1); - return -1; - } - - if (global_fds[lcore_id] < 0) { - RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not connected\n"); - return -1; - } - while (pkt_len > 0) { ret = read(global_fds[lcore_id], pkt, pkt_len);