liquidio: Enhanced ethtool stats
authorIntiyaz Basha <intiyaz.basha@cavium.com>
Tue, 17 Apr 2018 06:30:53 +0000 (23:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Apr 2018 13:56:52 +0000 (09:56 -0400)
1. Added red_drops stats. Inbound packets dropped by RED, buffer exhaustion
2. Included fcs_err, jabber_err, l2_err and frame_err errors under
   rx_errors
3. Included fifo_err, dmac_drop, red_drops, fw_err_pko, fw_err_link and
   fw_err_drop under rx_dropped
4. Included max_collision_fail, max_deferral_fail, total_collisions,
   fw_err_pko, fw_err_link, fw_err_drop and fw_err_pki under tx_dropped
5. Counting dma mapping errors
6. Added some firmware stats description and removed for some

Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Acked-by: Derek Chickles <derek.chickles@cavium.com>
Acked-by: Satanand Burla <satananda.burla@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/liquidio_common.h
drivers/net/ethernet/cavium/liquidio/octeon_iq.h

index 550ac29682a5301373c186e480f76a851916d1dc..9926a12dd80512fa0d3b66d8b28f8473444eb9f5 100644 (file)
@@ -96,11 +96,9 @@ static const char oct_stats_strings[][ETH_GSTRING_LEN] = {
        "tx_packets",
        "rx_bytes",
        "tx_bytes",
-       "rx_errors",    /*jabber_err+l2_err+frame_err */
-       "tx_errors",    /*fw_err_pko+fw_err_link+fw_err_drop */
-       "rx_dropped",   /*st->fromwire.total_rcvd - st->fromwire.fw_total_rcvd +
-                        *st->fromwire.dmac_drop + st->fromwire.fw_err_drop
-                        */
+       "rx_errors",
+       "tx_errors",
+       "rx_dropped",
        "tx_dropped",
 
        "tx_total_sent",
@@ -119,7 +117,7 @@ static const char oct_stats_strings[][ETH_GSTRING_LEN] = {
        "mac_tx_total_bytes",
        "mac_tx_mcast_pkts",
        "mac_tx_bcast_pkts",
-       "mac_tx_ctl_packets",   /*oct->link_stats.fromhost.ctl_sent */
+       "mac_tx_ctl_packets",
        "mac_tx_total_collisions",
        "mac_tx_one_collision",
        "mac_tx_multi_collison",
@@ -170,17 +168,17 @@ static const char oct_vf_stats_strings[][ETH_GSTRING_LEN] = {
        "tx_packets",
        "rx_bytes",
        "tx_bytes",
-       "rx_errors", /* jabber_err + l2_err+frame_err */
-       "tx_errors", /* fw_err_pko + fw_err_link+fw_err_drop */
-       "rx_dropped", /* total_rcvd - fw_total_rcvd + dmac_drop + fw_err_drop */
+       "rx_errors",
+       "tx_errors",
+       "rx_dropped",
        "tx_dropped",
        "link_state_changes",
 };
 
 /* statistics of host tx queue */
 static const char oct_iq_stats_strings[][ETH_GSTRING_LEN] = {
-       "packets",              /*oct->instr_queue[iq_no]->stats.tx_done*/
-       "bytes",                /*oct->instr_queue[iq_no]->stats.tx_tot_bytes*/
+       "packets",
+       "bytes",
        "dropped",
        "iq_busy",
        "sgentry_sent",
@@ -197,13 +195,9 @@ static const char oct_iq_stats_strings[][ETH_GSTRING_LEN] = {
 
 /* statistics of host rx queue */
 static const char oct_droq_stats_strings[][ETH_GSTRING_LEN] = {
-       "packets",              /*oct->droq[oq_no]->stats.rx_pkts_received */
-       "bytes",                /*oct->droq[oq_no]->stats.rx_bytes_received */
-       "dropped",              /*oct->droq[oq_no]->stats.rx_dropped+
-                                *oct->droq[oq_no]->stats.dropped_nodispatch+
-                                *oct->droq[oq_no]->stats.dropped_toomany+
-                                *oct->droq[oq_no]->stats.dropped_nomem
-                                */
+       "packets",
+       "bytes",
+       "dropped",
        "dropped_nomem",
        "dropped_toomany",
        "fw_dropped",
@@ -1080,16 +1074,33 @@ lio_get_ethtool_stats(struct net_device *netdev,
        data[i++] = CVM_CAST64(netstats->rx_bytes);
        /*sum of oct->instr_queue[iq_no]->stats.tx_tot_bytes */
        data[i++] = CVM_CAST64(netstats->tx_bytes);
-       data[i++] = CVM_CAST64(netstats->rx_errors);
+       data[i++] = CVM_CAST64(netstats->rx_errors +
+                              oct_dev->link_stats.fromwire.fcs_err +
+                              oct_dev->link_stats.fromwire.jabber_err +
+                              oct_dev->link_stats.fromwire.l2_err +
+                              oct_dev->link_stats.fromwire.frame_err);
        data[i++] = CVM_CAST64(netstats->tx_errors);
        /*sum of oct->droq[oq_no]->stats->rx_dropped +
         *oct->droq[oq_no]->stats->dropped_nodispatch +
         *oct->droq[oq_no]->stats->dropped_toomany +
         *oct->droq[oq_no]->stats->dropped_nomem
         */
-       data[i++] = CVM_CAST64(netstats->rx_dropped);
+       data[i++] = CVM_CAST64(netstats->rx_dropped +
+                              oct_dev->link_stats.fromwire.fifo_err +
+                              oct_dev->link_stats.fromwire.dmac_drop +
+                              oct_dev->link_stats.fromwire.red_drops +
+                              oct_dev->link_stats.fromwire.fw_err_pko +
+                              oct_dev->link_stats.fromwire.fw_err_link +
+                              oct_dev->link_stats.fromwire.fw_err_drop);
        /*sum of oct->instr_queue[iq_no]->stats.tx_dropped */
-       data[i++] = CVM_CAST64(netstats->tx_dropped);
+       data[i++] = CVM_CAST64(netstats->tx_dropped +
+                              oct_dev->link_stats.fromhost.max_collision_fail +
+                              oct_dev->link_stats.fromhost.max_deferral_fail +
+                              oct_dev->link_stats.fromhost.total_collisions +
+                              oct_dev->link_stats.fromhost.fw_err_pko +
+                              oct_dev->link_stats.fromhost.fw_err_link +
+                              oct_dev->link_stats.fromhost.fw_err_drop +
+                              oct_dev->link_stats.fromhost.fw_err_pki);
 
        /* firmware tx stats */
        /*per_core_stats[cvmx_get_core_num()].link_stats[mdata->from_ifidx].
@@ -1798,6 +1809,7 @@ octnet_nic_stats_callback(struct octeon_device *oct_dev,
                rstats->jabber_err = rsp_rstats->jabber_err;
                rstats->l2_err    = rsp_rstats->l2_err;
                rstats->frame_err = rsp_rstats->frame_err;
+               rstats->red_drops = rsp_rstats->red_drops;
 
                /* RX firmware stats */
                rstats->fw_total_rcvd = rsp_rstats->fw_total_rcvd;
index 603a144d3d9c2afcbae25f9dcce89d7061da28aa..44c2a0c1bbdd1be48f4680a498031bc52d0b9ff8 100644 (file)
@@ -2585,6 +2585,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
                if (dma_mapping_error(&oct->pci_dev->dev, dptr)) {
                        dev_err(&oct->pci_dev->dev, "%s DMA mapping error 1\n",
                                __func__);
+                       stats->tx_dmamap_fail++;
                        return NETDEV_TX_BUSY;
                }
 
@@ -2624,6 +2625,7 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
                if (dma_mapping_error(&oct->pci_dev->dev, g->sg[0].ptr[0])) {
                        dev_err(&oct->pci_dev->dev, "%s DMA mapping error 2\n",
                                __func__);
+                       stats->tx_dmamap_fail++;
                        return NETDEV_TX_BUSY;
                }
                add_sg_size(&g->sg[0], (skb->len - skb->data_len), 0);
index 75eea83c7cc6ac27b508786bbe3ecc8dd76cd2c4..34a94daca590da91b2fcb0bb4a670f4cbfc802d5 100644 (file)
@@ -779,18 +779,24 @@ struct liquidio_if_cfg_info {
 /** Stats for each NIC port in RX direction. */
 struct nic_rx_stats {
        /* link-level stats */
-       u64 total_rcvd;
-       u64 bytes_rcvd;
-       u64 total_bcst;
-       u64 total_mcst;
-       u64 runts;
-       u64 ctl_rcvd;
-       u64 fifo_err;      /* Accounts for over/under-run of buffers */
-       u64 dmac_drop;
-       u64 fcs_err;
-       u64 jabber_err;
-       u64 l2_err;
-       u64 frame_err;
+       u64 total_rcvd;         /* Received packets */
+       u64 bytes_rcvd;         /* Octets of received packets */
+       u64 total_bcst;         /* Number of non-dropped L2 broadcast packets */
+       u64 total_mcst;         /* Number of non-dropped L2 multicast packets */
+       u64 runts;              /* Packets shorter than allowed */
+       u64 ctl_rcvd;           /* Received PAUSE packets */
+       u64 fifo_err;           /* Packets dropped due to RX FIFO full */
+       u64 dmac_drop;          /* Packets dropped by the DMAC filter */
+       u64 fcs_err;            /* Sum of fragment, overrun, and FCS errors */
+       u64 jabber_err;         /* Packets larger than allowed */
+       u64 l2_err;             /* Sum of DMA, parity, PCAM access, no memory,
+                                * buffer overflow, malformed L2 header or
+                                * length, oversize errors
+                                **/
+       u64 frame_err;          /* Sum of IPv4 and L4 checksum errors */
+       u64 red_drops;          /* Packets dropped by RED due to buffer
+                                * exhaustion
+                                **/
 
        /* firmware stats */
        u64 fw_total_rcvd;
@@ -806,11 +812,11 @@ struct nic_rx_stats {
        u64 fw_lro_pkts;   /* Number of packets that are LROed      */
        u64 fw_lro_octs;   /* Number of octets that are LROed       */
        u64 fw_total_lro;  /* Number of LRO packets formed          */
-       u64 fw_lro_aborts; /* Number of times lRO of packet aborted */
+       u64 fw_lro_aborts; /* Number of times LRO of packet aborted */
        u64 fw_lro_aborts_port;
        u64 fw_lro_aborts_seq;
        u64 fw_lro_aborts_tsval;
-       u64 fw_lro_aborts_timer;
+       u64 fw_lro_aborts_timer;        /* Timer setting error */
        /* intrmod: packet forward rate */
        u64 fwd_rate;
 };
@@ -818,18 +824,35 @@ struct nic_rx_stats {
 /** Stats for each NIC port in RX direction. */
 struct nic_tx_stats {
        /* link-level stats */
-       u64 total_pkts_sent;
-       u64 total_bytes_sent;
-       u64 mcast_pkts_sent;
-       u64 bcast_pkts_sent;
-       u64 ctl_sent;
-       u64 one_collision_sent;   /* Packets sent after one collision*/
-       u64 multi_collision_sent; /* Packets sent after multiple collision*/
-       u64 max_collision_fail;   /* Packets not sent due to max collisions */
-       u64 max_deferral_fail;   /* Packets not sent due to max deferrals */
-       u64 fifo_err;       /* Accounts for over/under-run of buffers */
-       u64 runts;
-       u64 total_collisions; /* Total number of collisions detected */
+       u64 total_pkts_sent;            /* Total frames sent on the interface */
+       u64 total_bytes_sent;           /* Total octets sent on the interface */
+       u64 mcast_pkts_sent;            /* Packets sent to the multicast DMAC */
+       u64 bcast_pkts_sent;            /* Packets sent to a broadcast DMAC */
+       u64 ctl_sent;                   /* Control/PAUSE packets sent */
+       u64 one_collision_sent;         /* Packets sent that experienced a
+                                        * single collision before successful
+                                        * transmission
+                                        **/
+       u64 multi_collision_sent;       /* Packets sent that experienced
+                                        * multiple collisions before successful
+                                        * transmission
+                                        **/
+       u64 max_collision_fail;         /* Packets dropped due to excessive
+                                        * collisions
+                                        **/
+       u64 max_deferral_fail;          /* Packets not sent due to max
+                                        * deferrals
+                                        **/
+       u64 fifo_err;                   /* Packets sent that experienced a
+                                        * transmit underflow and were
+                                        * truncated
+                                        **/
+       u64 runts;                      /* Packets sent with an octet count
+                                        * lessthan 64
+                                        **/
+       u64 total_collisions;           /* Packets dropped due to excessive
+                                        * collisions
+                                        **/
 
        /* firmware stats */
        u64 fw_total_sent;
index 81c98768294174a44d7150d4a6ee08938a90f5f3..5fed7b63223e94e07376a30f3c15565c333a1d38 100644 (file)
@@ -62,8 +62,8 @@ struct oct_iq_stats {
        u64 tx_tot_bytes;/**< Total count of bytes sento to network. */
        u64 tx_gso;  /* count of tso */
        u64 tx_vxlan; /* tunnel */
-       u64 tx_dmamap_fail;
-       u64 tx_restart;
+       u64 tx_dmamap_fail; /* Number of times dma mapping failed */
+       u64 tx_restart; /* Number of times this queue restarted */
 };
 
 #define OCT_IQ_STATS_SIZE   (sizeof(struct oct_iq_stats))