[v3,2/6] power: make channel msg functions public

Message ID 20210120135556.33763-3-david.hunt@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series power: fix make build for power apps |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hunt, David Jan. 20, 2021, 1:55 p.m. UTC
  From: Bruce Richardson <bruce.richardson@intel.com>

Move the 2 public functions into rte_power_guest_channel.h

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>

---
changes in v3
* Mark both added functions as experimental
---
 lib/librte_power/guest_channel.h           | 40 +---------------------
 lib/librte_power/rte_power_guest_channel.h | 40 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 39 deletions(-)
  

Comments

Burakov, Anatoly Jan. 20, 2021, 2:26 p.m. UTC | #1
On 20-Jan-21 1:55 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> Move the 2 public functions into rte_power_guest_channel.h
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> 
> ---

<snip>

>   
> +/**
> + * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
> + *
> + * @param pkt
> + *  Pointer to a populated struct channel_packet
> + *
> + * @param lcore_id
> + *  lcore_id.

Not very informative doxygen comment :)

> + *
> + * @return
> + *  - 0 on success.
> + *  - Negative on error.
> + */
> +__rte_experimental
> +int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
> +			unsigned int lcore_id);
> +
> +/**
> + * Receive a message contained in pkt over the Virtio-Serial
> + * from the host endpoint.
> + *

Nitpick, but we generally add a warning to experimental functions, like so:

  * @warning
  * @b EXPERIMENTAL: this API may change, or be removed, without prior 
notice.

also, presumably this is not meant to be public API and exists solely 
because there's no other way to do it without significant rework, so 
maybe mark as @internal too?

> + * @param pkt
> + *  Pointer to channel_packet or
> + *  channel_packet_freq_list struct.
> + *
> + * @param pkt_len
> + *  Size of expected data packet.
> + *
> + * @param lcore_id
> + *  lcore_id.
> + *
> + * @return
> + *  - 0 on success.
> + *  - Negative on error.
> + */
> +__rte_experimental
> +int rte_power_guest_channel_receive_msg(void *pkt,
> +		size_t pkt_len,
> +		unsigned int lcore_id);
> +
>   
>   #ifdef __cplusplus
>   }
>
  
Hunt, David Jan. 20, 2021, 3:08 p.m. UTC | #2
On 20/1/2021 2:26 PM, Burakov, Anatoly wrote:
> On 20-Jan-21 1:55 PM, David Hunt wrote:
>> From: Bruce Richardson <bruce.richardson@intel.com>
>>
>> Move the 2 public functions into rte_power_guest_channel.h
>>
>> Fixes: 210c383e247b ("power: packet format for vm power management")
>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>
>> ---
>
> <snip>
>
>>   +/**
>> + * Send a message contained in pkt over the Virtio-Serial to the 
>> host endpoint.
>> + *
>> + * @param pkt
>> + *  Pointer to a populated struct channel_packet
>> + *
>> + * @param lcore_id
>> + *  lcore_id.
>
> Not very informative doxygen comment :)


Maybe "Use channel specific to this lcore_id"?


>
>> + *
>> + * @return
>> + *  - 0 on success.
>> + *  - Negative on error.
>> + */
>> +__rte_experimental
>> +int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
>> +            unsigned int lcore_id);
>> +
>> +/**
>> + * Receive a message contained in pkt over the Virtio-Serial
>> + * from the host endpoint.
>> + *
>
> Nitpick, but we generally add a warning to experimental functions, 
> like so:
>
>  * @warning
>  * @b EXPERIMENTAL: this API may change, or be removed, without prior 
> notice.
>
> also, presumably this is not meant to be public API and exists solely 
> because there's no other way to do it without significant rework, so 
> maybe mark as @internal too?
>

Yes, I believe so. I will add @internal.


>> + * @param pkt
>> + *  Pointer to channel_packet or
>> + *  channel_packet_freq_list struct.
>> + *
>> + * @param pkt_len
>> + *  Size of expected data packet.
>> + *
>> + * @param lcore_id
>> + *  lcore_id.


Same here.


>> + *
>> + * @return
>> + *  - 0 on success.
>> + *  - Negative on error.
>> + */
>> +__rte_experimental
>> +int rte_power_guest_channel_receive_msg(void *pkt,
>> +        size_t pkt_len,
>> +        unsigned int lcore_id);
>> +
>>     #ifdef __cplusplus
>>   }
>>
>
>
  
Burakov, Anatoly Jan. 20, 2021, 3:23 p.m. UTC | #3
On 20-Jan-21 3:08 PM, David Hunt wrote:
> 
> On 20/1/2021 2:26 PM, Burakov, Anatoly wrote:
>> On 20-Jan-21 1:55 PM, David Hunt wrote:
>>> From: Bruce Richardson <bruce.richardson@intel.com>
>>>
>>> Move the 2 public functions into rte_power_guest_channel.h
>>>
>>> Fixes: 210c383e247b ("power: packet format for vm power management")
>>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>>
>>> ---
>>
>> <snip>
>>
>>>   +/**
>>> + * Send a message contained in pkt over the Virtio-Serial to the 
>>> host endpoint.
>>> + *
>>> + * @param pkt
>>> + *  Pointer to a populated struct channel_packet
>>> + *
>>> + * @param lcore_id
>>> + *  lcore_id.
>>
>> Not very informative doxygen comment :)
> 
> 
> Maybe "Use channel specific to this lcore_id"?
> 

Something like that, yes. Or, "Use channel associated with this lcore ID".
  

Patch

diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index d3d87f0ae..69020b030 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -65,21 +65,7 @@  void guest_channel_host_disconnect(unsigned int lcore_id);
  */
 int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
 
-/**
- * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
- *
- * @param pkt
- *  Pointer to a populated struct channel_packet
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
-			unsigned int lcore_id);
+
 
 /**
  * Read a message contained in pkt over the Virtio-Serial
@@ -103,30 +89,6 @@  int power_guest_channel_read_msg(void *pkt,
 		size_t pkt_len,
 		unsigned int lcore_id);
 
-/**
- * Receive a message contained in pkt over the Virtio-Serial
- * from the host endpoint.
- *
- * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
- *
- * @param pkt_len
- *  Size of expected data packet.
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-__rte_experimental
-int
-rte_power_guest_channel_receive_msg(void *pkt,
-		size_t pkt_len,
-		unsigned int lcore_id);
-
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index ef3b064a8..26469b6c8 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -116,6 +116,46 @@  struct channel_packet_caps_list {
 	uint8_t num_vcpu;
 };
 
+/**
+ * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to a populated struct channel_packet
+ *
+ * @param lcore_id
+ *  lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+			unsigned int lcore_id);
+
+/**
+ * Receive a message contained in pkt over the Virtio-Serial
+ * from the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to channel_packet or
+ *  channel_packet_freq_list struct.
+ *
+ * @param pkt_len
+ *  Size of expected data packet.
+ *
+ * @param lcore_id
+ *  lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int rte_power_guest_channel_receive_msg(void *pkt,
+		size_t pkt_len,
+		unsigned int lcore_id);
+
 
 #ifdef __cplusplus
 }