diff options
Diffstat (limited to 'include/net/caif/caif_layer.h')
-rw-r--r-- | include/net/caif/caif_layer.h | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h index c8b07a904e78..35bc7883cf97 100644 --- a/include/net/caif/caif_layer.h +++ b/include/net/caif/caif_layer.h | |||
@@ -15,7 +15,6 @@ struct cfpktq; | |||
15 | struct caif_payload_info; | 15 | struct caif_payload_info; |
16 | struct caif_packet_funcs; | 16 | struct caif_packet_funcs; |
17 | 17 | ||
18 | |||
19 | #define CAIF_LAYER_NAME_SZ 16 | 18 | #define CAIF_LAYER_NAME_SZ 16 |
20 | 19 | ||
21 | /** | 20 | /** |
@@ -33,7 +32,6 @@ do { \ | |||
33 | } \ | 32 | } \ |
34 | } while (0) | 33 | } while (0) |
35 | 34 | ||
36 | |||
37 | /** | 35 | /** |
38 | * enum caif_ctrlcmd - CAIF Stack Control Signaling sent in layer.ctrlcmd(). | 36 | * enum caif_ctrlcmd - CAIF Stack Control Signaling sent in layer.ctrlcmd(). |
39 | * | 37 | * |
@@ -141,7 +139,7 @@ enum caif_direction { | |||
141 | * - All layers must use this structure. If embedding it, then place this | 139 | * - All layers must use this structure. If embedding it, then place this |
142 | * structure first in the layer specific structure. | 140 | * structure first in the layer specific structure. |
143 | * | 141 | * |
144 | * - Each layer should not depend on any others layer private data. | 142 | * - Each layer should not depend on any others layer's private data. |
145 | * | 143 | * |
146 | * - In order to send data upwards do | 144 | * - In order to send data upwards do |
147 | * layer->up->receive(layer->up, packet); | 145 | * layer->up->receive(layer->up, packet); |
@@ -155,16 +153,23 @@ struct cflayer { | |||
155 | struct list_head node; | 153 | struct list_head node; |
156 | 154 | ||
157 | /* | 155 | /* |
158 | * receive() - Receive Function. | 156 | * receive() - Receive Function (non-blocking). |
159 | * Contract: Each layer must implement a receive function passing the | 157 | * Contract: Each layer must implement a receive function passing the |
160 | * CAIF packets upwards in the stack. | 158 | * CAIF packets upwards in the stack. |
161 | * Packet handling rules: | 159 | * Packet handling rules: |
162 | * - The CAIF packet (cfpkt) cannot be accessed after | 160 | * - The CAIF packet (cfpkt) ownership is passed to the |
163 | * passing it to the next layer using up->receive(). | 161 | * called receive function. This means that the the |
162 | * packet cannot be accessed after passing it to the | ||
163 | * above layer using up->receive(). | ||
164 | * | ||
164 | * - If parsing of the packet fails, the packet must be | 165 | * - If parsing of the packet fails, the packet must be |
165 | * destroyed and -1 returned from the function. | 166 | * destroyed and negative error code returned |
167 | * from the function. | ||
168 | * EXCEPTION: If the framing layer (cffrml) returns | ||
169 | * -EILSEQ, the packet is not freed. | ||
170 | * | ||
166 | * - If parsing succeeds (and above layers return OK) then | 171 | * - If parsing succeeds (and above layers return OK) then |
167 | * the function must return a value > 0. | 172 | * the function must return a value >= 0. |
168 | * | 173 | * |
169 | * Returns result < 0 indicates an error, 0 or positive value | 174 | * Returns result < 0 indicates an error, 0 or positive value |
170 | * indicates success. | 175 | * indicates success. |
@@ -176,7 +181,7 @@ struct cflayer { | |||
176 | int (*receive)(struct cflayer *layr, struct cfpkt *cfpkt); | 181 | int (*receive)(struct cflayer *layr, struct cfpkt *cfpkt); |
177 | 182 | ||
178 | /* | 183 | /* |
179 | * transmit() - Transmit Function. | 184 | * transmit() - Transmit Function (non-blocking). |
180 | * Contract: Each layer must implement a transmit function passing the | 185 | * Contract: Each layer must implement a transmit function passing the |
181 | * CAIF packet downwards in the stack. | 186 | * CAIF packet downwards in the stack. |
182 | * Packet handling rules: | 187 | * Packet handling rules: |
@@ -185,15 +190,16 @@ struct cflayer { | |||
185 | * cannot be accessed after passing it to the below | 190 | * cannot be accessed after passing it to the below |
186 | * layer using dn->transmit(). | 191 | * layer using dn->transmit(). |
187 | * | 192 | * |
188 | * - If transmit fails, however, the ownership is returned | 193 | * - Upon error the packet ownership is still passed on, |
189 | * to thecaller. The caller of "dn->transmit()" must | 194 | * so the packet shall be freed where error is detected. |
190 | * destroy or resend packet. | 195 | * Callers of the transmit function shall not free packets, |
196 | * but errors shall be returned. | ||
191 | * | 197 | * |
192 | * - Return value less than zero means error, zero or | 198 | * - Return value less than zero means error, zero or |
193 | * greater than zero means OK. | 199 | * greater than zero means OK. |
194 | * | 200 | * |
195 | * result < 0 indicates an error, 0 or positive value | 201 | * Returns result < 0 indicates an error, 0 or positive value |
196 | * indicate success. | 202 | * indicates success. |
197 | * | 203 | * |
198 | * @layr: Pointer to the current layer the receive function | 204 | * @layr: Pointer to the current layer the receive function |
199 | * isimplemented for (this pointer). | 205 | * isimplemented for (this pointer). |
@@ -202,7 +208,7 @@ struct cflayer { | |||
202 | int (*transmit) (struct cflayer *layr, struct cfpkt *cfpkt); | 208 | int (*transmit) (struct cflayer *layr, struct cfpkt *cfpkt); |
203 | 209 | ||
204 | /* | 210 | /* |
205 | * cttrlcmd() - Control Function upwards in CAIF Stack. | 211 | * cttrlcmd() - Control Function upwards in CAIF Stack (non-blocking). |
206 | * Used for signaling responses (CAIF_CTRLCMD_*_RSP) | 212 | * Used for signaling responses (CAIF_CTRLCMD_*_RSP) |
207 | * and asynchronous events from the modem (CAIF_CTRLCMD_*_IND) | 213 | * and asynchronous events from the modem (CAIF_CTRLCMD_*_IND) |
208 | * | 214 | * |