Skip to contentSkip to conversation

virtio-net: why not always to set avail->flags to VRING_AVAIL_F_NO_INTERRUPT

DISCUSSION Linhaifeng 2 participants 6 messages Jun 3, 2015 – Jun 4, 2015

Subsystems (3)
lore
Share & tools
lore

Linhaifeng

author
#0 lore raw

Hi,

I'm a newbie and have a question about vring_new_virtqueue function.

Why we set avail->flags to VRING_AVAIL_F_NO_INTERRUPT when no callbacks? I think we should set avail->flags to VRING_AVAIL_F_NO_INTERRUPT even if no callbacks.

#1 lore raw
Quoted 6 lines · Linhaifeng

Hi,

I'm a newbie and have a question about vring_new_virtqueue function.

Why we set avail->flags to VRING_AVAIL_F_NO_INTERRUPT when no callbacks? I think we should set avail->flags to VRING_AVAIL_F_NO_INTERRUPT even if no callbacks.

Hi Linhaifeng,

Not sure I understand your question, but I'll try to answer.

We don't set VRING_AVAIL_F_NO_INTERRUPT if there's a callback because we want that callback called. Otherwise callback will never be used.

Cheers,
Rusty.

#2 lore raw
In reply to Linhaifeng
Quoted 6 lines · Linhaifeng

Hi,

I'm a newbie and have a question about vring_new_virtqueue function.

Why we set avail->flags to VRING_AVAIL_F_NO_INTERRUPT when no callbacks? I think we should set avail->flags to VRING_AVAIL_F_NO_INTERRUPT even if no callbacks.

Hi Linhaifeng,

Not sure I understand your question, but I'll try to answer.

We don't set VRING_AVAIL_F_NO_INTERRUPT if there's a callback because we want that callback called. Otherwise callback will never be used.

Cheers,
Rusty.

author
#3 lore raw
Quoted 10 lines · Rusty Russell
Quoted 6 lines · Linhaifeng

Hi,

I'm a newbie and have a question about vring_new_virtqueue function.

Why we set avail->flags to VRING_AVAIL_F_NO_INTERRUPT when no callbacks? I think we should set avail->flags to VRING_AVAIL_F_NO_INTERRUPT even if no callbacks.

Hi Linhaifeng,

Quoted 9 lines

Not sure I understand your question, but I'll try to answer.

We don't set VRING_AVAIL_F_NO_INTERRUPT if there's a callback because we want that callback called. Otherwise callback will never be used.

Cheers,
Rusty.

Hi Rusty,

Thank you for your response.

I mean should we set VRING_AVAIL_F_NO_INTERRUPT when virtqueue is initialized whether there is callback or not? As it would be set in function virtqueue_disable_cb and virtqueue_enable_cb_prepare later.

Regards,
Haifeng

author
#4 lore raw
In reply to Rusty Russell
Quoted 10 lines · Rusty Russell
Quoted 6 lines · Linhaifeng

Hi,

I'm a newbie and have a question about vring_new_virtqueue function.

Why we set avail->flags to VRING_AVAIL_F_NO_INTERRUPT when no callbacks? I think we should set avail->flags to VRING_AVAIL_F_NO_INTERRUPT even if no callbacks.

Hi Linhaifeng,

Quoted 9 lines

Not sure I understand your question, but I'll try to answer.

We don't set VRING_AVAIL_F_NO_INTERRUPT if there's a callback because we want that callback called. Otherwise callback will never be used.

Cheers,
Rusty.

Hi Rusty,

Thank you for your response.

I mean should we set VRING_AVAIL_F_NO_INTERRUPT when virtqueue is initialized whether there is callback or not? As it would be set in function virtqueue_disable_cb and virtqueue_enable_cb_prepare later.

Regards,
Haifeng

#5 lore raw
Quoted 21 lines · Linhaifeng
Quoted 10 lines · Rusty Russell
Quoted 6 lines · Linhaifeng

Hi,

I'm a newbie and have a question about vring_new_virtqueue function.

Why we set avail->flags to VRING_AVAIL_F_NO_INTERRUPT when no callbacks? I think we should set avail->flags to VRING_AVAIL_F_NO_INTERRUPT even if no callbacks.

Hi Linhaifeng,

Quoted 9 lines

Not sure I understand your question, but I'll try to answer.

We don't set VRING_AVAIL_F_NO_INTERRUPT if there's a callback because we want that callback called. Otherwise callback will never be used.

Cheers,
Rusty.

Quoted 6 lines

Hi Rusty,

Thank you for your response.

I mean should we set VRING_AVAIL_F_NO_INTERRUPT when virtqueue is initialized whether there is callback or not? As it would be set in function virtqueue_disable_cb and virtqueue_enable_cb_prepare later.

You're right, the callers could virtqueue_enable() specifically, but I think most callers will want the virtqueue enabled immediately.

And remember, the VRING_AVAIL_F_NO_INTERRUPT is just a *hint*: the device is allows to ignore it (this can happen due to race conditions, for example).

Thanks,
Rusty.