diff mbox

net: Allow specifying maximum number of network NICs during configure

Message ID 1434799589-27171-1-git-send-email-shmulik.ladkani@ravellosystems.com
State New
Headers show

Commit Message

Shmulik Ladkani June 20, 2015, 11:26 a.m. UTC
Currently, MAX_NICS is hardcoded as 8.

Add a configuration option '--net-max-nics' so one can override the
default.
Unless specified, default value is kept as 8.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
---
 configure         | 7 +++++++
 include/net/net.h | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Stefan Hajnoczi June 22, 2015, 12:13 p.m. UTC | #1
On Sat, Jun 20, 2015 at 02:26:29PM +0300, Shmulik Ladkani wrote:
> Currently, MAX_NICS is hardcoded as 8.
> 
> Add a configuration option '--net-max-nics' so one can override the
> default.
> Unless specified, default value is kept as 8.
> 
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
> ---
>  configure         | 7 +++++++
>  include/net/net.h | 2 +-
>  2 files changed, 8 insertions(+), 1 deletion(-)

The -device e1000,netdev=tap0,id=e1000-nic0 syntax is preferred to -net
nic syntax and does not have the 8 NIC limit.

Please use the -device syntax instead of -net.  Emulated NICs that
support virtio_net_hdr offload also perform better with the -device
syntax because -net nic does not allow virtio_net_hdr offloads.

If you think this patch should be merged, please explain the use case.
Shmulik Ladkani June 22, 2015, 2:42 p.m. UTC | #2
Hi,

On Mon, 22 Jun 2015 13:13:20 +0100, stefanha@gmail.com wrote:
> The -device e1000,netdev=tap0,id=e1000-nic0 syntax is preferred to
> -net nic syntax and does not have the 8 NIC limit.
> 
> Please use the -device syntax instead of -net. 

Very well, thanks.

Shmulik
cauchy-love Sept. 28, 2015, 11:52 a.m. UTC | #3
hi stefan.
   I have setup a VM on a server with two NICs (eth0 and eth1).  eth0 is connected with vlan22 and eth1 is connected with vlan33. I then added eth0.22 to br2  and eth1.33 to br3. after that tap2 and tap3 were added to br2 and br3 respectively. When i start up the vm,  the network connection is failed if tap2 and tap3 are allocated to this VM while it is ok if i only allocate one tap to this VM. It is shown that the packets were all routed to one NIC. So what is the problem?
yi




--
发自我的网易邮箱手机智能版


在 2015-06-22 20:13:20,"Stefan Hajnoczi" <stefanha@gmail.com> 写道:
>On Sat, Jun 20, 2015 at 02:26:29PM +0300, Shmulik Ladkani wrote:
>> Currently, MAX_NICS is hardcoded as 8.
>> 
>> Add a configuration option '--net-max-nics' so one can override the
>> default.
>> Unless specified, default value is kept as 8.
>> 
>> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
>> ---
>>  configure         | 7 +++++++
>>  include/net/net.h | 2 +-
>>  2 files changed, 8 insertions(+), 1 deletion(-)
>
>The -device e1000,netdev=tap0,id=e1000-nic0 syntax is preferred to -net
>nic syntax and does not have the 8 NIC limit.
>
>Please use the -device syntax instead of -net.  Emulated NICs that
>support virtio_net_hdr offload also perform better with the -device
>syntax because -net nic does not allow virtio_net_hdr offloads.
>
>If you think this patch should be merged, please explain the use case.
Jason Wang Sept. 29, 2015, 3:19 a.m. UTC | #4
On 09/28/2015 07:52 PM, cauchy-love wrote:
> hi stefan.
>    I have setup a VM on a server with two NICs (eth0 and eth1).  eth0 is connected with vlan22 and eth1 is connected with vlan33. I then added eth0.22 to br2  and eth1.33 to br3. after that tap2 and tap3 were added to br2 and br3 respectively. When i start up the vm,  the network connection is failed if tap2 and tap3 are allocated to this VM while it is ok if i only allocate one tap to this VM. It is shown that the packets were all routed to one NIC. So what is the problem?
> yi
>

Need more information. You qemu command line or libvirt xml. Versions of
qemu, host kernel and guest kernel. Is the issue only reproduced with
e1000 or others? Does it work if there's no vlan? And maybe you can try
qemu.git to see if it could be reproduced.

Thanks

