[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3DA1EFBB-2DA3-4DFF-ABB2-91824873A92B@cumulusnetworks.com>
Date: Fri, 10 Jan 2014 12:04:37 -0800
From: Scott Feldman <sfeldma@...ulusnetworks.com>
To: Nikolay Aleksandrov <nikolay@...hat.com>
Cc: Netdev <netdev@...r.kernel.org>
Subject: Re: [RFC net-next 3/3] bonding: convert packets_per_slave to use the new option API
On Jan 10, 2014, at 5:11 AM, Nikolay Aleksandrov <nikolay@...hat.com> wrote:
> This patch adds the necessary changes so packets_per_slave would use the
> new bonding option API.
>
> Signed-off-by: Nikolay Aleksandrov <nikolay@...hat.com>
> ---
> + [BOND_OPT_PACKETS_PER_SLAVE] = {
> + .id = BOND_OPT_PACKETS_PER_SLAVE,
> + .name = "packets_per_slave",
> + .desc = "Packets to send per slave in RR mode",
> + .valtype = BOND_OPTVAL_INTEGER,
> + .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ROUNDROBIN)),
This .unsuppmodes would be hard to generalize as-is since it’s bond-specific.
(*set)() could have done the check also. Maybe there is a (*check)() func to do pre-screening of value before (*set) is called, but after general checks are made?
> + .values = bond_pps_tbl,
> + .set = bond_option_pps_set
> + },
> { }
> };
>
> @@ -982,28 +997,6 @@ int bond_option_lp_interval_set(struct bonding *bond, int lp_interval)
> return 0;
> }
>
> -int bond_option_packets_per_slave_set(struct bonding *bond,
> - int packets_per_slave)
> -{
> - if (packets_per_slave < 0 || packets_per_slave > USHRT_MAX) {
> - pr_err("%s: packets_per_slave must be between 0 and %u\n",
> - bond->dev->name, USHRT_MAX);
> - return -EINVAL;
> - }
> -
> - if (bond->params.mode != BOND_MODE_ROUNDROBIN)
> - pr_warn("%s: Warning: packets_per_slave has effect only in balance-rr mode\n",
> - bond->dev->name);
> -
> - if (packets_per_slave > 1)
> - bond->params.packets_per_slave =
> - reciprocal_value(packets_per_slave);
> - else
> - bond->params.packets_per_slave = packets_per_slave;
> -
> - return 0;
> -}
> -
Nice! Good bye rambling code.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists