All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] mlx5e IPoIB stats
@ 2018-09-02 19:12 Tariq Toukan
  2018-09-02 19:12 ` [PATCH net-next 1/4] net/mlx5e: IPoIB, Initialize max_opened_tc in mlx5i_init flow Tariq Toukan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-09-02 19:12 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Eran Ben Elisha, Saeed Mahameed, Feras Daoud, Tariq Toukan

Hi Dave,

I am temporarily covering Saeed with the mlx5 submissions.

This patchset by Feras contains statistics enhancements and NDO
implementation for the mlx5e IPoIB driver.

Series generated against net-next commit:
2d5c28859839 net: bgmac: remove set but not used variable 'err'

Thanks,
Tariq.


Feras Daoud (4):
  net/mlx5e: IPoIB, Initialize max_opened_tc in mlx5i_init flow
  net/mlx5e: IPoIB, Add ndo stats support for IPoIB netdevices
  net/mlx5e: IPoIB, Add ndo stats support for IPoIB child devices
  net/mlx5e: IPoIB, Use priv stats in completion rx flow

 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    |  3 +-
 .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c  | 43 ++++++++++++++++++++++
 .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h  |  1 +
 .../ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c |  1 +
 4 files changed, 47 insertions(+), 1 deletion(-)

-- 
1.8.3.1

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

* [PATCH net-next 1/4] net/mlx5e: IPoIB, Initialize max_opened_tc in mlx5i_init flow
  2018-09-02 19:12 [PATCH net-next 0/4] mlx5e IPoIB stats Tariq Toukan
@ 2018-09-02 19:12 ` Tariq Toukan
  2018-09-02 19:12 ` [PATCH net-next 2/4] net/mlx5e: IPoIB, Add ndo stats support for IPoIB netdevices Tariq Toukan
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-09-02 19:12 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Eran Ben Elisha, Saeed Mahameed, Feras Daoud, Tariq Toukan

From: Feras Daoud <ferasda@mellanox.com>

Enhanced ipoib does not initialize max_opened_tc causing wrong ethtool
statistics. As mlx5e_grp_sw_update_stats relies on this variable, without
this change, the TX statistics will not be updated.

Fixes: 05909babce53 ("net/mlx5e: Avoid reset netdev stats on configuration changes")
Signed-off-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
index e3797a44e074..37a670b6a208 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
@@ -83,6 +83,7 @@ void mlx5i_init(struct mlx5_core_dev *mdev,
 	priv->netdev      = netdev;
 	priv->profile     = profile;
 	priv->ppriv       = ppriv;
+	priv->max_opened_tc = 1;
 	mutex_init(&priv->state_lock);
 
 	mlx5_query_port_max_mtu(mdev, &max_mtu, 1);
-- 
1.8.3.1

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

* [PATCH net-next 2/4] net/mlx5e: IPoIB, Add ndo stats support for IPoIB netdevices
  2018-09-02 19:12 [PATCH net-next 0/4] mlx5e IPoIB stats Tariq Toukan
  2018-09-02 19:12 ` [PATCH net-next 1/4] net/mlx5e: IPoIB, Initialize max_opened_tc in mlx5i_init flow Tariq Toukan
@ 2018-09-02 19:12 ` Tariq Toukan
  2018-09-02 19:12 ` [PATCH net-next 3/4] net/mlx5e: IPoIB, Add ndo stats support for IPoIB child devices Tariq Toukan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-09-02 19:12 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Eran Ben Elisha, Saeed Mahameed, Feras Daoud, Tariq Toukan

From: Feras Daoud <ferasda@mellanox.com>

Expose RX and TX counters by implementing ndo_get_stats64 operation for
both parent devices.
After this change, all the relevant statistics can be retrieved using
ifconfig.

Signed-off-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c  | 42 ++++++++++++++++++++++
 .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h  |  1 +
 2 files changed, 43 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
