samples/drivers/ethernet/eth_ivshmem/README.html · samples/drivers/ethernet/eth_ivshmem/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Drivers · Ethernet

IVSHMEM Ethernet

QEMU Linux와 Zephyr cell을 구성해 ping과 TCP throughput을 양방향 검증합니다.

Official pathsamples/drivers/ethernet/eth_ivshmem/README.html
Source filesamples/drivers/ethernet/eth_ivshmem/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Jailhouse image build, cell load·start, ping과 zperf/iPerf 14개 명령·출력을 보존합니다.

Hypervisor

Jailhouse

Board

qemu_cortex_a53

Throughput

zperf · iPerf

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 A2D79270CE3493B8E14F9DBF973CBB8626FA70A5FBD9315274982F830D9D8AED
.. zephyr:code-sample:: eth-ivshmem
   :name: Inter-VM Shared Memory (ivshmem) Ethernet
   :relevant-api: ivshmem ethernet

   Communicate with another "cell" in the Jailhouse hypervisor using IVSHMEM Ethernet.

Overview
********

This application demonstrates how to use IVSHMEM Ethernet to communicate with
another "cell" in the Jailhouse hypervisor. Currently only the qemu_cortex_a53
board is supported.

Building Jailhouse Linux for QEMU
*********************************

Clone Jailhouse yocto project. At the time of writing, the "next" branch has
some fixes that are not yet on the "master" branch:

.. code-block:: console

    git clone https://github.com/siemens/jailhouse-images.git
    cd jailhouse-images
    git checkout origin/next

Open the menu, select "QEMU ARM64 virtual target" then "Save & Build"
(this will take a while):

.. code-block:: console

    ./kas-container menu

Edit "start-qemu.sh":
 * change ``-cpu cortex-a57`` -> ``-cpu cortex-a53``
   under the ``arm64|aarch64`` case
 * Enable SSH access by appending ``,hostfwd=tcp::2222-:22`` to
   ``-netdev user,id=net`` in the QEMU process arguments
   (2222 can be replaced with any unused port)

Start QEMU:

.. code-block:: console

    ./start-qemu.sh arm64

This should boot Linux and drop into a shell.

Build the Zephyr sample
***********************

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/ethernet/eth_ivshmem
   :board: qemu_cortex_a53
   :goals: build

Running the sample
******************

Copy the generated zephyr.bin to the Jailhouse Linux root cell:

.. code-block:: console

    scp -P 2222 path/to/zephyr.bin root@localhost:/root

Jailhouse has a prebuilt Zephyr cell configuration that works for
this sample "qemu-arm64-zephyr-demo".

Back in Jailhouse Linux shell, create the Zephyr cell:

.. code-block:: console

    jailhouse enable /etc/jailhouse/qemu-arm64.cell
    jailhouse console
    jailhouse cell create /etc/jailhouse/qemu-arm64-zephyr-demo.cell

You may see a quirk here where the Linux shell stops taking input...
If you get this, open a second shell via SSH:

.. code-block:: console

    ssh -p 2222 root@localhost

Load and start the Zephyr cell:

.. code-block:: console

    jailhouse cell load qemu-arm64-zephyr-demo zephyr.bin --address 0x70000000
    jailhouse cell start qemu-arm64-zephyr-demo

Now you can run Zephyr and Linux shell commands to communicate between
the cells.

Ping Linux from Zephyr
**********************

.. code-block:: console

    *** Booting Zephyr OS build v3.3.0-475-g45b9e84c6013 ***
    uart:~$ net ping 192.168.19.1
    PING 192.168.19.1
    28 bytes from 192.168.19.1 to 192.168.19.2: icmp_seq=1 ttl=64 time=5.06 ms
    28 bytes from 192.168.19.1 to 192.168.19.2: icmp_seq=2 ttl=64 time=7.99 ms
    28 bytes from 192.168.19.1 to 192.168.19.2: icmp_seq=3 ttl=64 time=1.77 ms

Ping Zephyr from Linux
**********************

.. code-block:: console

    root@demo:~# ping -c 3 192.168.19.2
    PING 192.168.19.2 (192.168.19.2) 56(84) bytes of data.
    64 bytes from 192.168.19.2: icmp_seq=1 ttl=64 time=0.646 ms
    64 bytes from 192.168.19.2: icmp_seq=2 ttl=64 time=1.45 ms
    64 bytes from 192.168.19.2: icmp_seq=3 ttl=64 time=1.28 ms

    --- 192.168.19.2 ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2006ms
    rtt min/avg/max/mdev = 0.646/1.124/1.450/0.345 ms

Run zperf / iPerf
*****************

:ref:`zperf` / iPerf can be used to perform network throughput measurements.

In Zephyr:

.. code-block:: console

    # Start zperf TCP server
    zperf tcp download 5001

In Linux:

.. code-block:: console

    # Install iPerf 2.0.5
    apt install wget
    wget https://iperf.fr/download/ubuntu/iperf_2.0.5+dfsg1-2_arm64.deb
    apt install ./iperf_2.0.5+dfsg1-2_arm64.deb
    rm iperf_2.0.5+dfsg1-2_arm64.deb

    # Connect iPerf TCP client
    iperf -l 1K -V -c 192.168.19.2 -p 5001

Zephyr output:

