diff options
| author | Samuel Ortiz <samuel@sortiz.org> | 2006-09-27 23:06:44 -0400 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-28 21:02:48 -0400 |
| commit | 1b0fee7d68f234be6b270cda51d9fcb71bebd780 (patch) | |
| tree | 11e734d80ebaf2f0a053f912bfc59068c33ef4aa /include/net/irda | |
| parent | 778e6398d32590eaf2333706318cbcd04dbe50b7 (diff) | |
[IrDA]: Memory allocations cleanups
This patch replaces the bunch of arbitrary 64 and 128 bytes alloc_skb() calls
with more accurate allocation sizes.
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/irda')
| -rw-r--r-- | include/net/irda/irlan_common.h | 10 | ||||
| -rw-r--r-- | include/net/irda/irlap_frame.h | 31 | ||||
| -rw-r--r-- | include/net/irda/irlmp.h | 2 |
3 files changed, 39 insertions, 4 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 | |||
| 85 | struct disc_frame { | ||
| 86 | __u8 caddr; /* Connection address */ | ||
| 87 | __u8 control; | ||
| 88 | } IRDA_PACK; | ||
| 89 | |||
| 77 | struct xid_frame { | 90 | struct 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 { | |||
| 95 | struct ua_frame { | 108 | struct 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 | ||
| 115 | struct dm_frame { | ||
| 116 | __u8 caddr; /* Connection address */ | ||
| 117 | __u8 control; | ||
| 118 | } IRDA_PACK; | ||
| 119 | |||
| 120 | struct rd_frame { | ||
| 121 | __u8 caddr; /* Connection address */ | ||
| 122 | __u8 control; | ||
| 123 | } IRDA_PACK; | ||
| 124 | |||
| 125 | struct rr_frame { | ||
| 126 | __u8 caddr; /* Connection address */ | ||
| 127 | __u8 control; | ||
| 128 | } IRDA_PACK; | ||
| 129 | |||
| 103 | struct i_frame { | 130 | struct 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 | ||
