[v9,2/8] net/virtio: add packed virtqueue defines

Message ID 20181024143236.21271-3-jfreimann@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series implement packed virtqueues |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK

Commit Message

Jens Freimann Oct. 24, 2018, 2:32 p.m. UTC
  Signed-off-by: Jens Freimann <jfreimann@redhat.com>
---
 drivers/net/virtio/virtio_ring.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Tiwei Bie Oct. 25, 2018, 9:22 a.m. UTC | #1
On Wed, Oct 24, 2018 at 04:32:30PM +0200, Jens Freimann wrote:
> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
> ---
>  drivers/net/virtio/virtio_ring.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_ring.h b/drivers/net/virtio/virtio_ring.h
> index e65da100b..f84ab5e34 100644
> --- a/drivers/net/virtio/virtio_ring.h
> +++ b/drivers/net/virtio/virtio_ring.h
> @@ -15,7 +15,10 @@
>  #define VRING_DESC_F_WRITE      2
>  /* This means the buffer contains a list of buffer descriptors. */
>  #define VRING_DESC_F_INDIRECT   4
> -
> +/* This flag means the descriptor was made available by the driver */
> +#define VRING_DESC_F_AVAIL(b)   ((uint16_t)(b) << 7)
> +/* This flag means the descriptor was used by the device */
> +#define VRING_DESC_F_USED(b)    ((uint16_t)(b) << 15)

Please add an empty line here.

>  /* The Host uses this in used->flags to advise the Guest: don't kick me
>   * when you add a buffer.  It's unreliable, so it's simply an
>   * optimization.  Guest will still kick if it's out of buffers. */
> -- 
> 2.17.1
>
  
Jens Freimann Oct. 25, 2018, 2:41 p.m. UTC | #2
On Thu, Oct 25, 2018 at 05:22:37PM +0800, Tiwei Bie wrote:
>On Wed, Oct 24, 2018 at 04:32:30PM +0200, Jens Freimann wrote:
>> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
>> ---
>>  drivers/net/virtio/virtio_ring.h | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/virtio/virtio_ring.h b/drivers/net/virtio/virtio_ring.h
>> index e65da100b..f84ab5e34 100644
>> --- a/drivers/net/virtio/virtio_ring.h
>> +++ b/drivers/net/virtio/virtio_ring.h
>> @@ -15,7 +15,10 @@
>>  #define VRING_DESC_F_WRITE      2
>>  /* This means the buffer contains a list of buffer descriptors. */
>>  #define VRING_DESC_F_INDIRECT   4
>> -
>> +/* This flag means the descriptor was made available by the driver */
>> +#define VRING_DESC_F_AVAIL(b)   ((uint16_t)(b) << 7)
>> +/* This flag means the descriptor was used by the device */
>> +#define VRING_DESC_F_USED(b)    ((uint16_t)(b) << 15)
>
>Please add an empty line here.

ok

regards,
Jens 

>
>>  /* The Host uses this in used->flags to advise the Guest: don't kick me
>>   * when you add a buffer.  It's unreliable, so it's simply an
>>   * optimization.  Guest will still kick if it's out of buffers. */
>> --
>> 2.17.1
>>
  

Patch

diff --git a/drivers/net/virtio/virtio_ring.h b/drivers/net/virtio/virtio_ring.h
index e65da100b..f84ab5e34 100644
--- a/drivers/net/virtio/virtio_ring.h
+++ b/drivers/net/virtio/virtio_ring.h
@@ -15,7 +15,10 @@ 
 #define VRING_DESC_F_WRITE      2
 /* This means the buffer contains a list of buffer descriptors. */
 #define VRING_DESC_F_INDIRECT   4
-
+/* This flag means the descriptor was made available by the driver */
+#define VRING_DESC_F_AVAIL(b)   ((uint16_t)(b) << 7)
+/* This flag means the descriptor was used by the device */
+#define VRING_DESC_F_USED(b)    ((uint16_t)(b) << 15)
 /* The Host uses this in used->flags to advise the Guest: don't kick me
  * when you add a buffer.  It's unreliable, so it's simply an
  * optimization.  Guest will still kick if it's out of buffers. */