Skip to contentSkip to conversation

doc: correct Vhost Sample Application guide

PATCH Superseded Bernard Iremonger 5 participants 16 messages Dec 9, 2015 – Dec 14, 2015

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: correct Vhost Sample Application guide

correct sample console commands

Fixes d0dff9ba445e ("doc: sample application user guide"
Fixes 9bc23cb8209c ("doc: add vhost-user to sample guide")
Fixes 43866bf71d58 ("doc: fix vhost sample parameter")
---
 doc/guides/sample_app_ug/vhost.rst | 40 +++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
doc/guides/sample_app_ug/vhost.rst +20 -20
index ceeaf52..70d31b6 100644
@@ -1,6 +1,6 @@
 
 ..  BSD LICENSE
-    Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+    Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
     All rights reserved.
 
     Redistribution and use in source and binary forms, with or without
@@ -386,13 +386,13 @@ Running the Sample Code
 
     .. code-block:: console
 
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+        user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- -p 0x1 --dev-basename usvhost
 
     vhost user: a socket file named usvhost will be created under current directory. Use its path as the socket path in guest's qemu commandline.
 
     .. code-block:: console
 
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+        user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- -p 0x1 --dev-basename usvhost
 
 .. note::
 
@@ -411,7 +411,7 @@ For compatibility with the QEMU wrapper script, a base name of "usvhost" should
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- -p 0x1 --dev-basename usvhost
 
 **vm2vm.**
 The vm2vm parameter disable/set mode of packet switching between guests in the host.
@@ -424,7 +424,7 @@ which bases on the packet destination MAC address and VLAN tag.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --vm2vm [0,1,2]
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --vm2vm [0,1,2]
 
 **Mergeable Buffers.**
 The mergeable buffers parameter controls how virtio-net descriptors are used for virtio-net headers.
@@ -434,7 +434,7 @@ The default value is 0 or disabled since recent kernels virtio-net drivers show
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --mergeable [0,1]
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --mergeable [0,1]
 
 **Stats.**
 The stats parameter controls the printing of virtio-net device statistics.
@@ -442,7 +442,7 @@ The parameter specifies an interval second to print statistics, with an interval
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --stats [0,n]
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --stats [0,n]
 
 **RX Retry.**
 The rx-retry option enables/disables enqueue retries when the guests RX queue is full.
@@ -452,7 +452,7 @@ This option is enabled by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --rx-retry [0,1]
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --rx-retry [0,1]
 
 **RX Retry Number.**
 The rx-retry-num option specifies the number of retries on an RX burst,
@@ -461,7 +461,7 @@ The default value is 4.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --rx-retry 1 --rx-retry-num 5
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --rx-retry 1 --rx-retry-num 5
 
 **RX Retry Delay Time.**
 The rx-retry-delay option specifies the timeout (in micro seconds) between retries on an RX burst,
@@ -470,7 +470,7 @@ The default value is 15.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --rx-retry 1 --rx-retry-delay 20
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --rx-retry 1 --rx-retry-delay 20
 
 **Zero copy.**
 The zero copy option enables/disables the zero copy mode for RX/TX packet,
@@ -481,7 +481,7 @@ This option is disabled by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --zero-copy [0,1]
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --zero-copy [0,1]
 
 **RX descriptor number.**
 The RX descriptor number option specify the Ethernet RX descriptor number,
@@ -494,7 +494,7 @@ So it is valid only in zero copy mode is enabled. The value is 32 by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --zero-copy 1 --rx-desc-num [0, n]
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --zero-copy 1 --rx-desc-num [0, n]
 
 **TX descriptor number.**
 The TX descriptor number option specify the Ethernet TX descriptor number, it is valid only in zero copy mode is enabled.
@@ -502,7 +502,7 @@ The value is 64 by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --zero-copy 1 --tx-desc-num [0, n]
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --zero-copy 1 --tx-desc-num [0, n]
 
 **VLAN strip.**
 The VLAN strip option enable/disable the VLAN strip on host, if disabled, the guest will receive the packets with VLAN tag.
@@ -510,7 +510,7 @@ It is enabled by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --vlan-strip [0, 1]
+    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- --vlan-strip [0, 1]
 
 Running the Virtual Machine (QEMU)
 ----------------------------------
@@ -539,7 +539,7 @@ QEMU must be executed with specific parameters to:
 
     .. code-block:: console
 
-        user@target:~$ qemu-system-x86_64 ... -mem-prealloc -mem-path / dev/hugepages ...
+        user@target:~$ qemu-system-x86_64 ... -mem-prealloc -mem-path /dev/hugepages ...
 
 .. note::
 
@@ -573,7 +573,7 @@ In this case, the path passed to the guest should be that of the 1 GB page huget
 
 .. code-block:: console
 
-    user@target:~$ qemu-system-x86_64 ... -mem-prealloc -mem-path / dev/hugepages ...
+    user@target:~$ qemu-system-x86_64 ... -mem-prealloc -mem-path /dev/hugepages ...
 
 .. note::
 
@@ -771,21 +771,21 @@ Run the testpmd application as follows:
 
 .. code-block:: console
 
-    user@target:~$ x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -- n 4 -socket-mem 128 -- --burst=64 -i
+    user@target:~$ x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 --socket-mem 512 -- --burst=64 --i --disable-hw-vlan-filter
 
 The destination MAC address for packets transmitted on each port can be set at the command line:
 
 .. code-block:: console
 
-    user@target:~$ x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -- n 4 -socket-mem 128 -- --burst=64 -i --eth- peer=0,aa:bb:cc:dd:ee:ff --eth-peer=1,ff,ee,dd,cc,bb,aa
+    user@target:~$ x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 --socket-mem 512 -- --burst=64 --i --disable-hw-vlan-filter --eth-peer=0,aa:bb:cc:dd:ee:ff --eth-peer=1,ff:ee:dd:cc:bb:aa
 
 *   Packets received on port 1 will be forwarded on port 0 to MAC address
 
-    aa:bb:cc:dd:ee:ff.
+    aa:bb:cc:dd:ee:ff
 
 *   Packets received on port 0 will be forwarded on port 1 to MAC address
 
-    ff,ee,dd,cc,bb,aa.
+    ff:ee:dd:cc:bb:aa
 
 The testpmd application can then be configured to act as an L2 forwarding application:
 
Signature · 1 line
2.6.3
#2 lore raw
In reply to Bernard Iremonger
Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bernard Iremonger
Sent: Wednesday, December 9, 2015 12:36 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/1] doc: correct Vhost Sample Application guide

