[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMDZJNWog=cbKUrZVgRszpUeEvaa832y8t6NMNBidEoyeQ8chg@mail.gmail.com>
Date: Mon, 4 Mar 2019 11:06:39 +0800
From: Tonghao Zhang <xiangxia.m.yue@...il.com>
To: Roi Dayan <roid@...lanox.com>
Cc: Saeed Mahameed <saeedm@...lanox.com>,
"gerlitz.or@...il.com" <gerlitz.or@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Mohamad Haj Yahia <mohamad@...lanox.com>
Subject: Re: [PATCH net 2/2] net/mlx5: Avoid panic when setting VF rate
On Sun, Mar 3, 2019 at 10:17 PM Roi Dayan <roid@...lanox.com> wrote:
>
>
>
> On 03/03/2019 16:12, Roi Dayan wrote:
> >
> >
> > On 03/03/2019 11:56, xiangxia.m.yue@...il.com wrote:
> >> From: Tonghao Zhang <xiangxia.m.yue@...il.com>
> >>
> >> If we try to set VFs rate on a VF (not PF) net device, the kernel
> >> will be crash. The commands are show as below:
> >>
> >> $ echo 2 > /sys/class/net/$MLX_PF0/device/sriov_numvfs
> >> $ ip link set $MLX_VF0 vf 0 rate 100
> >
> > actually this didn't reproduce with this command + your first fix.
> >
> > setting rate calls netlink IFLA_VF_TX_RATE which is calling
> > nfo_get_vf_config() which is now returning error correctly.
> >
> > we need the netlink call to be IFLA_VF_RATE. seems we get there
> > when we set min/max_tx_rate.
> > so i reproduce the error with this command
> > $ ip link set dev $VF vf 0 max_tx_rate 2 max_tx_rate 1
>
> I had a typo here. the cmd is
> $ ip link set dev $VF vf 0 max_tx_rate 2 min_tx_rate 1
>
> >
> > can you verify and fix the commit msg?
Yes, thanks.
> >>
> >> Fixes: c9497c98901c ("net/mlx5: Add support for setting VF min rate")
> >> Cc: Mohamad Haj Yahia <mohamad@...lanox.com>
> >> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@...il.com>
> >> ---
> >> drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 13 +++++++++----
> >> 1 file changed, 9 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> >> index 774edc9..8c2f1e6 100644
> >> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> >> @@ -2122,19 +2122,24 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider)
> >> int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, int vport,
> >> u32 max_rate, u32 min_rate)
> >> {
> >> - u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share);
> >> - bool min_rate_supported = MLX5_CAP_QOS(esw->dev, esw_bw_share) &&
> >> - fw_max_bw_share >= MLX5_MIN_BW_SHARE;
> >> - bool max_rate_supported = MLX5_CAP_QOS(esw->dev, esw_rate_limit);
> >> struct mlx5_vport *evport;
> >> + u32 fw_max_bw_share;
> >> u32 previous_min_rate;
> >> u32 divider;
> >> + bool min_rate_supported;
> >> + bool max_rate_supported;
> >> int err = 0;
> >>
> >> if (!ESW_ALLOWED(esw))
> >> return -EPERM;
> >> if (!LEGAL_VPORT(esw, vport))
> >> return -EINVAL;
> >> +
> >> + fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share);
> >> + min_rate_supported = MLX5_CAP_QOS(esw->dev, esw_bw_share) &&
> >> + fw_max_bw_share >= MLX5_MIN_BW_SHARE;
> >> + max_rate_supported = MLX5_CAP_QOS(esw->dev, esw_rate_limit);
> >> +
> >> if ((min_rate && !min_rate_supported) || (max_rate && !max_rate_supported))
> >> return -EOPNOTSUPP;
> >>
> >>
Powered by blists - more mailing lists