diff mbox

[V4,01/12] net: Add vnet_hdr_len related arguments in NetClientState

Message ID 1494553288-30764-2-git-send-email-zhangchen.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhang Chen May 12, 2017, 1:41 a.m. UTC
Add vnet_hdr_len and using_vnet_hdr arguments in NetClientState
that make othermodule get real vnet_hdr_len easily.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 include/net/net.h | 2 ++
 net/net.c         | 2 ++
 2 files changed, 4 insertions(+)

Comments

Philippe Mathieu-Daudé May 13, 2017, 9:24 p.m. UTC | #1
Hi Zhang

On 05/11/2017 10:41 PM, Zhang Chen wrote:
> Add vnet_hdr_len and using_vnet_hdr arguments in NetClientState
> that make othermodule get real vnet_hdr_len easily.
>
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> ---
>  include/net/net.h | 2 ++
>  net/net.c         | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/include/net/net.h b/include/net/net.h
> index 99b28d5..70edfc0 100644
> --- a/include/net/net.h
> +++ b/include/net/net.h
> @@ -100,6 +100,8 @@ struct NetClientState {
>      unsigned int queue_index;
>      unsigned rxfilter_notify_enabled:1;
>      int vring_enable;
> +    bool using_vnet_hdr;
> +    int vnet_hdr_len;
>      QTAILQ_HEAD(NetFilterHead, NetFilterState) filters;
>  };
>
> diff --git a/net/net.c b/net/net.c
> index 0ac3b9e..a00a0c9 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -472,6 +472,7 @@ void qemu_using_vnet_hdr(NetClientState *nc, bool enable)
>          return;
>      }
>
> +    nc->using_vnet_hdr = enable;
>      nc->info->using_vnet_hdr(nc, enable);
>  }
>
> @@ -491,6 +492,7 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len)
>          return;
>      }
>
> +    nc->vnet_hdr_len = len;
>      nc->info->set_vnet_hdr_len(nc, len);
>  }
>

For what it's worth, now having those fields in NetClientState it is 
possible to remove a deref to NetClientInfo in qemu_has_vnet_hdr() and 
qemu_has_vnet_hdr_len().

Anyway,
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Jason Wang May 15, 2017, 3:24 a.m. UTC | #2
On 2017年05月14日 05:24, Philippe Mathieu-Daudé wrote:
> Hi Zhang
>
> On 05/11/2017 10:41 PM, Zhang Chen wrote:
>> Add vnet_hdr_len and using_vnet_hdr arguments in NetClientState
>> that make othermodule get real vnet_hdr_len easily.
>>
>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>> ---
>>  include/net/net.h | 2 ++
>>  net/net.c         | 2 ++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/include/net/net.h b/include/net/net.h
>> index 99b28d5..70edfc0 100644
>> --- a/include/net/net.h
>> +++ b/include/net/net.h
>> @@ -100,6 +100,8 @@ struct NetClientState {
>>      unsigned int queue_index;
>>      unsigned rxfilter_notify_enabled:1;
>>      int vring_enable;
>> +    bool using_vnet_hdr;
>> +    int vnet_hdr_len;
>>      QTAILQ_HEAD(NetFilterHead, NetFilterState) filters;
>>  };
>>
>> diff --git a/net/net.c b/net/net.c
>> index 0ac3b9e..a00a0c9 100644
>> --- a/net/net.c
>> +++ b/net/net.c
>> @@ -472,6 +472,7 @@ void qemu_using_vnet_hdr(NetClientState *nc, bool 
>> enable)
>>          return;
>>      }
>>
>> +    nc->using_vnet_hdr = enable;
>>      nc->info->using_vnet_hdr(nc, enable);
>>  }
>>
>> @@ -491,6 +492,7 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, 
>> int len)
>>          return;
>>      }
>>
>> +    nc->vnet_hdr_len = len;
>>      nc->info->set_vnet_hdr_len(nc, len);
>>  }
>>
>
> For what it's worth, now having those fields in NetClientState it is 
> possible to remove a deref to NetClientInfo in qemu_has_vnet_hdr() and 
> qemu_has_vnet_hdr_len().
>
> Anyway,
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
>

Yes and this could be done on top with removing private e.g vnet_hdr_len.

Thanks
Zhang Chen May 15, 2017, 6:56 a.m. UTC | #3
On 05/15/2017 11:24 AM, Jason Wang wrote:
>
>
> On 2017年05月14日 05:24, Philippe Mathieu-Daudé wrote:
>> Hi Zhang
>>
>> On 05/11/2017 10:41 PM, Zhang Chen wrote:
>>> Add vnet_hdr_len and using_vnet_hdr arguments in NetClientState
>>> that make othermodule get real vnet_hdr_len easily.
>>>
>>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>>> ---
>>>  include/net/net.h | 2 ++
>>>  net/net.c         | 2 ++
>>>  2 files changed, 4 insertions(+)
>>>
>>> diff --git a/include/net/net.h b/include/net/net.h
>>> index 99b28d5..70edfc0 100644
>>> --- a/include/net/net.h
>>> +++ b/include/net/net.h
>>> @@ -100,6 +100,8 @@ struct NetClientState {
>>>      unsigned int queue_index;
>>>      unsigned rxfilter_notify_enabled:1;
>>>      int vring_enable;
>>> +    bool using_vnet_hdr;
>>> +    int vnet_hdr_len;
>>>      QTAILQ_HEAD(NetFilterHead, NetFilterState) filters;
>>>  };
>>>
>>> diff --git a/net/net.c b/net/net.c
>>> index 0ac3b9e..a00a0c9 100644
>>> --- a/net/net.c
>>> +++ b/net/net.c
>>> @@ -472,6 +472,7 @@ void qemu_using_vnet_hdr(NetClientState *nc, 
>>> bool enable)
>>>          return;
>>>      }
>>>
>>> +    nc->using_vnet_hdr = enable;
>>>      nc->info->using_vnet_hdr(nc, enable);
>>>  }
>>>
>>> @@ -491,6 +492,7 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, 
>>> int len)
>>>          return;
>>>      }
>>>
>>> +    nc->vnet_hdr_len = len;
>>>      nc->info->set_vnet_hdr_len(nc, len);
>>>  }
>>>
>>
>> For what it's worth, now having those fields in NetClientState it is 
>> possible to remove a deref to NetClientInfo in qemu_has_vnet_hdr() 
>> and qemu_has_vnet_hdr_len().
>>
>> Anyway,
>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>
>>
>
> Yes and this could be done on top with removing private e.g vnet_hdr_len.

Do you means we will remove the qemu_has_vnet_hdr() and 
qemu_has_vnet_hdr_len() in the future?

Thanks
Zhang Chen

>
> Thanks
>
>
> .
>
Jason Wang May 15, 2017, 8:06 a.m. UTC | #4
On 2017年05月15日 14:56, Zhang Chen wrote:
>
>
> On 05/15/2017 11:24 AM, Jason Wang wrote:
>>
>>
>> On 2017年05月14日 05:24, Philippe Mathieu-Daudé wrote:
>>> Hi Zhang
>>>
>>> On 05/11/2017 10:41 PM, Zhang Chen wrote:
>>>> Add vnet_hdr_len and using_vnet_hdr arguments in NetClientState
>>>> that make othermodule get real vnet_hdr_len easily.
>>>>
>>>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>>>> ---
>>>>  include/net/net.h | 2 ++
>>>>  net/net.c         | 2 ++
>>>>  2 files changed, 4 insertions(+)
>>>>
>>>> diff --git a/include/net/net.h b/include/net/net.h
>>>> index 99b28d5..70edfc0 100644
>>>> --- a/include/net/net.h
>>>> +++ b/include/net/net.h
>>>> @@ -100,6 +100,8 @@ struct NetClientState {
>>>>      unsigned int queue_index;
>>>>      unsigned rxfilter_notify_enabled:1;
>>>>      int vring_enable;
>>>> +    bool using_vnet_hdr;
>>>> +    int vnet_hdr_len;
>>>>      QTAILQ_HEAD(NetFilterHead, NetFilterState) filters;
>>>>  };
>>>>
>>>> diff --git a/net/net.c b/net/net.c
>>>> index 0ac3b9e..a00a0c9 100644
>>>> --- a/net/net.c
>>>> +++ b/net/net.c
>>>> @@ -472,6 +472,7 @@ void qemu_using_vnet_hdr(NetClientState *nc, 
>>>> bool enable)
>>>>          return;
>>>>      }
>>>>
>>>> +    nc->using_vnet_hdr = enable;
>>>>      nc->info->using_vnet_hdr(nc, enable);
>>>>  }
>>>>
>>>> @@ -491,6 +492,7 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, 
>>>> int len)
>>>>          return;
>>>>      }
>>>>
>>>> +    nc->vnet_hdr_len = len;
>>>>      nc->info->set_vnet_hdr_len(nc, len);
>>>>  }
>>>>
>>>
>>> For what it's worth, now having those fields in NetClientState it is 
>>> possible to remove a deref to NetClientInfo in qemu_has_vnet_hdr() 
>>> and qemu_has_vnet_hdr_len().
>>>
>>> Anyway,
>>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>>
>>>
>>
>> Yes and this could be done on top with removing private e.g 
>> vnet_hdr_len.
>
> Do you means we will remove the qemu_has_vnet_hdr() and 
> qemu_has_vnet_hdr_len() in the future?
>
> Thanks
> Zhang Chen

Yes and e.g both tap and netmap have its private vnet header field. We 
can remove them too.

Thanks

