aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/irda/irlan_common.h10
-rw-r--r--include/net/irda/irlap_frame.h31
-rw-r--r--include/net/irda/irlmp.h2
-rw-r--r--net/irda/af_irda.c3
-rw-r--r--net/irda/ircomm/ircomm_lmp.c4
-rw-r--r--net/irda/iriap.c9
-rw-r--r--net/irda/iriap_event.c2
-rw-r--r--net/irda/irlan/irlan_common.c46
-rw-r--r--net/irda/irlan/irlan_provider.c12
-rw-r--r--net/irda/irlap_frame.c59
-rw-r--r--net/irda/irlmp.c2
-rw-r--r--net/irda/irttp.c14
12 files changed, 136 insertions, 58 deletions
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h
index 1c73bdbc3eb3..9592c374b41d 100644
--- a/include/net/irda/irlan_common.h
+++ b/include/net/irda/irlan_common.h
@@ -98,7 +98,15 @@
98#define IRLAN_SHORT 1 98#define IRLAN_SHORT 1
99#define IRLAN_ARRAY 2 99#define IRLAN_ARRAY 2
100 100
101#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_MAX_HEADER) 101/* IrLAN sits on top if IrTTP */
102#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER)
103/* 1 byte for the command code and 1 byte for the parameter count */
104#define IRLAN_CMD_HEADER 2
105
106#define IRLAN_STRING_PARAMETER_LEN(name, value) (1 + strlen((name)) + 2 \
107 + strlen ((value)))
108#define IRLAN_BYTE_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 1)
109#define IRLAN_SHORT_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 2)
102 110
103/* 111/*
104 * IrLAN client 112 * IrLAN client
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
index 3452ae257c84..9dd54a5002b2 100644
--- a/include/net/irda/irlap_frame.h
+++ b/include/net/irda/irlap_frame.h
@@ -74,6 +74,19 @@ struct discovery_t;
74 74
75#define PF_BIT 0x10 /* Poll/final bit */ 75#define PF_BIT 0x10 /* Poll/final bit */
76 76
77/* Some IrLAP field lengths */
78/*
79 * Only baud rate triplet is 4 bytes (PV can be 2 bytes).
80 * All others params (7) are 3 bytes, so that's 7*3 + 1*4 bytes.
81 */
82#define IRLAP_NEGOCIATION_PARAMS_LEN 25
83#define IRLAP_DISCOVERY_INFO_LEN 32
84
85struct disc_frame {
86 __u8 caddr; /* Connection address */
87 __u8 control;
88} IRDA_PACK;
89
77struct xid_frame { 90struct xid_frame {
78 __u8 caddr; /* Connection address */ 91 __u8 caddr; /* Connection address */
79 __u8 control; 92 __u8 control;
@@ -95,11 +108,25 @@ struct test_frame {
95struct ua_frame { 108struct ua_frame {
96 __u8 caddr; 109 __u8 caddr;
97 __u8 control; 110 __u8 control;
98
99 __u32 saddr; /* Source device address */ 111 __u32 saddr; /* Source device address */
100 __u32 daddr; /* Dest device address */ 112 __u32 daddr; /* Dest device address */
101} IRDA_PACK; 113} IRDA_PACK;
102 114
115struct dm_frame {
116 __u8 caddr; /* Connection address */
117 __u8 control;
118} IRDA_PACK;
119
120struct rd_frame {
121 __u8 caddr; /* Connection address */
122 __u8 control;
123} IRDA_PACK;
124
125struct rr_frame {
126 __u8 caddr; /* Connection address */
127 __u8 control;
128} IRDA_PACK;
129
103struct i_frame { 130struct i_frame {
104 __u8 caddr; 131 __u8 caddr;
105 __u8 control; 132 __u8 control;
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
index 11ecfa58a648..e212b9bc2503 100644
--- a/include/net/irda/irlmp.h
+++ b/include/net/irda/irlmp.h
@@ -48,7 +48,7 @@
48#define DEV_ADDR_ANY 0xffffffff 48#define DEV_ADDR_ANY 0xffffffff
49 49
50#define LMP_HEADER 2 /* Dest LSAP + Source LSAP */ 50#define LMP_HEADER 2 /* Dest LSAP + Source LSAP */
51#define LMP_CONTROL_HEADER 4 51#define LMP_CONTROL_HEADER 4 /* LMP_HEADER + opcode + parameter */
52#define LMP_PID_HEADER 1 /* Used by Ultra */ 52#define LMP_PID_HEADER 1 /* Used by Ultra */
53#define LMP_MAX_HEADER (LMP_CONTROL_HEADER+LAP_MAX_HEADER) 53#define LMP_MAX_HEADER (LMP_CONTROL_HEADER+LAP_MAX_HEADER)
54 54
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 7b7cd5bd2a06..7e1aea89ef05 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -309,7 +309,8 @@ static void irda_connect_response(struct irda_sock *self)
309 309
310 IRDA_ASSERT(self != NULL, return;); 310 IRDA_ASSERT(self != NULL, return;);
311 311
312 skb = alloc_skb(64, GFP_ATOMIC); 312 skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
313 GFP_ATOMIC);
313 if (skb == NULL) { 314 if (skb == NULL) {
314 IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n", 315 IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n",
315 __FUNCTION__); 316 __FUNCTION__);
diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c
index 959874b6451f..c8e0d89ee11f 100644
--- a/net/irda/ircomm/ircomm_lmp.c
+++ b/net/irda/ircomm/ircomm_lmp.c
@@ -81,7 +81,7 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
81 81
82 /* Any userdata supplied? */ 82 /* Any userdata supplied? */
83 if (userdata == NULL) { 83 if (userdata == NULL) {
84 tx_skb = alloc_skb(64, GFP_ATOMIC); 84 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
85 if (!tx_skb) 85 if (!tx_skb)
86 return -ENOMEM; 86 return -ENOMEM;
87 87
@@ -115,7 +115,7 @@ static int ircomm_lmp_disconnect_request(struct ircomm_cb *self,
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(64, 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
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index 61128aa05b40..415cf4eec23b 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -345,10 +345,11 @@ static void iriap_disconnect_request(struct iriap_cb *self)
345 IRDA_ASSERT(self != NULL, return;); 345 IRDA_ASSERT(self != NULL, return;);
346 IRDA_ASSERT(self->magic == IAS_MAGIC, return;); 346 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
347 347
348 tx_skb = alloc_skb(64, GFP_ATOMIC); 348 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
349 if (tx_skb == NULL) { 349 if (tx_skb == NULL) {
350 IRDA_DEBUG(0, "%s(), Could not allocate an sk_buff of length %d\n", 350 IRDA_DEBUG(0,
351 __FUNCTION__, 64); 351 "%s(), Could not allocate an sk_buff of length %d\n",
352 __FUNCTION__, LMP_MAX_HEADER);
352 return; 353 return;
353 } 354 }
354 355
@@ -701,7 +702,7 @@ void iriap_send_ack(struct iriap_cb *self)
701 IRDA_ASSERT(self != NULL, return;); 702 IRDA_ASSERT(self != NULL, return;);
702 IRDA_ASSERT(self->magic == IAS_MAGIC, return;); 703 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
703 704
704 tx_skb = alloc_skb(64, GFP_ATOMIC); 705 tx_skb = alloc_skb(LMP_MAX_HEADER + 1, GFP_ATOMIC);
705 if (!tx_skb) 706 if (!tx_skb)
706 return; 707 return;
707 708
diff --git a/net/irda/iriap_event.c b/net/irda/iriap_event.c
index da17395df05a..99b18dc7a0b7 100644
--- a/net/irda/iriap_event.c
+++ b/net/irda/iriap_event.c
@@ -365,7 +365,7 @@ static void state_r_disconnect(struct iriap_cb *self, IRIAP_EVENT event,
365 365
366 switch (event) { 366 switch (event) {
367 case IAP_LM_CONNECT_INDICATION: 367 case IAP_LM_CONNECT_INDICATION:
368 tx_skb = alloc_skb(64, GFP_ATOMIC); 368 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
369 if (tx_skb == NULL) { 369 if (tx_skb == NULL) {
370 IRDA_WARNING("%s: unable to malloc!\n", __FUNCTION__); 370 IRDA_WARNING("%s: unable to malloc!\n", __FUNCTION__);
371 return; 371 return;
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index 7dd0a2fe1d20..9b962f247714 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -636,7 +636,8 @@ void irlan_get_provider_info(struct irlan_cb *self)
636 IRDA_ASSERT(self != NULL, return;); 636 IRDA_ASSERT(self != NULL, return;);
637 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 637 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
638 638
639 skb = alloc_skb(64, GFP_ATOMIC); 639 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER,
640 GFP_ATOMIC);
640 if (!skb) 641 if (!skb)
641 return; 642 return;
642 643
@@ -668,7 +669,10 @@ void irlan_open_data_channel(struct irlan_cb *self)
668 IRDA_ASSERT(self != NULL, return;); 669 IRDA_ASSERT(self != NULL, return;);
669 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 670 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
670 671
671 skb = alloc_skb(64, GFP_ATOMIC); 672 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
673 IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") +
674 IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"),
675 GFP_ATOMIC);
672 if (!skb) 676 if (!skb)
673 return; 677 return;
674 678
@@ -704,7 +708,9 @@ void irlan_close_data_channel(struct irlan_cb *self)
704 if (self->client.tsap_ctrl == NULL) 708 if (self->client.tsap_ctrl == NULL)
705 return; 709 return;
706 710
707 skb = alloc_skb(64, GFP_ATOMIC); 711 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
712 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN"),
713 GFP_ATOMIC);
708 if (!skb) 714 if (!skb)
709 return; 715 return;
710 716
@@ -715,7 +721,7 @@ void irlan_close_data_channel(struct irlan_cb *self)
715 721
716 /* Build frame */ 722 /* Build frame */
717 frame[0] = CMD_CLOSE_DATA_CHAN; 723 frame[0] = CMD_CLOSE_DATA_CHAN;
718 frame[1] = 0x01; /* Two parameters */ 724 frame[1] = 0x01; /* One parameter */
719 725
720 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); 726 irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data);
721 727
@@ -739,7 +745,11 @@ static void irlan_open_unicast_addr(struct irlan_cb *self)
739 IRDA_ASSERT(self != NULL, return;); 745 IRDA_ASSERT(self != NULL, return;);
740 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 746 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
741 747
742 skb = alloc_skb(128, GFP_ATOMIC); 748 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
749 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
750 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
751 IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "FILTER"),
752 GFP_ATOMIC);
743 if (!skb) 753 if (!skb)
744 return; 754 return;
745 755
@@ -777,7 +787,12 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status)
777 IRDA_ASSERT(self != NULL, return;); 787 IRDA_ASSERT(self != NULL, return;);
778 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 788 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
779 789
780 skb = alloc_skb(128, GFP_ATOMIC); 790 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
791 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
792 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") +
793 /* We may waste one byte here...*/
794 IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "FILTER"),
795 GFP_ATOMIC);
781 if (!skb) 796 if (!skb)
782 return; 797 return;
783 798
@@ -816,7 +831,12 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status)
816 IRDA_ASSERT(self != NULL, return;); 831 IRDA_ASSERT(self != NULL, return;);
817 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 832 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
818 833
819 skb = alloc_skb(128, GFP_ATOMIC); 834 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
835 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
836 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "MULTICAST") +
837 /* We may waste one byte here...*/
838 IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "NONE"),
839 GFP_ATOMIC);
820 if (!skb) 840 if (!skb)
821 return; 841 return;
822 842
@@ -856,7 +876,12 @@ static void irlan_get_unicast_addr(struct irlan_cb *self)
856 IRDA_ASSERT(self != NULL, return;); 876 IRDA_ASSERT(self != NULL, return;);
857 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 877 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
858 878
859 skb = alloc_skb(128, GFP_ATOMIC); 879 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
880 IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
881 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
882 IRLAN_STRING_PARAMETER_LEN("FILTER_OPERATION",
883 "DYNAMIC"),
884 GFP_ATOMIC);
860 if (!skb) 885 if (!skb)
861 return; 886 return;
862 887
@@ -891,7 +916,10 @@ void irlan_get_media_char(struct irlan_cb *self)
891 IRDA_ASSERT(self != NULL, return;); 916 IRDA_ASSERT(self != NULL, return;);
892 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 917 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
893 918
894 skb = alloc_skb(64, GFP_ATOMIC); 919 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
920 IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"),
921 GFP_ATOMIC);
922
895 if (!skb) 923 if (!skb)
896 return; 924 return;
897 925
diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c
index 9c0df86044d7..58efde919667 100644
--- a/net/irda/irlan/irlan_provider.c
+++ b/net/irda/irlan/irlan_provider.c
@@ -296,7 +296,14 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
296 IRDA_ASSERT(self != NULL, return;); 296 IRDA_ASSERT(self != NULL, return;);
297 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 297 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
298 298
299 skb = alloc_skb(128, GFP_ATOMIC); 299 skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
300 /* Bigger param length comes from CMD_GET_MEDIA_CHAR */
301 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
302 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BORADCAST") +
303 IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "MULTICAST") +
304 IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "HOSTED"),
305 GFP_ATOMIC);
306
300 if (!skb) 307 if (!skb)
301 return; 308 return;
302 309
@@ -354,8 +361,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
354 } else 361 } else
355 skb->data[1] = 0x02; /* 2 parameters */ 362 skb->data[1] = 0x02; /* 2 parameters */
356 irlan_insert_byte_param(skb, "DATA_CHAN", self->stsap_sel_data); 363 irlan_insert_byte_param(skb, "DATA_CHAN", self->stsap_sel_data);
357 irlan_insert_array_param(skb, "RECONNECT_KEY", "LINUX RULES!", 364 irlan_insert_string_param(skb, "RECONNECT_KEY", "LINUX RULES!");
358 12);
359 break; 365 break;
360 case CMD_FILTER_OPERATION: 366 case CMD_FILTER_OPERATION:
361 irlan_filter_request(self, skb); 367 irlan_filter_request(self, skb);
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
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index c440913dee14..5073261b9d0c 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -392,7 +392,7 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
392 392
393 /* Any userdata? */ 393 /* Any userdata? */
394 if (tx_skb == NULL) { 394 if (tx_skb == NULL) {
395 tx_skb = alloc_skb(64, GFP_ATOMIC); 395 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
396 if (!tx_skb) 396 if (!tx_skb)
397 return -ENOMEM; 397 return -ENOMEM;
398 398
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 42acf1cde737..3c2e70b77df1 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -804,12 +804,12 @@ static inline void irttp_give_credit(struct tsap_cb *self)
804 self->send_credit, self->avail_credit, self->remote_credit); 804 self->send_credit, self->avail_credit, self->remote_credit);
805 805
806 /* Give credit to peer */ 806 /* Give credit to peer */
807 tx_skb = alloc_skb(64, GFP_ATOMIC); 807 tx_skb = alloc_skb(TTP_MAX_HEADER, GFP_ATOMIC);
808 if (!tx_skb) 808 if (!tx_skb)
809 return; 809 return;
810 810
811 /* Reserve space for LMP, and LAP header */ 811 /* Reserve space for LMP, and LAP header */
812 skb_reserve(tx_skb, self->max_header_size); 812 skb_reserve(tx_skb, LMP_MAX_HEADER);
813 813
814 /* 814 /*
815 * Since we can transmit and receive frames concurrently, 815 * Since we can transmit and receive frames concurrently,
@@ -1093,7 +1093,8 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel,
1093 1093
1094 /* Any userdata supplied? */ 1094 /* Any userdata supplied? */
1095 if (userdata == NULL) { 1095 if (userdata == NULL) {
1096 tx_skb = alloc_skb(64, GFP_ATOMIC); 1096 tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
1097 GFP_ATOMIC);
1097 if (!tx_skb) 1098 if (!tx_skb)
1098 return -ENOMEM; 1099 return -ENOMEM;
1099 1100
@@ -1341,7 +1342,8 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size,
1341 1342
1342 /* Any userdata supplied? */ 1343 /* Any userdata supplied? */
1343 if (userdata == NULL) { 1344 if (userdata == NULL) {
1344 tx_skb = alloc_skb(64, GFP_ATOMIC); 1345 tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
1346 GFP_ATOMIC);
1345 if (!tx_skb) 1347 if (!tx_skb)
1346 return -ENOMEM; 1348 return -ENOMEM;
1347 1349
@@ -1540,14 +1542,14 @@ int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata,
1540 1542
1541 if (!userdata) { 1543 if (!userdata) {
1542 struct sk_buff *tx_skb; 1544 struct sk_buff *tx_skb;
1543 tx_skb = alloc_skb(64, GFP_ATOMIC); 1545 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
1544 if (!tx_skb) 1546 if (!tx_skb)
1545 return -ENOMEM; 1547 return -ENOMEM;
1546 1548
1547 /* 1549 /*
1548 * Reserve space for MUX and LAP header 1550 * Reserve space for MUX and LAP header
1549 */ 1551 */
1550 skb_reserve(tx_skb, TTP_MAX_HEADER); 1552 skb_reserve(tx_skb, LMP_MAX_HEADER);
1551 1553
1552 userdata = tx_skb; 1554 userdata = tx_skb;
1553 } 1555 }