All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mlx5: fix psample_sample_packet link error
@ 2021-11-08 11:10 Arnd Bergmann
  2021-11-08 11:10 ` [PATCH 2/2] mlx5: fix mlx5i_grp_sw_update_stats() stack usage Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2021-11-08 11:10 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, David S. Miller, Jakub Kicinski
  Cc: Arnd Bergmann, Parav Pandit, Vu Pham, Tariq Toukan, Chris Mi,
	Vlad Buslov, Colin Ian King, caihuoqing, netdev, linux-rdma,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

When PSAMPLE is a loadable module, built-in drivers cannot use it:

aarch64-linux-ld: drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.o: in function `mlx5e_tc_sample_skb':
sample.c:(.text+0xd68): undefined reference to `psample_sample_packet'

Add the same dependency here that is used for MLXSW

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index 92056452a9e3..4ba1a78c6515 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -115,6 +115,7 @@ config MLX5_TC_CT
 config MLX5_TC_SAMPLE
 	bool "MLX5 TC sample offload support"
 	depends on MLX5_CLS_ACT
+	depends on PSAMPLE=y || PSAMPLE=n || MLX5_CORE=m
 	default y
 	help
 	  Say Y here if you want to support offloading sample rules via tc
-- 
2.29.2


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

* [PATCH 2/2] mlx5: fix mlx5i_grp_sw_update_stats() stack usage
  2021-11-08 11:10 [PATCH 1/2] mlx5: fix psample_sample_packet link error Arnd Bergmann
@ 2021-11-08 11:10 ` Arnd Bergmann
  2021-11-16 20:51   ` Saeed Mahameed
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2021-11-08 11:10 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, David S. Miller, Jakub Kicinski,
	Khalid Manaa, Tariq Toukan
  Cc: Arnd Bergmann, Maxim Mikityanskiy, Roi Dayan, Aya Levin,
	Maor Gottlieb, netdev, linux-rdma, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The mlx5e_sw_stats structure has grown to the point of triggering
a warning when put on the stack of a function:

mlx5/core/ipoib/ipoib.c: In function 'mlx5i_grp_sw_update_stats':
mlx5/core/ipoib/ipoib.c:136:1: error: the frame size of 1028 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

In this case, only five of the structure members are actually set,
so it's sufficient to have those as separate local variables.
As en_rep.c uses 'struct rtnl_link_stats64' for this, just use
the same one here for consistency.

Fixes: def09e7bbc3d ("net/mlx5e: Add HW_GRO statistics")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
index ea1efdecc88c..158958a49743 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
@@ -110,7 +110,7 @@ void mlx5i_cleanup(struct mlx5e_priv *priv)
 
 static void mlx5i_grp_sw_update_stats(struct mlx5e_priv *priv)
 {
-	struct mlx5e_sw_stats s = { 0 };
+	struct rtnl_link_stats64 s = {};
 	int i, j;
 
 	for (i = 0; i < priv->stats_nch; i++) {
@@ -128,11 +128,17 @@ static void mlx5i_grp_sw_update_stats(struct mlx5e_priv *priv)
 
 			s.tx_packets           += sq_stats->packets;
 			s.tx_bytes             += sq_stats->bytes;
-			s.tx_queue_dropped     += sq_stats->dropped;
+			s.tx_dropped 	       += sq_stats->dropped;
 		}
 	}
 
-	memcpy(&priv->stats.sw, &s, sizeof(s));
+	memset(&priv->stats.sw, 0, sizeof(s));
+
+	priv->stats.sw.rx_packets = s.rx_packets;
+	priv->stats.sw.rx_bytes = s.rx_bytes;
+	priv->stats.sw.tx_packets = s.tx_packets;
+	priv->stats.sw.tx_bytes = s.tx_bytes;
+	priv->stats.sw.tx_queue_dropped = s.tx_dropped;
 }
 
 void mlx5i_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
-- 
2.29.2


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

* Re: [PATCH 2/2] mlx5: fix mlx5i_grp_sw_update_stats() stack usage
  2021-11-08 11:10 ` [PATCH 2/2] mlx5: fix mlx5i_grp_sw_update_stats() stack usage Arnd Bergmann
@ 2021-11-16 20:51   ` Saeed Mahameed
  0 siblings, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2021-11-16 20:51 UTC (permalink / raw)
  To: Tariq Toukan, Khalid Manaa, arnd, davem, kuba, leon
  Cc: linux-rdma, Maxim Mikityanskiy, Roi Dayan, Maor Gottlieb,
	linux-kernel, arnd, netdev, Aya Levin

On Mon, 2021-11-08 at 12:10 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The mlx5e_sw_stats structure has grown to the point of triggering
> a warning when put on the stack of a function:
> 
> mlx5/core/ipoib/ipoib.c: In function 'mlx5i_grp_sw_update_stats':
> mlx5/core/ipoib/ipoib.c:136:1: error: the frame size of 1028 bytes is
> larger than 1024 bytes [-Werror=frame-larger-than=]
> 
> In this case, only five of the structure members are actually set,
> so it's sufficient to have those as separate local variables.
> As en_rep.c uses 'struct rtnl_link_stats64' for this, just use
> the same one here for consistency.
> 
> Fixes: def09e7bbc3d ("net/mlx5e: Add HW_GRO statistics")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Thanks Arnd, Both patches applied to net-next-mlx5,

Since I will be queuing them up for net-next, I will have to remove the
Fixes tags.



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

end of thread, other threads:[~2021-11-16 20:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 11:10 [PATCH 1/2] mlx5: fix psample_sample_packet link error Arnd Bergmann
2021-11-08 11:10 ` [PATCH 2/2] mlx5: fix mlx5i_grp_sw_update_stats() stack usage Arnd Bergmann
2021-11-16 20:51   ` Saeed Mahameed

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.