x25-iface.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. X.25 Device Driver Interface 1.1
  2. Jonathan Naylor 26.12.96
  3. This is a description of the messages to be passed between the X.25 Packet
  4. Layer and the X.25 device driver. They are designed to allow for the easy
  5. setting of the LAPB mode from within the Packet Layer.
  6. The X.25 device driver will be coded normally as per the Linux device driver
  7. standards. Most X.25 device drivers will be moderately similar to the
  8. already existing Ethernet device drivers. However unlike those drivers, the
  9. X.25 device driver has a state associated with it, and this information
  10. needs to be passed to and from the Packet Layer for proper operation.
  11. All messages are held in sk_buff's just like real data to be transmitted
  12. over the LAPB link. The first byte of the skbuff indicates the meaning of
  13. the rest of the skbuff, if any more information does exist.
  14. Packet Layer to Device Driver
  15. -----------------------------
  16. First Byte = 0x00 (X25_IFACE_DATA)
  17. This indicates that the rest of the skbuff contains data to be transmitted
  18. over the LAPB link. The LAPB link should already exist before any data is
  19. passed down.
  20. First Byte = 0x01 (X25_IFACE_CONNECT)
  21. Establish the LAPB link. If the link is already established then the connect
  22. confirmation message should be returned as soon as possible.
  23. First Byte = 0x02 (X25_IFACE_DISCONNECT)
  24. Terminate the LAPB link. If it is already disconnected then the disconnect
  25. confirmation message should be returned as soon as possible.
  26. First Byte = 0x03 (X25_IFACE_PARAMS)
  27. LAPB parameters. To be defined.
  28. Device Driver to Packet Layer
  29. -----------------------------
  30. First Byte = 0x00 (X25_IFACE_DATA)
  31. This indicates that the rest of the skbuff contains data that has been
  32. received over the LAPB link.
  33. First Byte = 0x01 (X25_IFACE_CONNECT)
  34. LAPB link has been established. The same message is used for both a LAPB
  35. link connect_confirmation and a connect_indication.
  36. First Byte = 0x02 (X25_IFACE_DISCONNECT)
  37. LAPB link has been terminated. This same message is used for both a LAPB
  38. link disconnect_confirmation and a disconnect_indication.
  39. First Byte = 0x03 (X25_IFACE_PARAMS)
  40. LAPB parameters. To be defined.
  41. Possible Problems
  42. =================
  43. (Henner Eisen, 2000-10-28)
  44. The X.25 packet layer protocol depends on a reliable datalink service.
  45. The LAPB protocol provides such reliable service. But this reliability
  46. is not preserved by the Linux network device driver interface:
  47. - With Linux 2.4.x (and above) SMP kernels, packet ordering is not
  48. preserved. Even if a device driver calls netif_rx(skb1) and later
  49. netif_rx(skb2), skb2 might be delivered to the network layer
  50. earlier that skb1.
  51. - Data passed upstream by means of netif_rx() might be dropped by the
  52. kernel if the backlog queue is congested.
  53. The X.25 packet layer protocol will detect this and reset the virtual
  54. call in question. But many upper layer protocols are not designed to
  55. handle such N-Reset events gracefully. And frequent N-Reset events
  56. will always degrade performance.
  57. Thus, driver authors should make netif_rx() as reliable as possible:
  58. SMP re-ordering will not occur if the driver's interrupt handler is
  59. always executed on the same CPU. Thus,
  60. - Driver authors should use irq affinity for the interrupt handler.
  61. The probability of packet loss due to backlog congestion can be
  62. reduced by the following measures or a combination thereof:
  63. (1) Drivers for kernel versions 2.4.x and above should always check the
  64. return value of netif_rx(). If it returns NET_RX_DROP, the
  65. driver's LAPB protocol must not confirm reception of the frame
  66. to the peer.
  67. This will reliably suppress packet loss. The LAPB protocol will
  68. automatically cause the peer to re-transmit the dropped packet
  69. later.
  70. The lapb module interface was modified to support this. Its
  71. data_indication() method should now transparently pass the
  72. netif_rx() return value to the (lapb module) caller.
  73. (2) Drivers for kernel versions 2.2.x should always check the global
  74. variable netdev_dropping when a new frame is received. The driver
  75. should only call netif_rx() if netdev_dropping is zero. Otherwise
  76. the driver should not confirm delivery of the frame and drop it.
  77. Alternatively, the driver can queue the frame internally and call
  78. netif_rx() later when netif_dropping is 0 again. In that case, delivery
  79. confirmation should also be deferred such that the internal queue
  80. cannot grow to much.
  81. This will not reliably avoid packet loss, but the probability
  82. of packet loss in netif_rx() path will be significantly reduced.
  83. (3) Additionally, driver authors might consider to support
  84. CONFIG_NET_HW_FLOWCONTROL. This allows the driver to be woken up
  85. when a previously congested backlog queue becomes empty again.
  86. The driver could uses this for flow-controlling the peer by means
  87. of the LAPB protocol's flow-control service.