Merge tag 'iommu-updates-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / net / batman-adv / fragmentation.h
CommitLineData
7db7d9f3 1/* SPDX-License-Identifier: GPL-2.0 */
ac79cbb9 2/* Copyright (C) 2013-2017 B.A.T.M.A.N. contributors:
610bfc6b
MH
3 *
4 * Martin Hundebøll <martin@hundeboll.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
ebf38fb7 16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
610bfc6b
MH
17 */
18
19#ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_
20#define _NET_BATMAN_ADV_FRAGMENTATION_H_
21
1e2c2a4f
SE
22#include "main.h"
23
24#include <linux/compiler.h>
25#include <linux/list.h>
26#include <linux/stddef.h>
27#include <linux/types.h>
28
29struct sk_buff;
30
610bfc6b
MH
31void batadv_frag_purge_orig(struct batadv_orig_node *orig,
32 bool (*check_cb)(struct batadv_frag_table_entry *));
33bool batadv_frag_skb_fwd(struct sk_buff *skb,
34 struct batadv_hard_iface *recv_if,
35 struct batadv_orig_node *orig_node_src);
36bool batadv_frag_skb_buffer(struct sk_buff **skb,
37 struct batadv_orig_node *orig_node);
f50ca95a
AQ
38int batadv_frag_send_packet(struct sk_buff *skb,
39 struct batadv_orig_node *orig_node,
40 struct batadv_neigh_node *neigh_node);
610bfc6b
MH
41
42/**
7e9a8c2c 43 * batadv_frag_check_entry() - check if a list of fragments has timed out
610bfc6b
MH
44 * @frags_entry: table entry to check
45 *
62fe710f 46 * Return: true if the frags entry has timed out, false otherwise.
610bfc6b
MH
47 */
48static inline bool
49batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
50{
176e5b77 51 if (!hlist_empty(&frags_entry->fragment_list) &&
610bfc6b
MH
52 batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
53 return true;
24820df1 54 return false;
610bfc6b
MH
55}
56
57#endif /* _NET_BATMAN_ADV_FRAGMENTATION_H_ */