[dpdk-dev] [PATCH v2 2/4] power: extend guest channel api	for	reading
    Pattan, Reshma 
    reshma.pattan at intel.com
       
    Tue Mar 19 16:00:47 CET 2019
    
    
  
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Hajkowski
> ---
> diff --git a/lib/librte_power/channel_commands.h
> +#define CPU_POWER_CMD_NAK       2
Instead of NAK , NACK would be better I guess.
> +	if (global_fds[lcore_id] == 0) {
Is this now < 0 ?
> +		ret = read(global_fds[lcore_id],
> +				buffer, buffer_len);
> +		if (ret < 0) {
read() return value 0 also should be handled?
> +
> +int rte_power_guest_channel_receive_msg(struct channel_packet *pkt,
> +			unsigned int lcore_id)
> +{
> +	int ret;
> +
> +	struct pollfd fds;
> +	fds.fd = global_fds[lcore_id];
> +	fds.events = POLLIN;
> +
> +	ret = poll(&fds, 1, TIMEOUT);
> +	if (ret == 0) {
> +		RTE_LOG(DEBUG, GUEST_CHANNEL, "Timeout occurs during
> poll function.\n");
> +		return -1;
> +	} else if (ret < 0) {
> +		RTE_LOG(ERR, GUEST_CHANNEL, "Error occurred during poll
> function: %s\n",
> +				strerror(ret));
> +		return -1;
> +	}
> +
You can keep this function simple by moving all the code above code to power_guest_channel_read_msg(), like the way done in rte_power_guest_channel_send_msg() and guest_channel_send_msg().
Thanks,
Reshma
    
    
More information about the dev
mailing list