netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next 0/3] mlxsw: Various fixes
@ 2017-10-24  9:17 Jiri Pirko
  2017-10-24  9:17 ` [patch net-next 1/3] mlxsw: spectrum: mr: Fix various endianness issues Jiri Pirko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jiri Pirko @ 2017-10-24  9:17 UTC (permalink / raw)
  To: netdev; +Cc: davem, yotamg, idosch, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

Yotam says:

Cleanup some issues reported by sparse.

Yotam Gigi (3):
  mlxsw: spectrum: mr: Fix various endianness issues
  mlxsw: spectrum: mr: Make the function mlxsw_sp_mr_dev_vif_lookup
    static
  mlxsw: spectrum: mr_tcam: Include the mr_tcam header file

 drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c      | 13 +++++++------
 drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c |  1 +
 2 files changed, 8 insertions(+), 6 deletions(-)

-- 
2.9.5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [patch net-next 1/3] mlxsw: spectrum: mr: Fix various endianness issues
  2017-10-24  9:17 [patch net-next 0/3] mlxsw: Various fixes Jiri Pirko
@ 2017-10-24  9:17 ` Jiri Pirko
  2017-10-24  9:17 ` [patch net-next 2/3] mlxsw: spectrum: mr: Make the function mlxsw_sp_mr_dev_vif_lookup static Jiri Pirko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2017-10-24  9:17 UTC (permalink / raw)
  To: netdev; +Cc: davem, yotamg, idosch, mlxsw

From: Yotam Gigi <yotamg@mellanox.com>

Fix various endianness issues in comparisons and assignments. The fix is
entirely cosmetic as all the values fixed are endianness-agnostic.

Cleans up sparse warnings:
spectrum_mr.c:156:49: warning: restricted __be32 degrades to integer
spectrum_mr.c:206:26: warning: restricted __be32 degrades to integer
spectrum_mr.c:212:31: warning: incorrect type in assignment (different
  base types)
spectrum_mr.c:212:31:    expected restricted __be32 [usertype] addr4
spectrum_mr.c:212:31:    got unsigned int
spectrum_mr.c:214:32: warning: incorrect type in assignment (different
  base types)
spectrum_mr.c:214:32:    expected restricted __be32 [usertype] addr4
spectrum_mr.c:214:32:    got unsigned int
spectrum_mr.c:461:16: warning: restricted __be32 degrades to integer
spectrum_mr.c:461:49: warning: restricted __be32 degrades to integer

Fixes: c011ec1bbfd6 ("mlxsw: spectrum: Add the multicast routing offloading logic")
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
index 1f84bb8..3f7d2d1 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
@@ -153,7 +153,7 @@ static bool mlxsw_sp_mr_route_starg(const struct mlxsw_sp_mr_route *mr_route)
 {
 	switch (mr_route->mr_table->proto) {
 	case MLXSW_SP_L3_PROTO_IPV4:
-		return mr_route->key.source_mask.addr4 == INADDR_ANY;
+		return mr_route->key.source_mask.addr4 == htonl(INADDR_ANY);
 	case MLXSW_SP_L3_PROTO_IPV6:
 		/* fall through */
 	default:
@@ -203,15 +203,15 @@ static void mlxsw_sp_mr_route4_key(struct mlxsw_sp_mr_table *mr_table,
 				   struct mlxsw_sp_mr_route_key *key,
 				   const struct mfc_cache *mfc)
 {
-	bool starg = (mfc->mfc_origin == INADDR_ANY);
+	bool starg = (mfc->mfc_origin == htonl(INADDR_ANY));
 
 	memset(key, 0, sizeof(*key));
 	key->vrid = mr_table->vr_id;
 	key->proto = mr_table->proto;
 	key->group.addr4 = mfc->mfc_mcastgrp;
-	key->group_mask.addr4 = 0xffffffff;
+	key->group_mask.addr4 = htonl(0xffffffff);
 	key->source.addr4 = mfc->mfc_origin;
-	key->source_mask.addr4 = starg ? 0 : 0xffffffff;
+	key->source_mask.addr4 = htonl(starg ? 0 : 0xffffffff);
 }
 
 static int mlxsw_sp_mr_route_evif_link(struct mlxsw_sp_mr_route *mr_route,
@@ -458,7 +458,8 @@ int mlxsw_sp_mr_route4_add(struct mlxsw_sp_mr_table *mr_table,
 	/* If the route is a (*,*) route, abort, as these kind of routes are
 	 * used for proxy routes.
 	 */
-	if (mfc->mfc_origin == INADDR_ANY && mfc->mfc_mcastgrp == INADDR_ANY) {
+	if (mfc->mfc_origin == htonl(INADDR_ANY) &&
+	    mfc->mfc_mcastgrp == htonl(INADDR_ANY)) {
 		dev_warn(mr_table->mlxsw_sp->bus_info->dev,
 			 "Offloading proxy routes is not supported.\n");
 		return -EINVAL;
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [patch net-next 2/3] mlxsw: spectrum: mr: Make the function mlxsw_sp_mr_dev_vif_lookup static
  2017-10-24  9:17 [patch net-next 0/3] mlxsw: Various fixes Jiri Pirko
  2017-10-24  9:17 ` [patch net-next 1/3] mlxsw: spectrum: mr: Fix various endianness issues Jiri Pirko
