Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd508065 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'bonding-next'



Veaceslav Falico says:

====================
bonding: simple macro cleanup

Trivial patchset that converts most of the bonding's macros into inline
functions. It introduces only one macro, BOND_MODE(), which is just
bond->params.mode, better to write/understand/remember.

The only real change is the removal of IFF_UP verification, which always
came in pair with && netif_running(), and is though useless, as it's always
IFF_UP when LINK_STATE_RUNNING.

v2->v3: fix 3/9 to actually invert bond_mode_uses_arp() and add
	bond_uses_arp() alongside bond_mode_uses_arp()
v1->v2: use inlined functions instead of macros.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 31ff6aa5 8557cd74
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -192,7 +192,7 @@ static inline void __enable_port(struct port *port)
{
{
	struct slave *slave = port->slave;
	struct slave *slave = port->slave;


	if ((slave->link == BOND_LINK_UP) && IS_UP(slave->dev))
	if ((slave->link == BOND_LINK_UP) && bond_slave_is_up(slave))
		bond_set_slave_active_flags(slave, BOND_SLAVE_NOTIFY_LATER);
		bond_set_slave_active_flags(slave, BOND_SLAVE_NOTIFY_LATER);
}
}


@@ -2449,13 +2449,13 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
			continue;
			continue;


		if (slave_agg_no >= 0) {
		if (slave_agg_no >= 0) {
			if (!first_ok_slave && SLAVE_IS_OK(slave))
			if (!first_ok_slave && bond_slave_can_tx(slave))
				first_ok_slave = slave;
				first_ok_slave = slave;
			slave_agg_no--;
			slave_agg_no--;
			continue;
			continue;
		}
		}


		if (SLAVE_IS_OK(slave)) {
		if (bond_slave_can_tx(slave)) {
			bond_dev_queue_xmit(bond, skb, slave->dev);
			bond_dev_queue_xmit(bond, skb, slave->dev);
			goto out;
			goto out;
		}
		}
