All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vmxnet3: add stub for encapsulation offload
@ 2021-08-06 22:23 Alexander Bulekov
  2021-08-07  8:19 ` Philippe Mathieu-Daudé
  2022-08-05 14:57 ` Thomas Huth
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Bulekov @ 2021-08-06 22:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Bulekov, Jason Wang, Dmitry Fleytman

Encapsulation offload (offload mode 1) is a valid mode present in the
kernel that isn't implemented in QEMU, yet.

https://lore.kernel.org/lkml/20200528015426.8285-4-doshir@vmware.com/

Add a stub for this mode, to avoid the guest-triggerable assertion.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/517
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
---
 hw/net/vmxnet3.c | 5 +++++
 hw/net/vmxnet3.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 41f796a247..62e11d0e3e 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -443,6 +443,11 @@ vmxnet3_setup_tx_offloads(VMXNET3State *s)
         net_tx_pkt_build_vheader(s->tx_pkt, false, false, 0);
         break;
 
+    case VMXNET3_OM_ENCAP:
+        VMW_PKPRN("Encapsulation offload requested, but not available\n");
+        return false;
+        break;
+
     case VMXNET3_OM_CSUM:
         net_tx_pkt_build_vheader(s->tx_pkt, false, true, 0);
         VMW_PKPRN("L4 CSO requested\n");
diff --git a/hw/net/vmxnet3.h b/hw/net/vmxnet3.h
index 5b3b76ba7a..36a17b82aa 100644
--- a/hw/net/vmxnet3.h
+++ b/hw/net/vmxnet3.h
@@ -273,6 +273,7 @@ struct Vmxnet3_TxDesc {
 
 /* TxDesc.OM values */
 #define VMXNET3_OM_NONE        0
+#define VMXNET3_OM_ENCAP       1
 #define VMXNET3_OM_CSUM        2
 #define VMXNET3_OM_TSO        3
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] vmxnet3: add stub for encapsulation offload
  2021-08-06 22:23 [PATCH] vmxnet3: add stub for encapsulation offload Alexander Bulekov
@ 2021-08-07  8:19 ` Philippe Mathieu-Daudé
  2021-08-07 20:25   ` Alexander Bulekov
  2022-08-05 14:57 ` Thomas Huth
  1 sibling, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-08-07  8:19 UTC (permalink / raw)
  To: Alexander Bulekov, qemu-devel; +Cc: Jason Wang, Dmitry Fleytman

On 8/7/21 12:23 AM, Alexander Bulekov wrote:
> Encapsulation offload (offload mode 1) is a valid mode present in the
> kernel that isn't implemented in QEMU, yet.
> 
> https://lore.kernel.org/lkml/20200528015426.8285-4-doshir@vmware.com/
> 
> Add a stub for this mode, to avoid the guest-triggerable assertion.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/517
> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> ---
>  hw/net/vmxnet3.c | 5 +++++
>  hw/net/vmxnet3.h | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
> index 41f796a247..62e11d0e3e 100644
> --- a/hw/net/vmxnet3.c
> +++ b/hw/net/vmxnet3.c
> @@ -443,6 +443,11 @@ vmxnet3_setup_tx_offloads(VMXNET3State *s)
>          net_tx_pkt_build_vheader(s->tx_pkt, false, false, 0);
>          break;
>  
> +    case VMXNET3_OM_ENCAP:
> +        VMW_PKPRN("Encapsulation offload requested, but not available\n");
> +        return false;
> +        break;

No need to break if you returned (unreachable).

> +
>      case VMXNET3_OM_CSUM:
>          net_tx_pkt_build_vheader(s->tx_pkt, false, true, 0);
>          VMW_PKPRN("L4 CSO requested\n");
> diff --git a/hw/net/vmxnet3.h b/hw/net/vmxnet3.h
> index 5b3b76ba7a..36a17b82aa 100644
> --- a/hw/net/vmxnet3.h
> +++ b/hw/net/vmxnet3.h
> @@ -273,6 +273,7 @@ struct Vmxnet3_TxDesc {
>  
>  /* TxDesc.OM values */
>  #define VMXNET3_OM_NONE        0
> +#define VMXNET3_OM_ENCAP       1
>  #define VMXNET3_OM_CSUM        2
>  #define VMXNET3_OM_TSO        3
>  
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vmxnet3: add stub for encapsulation offload
  2021-08-07  8:19 ` Philippe Mathieu-Daudé
