i40e/i40evf: Add a stat to keep track of linearization count
authorAnjali Singhai Jain <anjali.singhai@intel.com>
Thu, 27 Aug 2015 15:42:29 +0000 (11:42 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 7 Oct 2015 21:35:45 +0000 (14:35 -0700)
Keep track of how many times we ask the stack to linearize the
skb because the HW cannot handle skbs with more than 8 frags per
segment/single packet.

Change-ID: If455452060963a769bbe6112cba952e79e944b52
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40e/i40e_txrx.h
drivers/net/ethernet/intel/i40evf/i40e_txrx.c
drivers/net/ethernet/intel/i40evf/i40e_txrx.h

index a54577af48848940d96a855c5c068a77efb4a292..681bd5d37960daae8783cd7e09c3cad80f9c0123 100644 (file)
@@ -475,6 +475,7 @@ struct i40e_vsi {
 #endif
        u32 tx_restart;
        u32 tx_busy;
+       u64 tx_linearize;
        u32 rx_buf_failed;
        u32 rx_page_failed;
 
index 1fa38f6e0e194fc46511f0b297b020cf309bcd75..ffa943164b42c916214e825dab5131b851651b0d 100644 (file)
@@ -87,6 +87,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {
        I40E_VSI_STAT("rx_broadcast", eth_stats.rx_broadcast),
        I40E_VSI_STAT("tx_broadcast", eth_stats.tx_broadcast),
        I40E_VSI_STAT("rx_unknown_protocol", eth_stats.rx_unknown_protocol),
+       I40E_VSI_STAT("tx_linearize", tx_linearize),
 };
 
 static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
index 84f9dd91f354ae22b5d6c4acb60884082a8a0a01..fb4b34db1ff53ae9da143b249bc7082774d9f1f4 100644 (file)
@@ -879,6 +879,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
        u32 rx_page, rx_buf;
        u64 bytes, packets;
        unsigned int start;
+       u64 tx_linearize;
        u64 rx_p, rx_b;
        u64 tx_p, tx_b;
        u16 q;
@@ -897,7 +898,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
         */
        rx_b = rx_p = 0;
        tx_b = tx_p = 0;
-       tx_restart = tx_busy = 0;
+       tx_restart = tx_busy = tx_linearize = 0;
        rx_page = 0;
        rx_buf = 0;
        rcu_read_lock();
@@ -914,6 +915,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
                tx_p += packets;
                tx_restart += p->tx_stats.restart_queue;
                tx_busy += p->tx_stats.tx_busy;
+               tx_linearize += p->tx_stats.tx_linearize;
 
                /* Rx queue is part of the same block as Tx queue */
                p = &p[1];
@@ -930,6 +932,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
        rcu_read_unlock();
        vsi->tx_restart = tx_restart;
        vsi->tx_busy = tx_busy;
+       vsi->tx_linearize = tx_linearize;
        vsi->rx_page_failed = rx_page;
        vsi->rx_buf_failed = rx_buf;
 
index 85e61b004f2cc43c99634f7f11a299b68ec48d29..889ed10f588b18612f5338c369d7fadbef3d308e 100644 (file)
@@ -2771,10 +2771,11 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
        if (tsyn)
                tx_flags |= I40E_TX_FLAGS_TSYN;
 
-       if (i40e_chk_linearize(skb, tx_flags))
+       if (i40e_chk_linearize(skb, tx_flags)) {
                if (skb_linearize(skb))
                        goto out_drop;
-
+               tx_ring->tx_stats.tx_linearize++;
+       }
        skb_tx_timestamp(skb);
 
        /* always enable CRC insertion offload */
index 7c9975c983d9f042b28fdbf730ff1302fe75945d..ac3fb3a6f42dd22b6b6610d19a8900fa7362de31 100644 (file)
@@ -188,6 +188,7 @@ struct i40e_tx_queue_stats {
        u64 restart_queue;
        u64 tx_busy;
        u64 tx_done_old;
+       u64 tx_linearize;
 };
 
 struct i40e_rx_queue_stats {
index 0e1a4d6e4e6e48a73d79ce911e96a606300acd4b..3b102f209a96842ed893983d0d885c2e5ec5c295 100644 (file)
@@ -1927,10 +1927,11 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
        else if (tso)
                tx_flags |= I40E_TX_FLAGS_TSO;
 
-       if (i40e_chk_linearize(skb, tx_flags))
+       if (i40e_chk_linearize(skb, tx_flags)) {
                if (skb_linearize(skb))
                        goto out_drop;
-
+               tx_ring->tx_stats.tx_linearize++;
+       }
        skb_tx_timestamp(skb);
 
        /* always enable CRC insertion offload */
index d5cb7aca87b408ce1a8f45533bff9f8486cdc171..93b90f7e8e8606b60cdca63ad2e58ddea30148de 100644 (file)
@@ -187,6 +187,7 @@ struct i40e_tx_queue_stats {
        u64 restart_queue;
        u64 tx_busy;
        u64 tx_done_old;
+       u64 tx_linearize;
 };
 
 struct i40e_rx_queue_stats {