diff options
author | Andreas Langer <an.langer@gmx.de> | 2010-09-04 19:58:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-09-05 03:29:45 -0400 |
commit | e63760e59542ed872f7a5b1605a46e03b879d909 (patch) | |
tree | e93a45f0ad5224fa2213a6d04e9806422dac7e7a /drivers/staging/batman-adv/packet.h | |
parent | 24c76fc07b7680536fa372905f16b57a45c0d514 (diff) |
Staging: batman-adv: layer2 unicast packet fragmentation
This patch implements a simple layer2 fragmentation to allow traffic
exchange over network interfaces with a MTU smaller than 1500 bytes. The
fragmentation splits the big packets into two parts and marks the frames
accordingly. The receiving end buffers the packets to reassemble the
orignal packet before passing it to the higher layers. This feature
makes it necessary to modify the batman-adv encapsulation for unicast
packets by adding a sequence number, flags and the originator address.
This modifcation is part of a seperate packet type for fragemented
packets to keep the original overhead as low as possible. This patch
enables the feature by default to ensure the data traffic can travel
through the network. But it also prints a warning to notify the user
about the performance implications.
Note: Fragmentation should be avoided at all costs since it has a
dramatic impact on the performance, especially when it comes wifi
networks. Instead of a single packet, 2 packets have to be sent! Not
only valuable airtime is wasted but also packetloss decreases the
throughput. A link with 50% packetloss and fragmentation enabled is
pretty much unusable.
Signed-off-by: Andreas Langer <an.langer@gmx.de>
[sven.eckelmann@gmx.de: Rework on top of current version]
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/packet.h')
-rw-r--r-- | drivers/staging/batman-adv/packet.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/staging/batman-adv/packet.h b/drivers/staging/batman-adv/packet.h index abb5e460f23..44de1bfb0b0 100644 --- a/drivers/staging/batman-adv/packet.h +++ b/drivers/staging/batman-adv/packet.h | |||
@@ -24,14 +24,15 @@ | |||
24 | 24 | ||
25 | #define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ | 25 | #define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ |
26 | 26 | ||
27 | #define BAT_PACKET 0x01 | 27 | #define BAT_PACKET 0x01 |
28 | #define BAT_ICMP 0x02 | 28 | #define BAT_ICMP 0x02 |
29 | #define BAT_UNICAST 0x03 | 29 | #define BAT_UNICAST 0x03 |
30 | #define BAT_BCAST 0x04 | 30 | #define BAT_BCAST 0x04 |
31 | #define BAT_VIS 0x05 | 31 | #define BAT_VIS 0x05 |
32 | #define BAT_UNICAST_FRAG 0x06 | ||
32 | 33 | ||
33 | /* this file is included by batctl which needs these defines */ | 34 | /* this file is included by batctl which needs these defines */ |
34 | #define COMPAT_VERSION 11 | 35 | #define COMPAT_VERSION 13 |
35 | #define DIRECTLINK 0x40 | 36 | #define DIRECTLINK 0x40 |
36 | #define VIS_SERVER 0x20 | 37 | #define VIS_SERVER 0x20 |
37 | #define PRIMARIES_FIRST_HOP 0x10 | 38 | #define PRIMARIES_FIRST_HOP 0x10 |
@@ -47,6 +48,9 @@ | |||
47 | #define VIS_TYPE_SERVER_SYNC 0 | 48 | #define VIS_TYPE_SERVER_SYNC 0 |
48 | #define VIS_TYPE_CLIENT_UPDATE 1 | 49 | #define VIS_TYPE_CLIENT_UPDATE 1 |
49 | 50 | ||
51 | /* fragmentation defines */ | ||
52 | #define UNI_FRAG_HEAD 0x01 | ||
53 | |||
50 | struct batman_packet { | 54 | struct batman_packet { |
51 | uint8_t packet_type; | 55 | uint8_t packet_type; |
52 | uint8_t version; /* batman version field */ | 56 | uint8_t version; /* batman version field */ |
@@ -96,6 +100,16 @@ struct unicast_packet { | |||
96 | uint8_t ttl; | 100 | uint8_t ttl; |
97 | } __attribute__((packed)); | 101 | } __attribute__((packed)); |
98 | 102 | ||
103 | struct unicast_frag_packet { | ||
104 | uint8_t packet_type; | ||
105 | uint8_t version; /* batman version field */ | ||
106 | uint8_t dest[6]; | ||
107 | uint8_t ttl; | ||
108 | uint8_t flags; | ||
109 | uint8_t orig[6]; | ||
110 | uint16_t seqno; | ||
111 | } __attribute__((packed)); | ||
112 | |||
99 | struct bcast_packet { | 113 | struct bcast_packet { |
100 | uint8_t packet_type; | 114 | uint8_t packet_type; |
101 | uint8_t version; /* batman version field */ | 115 | uint8_t version; /* batman version field */ |