.. code-block:: console

    TCP server started on port 5001
    New TCP session started.
    TCP session ended
     Duration:              10.01 s
     rate:                  57.72 Mbps

Linux output:

.. code-block:: console

    ------------------------------------------------------------
    Client connecting to 192.168.19.2, TCP port 5001
    TCP window size: 85.0 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.19.1 port 58430 connected with 192.168.19.2 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0-10.0 sec  72.2 MBytes  60.6 Mbits/sec

Part 3

한국어 전문 번역

개요

이 application은 IVSHMEM Ethernet을 사용해 Jailhouse hypervisor의 다른 cell과 통신하는 방법을 보여줍니다. 현재는 qemu_cortex_a53 board만 지원합니다.

QEMU용 Jailhouse Linux Build

Jailhouse Yocto project를 clone합니다. 이 문서를 작성한 시점에는 next branch에 아직 master branch에 포함되지 않은 수정이 있습니다.

git clone https://github.com/siemens/jailhouse-images.git
cd jailhouse-images
git checkout origin/next

Menu를 열어 QEMU ARM64 virtual target을 선택한 뒤 Save & Build를 선택합니다. 이 작업에는 시간이 걸립니다.

./kas-container menu

start-qemu.sh를 다음과 같이 수정합니다.

  • arm64|aarch64 case에서 -cpu cortex-a57을 -cpu cortex-a53으로 바꿉니다.
  • QEMU process argument의 -netdev user,id=net에 ,hostfwd=tcp::2222-:22를 덧붙여 SSH 접근을 활성화합니다. 2222는 사용하지 않는 다른 port로 바꿀 수 있습니다.

QEMU를 시작합니다.

./start-qemu.sh arm64

Linux가 boot된 뒤 shell로 진입해야 합니다.

Zephyr Sample Build

# From the root of the zephyr repository
west build -b qemu_cortex_a53 samples/drivers/ethernet/eth_ivshmem

Sample 실행

생성된 zephyr.bin을 Jailhouse Linux root cell로 복사합니다.

scp -P 2222 path/to/zephyr.bin root@localhost:/root

Jailhouse에는 이 sample과 함께 동작하는 qemu-arm64-zephyr-demo Zephyr cell 구성이 미리 준비되어 있습니다.

Jailhouse Linux shell로 돌아가 Zephyr cell을 생성합니다.

jailhouse enable /etc/jailhouse/qemu-arm64.cell
jailhouse console
jailhouse cell create /etc/jailhouse/qemu-arm64-zephyr-demo.cell

여기서 Linux shell이 입력을 받지 않는 현상이 나타날 수 있습니다. 이 문제가 발생하면 SSH로 두 번째 shell을 여십시오.

ssh -p 2222 root@localhost

Zephyr cell을 load한 뒤 시작합니다.

jailhouse cell load qemu-arm64-zephyr-demo zephyr.bin --address 0x70000000
jailhouse cell start qemu-arm64-zephyr-demo

이제 Zephyr와 Linux shell 명령을 실행해 cell 사이에서 통신할 수 있습니다.

Zephyr에서 Linux로 Ping

*** Booting Zephyr OS build v3.3.0-475-g45b9e84c6013 ***
uart:~$ net ping 192.168.19.1
PING 192.168.19.1
28 bytes from 192.168.19.1 to 192.168.19.2: icmp_seq=1 ttl=64 time=5.06 ms
28 bytes from 192.168.19.1 to 192.168.19.2: icmp_seq=2 ttl=64 time=7.99 ms
28 bytes from 192.168.19.1 to 192.168.19.2: icmp_seq=3 ttl=64 time=1.77 ms

Linux에서 Zephyr로 Ping

root@demo:~# ping -c 3 192.168.19.2
PING 192.168.19.2 (192.168.19.2) 56(84) bytes of data.
64 bytes from 192.168.19.2: icmp_seq=1 ttl=64 time=0.646 ms
64 bytes from 192.168.19.2: icmp_seq=2 ttl=64 time=1.45 ms
64 bytes from 192.168.19.2: icmp_seq=3 ttl=64 time=1.28 ms

--- 192.168.19.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2006ms
rtt min/avg/max/mdev = 0.646/1.124/1.450/0.345 ms

zperf와 iPerf 실행

zperf와 iPerf를 사용해 network throughput을 측정할 수 있습니다.

Zephyr에서는 다음과 같이 zperf TCP server를 시작합니다.

# Start zperf TCP server
zperf tcp download 5001

Linux에서는 iPerf 2.0.5를 설치한 뒤 TCP client를 연결합니다.

# Install iPerf 2.0.5
apt install wget
wget https://iperf.fr/download/ubuntu/iperf_2.0.5+dfsg1-2_arm64.deb
apt install ./iperf_2.0.5+dfsg1-2_arm64.deb
rm iperf_2.0.5+dfsg1-2_arm64.deb

# Connect iPerf TCP client
iperf -l 1K -V -c 192.168.19.2 -p 5001

Zephyr 출력은 다음과 같습니다.

TCP server started on port 5001
New TCP session started.
TCP session ended
 Duration:              10.01 s
 rate:                  57.72 Mbps

Linux 출력은 다음과 같습니다.

------------------------------------------------------------
Client connecting to 192.168.19.2, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.19.1 port 58430 connected with 192.168.19.2 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  72.2 MBytes  60.6 Mbits/sec

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.