Author: mw
Date: Tue May 26 15:31:28 2020
New Revision: 361512
URL: https://svnweb.freebsd.org/changeset/base/361512

Log:
  Enable Tx drops reporting in the ENA driver
  
  Tx drops statistics are fetched from HW every ena_keepalive_wd() call
  and are observable using one of the commands:
  * sysctl dev.ena.0.hw_stats.tx_drops
  * netstat -I ena0 -d
  
  Submitted by:  Maciej Bielski <m...@semihalf.com>
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h
  head/sys/dev/ena/ena_sysctl.c

Modified: head/sys/dev/ena/ena.c
==============================================================================
--- head/sys/dev/ena/ena.c      Tue May 26 15:29:19 2020        (r361511)
+++ head/sys/dev/ena/ena.c      Tue May 26 15:31:28 2020        (r361512)
@@ -1888,6 +1888,8 @@ ena_get_counter(if_t ifp, ift_counter cnt)
                return (counter_u64_fetch(stats->tx_bytes));
        case IFCOUNTER_IQDROPS:
                return (counter_u64_fetch(stats->rx_drops));
+       case IFCOUNTER_OQDROPS:
+               return (counter_u64_fetch(stats->tx_drops));
        default:
                return (if_get_counter_default(ifp, cnt));
        }
@@ -2710,12 +2712,16 @@ static void ena_keep_alive_wd(void *adapter_data,
        struct ena_admin_aenq_keep_alive_desc *desc;
        sbintime_t stime;
        uint64_t rx_drops;
+       uint64_t tx_drops;
 
        desc = (struct ena_admin_aenq_keep_alive_desc *)aenq_e;
 
        rx_drops = ((uint64_t)desc->rx_drops_high << 32) | desc->rx_drops_low;
+       tx_drops = ((uint64_t)desc->tx_drops_high << 32) | desc->tx_drops_low;
        counter_u64_zero(adapter->hw_stats.rx_drops);
        counter_u64_add(adapter->hw_stats.rx_drops, rx_drops);
+       counter_u64_zero(adapter->hw_stats.tx_drops);
+       counter_u64_add(adapter->hw_stats.tx_drops, tx_drops);
 
        stime = getsbinuptime();
        atomic_store_rel_64(&adapter->keep_alive_timestamp, stime);

Modified: head/sys/dev/ena/ena.h
==============================================================================
--- head/sys/dev/ena/ena.h      Tue May 26 15:29:19 2020        (r361511)
+++ head/sys/dev/ena/ena.h      Tue May 26 15:31:28 2020        (r361512)
@@ -380,6 +380,7 @@ struct ena_hw_stats {
        counter_u64_t tx_bytes;
 
        counter_u64_t rx_drops;
+       counter_u64_t tx_drops;
 };
 
 /* Board specific private data structure */

Modified: head/sys/dev/ena/ena_sysctl.c
==============================================================================
--- head/sys/dev/ena/ena_sysctl.c       Tue May 26 15:29:19 2020        
(r361511)
+++ head/sys/dev/ena/ena_sysctl.c       Tue May 26 15:31:28 2020        
(r361512)
@@ -267,6 +267,8 @@ ena_sysctl_add_stats(struct ena_adapter *adapter)
            &hw_stats->tx_bytes, "Bytes transmitted");
        SYSCTL_ADD_COUNTER_U64(ctx, hw_list, OID_AUTO, "rx_drops", CTLFLAG_RD,
            &hw_stats->rx_drops, "Receive packet drops");
+       SYSCTL_ADD_COUNTER_U64(ctx, hw_list, OID_AUTO, "tx_drops", CTLFLAG_RD,
+           &hw_stats->tx_drops, "Transmit packet drops");
 
        /* ENA Admin queue stats */
        admin_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "admin_stats",
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to