Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * net/tipc/link.h: Include file for TIPC link code
0003  *
0004  * Copyright (c) 1995-2006, 2013-2014, Ericsson AB
0005  * Copyright (c) 2004-2005, 2010-2011, Wind River Systems
0006  * All rights reserved.
0007  *
0008  * Redistribution and use in source and binary forms, with or without
0009  * modification, are permitted provided that the following conditions are met:
0010  *
0011  * 1. Redistributions of source code must retain the above copyright
0012  *    notice, this list of conditions and the following disclaimer.
0013  * 2. Redistributions in binary form must reproduce the above copyright
0014  *    notice, this list of conditions and the following disclaimer in the
0015  *    documentation and/or other materials provided with the distribution.
0016  * 3. Neither the names of the copyright holders nor the names of its
0017  *    contributors may be used to endorse or promote products derived from
0018  *    this software without specific prior written permission.
0019  *
0020  * Alternatively, this software may be distributed under the terms of the
0021  * GNU General Public License ("GPL") version 2 as published by the Free
0022  * Software Foundation.
0023  *
0024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0025  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0026  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0027  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0028  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0029  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0030  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0031  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0032  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0033  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0034  * POSSIBILITY OF SUCH DAMAGE.
0035  */
0036 
0037 #ifndef _TIPC_LINK_H
0038 #define _TIPC_LINK_H
0039 
0040 #include <net/genetlink.h>
0041 #include "msg.h"
0042 #include "node.h"
0043 
0044 /* TIPC-specific error codes
0045 */
0046 #define ELINKCONG EAGAIN    /* link congestion <=> resource unavailable */
0047 
0048 /* Link FSM events:
0049  */
0050 enum {
0051     LINK_ESTABLISH_EVT       = 0xec1ab1e,
0052     LINK_PEER_RESET_EVT      = 0x9eed0e,
0053     LINK_FAILURE_EVT         = 0xfa110e,
0054     LINK_RESET_EVT           = 0x10ca1d0e,
0055     LINK_FAILOVER_BEGIN_EVT  = 0xfa110bee,
0056     LINK_FAILOVER_END_EVT    = 0xfa110ede,
0057     LINK_SYNCH_BEGIN_EVT     = 0xc1ccbee,
0058     LINK_SYNCH_END_EVT       = 0xc1ccede
0059 };
0060 
0061 /* Events returned from link at packet reception or at timeout
0062  */
0063 enum {
0064     TIPC_LINK_UP_EVT       = 1,
0065     TIPC_LINK_DOWN_EVT     = (1 << 1),
0066     TIPC_LINK_SND_STATE    = (1 << 2)
0067 };
0068 
0069 /* Starting value for maximum packet size negotiation on unicast links
0070  * (unless bearer MTU is less)
0071  */
0072 #define MAX_PKT_DEFAULT 1500
0073 
0074 bool tipc_link_create(struct net *net, char *if_name, int bearer_id,
0075               int tolerance, char net_plane, u32 mtu, int priority,
0076               u32 min_win, u32 max_win, u32 session, u32 ownnode,
0077               u32 peer, u8 *peer_id, u16 peer_caps,
0078               struct tipc_link *bc_sndlink,
0079               struct tipc_link *bc_rcvlink,
0080               struct sk_buff_head *inputq,
0081               struct sk_buff_head *namedq,
0082               struct tipc_link **link);
0083 bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer, u8 *peer_id,
0084              int mtu, u32 min_win, u32 max_win, u16 peer_caps,
0085              struct sk_buff_head *inputq,
0086              struct sk_buff_head *namedq,
0087              struct tipc_link *bc_sndlink,
0088              struct tipc_link **link);
0089 void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
0090                int mtyp, struct sk_buff_head *xmitq);
0091 void tipc_link_create_dummy_tnl_msg(struct tipc_link *tnl,
0092                     struct sk_buff_head *xmitq);
0093 void tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl,
0094                 struct sk_buff_head *xmitq);
0095 void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
0096 int tipc_link_fsm_evt(struct tipc_link *l, int evt);
0097 bool tipc_link_is_up(struct tipc_link *l);
0098 bool tipc_link_peer_is_down(struct tipc_link *l);
0099 bool tipc_link_is_reset(struct tipc_link *l);
0100 bool tipc_link_is_establishing(struct tipc_link *l);
0101 bool tipc_link_is_synching(struct tipc_link *l);
0102 bool tipc_link_is_failingover(struct tipc_link *l);
0103 bool tipc_link_is_blocked(struct tipc_link *l);
0104 void tipc_link_set_active(struct tipc_link *l, bool active);
0105 void tipc_link_reset(struct tipc_link *l);
0106 void tipc_link_reset_stats(struct tipc_link *l);
0107 int tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list,
0108            struct sk_buff_head *xmitq);
0109 struct sk_buff_head *tipc_link_inputq(struct tipc_link *l);
0110 u16 tipc_link_rcv_nxt(struct tipc_link *l);
0111 u16 tipc_link_acked(struct tipc_link *l);
0112 u32 tipc_link_id(struct tipc_link *l);
0113 char *tipc_link_name(struct tipc_link *l);
0114 u32 tipc_link_state(struct tipc_link *l);
0115 char tipc_link_plane(struct tipc_link *l);
0116 int tipc_link_prio(struct tipc_link *l);
0117 int tipc_link_min_win(struct tipc_link *l);
0118 int tipc_link_max_win(struct tipc_link *l);
0119 void tipc_link_update_caps(struct tipc_link *l, u16 capabilities);
0120 bool tipc_link_validate_msg(struct tipc_link *l, struct tipc_msg *hdr);
0121 unsigned long tipc_link_tolerance(struct tipc_link *l);
0122 void tipc_link_set_tolerance(struct tipc_link *l, u32 tol,
0123                  struct sk_buff_head *xmitq);
0124 void tipc_link_set_prio(struct tipc_link *l, u32 prio,
0125             struct sk_buff_head *xmitq);
0126 void tipc_link_set_abort_limit(struct tipc_link *l, u32 limit);
0127 void tipc_link_set_queue_limits(struct tipc_link *l, u32 min_win, u32 max_win);
0128 int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg,
0129                struct tipc_link *link, int nlflags);
0130 int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]);
0131 int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq);
0132 int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb,
0133           struct sk_buff_head *xmitq);
0134 int tipc_link_build_state_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
0135 void tipc_link_add_bc_peer(struct tipc_link *snd_l,
0136                struct tipc_link *uc_l,
0137                struct sk_buff_head *xmitq);
0138 void tipc_link_remove_bc_peer(struct tipc_link *snd_l,
0139                   struct tipc_link *rcv_l,
0140                   struct sk_buff_head *xmitq);
0141 int tipc_link_bc_peers(struct tipc_link *l);
0142 void tipc_link_set_mtu(struct tipc_link *l, int mtu);
0143 int tipc_link_mtu(struct tipc_link *l);
0144 int tipc_link_mss(struct tipc_link *l);
0145 u16 tipc_get_gap_ack_blks(struct tipc_gap_ack_blks **ga, struct tipc_link *l,
0146               struct tipc_msg *hdr, bool uc);
0147 int tipc_link_bc_ack_rcv(struct tipc_link *l, u16 acked, u16 gap,
0148              struct tipc_gap_ack_blks *ga,
0149              struct sk_buff_head *xmitq,
0150              struct sk_buff_head *retrq);
0151 void tipc_link_build_bc_sync_msg(struct tipc_link *l,
0152                  struct sk_buff_head *xmitq);
0153 void tipc_link_bc_init_rcv(struct tipc_link *l, struct tipc_msg *hdr);
0154 int tipc_link_bc_sync_rcv(struct tipc_link *l,   struct tipc_msg *hdr,
0155               struct sk_buff_head *xmitq);
0156 int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb,
0157               struct sk_buff_head *xmitq);
0158 bool tipc_link_too_silent(struct tipc_link *l);
0159 struct net *tipc_link_net(struct tipc_link *l);
0160 #endif