Quoted 6 lines

correct sample console commands

Fixes d0dff9ba445e ("doc: sample application user guide"
Fixes 9bc23cb8209c ("doc: add vhost-user to sample guide")
Fixes 43866bf71d58 ("doc: fix vhost sample parameter")

Hi Bernard,

Thanks for that. One comment (in several places):

Review

Quoted 4 lines

.. code-block:: console

(quoted diff) +1 -1
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- -p 0x1 --dev-basename usvhost
+        user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- -p 0x1 --dev-basename usvhost

These long lines in code blocks don't render correctly in the PDF docs. The Documentation Guidelines suggest using a commandline line continuation to maintain functionality within an 80 char doc limit:

http://dpdk.org/doc/guides/contributing/documentation.html#code-and-literal-block-sections

So something like this:

    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge -- -p 0x1 --dev-basename usvhost

Could be written as:

    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 \
                         --huge-dir /mnt/huge -- -p 0x1 --dev-basename usvhost

Or:

    user@target:~$ ./build/app/vhost-switch -c f -n 4 \
                                            --socket-mem 1024 \
                                            --huge-dir /mnt/huge \
                                            -- -p 0x1 --dev-basename usvhost

Regards,

John.

#3 lore raw

Hi John,

<snip>

Quoted 37 lines

Hi Bernard,

Thanks for that. One comment (in several places):

Quoted 3 lines

.. code-block:: console

- user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir

/mnt/huge -- -p 0x1 --dev-basename usvhost

Quoted 3 lines

+ user@target:~$ ./build/app/vhost-switch -c f -n 4
+ --socket-mem 1024 --huge-dir /mnt/huge -- -p 0x1 --dev-basename
+ usvhost

These long lines in code blocks don't render correctly in the PDF docs. The Documentation Guidelines suggest using a commandline line continuation to maintain functionality within an 80 char doc limit:

http://dpdk.org/doc/guides/contributing/documentation.html#code-and-
literal-block-sections

So something like this:

    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 --
huge-dir /mnt/huge -- -p 0x1 --dev-basename usvhost

Could be written as:

    user@target:~$ ./build/app/vhost-switch -c f -n 4 --socket-mem 1024 \
                         --huge-dir /mnt/huge -- -p 0x1 --dev-basename usvhost

Or:

    user@target:~$ ./build/app/vhost-switch -c f -n 4 \
                                            --socket-mem 1024 \
                                            --huge-dir /mnt/huge \
                                            -- -p 0x1 --dev-basename usvhost
Quoted 4 lines

Regards,

John.
--

I will use a command line continuation character to stay within 80 character limit.

Regards,

Bernard.

#4 lore raw
In reply to Bernard Iremonger
Quoted 18 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bernard Iremonger
Sent: Wednesday, December 9, 2015 12:36 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/1] doc: correct Vhost Sample Application guide

correct sample console commands

Fixes d0dff9ba445e ("doc: sample application user guide"
Fixes 9bc23cb8209c ("doc: add vhost-user to sample guide")
Fixes 43866bf71d58 ("doc: fix vhost sample parameter")
---
 doc/guides/sample_app_ug/vhost.rst | 40 +++++++++++++++++++--------------
Quoted 8 lines

...

Redistribution and use in source and binary forms, with or without @@
-386,13 +386,13 @@ Running the Sample Code

.. code-block:: console

- user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /

Also, as a general note, not just to this document/patch.

I don't think the "user@target:~$" prefixes used in some DPDK Doc commandlines is useful.

It prevents a straight copy and paste for testing, it makes the literal block lines longer than they should be, it isn't used consistently everywhere, it is visually distracting (in some cases it is longer than the command being shown), and it isn't always correct (I presume in the above case of "user@target" you would need run the application as sudo if you are a non root user).

Any objections to removing these as documents are updated?

John

#5 lore raw

2015-12-09 14:50, Mcnamara, John:

Quoted 13 lines

Also, as a general note, not just to this document/patch.

I don't think the "user@target:~$" prefixes used in some DPDK Doc commandlines is useful.

It prevents a straight copy and paste for testing, it makes the literal block lines longer than they should be, it isn't used consistently everywhere, it is visually distracting (in some cases it is longer than the command being shown), and it isn't always correct (I presume in the above case of "user@target" you would need run the application as sudo if you are a non root user).

Quoted 1 line

Any objections to removing these as documents are updated?

Generally speaking, +1 to remove extra bytes :)

#6 lore raw

Hi John,
<snip>

Quoted 13 lines

2015-12-09 14:50, Mcnamara, John:

Quoted 12 lines

Also, as a general note, not just to this document/patch.

I don't think the "user@target:~$" prefixes used in some DPDK Doc commandlines is useful.

It prevents a straight copy and paste for testing, it makes the literal block lines longer than they should be, it isn't used consistently everywhere, it is visually distracting (in some cases it is longer than the command being shown), and it isn't always correct (I presume in the above case of "user@target" you would need run the application as sudo if you are a non root user).

Quoted 3 lines
Quoted 1 line

Any objections to removing these as documents are updated?

Generally speaking, +1 to remove extra bytes :)

I will remove the "user@target:~$" prefixes in this document.

Regards,

Bernard.

#7 lore raw
Quoted 16 lines · Bernard

Hi John,
<snip>

Quoted 13 lines

2015-12-09 14:50, Mcnamara, John:

Quoted 12 lines

Also, as a general note, not just to this document/patch.

I don't think the "user@target:~$" prefixes used in some DPDK Doc commandlines is useful.

It prevents a straight copy and paste for testing, it makes the literal block lines longer than they should be, it isn't used consistently everywhere, it is visually distracting (in some cases it is longer than the command being shown), and it isn't always correct (I presume in the above case of "user@target" you would need run the application as sudo if you are a non root user).

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Any objections to removing these as documents are updated?

