aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irlap_frame.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/irlap_frame.c')
-rw-r--r--net/irda/irlap_frame.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index ccb983bf0f4a..dba349c832d0 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -117,7 +117,9 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
117 IRDA_ASSERT(self->magic == LAP_MAGIC, return;); 117 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
118 118
119 /* Allocate frame */ 119 /* Allocate frame */
120 tx_skb = alloc_skb(64, GFP_ATOMIC); 120 tx_skb = alloc_skb(sizeof(struct snrm_frame) +
121 IRLAP_NEGOCIATION_PARAMS_LEN,
122 GFP_ATOMIC);
121 if (!tx_skb) 123 if (!tx_skb)
122 return; 124 return;
123 125
@@ -136,7 +138,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
136 * If we are establishing a connection then insert QoS paramerters 138 * If we are establishing a connection then insert QoS paramerters
137 */ 139 */
138 if (qos) { 140 if (qos) {
139 skb_put(tx_skb, 9); /* 21 left */ 141 skb_put(tx_skb, 9); /* 25 left */
140 frame->saddr = cpu_to_le32(self->saddr); 142 frame->saddr = cpu_to_le32(self->saddr);
141 frame->daddr = cpu_to_le32(self->daddr); 143 frame->daddr = cpu_to_le32(self->daddr);
142 144
@@ -210,7 +212,9 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos)
210 IRDA_ASSERT(self->magic == LAP_MAGIC, return;); 212 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
211 213
212 /* Allocate frame */ 214 /* Allocate frame */
213 tx_skb = alloc_skb(64, GFP_ATOMIC); 215 tx_skb = alloc_skb(sizeof(struct ua_frame) +
216 IRLAP_NEGOCIATION_PARAMS_LEN,
217 GFP_ATOMIC);
214 if (!tx_skb) 218 if (!tx_skb)
215 return; 219 return;
216 220
@@ -245,23 +249,23 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos)
245void irlap_send_dm_frame( struct irlap_cb *self) 249void irlap_send_dm_frame( struct irlap_cb *self)
246{ 250{
247 struct sk_buff *tx_skb = NULL; 251 struct sk_buff *tx_skb = NULL;
248 __u8 *frame; 252 struct dm_frame *frame;
249 253
250 IRDA_ASSERT(self != NULL, return;); 254 IRDA_ASSERT(self != NULL, return;);
251 IRDA_ASSERT(self->magic == LAP_MAGIC, return;); 255 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
252 256
253 tx_skb = alloc_skb(32, GFP_ATOMIC); 257 tx_skb = alloc_skb(sizeof(struct dm_frame), GFP_ATOMIC);
254 if (!tx_skb) 258 if (!tx_skb)
255 return; 259 return;
256 260
257 frame = skb_put(tx_skb, 2); 261 frame = (struct dm_frame *)skb_put(tx_skb, 2);
258 262
259 if (self->state == LAP_NDM) 263 if (self->state == LAP_NDM)
260 frame[0] = CBROADCAST; 264 frame->caddr = CBROADCAST;
261 else 265 else
262 frame[0] = self->caddr; 266 frame->caddr = self->caddr;
263 267
264 frame[1] = DM_RSP | PF_BIT; 268 frame->control = DM_RSP | PF_BIT;
265 269
266 irlap_queue_xmit(self, tx_skb); 270 irlap_queue_xmit(self, tx_skb);
267} 271}
@@ -275,21 +279,21 @@ void irlap_send_dm_frame( struct irlap_cb *self)
275void irlap_send_disc_frame(struct irlap_cb *self) 279void irlap_send_disc_frame(struct irlap_cb *self)
276{ 280{
277 struct sk_buff *tx_skb = NULL; 281 struct sk_buff *tx_skb = NULL;
278 __u8 *frame; 282 struct disc_frame *frame;
279 283
280 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 284 IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
281 285
282 IRDA_ASSERT(self != NULL, return;); 286 IRDA_ASSERT(self != NULL, return;);
283 IRDA_ASSERT(self->magic == LAP_MAGIC, return;); 287 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
284 288
285 tx_skb = alloc_skb(16, GFP_ATOMIC); 289 tx_skb = alloc_skb(sizeof(struct disc_frame), GFP_ATOMIC);
286 if (!tx_skb) 290 if (!tx_skb)
287 return; 291 return;
288 292
289 frame = skb_put(tx_skb, 2); 293 frame = (struct disc_frame *)skb_put(tx_skb, 2);
290 294
291 frame[0] = self->caddr | CMD_FRAME; 295 frame->caddr = self->caddr | CMD_FRAME;
292 frame[1] = DISC_CMD | PF_BIT; 296 frame->control = DISC_CMD | PF_BIT;
293 297
294 irlap_queue_xmit(self, tx_skb); 298 irlap_queue_xmit(self, tx_skb);
295} 299}
@@ -315,7 +319,8 @@ void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s,
315 IRDA_ASSERT(self->magic == LAP_MAGIC, return;); 319 IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
316 IRDA_ASSERT(discovery != NULL, return;); 320 IRDA_ASSERT(discovery != NULL, return;);
317 321
318 tx_skb = alloc_skb(64, GFP_ATOMIC); 322 tx_skb = alloc_skb(sizeof(struct xid_frame) + IRLAP_DISCOVERY_INFO_LEN,
323 GFP_ATOMIC);
319 if (!tx_skb) 324 if (!tx_skb)
320 return; 325 return;
321 326
@@ -573,18 +578,18 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self,
573void irlap_send_rr_frame(struct irlap_cb *self, int command) 578void irlap_send_rr_frame(struct irlap_cb *self, int command)
574{ 579{
575 struct sk_buff *tx_skb; 580 struct sk_buff *tx_skb;
576 __u8 *frame; 581 struct rr_frame *frame;
577 582
578 tx_skb = alloc_skb(16, GFP_ATOMIC); 583 tx_skb = alloc_skb(sizeof(struct rr_frame), GFP_ATOMIC);
579 if (!tx_skb) 584 if (!tx_skb)
580 return; 585 return;
581 586
582 frame = skb_put(tx_skb, 2); 587 frame = (struct rr_frame *)skb_put(tx_skb, 2);
583 588
584 frame[0] = self->caddr; 589 frame->caddr = self->caddr;
585 frame[0] |= (command) ? CMD_FRAME : 0; 590 frame->caddr |= (command) ? CMD_FRAME : 0;
586 591
587 frame[1] = RR | PF_BIT | (self->vr << 5); 592 frame->control = RR | PF_BIT | (self->vr << 5);
588 593
589 irlap_queue_xmit(self, tx_skb); 594 irlap_queue_xmit(self, tx_skb);
590} 595}
@@ -598,16 +603,16 @@ void irlap_send_rr_frame(struct irlap_cb *self, int command)
598void irlap_send_rd_frame(struct irlap_cb *self) 603void irlap_send_rd_frame(struct irlap_cb *self)
599{ 604{
600 struct sk_buff *tx_skb; 605 struct sk_buff *tx_skb;
601 __u8 *frame; 606 struct rd_frame *frame;
602 607
603 tx_skb = alloc_skb(16, GFP_ATOMIC); 608 tx_skb = alloc_skb(sizeof(struct rd_frame), GFP_ATOMIC);
604 if (!tx_skb) 609 if (!tx_skb)
605 return; 610 return;
606 611
607 frame = skb_put(tx_skb, 2); 612 frame = (struct rd_frame *)skb_put(tx_skb, 2);
608 613
609 frame[0] = self->caddr; 614 frame->caddr = self->caddr;
610 frame[1] = RD_RSP | PF_BIT; 615 frame->caddr = RD_RSP | PF_BIT;
611 616
612 irlap_queue_xmit(self, tx_skb); 617 irlap_queue_xmit(self, tx_skb);
613} 618}
@@ -1214,7 +1219,7 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
1214 struct test_frame *frame; 1219 struct test_frame *frame;
1215 __u8 *info; 1220 __u8 *info;
1216 1221
1217 tx_skb = alloc_skb(cmd->len+sizeof(struct test_frame), GFP_ATOMIC); 1222 tx_skb = alloc_skb(cmd->len + sizeof(struct test_frame), GFP_ATOMIC);
1218 if (!tx_skb) 1223 if (!tx_skb)
1219 return; 1224 return;
1220 1225