+9 −9
Original line number Original line Diff line number Diff line
@@ -228,7 +228,7 @@ static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)


	/* Find the slave with the largest gap */
	/* Find the slave with the largest gap */
	bond_for_each_slave_rcu(bond, slave, iter) {
	bond_for_each_slave_rcu(bond, slave, iter) {
		if (SLAVE_IS_OK(slave)) {
		if (bond_slave_can_tx(slave)) {
			long long gap = compute_gap(slave);
			long long gap = compute_gap(slave);


			if (max_gap < gap) {
			if (max_gap < gap) {
@@ -383,7 +383,7 @@ static struct slave *rlb_next_rx_slave(struct bonding *bond)
	bool found = false;
	bool found = false;


	bond_for_each_slave(bond, slave, iter) {
	bond_for_each_slave(bond, slave, iter) {
		if (!SLAVE_IS_OK(slave))
		if (!bond_slave_can_tx(slave))
			continue;
			continue;
		if (!found) {
		if (!found) {
			if (!before || before->speed < slave->speed)
			if (!before || before->speed < slave->speed)
@@ -416,7 +416,7 @@ static struct slave *__rlb_next_rx_slave(struct bonding *bond)
	bool found = false;
	bool found = false;


	bond_for_each_slave_rcu(bond, slave, iter) {
	bond_for_each_slave_rcu(bond, slave, iter) {
		if (!SLAVE_IS_OK(slave))
		if (!bond_slave_can_tx(slave))
			continue;
			continue;
		if (!found) {
		if (!found) {
			if (!before || before->speed < slave->speed)
			if (!before || before->speed < slave->speed)
@@ -1057,7 +1057,7 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[])
	struct net_device *dev = slave->dev;
	struct net_device *dev = slave->dev;
	struct sockaddr s_addr;
	struct sockaddr s_addr;


	if (slave->bond->params.mode == BOND_MODE_TLB) {
	if (BOND_MODE(slave->bond) == BOND_MODE_TLB) {
		memcpy(dev->dev_addr, addr, dev->addr_len);
		memcpy(dev->dev_addr, addr, dev->addr_len);
		return 0;
		return 0;
	}
	}
@@ -1100,13 +1100,13 @@ static void alb_swap_mac_addr(struct slave *slave1, struct slave *slave2)
static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
				struct slave *slave2)
				struct slave *slave2)
{
{
	int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2));
	int slaves_state_differ = (bond_slave_can_tx(slave1) != bond_slave_can_tx(slave2));
	struct slave *disabled_slave = NULL;
	struct slave *disabled_slave = NULL;


	ASSERT_RTNL();
	ASSERT_RTNL();


	/* fasten the change in the switch */
	/* fasten the change in the switch */
	if (SLAVE_IS_OK(slave1)) {
	if (bond_slave_can_tx(slave1)) {
		alb_send_learning_packets(slave1, slave1->dev->dev_addr);
		alb_send_learning_packets(slave1, slave1->dev->dev_addr);
		if (bond->alb_info.rlb_enabled) {
		if (bond->alb_info.rlb_enabled) {
			/* inform the clients that the mac address
			/* inform the clients that the mac address
@@ -1118,7 +1118,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
		disabled_slave = slave1;
		disabled_slave = slave1;
	}
	}


	if (SLAVE_IS_OK(slave2)) {
	if (bond_slave_can_tx(slave2)) {
		alb_send_learning_packets(slave2, slave2->dev->dev_addr);
		alb_send_learning_packets(slave2, slave2->dev->dev_addr);
		if (bond->alb_info.rlb_enabled) {
		if (bond->alb_info.rlb_enabled) {
			/* inform the clients that the mac address
			/* inform the clients that the mac address
@@ -1360,7 +1360,7 @@ static int bond_do_alb_xmit(struct sk_buff *skb, struct bonding *bond,
			bond_info->unbalanced_load += skb->len;
			bond_info->unbalanced_load += skb->len;
	}
	}


	if (tx_slave && SLAVE_IS_OK(tx_slave)) {
	if (tx_slave && bond_slave_can_tx(tx_slave)) {
		if (tx_slave != rcu_dereference(bond->curr_active_slave)) {
		if (tx_slave != rcu_dereference(bond->curr_active_slave)) {
			ether_addr_copy(eth_data->h_source,
			ether_addr_copy(eth_data->h_source,
					tx_slave->dev->dev_addr);
					tx_slave->dev->dev_addr);
@@ -1745,7 +1745,7 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
	/* in TLB mode, the slave might flip down/up with the old dev_addr,
	/* in TLB mode, the slave might flip down/up with the old dev_addr,
	 * and thus filter bond->dev_addr's packets, so force bond's mac
	 * and thus filter bond->dev_addr's packets, so force bond's mac
	 */
	 */
	if (bond->params.mode == BOND_MODE_TLB) {
	if (BOND_MODE(bond) == BOND_MODE_TLB) {
		struct sockaddr sa;
		struct sockaddr sa;
		u8 tmp_addr[ETH_ALEN];
		u8 tmp_addr[ETH_ALEN];


+1 −1
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ static int bond_debug_rlb_hash_show(struct seq_file *m, void *v)
	struct rlb_client_info *client_info;
	struct rlb_client_info *client_info;
	u32 hash_index;
	u32 hash_index;


	if (bond->params.mode != BOND_MODE_ALB)
	if (BOND_MODE(bond) != BOND_MODE_ALB)
		return 0;
		return 0;


	seq_printf(m, "SourceIP        DestinationIP   "
	seq_printf(m, "SourceIP        DestinationIP   "
+71 −72

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Original line Diff line number Diff line
@@ -56,7 +56,7 @@ static int bond_fill_slave_info(struct sk_buff *skb,
	if (nla_put_u16(skb, IFLA_BOND_SLAVE_QUEUE_ID, slave->queue_id))
	if (nla_put_u16(skb, IFLA_BOND_SLAVE_QUEUE_ID, slave->queue_id))
		goto nla_put_failure;
		goto nla_put_failure;


	if (slave->bond->params.mode == BOND_MODE_8023AD) {
	if (BOND_MODE(slave->bond) == BOND_MODE_8023AD) {
		const struct aggregator *agg;
		const struct aggregator *agg;


		agg = SLAVE_AD_INFO(slave)->port.aggregator;
		agg = SLAVE_AD_INFO(slave)->port.aggregator;
@@ -407,7 +407,7 @@ static int bond_fill_info(struct sk_buff *skb,
	unsigned int packets_per_slave;
	unsigned int packets_per_slave;
	int i, targets_added;
	int i, targets_added;


	if (nla_put_u8(skb, IFLA_BOND_MODE, bond->params.mode))
	if (nla_put_u8(skb, IFLA_BOND_MODE, BOND_MODE(bond)))
		goto nla_put_failure;
		goto nla_put_failure;


	if (slave_dev &&
	if (slave_dev &&
@@ -505,7 +505,7 @@ static int bond_fill_info(struct sk_buff *skb,
		       bond->params.ad_select))
		       bond->params.ad_select))
		goto nla_put_failure;
		goto nla_put_failure;


	if (bond->params.mode == BOND_MODE_8023AD) {
	if (BOND_MODE(bond) == BOND_MODE_8023AD) {
		struct ad_info info;
		struct ad_info info;


		if (!bond_3ad_get_active_agg_info(bond, &info)) {
		if (!bond_3ad_get_active_agg_info(bond, &info)) {
Loading