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) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * drivers/net/bond/bond_options.h - bonding options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 2013 Nikolay Aleksandrov <nikolay@redhat.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #ifndef _NET_BOND_OPTIONS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #define _NET_BOND_OPTIONS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #define BOND_OPT_MAX_NAMELEN 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define BOND_OPT_VALID(opt) ((opt) < BOND_OPT_LAST)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define BOND_MODE_ALL_EX(x) (~(x))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) /* Option flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * BOND_OPTFLAG_NOSLAVES - check if the bond device is empty before setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * BOND_OPTFLAG_IFDOWN - check if the bond device is down before setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * BOND_OPTFLAG_RAWVAL - the option parses the value itself
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	BOND_OPTFLAG_NOSLAVES	= BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	BOND_OPTFLAG_IFDOWN	= BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	BOND_OPTFLAG_RAWVAL	= BIT(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) /* Value type flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * BOND_VALFLAG_DEFAULT - mark the value as default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * BOND_VALFLAG_(MIN|MAX) - mark the value as min/max
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	BOND_VALFLAG_DEFAULT	= BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	BOND_VALFLAG_MIN	= BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	BOND_VALFLAG_MAX	= BIT(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) /* Option IDs, their bit positions correspond to their IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	BOND_OPT_MODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	BOND_OPT_PACKETS_PER_SLAVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	BOND_OPT_XMIT_HASH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	BOND_OPT_ARP_VALIDATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	BOND_OPT_ARP_ALL_TARGETS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	BOND_OPT_FAIL_OVER_MAC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	BOND_OPT_ARP_INTERVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	BOND_OPT_ARP_TARGETS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	BOND_OPT_DOWNDELAY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	BOND_OPT_UPDELAY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	BOND_OPT_LACP_RATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	BOND_OPT_MINLINKS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	BOND_OPT_AD_SELECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	BOND_OPT_NUM_PEER_NOTIF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	BOND_OPT_MIIMON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	BOND_OPT_PRIMARY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	BOND_OPT_PRIMARY_RESELECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	BOND_OPT_USE_CARRIER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	BOND_OPT_ACTIVE_SLAVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	BOND_OPT_QUEUE_ID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	BOND_OPT_ALL_SLAVES_ACTIVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	BOND_OPT_RESEND_IGMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	BOND_OPT_LP_INTERVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	BOND_OPT_SLAVES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	BOND_OPT_TLB_DYNAMIC_LB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	BOND_OPT_AD_ACTOR_SYS_PRIO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	BOND_OPT_AD_ACTOR_SYSTEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	BOND_OPT_AD_USER_PORT_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	BOND_OPT_NUM_PEER_NOTIF_ALIAS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	BOND_OPT_PEER_NOTIF_DELAY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	BOND_OPT_LAST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) /* This structure is used for storing option values and for passing option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  * values when changing an option. The logic when used as an arg is as follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  * - if string != NULL -> parse it, if the opt is RAW type then return it, else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  *   return the parse result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  * - if string == NULL -> parse value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) struct bond_opt_value {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	char *string;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	u64 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) struct bonding;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) struct bond_option {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	int id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	const char *desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	/* unsuppmodes is used to denote modes in which the option isn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	 * supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	unsigned long unsuppmodes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	/* supported values which this option can have, can be a subset of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	 * BOND_OPTVAL_RANGE's value range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	const struct bond_opt_value *values;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	int (*set)(struct bonding *bond, const struct bond_opt_value *val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) int __bond_opt_set(struct bonding *bond, unsigned int option,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		   struct bond_opt_value *val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) int __bond_opt_set_notify(struct bonding *bond, unsigned int option,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			  struct bond_opt_value *val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) const struct bond_opt_value *bond_opt_parse(const struct bond_option *opt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 					    struct bond_opt_value *val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) const struct bond_option *bond_opt_get(unsigned int option);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) const struct bond_option *bond_opt_get_by_name(const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) const struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /* This helper is used to initialize a bond_opt_value structure for parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  * passing. There should be either a valid string or value, but not both.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)  * When value is ULLONG_MAX then string will be used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) static inline void __bond_opt_init(struct bond_opt_value *optval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 				   char *string, u64 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	memset(optval, 0, sizeof(*optval));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	optval->value = ULLONG_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	if (value == ULLONG_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		optval->string = string;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		optval->value = value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define bond_opt_initval(optval, value) __bond_opt_init(optval, NULL, value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define bond_opt_initstr(optval, str) __bond_opt_init(optval, str, ULLONG_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) void bond_option_arp_ip_targets_clear(struct bonding *bond);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #endif /* _NET_BOND_OPTIONS_H */