index 37a670b6a208..48886b3ed320 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
@@ -45,6 +45,7 @@
 static const struct net_device_ops mlx5i_netdev_ops = {
 	.ndo_open                = mlx5i_open,
 	.ndo_stop                = mlx5i_close,
+	.ndo_get_stats64         = mlx5i_get_stats,
 	.ndo_init                = mlx5i_dev_init,
 	.ndo_uninit              = mlx5i_dev_cleanup,
 	.ndo_change_mtu          = mlx5i_change_mtu,
@@ -115,6 +116,47 @@ static void mlx5i_cleanup(struct mlx5e_priv *priv)
 	/* Do nothing .. */
 }
 
+void mlx5i_grp_sw_update_stats(struct mlx5e_priv *priv)
+{
+	struct mlx5e_sw_stats s = { 0 };
+	int i, j;
+
+	for (i = 0; i < priv->profile->max_nch(priv->mdev); i++) {
+		struct mlx5e_channel_stats *channel_stats;
+		struct mlx5e_rq_stats *rq_stats;
+
+		channel_stats = &priv->channel_stats[i];
+		rq_stats = &channel_stats->rq;
+
+		s.rx_packets += rq_stats->packets;
+		s.rx_bytes   += rq_stats->bytes;
+
+		for (j = 0; j < priv->max_opened_tc; j++) {
+			struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j];
+
+			s.tx_packets           += sq_stats->packets;
+			s.tx_bytes             += sq_stats->bytes;
+			s.tx_queue_dropped     += sq_stats->dropped;
+		}
+	}
+
+	memcpy(&priv->stats.sw, &s, sizeof(s));
+}
+
+void mlx5i_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
+{
+	struct mlx5e_priv     *priv   = mlx5i_epriv(dev);
+	struct mlx5e_sw_stats *sstats = &priv->stats.sw;
+
+	mlx5i_grp_sw_update_stats(priv);
+
+	stats->rx_packets = sstats->rx_packets;
+	stats->rx_bytes   = sstats->rx_bytes;
+	stats->tx_packets = sstats->tx_packets;
+	stats->tx_bytes   = sstats->tx_bytes;
+	stats->tx_dropped = sstats->tx_queue_dropped;
+}
+
 int mlx5i_init_underlay_qp(struct mlx5e_priv *priv)
 {
 	struct mlx5_core_dev *mdev = priv->mdev;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h
index 08eac92fc26c..2e7fb829e1b0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h
@@ -121,6 +121,7 @@ static inline void mlx5i_sq_fetch_wqe(struct mlx5e_txqsq *sq,
 netdev_tx_t mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
 			  struct mlx5_av *av, u32 dqpn, u32 dqkey);
 void mlx5i_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
+void mlx5i_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats);
 
 #endif /* CONFIG_MLX5_CORE_IPOIB */
 #endif /* __MLX5E_IPOB_H__ */
-- 
1.8.3.1

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

* [PATCH net-next 3/4] net/mlx5e: IPoIB, Add ndo stats support for IPoIB child devices
  2018-09-02 19:12 [PATCH net-next 0/4] mlx5e IPoIB stats Tariq Toukan
  2018-09-02 19:12 ` [PATCH net-next 1/4] net/mlx5e: IPoIB, Initialize max_opened_tc in mlx5i_init flow Tariq Toukan
  2018-09-02 19:12 ` [PATCH net-next 2/4] net/mlx5e: IPoIB, Add ndo stats support for IPoIB netdevices Tariq Toukan
