* [PATCH net-next 0/4] mlx4_en misc for 4.17
@ 2018-02-27 14:17 Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 1/4] net/mlx4_en: Add physical RX/TX bytes/packets counters Tariq Toukan
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-02-27 14:17 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan
Hi Dave,
This patchset contains misc enhancements from the team
to the mlx4 Eth driver.
Patch 1 by Eran adds physical layer counters.
Patch 2 by Eran cleans-up a redundant warn print.
Patch 3 combines the checks of two end cases into a single if statement.
Patch 4 takes common code structures out of the #ifdef, following your
comment on a previous patch.
Series generated against net-next commit:
f74290fdb363 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Thanks,
Tariq.
Eran Ben Elisha (2):
net/mlx4_en: Add physical RX/TX bytes/packets counters
net/mlx4_en: Remove unnecessary warn print in reset config
Tariq Toukan (2):
net/mlx4_en: Combine checks of end-cases in RX completion function
net/mlx4_en: RX csum, pre-define enabled protocols for IP status
masking
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 14 +++++++++
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 8 +++---
drivers/net/ethernet/mellanox/mlx4/en_port.c | 38 ++++++++++++++++---------
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 18 ++++++------
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 +
drivers/net/ethernet/mellanox/mlx4/mlx4_stats.h | 10 ++++++-
6 files changed, 61 insertions(+), 28 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/4] net/mlx4_en: Add physical RX/TX bytes/packets counters
2018-02-27 14:17 [PATCH net-next 0/4] mlx4_en misc for 4.17 Tariq Toukan
@ 2018-02-27 14:17 ` Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 2/4] net/mlx4_en: Remove unnecessary warn print in reset config Tariq Toukan
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-02-27 14:17 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan
From: Eran Ben Elisha <eranbe@mellanox.com>
Add physical RX/TX packets/bytes counters into ethtool output to monitor
all traffic that was received and transmitted on the port. These
counters are available only for none Virtual Function.
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 14 +++++++++
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 4 +++
drivers/net/ethernet/mellanox/mlx4/en_port.c | 38 ++++++++++++++++---------
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 +
drivers/net/ethernet/mellanox/mlx4/mlx4_stats.h | 10 ++++++-
5 files changed, 53 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index ebc1f566a4d9..9a7a2f05ab35 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -199,6 +199,10 @@ static int mlx4_en_moderation_update(struct mlx4_en_priv *priv)
"rx_xdp_drop",
"rx_xdp_tx",
"rx_xdp_tx_full",
+
+ /* phy statistics */
+ "rx_packets_phy", "rx_bytes_phy",
+ "tx_packets_phy", "tx_bytes_phy",
};
static const char mlx4_en_test_names[][ETH_GSTRING_LEN]= {
@@ -411,6 +415,10 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev,
if (bitmap_iterator_test(&it))
data[index++] = ((unsigned long *)&priv->xdp_stats)[i];
+ for (i = 0; i < NUM_PHY_STATS; i++, bitmap_iterator_inc(&it))
+ if (bitmap_iterator_test(&it))
+ data[index++] = ((unsigned long *)&priv->phy_stats)[i];
+
for (i = 0; i < priv->tx_ring_num[TX]; i++) {
data[index++] = priv->tx_ring[TX][i]->packets;
data[index++] = priv->tx_ring[TX][i]->bytes;
@@ -490,6 +498,12 @@ static void mlx4_en_get_strings(struct net_device *dev,
strcpy(data + (index++) * ETH_GSTRING_LEN,
main_strings[strings]);
+ for (i = 0; i < NUM_PHY_STATS; i++, strings++,
+ bitmap_iterator_inc(&it))
+ if (bitmap_iterator_test(&it))
+ strcpy(data + (index++) * ETH_GSTRING_LEN,
+ main_strings[strings]);
+
for (i = 0; i < priv->tx_ring_num[TX]; i++) {
sprintf(data + (index++) * ETH_GSTRING_LEN,
"tx%d_packets", i);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 8fc51bc29003..b62d2c3f976a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -3256,6 +3256,10 @@ void mlx4_en_set_stats_bitmap(struct mlx4_dev *dev,
bitmap_set(stats_bitmap->bitmap, last_i, NUM_XDP_STATS);
last_i += NUM_XDP_STATS;
+
+ if (!mlx4_is_slave(dev))
+ bitmap_set(stats_bitmap->bitmap, last_i, NUM_PHY_STATS);
+ last_i += NUM_PHY_STATS;
}
int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_port.c b/drivers/net/ethernet/mellanox/mlx4/en_port.c
index 1fa4849a6f56..0158b88bea5b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_port.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_port.c
@@ -275,19 +275,31 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
priv->port_stats.xmit_more += READ_ONCE(ring->xmit_more);
}
- if (mlx4_is_master(mdev->dev)) {
- stats->rx_packets = en_stats_adder(&mlx4_en_stats->RTOT_prio_0,
- &mlx4_en_stats->RTOT_prio_1,
- NUM_PRIORITIES);
- stats->tx_packets = en_stats_adder(&mlx4_en_stats->TTOT_prio_0,
- &mlx4_en_stats->TTOT_prio_1,
- NUM_PRIORITIES);
- stats->rx_bytes = en_stats_adder(&mlx4_en_stats->ROCT_prio_0,
- &mlx4_en_stats->ROCT_prio_1,
- NUM_PRIORITIES);
- stats->tx_bytes = en_stats_adder(&mlx4_en_stats->TOCT_prio_0,
- &mlx4_en_stats->TOCT_prio_1,
- NUM_PRIORITIES);
+ if (!mlx4_is_slave(mdev->dev)) {
+ struct mlx4_en_phy_stats *p_stats = &priv->phy_stats;
+
+ p_stats->rx_packets_phy =
+ en_stats_adder(&mlx4_en_stats->RTOT_prio_0,
+ &mlx4_en_stats->RTOT_prio_1,
+ NUM_PRIORITIES);
+ p_stats->tx_packets_phy =
+ en_stats_adder(&mlx4_en_stats->TTOT_prio_0,
+ &mlx4_en_stats->TTOT_prio_1,
+ NUM_PRIORITIES);
+ p_stats->rx_bytes_phy =
+ en_stats_adder(&mlx4_en_stats->ROCT_prio_0,
+ &mlx4_en_stats->ROCT_prio_1,
+ NUM_PRIORITIES);
+ p_stats->tx_bytes_phy =
+ en_stats_adder(&mlx4_en_stats->TOCT_prio_0,
+ &mlx4_en_stats->TOCT_prio_1,
+ NUM_PRIORITIES);
+ if (mlx4_is_master(mdev->dev)) {
+ stats->rx_packets = p_stats->rx_packets_phy;
+ stats->tx_packets = p_stats->tx_packets_phy;
+ stats->rx_bytes = p_stats->rx_bytes_phy;
+ stats->tx_bytes = p_stats->tx_bytes_phy;
+ }
}
/* net device stats */
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index f470ae37d937..f7c81133594f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -608,6 +608,7 @@ struct mlx4_en_priv {
struct mlx4_en_flow_stats_tx tx_flowstats;
struct mlx4_en_port_stats port_stats;
struct mlx4_en_xdp_stats xdp_stats;
+ struct mlx4_en_phy_stats phy_stats;
struct mlx4_en_stats_bitmap stats_bitmap;
struct list_head mc_list;
struct list_head curr_list;
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_stats.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_stats.h
index aab28eb27a30..86b6051da8ec 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_stats.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_stats.h
@@ -63,6 +63,14 @@ struct mlx4_en_xdp_stats {
#define NUM_XDP_STATS 3
};
+struct mlx4_en_phy_stats {
+ unsigned long rx_packets_phy;
+ unsigned long rx_bytes_phy;
+ unsigned long tx_packets_phy;
+ unsigned long tx_bytes_phy;
+#define NUM_PHY_STATS 4
+};
+
#define NUM_MAIN_STATS 21
#define MLX4_NUM_PRIORITIES 8
@@ -116,7 +124,7 @@ enum {
#define NUM_ALL_STATS (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + \
NUM_FLOW_STATS + NUM_PERF_STATS + NUM_PF_STATS + \
- NUM_XDP_STATS)
+ NUM_XDP_STATS + NUM_PHY_STATS)
#define MLX4_FIND_NETDEV_STAT(n) (offsetof(struct net_device_stats, n) / \
sizeof(((struct net_device_stats *)0)->n))
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/4] net/mlx4_en: Remove unnecessary warn print in reset config
2018-02-27 14:17 [PATCH net-next 0/4] mlx4_en misc for 4.17 Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 1/4] net/mlx4_en: Add physical RX/TX bytes/packets counters Tariq Toukan
@ 2018-02-27 14:17 ` Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 3/4] net/mlx4_en: Combine checks of end-cases in RX completion function Tariq Toukan
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-02-27 14:17 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan
From: Eran Ben Elisha <eranbe@mellanox.com>
In mlx4_en_reset_config, there was a redundant warn print that was left
from previous versions of this function. No warn is needed anymore.
This warn can be confusing when RX-FCS is changed:
Turn OFF RX-FCS:
mlx4_en: eth1: Changing device configuration rx filter(0) rx vlan(1)
Turn ON RX-FCS:
mlx4_en: eth1: Changing device configuration rx filter(0) rx vlan(1)
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index b62d2c3f976a..e0adac4a9a19 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -3634,10 +3634,6 @@ int mlx4_en_reset_config(struct net_device *dev,
mlx4_en_stop_port(dev, 1);
}
- en_warn(priv, "Changing device configuration rx filter(%x) rx vlan(%x)\n",
- ts_config.rx_filter,
- !!(features & NETIF_F_HW_VLAN_CTAG_RX));
-
mlx4_en_safe_replace_resources(priv, tmp);
if (DEV_FEATURE_CHANGED(dev, features, NETIF_F_HW_VLAN_CTAG_RX)) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 3/4] net/mlx4_en: Combine checks of end-cases in RX completion function
2018-02-27 14:17 [PATCH net-next 0/4] mlx4_en misc for 4.17 Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 1/4] net/mlx4_en: Add physical RX/TX bytes/packets counters Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 2/4] net/mlx4_en: Remove unnecessary warn print in reset config Tariq Toukan
@ 2018-02-27 14:17 ` Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 4/4] net/mlx4_en: RX csum, pre-define enabled protocols for IP status masking Tariq Toukan
2018-02-27 19:55 ` [PATCH net-next 0/4] mlx4_en misc for 4.17 David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-02-27 14:17 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan
Combine two end-cases in the same if statement with a single return value.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index b4d144e67514..1e8f21b7fed8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -662,12 +662,9 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
int polled = 0;
int index;
- if (unlikely(!priv->port_up))
+ if (unlikely(!priv->port_up || budget <= 0))
return 0;
- if (unlikely(budget <= 0))
- return polled;
-
ring = priv->rx_ring[cq_ring];
/* Protect accesses to: ring->xdp_prog, priv->mac_hash list */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 4/4] net/mlx4_en: RX csum, pre-define enabled protocols for IP status masking
2018-02-27 14:17 [PATCH net-next 0/4] mlx4_en misc for 4.17 Tariq Toukan
` (2 preceding siblings ...)
2018-02-27 14:17 ` [PATCH net-next 3/4] net/mlx4_en: Combine checks of end-cases in RX completion function Tariq Toukan
@ 2018-02-27 14:17 ` Tariq Toukan
2018-02-27 19:55 ` [PATCH net-next 0/4] mlx4_en misc for 4.17 David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2018-02-27 14:17 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eran Ben Elisha, Tariq Toukan
Pre-define a mask for IP status of a completion, that tests the
MLX4_CQE_STATUS_IPV6 only in case CONFIG_IPV6 is enabled.
Use it for IP status testing upon completion, instead of separating
the datapath into two flows.
This takes common code structures (such as closing parenthesis)
back to their original place, and makes code more readable.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Suggested-by: David S. Miller <davem@davemloft.net>
---
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 1e8f21b7fed8..c2c6bd7578fd 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -649,6 +649,12 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
return get_fixed_ipv4_csum(hw_checksum, skb, hdr);
}
+#if IS_ENABLED(CONFIG_IPV6)
+#define MLX4_CQE_STATUS_IP_ANY (MLX4_CQE_STATUS_IPV4 | MLX4_CQE_STATUS_IPV6)
+#else
+#define MLX4_CQE_STATUS_IP_ANY (MLX4_CQE_STATUS_IPV4)
+#endif
+
int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int budget)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
@@ -835,12 +841,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
ring->csum_ok++;
} else {
if (!(priv->flags & MLX4_EN_FLAG_RX_CSUM_NON_TCP_UDP &&
- (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4 |
-#if IS_ENABLED(CONFIG_IPV6)
- MLX4_CQE_STATUS_IPV6))))
-#else
- 0))))
-#endif
+ (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IP_ANY))))
goto csum_none;
if (check_csum(cqe, skb, va, dev->features))
goto csum_none;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/4] mlx4_en misc for 4.17
2018-02-27 14:17 [PATCH net-next 0/4] mlx4_en misc for 4.17 Tariq Toukan
` (3 preceding siblings ...)
2018-02-27 14:17 ` [PATCH net-next 4/4] net/mlx4_en: RX csum, pre-define enabled protocols for IP status masking Tariq Toukan
@ 2018-02-27 19:55 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-02-27 19:55 UTC (permalink / raw)
To: tariqt; +Cc: netdev, eranbe
From: Tariq Toukan <tariqt@mellanox.com>
Date: Tue, 27 Feb 2018 16:17:18 +0200
> This patchset contains misc enhancements from the team
> to the mlx4 Eth driver.
>
> Patch 1 by Eran adds physical layer counters.
> Patch 2 by Eran cleans-up a redundant warn print.
> Patch 3 combines the checks of two end cases into a single if statement.
> Patch 4 takes common code structures out of the #ifdef, following your
> comment on a previous patch.
>
> Series generated against net-next commit:
> f74290fdb363 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Series applied, thanks Tariq.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-02-27 19:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-27 14:17 [PATCH net-next 0/4] mlx4_en misc for 4.17 Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 1/4] net/mlx4_en: Add physical RX/TX bytes/packets counters Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 2/4] net/mlx4_en: Remove unnecessary warn print in reset config Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 3/4] net/mlx4_en: Combine checks of end-cases in RX completion function Tariq Toukan
2018-02-27 14:17 ` [PATCH net-next 4/4] net/mlx4_en: RX csum, pre-define enabled protocols for IP status masking Tariq Toukan
2018-02-27 19:55 ` [PATCH net-next 0/4] mlx4_en misc for 4.17 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).