aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex/benet
diff options
context:
space:
mode:
authorKalesh AP <kalesh.purayil@emulex.com>2014-09-02 00:26:49 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-02 15:45:59 -0400
commit512bb8a244d2854953c65c0b36b0d0812fced7d5 (patch)
treed70abf9e64dda09dc13dd2be73cea6c45e7fcb1a /drivers/net/ethernet/emulex/benet
parentacbd6ff833da9d84e6596bfc94c5605a9c5b66da (diff)
be2net: Add TX completion error statistics in ethtool
HW reports TX completion errors in TX completion. This patch adds these counters to ethtool statistics. Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com> Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex/benet')
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h7
-rw-r--r--drivers/net/ethernet/emulex/benet/be_ethtool.c28
-rw-r--r--drivers/net/ethernet/emulex/benet/be_hw.h12
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c45
4 files changed, 92 insertions, 0 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index d9cd88576ffa..d491ac614dcf 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -248,6 +248,13 @@ struct be_tx_stats {
248 ulong tx_jiffies; 248 ulong tx_jiffies;
249 u32 tx_stops; 249 u32 tx_stops;
250 u32 tx_drv_drops; /* pkts dropped by driver */ 250 u32 tx_drv_drops; /* pkts dropped by driver */
251 /* the error counters are described in be_ethtool.c */
252 u32 tx_hdr_parse_err;
253 u32 tx_dma_err;
254 u32 tx_tso_err;
255 u32 tx_spoof_check_err;
256 u32 tx_qinq_err;
257 u32 tx_internal_parity_err;
251 struct u64_stats_sync sync; 258 struct u64_stats_sync sync;
252 struct u64_stats_sync sync_compl; 259 struct u64_stats_sync sync_compl;
253}; 260};
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index d8d7a4a8538f..3a7ade4b313a 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -157,6 +157,34 @@ static const struct be_ethtool_stat et_rx_stats[] = {
157 */ 157 */
158static const struct be_ethtool_stat et_tx_stats[] = { 158static const struct be_ethtool_stat et_tx_stats[] = {
159 {DRVSTAT_TX_INFO(tx_compl)}, /* If moving this member see above note */ 159 {DRVSTAT_TX_INFO(tx_compl)}, /* If moving this member see above note */
160 /* This counter is incremented when the HW encounters an error while
161 * parsing the packet header of an outgoing TX request. This counter is
162 * applicable only for BE2, BE3 and Skyhawk based adapters.
163 */
164 {DRVSTAT_TX_INFO(tx_hdr_parse_err)},
165 /* This counter is incremented when an error occurs in the DMA
166 * operation associated with the TX request from the host to the device.
167 */
168 {DRVSTAT_TX_INFO(tx_dma_err)},
169 /* This counter is incremented when MAC or VLAN spoof checking is
170 * enabled on the interface and the TX request fails the spoof check
171 * in HW.
172 */
173 {DRVSTAT_TX_INFO(tx_spoof_check_err)},
174 /* This counter is incremented when the HW encounters an error while
175 * performing TSO offload. This counter is applicable only for Lancer
176 * adapters.
177 */
178 {DRVSTAT_TX_INFO(tx_tso_err)},
179 /* This counter is incremented when the HW detects Q-in-Q style VLAN
180 * tagging in a packet and such tagging is not expected on the outgoing
181 * interface. This counter is applicable only for Lancer adapters.
182 */
183 {DRVSTAT_TX_INFO(tx_qinq_err)},
184 /* This counter is incremented when the HW detects parity errors in the
185 * packet data. This counter is applicable only for Lancer adapters.
186 */
187 {DRVSTAT_TX_INFO(tx_internal_parity_err)},
160 {DRVSTAT_TX_INFO(tx_bytes)}, 188 {DRVSTAT_TX_INFO(tx_bytes)},
161 {DRVSTAT_TX_INFO(tx_pkts)}, 189 {DRVSTAT_TX_INFO(tx_pkts)},
162 /* Number of skbs queued for trasmission by the driver */ 190 /* Number of skbs queued for trasmission by the driver */
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index 8840c64aaeca..295ee0835ba0 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -315,6 +315,18 @@ struct be_eth_hdr_wrb {
315 u32 dw[4]; 315 u32 dw[4];
316}; 316};
317 317
318/********* Tx Compl Status Encoding *********/
319#define BE_TX_COMP_HDR_PARSE_ERR 0x2
320#define BE_TX_COMP_NDMA_ERR 0x3
321#define BE_TX_COMP_ACL_ERR 0x5
322
323#define LANCER_TX_COMP_LSO_ERR 0x1
324#define LANCER_TX_COMP_HSW_DROP_MAC_ERR 0x3
325#define LANCER_TX_COMP_HSW_DROP_VLAN_ERR 0x5
326#define LANCER_TX_COMP_QINQ_ERR 0x7
327#define LANCER_TX_COMP_PARITY_ERR 0xb
328#define LANCER_TX_COMP_DMA_ERR 0xd
329
318/* TX Compl Queue Descriptor */ 330/* TX Compl Queue Descriptor */
319 331
320/* Pseudo amap definition for eth_tx_compl in which each bit of the 332/* Pseudo amap definition for eth_tx_compl in which each bit of the
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index aa0e9c142e05..7b6dbf880a66 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2421,11 +2421,49 @@ loop_continue:
2421 return work_done; 2421 return work_done;
2422} 2422}
2423 2423
2424static inline void be_update_tx_err(struct be_tx_obj *txo, u32 status)
2425{
2426 switch (status) {
2427 case BE_TX_COMP_HDR_PARSE_ERR:
2428 tx_stats(txo)->tx_hdr_parse_err++;
2429 break;
2430 case BE_TX_COMP_NDMA_ERR:
2431 tx_stats(txo)->tx_dma_err++;
2432 break;
2433 case BE_TX_COMP_ACL_ERR:
2434 tx_stats(txo)->tx_spoof_check_err++;
2435 break;
2436 }
2437}
2438
2439static inline void lancer_update_tx_err(struct be_tx_obj *txo, u32 status)
2440{
2441 switch (status) {
2442 case LANCER_TX_COMP_LSO_ERR:
2443 tx_stats(txo)->tx_tso_err++;
2444 break;
2445 case LANCER_TX_COMP_HSW_DROP_MAC_ERR:
2446 case LANCER_TX_COMP_HSW_DROP_VLAN_ERR:
2447 tx_stats(txo)->tx_spoof_check_err++;
2448 break;
2449 case LANCER_TX_COMP_QINQ_ERR:
2450 tx_stats(txo)->tx_qinq_err++;
2451 break;
2452 case LANCER_TX_COMP_PARITY_ERR:
2453 tx_stats(txo)->tx_internal_parity_err++;
2454 break;
2455 case LANCER_TX_COMP_DMA_ERR:
2456 tx_stats(txo)->tx_dma_err++;
2457 break;
2458 }
2459}
2460
2424static bool be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo, 2461static bool be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo,
2425 int budget, int idx) 2462 int budget, int idx)
2426{ 2463{
2427 struct be_eth_tx_compl *txcp; 2464 struct be_eth_tx_compl *txcp;
2428 int num_wrbs = 0, work_done; 2465 int num_wrbs = 0, work_done;
2466 u32 compl_status;
2429 2467
2430 for (work_done = 0; work_done < budget; work_done++) { 2468 for (work_done = 0; work_done < budget; work_done++) {
2431 txcp = be_tx_compl_get(&txo->cq); 2469 txcp = be_tx_compl_get(&txo->cq);
@@ -2434,6 +2472,13 @@ static bool be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo,
2434 num_wrbs += be_tx_compl_process(adapter, txo, 2472 num_wrbs += be_tx_compl_process(adapter, txo,
2435 GET_TX_COMPL_BITS(wrb_index, 2473 GET_TX_COMPL_BITS(wrb_index,
2436 txcp)); 2474 txcp));
2475 compl_status = GET_TX_COMPL_BITS(status, txcp);
2476 if (compl_status) {
2477 if (lancer_chip(adapter))
2478 lancer_update_tx_err(txo, compl_status);
2479 else
2480 be_update_tx_err(txo, compl_status);
2481 }
2437 } 2482 }
2438 2483
2439 if (work_done) { 2484 if (work_done) {