-
Notifications
You must be signed in to change notification settings - Fork 5
Dong-Wang/uio_reg
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is simple tool to access a PCIe device's MMIO register. Why I wrote this tool? I was a FPGA engineer working on a SmartNIC project, we need debug it in user space with UIO/igb_uio. Though DPDK have a test application named "testpmd", it is too big and complex to use for a FPGA engineer. So I wrote an applicaton without DPDK library to debug my SmartNIC, e.g. read queue index, module state and packet statistics register. Now I find it also can be used for normal FPGA Add-In card test and debug. I plan to add a kernel module to instead igb_uio which comes from DPDK (of course, will refer to igb_uio and uio_reg still can be used with igb_uio). HOWTO Step 1 COMPILE SOURCE CODE dong@W530:~/work/uio_reg/src/uio_reg$ make gcc -g -Wall -c uio_reg.c gcc -g -Wall uio_reg.o -o uio_reg dong@W530:~/work/uio_reg/src/uio_reg$ ls Makefile uio_reg uio_reg.c uio_reg.o Step 2 RUN The PCIe device is 82579 NIC. We can verify the application by access ethernet address register (RAL and RAH). dong@W530:~/work/dpdk/tags/dpdk-17.08$ lspci | grep -i eth 00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04) dong@W530:~/work/uio_reg/src$ sudo ./uio_reg -s 0000:00:19.0 -b 0 -r 0x5400 4 READ, offset [0x00005400], count [4], BAR number [0], BDF [0000:00:19.0]. OFFSET VALUE 0x00005400 0x540E973C 0x00005404 0x8000CC5C 0x00005408 0x00000000 0x0000540C 0x00000000 dong@W530:~/work/uio_reg/src$ sudo ./uio_reg -s 0000:00:19.0 -b 0 -w 0x5408 0x12345678 WRITE, offset [0x00005408], value [0x12345678], BAR number [0], BDF [0000:00:19.0]. dong@W530:~/work/uio_reg/src$ sudo ./uio_reg -s 00:19.0 -b 0 -r 0x5400 4 READ, offset [0x00005400], count [4], BAR number [0], BDF [00:19.0]. OFFSET VALUE 0x00005400 0x540E973C 0x00005404 0x8000CC5C 0x00005408 0x12345678 0x0000540C 0x00000000 dong@W530:~/work/uio_reg/src$ sudo ./uio_reg -s 00:19.0 -b 0 -w 0x540C 0xaaaabbbb \WRITE, offset [0x0000540C], value [0xAAAABBBB], BAR number [0], BDF [00:19.0]. dong@W530:~/work/uio_reg/src$ sudo ./uio_reg -s 00:19.0 -b 0 -r 0x5400 4 READ, offset [0x00005400], count [4], BAR number [0], BDF [00:19.0]. OFFSET VALUE 0x00005400 0x540E973C 0x00005404 0x8000CC5C 0x00005408 0x12345678 0x0000540C 0x0000BBBB [VERIFY]We load the native driver to 82579, then read the ethernet address: dong@W530:~/work/uio_reg$ ifconfig enp0s25 enp0s25 Link encap:Ethernet HWaddr 3c:97:0e:54:5c:cc UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:20 Memory:f3a00000-f3a20000 The ethernet address which read by uio_reg is right. Also, you can validate uio_reg with Intel 82599/X550 series NIC and 710 series NIC. Table 1 MAC Address Register List +------------+------------------+------------------+ | | MAC Address Low | MAC Address High | +------------+------------------+------------------+ | 82579 | BAR0, 0x00005400 | BAR0, 0x00005400 | +------------+------------------+------------------+ | 82599/X550 | BAR0, 0x0000A200 | BAR0, 0x0000A204 | +------------+------------------+------------------+ | 710 | BAR0, 0x001E2120 | BAR0, 0x001E2140 | +------------+------------------+------------------+
About
A simple tool to access MMIO register of a PCIe device which is using UIO module.
Resources
Stars
Watchers
Forks
Packages 0
No packages published