]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - net/tipc/link.h
Merge tag 'seccomp-v5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees...
[mirror_ubuntu-jammy-kernel.git] / net / tipc / link.h
CommitLineData
b97bf3fd
PL
1/*
2 * net/tipc/link.h: Include file for TIPC link code
c4307285 3 *
50100a5e 4 * Copyright (c) 1995-2006, 2013-2014, Ericsson AB
23dd4cce 5 * Copyright (c) 2004-2005, 2010-2011, Wind River Systems
b97bf3fd
PL
6 * All rights reserved.
7 *
9ea1fd3c 8 * Redistribution and use in source and binary forms, with or without
b97bf3fd
PL
9 * modification, are permitted provided that the following conditions are met:
10 *
9ea1fd3c
PL
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
b97bf3fd 19 *
9ea1fd3c
PL
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
b97bf3fd
PL
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _TIPC_LINK_H
38#define _TIPC_LINK_H
39
0655f6a8 40#include <net/genetlink.h>
b97bf3fd 41#include "msg.h"
b97bf3fd
PL
42#include "node.h"
43
859fc7c0
YX
44/* TIPC-specific error codes
45*/
46#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */
47
662921cd 48/* Link FSM events:
135daee6 49 */
d3504c34 50enum {
662921cd
JPM
51 LINK_ESTABLISH_EVT = 0xec1ab1e,
52 LINK_PEER_RESET_EVT = 0x9eed0e,
53 LINK_FAILURE_EVT = 0xfa110e,
54 LINK_RESET_EVT = 0x10ca1d0e,
55 LINK_FAILOVER_BEGIN_EVT = 0xfa110bee,
56 LINK_FAILOVER_END_EVT = 0xfa110ede,
57 LINK_SYNCH_BEGIN_EVT = 0xc1ccbee,
58 LINK_SYNCH_END_EVT = 0xc1ccede
d3504c34 59};
135daee6 60
d999297c 61/* Events returned from link at packet reception or at timeout
6ab30f9c
JPM
62 */
63enum {
64 TIPC_LINK_UP_EVT = 1,
52666986 65 TIPC_LINK_DOWN_EVT = (1 << 1),
02d11ca2 66 TIPC_LINK_SND_STATE = (1 << 2)
6ab30f9c
JPM
67};
68
135daee6 69/* Starting value for maximum packet size negotiation on unicast links
b97bf3fd
PL
70 * (unless bearer MTU is less)
71 */
b97bf3fd
PL
72#define MAX_PKT_DEFAULT 1500
73
c72fa872 74bool tipc_link_create(struct net *net, char *if_name, int bearer_id,
0e05498e 75 int tolerance, char net_plane, u32 mtu, int priority,
16ad3f40 76 u32 min_win, u32 max_win, u32 session, u32 ownnode,
25b0b9c4 77 u32 peer, u8 *peer_id, u16 peer_caps,
52666986
JPM
78 struct tipc_link *bc_sndlink,
79 struct tipc_link *bc_rcvlink,
80 struct sk_buff_head *inputq,
81 struct sk_buff_head *namedq,
440d8963 82 struct tipc_link **link);
03b6fefd 83bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer, u8 *peer_id,
16ad3f40 84 int mtu, u32 min_win, u32 max_win, u16 peer_caps,
52666986 85 struct sk_buff_head *inputq,
32301906 86 struct sk_buff_head *namedq,
52666986 87 struct tipc_link *bc_sndlink,
32301906 88 struct tipc_link **link);
6e498158
JPM
89void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
90 int mtyp, struct sk_buff_head *xmitq);
c140eb16
LDC
91void tipc_link_create_dummy_tnl_msg(struct tipc_link *tnl,
92 struct sk_buff_head *xmitq);
c0b14a08
TL
93void tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl,
94 struct sk_buff_head *xmitq);
282b3a05 95void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
662921cd 96int tipc_link_fsm_evt(struct tipc_link *l, int evt);
662921cd 97bool tipc_link_is_up(struct tipc_link *l);
c8199300 98bool tipc_link_peer_is_down(struct tipc_link *l);
662921cd 99bool tipc_link_is_reset(struct tipc_link *l);
73f646ce 100bool tipc_link_is_establishing(struct tipc_link *l);
662921cd
JPM
101bool tipc_link_is_synching(struct tipc_link *l);
102bool tipc_link_is_failingover(struct tipc_link *l);
103bool tipc_link_is_blocked(struct tipc_link *l);
c72fa872 104void tipc_link_set_active(struct tipc_link *l, bool active);
1a90632d 105void tipc_link_reset(struct tipc_link *l);
38206d59
JPM
106void tipc_link_reset_stats(struct tipc_link *l);
107int tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list,
af9b028e 108 struct sk_buff_head *xmitq);
38206d59
JPM
109struct sk_buff_head *tipc_link_inputq(struct tipc_link *l);
110u16 tipc_link_rcv_nxt(struct tipc_link *l);
111u16 tipc_link_acked(struct tipc_link *l);
112u32 tipc_link_id(struct tipc_link *l);
113char *tipc_link_name(struct tipc_link *l);
c140eb16 114u32 tipc_link_state(struct tipc_link *l);
38206d59
JPM
115char tipc_link_plane(struct tipc_link *l);
116int tipc_link_prio(struct tipc_link *l);
16ad3f40
JM
117int tipc_link_min_win(struct tipc_link *l);
118int tipc_link_max_win(struct tipc_link *l);
9012de50 119void tipc_link_update_caps(struct tipc_link *l, u16 capabilities);
7ea817f4 120bool tipc_link_validate_msg(struct tipc_link *l, struct tipc_msg *hdr);
38206d59 121unsigned long tipc_link_tolerance(struct tipc_link *l);
d01332f1
RA
122void tipc_link_set_tolerance(struct tipc_link *l, u32 tol,
123 struct sk_buff_head *xmitq);
124void tipc_link_set_prio(struct tipc_link *l, u32 prio,
125 struct sk_buff_head *xmitq);
38206d59 126void tipc_link_set_abort_limit(struct tipc_link *l, u32 limit);
16ad3f40 127void tipc_link_set_queue_limits(struct tipc_link *l, u32 min_win, u32 max_win);
5be9c086
JPM
128int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg,
129 struct tipc_link *link, int nlflags);
0655f6a8 130int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]);
333ef69e 131int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq);
d999297c
JPM
132int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb,
133 struct sk_buff_head *xmitq);
34b9cd64 134int tipc_link_build_state_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
52666986
JPM
135void tipc_link_add_bc_peer(struct tipc_link *snd_l,
136 struct tipc_link *uc_l,
137 struct sk_buff_head *xmitq);
138void tipc_link_remove_bc_peer(struct tipc_link *snd_l,
139 struct tipc_link *rcv_l,
140 struct sk_buff_head *xmitq);
2f566124 141int tipc_link_bc_peers(struct tipc_link *l);
959e1781
JPM
142void tipc_link_set_mtu(struct tipc_link *l, int mtu);
143int tipc_link_mtu(struct tipc_link *l);
fc1b6d6d 144int tipc_link_mss(struct tipc_link *l);
d7626b5a
TL
145u16 tipc_get_gap_ack_blks(struct tipc_gap_ack_blks **ga, struct tipc_link *l,
146 struct tipc_msg *hdr, bool uc);
147int tipc_link_bc_ack_rcv(struct tipc_link *l, u16 acked, u16 gap,
148 struct tipc_gap_ack_blks *ga,
a91d55d1
TL
149 struct sk_buff_head *xmitq,
150 struct sk_buff_head *retrq);
52666986
JPM
151void tipc_link_build_bc_sync_msg(struct tipc_link *l,
152 struct sk_buff_head *xmitq);
153void tipc_link_bc_init_rcv(struct tipc_link *l, struct tipc_msg *hdr);
02d11ca2
JPM
154int tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr,
155 struct sk_buff_head *xmitq);
52666986
JPM
156int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb,
157 struct sk_buff_head *xmitq);
26574db0 158bool tipc_link_too_silent(struct tipc_link *l);
b97bf3fd 159#endif