@ 2018-09-02 19:12 ` Tariq Toukan
  2018-09-02 19:12 ` [PATCH net-next 4/4] net/mlx5e: IPoIB, Use priv stats in completion rx flow Tariq Toukan
  2018-09-02 23:23 ` [PATCH net-next 0/4] mlx5e IPoIB stats David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-09-02 19:12 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Eran Ben Elisha, Saeed Mahameed, Feras Daoud, Tariq Toukan

From: Feras Daoud <ferasda@mellanox.com>

Expose RX and TX counters by implementing ndo_get_stats64 operation
for child devices.

Signed-off-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
index 54a188f41f90..e3e8a5f1ac9b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
@@ -146,6 +146,7 @@ struct net_device *mlx5i_pkey_get_netdev(struct net_device *netdev, u32 qpn)
 	.ndo_open                = mlx5i_pkey_open,
 	.ndo_stop                = mlx5i_pkey_close,
 	.ndo_init                = mlx5i_pkey_dev_init,
+	.ndo_get_stats64         = mlx5i_get_stats,
 	.ndo_uninit              = mlx5i_pkey_dev_cleanup,
 	.ndo_change_mtu          = mlx5i_pkey_change_mtu,
 	.ndo_do_ioctl            = mlx5i_pkey_ioctl,
-- 
1.8.3.1

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

* [PATCH net-next 4/4] net/mlx5e: IPoIB, Use priv stats in completion rx flow
  2018-09-02 19:12 [PATCH net-next 0/4] mlx5e IPoIB stats Tariq Toukan
                   ` (2 preceding siblings ...)
  2018-09-02 19:12 ` [PATCH net-next 3/4] net/mlx5e: IPoIB, Add ndo stats support for IPoIB child devices Tariq Toukan
@ 2018-09-02 19:12 ` Tariq Toukan
  2018-09-02 23:23 ` [PATCH net-next 0/4] mlx5e IPoIB stats David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-09-02 19:12 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Eran Ben Elisha, Saeed Mahameed, Feras Daoud, Tariq Toukan

From: Feras Daoud <ferasda@mellanox.com>

Since the RQs are shared between all pkey interfaces, the stats
should be taken from where the per-ring stats are stored instead
of the parent RQ.

Fixes: 4c6c615e3f30 ("net/mlx5e: IPoIB, Add PKEY child interface nic profile")
Signed-off-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 15d8ae28c040..6a959e8b1f9d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -1230,8 +1230,8 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
 					 u32 cqe_bcnt,
 					 struct sk_buff *skb)
 {
-	struct mlx5e_rq_stats *stats = rq->stats;
 	struct hwtstamp_config *tstamp;
+	struct mlx5e_rq_stats *stats;
 	struct net_device *netdev;
 	struct mlx5e_priv *priv;
 	char *pseudo_header;
@@ -1254,6 +1254,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
 
 	priv = mlx5i_epriv(netdev);
 	tstamp = &priv->tstamp;
+	stats = &priv->channel_stats[rq->ix].rq;
 
 	g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3;
 	dgid = skb->data + MLX5_IB_GRH_DGID_OFFSET;
-- 
1.8.3.1

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

* Re: [PATCH net-next 0/4] mlx5e IPoIB stats
  2018-09-02 19:12 [PATCH net-next 0/4] mlx5e IPoIB stats Tariq Toukan
                   ` (3 preceding siblings ...)
  2018-09-02 19:12 ` [PATCH net-next 4/4] net/mlx5e: IPoIB, Use priv stats in completion rx flow Tariq Toukan
@ 2018-09-02 23:23 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-09-02 23:23 UTC (permalink / raw)
  To: tariqt; +Cc: netdev, eranbe, saeedm, ferasda

From: Tariq Toukan <tariqt@mellanox.com>
Date: Sun,  2 Sep 2018 22:12:06 +0300

> I am temporarily covering Saeed with the mlx5 submissions.

Ok, thanks for letting me know.

> This patchset by Feras contains statistics enhancements and NDO
> implementation for the mlx5e IPoIB driver.
> 
> Series generated against net-next commit:
> 2d5c28859839 net: bgmac: remove set but not used variable 'err'

Series applied, thanks Tariq.

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

end of thread, other threads:[~2018-09-03  3:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-02 19:12 [PATCH net-next 0/4] mlx5e IPoIB stats Tariq Toukan
2018-09-02 19:12 ` [PATCH net-next 1/4] net/mlx5e: IPoIB, Initialize max_opened_tc in mlx5i_init flow Tariq Toukan
2018-09-02 19:12 ` [PATCH net-next 2/4] net/mlx5e: IPoIB, Add ndo stats support for IPoIB netdevices Tariq Toukan
2018-09-02 19:12 ` [PATCH net-next 3/4] net/mlx5e: IPoIB, Add ndo stats support for IPoIB child devices Tariq Toukan
2018-09-02 19:12 ` [PATCH net-next 4/4] net/mlx5e: IPoIB, Use priv stats in completion rx flow Tariq Toukan
2018-09-02 23:23 ` [PATCH net-next 0/4] mlx5e IPoIB stats David Miller

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.