From: Jay Vosburgh <jay.vosburgh@canonical.com>
To: Jarod Wilson <jarod@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Veaceslav Falico <vfalico@gmail.com>,
Andy Gospodarek <andy@greyhouse.net>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH net] bonding: show saner speed for broadcast mode
Date: Wed, 12 Aug 2020 22:29:56 -0700 [thread overview]
Message-ID: <27389.1597296596@famine> (raw)
In-Reply-To: <20200813035509.739-1-jarod@redhat.com>
Jarod Wilson <jarod@redhat.com> wrote:
>Broadcast mode bonds transmit a copy of all traffic simultaneously out of
>all interfaces, so the "speed" of the bond isn't really the aggregate of
>all interfaces, but rather, the speed of the lowest active interface.
Did you mean "slowest" here?
>Also, the type of the speed field is u32, not unsigned long, so adjust
>that accordingly, as required to make min() function here without
>complaining about mismatching types.
>
>Fixes: bb5b052f751b ("bond: add support to read speed and duplex via ethtool")
>CC: Jay Vosburgh <j.vosburgh@gmail.com>
>CC: Veaceslav Falico <vfalico@gmail.com>
>CC: Andy Gospodarek <andy@greyhouse.net>
>CC: "David S. Miller" <davem@davemloft.net>
>CC: netdev@vger.kernel.org
>Signed-off-by: Jarod Wilson <jarod@redhat.com>
Did you notice this by inspection, or did it come up in use
somewhere? I can't recall ever hearing of anyone using broadcast mode,
so I'm curious if there is a use for it, but this change seems
reasonable enough regardless.
-J
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
>---
> drivers/net/bonding/bond_main.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 5ad43aaf76e5..c853ca67058c 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -4552,13 +4552,23 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
> return ret;
> }
>
>+static u32 bond_mode_bcast_speed(struct slave *slave, u32 speed)
>+{
>+ if (speed == 0 || speed == SPEED_UNKNOWN)
>+ speed = slave->speed;
>+ else
>+ speed = min(speed, slave->speed);
>+
>+ return speed;
>+}
>+
> static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
> struct ethtool_link_ksettings *cmd)
> {
> struct bonding *bond = netdev_priv(bond_dev);
>- unsigned long speed = 0;
> struct list_head *iter;
> struct slave *slave;
>+ u32 speed = 0;
>
> cmd->base.duplex = DUPLEX_UNKNOWN;
> cmd->base.port = PORT_OTHER;
>@@ -4570,8 +4580,13 @@ static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
> */
> bond_for_each_slave(bond, slave, iter) {
> if (bond_slave_can_tx(slave)) {
>- if (slave->speed != SPEED_UNKNOWN)
>- speed += slave->speed;
>+ if (slave->speed != SPEED_UNKNOWN) {
>+ if (BOND_MODE(bond) == BOND_MODE_BROADCAST)
>+ speed = bond_mode_bcast_speed(slave,
>+ speed);
>+ else
>+ speed += slave->speed;
>+ }
> if (cmd->base.duplex == DUPLEX_UNKNOWN &&
> slave->duplex != DUPLEX_UNKNOWN)
> cmd->base.duplex = slave->duplex;
>--
>2.20.1
>
next prev parent reply other threads:[~2020-08-13 5:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 3:55 [PATCH net] bonding: show saner speed for broadcast mode Jarod Wilson
2020-08-13 5:29 ` Jay Vosburgh [this message]
2020-08-13 14:06 ` Jarod Wilson
2020-08-13 21:36 ` Michal Kubecek
2020-08-13 14:09 ` [PATCH net v2] " Jarod Wilson
2020-08-15 3:40 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=27389.1597296596@famine \
--to=jay.vosburgh@canonical.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=jarod@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).