Mauro Carvalho Chehab | 883780a | 2020-05-01 16:44:27 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | |
| 3 | ============================- |
| 4 | X.25 Device Driver Interface |
| 5 | ============================- |
| 6 | |
| 7 | Version 1.1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | |
| 9 | Jonathan Naylor 26.12.96 |
| 10 | |
| 11 | This is a description of the messages to be passed between the X.25 Packet |
| 12 | Layer and the X.25 device driver. They are designed to allow for the easy |
| 13 | setting of the LAPB mode from within the Packet Layer. |
| 14 | |
| 15 | The X.25 device driver will be coded normally as per the Linux device driver |
| 16 | standards. Most X.25 device drivers will be moderately similar to the |
| 17 | already existing Ethernet device drivers. However unlike those drivers, the |
| 18 | X.25 device driver has a state associated with it, and this information |
| 19 | needs to be passed to and from the Packet Layer for proper operation. |
| 20 | |
| 21 | All messages are held in sk_buff's just like real data to be transmitted |
| 22 | over the LAPB link. The first byte of the skbuff indicates the meaning of |
| 23 | the rest of the skbuff, if any more information does exist. |
| 24 | |
| 25 | |
| 26 | Packet Layer to Device Driver |
| 27 | ----------------------------- |
| 28 | |
andrew hendry | e904f0a | 2010-04-19 13:30:36 +0000 | [diff] [blame] | 29 | First Byte = 0x00 (X25_IFACE_DATA) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | |
| 31 | This indicates that the rest of the skbuff contains data to be transmitted |
| 32 | over the LAPB link. The LAPB link should already exist before any data is |
| 33 | passed down. |
| 34 | |
andrew hendry | e904f0a | 2010-04-19 13:30:36 +0000 | [diff] [blame] | 35 | First Byte = 0x01 (X25_IFACE_CONNECT) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | Establish the LAPB link. If the link is already established then the connect |
| 38 | confirmation message should be returned as soon as possible. |
| 39 | |
andrew hendry | e904f0a | 2010-04-19 13:30:36 +0000 | [diff] [blame] | 40 | First Byte = 0x02 (X25_IFACE_DISCONNECT) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
| 42 | Terminate the LAPB link. If it is already disconnected then the disconnect |
| 43 | confirmation message should be returned as soon as possible. |
| 44 | |
andrew hendry | e904f0a | 2010-04-19 13:30:36 +0000 | [diff] [blame] | 45 | First Byte = 0x03 (X25_IFACE_PARAMS) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
| 47 | LAPB parameters. To be defined. |
| 48 | |
| 49 | |
| 50 | Device Driver to Packet Layer |
| 51 | ----------------------------- |
| 52 | |
andrew hendry | e904f0a | 2010-04-19 13:30:36 +0000 | [diff] [blame] | 53 | First Byte = 0x00 (X25_IFACE_DATA) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
| 55 | This indicates that the rest of the skbuff contains data that has been |
| 56 | received over the LAPB link. |
| 57 | |
andrew hendry | e904f0a | 2010-04-19 13:30:36 +0000 | [diff] [blame] | 58 | First Byte = 0x01 (X25_IFACE_CONNECT) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
| 60 | LAPB link has been established. The same message is used for both a LAPB |
| 61 | link connect_confirmation and a connect_indication. |
| 62 | |
andrew hendry | e904f0a | 2010-04-19 13:30:36 +0000 | [diff] [blame] | 63 | First Byte = 0x02 (X25_IFACE_DISCONNECT) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
| 65 | LAPB link has been terminated. This same message is used for both a LAPB |
| 66 | link disconnect_confirmation and a disconnect_indication. |
| 67 | |
andrew hendry | e904f0a | 2010-04-19 13:30:36 +0000 | [diff] [blame] | 68 | First Byte = 0x03 (X25_IFACE_PARAMS) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
| 70 | LAPB parameters. To be defined. |
| 71 | |
| 72 | |
Xie He | 514e115 | 2021-04-02 02:30:00 -0700 | [diff] [blame] | 73 | Requirements for the device driver |
| 74 | ---------------------------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
Xie He | 514e115 | 2021-04-02 02:30:00 -0700 | [diff] [blame] | 76 | Packets should not be reordered or dropped when delivering between the |
| 77 | Packet Layer and the device driver. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
Xie He | 514e115 | 2021-04-02 02:30:00 -0700 | [diff] [blame] | 79 | To avoid packets from being reordered or dropped when delivering from |
| 80 | the device driver to the Packet Layer, the device driver should not |
| 81 | call "netif_rx" to deliver the received packets. Instead, it should |
| 82 | call "netif_receive_skb_core" from softirq context to deliver them. |