aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/ircomm/ircomm_lmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/ircomm/ircomm_lmp.c')
-rw-r--r--net/irda/ircomm/ircomm_lmp.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c
index c8e0d89ee11f..22bd75299104 100644
--- a/net/irda/ircomm/ircomm_lmp.c
+++ b/net/irda/ircomm/ircomm_lmp.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: ircomm_lmp.c 3 * Filename: ircomm_lmp.c
4 * Version: 1.0 4 * Version: 1.0
5 * Description: Interface between IrCOMM and IrLMP 5 * Description: Interface between IrCOMM and IrLMP
@@ -9,25 +9,25 @@
9 * Modified at: Sun Dec 12 13:44:17 1999 9 * Modified at: Sun Dec 12 13:44:17 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no> 10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * Sources: Previous IrLPT work by Thomas Davis 11 * Sources: Previous IrLPT work by Thomas Davis
12 * 12 *
13 * Copyright (c) 1999 Dag Brattli, All Rights Reserved. 13 * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> 14 * Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * This program is distributed in the hope that it will be useful, 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details. 24 * GNU General Public License for more details.
25 * 25 *
26 * You should have received a copy of the GNU General Public License 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software 27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA 29 * MA 02111-1307 USA
30 * 30 *
31 ********************************************************************/ 31 ********************************************************************/
32 32
33#include <linux/sched.h> 33#include <linux/sched.h>
@@ -45,11 +45,11 @@
45/* 45/*
46 * Function ircomm_lmp_connect_request (self, userdata) 46 * Function ircomm_lmp_connect_request (self, userdata)
47 * 47 *
48 * 48 *
49 * 49 *
50 */ 50 */
51static int ircomm_lmp_connect_request(struct ircomm_cb *self, 51static int ircomm_lmp_connect_request(struct ircomm_cb *self,
52 struct sk_buff *userdata, 52 struct sk_buff *userdata,
53 struct ircomm_info *info) 53 struct ircomm_info *info)
54{ 54{
55 int ret = 0; 55 int ret = 0;
@@ -61,14 +61,14 @@ static int ircomm_lmp_connect_request(struct ircomm_cb *self,
61 skb_get(userdata); 61 skb_get(userdata);
62 62
63 ret = irlmp_connect_request(self->lsap, info->dlsap_sel, 63 ret = irlmp_connect_request(self->lsap, info->dlsap_sel,
64 info->saddr, info->daddr, NULL, userdata); 64 info->saddr, info->daddr, NULL, userdata);
65 return ret; 65 return ret;
66} 66}
67 67
68/* 68/*
69 * Function ircomm_lmp_connect_response (self, skb) 69 * Function ircomm_lmp_connect_response (self, skb)
70 * 70 *
71 * 71 *
72 * 72 *
73 */ 73 */
74static int ircomm_lmp_connect_response(struct ircomm_cb *self, 74static int ircomm_lmp_connect_response(struct ircomm_cb *self,
@@ -78,7 +78,7 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
78 int ret; 78 int ret;
79 79
80 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 80 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
81 81
82 /* Any userdata supplied? */ 82 /* Any userdata supplied? */
83 if (userdata == NULL) { 83 if (userdata == NULL) {
84 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); 84 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
@@ -88,8 +88,8 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
88 /* Reserve space for MUX and LAP header */ 88 /* Reserve space for MUX and LAP header */
89 skb_reserve(tx_skb, LMP_MAX_HEADER); 89 skb_reserve(tx_skb, LMP_MAX_HEADER);
90 } else { 90 } else {
91 /* 91 /*
92 * Check that the client has reserved enough space for 92 * Check that the client has reserved enough space for
93 * headers 93 * headers
94 */ 94 */
95 IRDA_ASSERT(skb_headroom(userdata) >= LMP_MAX_HEADER, 95 IRDA_ASSERT(skb_headroom(userdata) >= LMP_MAX_HEADER,
@@ -105,22 +105,22 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
105 return 0; 105 return 0;
106} 106}
107 107
108static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, 108static int ircomm_lmp_disconnect_request(struct ircomm_cb *self,
109 struct sk_buff *userdata, 109 struct sk_buff *userdata,
110 struct ircomm_info *info) 110 struct ircomm_info *info)
111{ 111{
112 struct sk_buff *tx_skb; 112 struct sk_buff *tx_skb;
113 int ret; 113 int ret;
114 114
115 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 115 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
116 116
117 if (!userdata) { 117 if (!userdata) {
118 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); 118 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
119 if (!tx_skb) 119 if (!tx_skb)
120 return -ENOMEM; 120 return -ENOMEM;
121 121
122 /* Reserve space for MUX and LAP header */ 122 /* Reserve space for MUX and LAP header */
123 skb_reserve(tx_skb, LMP_MAX_HEADER); 123 skb_reserve(tx_skb, LMP_MAX_HEADER);
124 userdata = tx_skb; 124 userdata = tx_skb;
125 } else { 125 } else {
126 /* Don't forget to refcount it - should be NULL anyway */ 126 /* Don't forget to refcount it - should be NULL anyway */
@@ -136,7 +136,7 @@ static int ircomm_lmp_disconnect_request(struct ircomm_cb *self,
136 * Function ircomm_lmp_flow_control (skb) 136 * Function ircomm_lmp_flow_control (skb)
137 * 137 *
138 * This function is called when a data frame we have sent to IrLAP has 138 * This function is called when a data frame we have sent to IrLAP has
139 * been deallocated. We do this to make sure we don't flood IrLAP with 139 * been deallocated. We do this to make sure we don't flood IrLAP with
140 * frames, since we are not using the IrTTP flow control mechanism 140 * frames, since we are not using the IrTTP flow control mechanism
141 */ 141 */
142static void ircomm_lmp_flow_control(struct sk_buff *skb) 142static void ircomm_lmp_flow_control(struct sk_buff *skb)
@@ -150,29 +150,29 @@ static void ircomm_lmp_flow_control(struct sk_buff *skb)
150 cb = (struct irda_skb_cb *) skb->cb; 150 cb = (struct irda_skb_cb *) skb->cb;
151 151
152 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 152 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
153 153
154 line = cb->line; 154 line = cb->line;
155 155
156 self = (struct ircomm_cb *) hashbin_lock_find(ircomm, line, NULL); 156 self = (struct ircomm_cb *) hashbin_lock_find(ircomm, line, NULL);
157 if (!self) { 157 if (!self) {
158 IRDA_DEBUG(2, "%s(), didn't find myself\n", __FUNCTION__ ); 158 IRDA_DEBUG(2, "%s(), didn't find myself\n", __FUNCTION__ );
159 return; 159 return;
160 } 160 }
161 161
162 IRDA_ASSERT(self != NULL, return;); 162 IRDA_ASSERT(self != NULL, return;);
163 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;); 163 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return;);
164 164
165 self->pkt_count--; 165 self->pkt_count--;
166 166
167 if ((self->pkt_count < 2) && (self->flow_status == FLOW_STOP)) { 167 if ((self->pkt_count < 2) && (self->flow_status == FLOW_STOP)) {
168 IRDA_DEBUG(2, "%s(), asking TTY to start again!\n", __FUNCTION__ ); 168 IRDA_DEBUG(2, "%s(), asking TTY to start again!\n", __FUNCTION__ );
169 self->flow_status = FLOW_START; 169 self->flow_status = FLOW_START;
170 if (self->notify.flow_indication) 170 if (self->notify.flow_indication)
171 self->notify.flow_indication(self->notify.instance, 171 self->notify.flow_indication(self->notify.instance,
172 self, FLOW_START); 172 self, FLOW_START);
173 } 173 }
174} 174}
175 175
176/* 176/*
177 * Function ircomm_lmp_data_request (self, userdata) 177 * Function ircomm_lmp_data_request (self, userdata)
178 * 178 *
@@ -180,7 +180,7 @@ static void ircomm_lmp_flow_control(struct sk_buff *skb)
180 * 180 *
181 */ 181 */
182static int ircomm_lmp_data_request(struct ircomm_cb *self, 182static int ircomm_lmp_data_request(struct ircomm_cb *self,
183 struct sk_buff *skb, 183 struct sk_buff *skb,
184 int not_used) 184 int not_used)
185{ 185{
186 struct irda_skb_cb *cb; 186 struct irda_skb_cb *cb;
@@ -189,8 +189,8 @@ static int ircomm_lmp_data_request(struct ircomm_cb *self,
189 IRDA_ASSERT(skb != NULL, return -1;); 189 IRDA_ASSERT(skb != NULL, return -1;);
190 190
191 cb = (struct irda_skb_cb *) skb->cb; 191 cb = (struct irda_skb_cb *) skb->cb;
192 192
193 cb->line = self->line; 193 cb->line = self->line;
194 194
195 IRDA_DEBUG(4, "%s(), sending frame\n", __FUNCTION__ ); 195 IRDA_DEBUG(4, "%s(), sending frame\n", __FUNCTION__ );
196 196
@@ -199,13 +199,13 @@ static int ircomm_lmp_data_request(struct ircomm_cb *self,
199 199
200 skb->destructor = ircomm_lmp_flow_control; 200 skb->destructor = ircomm_lmp_flow_control;
201 201
202 if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) { 202 if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) {
203 IRDA_DEBUG(2, "%s(), asking TTY to slow down!\n", __FUNCTION__ ); 203 IRDA_DEBUG(2, "%s(), asking TTY to slow down!\n", __FUNCTION__ );
204 self->flow_status = FLOW_STOP; 204 self->flow_status = FLOW_STOP;
205 if (self->notify.flow_indication) 205 if (self->notify.flow_indication)
206 self->notify.flow_indication(self->notify.instance, 206 self->notify.flow_indication(self->notify.instance,
207 self, FLOW_STOP); 207 self, FLOW_STOP);
208 } 208 }
209 ret = irlmp_data_request(self->lsap, skb); 209 ret = irlmp_data_request(self->lsap, skb);
210 if (ret) { 210 if (ret) {
211 IRDA_ERROR("%s(), failed\n", __FUNCTION__); 211 IRDA_ERROR("%s(), failed\n", __FUNCTION__);
@@ -227,11 +227,11 @@ static int ircomm_lmp_data_indication(void *instance, void *sap,
227 struct ircomm_cb *self = (struct ircomm_cb *) instance; 227 struct ircomm_cb *self = (struct ircomm_cb *) instance;
228 228
229 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 229 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
230 230
231 IRDA_ASSERT(self != NULL, return -1;); 231 IRDA_ASSERT(self != NULL, return -1;);
232 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;); 232 IRDA_ASSERT(self->magic == IRCOMM_MAGIC, return -1;);
233 IRDA_ASSERT(skb != NULL, return -1;); 233 IRDA_ASSERT(skb != NULL, return -1;);
234 234
235 ircomm_do_event(self, IRCOMM_LMP_DATA_INDICATION, skb, NULL); 235 ircomm_do_event(self, IRCOMM_LMP_DATA_INDICATION, skb, NULL);
236 236
237 /* Drop reference count - see ircomm_tty_data_indication(). */ 237 /* Drop reference count - see ircomm_tty_data_indication(). */
@@ -241,15 +241,15 @@ static int ircomm_lmp_data_indication(void *instance, void *sap,
241} 241}
242 242
243/* 243/*
244 * Function ircomm_lmp_connect_confirm (instance, sap, qos, max_sdu_size, 244 * Function ircomm_lmp_connect_confirm (instance, sap, qos, max_sdu_size,
245 * max_header_size, skb) 245 * max_header_size, skb)
246 * 246 *
247 * Connection has been confirmed by peer device 247 * Connection has been confirmed by peer device
248 * 248 *
249 */ 249 */
250static void ircomm_lmp_connect_confirm(void *instance, void *sap, 250static void ircomm_lmp_connect_confirm(void *instance, void *sap,
251 struct qos_info *qos, 251 struct qos_info *qos,
252 __u32 max_seg_size, 252 __u32 max_seg_size,
253 __u8 max_header_size, 253 __u8 max_header_size,
254 struct sk_buff *skb) 254 struct sk_buff *skb)
255{ 255{
@@ -312,7 +312,7 @@ static void ircomm_lmp_connect_indication(void *instance, void *sap,
312 * Peer device has closed the connection, or the link went down for some 312 * Peer device has closed the connection, or the link went down for some
313 * other reason 313 * other reason
314 */ 314 */
315static void ircomm_lmp_disconnect_indication(void *instance, void *sap, 315static void ircomm_lmp_disconnect_indication(void *instance, void *sap,
316 LM_REASON reason, 316 LM_REASON reason,
317 struct sk_buff *skb) 317 struct sk_buff *skb)
318{ 318{