@ 2021-08-07 20:25   ` Alexander Bulekov
  2021-08-09  7:32     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Bulekov @ 2021-08-07 20:25 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Jason Wang, Dmitry Fleytman, qemu-devel

On 210807 1019, Philippe Mathieu-Daudé wrote:
> On 8/7/21 12:23 AM, Alexander Bulekov wrote:
> > Encapsulation offload (offload mode 1) is a valid mode present in the
> > kernel that isn't implemented in QEMU, yet.
> > 
> > https://lore.kernel.org/lkml/20200528015426.8285-4-doshir@vmware.com/
> > 
> > Add a stub for this mode, to avoid the guest-triggerable assertion.
> > 
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/517
> > Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> > ---
> >  hw/net/vmxnet3.c | 5 +++++
> >  hw/net/vmxnet3.h | 1 +
> >  2 files changed, 6 insertions(+)
> > 
> > diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
> > index 41f796a247..62e11d0e3e 100644
> > --- a/hw/net/vmxnet3.c
> > +++ b/hw/net/vmxnet3.c
> > @@ -443,6 +443,11 @@ vmxnet3_setup_tx_offloads(VMXNET3State *s)
> >          net_tx_pkt_build_vheader(s->tx_pkt, false, false, 0);
> >          break;
> >  
> > +    case VMXNET3_OM_ENCAP:
> > +        VMW_PKPRN("Encapsulation offload requested, but not available\n");
> > +        return false;
> > +        break;
> 
> No need to break if you returned (unreachable).

I included it in case the feature ends up being added, so there is one
less thing to worry about, but I can remove it. There are a couple of
places in QEMU where this occurs, so I wasn't sure about the best
practice.

-Alex

> 
> > +
> >      case VMXNET3_OM_CSUM:
> >          net_tx_pkt_build_vheader(s->tx_pkt, false, true, 0);
> >          VMW_PKPRN("L4 CSO requested\n");
> > diff --git a/hw/net/vmxnet3.h b/hw/net/vmxnet3.h
> > index 5b3b76ba7a..36a17b82aa 100644
> > --- a/hw/net/vmxnet3.h
> > +++ b/hw/net/vmxnet3.h
> > @@ -273,6 +273,7 @@ struct Vmxnet3_TxDesc {
> >  
> >  /* TxDesc.OM values */
> >  #define VMXNET3_OM_NONE        0
> > +#define VMXNET3_OM_ENCAP       1
> >  #define VMXNET3_OM_CSUM        2
> >  #define VMXNET3_OM_TSO        3
> >  
> > 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vmxnet3: add stub for encapsulation offload
  2021-08-07 20:25   ` Alexander Bulekov
@ 2021-08-09  7:32     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-08-09  7:32 UTC (permalink / raw)
  To: Alexander Bulekov; +Cc: Jason Wang, Dmitry Fleytman, qemu-devel

