# brick_utils **Repository Path**: brick.yang/brick_utils ## Basic Information - **Project Name**: brick_utils - **Description**: No description available - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 2 - **Created**: 2015-03-16 - **Last Updated**: 2026-03-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README === OVERVIEW === * mtool A tool for R/W memory with specified physical address. This is a pure user space application run in linux. * mdio_tool A tool for R/W MDIO/MII registers. * simplebits A simple ethernet tool for generate traffic. Core module run in linux kernel space. Control it with client. These are key features of it: - Base on standard linux kernel. - Realtime measure Tx/Rx throughput. - Flow control support. - Load/Save tx frames from pcap file. - Optimized driver for NXP DPAA and DPAA2 device. * pmu A tool for use performance monitor === HOW TO BUILD === * Build with Bmake 1. Ensure ncurses or ncursesw already installed in your OS. 2. Build kconfig frontend: $ make kconfig 3. Run mconf to generate config file: $ make mconf 4. Build project: $ make After build, you will find all binaries under "opt/" 5. For cross-compile, you need export these enviroment variables: CROSS_COMPILE - Cross compiler prefix CFLAGS - Extra compile flags LDFLAGS - Extra link flags KDIR - Directory that include linux kernel symbols ARCH - ARCH for build linux kernel module KCFLAGS - Extra compile flags for build linux module KBUILD_VERBOSE - Verbose for build for build linux module KBUILD_EXTRA_WARN - Extra warnings for build linux module PKG_CONFIG_LIBDIR - Pkgconf .pc files lookup directory PKG_CONFIG_SYSROOT_DIR - Pkgconf sysroot directory NOTE: The legacy Bmake is abandoned in the future. The build system will switch to meson/ninja. -------------------------------------------------------------------------------- * Build with meson/ninja, the meson version need 0.58.0 or above. 1. Ensure meson/ninja already installed in your OS. If the meson version is 0.58.0 below, you can install it via pip: $ pip install meson -I Install to user directory, don't forget to add the directory to PATH. $ pip install meson --user -I 2. Do setup for native build from specified configuration file: $ meson setup build/ --native-file=configs/default.cfg 3. Do setup for cross build from specified configuration file: Modify configs/project.cfg base on your project $ meson setup build/ --cross-file=configs/aarch64.cfg --cross-file=configs/default.cfg --cross-file=configs/project.cfg 4. Do build. $ meson compile -C build/ 5. Build kconfig and run menu based configuration: $ cd build/ $ ninja mconf 6. Re-configure the project with .config that generated by mconf and build: $ meson setup --reconfigure -Dmcfg=build/.config $ meson compile === HOW TO RUN === * mtool Run "mtool -h" to see help. -------------------------------------------------------------------------------- * mdio_tool Run "mdio_tool -h" to see help. -------------------------------------------------------------------------------- * simplebits 1. Insert simplebits.ko in target linux OS. $ insmod simplebits.ko 2. CLI connect with simplebits.ko with TCP/IP, config target IP and port: $ export SB_IP=: 3. View netdev list: $ sb_cli netdev 4. Config tx pkt pool size: $ sb_cli pool_sz 5. Config tx queue: $ sb_cli queue 6. Add pkts in pool: $ sb_cli add_pkt ... 7. Attach to the device: $ sb_cli attach 8. Start traffic on the device: $ sb_cli start 9. View statistics $ sb_cli stats 10. Flow control $ sb_cli fc === USE OPTIMIZED DRIVER === Now only NXP DPAA and DPAA2 device supported. Use optimized driver will get better performance than generic linux driver. * DPAA Download "dpaa_bind.sh" to your board, execute command "dpaa_bind.sh ". It will bind all objects that need. $ insmod sb_dpaa.ko * DPAA2 Download "dpaa2_bind.sh" to your board, execute command "dpaa2_bind.sh ". It will create DPRC and all objects that need. $ insmod sb_dpaa2.ko dprc=dprc.x === EXAMPLE === You can see some examples under "simplebits/example/" -------------------------------------------------------------------------------- * pmu === PMU FOR ARM64 === * Control and read counter via file under /proc/pmu/ /proc/pmu/cpu - RW. Current CPU /proc/pmu/info - RO. PMU information for current CPU /proc/pmu/evcnt_sel - RW. Event counter selection /proc/pmu/evcnt_type - RW. Event counter type configuration /proc/pmu/evcnt - RW. Event counter value /proc/pmu/evcnt_en - RW. Enable and disable event counter /proc/pmu/ccnt - RW. Cycle counter value /proc/pmu/ccnt_en - RW. Enable and disable cycle counter /proc/pmu/reset - WO. Reset PMU of all cores For prevent PMU used by perf event driver, add these parameters into cmdline: initcall_blacklist=armv8_pmu_driver_init cpuidle.off=1 nohlt=1 After login linux, execute this command to set cpufreq governor: $ cpufreq-set -g performance