提交 7e15b90f 编写于 作者: E Eliezer Tamir 提交者: David S. Miller

ixgbe: add extra stats for ndo_ll_poll

Add additional statistics to the ixgbe driver for ndo_ll_poll
Defined under LL_EXTENDED_STATS
Signed-off-by: NAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: NEliezer Tamir <eliezer.tamir@linux.intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5a85e737
...@@ -54,6 +54,9 @@ ...@@ -54,6 +54,9 @@
#include <net/ll_poll.h> #include <net/ll_poll.h>
#ifdef CONFIG_NET_LL_RX_POLL
#define LL_EXTENDED_STATS
#endif
/* common prefix used by pr_<> macros */ /* common prefix used by pr_<> macros */
#undef pr_fmt #undef pr_fmt
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
...@@ -184,6 +187,11 @@ struct ixgbe_rx_buffer { ...@@ -184,6 +187,11 @@ struct ixgbe_rx_buffer {
struct ixgbe_queue_stats { struct ixgbe_queue_stats {
u64 packets; u64 packets;
u64 bytes; u64 bytes;
#ifdef LL_EXTENDED_STATS
u64 yields;
u64 misses;
u64 cleaned;
#endif /* LL_EXTENDED_STATS */
}; };
struct ixgbe_tx_queue_stats { struct ixgbe_tx_queue_stats {
...@@ -391,6 +399,9 @@ static inline bool ixgbe_qv_lock_napi(struct ixgbe_q_vector *q_vector) ...@@ -391,6 +399,9 @@ static inline bool ixgbe_qv_lock_napi(struct ixgbe_q_vector *q_vector)
WARN_ON(q_vector->state & IXGBE_QV_STATE_NAPI); WARN_ON(q_vector->state & IXGBE_QV_STATE_NAPI);
q_vector->state |= IXGBE_QV_STATE_NAPI_YIELD; q_vector->state |= IXGBE_QV_STATE_NAPI_YIELD;
rc = false; rc = false;
#ifdef LL_EXTENDED_STATS
q_vector->tx.ring->stats.yields++;
#endif
} else } else
/* we don't care if someone yielded */ /* we don't care if someone yielded */
q_vector->state = IXGBE_QV_STATE_NAPI; q_vector->state = IXGBE_QV_STATE_NAPI;
...@@ -421,6 +432,9 @@ static inline bool ixgbe_qv_lock_poll(struct ixgbe_q_vector *q_vector) ...@@ -421,6 +432,9 @@ static inline bool ixgbe_qv_lock_poll(struct ixgbe_q_vector *q_vector)
if ((q_vector->state & IXGBE_QV_LOCKED)) { if ((q_vector->state & IXGBE_QV_LOCKED)) {
q_vector->state |= IXGBE_QV_STATE_POLL_YIELD; q_vector->state |= IXGBE_QV_STATE_POLL_YIELD;
rc = false; rc = false;
#ifdef LL_EXTENDED_STATS
q_vector->rx.ring->stats.yields++;
#endif
} else } else
/* preserve yield marks */ /* preserve yield marks */
q_vector->state |= IXGBE_QV_STATE_POLL; q_vector->state |= IXGBE_QV_STATE_POLL;
......
...@@ -1054,6 +1054,12 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, ...@@ -1054,6 +1054,12 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
data[i] = 0; data[i] = 0;
data[i+1] = 0; data[i+1] = 0;
i += 2; i += 2;
#ifdef LL_EXTENDED_STATS
data[i] = 0;
data[i+1] = 0;
data[i+2] = 0;
i += 3;
#endif
continue; continue;
} }
...@@ -1063,6 +1069,12 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, ...@@ -1063,6 +1069,12 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
data[i+1] = ring->stats.bytes; data[i+1] = ring->stats.bytes;
} while (u64_stats_fetch_retry_bh(&ring->syncp, start)); } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
i += 2; i += 2;
#ifdef LL_EXTENDED_STATS
data[i] = ring->stats.yields;
data[i+1] = ring->stats.misses;
data[i+2] = ring->stats.cleaned;
i += 3;
#endif
} }
for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) { for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) {
ring = adapter->rx_ring[j]; ring = adapter->rx_ring[j];
...@@ -1070,6 +1082,12 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, ...@@ -1070,6 +1082,12 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
data[i] = 0; data[i] = 0;
data[i+1] = 0; data[i+1] = 0;
i += 2; i += 2;
#ifdef LL_EXTENDED_STATS
data[i] = 0;
data[i+1] = 0;
data[i+2] = 0;
i += 3;
#endif
continue; continue;
} }
...@@ -1079,6 +1097,12 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, ...@@ -1079,6 +1097,12 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
data[i+1] = ring->stats.bytes; data[i+1] = ring->stats.bytes;
} while (u64_stats_fetch_retry_bh(&ring->syncp, start)); } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
i += 2; i += 2;
#ifdef LL_EXTENDED_STATS
data[i] = ring->stats.yields;
data[i+1] = ring->stats.misses;
data[i+2] = ring->stats.cleaned;
i += 3;
#endif
} }
for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) { for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) {
...@@ -1115,12 +1139,28 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset, ...@@ -1115,12 +1139,28 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
p += ETH_GSTRING_LEN; p += ETH_GSTRING_LEN;
sprintf(p, "tx_queue_%u_bytes", i); sprintf(p, "tx_queue_%u_bytes", i);
p += ETH_GSTRING_LEN; p += ETH_GSTRING_LEN;
#ifdef LL_EXTENDED_STATS
sprintf(p, "tx_q_%u_napi_yield", i);
p += ETH_GSTRING_LEN;
sprintf(p, "tx_q_%u_misses", i);
p += ETH_GSTRING_LEN;
sprintf(p, "tx_q_%u_cleaned", i);
p += ETH_GSTRING_LEN;
#endif /* LL_EXTENDED_STATS */
} }
for (i = 0; i < IXGBE_NUM_RX_QUEUES; i++) { for (i = 0; i < IXGBE_NUM_RX_QUEUES; i++) {
sprintf(p, "rx_queue_%u_packets", i); sprintf(p, "rx_queue_%u_packets", i);
p += ETH_GSTRING_LEN; p += ETH_GSTRING_LEN;
sprintf(p, "rx_queue_%u_bytes", i); sprintf(p, "rx_queue_%u_bytes", i);
p += ETH_GSTRING_LEN; p += ETH_GSTRING_LEN;
#ifdef LL_EXTENDED_STATS
sprintf(p, "rx_q_%u_ll_poll_yield", i);
p += ETH_GSTRING_LEN;
sprintf(p, "rx_q_%u_misses", i);
p += ETH_GSTRING_LEN;
sprintf(p, "rx_q_%u_cleaned", i);
p += ETH_GSTRING_LEN;
#endif /* LL_EXTENDED_STATS */
} }
for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) { for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) {
sprintf(p, "tx_pb_%u_pxon", i); sprintf(p, "tx_pb_%u_pxon", i);
......
...@@ -2016,6 +2016,12 @@ static int ixgbe_low_latency_recv(struct napi_struct *napi) ...@@ -2016,6 +2016,12 @@ static int ixgbe_low_latency_recv(struct napi_struct *napi)
ixgbe_for_each_ring(ring, q_vector->rx) { ixgbe_for_each_ring(ring, q_vector->rx) {
found = ixgbe_clean_rx_irq(q_vector, ring, 4); found = ixgbe_clean_rx_irq(q_vector, ring, 4);
#ifdef LL_EXTENDED_STATS
if (found)
ring->stats.cleaned += found;
else
ring->stats.misses++;
#endif
if (found) if (found)
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册