>
>>
>> Thanks
>>
>>
>> .
>>
>
Zhang Chen May 15, 2017, 8:14 a.m. UTC | #5
On 05/15/2017 04:06 PM, Jason Wang wrote:
>
>
> On 2017年05月15日 14:56, Zhang Chen wrote:
>>
>>
>> On 05/15/2017 11:24 AM, Jason Wang wrote:
>>>
>>>
>>> On 2017年05月14日 05:24, Philippe Mathieu-Daudé wrote:
>>>> Hi Zhang
>>>>
>>>> On 05/11/2017 10:41 PM, Zhang Chen wrote:
>>>>> Add vnet_hdr_len and using_vnet_hdr arguments in NetClientState
>>>>> that make othermodule get real vnet_hdr_len easily.
>>>>>
>>>>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>>>>> ---
>>>>>  include/net/net.h | 2 ++
>>>>>  net/net.c         | 2 ++
>>>>>  2 files changed, 4 insertions(+)
>>>>>
>>>>> diff --git a/include/net/net.h b/include/net/net.h
>>>>> index 99b28d5..70edfc0 100644
>>>>> --- a/include/net/net.h
>>>>> +++ b/include/net/net.h
>>>>> @@ -100,6 +100,8 @@ struct NetClientState {
>>>>>      unsigned int queue_index;
>>>>>      unsigned rxfilter_notify_enabled:1;
>>>>>      int vring_enable;
>>>>> +    bool using_vnet_hdr;
>>>>> +    int vnet_hdr_len;
>>>>>      QTAILQ_HEAD(NetFilterHead, NetFilterState) filters;
>>>>>  };
>>>>>
>>>>> diff --git a/net/net.c b/net/net.c
>>>>> index 0ac3b9e..a00a0c9 100644
>>>>> --- a/net/net.c
>>>>> +++ b/net/net.c
>>>>> @@ -472,6 +472,7 @@ void qemu_using_vnet_hdr(NetClientState *nc, 
>>>>> bool enable)
>>>>>          return;
>>>>>      }
>>>>>
>>>>> +    nc->using_vnet_hdr = enable;
>>>>>      nc->info->using_vnet_hdr(nc, enable);
>>>>>  }
>>>>>
>>>>> @@ -491,6 +492,7 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, 
>>>>> int len)
>>>>>          return;
>>>>>      }
>>>>>
>>>>> +    nc->vnet_hdr_len = len;
>>>>>      nc->info->set_vnet_hdr_len(nc, len);
>>>>>  }
>>>>>
>>>>
>>>> For what it's worth, now having those fields in NetClientState it 
>>>> is possible to remove a deref to NetClientInfo in 
>>>> qemu_has_vnet_hdr() and qemu_has_vnet_hdr_len().
>>>>
>>>> Anyway,
>>>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>>>
>>>>
>>>
>>> Yes and this could be done on top with removing private e.g 
>>> vnet_hdr_len.
>>
>> Do you means we will remove the qemu_has_vnet_hdr() and 
>> qemu_has_vnet_hdr_len() in the future?
>>
>> Thanks
>> Zhang Chen
>
> Yes and e.g both tap and netmap have its private vnet header field. We 
> can remove them too.

Maybe I should do this job in this series next version or a independent 
series?

Thanks
Zhang Chen

>
> Thanks
>
>>
>>>
>>> Thanks
>>>
>>>
>>> .
>>>
>>
>
>
>
> .
>
Jason Wang May 16, 2017, 6:49 a.m. UTC | #6
On 2017年05月15日 16:14, Zhang Chen wrote:
>> Yes and e.g both tap and netmap have its private vnet header field. 
>> We can remove them too.
>
> Maybe I should do this job in this series next version or a 
> independent series?
>
> Thanks
> Zhang Chen 

Your call.

Thanks
Zhang Chen May 23, 2017, 12:06 p.m. UTC | #7
On 05/16/2017 02:49 PM, Jason Wang wrote:
>
>
> On 2017年05月15日 16:14, Zhang Chen wrote:
>>> Yes and e.g both tap and netmap have its private vnet header field. 
>>> We can remove them too.
>>
>> Maybe I should do this job in this series next version or a 
>> independent series?
>>
>> Thanks
>> Zhang Chen 
>
> Your call.

I will send a independent series after this series have been merged.

Thanks
Zhang Chen

>
> Thanks
>
>
>
diff mbox

Patch

diff --git a/include/net/net.h b/include/net/net.h
index 99b28d5..70edfc0 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -100,6 +100,8 @@  struct NetClientState {
     unsigned int queue_index;
     unsigned rxfilter_notify_enabled:1;
     int vring_enable;
+    bool using_vnet_hdr;
+    int vnet_hdr_len;
     QTAILQ_HEAD(NetFilterHead, NetFilterState) filters;
 };
 
diff --git a/net/net.c b/net/net.c
index 0ac3b9e..a00a0c9 100644
--- a/net/net.c
+++ b/net/net.c
@@ -472,6 +472,7 @@  void qemu_using_vnet_hdr(NetClientState *nc, bool enable)
         return;
     }
 
+    nc->using_vnet_hdr = enable;
     nc->info->using_vnet_hdr(nc, enable);
 }
 
@@ -491,6 +492,7 @@  void qemu_set_vnet_hdr_len(NetClientState *nc, int len)
         return;
     }
 
+    nc->vnet_hdr_len = len;
     nc->info->set_vnet_hdr_len(nc, len);
 }