diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2013-05-08 13:31:59 +0800 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-10-12 17:17:09 +0200 |
commit | 411d6ed93a5d0601980d3e5ce75de07c98e3a7de (patch) | |
tree | 00a52bc5c70d465129c85d48e52ced2186649660 /net/batman-adv/main.c | |
parent | 0bf84c160a4b3b75bb911b79c3972f64dfb0b039 (diff) |
batman-adv: consider network coding overhead when calculating required mtu
The module prints a warning when the MTU on the hard interface is too
small to transfer payload traffic without fragmentation. The required
MTU is calculated based on the encapsulation header size. If network
coding is compild into the module its header size is taken into
account as well.
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/main.c')
-rw-r--r-- | net/batman-adv/main.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 519138e32fe..7f3a5c42661 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c @@ -256,6 +256,31 @@ out: } /** + * batadv_max_header_len - calculate maximum encapsulation overhead for a + * payload packet + * + * Return the maximum encapsulation overhead in bytes. + */ +int batadv_max_header_len(void) +{ + int header_len = 0; + + header_len = max_t(int, header_len, + sizeof(struct batadv_unicast_packet)); + header_len = max_t(int, header_len, + sizeof(struct batadv_unicast_4addr_packet)); + header_len = max_t(int, header_len, + sizeof(struct batadv_bcast_packet)); + +#ifdef CONFIG_BATMAN_ADV_NC + header_len = max_t(int, header_len, + sizeof(struct batadv_coded_packet)); +#endif + + return header_len; +} + +/** * batadv_skb_set_priority - sets skb priority according to packet content * @skb: the packet to be sent * @offset: offset to the packet content |