MACsec Intel® FPGA System Design User Guide

ID 767516
Date 3/31/2024
Public
Document Table of Contents

7.10. Building, Installing, and Running the Software

The building of the repository produces a set of application/drivers that need to be loaded (or linked to) from the application. Perform the following steps to build and install the software:
  1. Log in as Super User.

    Run the command below:

    -- sudo -s

  2. Install the dependent packages.

    To Install the dependencies for drivers built on the platform Ubuntu 22.04-48-generic, run the commands below:

    Note:
    Make sure the kernel version is 5.15.0-48-generic. Also make sure that your yum the repository proxy, the environment proxies are set properly, and you have the sudo access.
    -- sudo apt install -y build-essential libpython3-dev libdbus-1-dev 
    -- sudo apt-get -y install dbus libdbus-1-dev libdbus-glib-1-2 libdbus-glib-1-dev
    -- sudo apt-get install -y libnl-route-3-dev 
    -- sudo apt install libelf-dev
    -- apt install openssh-server -y
    -- sudo apt-get install libnl-genl-3-dev
  3. Build all applications and drivers.

    Run the command below:

    -- ./build.sh all
    1. Get the MCDMA module.

      Run the command below:

      -- git submodule update –init

    2. Build all applications and drivers.
      Note: All drivers/applications are copied to the binaries folder. To build only the required drivers/applications, refer to the app folders for patches and build scripts.

      Run the command below:

      -- ./build.sh all

      In addition to the above, you can do the following to build binaries separately and they are copied to the binaries folder:

      -- ./build.sh iptool

      -- ./build.sh wpa_supplicant

      -- ./build.sh linux_macsec

      -- ./build.sh ipdriver

      -- ./build.sh mcdma

    3. Build individual applications and drivers.
      1. To build the MCDSM driver, run the commands below, which build the MCDM and the MACsec IP source code:

        -- cd mcdma/driver/kmod/mcdma-netdev-driver/

        -- make clean all

      2. To build the Linux MACsec driver, run the commands below:

        -- cd linux_macsec/

        -- ./linux_macsec_build.sh

      3. To build IProute2 – iptool application, run the commands below:

        -- cd iptool/

        -- ./iptool_build.sh

      4. To build the wpa_supplicant application, run the commands below:

        -- cd wpa_supplicant/

        -- ./build_wpa.sh

      5. To build the CLI tool, run the commands below:

        -- cd cli/

        -- make clean all

      6. To build the MACsec IP driver code used for the HPS based design, run the command below from the base folder to create the MACsec IP driver:

        -- make clean all

    4. Install the drivers.
      1. MCDMA + MACsec IP driver.

        Run the command below:

        -- cd binaries

        Copy the pf_test.sh file to the binaries from the wpa_supplicant directory. Run the pf_test.sh file to insert and create 2 name-spaces as "ns0" and "ns1". Two MACsec IPs are present in the example design of the HW. So 2 name-spaces are created.

        Run the commands below to login to name-spaces:

        -- ip netns exec ns0 bash

        -- ip netns exec ns1 bash

      2. Linux MACsec driver.

        After compiling/building, run the command below to insert the module:

        -- insmod macsec.ko

      3. Run the CLI tool.

        Run the command below to list the supported parameters:

        -- ./cli_macsec -h

      4. Run the IP tool app.

        The IP tool is an ip-macsec reference application.

        Make sure the [Linux MACsec driver](#42-linux-macsec-driver) is inserted before proceeding.
        1. To configure the MACsec IP from iptool:

          a. Run the command below to log in to "ns0":

          -- ip netns exec ns0 bash

          Below are some example `ip` commands to configure `ifc_mcdma0` for the `macsec0` interface:

          -- ./ip link add link ifc_mcdma0 macsec0 type macsec address 6e:ed:32:da:fe:4b port 0 encrypt off offload mac
          -- ./ip macsec add macsec0 tx sa 0 sc 0 on pn 1 key 01 ABCD1234567891011121314151617181
          -- ./ip macsec add macsec0 rx port 0 address 96:2d:5a:25:ac:ae on
          -- ./ip macsec add macsec0 rx address 96:2d:5a:25:ac:ae port 0 sa 0 sc 0 pn 1 on key 01 ABCD1234567891011121314151617181

          b. Run the command below to log in to "ns1":

          -- ip netns exec ns1 bash

          Below are some example `ip` commands to configure `ifc_mcdma1` for the `macsec1` interface:

          -- ./ip link add link ifc_mcdma1 macsec0 type macsec address 96:2d:5a:25:ac:ae port 0 encrypt off offload mac
          -- ./ip macsec add macsec0 tx sa 0 sc 0 on pn 1 key 01 ABCD1234567891011121314151617181
          -- ./ip macsec add macsec0 rx port 0 address 6e:ed:32:da:fe:4b on
          -- ./ip macsec add macsec0 rx address 6e:ed:32:da:fe:4b port 0 sa 0 sc 0 pn 1 on key 01 ABCD1234567891011121314151617181
        2. Follow these steps to initiate traffic via the CLI tool after configuring using the ip tool:

          a. Run the command below to check the HSSI status (Read data should be 0x1E):

          --./cli_macsec ppbb_reg_read -d ifc_mcdma0 -i 0 -o 0x0054 -r

          b. Run the command below to configure the number of packets to be transmitted:

          --./cli_macsec ppbb_reg_write -d ifc_mcdma0 -i 0 -o 0x001c -w 0x00000400

          c. Run the command below to configure the packet size (min size in [13:0], max size in [29:16]):

          --./cli_macsec ppbb_reg_write -d ifc_mcdma0 -i 0 -o 0x0020 -w 0x00500050

          d. Run the command below to start traffic in the dynamic mode:

          --./cli_macsec ppbb_reg_write -d ifc_mcdma0 -i 0 -o 0x0000 -w 0x00008611

          e. Run the command below to read the checker packet counter (wait for this counter to display equal packet number before proceeding to the next step):

          --./cli_macsec ppbb_reg_read -d ifc_mcdma0 -i 0 -o 0x005c -r

        3. To show the MACsec IP statistics, run the command below to login to the specific console, i.e. ns0 or ns1, to read out the statistics:

          --./ip -s macsec show

      5. Run the wpa_supplicant.

        The WPA is a MACsec MKA reference application.

        Follow these steps below:
        1. Insert the [McDMA+MACsec IP drivers](#41-mcdma--macsec-ip-driver).
        2. Insert the [Linux MACsec driver](#42-linux-macsec-driver).
        3. Run the wpa_supplicant.

          Below is an example:

          --./wpa_supplicant -i ifc_mcdma0 -Dmacsec_linux -c mka_default.conf

          Below are example steps to evaluate the wpa_supplicant, which needs three terminals in parallel.
          1. In the terminal window 1, do the following:

            a. Navigate to binaries folder.

            b. Log in to the ns0: ip netns exec ns0 bash.

            c. Execute this command: sh wpa_offload.sh.

          2. In the terminal window 2, do the following:

            a. Navigate to binaries folder.

            b. Log in to the ns1: ip netns exec ns1 bash.

            c. Execute this command: sh wpa_offload.sh1-+.

          3. In the terminal window 3, do the following:

            a. Navigate to binaries folder.

            b. Log in to the ns0: ip netns exec ns0 bash.

            c. Run the steps as in step IV-2 (initiate traffic via the CLI tool after configuring using the ip tool) above.

            For statistics, repeat step IV-3 (show the MACsec IP statistics) above.