Commit 5e316a81 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by David S. Miller

net: veth: make PAGE_POOL_STATS optional

Since veth is very likely to be enabled and there are some drivers
(e.g. mlx5) where CONFIG_PAGE_POOL_STATS is optional, make
CONFIG_PAGE_POOL_STATS optional for veth too in order to keep it
optional instead of required.
Suggested-by: default avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Acked-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
Acked-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 65718c4d
...@@ -403,7 +403,6 @@ config TUN_VNET_CROSS_LE ...@@ -403,7 +403,6 @@ config TUN_VNET_CROSS_LE
config VETH config VETH
tristate "Virtual ethernet pair device" tristate "Virtual ethernet pair device"
select PAGE_POOL select PAGE_POOL
select PAGE_POOL_STATS
help help
This device is a local ethernet tunnel. Devices are created in pairs. This device is a local ethernet tunnel. Devices are created in pairs.
When one end receives the packet it appears on its pair and vice When one end receives the packet it appears on its pair and vice
......
...@@ -176,12 +176,27 @@ static int veth_get_sset_count(struct net_device *dev, int sset) ...@@ -176,12 +176,27 @@ static int veth_get_sset_count(struct net_device *dev, int sset)
} }
} }
static void veth_get_page_pool_stats(struct net_device *dev, u64 *data)
{
#ifdef CONFIG_PAGE_POOL_STATS
struct veth_priv *priv = netdev_priv(dev);
struct page_pool_stats pp_stats = {};
int i;
for (i = 0; i < dev->real_num_rx_queues; i++) {
if (!priv->rq[i].page_pool)
continue;
page_pool_get_stats(priv->rq[i].page_pool, &pp_stats);
}
page_pool_ethtool_stats_get(data, &pp_stats);
#endif /* CONFIG_PAGE_POOL_STATS */
}
static void veth_get_ethtool_stats(struct net_device *dev, static void veth_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data) struct ethtool_stats *stats, u64 *data)
{ {
struct veth_priv *rcv_priv, *priv = netdev_priv(dev); struct veth_priv *rcv_priv, *priv = netdev_priv(dev);
struct net_device *peer = rtnl_dereference(priv->peer); struct net_device *peer = rtnl_dereference(priv->peer);
struct page_pool_stats pp_stats = {};
int i, j, idx, pp_idx; int i, j, idx, pp_idx;
data[0] = peer ? peer->ifindex : 0; data[0] = peer ? peer->ifindex : 0;
...@@ -225,12 +240,7 @@ static void veth_get_ethtool_stats(struct net_device *dev, ...@@ -225,12 +240,7 @@ static void veth_get_ethtool_stats(struct net_device *dev,
} }
page_pool_stats: page_pool_stats:
for (i = 0; i < dev->real_num_rx_queues; i++) { veth_get_page_pool_stats(dev, &data[pp_idx]);
if (!priv->rq[i].page_pool)
continue;
page_pool_get_stats(priv->rq[i].page_pool, &pp_stats);
}
page_pool_ethtool_stats_get(&data[pp_idx], &pp_stats);
} }
static void veth_get_channels(struct net_device *dev, static void veth_get_channels(struct net_device *dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment