aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@emulex.com>2013-10-01 06:30:01 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-01 12:45:52 -0400
commitbc617526db53246648a6690645572829bcc21a12 (patch)
tree7adee253bbdef48df13bfd146873e6ea1bb748e9
parent2632bafd74ae7d058ae52be80e6393139fd29f23 (diff)
be2net: add a counter for pkts dropped in xmit path
In the xmit path, the driver may drop some pkts due to reasons such as DMA mapping errors, out of memory conditions or to protect HW from unrecoverable errors. Add a counter in TX-stats for such drops. Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_ethtool.c4
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c5
3 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index e7cbc56a0c8f..21b064feaa4e 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -225,6 +225,7 @@ struct be_tx_stats {
225 u64 tx_compl; 225 u64 tx_compl;
226 ulong tx_jiffies; 226 ulong tx_jiffies;
227 u32 tx_stops; 227 u32 tx_stops;
228 u32 tx_drv_drops; /* pkts dropped by driver */
228 struct u64_stats_sync sync; 229 struct u64_stats_sync sync;
229 struct u64_stats_sync sync_compl; 230 struct u64_stats_sync sync_compl;
230}; 231};
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index a08783c7456e..3dcf817e756d 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -155,7 +155,9 @@ static const struct be_ethtool_stat et_tx_stats[] = {
155 /* Number of times the TX queue was stopped due to lack 155 /* Number of times the TX queue was stopped due to lack
156 * of spaces in the TXQ. 156 * of spaces in the TXQ.
157 */ 157 */
158 {DRVSTAT_TX_INFO(tx_stops)} 158 {DRVSTAT_TX_INFO(tx_stops)},
159 /* Pkts dropped in the driver's transmit path */
160 {DRVSTAT_TX_INFO(tx_drv_drops)}
159}; 161};
160#define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats)) 162#define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats))
161 163
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 6691d75b6cca..0a168e3d47ab 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -935,8 +935,10 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)
935 u32 start = txq->head; 935 u32 start = txq->head;
936 936
937 skb = be_xmit_workarounds(adapter, skb, &skip_hw_vlan); 937 skb = be_xmit_workarounds(adapter, skb, &skip_hw_vlan);
938 if (!skb) 938 if (!skb) {
939 tx_stats(txo)->tx_drv_drops++;
939 return NETDEV_TX_OK; 940 return NETDEV_TX_OK;
941 }
940 942
941 wrb_cnt = wrb_cnt_for_skb(adapter, skb, &dummy_wrb); 943 wrb_cnt = wrb_cnt_for_skb(adapter, skb, &dummy_wrb);
942 944
@@ -965,6 +967,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)
965 be_tx_stats_update(txo, wrb_cnt, copied, gso_segs, stopped); 967 be_tx_stats_update(txo, wrb_cnt, copied, gso_segs, stopped);
966 } else { 968 } else {
967 txq->head = start; 969 txq->head = start;
970 tx_stats(txo)->tx_drv_drops++;
968 dev_kfree_skb_any(skb); 971 dev_kfree_skb_any(skb);
969 } 972 }
970 return NETDEV_TX_OK; 973 return NETDEV_TX_OK;