>
>
> --
> 发自我的网易邮箱手机智能版
>
>
> 在 2015-06-22 20:13:20,"Stefan Hajnoczi" <stefanha@gmail.com> 写道:
>> On Sat, Jun 20, 2015 at 02:26:29PM +0300, Shmulik Ladkani wrote:
>>> Currently, MAX_NICS is hardcoded as 8.
>>>
>>> Add a configuration option '--net-max-nics' so one can override the
>>> default.
>>> Unless specified, default value is kept as 8.
>>>
>>> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
>>> ---
>>>  configure         | 7 +++++++
>>>  include/net/net.h | 2 +-
>>>  2 files changed, 8 insertions(+), 1 deletion(-)
>> The -device e1000,netdev=tap0,id=e1000-nic0 syntax is preferred to -net
>> nic syntax and does not have the 8 NIC limit.
>>
>> Please use the -device syntax instead of -net.  Emulated NICs that
>> support virtio_net_hdr offload also perform better with the -device
>> syntax because -net nic does not allow virtio_net_hdr offloads.
>>
>> If you think this patch should be merged, please explain the use case.
cauchy-love Sept. 29, 2015, 5:28 a.m. UTC | #5
Thanks for your reply. After testing,  I found the network connection was failed even without vlan. If I started up two VMs,  each of which has two VNICS(attached to br0 and br1), the network failed if br0 and br1 were on different VLans( belong to the same NIC) or on different NICs. I am using CENTOS 7.0  and QEMU2.3 as well as  E1000. The command line is as following:
qemu -net nic, model=e1000,macaddr=xxxx -net bridge=br0, tap=tap11,scipt=no  -net nic,model=e1000,macaddr=xxxx -net bridge=br1,tap=tap12,script=no -enable kvm
在 2015-09-29 11:19:41,"Jason Wang" <jasowang@redhat.com> 写道:


On 09/28/2015 07:52 PM, cauchy-love wrote:
> hi stefan.

>    I have setup a VM on a server with two NICs (eth0 and eth1).  eth0 is connected with vlan22 and eth1 is connected with vlan33. I then added eth0.22 to br2  and eth1.33 to br3. after that tap2 and tap3 were added to br2 and br3 respectively. When i start up the vm,  the network connection is failed if tap2 and tap3 are allocated to this VM while it is ok if i only allocate one tap to this VM. It is shown that the packets were all routed to one NIC. So what is the problem?

> yi

>


Need more information. You qemu command line or libvirt xml. Versions of
qemu, host kernel and guest kernel. Is the issue only reproduced with
e1000 or others? Does it work if there's no vlan? And maybe you can try
qemu.git to see if it could be reproduced.

Thanks

>

>

> --

> 发自我的网易邮箱手机智能版

>

>

> 在 2015-06-22 20:13:20,"Stefan Hajnoczi" <stefanha@gmail.com> 写道:

>> On Sat, Jun 20, 2015 at 02:26:29PM +0300, Shmulik Ladkani wrote:

>>> Currently, MAX_NICS is hardcoded as 8.

>>>

>>> Add a configuration option '--net-max-nics' so one can override the

>>> default.

>>> Unless specified, default value is kept as 8.

>>>

>>> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>

>>> ---

>>>  configure         | 7 +++++++

>>>  include/net/net.h | 2 +-

>>>  2 files changed, 8 insertions(+), 1 deletion(-)

>> The -device e1000,netdev=tap0,id=e1000-nic0 syntax is preferred to -net

>> nic syntax and does not have the 8 NIC limit.

>>

>> Please use the -device syntax instead of -net.  Emulated NICs that

>> support virtio_net_hdr offload also perform better with the -device

>> syntax because -net nic does not allow virtio_net_hdr offloads.

>>

>> If you think this patch should be merged, please explain the use case.
cauchy-love Sept. 29, 2015, 5:36 a.m. UTC | #6
BTW: Xen4.2 and later works quite well
在 2015-09-29 11:19:41,"Jason Wang" <jasowang@redhat.com> 写道:


On 09/28/2015 07:52 PM, cauchy-love wrote:
> hi stefan.

>    I have setup a VM on a server with two NICs (eth0 and eth1).  eth0 is connected with vlan22 and eth1 is connected with vlan33. I then added eth0.22 to br2  and eth1.33 to br3. after that tap2 and tap3 were added to br2 and br3 respectively. When i start up the vm,  the network connection is failed if tap2 and tap3 are allocated to this VM while it is ok if i only allocate one tap to this VM. It is shown that the packets were all routed to one NIC. So what is the problem?

> yi

>


Need more information. You qemu command line or libvirt xml. Versions of
qemu, host kernel and guest kernel. Is the issue only reproduced with
e1000 or others? Does it work if there's no vlan? And maybe you can try
qemu.git to see if it could be reproduced.

Thanks

>

>

> --

> 发自我的网易邮箱手机智能版

>

>

> 在 2015-06-22 20:13:20,"Stefan Hajnoczi" <stefanha@gmail.com> 写道:

>> On Sat, Jun 20, 2015 at 02:26:29PM +0300, Shmulik Ladkani wrote:

>>> Currently, MAX_NICS is hardcoded as 8.

>>>

>>> Add a configuration option '--net-max-nics' so one can override the

>>> default.

>>> Unless specified, default value is kept as 8.

>>>

>>> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>

>>> ---

>>>  configure         | 7 +++++++

