Netmap test program exits with SIGSEGV

Hi all,

I am working on Gb packet capture interface development. I was setting up a netmap example and see how it works so that I can use it for my development. I don't know what I am doing wrong but the test code seems very straightforward. Please help me, what am I doing wrong?

Code:
# uname -i
FreeBSD 9.1
#ifconfig igb1
igb1: flags=c843<UP,BROADCAST,RUNNING,SIMPLEX,LINK2,MULTICAST> metric 0 mtu 1500
	options=401bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,VLAN_HWTSO>
	ether XX:15:17:XX:03:X1
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active

Attached is my test code and debug output. Any help will be greatly appreciated.

Cheers,
hmehta
 

Attachments

  • netmap_test.c
    1.2 KB · Views: 210
  • gdb_out.txt.txt
    1 KB · Views: 186
Hi,

Do you have /dev/netmap? You didn't check whether open function failed and if it failed then you should not continue the program because it may lead your program to segfault ;)
 
When you get the segfault, run bt in gdb to get a backtrace. If you haven't compiled with -g, then recompile with that flag and run it again. You can also run it with truss to see if any system calls fail.

Kevin Barry
 
steps to make netmap work

Thanks for the replies guys. Well I took some time and prolly probably many changes to make it work.
  1. The nm req structure has the requirement that version should be same as NETMAP_API when registering the interface. It needs to be documented somewhere, ideally I would like to see this check is implicit and done by the kernel internally rather than by user-supplied arugment argument.
  2. mmap: I was not setting the MAP_SHARED/MAP_PRIVATE flag. And as mmap was done for PROT_READ and PROT_WRITE I have to open /dev/netmap in O_RDWR mode., else mmap failure fails.
  3. /dev/netmap attributes: although ideally you should not require to be super user, but in some configuration I found this an issue. I am still investigating config differences.
  4. Most importantly, ring interface. Netmap doesn't document anywhere that packets are not captured only in one ring but is are load balanced by default. Basically you have to first get information by calling the netmap ioctl to get the available ring and every time you have to traverse through the ring. The reason is unclear to me. It makes sense if one ring is full and then you move to the next ring but it seems that even if the ring is not full it starts capturing packets in another ring, so basically you have to poll through the ring.

I am looking for some suggestion. Is there a way to fix rings for the netmap interface, this may help to localize/assign the ring/interface. And how did netmap gets RX and TX ring counts from the interface. When I do ifconfig igb1 I don't get the number of HW rings in the interface.

Thanks.
hm
 
Back
Top