luigirizzo / netmap

Automatically exported from code.google.com/p/netmap
BSD 2-Clause "Simplified" License
1.86k stars 537 forks source link

Is buf returned by nm_nextpkt() safe? #254

Closed WumpusJia closed 7 years ago

WumpusJia commented 7 years ago

If consume_pkt(buf, h->len) takes long time,will data in buf be changed by kernel or something? Is there need to copy?

vmaffione commented 7 years ago

No. Netmap kernel module only accesses netmap rings in the context of poll() or ioctl() system calls. Only buffers that the application has released (increasing ring->head) can be rewritten, and this happens after a poll() or ioctl() system call.

Please read the netmap manual and/or papers, this basic contract between applications and kernel is clearly explained.

2016-11-26 17:46 GMT+01:00 Wumpus notifications@github.com:

If consume_pkt(buf, h->len) takes long time,will data in buf be changed by kernel or something? Is there need to copy?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/luigirizzo/netmap/issues/254, or mute the thread https://github.com/notifications/unsubscribe-auth/AEsSwTIvbAmnz2PuG6Nncts31RgsMXMhks5rCGJhgaJpZM4K877W .

-- Vincenzo Maffione