diff options
author | Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> | 2012-07-10 10:57:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-11 02:28:33 -0400 |
commit | 433c88e866927b9ae5e2b485760f93aa8971608f (patch) | |
tree | 4355b87bf9f39d79bbe91439bb2492d435c92330 /drivers | |
parent | f5c4441cd80123c0f13fca75afc811c9c2b64add (diff) |
qlge: Moving low level frame error to ethtool statistics.
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlge/qlge.h | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlge/qlge_main.c | 63 |
3 files changed, 58 insertions, 27 deletions
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h index 02fd96bb7db6..0c3a1ba8e54c 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge.h +++ b/drivers/net/ethernet/qlogic/qlge/qlge.h | |||
@@ -1536,6 +1536,14 @@ struct nic_stats { | |||
1536 | u64 rx_1024_to_1518_pkts; | 1536 | u64 rx_1024_to_1518_pkts; |
1537 | u64 rx_1519_to_max_pkts; | 1537 | u64 rx_1519_to_max_pkts; |
1538 | u64 rx_len_err_pkts; | 1538 | u64 rx_len_err_pkts; |
1539 | /* Receive Mac Err stats */ | ||
1540 | u64 rx_code_err; | ||
1541 | u64 rx_oversize_err; | ||
1542 | u64 rx_undersize_err; | ||
1543 | u64 rx_preamble_err; | ||
1544 | u64 rx_frame_len_err; | ||
1545 | u64 rx_crc_err; | ||
1546 | u64 rx_err_count; | ||
1539 | /* | 1547 | /* |
1540 | * These stats come from offset 500h to 5C8h | 1548 | * These stats come from offset 500h to 5C8h |
1541 | * in the XGMAC register. | 1549 | * in the XGMAC register. |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c index 4c141da51a82..d505abe8d83c 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c | |||
@@ -226,6 +226,13 @@ static char ql_stats_str_arr[][ETH_GSTRING_LEN] = { | |||
226 | {"rx_1024_to_1518_pkts"}, | 226 | {"rx_1024_to_1518_pkts"}, |
227 | {"rx_1519_to_max_pkts"}, | 227 | {"rx_1519_to_max_pkts"}, |
228 | {"rx_len_err_pkts"}, | 228 | {"rx_len_err_pkts"}, |
229 | {"rx_code_err"}, | ||
230 | {"rx_oversize_err"}, | ||
231 | {"rx_undersize_err"}, | ||
232 | {"rx_preamble_err"}, | ||
233 | {"rx_frame_len_err"}, | ||
234 | {"rx_crc_err"}, | ||
235 | {"rx_err_count"}, | ||
229 | {"tx_cbfc_pause_frames0"}, | 236 | {"tx_cbfc_pause_frames0"}, |
230 | {"tx_cbfc_pause_frames1"}, | 237 | {"tx_cbfc_pause_frames1"}, |
231 | {"tx_cbfc_pause_frames2"}, | 238 | {"tx_cbfc_pause_frames2"}, |
@@ -320,6 +327,13 @@ ql_get_ethtool_stats(struct net_device *ndev, | |||
320 | *data++ = s->rx_1024_to_1518_pkts; | 327 | *data++ = s->rx_1024_to_1518_pkts; |
321 | *data++ = s->rx_1519_to_max_pkts; | 328 | *data++ = s->rx_1519_to_max_pkts; |
322 | *data++ = s->rx_len_err_pkts; | 329 | *data++ = s->rx_len_err_pkts; |
330 | *data++ = s->rx_code_err; | ||
331 | *data++ = s->rx_oversize_err; | ||
332 | *data++ = s->rx_undersize_err; | ||
333 | *data++ = s->rx_preamble_err; | ||
334 | *data++ = s->rx_frame_len_err; | ||
335 | *data++ = s->rx_crc_err; | ||
336 | *data++ = s->rx_err_count; | ||
323 | *data++ = s->tx_cbfc_pause_frames0; | 337 | *data++ = s->tx_cbfc_pause_frames0; |
324 | *data++ = s->tx_cbfc_pause_frames1; | 338 | *data++ = s->tx_cbfc_pause_frames1; |
325 | *data++ = s->tx_cbfc_pause_frames2; | 339 | *data++ = s->tx_cbfc_pause_frames2; |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index bccbc4e2b31a..31cae42498aa 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -1433,6 +1433,36 @@ map_error: | |||
1433 | return NETDEV_TX_BUSY; | 1433 | return NETDEV_TX_BUSY; |
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | /* Categorizing receive firmware frame errors */ | ||
1437 | static void ql_categorize_rx_err(struct ql_adapter *qdev, u8 rx_err) | ||
1438 | { | ||
1439 | struct nic_stats *stats = &qdev->nic_stats; | ||
1440 | |||
1441 | stats->rx_err_count++; | ||
1442 | |||
1443 | switch (rx_err & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1444 | case IB_MAC_IOCB_RSP_ERR_CODE_ERR: | ||
1445 | stats->rx_code_err++; | ||
1446 | break; | ||
1447 | case IB_MAC_IOCB_RSP_ERR_OVERSIZE: | ||
1448 | stats->rx_oversize_err++; | ||
1449 | break; | ||
1450 | case IB_MAC_IOCB_RSP_ERR_UNDERSIZE: | ||
1451 | stats->rx_undersize_err++; | ||
1452 | break; | ||
1453 | case IB_MAC_IOCB_RSP_ERR_PREAMBLE: | ||
1454 | stats->rx_preamble_err++; | ||
1455 | break; | ||
1456 | case IB_MAC_IOCB_RSP_ERR_FRAME_LEN: | ||
1457 | stats->rx_frame_len_err++; | ||
1458 | break; | ||
1459 | case IB_MAC_IOCB_RSP_ERR_CRC: | ||
1460 | stats->rx_crc_err++; | ||
1461 | default: | ||
1462 | break; | ||
1463 | } | ||
1464 | } | ||
1465 | |||
1436 | /* Process an inbound completion from an rx ring. */ | 1466 | /* Process an inbound completion from an rx ring. */ |
1437 | static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev, | 1467 | static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev, |
1438 | struct rx_ring *rx_ring, | 1468 | struct rx_ring *rx_ring, |
@@ -1499,15 +1529,6 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev, | |||
1499 | addr = lbq_desc->p.pg_chunk.va; | 1529 | addr = lbq_desc->p.pg_chunk.va; |
1500 | prefetch(addr); | 1530 | prefetch(addr); |
1501 | 1531 | ||
1502 | |||
1503 | /* Frame error, so drop the packet. */ | ||
1504 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1505 | netif_info(qdev, drv, qdev->ndev, | ||
1506 | "Receive error, flags2 = 0x%x\n", ib_mac_rsp->flags2); | ||
1507 | rx_ring->rx_errors++; | ||
1508 | goto err_out; | ||
1509 | } | ||
1510 | |||
1511 | /* The max framesize filter on this chip is set higher than | 1532 | /* The max framesize filter on this chip is set higher than |
1512 | * MTU since FCoE uses 2k frames. | 1533 | * MTU since FCoE uses 2k frames. |
1513 | */ | 1534 | */ |
@@ -1593,15 +1614,6 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev, | |||
1593 | memcpy(skb_put(new_skb, length), skb->data, length); | 1614 | memcpy(skb_put(new_skb, length), skb->data, length); |
1594 | skb = new_skb; | 1615 | skb = new_skb; |
1595 | 1616 | ||
1596 | /* Frame error, so drop the packet. */ | ||
1597 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1598 | netif_info(qdev, drv, qdev->ndev, | ||
1599 | "Receive error, flags2 = 0x%x\n", ib_mac_rsp->flags2); | ||
1600 | dev_kfree_skb_any(skb); | ||
1601 | rx_ring->rx_errors++; | ||
1602 | return; | ||
1603 | } | ||
1604 | |||
1605 | /* loopback self test for ethtool */ | 1617 | /* loopback self test for ethtool */ |
1606 | if (test_bit(QL_SELFTEST, &qdev->flags)) { | 1618 | if (test_bit(QL_SELFTEST, &qdev->flags)) { |
1607 | ql_check_lb_frame(qdev, skb); | 1619 | ql_check_lb_frame(qdev, skb); |
@@ -1907,15 +1919,6 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev, | |||
1907 | return; | 1919 | return; |
1908 | } | 1920 | } |
1909 | 1921 | ||
1910 | /* Frame error, so drop the packet. */ | ||
1911 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
1912 | netif_info(qdev, drv, qdev->ndev, | ||
1913 | "Receive error, flags2 = 0x%x\n", ib_mac_rsp->flags2); | ||
1914 | dev_kfree_skb_any(skb); | ||
1915 | rx_ring->rx_errors++; | ||
1916 | return; | ||
1917 | } | ||
1918 | |||
1919 | /* The max framesize filter on this chip is set higher than | 1922 | /* The max framesize filter on this chip is set higher than |
1920 | * MTU since FCoE uses 2k frames. | 1923 | * MTU since FCoE uses 2k frames. |
1921 | */ | 1924 | */ |
@@ -1997,6 +2000,12 @@ static unsigned long ql_process_mac_rx_intr(struct ql_adapter *qdev, | |||
1997 | 2000 | ||
1998 | QL_DUMP_IB_MAC_RSP(ib_mac_rsp); | 2001 | QL_DUMP_IB_MAC_RSP(ib_mac_rsp); |
1999 | 2002 | ||
2003 | /* Frame error, so drop the packet. */ | ||
2004 | if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) { | ||
2005 | ql_categorize_rx_err(qdev, ib_mac_rsp->flags2); | ||
2006 | return (unsigned long)length; | ||
2007 | } | ||
2008 | |||
2000 | if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { | 2009 | if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) { |
2001 | /* The data and headers are split into | 2010 | /* The data and headers are split into |
2002 | * separate buffers. | 2011 | * separate buffers. |