@ 2017-10-24  9:17 ` Jiri Pirko
  2017-10-24  9:17 ` [patch net-next 3/3] mlxsw: spectrum: mr_tcam: Include the mr_tcam header file Jiri Pirko
  2017-10-24 10:07 ` [patch net-next 0/3] mlxsw: Various fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2017-10-24  9:17 UTC (permalink / raw)
  To: netdev; +Cc: davem, yotamg, idosch, mlxsw

From: Yotam Gigi <yotamg@mellanox.com>

The function is only used internally in spectrum_mr.c and is not declared
in the header file, thus make it static.

Cleans up sparse warning:
symbol 'mlxsw_sp_mr_dev_vif_lookup' was not declared. Should it be static?

Fixes: c011ec1bbfd6 ("mlxsw: spectrum: Add the multicast routing offloading logic")
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
index 3f7d2d1..d20b143 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
@@ -768,7 +768,7 @@ void mlxsw_sp_mr_vif_del(struct mlxsw_sp_mr_table *mr_table, vifi_t vif_index)
 	mlxsw_sp_mr_vif_unresolve(mr_table, NULL, mr_vif);
 }
 
-struct mlxsw_sp_mr_vif *
+static struct mlxsw_sp_mr_vif *
 mlxsw_sp_mr_dev_vif_lookup(struct mlxsw_sp_mr_table *mr_table,
 			   const struct net_device *dev)
 {
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [patch net-next 3/3] mlxsw: spectrum: mr_tcam: Include the mr_tcam header file
  2017-10-24  9:17 [patch net-next 0/3] mlxsw: Various fixes Jiri Pirko
  2017-10-24  9:17 ` [patch net-next 1/3] mlxsw: spectrum: mr: Fix various endianness issues Jiri Pirko
  2017-10-24  9:17 ` [patch net-next 2/3] mlxsw: spectrum: mr: Make the function mlxsw_sp_mr_dev_vif_lookup static Jiri Pirko
@ 2017-10-24  9:17 ` Jiri Pirko
  2017-10-24 10:07 ` [patch net-next 0/3] mlxsw: Various fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2017-10-24  9:17 UTC (permalink / raw)
  To: netdev; +Cc: davem, yotamg, idosch, mlxsw

From: Yotam Gigi <yotamg@mellanox.com>

Make the spectrum_mr_tcam.c include the spectrum_mr_tcam.h header file.

Cleans up sparse warning:
symbol 'mlxsw_sp_mr_tcam_ops' was not declared. Should it be static?

Fixes: 0e14c7777acb6 ("mlxsw: spectrum: Add the multicast routing hardware logic")
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
index 39c21c7..34a0b63 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
@@ -37,6 +37,7 @@
 #include <linux/netdevice.h>
 #include <linux/parman.h>
 
+#include "spectrum_mr_tcam.h"
 #include "reg.h"
 #include "spectrum.h"
 #include "core_acl_flex_actions.h"
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [patch net-next 0/3] mlxsw: Various fixes
  2017-10-24  9:17 [patch net-next 0/3] mlxsw: Various fixes Jiri Pirko
                   ` (2 preceding siblings ...)
  2017-10-24  9:17 ` [patch net-next 3/3] mlxsw: spectrum: mr_tcam: Include the mr_tcam header file Jiri Pirko
@ 2017-10-24 10:07 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-10-24 10:07 UTC (permalink / raw)
  To: jiri; +Cc: netdev, yotamg, idosch, mlxsw

From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 24 Oct 2017 11:17:14 +0200

> From: Jiri Pirko <jiri@mellanox.com>
> 
> Yotam says:
> 
> Cleanup some issues reported by sparse.

Series applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-24 10:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-24  9:17 [patch net-next 0/3] mlxsw: Various fixes Jiri Pirko
2017-10-24  9:17 ` [patch net-next 1/3] mlxsw: spectrum: mr: Fix various endianness issues Jiri Pirko
2017-10-24  9:17 ` [patch net-next 2/3] mlxsw: spectrum: mr: Make the function mlxsw_sp_mr_dev_vif_lookup static Jiri Pirko
2017-10-24  9:17 ` [patch net-next 3/3] mlxsw: spectrum: mr_tcam: Include the mr_tcam header file Jiri Pirko
2017-10-24 10:07 ` [patch net-next 0/3] mlxsw: Various fixes David Miller

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).