tcp_zerocopy_small.pkt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // SPDX-License-Identifier: GPL-2.0
  2. // small packet zerocopy test:
  3. //
  4. // verify that SO_EE_CODE_ZEROCOPY_COPIED is set on zerocopy
  5. // packets of all sizes, including the smallest payload, 1B.
  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. // send 1B
  18. +0 send(4, ..., 1, MSG_ZEROCOPY) = 1
  19. +0 > P. 1:2(1) ack 1
  20. +0 < . 1:1(0) ack 2 win 257
  21. +1 recvmsg(4, {msg_name(...)=...,
  22. msg_iov(1)=[{...,0}],
  23. msg_flags=MSG_ERRQUEUE,
  24. msg_control=[
  25. {cmsg_level=CMSG_LEVEL_IP,
  26. cmsg_type=CMSG_TYPE_RECVERR,
  27. cmsg_data={ee_errno=0,
  28. ee_origin=SO_EE_ORIGIN_ZEROCOPY,
  29. ee_type=0,
  30. ee_code=SO_EE_CODE_ZEROCOPY_COPIED,
  31. ee_info=0,
  32. ee_data=0}}
  33. ]}, MSG_ERRQUEUE) = 0
  34. // send 1B again
  35. +0 send(4, ..., 1, MSG_ZEROCOPY) = 1
  36. +0 > P. 2:3(1) ack 1
  37. +0 < . 1:1(0) ack 3 win 257
  38. +1 recvmsg(4, {msg_name(...)=...,
  39. msg_iov(1)=[{...,0}],
  40. msg_flags=MSG_ERRQUEUE,
  41. msg_control=[
  42. {cmsg_level=CMSG_LEVEL_IP,
  43. cmsg_type=CMSG_TYPE_RECVERR,
  44. cmsg_data={ee_errno=0,
  45. ee_origin=SO_EE_ORIGIN_ZEROCOPY,
  46. ee_type=0,
  47. ee_code=SO_EE_CODE_ZEROCOPY_COPIED,
  48. ee_info=1,
  49. ee_data=1}}
  50. ]}, MSG_ERRQUEUE) = 0