Skip to content

Commit 8670f2a

Browse files
Sriharsha Basavapatnadavem330
authored andcommitted
be2net: Support vxlan offload stats in the driver
This patch adds vxlan offload specific counters to ethtool stats. We provide tx/rx queue counters to show the number of vxlan offload pkts sent/received. Signed-off-by: Sriharsha Basavapatna <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 05cc5a3 commit 8670f2a

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

drivers/net/ethernet/emulex/benet/be.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ struct be_mcc_obj {
230230
struct be_tx_stats {
231231
u64 tx_bytes;
232232
u64 tx_pkts;
233+
u64 tx_vxlan_offload_pkts;
233234
u64 tx_reqs;
234235
u64 tx_compl;
235236
ulong tx_jiffies;
@@ -277,6 +278,7 @@ struct be_rx_page_info {
277278
struct be_rx_stats {
278279
u64 rx_bytes;
279280
u64 rx_pkts;
281+
u64 rx_vxlan_offload_pkts;
280282
u32 rx_drops_no_skbs; /* skb allocation errors */
281283
u32 rx_drops_no_frags; /* HW has no fetched frags */
282284
u32 rx_post_fail; /* page post alloc failures */

drivers/net/ethernet/emulex/benet/be_ethtool.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ static const struct be_ethtool_stat et_stats[] = {
138138
static const struct be_ethtool_stat et_rx_stats[] = {
139139
{DRVSTAT_RX_INFO(rx_bytes)},/* If moving this member see above note */
140140
{DRVSTAT_RX_INFO(rx_pkts)}, /* If moving this member see above note */
141+
{DRVSTAT_RX_INFO(rx_vxlan_offload_pkts)},
141142
{DRVSTAT_RX_INFO(rx_compl)},
142143
{DRVSTAT_RX_INFO(rx_compl_err)},
143144
{DRVSTAT_RX_INFO(rx_mcast_pkts)},
@@ -190,6 +191,7 @@ static const struct be_ethtool_stat et_tx_stats[] = {
190191
{DRVSTAT_TX_INFO(tx_internal_parity_err)},
191192
{DRVSTAT_TX_INFO(tx_bytes)},
192193
{DRVSTAT_TX_INFO(tx_pkts)},
194+
{DRVSTAT_TX_INFO(tx_vxlan_offload_pkts)},
193195
/* Number of skbs queued for trasmission by the driver */
194196
{DRVSTAT_TX_INFO(tx_reqs)},
195197
/* Number of times the TX queue was stopped due to lack

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,14 @@ void be_link_status_update(struct be_adapter *adapter, u8 link_status)
677677
static void be_tx_stats_update(struct be_tx_obj *txo, struct sk_buff *skb)
678678
{
679679
struct be_tx_stats *stats = tx_stats(txo);
680+
u64 tx_pkts = skb_shinfo(skb)->gso_segs ? : 1;
680681

681682
u64_stats_update_begin(&stats->sync);
682683
stats->tx_reqs++;
683684
stats->tx_bytes += skb->len;
684-
stats->tx_pkts += (skb_shinfo(skb)->gso_segs ? : 1);
685+
stats->tx_pkts += tx_pkts;
686+
if (skb->encapsulation && skb->ip_summed == CHECKSUM_PARTIAL)
687+
stats->tx_vxlan_offload_pkts += tx_pkts;
685688
u64_stats_update_end(&stats->sync);
686689
}
687690

@@ -1957,6 +1960,8 @@ static void be_rx_stats_update(struct be_rx_obj *rxo,
19571960
stats->rx_compl++;
19581961
stats->rx_bytes += rxcp->pkt_size;
19591962
stats->rx_pkts++;
1963+
if (rxcp->tunneled)
1964+
stats->rx_vxlan_offload_pkts++;
19601965
if (rxcp->pkt_type == BE_MULTICAST_PACKET)
19611966
stats->rx_mcast_pkts++;
19621967
if (rxcp->err)

0 commit comments

Comments
 (0)