diff options
Diffstat (limited to 'drivers/net')
-rwxr-xr-x | drivers/net/chelsio/cxgb2.c | 67 | ||||
-rwxr-xr-x[-rw-r--r--] | drivers/net/chelsio/pm3393.c | 112 | ||||
-rwxr-xr-x[-rw-r--r--] | drivers/net/chelsio/sge.c | 4 | ||||
-rwxr-xr-x | drivers/net/chelsio/sge.h | 2 |
4 files changed, 96 insertions, 89 deletions
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 2461f91b0996..c5975047c89b 100755 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c | |||
@@ -374,7 +374,9 @@ static char stats_strings[][ETH_GSTRING_LEN] = { | |||
374 | "TxInternalMACXmitError", | 374 | "TxInternalMACXmitError", |
375 | "TxFramesWithExcessiveDeferral", | 375 | "TxFramesWithExcessiveDeferral", |
376 | "TxFCSErrors", | 376 | "TxFCSErrors", |
377 | 377 | "TxJumboFramesOk", | |
378 | "TxJumboOctetsOk", | ||
379 | |||
378 | "RxOctetsOK", | 380 | "RxOctetsOK", |
379 | "RxOctetsBad", | 381 | "RxOctetsBad", |
380 | "RxUnicastFramesOK", | 382 | "RxUnicastFramesOK", |
@@ -392,11 +394,11 @@ static char stats_strings[][ETH_GSTRING_LEN] = { | |||
392 | "RxInRangeLengthErrors", | 394 | "RxInRangeLengthErrors", |
393 | "RxOutOfRangeLengthField", | 395 | "RxOutOfRangeLengthField", |
394 | "RxFrameTooLongErrors", | 396 | "RxFrameTooLongErrors", |
397 | "RxJumboFramesOk", | ||
398 | "RxJumboOctetsOk", | ||
395 | 399 | ||
396 | /* Port stats */ | 400 | /* Port stats */ |
397 | "RxPackets", | ||
398 | "RxCsumGood", | 401 | "RxCsumGood", |
399 | "TxPackets", | ||
400 | "TxCsumOffload", | 402 | "TxCsumOffload", |
401 | "TxTso", | 403 | "TxTso", |
402 | "RxVlan", | 404 | "RxVlan", |
@@ -464,23 +466,56 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, | |||
464 | const struct cmac_statistics *s; | 466 | const struct cmac_statistics *s; |
465 | const struct sge_intr_counts *t; | 467 | const struct sge_intr_counts *t; |
466 | struct sge_port_stats ss; | 468 | struct sge_port_stats ss; |
467 | unsigned int len; | ||
468 | 469 | ||
469 | s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL); | 470 | s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL); |
470 | 471 | t = t1_sge_get_intr_counts(adapter->sge); | |
471 | len = sizeof(u64)*(&s->TxFCSErrors + 1 - &s->TxOctetsOK); | ||
472 | memcpy(data, &s->TxOctetsOK, len); | ||
473 | data += len; | ||
474 | |||
475 | len = sizeof(u64)*(&s->RxFrameTooLongErrors + 1 - &s->RxOctetsOK); | ||
476 | memcpy(data, &s->RxOctetsOK, len); | ||
477 | data += len; | ||
478 | |||
479 | t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss); | 472 | t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss); |
480 | memcpy(data, &ss, sizeof(ss)); | ||
481 | data += sizeof(ss); | ||
482 | 473 | ||
483 | t = t1_sge_get_intr_counts(adapter->sge); | 474 | *data++ = s->TxOctetsOK; |
475 | *data++ = s->TxOctetsBad; | ||
476 | *data++ = s->TxUnicastFramesOK; | ||
477 | *data++ = s->TxMulticastFramesOK; | ||
478 | *data++ = s->TxBroadcastFramesOK; | ||
479 | *data++ = s->TxPauseFrames; | ||
480 | *data++ = s->TxFramesWithDeferredXmissions; | ||
481 | *data++ = s->TxLateCollisions; | ||
482 | *data++ = s->TxTotalCollisions; | ||
483 | *data++ = s->TxFramesAbortedDueToXSCollisions; | ||
484 | *data++ = s->TxUnderrun; | ||
485 | *data++ = s->TxLengthErrors; | ||
486 | *data++ = s->TxInternalMACXmitError; | ||
487 | *data++ = s->TxFramesWithExcessiveDeferral; | ||
488 | *data++ = s->TxFCSErrors; | ||
489 | *data++ = s->TxJumboFramesOK; | ||
490 | *data++ = s->TxJumboOctetsOK; | ||
491 | |||
492 | *data++ = s->RxOctetsOK; | ||
493 | *data++ = s->RxOctetsBad; | ||
494 | *data++ = s->RxUnicastFramesOK; | ||
495 | *data++ = s->RxMulticastFramesOK; | ||
496 | *data++ = s->RxBroadcastFramesOK; | ||
497 | *data++ = s->RxPauseFrames; | ||
498 | *data++ = s->RxFCSErrors; | ||
499 | *data++ = s->RxAlignErrors; | ||
500 | *data++ = s->RxSymbolErrors; | ||
501 | *data++ = s->RxDataErrors; | ||
502 | *data++ = s->RxSequenceErrors; | ||
503 | *data++ = s->RxRuntErrors; | ||
504 | *data++ = s->RxJabberErrors; | ||
505 | *data++ = s->RxInternalMACRcvError; | ||
506 | *data++ = s->RxInRangeLengthErrors; | ||
507 | *data++ = s->RxOutOfRangeLengthField; | ||
508 | *data++ = s->RxFrameTooLongErrors; | ||
509 | *data++ = s->RxJumboFramesOK; | ||
510 | *data++ = s->RxJumboOctetsOK; | ||
511 | |||
512 | *data++ = ss.rx_cso_good; | ||
513 | *data++ = ss.tx_cso; | ||
514 | *data++ = ss.tx_tso; | ||
515 | *data++ = ss.vlan_xtract; | ||
516 | *data++ = ss.vlan_insert; | ||
517 | *data++ = ss.tx_need_hdrroom; | ||
518 | |||
484 | *data++ = t->rx_drops; | 519 | *data++ = t->rx_drops; |
485 | *data++ = t->pure_rsps; | 520 | *data++ = t->pure_rsps; |
486 | *data++ = t->unhandled_irqs; | 521 | *data++ = t->unhandled_irqs; |
diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c index 678778a8d133..2117c4fbb107 100644..100755 --- a/drivers/net/chelsio/pm3393.c +++ b/drivers/net/chelsio/pm3393.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #include <linux/crc32.h> | 46 | #include <linux/crc32.h> |
47 | 47 | ||
48 | #define OFFSET(REG_ADDR) (REG_ADDR << 2) | 48 | #define OFFSET(REG_ADDR) ((REG_ADDR) << 2) |
49 | 49 | ||
50 | /* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */ | 50 | /* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */ |
51 | #define MAX_FRAME_SIZE 9600 | 51 | #define MAX_FRAME_SIZE 9600 |
@@ -428,69 +428,26 @@ static int pm3393_set_speed_duplex_fc(struct cmac *cmac, int speed, int duplex, | |||
428 | return 0; | 428 | return 0; |
429 | } | 429 | } |
430 | 430 | ||
431 | static void pm3393_rmon_update(struct adapter *adapter, u32 offs, u64 *val, | 431 | #define RMON_UPDATE(mac, name, stat_name) \ |
432 | int over) | 432 | { \ |
433 | { | 433 | t1_tpi_read((mac)->adapter, OFFSET(name), &val0); \ |
434 | u32 val0, val1, val2; | 434 | t1_tpi_read((mac)->adapter, OFFSET((name)+1), &val1); \ |
435 | 435 | t1_tpi_read((mac)->adapter, OFFSET((name)+2), &val2); \ | |
436 | t1_tpi_read(adapter, offs, &val0); | 436 | (mac)->stats.stat_name = (u64)(val0 & 0xffff) | \ |
437 | t1_tpi_read(adapter, offs + 4, &val1); | 437 | ((u64)(val1 & 0xffff) << 16) | \ |
438 | t1_tpi_read(adapter, offs + 8, &val2); | 438 | ((u64)(val2 & 0xff) << 32) | \ |
439 | 439 | ((mac)->stats.stat_name & \ | |
440 | *val &= ~0ull << 40; | 440 | 0xffffff0000000000ULL); \ |
441 | *val |= val0 & 0xffff; | 441 | if (ro & \ |
442 | *val |= (val1 & 0xffff) << 16; | 442 | (1ULL << ((name - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW) >> 2))) \ |
443 | *val |= (u64)(val2 & 0xff) << 32; | 443 | (mac)->stats.stat_name += 1ULL << 40; \ |
444 | |||
445 | if (over) | ||
446 | *val += 1ull << 40; | ||
447 | } | 444 | } |
448 | 445 | ||
449 | static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, | 446 | static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, |
450 | int flag) | 447 | int flag) |
451 | { | 448 | { |
452 | static struct { | 449 | u64 ro; |
453 | unsigned int reg; | 450 | u32 val0, val1, val2, val3; |
454 | unsigned int offset; | ||
455 | } hw_stats [] = { | ||
456 | |||
457 | #define HW_STAT(name, stat_name) \ | ||
458 | { name, (&((struct cmac_statistics *)NULL)->stat_name) - (u64 *)NULL } | ||
459 | |||
460 | /* Rx stats */ | ||
461 | HW_STAT(RxOctetsReceivedOK, RxOctetsOK), | ||
462 | HW_STAT(RxUnicastFramesReceivedOK, RxUnicastFramesOK), | ||
463 | HW_STAT(RxMulticastFramesReceivedOK, RxMulticastFramesOK), | ||
464 | HW_STAT(RxBroadcastFramesReceivedOK, RxBroadcastFramesOK), | ||
465 | HW_STAT(RxPAUSEMACCtrlFramesReceived, RxPauseFrames), | ||
466 | HW_STAT(RxFrameCheckSequenceErrors, RxFCSErrors), | ||
467 | HW_STAT(RxFramesLostDueToInternalMACErrors, | ||
468 | RxInternalMACRcvError), | ||
469 | HW_STAT(RxSymbolErrors, RxSymbolErrors), | ||
470 | HW_STAT(RxInRangeLengthErrors, RxInRangeLengthErrors), | ||
471 | HW_STAT(RxFramesTooLongErrors , RxFrameTooLongErrors), | ||
472 | HW_STAT(RxJabbers, RxJabberErrors), | ||
473 | HW_STAT(RxFragments, RxRuntErrors), | ||
474 | HW_STAT(RxUndersizedFrames, RxRuntErrors), | ||
475 | HW_STAT(RxJumboFramesReceivedOK, RxJumboFramesOK), | ||
476 | HW_STAT(RxJumboOctetsReceivedOK, RxJumboOctetsOK), | ||
477 | |||
478 | /* Tx stats */ | ||
479 | HW_STAT(TxOctetsTransmittedOK, TxOctetsOK), | ||
480 | HW_STAT(TxFramesLostDueToInternalMACTransmissionError, | ||
481 | TxInternalMACXmitError), | ||
482 | HW_STAT(TxTransmitSystemError, TxFCSErrors), | ||
483 | HW_STAT(TxUnicastFramesTransmittedOK, TxUnicastFramesOK), | ||
484 | HW_STAT(TxMulticastFramesTransmittedOK, TxMulticastFramesOK), | ||
485 | HW_STAT(TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK), | ||
486 | HW_STAT(TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames), | ||
487 | HW_STAT(TxJumboFramesReceivedOK, TxJumboFramesOK), | ||
488 | HW_STAT(TxJumboOctetsReceivedOK, TxJumboOctetsOK) | ||
489 | }, *p = hw_stats; | ||
490 | u64 ro; | ||
491 | u32 val0, val1, val2, val3; | ||
492 | u64 *stats = (u64 *) &mac->stats; | ||
493 | unsigned int i; | ||
494 | 451 | ||
495 | /* Snap the counters */ | 452 | /* Snap the counters */ |
496 | pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL, | 453 | pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL, |
@@ -504,14 +461,35 @@ static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac, | |||
504 | ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) | | 461 | ro = ((u64)val0 & 0xffff) | (((u64)val1 & 0xffff) << 16) | |
505 | (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48); | 462 | (((u64)val2 & 0xffff) << 32) | (((u64)val3 & 0xffff) << 48); |
506 | 463 | ||
507 | for (i = 0; i < ARRAY_SIZE(hw_stats); i++) { | 464 | /* Rx stats */ |
508 | unsigned reg = p->reg - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW; | 465 | RMON_UPDATE(mac, RxOctetsReceivedOK, RxOctetsOK); |
509 | 466 | RMON_UPDATE(mac, RxUnicastFramesReceivedOK, RxUnicastFramesOK); | |
510 | pm3393_rmon_update((mac)->adapter, OFFSET(p->reg), | 467 | RMON_UPDATE(mac, RxMulticastFramesReceivedOK, RxMulticastFramesOK); |
511 | stats + p->offset, ro & (reg >> 2)); | 468 | RMON_UPDATE(mac, RxBroadcastFramesReceivedOK, RxBroadcastFramesOK); |
512 | } | 469 | RMON_UPDATE(mac, RxPAUSEMACCtrlFramesReceived, RxPauseFrames); |
513 | 470 | RMON_UPDATE(mac, RxFrameCheckSequenceErrors, RxFCSErrors); | |
514 | 471 | RMON_UPDATE(mac, RxFramesLostDueToInternalMACErrors, | |
472 | RxInternalMACRcvError); | ||
473 | RMON_UPDATE(mac, RxSymbolErrors, RxSymbolErrors); | ||
474 | RMON_UPDATE(mac, RxInRangeLengthErrors, RxInRangeLengthErrors); | ||
475 | RMON_UPDATE(mac, RxFramesTooLongErrors , RxFrameTooLongErrors); | ||
476 | RMON_UPDATE(mac, RxJabbers, RxJabberErrors); | ||
477 | RMON_UPDATE(mac, RxFragments, RxRuntErrors); | ||
478 | RMON_UPDATE(mac, RxUndersizedFrames, RxRuntErrors); | ||
479 | RMON_UPDATE(mac, RxJumboFramesReceivedOK, RxJumboFramesOK); | ||
480 | RMON_UPDATE(mac, RxJumboOctetsReceivedOK, RxJumboOctetsOK); | ||
481 | |||
482 | /* Tx stats */ | ||
483 | RMON_UPDATE(mac, TxOctetsTransmittedOK, TxOctetsOK); | ||
484 | RMON_UPDATE(mac, TxFramesLostDueToInternalMACTransmissionError, | ||
485 | TxInternalMACXmitError); | ||
486 | RMON_UPDATE(mac, TxTransmitSystemError, TxFCSErrors); | ||
487 | RMON_UPDATE(mac, TxUnicastFramesTransmittedOK, TxUnicastFramesOK); | ||
488 | RMON_UPDATE(mac, TxMulticastFramesTransmittedOK, TxMulticastFramesOK); | ||
489 | RMON_UPDATE(mac, TxBroadcastFramesTransmittedOK, TxBroadcastFramesOK); | ||
490 | RMON_UPDATE(mac, TxPAUSEMACCtrlFramesTransmitted, TxPauseFrames); | ||
491 | RMON_UPDATE(mac, TxJumboFramesReceivedOK, TxJumboFramesOK); | ||
492 | RMON_UPDATE(mac, TxJumboOctetsReceivedOK, TxJumboOctetsOK); | ||
515 | 493 | ||
516 | return &mac->stats; | 494 | return &mac->stats; |
517 | } | 495 | } |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 4b6258fc726f..b301c0428ae0 100644..100755 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -986,9 +986,7 @@ void t1_sge_get_port_stats(const struct sge *sge, int port, | |||
986 | for_each_possible_cpu(cpu) { | 986 | for_each_possible_cpu(cpu) { |
987 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu); | 987 | struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[port], cpu); |
988 | 988 | ||
989 | ss->rx_packets += st->rx_packets; | ||
990 | ss->rx_cso_good += st->rx_cso_good; | 989 | ss->rx_cso_good += st->rx_cso_good; |
991 | ss->tx_packets += st->tx_packets; | ||
992 | ss->tx_cso += st->tx_cso; | 990 | ss->tx_cso += st->tx_cso; |
993 | ss->tx_tso += st->tx_tso; | 991 | ss->tx_tso += st->tx_tso; |
994 | ss->tx_need_hdrroom += st->tx_need_hdrroom; | 992 | ss->tx_need_hdrroom += st->tx_need_hdrroom; |
@@ -1381,7 +1379,6 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) | |||
1381 | __skb_pull(skb, sizeof(*p)); | 1379 | __skb_pull(skb, sizeof(*p)); |
1382 | 1380 | ||
1383 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); | 1381 | st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); |
1384 | st->rx_packets++; | ||
1385 | 1382 | ||
1386 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); | 1383 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); |
1387 | skb->dev->last_rx = jiffies; | 1384 | skb->dev->last_rx = jiffies; |
@@ -1946,7 +1943,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1946 | cpl->vlan_valid = 0; | 1943 | cpl->vlan_valid = 0; |
1947 | 1944 | ||
1948 | send: | 1945 | send: |
1949 | st->tx_packets++; | ||
1950 | dev->trans_start = jiffies; | 1946 | dev->trans_start = jiffies; |
1951 | ret = t1_sge_tx(skb, adapter, 0, dev); | 1947 | ret = t1_sge_tx(skb, adapter, 0, dev); |
1952 | 1948 | ||
diff --git a/drivers/net/chelsio/sge.h b/drivers/net/chelsio/sge.h index 285bbb272ed5..cced9dff91c5 100755 --- a/drivers/net/chelsio/sge.h +++ b/drivers/net/chelsio/sge.h | |||
@@ -57,9 +57,7 @@ struct sge_intr_counts { | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | struct sge_port_stats { | 59 | struct sge_port_stats { |
60 | u64 rx_packets; /* # of Ethernet packets received */ | ||
61 | u64 rx_cso_good; /* # of successful RX csum offloads */ | 60 | u64 rx_cso_good; /* # of successful RX csum offloads */ |
62 | u64 tx_packets; /* # of TX packets */ | ||
63 | u64 tx_cso; /* # of TX checksum offloads */ | 61 | u64 tx_cso; /* # of TX checksum offloads */ |
64 | u64 tx_tso; /* # of TSO requests */ | 62 | u64 tx_tso; /* # of TSO requests */ |
65 | u64 vlan_xtract; /* # of VLAN tag extractions */ | 63 | u64 vlan_xtract; /* # of VLAN tag extractions */ |