[v8,01/15] vhost: add virtio packed virtqueue defines

Message ID 20180705210741.17974-2-maxime.coquelin@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series Vhost: add support to packed ring layout |

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues

Commit Message

Maxime Coquelin July 5, 2018, 9:07 p.m. UTC
  From: Jens Freimann <jfreimann@redhat.com>

Signed-off-by: Jens Freimann <jfreimann@redhat.com>
---
 lib/librte_vhost/vhost.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
  

Comments

Tiwei Bie July 6, 2018, 2:52 a.m. UTC | #1
On Thu, Jul 05, 2018 at 11:07:27PM +0200, Maxime Coquelin wrote:
> From: Jens Freimann <jfreimann@redhat.com>
> 
> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
> ---
>  lib/librte_vhost/vhost.h | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index 79e3117d2..4fc804bd8 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -192,6 +192,26 @@ struct vhost_msg {
>   #define VIRTIO_F_VERSION_1 32
>  #endif
>  
> +/* Declare packed ring related bits for older kernels */
> +#ifndef VIRTIO_F_RING_PACKED
> +
> +#define VIRTIO_F_RING_PACKED 34
> +
> +#define VRING_DESC_F_NEXT			1
> +#define VRING_DESC_F_WRITE			2
> +#define VRING_DESC_F_INDIRECT		4
> +
> +#define VRING_DESC_F_AVAIL			(1ULL << 7)
> +#define VRING_DESC_F_USED			(1ULL << 15)
> +
> +struct vring_desc_packed {

Maybe vring_packed_desc will be more consistent with
vring_packed_desc_event and vring_packed. Jason also
planned to change the name to vring_packed_desc [1].

[1] https://lkml.org/lkml/2018/7/4/36

Best regards,
Tiwei Bie

> +	uint64_t addr;
> +	uint32_t len;
> +	uint16_t id;
> +	uint16_t flags;
> +};
> +#endif
> +
>  /*
>   * Available and used descs are in same order
>   */
> -- 
> 2.14.4
>
  
Maxime Coquelin July 6, 2018, 6:34 a.m. UTC | #2
On 07/06/2018 04:52 AM, Tiwei Bie wrote:
> On Thu, Jul 05, 2018 at 11:07:27PM +0200, Maxime Coquelin wrote:
>> From: Jens Freimann <jfreimann@redhat.com>
>>
>> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
>> ---
>>   lib/librte_vhost/vhost.h | 20 ++++++++++++++++++++
>>   1 file changed, 20 insertions(+)
>>
>> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
>> index 79e3117d2..4fc804bd8 100644
>> --- a/lib/librte_vhost/vhost.h
>> +++ b/lib/librte_vhost/vhost.h
>> @@ -192,6 +192,26 @@ struct vhost_msg {
>>    #define VIRTIO_F_VERSION_1 32
>>   #endif
>>   
>> +/* Declare packed ring related bits for older kernels */
>> +#ifndef VIRTIO_F_RING_PACKED
>> +
>> +#define VIRTIO_F_RING_PACKED 34
>> +
>> +#define VRING_DESC_F_NEXT			1
>> +#define VRING_DESC_F_WRITE			2
>> +#define VRING_DESC_F_INDIRECT		4
>> +
>> +#define VRING_DESC_F_AVAIL			(1ULL << 7)
>> +#define VRING_DESC_F_USED			(1ULL << 15)
>> +
>> +struct vring_desc_packed {
> 
> Maybe vring_packed_desc will be more consistent with
> vring_packed_desc_event and vring_packed. Jason also
> planned to change the name to vring_packed_desc [1].
> 
> [1] https://lkml.org/lkml/2018/7/4/36

Thanks for the reminder, I fixed it in the series.

Regards,
Maxime
> 
> Best regards,
> Tiwei Bie
> 
>> +	uint64_t addr;
>> +	uint32_t len;
>> +	uint16_t id;
>> +	uint16_t flags;
>> +};
>> +#endif
>> +
>>   /*
>>    * Available and used descs are in same order
>>    */
>> -- 
>> 2.14.4
>>
  

Patch

diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index 79e3117d2..4fc804bd8 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -192,6 +192,26 @@  struct vhost_msg {
  #define VIRTIO_F_VERSION_1 32
 #endif
 
+/* Declare packed ring related bits for older kernels */
+#ifndef VIRTIO_F_RING_PACKED
+
+#define VIRTIO_F_RING_PACKED 34
+
+#define VRING_DESC_F_NEXT			1
+#define VRING_DESC_F_WRITE			2
+#define VRING_DESC_F_INDIRECT		4
+
+#define VRING_DESC_F_AVAIL			(1ULL << 7)
+#define VRING_DESC_F_USED			(1ULL << 15)
+
+struct vring_desc_packed {
+	uint64_t addr;
+	uint32_t len;
+	uint16_t id;
+	uint16_t flags;
+};
+#endif
+
 /*
  * Available and used descs are in same order
  */