Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * net/tipc/bearer.h: Include file for TIPC bearer code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 1996-2006, 2013-2016, Ericsson AB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 2005, 2010-2011, Wind River Systems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Redistribution and use in source and binary forms, with or without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * modification, are permitted provided that the following conditions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * 1. Redistributions of source code must retain the above copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *    notice, this list of conditions and the following disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * 2. Redistributions in binary form must reproduce the above copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *    notice, this list of conditions and the following disclaimer in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *    documentation and/or other materials provided with the distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * 3. Neither the names of the copyright holders nor the names of its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *    contributors may be used to endorse or promote products derived from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *    this software without specific prior written permission.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * Alternatively, this software may be distributed under the terms of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * GNU General Public License ("GPL") version 2 as published by the Free
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * Software Foundation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * POSSIBILITY OF SUCH DAMAGE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #ifndef _TIPC_BEARER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define _TIPC_BEARER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include "netlink.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #include "core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include "msg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #include <net/genetlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define MAX_MEDIA	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /* Identifiers associated with TIPC message header media address info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * - address info field is 32 bytes long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * - the field's actual content and length is defined per media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * - remaining unused bytes in the field are set to zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define TIPC_MEDIA_INFO_SIZE	32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define TIPC_MEDIA_TYPE_OFFSET	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #define TIPC_MEDIA_ADDR_OFFSET	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * Identifiers of supported TIPC media types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #define TIPC_MEDIA_TYPE_ETH	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define TIPC_MEDIA_TYPE_IB	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define TIPC_MEDIA_TYPE_UDP	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) /* Minimum bearer MTU */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #define TIPC_MIN_BEARER_MTU	(MAX_H_SIZE + INT_H_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) /* Identifiers for distinguishing between broadcast/multicast and replicast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #define TIPC_BROADCAST_SUPPORT  1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define TIPC_REPLICAST_SUPPORT  2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  * struct tipc_media_addr - destination address used by TIPC bearers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * @value: address info (format defined by media)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  * @media_id: TIPC media type identifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  * @broadcast: non-zero if address is a broadcast address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) struct tipc_media_addr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	u8 value[TIPC_MEDIA_INFO_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	u8 media_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	u8 broadcast;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) struct tipc_bearer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * struct tipc_media - Media specific info exposed to generic bearer layer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * @send_msg: routine which handles buffer transmission
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * @enable_media: routine which enables a media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * @disable_media: routine which disables a media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * @addr2str: convert media address format to string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * @addr2msg: convert from media addr format to discovery msg addr format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * @msg2addr: convert from discovery msg addr format to media addr format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * @raw2addr: convert from raw addr format to media addr format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * @priority: default link (and bearer) priority
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * @tolerance: default time (in ms) before declaring link failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  * @window: default window (in packets) before declaring link congestion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  * @mtu: max packet size bearer can support for media type not dependent on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  * underlying device MTU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  * @type_id: TIPC media identifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  * @hwaddr_len: TIPC media address len
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * @name: media name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) struct tipc_media {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	int (*send_msg)(struct net *net, struct sk_buff *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			struct tipc_bearer *b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			struct tipc_media_addr *dest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	int (*enable_media)(struct net *net, struct tipc_bearer *b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			    struct nlattr *attr[]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	void (*disable_media)(struct tipc_bearer *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	int (*addr2str)(struct tipc_media_addr *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			char *strbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 			int bufsz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	int (*addr2msg)(char *msg, struct tipc_media_addr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	int (*msg2addr)(struct tipc_bearer *b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			struct tipc_media_addr *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			char *msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	int (*raw2addr)(struct tipc_bearer *b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 			struct tipc_media_addr *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			char *raw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	u32 priority;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	u32 tolerance;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	u32 min_win;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	u32 max_win;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	u32 mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	u32 type_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	u32 hwaddr_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	char name[TIPC_MAX_MEDIA_NAME];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)  * struct tipc_bearer - Generic TIPC bearer structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)  * @media_ptr: pointer to additional media-specific information about bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * @mtu: max packet size bearer can support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * @addr: media-specific address associated with bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * @name: bearer name (format = media:interface)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * @media: ptr to media structure associated with bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  * @bcast_addr: media address used in broadcasting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  * @pt: packet type for bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  * @rcu: rcu struct for tipc_bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  * @priority: default link priority for bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  * @window: default window size for bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  * @tolerance: default link tolerance for bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  * @domain: network domain to which links can be established
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  * @identity: array index of this bearer within TIPC bearer array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * @link_req: ptr to (optional) structure making periodic link setup requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * @net_plane: network plane ('A' through 'H') currently associated with bearer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * Note: media-specific code is responsible for initialization of the fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  * indicated below when a bearer is enabled; TIPC's generic bearer code takes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  * care of initializing all other fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct tipc_bearer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	void __rcu *media_ptr;			/* initalized by media */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	u32 mtu;				/* initalized by media */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	struct tipc_media_addr addr;		/* initalized by media */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	char name[TIPC_MAX_BEARER_NAME];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	struct tipc_media *media;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	struct tipc_media_addr bcast_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	struct packet_type pt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	u32 priority;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	u32 min_win;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	u32 max_win;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	u32 tolerance;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	u32 domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	u32 identity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	struct tipc_discoverer *disc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	char net_plane;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	unsigned long up;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	refcount_t refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) struct tipc_bearer_names {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	char media_name[TIPC_MAX_MEDIA_NAME];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	char if_name[TIPC_MAX_IF_NAME];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  * TIPC routines available to supported media types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  * Routines made available to TIPC by supported media types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) extern struct tipc_media eth_media_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) #ifdef CONFIG_TIPC_MEDIA_IB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) extern struct tipc_media ib_media_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) #ifdef CONFIG_TIPC_MEDIA_UDP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) extern struct tipc_media udp_media_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) int __tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) int __tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) int tipc_nl_bearer_dump(struct sk_buff *skb, struct netlink_callback *cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) int tipc_nl_media_dump(struct sk_buff *skb, struct netlink_callback *cb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) int tipc_media_set_priority(const char *name, u32 new_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) int tipc_media_set_window(const char *name, u32 new_value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) int tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 			 struct nlattr *attrs[]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) bool tipc_bearer_hold(struct tipc_bearer *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) void tipc_bearer_put(struct tipc_bearer *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) void tipc_disable_l2_media(struct tipc_bearer *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) int tipc_l2_send_msg(struct net *net, struct sk_buff *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		     struct tipc_bearer *b, struct tipc_media_addr *dest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) void tipc_bearer_remove_dest(struct net *net, u32 bearer_id, u32 dest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) int tipc_bearer_get_name(struct net *net, char *name, u32 bearer_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) struct tipc_media *tipc_media_find(const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) int tipc_bearer_setup(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) void tipc_bearer_cleanup(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) void tipc_bearer_stop(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) int tipc_bearer_mtu(struct net *net, u32 bearer_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) bool tipc_bearer_bcast_support(struct net *net, u32 bearer_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) void tipc_bearer_xmit_skb(struct net *net, u32 bearer_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 			  struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			  struct tipc_media_addr *dest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) void tipc_bearer_xmit(struct net *net, u32 bearer_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		      struct sk_buff_head *xmitq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 		      struct tipc_media_addr *dst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 		      struct tipc_node *__dnode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) void tipc_bearer_bc_xmit(struct net *net, u32 bearer_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 			 struct sk_buff_head *xmitq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) void tipc_clone_to_loopback(struct net *net, struct sk_buff_head *pkts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) int tipc_attach_loopback(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) void tipc_detach_loopback(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) static inline void tipc_loopback_trace(struct net *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 				       struct sk_buff_head *pkts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	if (unlikely(dev_nit_active(net->loopback_dev)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 		tipc_clone_to_loopback(net, pkts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) /* check if device MTU is too low for tipc headers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) static inline bool tipc_mtu_bad(struct net_device *dev, unsigned int reserve)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	if (dev->mtu >= TIPC_MIN_BEARER_MTU + reserve)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 		return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	netdev_warn(dev, "MTU too low for tipc bearer\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) #endif	/* _TIPC_BEARER_H */