# Netmap issue (setting txring->cur)



## Geen (Dec 30, 2013)

I am trying to get the Netmap examples to work supplied with FreeBSD 10RC3 on 2 guest VMs (on single host). Netmap enabled, kernel recompiled and sample code compiled. So far so good, but there seems a 50% packet loss. For example, if I use the following commands:

On virtual machine 1 (TX): 
`$ ./pkt_gen -i em1 -f tx -n 100`
It reports:

```
...
main_thread [1333] 95 pps (100 pkts in 1049543 usec)
Sent 100 packets, 60 bytes each, in 0.00 seconds.
...
```

On virtual machine 2 (RX):
`$ ./pkt_gen -i em1 -f rx`
It reports:

```
...
main_thread [1333] 49 pps (50 pkts in 1024204 usec)
Received 50 packets, in -1388442593.30 seconds.
...
```

Although unlikely at first, the problem resided at the sending side. The receiving VM did receive only 50 packets where the sending VM reported 100 packets sent. The packets were put in the buffers in shared memory but only the first 50 seemed to be put on the wire. As such I have played around with the source code and changed line 631 as follows:


```
ring->cur = cur;   to    ring->cur = cur + sent;
```

This seems to fool the Netmap device somehow that it actually transmits all 100 packets instead of the initial 50. Not sure where the problem lies, whether it is specific to the VMs or Netmap NIC drivers. Hope someone will be able to assist me in pinpointing this as it may be a bug in the Netmap kernel code...

Regards


----------



## Geen (Dec 31, 2013)

Solved the issue... it seemed I used the wrong (older) header netmap header files from an example download instead of the header files that came with FreeBSD 10RC3. It works now without packet loss, for my deployment for lower throughput (up to ~200Kpps) on the virtual machines.


----------

