From: Ido Schimmel <idosch@idosch.org>
To: Colin King <colin.king@canonical.com>
Cc: Jiri Pirko <jiri@mellanox.com>,
Ido Schimmel <idosch@mellanox.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org, nogahf@mellanox.com
Subject: Re: [PATCH] mlxsw: spectrum_switchdev: remove duplicated check on multicast_enable
Date: Tue, 24 Apr 2018 12:51:04 +0000 [thread overview]
Message-ID: <20180424125104.GA2461@splinter.mtl.com> (raw)
In-Reply-To: <20180424115139.21134-1-colin.king@canonical.com>
On Tue, Apr 24, 2018 at 12:51:39PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The check on bridge_port->bridge_device->multicast_enable is performed
> twice in two nested if statements. I can't see any reason for this, the
> second check is redundant and can be removed.
>
> Detected by cppcheck:
> drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:1722]:
> (warning) Identical inner 'if' condition is always true.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
> index c11c9a635866..989ed19e25c9 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
> @@ -1719,12 +1719,9 @@ __mlxsw_sp_port_mdb_del(struct mlxsw_sp_port *mlxsw_sp_port,
> int err;
>
> if (bridge_port->bridge_device->multicast_enabled) {
> - if (bridge_port->bridge_device->multicast_enabled) {
This looks like a copy-paste error. I believe the intention was to check
'!bridge_port->mrouter' so that if port is an mrouter port packets
hitting the MDB entry would still be sent to it even after it was
removed from the MDB entry ports list.
I will send a patch later this week after I run it by Nogah who worked
on this part.
Thanks for the patch.
> - err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid,
> - false);
> - if (err)
> - netdev_err(dev, "Unable to remove port from SMID\n");
> - }
> + err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, false);
> + if (err)
> + netdev_err(dev, "Unable to remove port from SMID\n");
> }
>
> err = mlxsw_sp_port_remove_from_mid(mlxsw_sp_port, mid);
> --
> 2.17.0
>
WARNING: multiple messages have this Message-ID (diff)
From: Ido Schimmel <idosch@idosch.org>
To: Colin King <colin.king@canonical.com>
Cc: Jiri Pirko <jiri@mellanox.com>,
Ido Schimmel <idosch@mellanox.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org, nogahf@mellanox.com
Subject: Re: [PATCH] mlxsw: spectrum_switchdev: remove duplicated check on multicast_enable
Date: Tue, 24 Apr 2018 15:51:04 +0300 [thread overview]
Message-ID: <20180424125104.GA2461@splinter.mtl.com> (raw)
In-Reply-To: <20180424115139.21134-1-colin.king@canonical.com>
On Tue, Apr 24, 2018 at 12:51:39PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The check on bridge_port->bridge_device->multicast_enable is performed
> twice in two nested if statements. I can't see any reason for this, the
> second check is redundant and can be removed.
>
> Detected by cppcheck:
> drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:1722]:
> (warning) Identical inner 'if' condition is always true.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
> index c11c9a635866..989ed19e25c9 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
> @@ -1719,12 +1719,9 @@ __mlxsw_sp_port_mdb_del(struct mlxsw_sp_port *mlxsw_sp_port,
> int err;
>
> if (bridge_port->bridge_device->multicast_enabled) {
> - if (bridge_port->bridge_device->multicast_enabled) {
This looks like a copy-paste error. I believe the intention was to check
'!bridge_port->mrouter' so that if port is an mrouter port packets
hitting the MDB entry would still be sent to it even after it was
removed from the MDB entry ports list.
I will send a patch later this week after I run it by Nogah who worked
on this part.
Thanks for the patch.
> - err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid,
> - false);
> - if (err)
> - netdev_err(dev, "Unable to remove port from SMID\n");
> - }
> + err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, false);
> + if (err)
> + netdev_err(dev, "Unable to remove port from SMID\n");
> }
>
> err = mlxsw_sp_port_remove_from_mid(mlxsw_sp_port, mid);
> --
> 2.17.0
>
next prev parent reply other threads:[~2018-04-24 12:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 11:51 [PATCH] mlxsw: spectrum_switchdev: remove duplicated check on multicast_enable Colin King
2018-04-24 11:51 ` Colin King
2018-04-24 12:51 ` Ido Schimmel [this message]
2018-04-24 12:51 ` Ido Schimmel
2018-04-24 12:55 ` Colin Ian King
2018-04-24 12:55 ` Colin Ian King
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=20180424125104.GA2461@splinter.mtl.com \
--to=idosch@idosch.org \
--cc=colin.king@canonical.com \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nogahf@mellanox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.