On 8/7/21 10:25 PM, Alexander Bulekov wrote:
> On 210807 1019, Philippe Mathieu-Daudé wrote:
>> On 8/7/21 12:23 AM, Alexander Bulekov wrote:
>>> Encapsulation offload (offload mode 1) is a valid mode present in the
>>> kernel that isn't implemented in QEMU, yet.
>>>
>>> https://lore.kernel.org/lkml/20200528015426.8285-4-doshir@vmware.com/
>>>
>>> Add a stub for this mode, to avoid the guest-triggerable assertion.
>>>
>>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/517
>>> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
>>> ---
>>>  hw/net/vmxnet3.c | 5 +++++
>>>  hw/net/vmxnet3.h | 1 +
>>>  2 files changed, 6 insertions(+)
>>>
>>> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
>>> index 41f796a247..62e11d0e3e 100644
>>> --- a/hw/net/vmxnet3.c
>>> +++ b/hw/net/vmxnet3.c
>>> @@ -443,6 +443,11 @@ vmxnet3_setup_tx_offloads(VMXNET3State *s)
>>>          net_tx_pkt_build_vheader(s->tx_pkt, false, false, 0);
>>>          break;
>>>  
>>> +    case VMXNET3_OM_ENCAP:
>>> +        VMW_PKPRN("Encapsulation offload requested, but not available\n");
>>> +        return false;
>>> +        break;
>>
>> No need to break if you returned (unreachable).
> 
> I included it in case the feature ends up being added, so there is one
> less thing to worry about, but I can remove it. There are a couple of
> places in QEMU where this occurs, so I wasn't sure about the best
> practice.

I don't know if there is an official "best practice". My style /
recommendation is to try to use single exit point when possible
so I can easily add trace events.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vmxnet3: add stub for encapsulation offload
  2021-08-06 22:23 [PATCH] vmxnet3: add stub for encapsulation offload Alexander Bulekov
  2021-08-07  8:19 ` Philippe Mathieu-Daudé
@ 2022-08-05 14:57 ` Thomas Huth
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2022-08-05 14:57 UTC (permalink / raw)
  To: Alexander Bulekov, qemu-devel, Jason Wang
  Cc: Dmitry Fleytman, Philippe Mathieu-Daudé

On 07/08/2021 00.23, Alexander Bulekov wrote:
> Encapsulation offload (offload mode 1) is a valid mode present in the
> kernel that isn't implemented in QEMU, yet.
> 
> https://lore.kernel.org/lkml/20200528015426.8285-4-doshir@vmware.com/
> 
> Add a stub for this mode, to avoid the guest-triggerable assertion.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/517
> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> ---
>   hw/net/vmxnet3.c | 5 +++++
>   hw/net/vmxnet3.h | 1 +
>   2 files changed, 6 insertions(+)
> 
> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
> index 41f796a247..62e11d0e3e 100644
> --- a/hw/net/vmxnet3.c
> +++ b/hw/net/vmxnet3.c
> @@ -443,6 +443,11 @@ vmxnet3_setup_tx_offloads(VMXNET3State *s)
>           net_tx_pkt_build_vheader(s->tx_pkt, false, false, 0);
>           break;
>   
> +    case VMXNET3_OM_ENCAP:
> +        VMW_PKPRN("Encapsulation offload requested, but not available\n");
> +        return false;
> +        break;

I think I'd also remove the break, anyway:

Reviewed-by: Thomas Huth <thuth@redhat.com>

Jason, could you maybe also pick this up for QEMU 7.1, so we can close issue 
517 ?

>       case VMXNET3_OM_CSUM:
>           net_tx_pkt_build_vheader(s->tx_pkt, false, true, 0);
>           VMW_PKPRN("L4 CSO requested\n");
> diff --git a/hw/net/vmxnet3.h b/hw/net/vmxnet3.h
> index 5b3b76ba7a..36a17b82aa 100644
> --- a/hw/net/vmxnet3.h
> +++ b/hw/net/vmxnet3.h
> @@ -273,6 +273,7 @@ struct Vmxnet3_TxDesc {
>   
>   /* TxDesc.OM values */
>   #define VMXNET3_OM_NONE        0
> +#define VMXNET3_OM_ENCAP       1
>   #define VMXNET3_OM_CSUM        2
>   #define VMXNET3_OM_TSO        3
>   



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-05 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 22:23 [PATCH] vmxnet3: add stub for encapsulation offload Alexander Bulekov
2021-08-07  8:19 ` Philippe Mathieu-Daudé
2021-08-07 20:25   ` Alexander Bulekov
2021-08-09  7:32     ` Philippe Mathieu-Daudé
2022-08-05 14:57 ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.