>>>  include/net/net.h | 2 +-

>>>  2 files changed, 8 insertions(+), 1 deletion(-)

>> The -device e1000,netdev=tap0,id=e1000-nic0 syntax is preferred to -net

>> nic syntax and does not have the 8 NIC limit.

>>

>> Please use the -device syntax instead of -net.  Emulated NICs that

>> support virtio_net_hdr offload also perform better with the -device

>> syntax because -net nic does not allow virtio_net_hdr offloads.

>>

>> If you think this patch should be merged, please explain the use case.
cauchy-love Sept. 29, 2015, 11:46 a.m. UTC | #7
BTW: the virt-manager works well on the server. I don't know how to make the multiple NICs work using command line.
在 2015-09-29 11:19:41,"Jason Wang" <jasowang@redhat.com> 写道:


On 09/28/2015 07:52 PM, cauchy-love wrote:
> hi stefan.

>    I have setup a VM on a server with two NICs (eth0 and eth1).  eth0 is connected with vlan22 and eth1 is connected with vlan33. I then added eth0.22 to br2  and eth1.33 to br3. after that tap2 and tap3 were added to br2 and br3 respectively. When i start up the vm,  the network connection is failed if tap2 and tap3 are allocated to this VM while it is ok if i only allocate one tap to this VM. It is shown that the packets were all routed to one NIC. So what is the problem?

> yi

>


Need more information. You qemu command line or libvirt xml. Versions of
qemu, host kernel and guest kernel. Is the issue only reproduced with
e1000 or others? Does it work if there's no vlan? And maybe you can try
qemu.git to see if it could be reproduced.

Thanks

>

>

> --

> 发自我的网易邮箱手机智能版

>

>

> 在 2015-06-22 20:13:20,"Stefan Hajnoczi" <stefanha@gmail.com> 写道:

>> On Sat, Jun 20, 2015 at 02:26:29PM +0300, Shmulik Ladkani wrote:

>>> Currently, MAX_NICS is hardcoded as 8.

>>>

>>> Add a configuration option '--net-max-nics' so one can override the

>>> default.

>>> Unless specified, default value is kept as 8.

>>>

>>> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>

>>> ---

>>>  configure         | 7 +++++++

>>>  include/net/net.h | 2 +-

>>>  2 files changed, 8 insertions(+), 1 deletion(-)

>> The -device e1000,netdev=tap0,id=e1000-nic0 syntax is preferred to -net

>> nic syntax and does not have the 8 NIC limit.

>>

>> Please use the -device syntax instead of -net.  Emulated NICs that

>> support virtio_net_hdr offload also perform better with the -device

>> syntax because -net nic does not allow virtio_net_hdr offloads.

>>

>> If you think this patch should be merged, please explain the use case.
diff mbox

Patch

diff --git a/configure b/configure
index 222694f34d..ce859a1853 100755
--- a/configure
+++ b/configure
@@ -336,6 +336,7 @@  vhdx=""
 quorum=""
 numa=""
 tcmalloc="no"
+net_max_nics="8"
 
 # parse CC options first
 for opt do
@@ -1147,6 +1148,8 @@  for opt do
   ;;
   --enable-tcmalloc) tcmalloc="yes"
   ;;
+  --net-max-nics=*) net_max_nics="$optarg"
+  ;;
   *)
       echo "ERROR: unknown option $opt"
       echo "Try '$0 --help' for more information"
@@ -1420,6 +1423,7 @@  Advanced options (experts only):
   --enable-numa            enable libnuma support
   --disable-tcmalloc       disable tcmalloc support
   --enable-tcmalloc        enable tcmalloc support
+  --net-max-nics=NUM       maximum number of network NICs
 
 NOTE: The object files are built at the place where configure is launched
 EOF
@@ -4499,6 +4503,7 @@  echo "snappy support    $snappy"
 echo "bzip2 support     $bzip2"
 echo "NUMA host support $numa"
 echo "tcmalloc support  $tcmalloc"
+echo "maximum network nics $net_max_nics"
 
 if test "$sdl_too_old" = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -5011,6 +5016,8 @@  if test "$rdma" = "yes" ; then
   echo "CONFIG_RDMA=y" >> $config_host_mak
 fi
 
+echo "CONFIG_NET_MAX_NICS=$net_max_nics" >> $config_host_mak
+
 # Hold two types of flag:
 #   CONFIG_THREAD_SETNAME_BYTHREAD  - we've got a way of setting the name on
 #                                     a thread we have a handle to
diff --git a/include/net/net.h b/include/net/net.h
index 4306252b97..6be063f1dc 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -167,7 +167,7 @@  void hmp_info_network(Monitor *mon, const QDict *qdict);
 
 /* NIC info */
 
-#define MAX_NICS 8
+#define MAX_NICS (CONFIG_NET_MAX_NICS)
 
 struct NICInfo {
     MACAddr macaddr;