Generally speaking, +1 to remove extra bytes :)

I will remove the "user@target:~$" prefixes in this document.

I'd personally suggest to keep the "$ " prefix, or "# " if it needs root privilege. Which is a convention to paste commands.

	--yliu
#8 lore raw

PATCH v2 1/1 doc: correct Vhost Sample Application guide

In reply to Bernard Iremonger

correct sample console commands

changes in v2:
remove "user@target:~$" prefixes in command lines. use continuation character to stay within 80 character limit. wrap sample python code.

Fixes d0dff9ba445e ("doc: sample application user guide"
Fixes 9bc23cb8209c ("doc: add vhost-user to sample guide")
Fixes 43866bf71d58 ("doc: fix vhost sample parameter")
---
 doc/guides/sample_app_ug/vhost.rst | 99 ++++++++++++++++++++++++--------------
 1 file changed, 64 insertions(+), 35 deletions(-)
doc/guides/sample_app_ug/vhost.rst +64 -35
index ceeaf52..21b5360 100644
@@ -1,6 +1,6 @@
 
 ..  BSD LICENSE
-    Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+    Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
     All rights reserved.
 
     Redistribution and use in source and binary forms, with or without
@@ -275,7 +275,7 @@ For vhost cuse:
 
 .. code-block:: console
 
-    user@target:~$ qemu-system-x86_64 ... \
+    qemu-system-x86_64 ... \
     -netdev tap,id=hostnet1,vhost=on,vhostfd=<open fd> \
     -device virtio-net-pci, netdev=hostnet1,id=net1 \
     -netdev tap,id=hostnet2,vhost=on,vhostfd=<open fd> \
@@ -285,7 +285,7 @@ For vhost user:
 
 .. code-block:: console
 
-    user@target:~$ qemu-system-x86_64 ... \
+    qemu-system-x86_64 ... \
     -chardev socket,id=char1,path=<sock_path> \
     -netdev type=vhost-user,id=hostnet1,chardev=char1 \
     -device virtio-net-pci,netdev=hostnet1,id=net1 \
@@ -378,7 +378,7 @@ Running the Sample Code
     .. code-block:: console
 
         export RTE_SDK=/path/to/rte_sdk
-        cd ${RTE_SDK}/examples/vhost
+        cd ${RTE_SDK}/examples/vhost/build/app
 
 #.  Run the vhost-switch sample code:
 
@@ -386,13 +386,15 @@ Running the Sample Code
 
     .. code-block:: console
 
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+        ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+         -- -p 0x1 --dev-basename usvhost
 
     vhost user: a socket file named usvhost will be created under current directory. Use its path as the socket path in guest's qemu commandline.
 
     .. code-block:: console
 
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+        ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+         -- -p 0x1 --dev-basename usvhost
 
 .. note::
 
@@ -411,7 +413,8 @@ For compatibility with the QEMU wrapper script, a base name of "usvhost" should
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- -p 0x1 --dev-basename usvhost
 
 **vm2vm.**
 The vm2vm parameter disable/set mode of packet switching between guests in the host.
@@ -424,7 +427,8 @@ which bases on the packet destination MAC address and VLAN tag.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --vm2vm [0,1,2]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --vm2vm [0,1,2]
 
 **Mergeable Buffers.**
 The mergeable buffers parameter controls how virtio-net descriptors are used for virtio-net headers.
@@ -434,7 +438,8 @@ The default value is 0 or disabled since recent kernels virtio-net drivers show
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --mergeable [0,1]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --mergeable [0,1]
 
 **Stats.**
 The stats parameter controls the printing of virtio-net device statistics.
@@ -442,7 +447,8 @@ The parameter specifies an interval second to print statistics, with an interval
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --stats [0,n]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+    -- --stats [0,n]
 
 **RX Retry.**
 The rx-retry option enables/disables enqueue retries when the guests RX queue is full.
@@ -452,7 +458,8 @@ This option is enabled by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --rx-retry [0,1]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --rx-retry [0,1]
 
 **RX Retry Number.**
 The rx-retry-num option specifies the number of retries on an RX burst,
@@ -461,7 +468,8 @@ The default value is 4.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --rx-retry 1 --rx-retry-num 5
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --rx-retry 1 --rx-retry-num 5
 
 **RX Retry Delay Time.**
 The rx-retry-delay option specifies the timeout (in micro seconds) between retries on an RX burst,
@@ -470,7 +478,8 @@ The default value is 15.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --rx-retry 1 --rx-retry-delay 20
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --rx-retry 1 --rx-retry-delay 20
 
 **Zero copy.**
 The zero copy option enables/disables the zero copy mode for RX/TX packet,
@@ -481,7 +490,8 @@ This option is disabled by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --zero-copy [0,1]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --zero-copy [0,1]
 
 **RX descriptor number.**
 The RX descriptor number option specify the Ethernet RX descriptor number,
@@ -494,7 +504,8 @@ So it is valid only in zero copy mode is enabled. The value is 32 by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --zero-copy 1 --rx-desc-num [0, n]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --zero-copy 1 --rx-desc-num [0, n]
 
 **TX descriptor number.**
 The TX descriptor number option specify the Ethernet TX descriptor number, it is valid only in zero copy mode is enabled.
@@ -502,7 +513,8 @@ The value is 64 by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --zero-copy 1 --tx-desc-num [0, n]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --zero-copy 1 --tx-desc-num [0, n]
 
 **VLAN strip.**
 The VLAN strip option enable/disable the VLAN strip on host, if disabled, the guest will receive the packets with VLAN tag.
@@ -510,7 +522,8 @@ It is enabled by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --vlan-strip [0, 1]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --vlan-strip [0, 1]
 
 Running the Virtual Machine (QEMU)
 ----------------------------------
@@ -521,25 +534,28 @@ QEMU must be executed with specific parameters to:
 
     .. code-block:: console
 
-        user@target:~$ qemu-system-x86_64 ... -device virtio-net-pci,netdev=hostnet1,id=net1 ...
+        qemu-system-x86_64 ... -device virtio-net-pci,netdev=hostnet1, \
+        id=net1 ...
 
 *   Ensure the guest's virtio-net network adapter is configured with offloads disabled.
 
     .. code-block:: console
 
-        user@target:~$ qemu-system-x86_64 ... -device virtio-net-pci,netdev=hostnet1,id=net1,csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off
+        qemu-system-x86_64 ... -device virtio-net-pci,netdev=hostnet1, \
+        id=net1, csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off
 
 *   Redirect QEMU to communicate with the DPDK vhost-net sample code in place of the vhost-net kernel module(vhost cuse).
 
     .. code-block:: console
 
-        user@target:~$ qemu-system-x86_64 ... -netdev tap,id=hostnet1,vhost=on,vhostfd=<open fd> ...
+        qemu-system-x86_64 ... -netdev tap,id=hostnet1,vhost=on, \
+        vhostfd=<open fd> ...
 
 *   Enable the vhost-net sample code to map the VM's memory into its own process address space.
 
     .. code-block:: console
 
-        user@target:~$ qemu-system-x86_64 ... -mem-prealloc -mem-path / dev/hugepages ...
+        qemu-system-x86_64 ... -mem-prealloc -mem-path /dev/hugepages ...
 
 .. note::
 
@@ -556,7 +572,9 @@ an open file descriptor must be passed to QEMU running as a child process.
 
     #!/usr/bin/python
     fd = os.open("/dev/usvhost-1", os.O_RDWR)
-    subprocess.call("qemu-system-x86_64 ... . -netdev tap,id=vhostnet0,vhost=on,vhostfd=" + fd +"...", shell=True)
+    subprocess.call
+    ("qemu-system-x86_64 ... -netdev tap,id=vhostnet0,vhost=on,vhostfd="
+      + fd +"...", shell=True)
 
 .. note::
 
@@ -573,12 +591,13 @@ In this case, the path passed to the guest should be that of the 1 GB page huget
 
 .. code-block:: console
 
-    user@target:~$ qemu-system-x86_64 ... -mem-prealloc -mem-path / dev/hugepages ...
+    qemu-system-x86_64 ... -mem-prealloc -mem-path /dev/hugepages ...
 
 .. note::
 
     This process is automated in the QEMU wrapper script discussed in Section 24.7.3.
-    The following two sections only applies to vhost cuse. For vhost-user, please make corresponding changes to qemu-wrapper script and guest XML file.
+    The following two sections only applies to vhost cuse.
+    For vhost-user, please make corresponding changes to qemu-wrapper script and guest XML file.
 
 QEMU Wrapper Script
 ~~~~~~~~~~~~~~~~~~~
@@ -599,16 +618,22 @@ The QEMU wrapper script will automatically configure calls to QEMU:
 
 .. code-block:: console
 
-    user@target:~$ qemu-wrap.py -machine pc-i440fx-1.4,accel=kvm,usb=off -cpu SandyBridge -smp 4,sockets=4,cores=1,threads=1
-    -netdev tap,id=hostnet1,vhost=on -device virtio-net-pci,netdev=hostnet1,id=net1 -hda <disk img> -m 4096
+    qemu-wrap.py -machine pc-i440fx-1.4,accel=kvm,usb=off \
+    -cpu SandyBridge -smp 4,sockets=4,cores=1,threads=1 \
+    -netdev tap,id=hostnet1,vhost=on \
+    -device virtio-net-pci,netdev=hostnet1,id=net1 \
+    -hda <disk img> -m 4096
 
 which will become the following call to QEMU:
 
 .. code-block:: console
 
-    /usr/local/bin/qemu-system-x86_64 -machine pc-i440fx-1.4,accel=kvm,usb=off -cpu SandyBridge -smp 4,sockets=4,cores=1,threads=1
-    -netdev tap,id=hostnet1,vhost=on,vhostfd=<open fd> -device virtio-net-pci,netdev=hostnet1,id=net1,
-    csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off -hda <disk img> -m 4096 -mem-path /dev/hugepages -mem-prealloc
+    qemu-system-x86_64 -machine pc-i440fx-1.4,accel=kvm,usb=off \
+    -cpu SandyBridge -smp 4,sockets=4,cores=1,threads=1 \
+    -netdev tap,id=hostnet1,vhost=on,vhostfd=<open fd> \
+    -device virtio-net-pci,netdev=hostnet1,id=net1, \
+    csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off \
+    -hda <disk img> -m 4096 -mem-path /dev/hugepages -mem-prealloc
 
 Libvirt Integration
 ~~~~~~~~~~~~~~~~~~~
@@ -660,8 +685,8 @@ To call the QEMU wrapper automatically from libvirt, the following configuration
 
     .. code-block:: console
 
-        user@target:~$ mkdir /dev/cgroup
-        user@target:~$ mount -t cgroup none /dev/cgroup -o devices
+        mkdir /dev/cgroup
+        mount -t cgroup none /dev/cgroup -o devices
 
 *   Restart the libvirtd system process
 
@@ -771,21 +796,25 @@ Run the testpmd application as follows:
 
 .. code-block:: console
 
-    user@target:~$ x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -- n 4 -socket-mem 128 -- --burst=64 -i
+    cd ${RTE_SDK}/x86_64-native-linuxapp-gcc/app
+    ./testpmd -c 0x3 -n 4 --socket-mem 512 \
+    -- --burst=64 --i --disable-hw-vlan-filter
 
 The destination MAC address for packets transmitted on each port can be set at the command line:
 
 .. code-block:: console
 
-    user@target:~$ x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -- n 4 -socket-mem 128 -- --burst=64 -i --eth- peer=0,aa:bb:cc:dd:ee:ff --eth-peer=1,ff,ee,dd,cc,bb,aa
+    ./testpmd -c 0x3 -n 4 --socket-mem 512 \
+    -- --burst=64 --i --disable-hw-vlan-filter \
+    --eth-peer=0,aa:bb:cc:dd:ee:ff --eth-peer=1,ff:ee:dd:cc:bb:aa
 
 *   Packets received on port 1 will be forwarded on port 0 to MAC address
 
-    aa:bb:cc:dd:ee:ff.
+    aa:bb:cc:dd:ee:ff
 
 *   Packets received on port 0 will be forwarded on port 1 to MAC address
 
-    ff,ee,dd,cc,bb,aa.
+    ff:ee:dd:cc:bb:aa
 
 The testpmd application can then be configured to act as an L2 forwarding application:
 
Signature · 1 line
2.6.3
#9 lore raw
Quoted 1 line · Bernard Iremonger

correct sample console commands

You'd state what exactly this patch corrects here, and why is that needed.

Quoted 11 lines

changes in v2:
remove "user@target:~$" prefixes in command lines. use continuation character to stay within 80 character limit. wrap sample python code.

Fixes d0dff9ba445e ("doc: sample application user guide"
Fixes 9bc23cb8209c ("doc: add vhost-user to sample guide")
Fixes 43866bf71d58 ("doc: fix vhost sample parameter")

---

...

doc/guides/sample_app_ug/vhost.rst Running the Sample Code · line 390

Quoted 8 lines
doc/guides/sample_app_ug/vhost.rst +2 -1
@@ -386,13 +386,15 @@ Running the Sample Code
 
     .. code-block:: console
 
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+        ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+         -- -p 0x1 --dev-basename usvhost

I don't think that's a right "correction": vhost-swtich would fail to start:

EAL: Error - exiting with code: 1
Cause: Cannot create mbuf pool

As vhost-switch creates more mbuf than 1024M can hold.

However, I do think that adding this option is necessary, otherwise, all hugepages will be allocated to vhost-switch, leaving no memory for starting VM at all. (And this is kind of informatin you need to put into commit log).

And limiting it to "1024M" is reasonable as well, so that we can run it on a desktop (or laptop) without too many memories. You just need fix vhost-switch example to not allocate too many mbufs by default.

	--yliu
#10 lore raw

Hi Yuanhan,

Quoted 8 lines

-----Original Message-----
From: Yuanhan Liu [mailto:[email protected]]
Sent: Thursday, December 10, 2015 6:53 AM
To: Iremonger, Bernard <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/1] doc: correct Vhost Sample Application guide

Quoted 4 lines
Quoted 1 line · Bernard Iremonger

correct sample console commands

You'd state what exactly this patch corrects here, and why is that needed.

I will add more information to the commit message.

Quoted 34 lines
Quoted 11 lines

changes in v2:
remove "user@target:~$" prefixes in command lines. use continuation character to stay within 80 character limit. wrap sample python code.

Fixes d0dff9ba445e ("doc: sample application user guide"
Fixes 9bc23cb8209c ("doc: add vhost-user to sample guide")
Fixes 43866bf71d58 ("doc: fix vhost sample parameter")

---

...

doc/guides/sample_app_ug/vhost.rst Running the Sample Code · line 389

Quoted 6 lines
doc/guides/sample_app_ug/vhost.rst +0 -1
@@ -386,13 +386,15 @@ Running the Sample Code
 
     .. code-block:: console
 
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /

mnt/huge -- -p 0x1 --dev-basename usvhost

Review Running the Sample Code · line 390

Quoted 2 lines
(quoted diff) +2 -0
+        ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+         -- -p 0x1 --dev-basename usvhost

I don't think that's a right "correction": vhost-swtich would fail to start:

EAL: Error - exiting with code: 1
Cause: Cannot create mbuf pool

As vhost-switch creates more mbuf than 1024M can hold.

However, I do think that adding this option is necessary, otherwise, all hugepages will be allocated to vhost-switch, leaving no memory for starting VM at all. (And this is kind of informatin you need to put into commit log).

Quoted 5 lines

And limiting it to "1024M" is reasonable as well, so that we can run it on a desktop (or laptop) without too many memories. You just need fix vhost- switch example to not allocate too many mbufs by default.

	--yliu

Yes the --socket-mem <number> option is necessary.
I will add a note that a value of <number> may need to be greater than 1024. I will submit a patch to vhost-switch to reduce the number of mbufs.

Regards,

Bernard.

#11 lore raw
Quoted 70 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Iremonger, Bernard
Sent: Thursday, December 10, 2015 5:59 PM
To: Yuanhan Liu
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/1] doc: correct Vhost Sample Application guide

Hi Yuanhan,

Quoted 8 lines

-----Original Message-----
From: Yuanhan Liu [mailto:[email protected]]
Sent: Thursday, December 10, 2015 6:53 AM
To: Iremonger, Bernard <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/1] doc: correct Vhost Sample Application guide

