loopback 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. .TH LOOPBACK 3
  2. .SH NAME
  3. loopback \- network link simulation
  4. .SH SYNOPSIS
  5. .nf
  6. .B bind -a #X /net
  7. .BI /net/loopback n /[0-1]
  8. .BI /net/loopback n /[0-1]/data
  9. .BI /net/loopback n /[0-1]/ctl
  10. .BI /net/loopback n /[0-1]/status
  11. .BI /net/loopback n /[0-1]/stats
  12. .fi
  13. .SH DESCRIPTION
  14. The loopback interface,
  15. .BI /net/loopback n\f1,
  16. is a directory containing two subdirectories,
  17. one for each end of a simulated network link.
  18. The number
  19. .I n
  20. is the device number of the link, permitting multiple links to be used on a single machine.
  21. .PP
  22. Each directory contains files to control the associated connection,
  23. receive and send data,
  24. monitor the simulation parameters,
  25. and supply statistics.
  26. .PP
  27. The
  28. .B data
  29. files for the two directories are cross-connected.
  30. Writes to one are divided into packets of at most a certain size,
  31. typically 32768 bytes,
  32. written to a flow-controlled output queue,
  33. transferred across the link,
  34. and put into an input queue where it is readable from the other
  35. .B data
  36. file.
  37. .PP
  38. Options are set by writing to the
  39. .B ctl
  40. file for the receiving end of the link,
  41. and are reported in the same format by reading
  42. .BR status .
  43. The following options are supported.
  44. .TP
  45. .BI delay \ latency\ bytedelay
  46. Control the time a packet takes in the link.
  47. A packet
  48. .B n
  49. bytes long takes
  50. .I bytedelay
  51. .B *
  52. .B n
  53. nanoseconds to exit the output queue and
  54. is available for reading
  55. .I latency
  56. nanoseconds later.
  57. .TP
  58. .BI droprate \ n
  59. Randomly drop approximately one out of
  60. .B n
  61. packets.
  62. If zero drop no packets.
  63. .TP
  64. .BR indrop \ [01]
  65. Disallow or allow packets to be dropped if the input queue overflows.
  66. .TP
  67. .BI limit \ n
  68. Set the input and output queues to hold at most
  69. .I n
  70. bytes.
  71. .TP
  72. .B reset
  73. Clear all of the statistics recorded for the link.
  74. .PP
  75. Reading
  76. .B stats
  77. returns a list of 4 tagged numbers representing:
  78. .EX
  79. .ft 1
  80. packets sent to this receiver
  81. bytes sent to this receiver
  82. packets dropped due to droprate
  83. packets dropped due to input queue overflows
  84. .EE
  85. .SH SOURCE
  86. .B /sys/src/9/port/devloopback.c