* [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config
@ 2019-03-04 8:27 xiangxia.m.yue
2019-03-04 8:27 ` [PATCH net v2 2/2] net/mlx5: Avoid panic when setting vport rate xiangxia.m.yue
2019-03-04 15:52 ` [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config Roi Dayan
0 siblings, 2 replies; 6+ messages in thread
From: xiangxia.m.yue @ 2019-03-04 8:27 UTC (permalink / raw)
To: saeedm, roid; +Cc: gerlitz.or, netdev, davem, Tonghao Zhang, Eli Cohen
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
If we try to set VFs mac address 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 mac 00:11:22:33:44:00
[exception RIP: mlx5_eswitch_set_vport_mac+41]
[ffffb8b7079e3688] do_setlink at ffffffff8f67f85b
[ffffb8b7079e37a8] __rtnl_newlink at ffffffff8f683778
[ffffb8b7079e3b68] rtnl_newlink at ffffffff8f683a63
[ffffb8b7079e3b90] rtnetlink_rcv_msg at ffffffff8f67d812
[ffffb8b7079e3c10] netlink_rcv_skb at ffffffff8f6b88ab
[ffffb8b7079e3c60] netlink_unicast at ffffffff8f6b808f
[ffffb8b7079e3ca0] netlink_sendmsg at ffffffff8f6b8412
[ffffb8b7079e3d18] sock_sendmsg at ffffffff8f6452f6
[ffffb8b7079e3d30] ___sys_sendmsg at ffffffff8f645860
[ffffb8b7079e3eb0] __sys_sendmsg at ffffffff8f647a38
[ffffb8b7079e3f38] do_syscall_64 at ffffffff8f00401b
[ffffb8b7079e3f50] entry_SYSCALL_64_after_hwframe at ffffffff8f80008c
and
[exception RIP: mlx5_eswitch_get_vport_config+12]
[ffffa70607e57678] mlx5e_get_vf_config at ffffffffc03c7f8f [mlx5_core]
[ffffa70607e57688] do_setlink at ffffffffbc67fa59
[ffffa70607e577a8] __rtnl_newlink at ffffffffbc683778
[ffffa70607e57b68] rtnl_newlink at ffffffffbc683a63
[ffffa70607e57b90] rtnetlink_rcv_msg at ffffffffbc67d812
[ffffa70607e57c10] netlink_rcv_skb at ffffffffbc6b88ab
[ffffa70607e57c60] netlink_unicast at ffffffffbc6b808f
[ffffa70607e57ca0] netlink_sendmsg at ffffffffbc6b8412
[ffffa70607e57d18] sock_sendmsg at ffffffffbc6452f6
[ffffa70607e57d30] ___sys_sendmsg at ffffffffbc645860
[ffffa70607e57eb0] __sys_sendmsg at ffffffffbc647a38
[ffffa70607e57f38] do_syscall_64 at ffffffffbc00401b
[ffffa70607e57f50] entry_SYSCALL_64_after_hwframe at ffffffffbc80008c
Fixes: a8d70a054a718 ("net/mlx5: E-Switch, Disallow vlan/spoofcheck setup if not being esw manager")
Cc: Eli Cohen <eli@mellanox.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
v1->v2: check only the esw is null, instead of ESW_ALLOWED.
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 6cb9710..385e5cc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1871,7 +1871,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
u64 node_guid;
int err = 0;
- if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
+ if (!esw || !MLX5_CAP_GEN(esw->dev, vport_group_manager))
return -EPERM;
if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
return -EINVAL;
@@ -1945,7 +1945,7 @@ int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
{
struct mlx5_vport *evport;
- if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
+ if (!esw || !MLX5_CAP_GEN(esw->dev, vport_group_manager))
return -EPERM;
if (!LEGAL_VPORT(esw, vport))
return -EINVAL;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net v2 2/2] net/mlx5: Avoid panic when setting vport rate
2019-03-04 8:27 [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config xiangxia.m.yue
@ 2019-03-04 8:27 ` xiangxia.m.yue
2019-03-04 15:55 ` Roi Dayan
2019-03-04 15:52 ` [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config Roi Dayan
1 sibling, 1 reply; 6+ messages in thread
From: xiangxia.m.yue @ 2019-03-04 8:27 UTC (permalink / raw)
To: saeedm, roid; +Cc: gerlitz.or, netdev, davem, Tonghao Zhang, Mohamad Haj Yahia
From: Tonghao Zhang <xiangxia.m.yue@gmail.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 max_tx_rate 2 min_tx_rate 1
If not applied the first patch ("net/mlx5: Avoid panic when setting
vport mac, getting vport config"), the command:
$ ip link set $MLX_VF0 vf 0 rate 100
can also crash the kernel.
[ 1650.006388] RIP: 0010:mlx5_eswitch_set_vport_rate+0x1f/0x260 [mlx5_core]
[ 1650.007092] do_setlink+0x982/0xd20
[ 1650.007129] __rtnl_newlink+0x528/0x7d0
[ 1650.007374] rtnl_newlink+0x43/0x60
[ 1650.007407] rtnetlink_rcv_msg+0x2a2/0x320
[ 1650.007484] netlink_rcv_skb+0xcb/0x100
[ 1650.007519] netlink_unicast+0x17f/0x230
[ 1650.007554] netlink_sendmsg+0x2d2/0x3d0
[ 1650.007592] sock_sendmsg+0x36/0x50
[ 1650.007625] ___sys_sendmsg+0x280/0x2a0
[ 1650.007963] __sys_sendmsg+0x58/0xa0
[ 1650.007998] do_syscall_64+0x5b/0x180
[ 1650.009438] entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: c9497c98901c ("net/mlx5: Add support for setting VF min rate")
Cc: Mohamad Haj Yahia <mohamad@mellanox.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
v1->v2: change commit log
---
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 385e5cc..9e339b2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -2116,19 +2116,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;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config
2019-03-04 8:27 [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config xiangxia.m.yue
2019-03-04 8:27 ` [PATCH net v2 2/2] net/mlx5: Avoid panic when setting vport rate xiangxia.m.yue
@ 2019-03-04 15:52 ` Roi Dayan
2019-03-05 22:03 ` Saeed Mahameed
1 sibling, 1 reply; 6+ messages in thread
From: Roi Dayan @ 2019-03-04 15:52 UTC (permalink / raw)
To: xiangxia.m.yue, Saeed Mahameed; +Cc: gerlitz.or, netdev, davem, Eli Cohen
On 04/03/2019 10:27, xiangxia.m.yue@gmail.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>
> If we try to set VFs mac address 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 mac 00:11:22:33:44:00
>
> [exception RIP: mlx5_eswitch_set_vport_mac+41]
> [ffffb8b7079e3688] do_setlink at ffffffff8f67f85b
> [ffffb8b7079e37a8] __rtnl_newlink at ffffffff8f683778
> [ffffb8b7079e3b68] rtnl_newlink at ffffffff8f683a63
> [ffffb8b7079e3b90] rtnetlink_rcv_msg at ffffffff8f67d812
> [ffffb8b7079e3c10] netlink_rcv_skb at ffffffff8f6b88ab
> [ffffb8b7079e3c60] netlink_unicast at ffffffff8f6b808f
> [ffffb8b7079e3ca0] netlink_sendmsg at ffffffff8f6b8412
> [ffffb8b7079e3d18] sock_sendmsg at ffffffff8f6452f6
> [ffffb8b7079e3d30] ___sys_sendmsg at ffffffff8f645860
> [ffffb8b7079e3eb0] __sys_sendmsg at ffffffff8f647a38
> [ffffb8b7079e3f38] do_syscall_64 at ffffffff8f00401b
> [ffffb8b7079e3f50] entry_SYSCALL_64_after_hwframe at ffffffff8f80008c
>
> and
>
> [exception RIP: mlx5_eswitch_get_vport_config+12]
> [ffffa70607e57678] mlx5e_get_vf_config at ffffffffc03c7f8f [mlx5_core]
> [ffffa70607e57688] do_setlink at ffffffffbc67fa59
> [ffffa70607e577a8] __rtnl_newlink at ffffffffbc683778
> [ffffa70607e57b68] rtnl_newlink at ffffffffbc683a63
> [ffffa70607e57b90] rtnetlink_rcv_msg at ffffffffbc67d812
> [ffffa70607e57c10] netlink_rcv_skb at ffffffffbc6b88ab
> [ffffa70607e57c60] netlink_unicast at ffffffffbc6b808f
> [ffffa70607e57ca0] netlink_sendmsg at ffffffffbc6b8412
> [ffffa70607e57d18] sock_sendmsg at ffffffffbc6452f6
> [ffffa70607e57d30] ___sys_sendmsg at ffffffffbc645860
> [ffffa70607e57eb0] __sys_sendmsg at ffffffffbc647a38
> [ffffa70607e57f38] do_syscall_64 at ffffffffbc00401b
> [ffffa70607e57f50] entry_SYSCALL_64_after_hwframe at ffffffffbc80008c
>
> Fixes: a8d70a054a718 ("net/mlx5: E-Switch, Disallow vlan/spoofcheck setup if not being esw manager")
> Cc: Eli Cohen <eli@mellanox.com>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
> v1->v2: check only the esw is null, instead of ESW_ALLOWED.
> ---
> drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> index 6cb9710..385e5cc 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> @@ -1871,7 +1871,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
> u64 node_guid;
> int err = 0;
>
> - if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
> + if (!esw || !MLX5_CAP_GEN(esw->dev, vport_group_manager))
> return -EPERM;
> if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
> return -EINVAL;
> @@ -1945,7 +1945,7 @@ int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
> {
> struct mlx5_vport *evport;
>
> - if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
> + if (!esw || !MLX5_CAP_GEN(esw->dev, vport_group_manager))
> return -EPERM;
> if (!LEGAL_VPORT(esw, vport))
> return -EINVAL;
>
Reviewed-by: Roi Dayan <roid@mellanox.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net v2 2/2] net/mlx5: Avoid panic when setting vport rate
2019-03-04 8:27 ` [PATCH net v2 2/2] net/mlx5: Avoid panic when setting vport rate xiangxia.m.yue
@ 2019-03-04 15:55 ` Roi Dayan
2019-03-05 22:02 ` Saeed Mahameed
0 siblings, 1 reply; 6+ messages in thread
From: Roi Dayan @ 2019-03-04 15:55 UTC (permalink / raw)
To: xiangxia.m.yue, Saeed Mahameed
Cc: gerlitz.or, netdev, davem, Mohamad Haj Yahia
On 04/03/2019 10:27, xiangxia.m.yue@gmail.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue@gmail.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 max_tx_rate 2 min_tx_rate 1
>
> If not applied the first patch ("net/mlx5: Avoid panic when setting
> vport mac, getting vport config"), the command:
>
> $ ip link set $MLX_VF0 vf 0 rate 100
>
> can also crash the kernel.
>
> [ 1650.006388] RIP: 0010:mlx5_eswitch_set_vport_rate+0x1f/0x260 [mlx5_core]
> [ 1650.007092] do_setlink+0x982/0xd20
> [ 1650.007129] __rtnl_newlink+0x528/0x7d0
> [ 1650.007374] rtnl_newlink+0x43/0x60
> [ 1650.007407] rtnetlink_rcv_msg+0x2a2/0x320
> [ 1650.007484] netlink_rcv_skb+0xcb/0x100
> [ 1650.007519] netlink_unicast+0x17f/0x230
> [ 1650.007554] netlink_sendmsg+0x2d2/0x3d0
> [ 1650.007592] sock_sendmsg+0x36/0x50
> [ 1650.007625] ___sys_sendmsg+0x280/0x2a0
> [ 1650.007963] __sys_sendmsg+0x58/0xa0
> [ 1650.007998] do_syscall_64+0x5b/0x180
> [ 1650.009438] entry_SYSCALL_64_after_hwframe+0x44/0xa9
>
> Fixes: c9497c98901c ("net/mlx5: Add support for setting VF min rate")
> Cc: Mohamad Haj Yahia <mohamad@mellanox.com>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
> v1->v2: change commit log
> ---
> 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 385e5cc..9e339b2 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> @@ -2116,19 +2116,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;
>
>
Reviewed-by: Roi Dayan <roid@mellanox.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net v2 2/2] net/mlx5: Avoid panic when setting vport rate
2019-03-04 15:55 ` Roi Dayan
@ 2019-03-05 22:02 ` Saeed Mahameed
0 siblings, 0 replies; 6+ messages in thread
From: Saeed Mahameed @ 2019-03-05 22:02 UTC (permalink / raw)
To: Roi Dayan, xiangxia.m.yue; +Cc: netdev, davem, Mohamad Haj Yahia, gerlitz.or
On Mon, 2019-03-04 at 15:55 +0000, Roi Dayan wrote:
>
> On 04/03/2019 10:27, xiangxia.m.yue@gmail.com wrote:
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.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 max_tx_rate 2 min_tx_rate 1
> >
> > If not applied the first patch ("net/mlx5: Avoid panic when setting
> > vport mac, getting vport config"), the command:
> >
> > $ ip link set $MLX_VF0 vf 0 rate 100
> >
> > can also crash the kernel.
> >
> > [ 1650.006388] RIP: 0010:mlx5_eswitch_set_vport_rate+0x1f/0x260
> > [mlx5_core]
> > [ 1650.007092] do_setlink+0x982/0xd20
> > [ 1650.007129] __rtnl_newlink+0x528/0x7d0
> > [ 1650.007374] rtnl_newlink+0x43/0x60
> > [ 1650.007407] rtnetlink_rcv_msg+0x2a2/0x320
> > [ 1650.007484] netlink_rcv_skb+0xcb/0x100
> > [ 1650.007519] netlink_unicast+0x17f/0x230
> > [ 1650.007554] netlink_sendmsg+0x2d2/0x3d0
> > [ 1650.007592] sock_sendmsg+0x36/0x50
> > [ 1650.007625] ___sys_sendmsg+0x280/0x2a0
> > [ 1650.007963] __sys_sendmsg+0x58/0xa0
> > [ 1650.007998] do_syscall_64+0x5b/0x180
> > [ 1650.009438] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> >
> > Fixes: c9497c98901c ("net/mlx5: Add support for setting VF min
> > rate")
> > Cc: Mohamad Haj Yahia <mohamad@mellanox.com>
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > ---
> > v1->v2: change commit log
> > ---
> > 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 385e5cc..9e339b2 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> > @@ -2116,19 +2116,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;
> >
> >
>
> Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config
2019-03-04 15:52 ` [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config Roi Dayan
@ 2019-03-05 22:03 ` Saeed Mahameed
0 siblings, 0 replies; 6+ messages in thread
From: Saeed Mahameed @ 2019-03-05 22:03 UTC (permalink / raw)
To: Roi Dayan, xiangxia.m.yue; +Cc: Eli Cohen, netdev, davem, gerlitz.or
On Mon, 2019-03-04 at 15:52 +0000, Roi Dayan wrote:
>
> On 04/03/2019 10:27, xiangxia.m.yue@gmail.com wrote:
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >
> > If we try to set VFs mac address 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 mac 00:11:22:33:44:00
> >
> > [exception RIP: mlx5_eswitch_set_vport_mac+41]
> > [ffffb8b7079e3688] do_setlink at ffffffff8f67f85b
> > [ffffb8b7079e37a8] __rtnl_newlink at ffffffff8f683778
> > [ffffb8b7079e3b68] rtnl_newlink at ffffffff8f683a63
> > [ffffb8b7079e3b90] rtnetlink_rcv_msg at ffffffff8f67d812
> > [ffffb8b7079e3c10] netlink_rcv_skb at ffffffff8f6b88ab
> > [ffffb8b7079e3c60] netlink_unicast at ffffffff8f6b808f
> > [ffffb8b7079e3ca0] netlink_sendmsg at ffffffff8f6b8412
> > [ffffb8b7079e3d18] sock_sendmsg at ffffffff8f6452f6
> > [ffffb8b7079e3d30] ___sys_sendmsg at ffffffff8f645860
> > [ffffb8b7079e3eb0] __sys_sendmsg at ffffffff8f647a38
> > [ffffb8b7079e3f38] do_syscall_64 at ffffffff8f00401b
> > [ffffb8b7079e3f50] entry_SYSCALL_64_after_hwframe at
> > ffffffff8f80008c
> >
> > and
> >
> > [exception RIP: mlx5_eswitch_get_vport_config+12]
> > [ffffa70607e57678] mlx5e_get_vf_config at ffffffffc03c7f8f
> > [mlx5_core]
> > [ffffa70607e57688] do_setlink at ffffffffbc67fa59
> > [ffffa70607e577a8] __rtnl_newlink at ffffffffbc683778
> > [ffffa70607e57b68] rtnl_newlink at ffffffffbc683a63
> > [ffffa70607e57b90] rtnetlink_rcv_msg at ffffffffbc67d812
> > [ffffa70607e57c10] netlink_rcv_skb at ffffffffbc6b88ab
> > [ffffa70607e57c60] netlink_unicast at ffffffffbc6b808f
> > [ffffa70607e57ca0] netlink_sendmsg at ffffffffbc6b8412
> > [ffffa70607e57d18] sock_sendmsg at ffffffffbc6452f6
> > [ffffa70607e57d30] ___sys_sendmsg at ffffffffbc645860
> > [ffffa70607e57eb0] __sys_sendmsg at ffffffffbc647a38
> > [ffffa70607e57f38] do_syscall_64 at ffffffffbc00401b
> > [ffffa70607e57f50] entry_SYSCALL_64_after_hwframe at
> > ffffffffbc80008c
> >
> > Fixes: a8d70a054a718 ("net/mlx5: E-Switch, Disallow vlan/spoofcheck
> > setup if not being esw manager")
> > Cc: Eli Cohen <eli@mellanox.com>
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > ---
> > v1->v2: check only the esw is null, instead of ESW_ALLOWED.
> > ---
> > drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> > index 6cb9710..385e5cc 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> > @@ -1871,7 +1871,7 @@ int mlx5_eswitch_set_vport_mac(struct
> > mlx5_eswitch *esw,
> > u64 node_guid;
> > int err = 0;
> >
> > - if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
> > + if (!esw || !MLX5_CAP_GEN(esw->dev, vport_group_manager))
> > return -EPERM;
> > if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
> > return -EINVAL;
> > @@ -1945,7 +1945,7 @@ int mlx5_eswitch_get_vport_config(struct
> > mlx5_eswitch *esw,
> > {
> > struct mlx5_vport *evport;
> >
> > - if (!MLX5_CAP_GEN(esw->dev, vport_group_manager))
> > + if (!esw || !MLX5_CAP_GEN(esw->dev, vport_group_manager))
> > return -EPERM;
> > if (!LEGAL_VPORT(esw, vport))
> > return -EINVAL;
> >
>
> Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-03-05 22:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 8:27 [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config xiangxia.m.yue
2019-03-04 8:27 ` [PATCH net v2 2/2] net/mlx5: Avoid panic when setting vport rate xiangxia.m.yue
2019-03-04 15:55 ` Roi Dayan
2019-03-05 22:02 ` Saeed Mahameed
2019-03-04 15:52 ` [PATCH net v2 1/2] net/mlx5: Avoid panic when setting vport mac, getting vport config Roi Dayan
2019-03-05 22:03 ` Saeed Mahameed
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).