Quoted 4 lines
Quoted 1 line · Bernard Iremonger

correct sample console commands

You'd state what exactly this patch corrects here, and why is that needed.

I will add more information to the commit message.

Quoted 11 lines
Quoted 11 lines

changes in v2:
remove "user@target:~$" prefixes in command lines. use continuation character to stay within 80 character limit. wrap sample python code.

Fixes d0dff9ba445e ("doc: sample application user guide"
Fixes 9bc23cb8209c ("doc: add vhost-user to sample guide")
Fixes 43866bf71d58 ("doc: fix vhost sample parameter")

---

Quoted 9 lines

...

doc/guides/sample_app_ug/vhost.rst Running the Sample Code · line 389

Quoted 6 lines
doc/guides/sample_app_ug/vhost.rst +0 -1
@@ -386,13 +386,15 @@ Running the Sample Code
 
     .. code-block:: console
 
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /

mnt/huge -- -p 0x1 --dev-basename usvhost

Quoted 1 line
(quoted diff) +1 -0
+        ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir

/mnt/huge \

Quoted 5 lines

Review Running the Sample Code · line 390

Quoted 1 line
(quoted diff) +1 -0
+         -- -p 0x1 --dev-basename usvhost

I don't think that's a right "correction": vhost-swtich would fail to start:

Quoted 7 lines

EAL: Error - exiting with code: 1
Cause: Cannot create mbuf pool

As vhost-switch creates more mbuf than 1024M can hold.

However, I do think that adding this option is necessary, otherwise, all hugepages will be allocated to vhost-switch, leaving no memory for

starting

Quoted 1 line

VM at all. (And this is kind of informatin you need to put into commit

log).

Quoted 2 lines

And limiting it to "1024M" is reasonable as well, so that we can run it

on a

Quoted 3 lines

desktop (or laptop) without too many memories. You just need fix vhost- switch example to not allocate too many mbufs by default.

Quoted 7 lines
Quoted 1 line
	--yliu

Yes the --socket-mem <number> option is necessary.
I will add a note that a value of <number> may need to be greater than 1024.
I will submit a patch to vhost-switch to reduce the number of mbufs.

I recall we have to allocate mbufs for each queue rather than used queues only, so memory consumption depends on queue number. After that issue is fixed, I think 1024MB is enough. For the time being, you could temporarily use 2048M and add an explanation.

Quoted 3 lines

Regards,

Bernard.

#12 lore raw

Hi Huawei,

<snip>

Quoted 30 lines
Quoted 23 lines
Quoted 4 lines

I don't think that's a right "correction": vhost-swtich would fail to
start:

Quoted 8 lines

EAL: Error - exiting with code: 1
Cause: Cannot create mbuf pool

As vhost-switch creates more mbuf than 1024M can hold.

However, I do think that adding this option is necessary, otherwise, all hugepages will be allocated to vhost-switch, leaving no memory for

starting

Quoted 2 lines

VM at all. (And this is kind of informatin you need to put into commit

log).

Quoted 3 lines

And limiting it to "1024M" is reasonable as well, so that we can run it

on a

Quoted 3 lines

desktop (or laptop) without too many memories. You just need fix vhost- switch example to not allocate too many mbufs by default.

Quoted 7 lines
Quoted 1 line
	--yliu

Yes the --socket-mem <number> option is necessary.
I will add a note that a value of <number> may need to be greater than 1024.
I will submit a patch to vhost-switch to reduce the number of mbufs.

Quoted 5 lines

I recall we have to allocate mbufs for each queue rather than used queues only, so memory consumption depends on queue number. After that issue is fixed, I think 1024MB is enough. For the time being, you could temporarily use 2048M and add an explanation.

I have sent a v3 of this patch which includes a note that the value of 1024 may have to be increased. I would prefer to keep the value of 1024.

Regards,

Bernard.

#13 lore raw
Quoted 47 lines

-----Original Message-----
From: Iremonger, Bernard
Sent: Thursday, December 10, 2015 9:20 PM
To: Xie, Huawei; Yuanhan Liu
Cc: [email protected]
Subject: RE: [dpdk-dev] [PATCH v2 1/1] doc: correct Vhost Sample Application guide

Hi Huawei,

<snip>

Quoted 25 lines
Quoted 25 lines
Quoted 4 lines

I don't think that's a right "correction": vhost-swtich would fail to
start:

Quoted 8 lines

EAL: Error - exiting with code: 1
Cause: Cannot create mbuf pool

As vhost-switch creates more mbuf than 1024M can hold.

However, I do think that adding this option is necessary, otherwise, all hugepages will be allocated to vhost-switch, leaving no memory for

starting

Quoted 2 lines

VM at all. (And this is kind of informatin you need to put into commit

log).

Quoted 3 lines

And limiting it to "1024M" is reasonable as well, so that we can run it

on a

Quoted 4 lines

desktop (or laptop) without too many memories. You just need fix vhost- switch example to not allocate too many mbufs by default.

	--yliu
Quoted 8 lines
Quoted 5 lines

Yes the --socket-mem <number> option is necessary.
I will add a note that a value of <number> may need to be greater than 1024.
I will submit a patch to vhost-switch to reduce the number of mbufs.

I recall we have to allocate mbufs for each queue rather than used queues only, so memory consumption depends on queue number. After that issue is fixed, I think 1024MB is enough. For the time being, you could

Quoted 8 lines

temporarily

Quoted 2 lines

use 2048M and add an explanation.

I have sent a v3 of this patch which includes a note that the value of 1024 may have to be increased.
I would prefer to keep the value of 1024.

For FVL with more queues, I recall 1024mb isn't enough, but it is ok with a note. :).

Quoted 3 lines

Regards,

Bernard.

#14 lore raw

PATCH v3 1/1 doc: correct Vhost Sample Application guide

In reply to Bernard Iremonger

Fix typos in sample console commands.

Add --socket-mem 1024 to vhost-switch command lines. Without the --socket-mem parameter all hugepages will be allocated to vhost-switch, leaving no memory for the VM.

Add --disable-hw-vlan-filter parameter to testpmd command lines. Without this parameter testpmd fails on startup in the VM.

Increase value of --sock-mem parameter to testpmd as original value was too small.

changes in v3:
rebase
update commit message.
add note regarding --socket-mem parameter used with the vhost-switch program.

changes in v2:
remove "user@target:~$" prefixes in command lines. use continuation character to stay within 80 character limit. wrap sample python code.

Fixes d0dff9ba445e ("doc: sample application user guide"
Fixes 9bc23cb8209c ("doc: add vhost-user to sample guide")
Fixes 43866bf71d58 ("doc: fix vhost sample parameter")
---
 doc/guides/sample_app_ug/vhost.rst | 104 ++++++++++++++++++++++++-------------
 1 file changed, 69 insertions(+), 35 deletions(-)
doc/guides/sample_app_ug/vhost.rst +69 -35
index ceeaf52..e5d1326 100644
@@ -1,6 +1,6 @@
 
 ..  BSD LICENSE
-    Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+    Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
     All rights reserved.
 
     Redistribution and use in source and binary forms, with or without
@@ -275,7 +275,7 @@ For vhost cuse:
 
 .. code-block:: console
 
-    user@target:~$ qemu-system-x86_64 ... \
+    qemu-system-x86_64 ... \
     -netdev tap,id=hostnet1,vhost=on,vhostfd=<open fd> \
     -device virtio-net-pci, netdev=hostnet1,id=net1 \
     -netdev tap,id=hostnet2,vhost=on,vhostfd=<open fd> \
@@ -285,7 +285,7 @@ For vhost user:
 
 .. code-block:: console
 
-    user@target:~$ qemu-system-x86_64 ... \
+    qemu-system-x86_64 ... \
     -chardev socket,id=char1,path=<sock_path> \
     -netdev type=vhost-user,id=hostnet1,chardev=char1 \
     -device virtio-net-pci,netdev=hostnet1,id=net1 \
@@ -378,7 +378,7 @@ Running the Sample Code
     .. code-block:: console
 
         export RTE_SDK=/path/to/rte_sdk
-        cd ${RTE_SDK}/examples/vhost
+        cd ${RTE_SDK}/examples/vhost/build/app
 
 #.  Run the vhost-switch sample code:
 
@@ -386,18 +386,25 @@ Running the Sample Code
 
     .. code-block:: console
 
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+        ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+         -- -p 0x1 --dev-basename usvhost
 
     vhost user: a socket file named usvhost will be created under current directory. Use its path as the socket path in guest's qemu commandline.
 
     .. code-block:: console
 
-        user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+        ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+         -- -p 0x1 --dev-basename usvhost
 
 .. note::
 
     Please note the huge-dir parameter instructs the DPDK to allocate its memory from the 2 MB page hugetlbfs.
 
+.. note::
+
+    The number used with the --socket-mem parameter may need to be more than 1024.
+    The number required depends on the number of mbufs allocated by vhost-switch.
+
 Parameters
 ~~~~~~~~~~
 
@@ -411,7 +418,8 @@ For compatibility with the QEMU wrapper script, a base name of "usvhost" should
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- -p 0x1 --dev-basename usvhost
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- -p 0x1 --dev-basename usvhost
 
 **vm2vm.**
 The vm2vm parameter disable/set mode of packet switching between guests in the host.
@@ -424,7 +432,8 @@ which bases on the packet destination MAC address and VLAN tag.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --vm2vm [0,1,2]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --vm2vm [0,1,2]
 
 **Mergeable Buffers.**
 The mergeable buffers parameter controls how virtio-net descriptors are used for virtio-net headers.
@@ -434,7 +443,8 @@ The default value is 0 or disabled since recent kernels virtio-net drivers show
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --mergeable [0,1]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --mergeable [0,1]
 
 **Stats.**
 The stats parameter controls the printing of virtio-net device statistics.
@@ -442,7 +452,8 @@ The parameter specifies an interval second to print statistics, with an interval
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --stats [0,n]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+    -- --stats [0,n]
 
 **RX Retry.**
 The rx-retry option enables/disables enqueue retries when the guests RX queue is full.
@@ -452,7 +463,8 @@ This option is enabled by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --rx-retry [0,1]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --rx-retry [0,1]
 
 **RX Retry Number.**
 The rx-retry-num option specifies the number of retries on an RX burst,
@@ -461,7 +473,8 @@ The default value is 4.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --rx-retry 1 --rx-retry-num 5
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --rx-retry 1 --rx-retry-num 5
 
 **RX Retry Delay Time.**
 The rx-retry-delay option specifies the timeout (in micro seconds) between retries on an RX burst,
@@ -470,7 +483,8 @@ The default value is 15.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir / mnt/huge -- --rx-retry 1 --rx-retry-delay 20
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --rx-retry 1 --rx-retry-delay 20
 
 **Zero copy.**
 The zero copy option enables/disables the zero copy mode for RX/TX packet,
@@ -481,7 +495,8 @@ This option is disabled by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --zero-copy [0,1]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --zero-copy [0,1]
 
 **RX descriptor number.**
 The RX descriptor number option specify the Ethernet RX descriptor number,
@@ -494,7 +509,8 @@ So it is valid only in zero copy mode is enabled. The value is 32 by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --zero-copy 1 --rx-desc-num [0, n]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --zero-copy 1 --rx-desc-num [0, n]
 
 **TX descriptor number.**
 The TX descriptor number option specify the Ethernet TX descriptor number, it is valid only in zero copy mode is enabled.
@@ -502,7 +518,8 @@ The value is 64 by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --zero-copy 1 --tx-desc-num [0, n]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --zero-copy 1 --tx-desc-num [0, n]
 
 **VLAN strip.**
 The VLAN strip option enable/disable the VLAN strip on host, if disabled, the guest will receive the packets with VLAN tag.
@@ -510,7 +527,8 @@ It is enabled by default.
 
 .. code-block:: console
 
-    user@target:~$ ./build/app/vhost-switch -c f -n 4 --huge-dir /mnt/huge -- --vlan-strip [0, 1]
+    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
+     -- --vlan-strip [0, 1]
 
 Running the Virtual Machine (QEMU)
 ----------------------------------
@@ -521,25 +539,28 @@ QEMU must be executed with specific parameters to:
 
     .. code-block:: console
 
-        user@target:~$ qemu-system-x86_64 ... -device virtio-net-pci,netdev=hostnet1,id=net1 ...
+        qemu-system-x86_64 ... -device virtio-net-pci,netdev=hostnet1, \
+        id=net1 ...
 
 *   Ensure the guest's virtio-net network adapter is configured with offloads disabled.
 
     .. code-block:: console
 
-        user@target:~$ qemu-system-x86_64 ... -device virtio-net-pci,netdev=hostnet1,id=net1,csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off
+        qemu-system-x86_64 ... -device virtio-net-pci,netdev=hostnet1, \
+        id=net1, csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off
 
 *   Redirect QEMU to communicate with the DPDK vhost-net sample code in place of the vhost-net kernel module(vhost cuse).
 
     .. code-block:: console
 
-        user@target:~$ qemu-system-x86_64 ... -netdev tap,id=hostnet1,vhost=on,vhostfd=<open fd> ...
+        qemu-system-x86_64 ... -netdev tap,id=hostnet1,vhost=on, \
+        vhostfd=<open fd> ...
 
 *   Enable the vhost-net sample code to map the VM's memory into its own process address space.
 
     .. code-block:: console
 
-        user@target:~$ qemu-system-x86_64 ... -mem-prealloc -mem-path / dev/hugepages ...
+        qemu-system-x86_64 ... -mem-prealloc -mem-path /dev/hugepages ...
 
 .. note::
 
@@ -556,7 +577,9 @@ an open file descriptor must be passed to QEMU running as a child process.
 
     #!/usr/bin/python
     fd = os.open("/dev/usvhost-1", os.O_RDWR)
-    subprocess.call("qemu-system-x86_64 ... . -netdev tap,id=vhostnet0,vhost=on,vhostfd=" + fd +"...", shell=True)
+    subprocess.call
+    ("qemu-system-x86_64 ... -netdev tap,id=vhostnet0,vhost=on,vhostfd="
+      + fd +"...", shell=True)
 
 .. note::
 
@@ -573,12 +596,13 @@ In this case, the path passed to the guest should be that of the 1 GB page huget
 
 .. code-block:: console
 
-    user@target:~$ qemu-system-x86_64 ... -mem-prealloc -mem-path / dev/hugepages ...
+    qemu-system-x86_64 ... -mem-prealloc -mem-path /dev/hugepages ...
 
 .. note::
 
     This process is automated in the QEMU wrapper script discussed in Section 24.7.3.
-    The following two sections only applies to vhost cuse. For vhost-user, please make corresponding changes to qemu-wrapper script and guest XML file.
+    The following two sections only applies to vhost cuse.
+    For vhost-user, please make corresponding changes to qemu-wrapper script and guest XML file.
 
 QEMU Wrapper Script
 ~~~~~~~~~~~~~~~~~~~
@@ -599,16 +623,22 @@ The QEMU wrapper script will automatically configure calls to QEMU:
 
 .. code-block:: console
 
-    user@target:~$ qemu-wrap.py -machine pc-i440fx-1.4,accel=kvm,usb=off -cpu SandyBridge -smp 4,sockets=4,cores=1,threads=1
-    -netdev tap,id=hostnet1,vhost=on -device virtio-net-pci,netdev=hostnet1,id=net1 -hda <disk img> -m 4096
+    qemu-wrap.py -machine pc-i440fx-1.4,accel=kvm,usb=off \
+    -cpu SandyBridge -smp 4,sockets=4,cores=1,threads=1 \
+    -netdev tap,id=hostnet1,vhost=on \
+    -device virtio-net-pci,netdev=hostnet1,id=net1 \
+    -hda <disk img> -m 4096
 
 which will become the following call to QEMU:
 
 .. code-block:: console
 
-    /usr/local/bin/qemu-system-x86_64 -machine pc-i440fx-1.4,accel=kvm,usb=off -cpu SandyBridge -smp 4,sockets=4,cores=1,threads=1
-    -netdev tap,id=hostnet1,vhost=on,vhostfd=<open fd> -device virtio-net-pci,netdev=hostnet1,id=net1,
-    csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off -hda <disk img> -m 4096 -mem-path /dev/hugepages -mem-prealloc
+    qemu-system-x86_64 -machine pc-i440fx-1.4,accel=kvm,usb=off \
+    -cpu SandyBridge -smp 4,sockets=4,cores=1,threads=1 \
+    -netdev tap,id=hostnet1,vhost=on,vhostfd=<open fd> \
+    -device virtio-net-pci,netdev=hostnet1,id=net1, \
+    csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off \
+    -hda <disk img> -m 4096 -mem-path /dev/hugepages -mem-prealloc
 
 Libvirt Integration
 ~~~~~~~~~~~~~~~~~~~
@@ -660,8 +690,8 @@ To call the QEMU wrapper automatically from libvirt, the following configuration
 
     .. code-block:: console
 
-        user@target:~$ mkdir /dev/cgroup
-        user@target:~$ mount -t cgroup none /dev/cgroup -o devices
+        mkdir /dev/cgroup
+        mount -t cgroup none /dev/cgroup -o devices
 
 *   Restart the libvirtd system process
 
@@ -771,21 +801,25 @@ Run the testpmd application as follows:
 
 .. code-block:: console
 
-    user@target:~$ x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -- n 4 -socket-mem 128 -- --burst=64 -i
+    cd ${RTE_SDK}/x86_64-native-linuxapp-gcc/app
+    ./testpmd -c 0x3 -n 4 --socket-mem 512 \
+    -- --burst=64 --i --disable-hw-vlan-filter
 
 The destination MAC address for packets transmitted on each port can be set at the command line:
 
 .. code-block:: console
 
-    user@target:~$ x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -- n 4 -socket-mem 128 -- --burst=64 -i --eth- peer=0,aa:bb:cc:dd:ee:ff --eth-peer=1,ff,ee,dd,cc,bb,aa
+    ./testpmd -c 0x3 -n 4 --socket-mem 512 \
+    -- --burst=64 --i --disable-hw-vlan-filter \
+    --eth-peer=0,aa:bb:cc:dd:ee:ff --eth-peer=1,ff:ee:dd:cc:bb:aa
 
 *   Packets received on port 1 will be forwarded on port 0 to MAC address
 
-    aa:bb:cc:dd:ee:ff.
+    aa:bb:cc:dd:ee:ff
 
 *   Packets received on port 0 will be forwarded on port 1 to MAC address
 
-    ff,ee,dd,cc,bb,aa.
+    ff:ee:dd:cc:bb:aa
 
 The testpmd application can then be configured to act as an L2 forwarding application:
 
Signature · 1 line
2.6.3
#15 lore raw

2015-12-10 11:23, Bernard Iremonger:

Quoted 22 lines

Fix typos in sample console commands.

Add --socket-mem 1024 to vhost-switch command lines. Without the --socket-mem parameter all hugepages will be allocated to vhost-switch, leaving no memory for the VM.

Add --disable-hw-vlan-filter parameter to testpmd command lines. Without this parameter testpmd fails on startup in the VM.

Increase value of --sock-mem parameter to testpmd as original value was too small.

changes in v3:
rebase
update commit message.
add note regarding --socket-mem parameter used with the vhost-switch program.

changes in v2:
remove "user@target:~$" prefixes in command lines. use continuation character to stay within 80 character limit. wrap sample python code.

Quoted 4 lines
Fixes d0dff9ba445e ("doc: sample application user guide"
Fixes 9bc23cb8209c ("doc: add vhost-user to sample guide")
Fixes 43866bf71d58 ("doc: fix vhost sample parameter")

Applied, thanks