Commit 9a182242 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Simon Wunderlich
Browse files

batman-adv: Add throughput_override hardif genl configuration



The B.A.T.M.A.N. V implementation tries to estimate the link throughput of
an interface to an originator using different automatic methods. It is
still possible to overwrite it the link throughput for all reachable
originators via this interface.

The BATADV_CMD_SET_HARDIF/BATADV_CMD_GET_HARDIF commands allow to set/get
the configuration of this feature using the u32
BATADV_ATTR_THROUGHPUT_OVERRIDE attribute. The used unit is in 100 Kbit/s.
If the value is set to 0 then batman-adv will try to estimate the
throughput by itself.

Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
parent a1080082
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -483,6 +483,14 @@ enum batadv_nl_attrs {
	 */
	BATADV_ATTR_ELP_INTERVAL,

	/**
	 * @BATADV_ATTR_THROUGHPUT_OVERRIDE: defines the throughput value to be
	 *  used by B.A.T.M.A.N. V when estimating the link throughput using
	 *  this interface. If the value is set to 0 then batman-adv will try to
	 *  estimate the throughput by itself.
	 */
	BATADV_ATTR_THROUGHPUT_OVERRIDE,

	/* add attributes above here, update the policy in netlink.c */

	/**
+12 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ static const struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = {
	[BATADV_ATTR_NETWORK_CODING_ENABLED]	= { .type = NLA_U8 },
	[BATADV_ATTR_ORIG_INTERVAL]		= { .type = NLA_U32 },
	[BATADV_ATTR_ELP_INTERVAL]		= { .type = NLA_U32 },
	[BATADV_ATTR_THROUGHPUT_OVERRIDE]	= { .type = NLA_U32 },
};

/**
@@ -830,6 +831,10 @@ static int batadv_netlink_hardif_fill(struct sk_buff *msg,
	if (nla_put_u32(msg, BATADV_ATTR_ELP_INTERVAL,
			atomic_read(&hard_iface->bat_v.elp_interval)))
		goto nla_put_failure;

	if (nla_put_u32(msg, BATADV_ATTR_THROUGHPUT_OVERRIDE,
			atomic_read(&hard_iface->bat_v.throughput_override)))
		goto nla_put_failure;
#endif /* CONFIG_BATMAN_ADV_BATMAN_V */

	genlmsg_end(msg, hdr);
@@ -925,6 +930,13 @@ static int batadv_netlink_set_hardif(struct sk_buff *skb,

		atomic_set(&hard_iface->bat_v.elp_interval, nla_get_u32(attr));
	}

	if (info->attrs[BATADV_ATTR_THROUGHPUT_OVERRIDE]) {
		attr = info->attrs[BATADV_ATTR_THROUGHPUT_OVERRIDE];

		atomic_set(&hard_iface->bat_v.throughput_override,
			   nla_get_u32(attr));
	}
#endif /* CONFIG_BATMAN_ADV_BATMAN_V */

	batadv_netlink_notify_hardif(bat_priv, hard_iface);