162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * net/tipc/link.h: Include file for TIPC link code 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright (c) 1995-2006, 2013-2014, Ericsson AB 562306a36Sopenharmony_ci * Copyright (c) 2004-2005, 2010-2011, Wind River Systems 662306a36Sopenharmony_ci * All rights reserved. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 962306a36Sopenharmony_ci * modification, are permitted provided that the following conditions are met: 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 1262306a36Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 1362306a36Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright 1462306a36Sopenharmony_ci * notice, this list of conditions and the following disclaimer in the 1562306a36Sopenharmony_ci * documentation and/or other materials provided with the distribution. 1662306a36Sopenharmony_ci * 3. Neither the names of the copyright holders nor the names of its 1762306a36Sopenharmony_ci * contributors may be used to endorse or promote products derived from 1862306a36Sopenharmony_ci * this software without specific prior written permission. 1962306a36Sopenharmony_ci * 2062306a36Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the 2162306a36Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free 2262306a36Sopenharmony_ci * Software Foundation. 2362306a36Sopenharmony_ci * 2462306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2562306a36Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2662306a36Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2762306a36Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2862306a36Sopenharmony_ci * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2962306a36Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3062306a36Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3162306a36Sopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3262306a36Sopenharmony_ci * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3362306a36Sopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3462306a36Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGE. 3562306a36Sopenharmony_ci */ 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#ifndef _TIPC_LINK_H 3862306a36Sopenharmony_ci#define _TIPC_LINK_H 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci#include <net/genetlink.h> 4162306a36Sopenharmony_ci#include "msg.h" 4262306a36Sopenharmony_ci#include "node.h" 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci/* TIPC-specific error codes 4562306a36Sopenharmony_ci*/ 4662306a36Sopenharmony_ci#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */ 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci/* Link FSM events: 4962306a36Sopenharmony_ci */ 5062306a36Sopenharmony_cienum { 5162306a36Sopenharmony_ci LINK_ESTABLISH_EVT = 0xec1ab1e, 5262306a36Sopenharmony_ci LINK_PEER_RESET_EVT = 0x9eed0e, 5362306a36Sopenharmony_ci LINK_FAILURE_EVT = 0xfa110e, 5462306a36Sopenharmony_ci LINK_RESET_EVT = 0x10ca1d0e, 5562306a36Sopenharmony_ci LINK_FAILOVER_BEGIN_EVT = 0xfa110bee, 5662306a36Sopenharmony_ci LINK_FAILOVER_END_EVT = 0xfa110ede, 5762306a36Sopenharmony_ci LINK_SYNCH_BEGIN_EVT = 0xc1ccbee, 5862306a36Sopenharmony_ci LINK_SYNCH_END_EVT = 0xc1ccede 5962306a36Sopenharmony_ci}; 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* Events returned from link at packet reception or at timeout 6262306a36Sopenharmony_ci */ 6362306a36Sopenharmony_cienum { 6462306a36Sopenharmony_ci TIPC_LINK_UP_EVT = 1, 6562306a36Sopenharmony_ci TIPC_LINK_DOWN_EVT = (1 << 1), 6662306a36Sopenharmony_ci TIPC_LINK_SND_STATE = (1 << 2) 6762306a36Sopenharmony_ci}; 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci/* Starting value for maximum packet size negotiation on unicast links 7062306a36Sopenharmony_ci * (unless bearer MTU is less) 7162306a36Sopenharmony_ci */ 7262306a36Sopenharmony_ci#define MAX_PKT_DEFAULT 1500 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_cibool tipc_link_create(struct net *net, char *if_name, int bearer_id, 7562306a36Sopenharmony_ci int tolerance, char net_plane, u32 mtu, int priority, 7662306a36Sopenharmony_ci u32 min_win, u32 max_win, u32 session, u32 ownnode, 7762306a36Sopenharmony_ci u32 peer, u8 *peer_id, u16 peer_caps, 7862306a36Sopenharmony_ci struct tipc_link *bc_sndlink, 7962306a36Sopenharmony_ci struct tipc_link *bc_rcvlink, 8062306a36Sopenharmony_ci struct sk_buff_head *inputq, 8162306a36Sopenharmony_ci struct sk_buff_head *namedq, 8262306a36Sopenharmony_ci struct tipc_link **link); 8362306a36Sopenharmony_cibool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer, u8 *peer_id, 8462306a36Sopenharmony_ci int mtu, u32 min_win, u32 max_win, u16 peer_caps, 8562306a36Sopenharmony_ci struct sk_buff_head *inputq, 8662306a36Sopenharmony_ci struct sk_buff_head *namedq, 8762306a36Sopenharmony_ci struct tipc_link *bc_sndlink, 8862306a36Sopenharmony_ci struct tipc_link **link); 8962306a36Sopenharmony_civoid tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl, 9062306a36Sopenharmony_ci int mtyp, struct sk_buff_head *xmitq); 9162306a36Sopenharmony_civoid tipc_link_create_dummy_tnl_msg(struct tipc_link *tnl, 9262306a36Sopenharmony_ci struct sk_buff_head *xmitq); 9362306a36Sopenharmony_civoid tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl, 9462306a36Sopenharmony_ci struct sk_buff_head *xmitq); 9562306a36Sopenharmony_civoid tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq); 9662306a36Sopenharmony_ciint tipc_link_fsm_evt(struct tipc_link *l, int evt); 9762306a36Sopenharmony_cibool tipc_link_is_up(struct tipc_link *l); 9862306a36Sopenharmony_cibool tipc_link_peer_is_down(struct tipc_link *l); 9962306a36Sopenharmony_cibool tipc_link_is_reset(struct tipc_link *l); 10062306a36Sopenharmony_cibool tipc_link_is_establishing(struct tipc_link *l); 10162306a36Sopenharmony_cibool tipc_link_is_synching(struct tipc_link *l); 10262306a36Sopenharmony_cibool tipc_link_is_failingover(struct tipc_link *l); 10362306a36Sopenharmony_cibool tipc_link_is_blocked(struct tipc_link *l); 10462306a36Sopenharmony_civoid tipc_link_set_active(struct tipc_link *l, bool active); 10562306a36Sopenharmony_civoid tipc_link_reset(struct tipc_link *l); 10662306a36Sopenharmony_civoid tipc_link_reset_stats(struct tipc_link *l); 10762306a36Sopenharmony_ciint tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list, 10862306a36Sopenharmony_ci struct sk_buff_head *xmitq); 10962306a36Sopenharmony_cistruct sk_buff_head *tipc_link_inputq(struct tipc_link *l); 11062306a36Sopenharmony_ciu16 tipc_link_rcv_nxt(struct tipc_link *l); 11162306a36Sopenharmony_ciu16 tipc_link_acked(struct tipc_link *l); 11262306a36Sopenharmony_ciu32 tipc_link_id(struct tipc_link *l); 11362306a36Sopenharmony_cichar *tipc_link_name(struct tipc_link *l); 11462306a36Sopenharmony_ciu32 tipc_link_state(struct tipc_link *l); 11562306a36Sopenharmony_cichar tipc_link_plane(struct tipc_link *l); 11662306a36Sopenharmony_ciint tipc_link_prio(struct tipc_link *l); 11762306a36Sopenharmony_ciint tipc_link_min_win(struct tipc_link *l); 11862306a36Sopenharmony_ciint tipc_link_max_win(struct tipc_link *l); 11962306a36Sopenharmony_civoid tipc_link_update_caps(struct tipc_link *l, u16 capabilities); 12062306a36Sopenharmony_cibool tipc_link_validate_msg(struct tipc_link *l, struct tipc_msg *hdr); 12162306a36Sopenharmony_ciunsigned long tipc_link_tolerance(struct tipc_link *l); 12262306a36Sopenharmony_civoid tipc_link_set_tolerance(struct tipc_link *l, u32 tol, 12362306a36Sopenharmony_ci struct sk_buff_head *xmitq); 12462306a36Sopenharmony_civoid tipc_link_set_prio(struct tipc_link *l, u32 prio, 12562306a36Sopenharmony_ci struct sk_buff_head *xmitq); 12662306a36Sopenharmony_civoid tipc_link_set_abort_limit(struct tipc_link *l, u32 limit); 12762306a36Sopenharmony_civoid tipc_link_set_queue_limits(struct tipc_link *l, u32 min_win, u32 max_win); 12862306a36Sopenharmony_ciint __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg, 12962306a36Sopenharmony_ci struct tipc_link *link, int nlflags); 13062306a36Sopenharmony_ciint tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]); 13162306a36Sopenharmony_ciint tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq); 13262306a36Sopenharmony_ciint tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb, 13362306a36Sopenharmony_ci struct sk_buff_head *xmitq); 13462306a36Sopenharmony_ciint tipc_link_build_state_msg(struct tipc_link *l, struct sk_buff_head *xmitq); 13562306a36Sopenharmony_civoid tipc_link_add_bc_peer(struct tipc_link *snd_l, 13662306a36Sopenharmony_ci struct tipc_link *uc_l, 13762306a36Sopenharmony_ci struct sk_buff_head *xmitq); 13862306a36Sopenharmony_civoid tipc_link_remove_bc_peer(struct tipc_link *snd_l, 13962306a36Sopenharmony_ci struct tipc_link *rcv_l, 14062306a36Sopenharmony_ci struct sk_buff_head *xmitq); 14162306a36Sopenharmony_ciint tipc_link_bc_peers(struct tipc_link *l); 14262306a36Sopenharmony_civoid tipc_link_set_mtu(struct tipc_link *l, int mtu); 14362306a36Sopenharmony_ciint tipc_link_mtu(struct tipc_link *l); 14462306a36Sopenharmony_ciint tipc_link_mss(struct tipc_link *l); 14562306a36Sopenharmony_ciu16 tipc_get_gap_ack_blks(struct tipc_gap_ack_blks **ga, struct tipc_link *l, 14662306a36Sopenharmony_ci struct tipc_msg *hdr, bool uc); 14762306a36Sopenharmony_ciint tipc_link_bc_ack_rcv(struct tipc_link *l, u16 acked, u16 gap, 14862306a36Sopenharmony_ci struct tipc_gap_ack_blks *ga, 14962306a36Sopenharmony_ci struct sk_buff_head *xmitq, 15062306a36Sopenharmony_ci struct sk_buff_head *retrq); 15162306a36Sopenharmony_civoid tipc_link_bc_init_rcv(struct tipc_link *l, struct tipc_msg *hdr); 15262306a36Sopenharmony_ciint tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr, 15362306a36Sopenharmony_ci struct sk_buff_head *xmitq); 15462306a36Sopenharmony_ciint tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb, 15562306a36Sopenharmony_ci struct sk_buff_head *xmitq); 15662306a36Sopenharmony_cibool tipc_link_too_silent(struct tipc_link *l); 15762306a36Sopenharmony_cistruct net *tipc_link_net(struct tipc_link *l); 15862306a36Sopenharmony_ci#endif 159