tcp_zerocopy_basic.pkt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // SPDX-License-Identifier: GPL-2.0
  2. // basic zerocopy test:
  3. //
  4. // send a packet with MSG_ZEROCOPY and receive the notification ID
  5. // repeat and verify IDs are consecutive
  6. --send_omit_free // do not reuse send buffers with zerocopy
  7. `./defaults.sh`
  8. 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
  9. +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
  10. +0 setsockopt(3, SOL_SOCKET, SO_ZEROCOPY, [1], 4) = 0
  11. +0 bind(3, ..., ...) = 0
  12. +0 listen(3, 1) = 0
  13. +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
  14. +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
  15. +0 < . 1:1(0) ack 1 win 257
  16. +0 accept(3, ..., ...) = 4
  17. +0 send(4, ..., 4000, MSG_ZEROCOPY) = 4000
  18. +0 > P. 1:4001(4000) ack 1
  19. +0 < . 1:1(0) ack 4001 win 257
  20. +0 recvmsg(4, {msg_name(...)=...,
  21. msg_iov(1)=[{...,0}],
  22. msg_flags=MSG_ERRQUEUE,
  23. msg_control=[
  24. {cmsg_level=CMSG_LEVEL_IP,
  25. cmsg_type=CMSG_TYPE_RECVERR,
  26. cmsg_data={ee_errno=0,
  27. ee_origin=SO_EE_ORIGIN_ZEROCOPY,
  28. ee_type=0,
  29. ee_code=SO_EE_CODE_ZEROCOPY_COPIED,
  30. ee_info=0,
  31. ee_data=0}}
  32. ]}, MSG_ERRQUEUE) = 0
  33. +0 send(4, ..., 4000, MSG_ZEROCOPY) = 4000
  34. +0 > P. 4001:8001(4000) ack 1
  35. +0 < . 1:1(0) ack 8001 win 257
  36. +0 recvmsg(4, {msg_name(...)=...,
  37. msg_iov(1)=[{...,0}],
  38. msg_flags=MSG_ERRQUEUE,
  39. msg_control=[
  40. {cmsg_level=CMSG_LEVEL_IP,
  41. cmsg_type=CMSG_TYPE_RECVERR,
  42. cmsg_data={ee_errno=0,
  43. ee_origin=SO_EE_ORIGIN_ZEROCOPY,
  44. ee_type=0,
  45. ee_code=SO_EE_CODE_ZEROCOPY_COPIED,
  46. ee_info=1,
  47. ee_data=1}}
  48. ]}, MSG_ERRQUEUE) = 0