diff options
author | Ralph Campbell <ralph.campbell@qlogic.com> | 2008-01-07 00:02:34 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-01-25 17:15:38 -0500 |
commit | 3029fcc3d44530601f19fd8f551ac195d3a918d7 (patch) | |
tree | df486443f140a8d47fab8bda9552744c3201b865 /drivers | |
parent | 6c719cae0b91f577738dfb4007baee28f03e48a5 (diff) |
IB/ipath: Export hardware counters more consistently
Various hardware counters are exported via the ipath file system (since
it is binary data). The old file format was very dependent on the HW
offsets for these registers. Newer HCA chips can have different
counters at different offsets. This patch adds a level of indirection
to make the file format consistent across HCAs.
Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_common.h | 20 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_fs.c | 11 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_iba6110.c | 159 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_iba6120.c | 153 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_kernel.h | 2 |
5 files changed, 328 insertions, 17 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h index 851df8a75e79..aa780e7f2418 100644 --- a/drivers/infiniband/hw/ipath/ipath_common.h +++ b/drivers/infiniband/hw/ipath/ipath_common.h | |||
@@ -579,7 +579,7 @@ struct ipath_flash { | |||
579 | struct infinipath_counters { | 579 | struct infinipath_counters { |
580 | __u64 LBIntCnt; | 580 | __u64 LBIntCnt; |
581 | __u64 LBFlowStallCnt; | 581 | __u64 LBFlowStallCnt; |
582 | __u64 Reserved1; | 582 | __u64 TxSDmaDescCnt; /* was Reserved1 */ |
583 | __u64 TxUnsupVLErrCnt; | 583 | __u64 TxUnsupVLErrCnt; |
584 | __u64 TxDataPktCnt; | 584 | __u64 TxDataPktCnt; |
585 | __u64 TxFlowPktCnt; | 585 | __u64 TxFlowPktCnt; |
@@ -615,12 +615,26 @@ struct infinipath_counters { | |||
615 | __u64 RxP6HdrEgrOvflCnt; | 615 | __u64 RxP6HdrEgrOvflCnt; |
616 | __u64 RxP7HdrEgrOvflCnt; | 616 | __u64 RxP7HdrEgrOvflCnt; |
617 | __u64 RxP8HdrEgrOvflCnt; | 617 | __u64 RxP8HdrEgrOvflCnt; |
618 | __u64 Reserved6; | 618 | __u64 RxP9HdrEgrOvflCnt; /* was Reserved6 */ |
619 | __u64 Reserved7; | 619 | __u64 RxP10HdrEgrOvflCnt; /* was Reserved7 */ |
620 | __u64 RxP11HdrEgrOvflCnt; /* new for IBA7220 */ | ||
621 | __u64 RxP12HdrEgrOvflCnt; /* new for IBA7220 */ | ||
622 | __u64 RxP13HdrEgrOvflCnt; /* new for IBA7220 */ | ||
623 | __u64 RxP14HdrEgrOvflCnt; /* new for IBA7220 */ | ||
624 | __u64 RxP15HdrEgrOvflCnt; /* new for IBA7220 */ | ||
625 | __u64 RxP16HdrEgrOvflCnt; /* new for IBA7220 */ | ||
620 | __u64 IBStatusChangeCnt; | 626 | __u64 IBStatusChangeCnt; |
621 | __u64 IBLinkErrRecoveryCnt; | 627 | __u64 IBLinkErrRecoveryCnt; |
622 | __u64 IBLinkDownedCnt; | 628 | __u64 IBLinkDownedCnt; |
623 | __u64 IBSymbolErrCnt; | 629 | __u64 IBSymbolErrCnt; |
630 | /* The following are new for IBA7220 */ | ||
631 | __u64 RxVL15DroppedPktCnt; | ||
632 | __u64 RxOtherLocalPhyErrCnt; | ||
633 | __u64 PcieRetryBufDiagQwordCnt; | ||
634 | __u64 ExcessBufferOvflCnt; | ||
635 | __u64 LocalLinkIntegrityErrCnt; | ||
636 | __u64 RxVlErrCnt; | ||
637 | __u64 RxDlidFltrCnt; | ||
624 | }; | 638 | }; |
625 | 639 | ||
626 | /* | 640 | /* |
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index 262c25db05cd..52325e009a1f 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
@@ -108,21 +108,16 @@ static const struct file_operations atomic_stats_ops = { | |||
108 | .read = atomic_stats_read, | 108 | .read = atomic_stats_read, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | #define NUM_COUNTERS sizeof(struct infinipath_counters) / sizeof(u64) | ||
112 | |||
113 | static ssize_t atomic_counters_read(struct file *file, char __user *buf, | 111 | static ssize_t atomic_counters_read(struct file *file, char __user *buf, |
114 | size_t count, loff_t *ppos) | 112 | size_t count, loff_t *ppos) |
115 | { | 113 | { |
116 | u64 counters[NUM_COUNTERS]; | 114 | struct infinipath_counters counters; |
117 | u16 i; | ||
118 | struct ipath_devdata *dd; | 115 | struct ipath_devdata *dd; |
119 | 116 | ||
120 | dd = file->f_path.dentry->d_inode->i_private; | 117 | dd = file->f_path.dentry->d_inode->i_private; |
118 | dd->ipath_f_read_counters(dd, &counters); | ||
121 | 119 | ||
122 | for (i = 0; i < NUM_COUNTERS; i++) | 120 | return simple_read_from_buffer(buf, count, ppos, &counters, |
123 | counters[i] = ipath_snap_cntr(dd, i); | ||
124 | |||
125 | return simple_read_from_buffer(buf, count, ppos, counters, | ||
126 | sizeof counters); | 121 | sizeof counters); |
127 | } | 122 | } |
128 | 123 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6110.c b/drivers/infiniband/hw/ipath/ipath_iba6110.c index c272a7392e22..ce858797e299 100644 --- a/drivers/infiniband/hw/ipath/ipath_iba6110.c +++ b/drivers/infiniband/hw/ipath/ipath_iba6110.c | |||
@@ -148,10 +148,57 @@ struct _infinipath_do_not_use_kernel_regs { | |||
148 | unsigned long long ReservedSW2[4]; | 148 | unsigned long long ReservedSW2[4]; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | #define IPATH_KREG_OFFSET(field) (offsetof(struct \ | 151 | struct _infinipath_do_not_use_counters { |
152 | _infinipath_do_not_use_kernel_regs, field) / sizeof(u64)) | 152 | __u64 LBIntCnt; |
153 | __u64 LBFlowStallCnt; | ||
154 | __u64 Reserved1; | ||
155 | __u64 TxUnsupVLErrCnt; | ||
156 | __u64 TxDataPktCnt; | ||
157 | __u64 TxFlowPktCnt; | ||
158 | __u64 TxDwordCnt; | ||
159 | __u64 TxLenErrCnt; | ||
160 | __u64 TxMaxMinLenErrCnt; | ||
161 | __u64 TxUnderrunCnt; | ||
162 | __u64 TxFlowStallCnt; | ||
163 | __u64 TxDroppedPktCnt; | ||
164 | __u64 RxDroppedPktCnt; | ||
165 | __u64 RxDataPktCnt; | ||
166 | __u64 RxFlowPktCnt; | ||
167 | __u64 RxDwordCnt; | ||
168 | __u64 RxLenErrCnt; | ||
169 | __u64 RxMaxMinLenErrCnt; | ||
170 | __u64 RxICRCErrCnt; | ||
171 | __u64 RxVCRCErrCnt; | ||
172 | __u64 RxFlowCtrlErrCnt; | ||
173 | __u64 RxBadFormatCnt; | ||
174 | __u64 RxLinkProblemCnt; | ||
175 | __u64 RxEBPCnt; | ||
176 | __u64 RxLPCRCErrCnt; | ||
177 | __u64 RxBufOvflCnt; | ||
178 | __u64 RxTIDFullErrCnt; | ||
179 | __u64 RxTIDValidErrCnt; | ||
180 | __u64 RxPKeyMismatchCnt; | ||
181 | __u64 RxP0HdrEgrOvflCnt; | ||
182 | __u64 RxP1HdrEgrOvflCnt; | ||
183 | __u64 RxP2HdrEgrOvflCnt; | ||
184 | __u64 RxP3HdrEgrOvflCnt; | ||
185 | __u64 RxP4HdrEgrOvflCnt; | ||
186 | __u64 RxP5HdrEgrOvflCnt; | ||
187 | __u64 RxP6HdrEgrOvflCnt; | ||
188 | __u64 RxP7HdrEgrOvflCnt; | ||
189 | __u64 RxP8HdrEgrOvflCnt; | ||
190 | __u64 Reserved6; | ||
191 | __u64 Reserved7; | ||
192 | __u64 IBStatusChangeCnt; | ||
193 | __u64 IBLinkErrRecoveryCnt; | ||
194 | __u64 IBLinkDownedCnt; | ||
195 | __u64 IBSymbolErrCnt; | ||
196 | }; | ||
197 | |||
198 | #define IPATH_KREG_OFFSET(field) (offsetof( \ | ||
199 | struct _infinipath_do_not_use_kernel_regs, field) / sizeof(u64)) | ||
153 | #define IPATH_CREG_OFFSET(field) (offsetof( \ | 200 | #define IPATH_CREG_OFFSET(field) (offsetof( \ |
154 | struct infinipath_counters, field) / sizeof(u64)) | 201 | struct _infinipath_do_not_use_counters, field) / sizeof(u64)) |
155 | 202 | ||
156 | static const struct ipath_kregs ipath_ht_kregs = { | 203 | static const struct ipath_kregs ipath_ht_kregs = { |
157 | .kr_control = IPATH_KREG_OFFSET(Control), | 204 | .kr_control = IPATH_KREG_OFFSET(Control), |
@@ -1614,6 +1661,111 @@ static void ipath_ht_free_irq(struct ipath_devdata *dd) | |||
1614 | dd->ipath_intconfig = 0; | 1661 | dd->ipath_intconfig = 0; |
1615 | } | 1662 | } |
1616 | 1663 | ||
1664 | static void ipath_ht_read_counters(struct ipath_devdata *dd, | ||
1665 | struct infinipath_counters *cntrs) | ||
1666 | { | ||
1667 | cntrs->LBIntCnt = | ||
1668 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(LBIntCnt)); | ||
1669 | cntrs->LBFlowStallCnt = | ||
1670 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(LBFlowStallCnt)); | ||
1671 | cntrs->TxSDmaDescCnt = 0; | ||
1672 | cntrs->TxUnsupVLErrCnt = | ||
1673 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxUnsupVLErrCnt)); | ||
1674 | cntrs->TxDataPktCnt = | ||
1675 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxDataPktCnt)); | ||
1676 | cntrs->TxFlowPktCnt = | ||
1677 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxFlowPktCnt)); | ||
1678 | cntrs->TxDwordCnt = | ||
1679 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxDwordCnt)); | ||
1680 | cntrs->TxLenErrCnt = | ||
1681 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxLenErrCnt)); | ||
1682 | cntrs->TxMaxMinLenErrCnt = | ||
1683 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxMaxMinLenErrCnt)); | ||
1684 | cntrs->TxUnderrunCnt = | ||
1685 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxUnderrunCnt)); | ||
1686 | cntrs->TxFlowStallCnt = | ||
1687 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxFlowStallCnt)); | ||
1688 | cntrs->TxDroppedPktCnt = | ||
1689 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxDroppedPktCnt)); | ||
1690 | cntrs->RxDroppedPktCnt = | ||
1691 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxDroppedPktCnt)); | ||
1692 | cntrs->RxDataPktCnt = | ||
1693 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxDataPktCnt)); | ||
1694 | cntrs->RxFlowPktCnt = | ||
1695 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxFlowPktCnt)); | ||
1696 | cntrs->RxDwordCnt = | ||
1697 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxDwordCnt)); | ||
1698 | cntrs->RxLenErrCnt = | ||
1699 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxLenErrCnt)); | ||
1700 | cntrs->RxMaxMinLenErrCnt = | ||
1701 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxMaxMinLenErrCnt)); | ||
1702 | cntrs->RxICRCErrCnt = | ||
1703 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxICRCErrCnt)); | ||
1704 | cntrs->RxVCRCErrCnt = | ||
1705 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxVCRCErrCnt)); | ||
1706 | cntrs->RxFlowCtrlErrCnt = | ||
1707 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxFlowCtrlErrCnt)); | ||
1708 | cntrs->RxBadFormatCnt = | ||
1709 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxBadFormatCnt)); | ||
1710 | cntrs->RxLinkProblemCnt = | ||
1711 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxLinkProblemCnt)); | ||
1712 | cntrs->RxEBPCnt = | ||
1713 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxEBPCnt)); | ||
1714 | cntrs->RxLPCRCErrCnt = | ||
1715 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxLPCRCErrCnt)); | ||
1716 | cntrs->RxBufOvflCnt = | ||
1717 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxBufOvflCnt)); | ||
1718 | cntrs->RxTIDFullErrCnt = | ||
1719 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxTIDFullErrCnt)); | ||
1720 | cntrs->RxTIDValidErrCnt = | ||
1721 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxTIDValidErrCnt)); | ||
1722 | cntrs->RxPKeyMismatchCnt = | ||
1723 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxPKeyMismatchCnt)); | ||
1724 | cntrs->RxP0HdrEgrOvflCnt = | ||
1725 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP0HdrEgrOvflCnt)); | ||
1726 | cntrs->RxP1HdrEgrOvflCnt = | ||
1727 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP1HdrEgrOvflCnt)); | ||
1728 | cntrs->RxP2HdrEgrOvflCnt = | ||
1729 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP2HdrEgrOvflCnt)); | ||
1730 | cntrs->RxP3HdrEgrOvflCnt = | ||
1731 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP3HdrEgrOvflCnt)); | ||
1732 | cntrs->RxP4HdrEgrOvflCnt = | ||
1733 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP4HdrEgrOvflCnt)); | ||
1734 | cntrs->RxP5HdrEgrOvflCnt = | ||
1735 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP5HdrEgrOvflCnt)); | ||
1736 | cntrs->RxP6HdrEgrOvflCnt = | ||
1737 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP6HdrEgrOvflCnt)); | ||
1738 | cntrs->RxP7HdrEgrOvflCnt = | ||
1739 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP7HdrEgrOvflCnt)); | ||
1740 | cntrs->RxP8HdrEgrOvflCnt = | ||
1741 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP8HdrEgrOvflCnt)); | ||
1742 | cntrs->RxP9HdrEgrOvflCnt = 0; | ||
1743 | cntrs->RxP10HdrEgrOvflCnt = 0; | ||
1744 | cntrs->RxP11HdrEgrOvflCnt = 0; | ||
1745 | cntrs->RxP12HdrEgrOvflCnt = 0; | ||
1746 | cntrs->RxP13HdrEgrOvflCnt = 0; | ||
1747 | cntrs->RxP14HdrEgrOvflCnt = 0; | ||
1748 | cntrs->RxP15HdrEgrOvflCnt = 0; | ||
1749 | cntrs->RxP16HdrEgrOvflCnt = 0; | ||
1750 | cntrs->IBStatusChangeCnt = | ||
1751 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(IBStatusChangeCnt)); | ||
1752 | cntrs->IBLinkErrRecoveryCnt = | ||
1753 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(IBLinkErrRecoveryCnt)); | ||
1754 | cntrs->IBLinkDownedCnt = | ||
1755 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(IBLinkDownedCnt)); | ||
1756 | cntrs->IBSymbolErrCnt = | ||
1757 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(IBSymbolErrCnt)); | ||
1758 | cntrs->RxVL15DroppedPktCnt = 0; | ||
1759 | cntrs->RxOtherLocalPhyErrCnt = 0; | ||
1760 | cntrs->PcieRetryBufDiagQwordCnt = 0; | ||
1761 | cntrs->ExcessBufferOvflCnt = dd->ipath_overrun_thresh_errs; | ||
1762 | cntrs->LocalLinkIntegrityErrCnt = | ||
1763 | (dd->ipath_flags & IPATH_GPIO_ERRINTRS) ? | ||
1764 | dd->ipath_lli_errs : dd->ipath_lli_errors; | ||
1765 | cntrs->RxVlErrCnt = 0; | ||
1766 | cntrs->RxDlidFltrCnt = 0; | ||
1767 | } | ||
1768 | |||
1617 | /** | 1769 | /** |
1618 | * ipath_init_iba6110_funcs - set up the chip-specific function pointers | 1770 | * ipath_init_iba6110_funcs - set up the chip-specific function pointers |
1619 | * @dd: the infinipath device | 1771 | * @dd: the infinipath device |
@@ -1638,6 +1790,7 @@ void ipath_init_iba6110_funcs(struct ipath_devdata *dd) | |||
1638 | dd->ipath_f_setextled = ipath_setup_ht_setextled; | 1790 | dd->ipath_f_setextled = ipath_setup_ht_setextled; |
1639 | dd->ipath_f_get_base_info = ipath_ht_get_base_info; | 1791 | dd->ipath_f_get_base_info = ipath_ht_get_base_info; |
1640 | dd->ipath_f_free_irq = ipath_ht_free_irq; | 1792 | dd->ipath_f_free_irq = ipath_ht_free_irq; |
1793 | dd->ipath_f_read_counters = ipath_ht_read_counters; | ||
1641 | 1794 | ||
1642 | /* | 1795 | /* |
1643 | * initialize chip-specific variables | 1796 | * initialize chip-specific variables |
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6120.c b/drivers/infiniband/hw/ipath/ipath_iba6120.c index e6893ebc59d4..97ae11793973 100644 --- a/drivers/infiniband/hw/ipath/ipath_iba6120.c +++ b/drivers/infiniband/hw/ipath/ipath_iba6120.c | |||
@@ -145,10 +145,57 @@ struct _infinipath_do_not_use_kernel_regs { | |||
145 | unsigned long long Reserved12; | 145 | unsigned long long Reserved12; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | #define IPATH_KREG_OFFSET(field) (offsetof(struct \ | 148 | struct _infinipath_do_not_use_counters { |
149 | _infinipath_do_not_use_kernel_regs, field) / sizeof(u64)) | 149 | __u64 LBIntCnt; |
150 | __u64 LBFlowStallCnt; | ||
151 | __u64 Reserved1; | ||
152 | __u64 TxUnsupVLErrCnt; | ||
153 | __u64 TxDataPktCnt; | ||
154 | __u64 TxFlowPktCnt; | ||
155 | __u64 TxDwordCnt; | ||
156 | __u64 TxLenErrCnt; | ||
157 | __u64 TxMaxMinLenErrCnt; | ||
158 | __u64 TxUnderrunCnt; | ||
159 | __u64 TxFlowStallCnt; | ||
160 | __u64 TxDroppedPktCnt; | ||
161 | __u64 RxDroppedPktCnt; | ||
162 | __u64 RxDataPktCnt; | ||
163 | __u64 RxFlowPktCnt; | ||
164 | __u64 RxDwordCnt; | ||
165 | __u64 RxLenErrCnt; | ||
166 | __u64 RxMaxMinLenErrCnt; | ||
167 | __u64 RxICRCErrCnt; | ||
168 | __u64 RxVCRCErrCnt; | ||
169 | __u64 RxFlowCtrlErrCnt; | ||
170 | __u64 RxBadFormatCnt; | ||
171 | __u64 RxLinkProblemCnt; | ||
172 | __u64 RxEBPCnt; | ||
173 | __u64 RxLPCRCErrCnt; | ||
174 | __u64 RxBufOvflCnt; | ||
175 | __u64 RxTIDFullErrCnt; | ||
176 | __u64 RxTIDValidErrCnt; | ||
177 | __u64 RxPKeyMismatchCnt; | ||
178 | __u64 RxP0HdrEgrOvflCnt; | ||
179 | __u64 RxP1HdrEgrOvflCnt; | ||
180 | __u64 RxP2HdrEgrOvflCnt; | ||
181 | __u64 RxP3HdrEgrOvflCnt; | ||
182 | __u64 RxP4HdrEgrOvflCnt; | ||
183 | __u64 RxP5HdrEgrOvflCnt; | ||
184 | __u64 RxP6HdrEgrOvflCnt; | ||
185 | __u64 RxP7HdrEgrOvflCnt; | ||
186 | __u64 RxP8HdrEgrOvflCnt; | ||
187 | __u64 Reserved6; | ||
188 | __u64 Reserved7; | ||
189 | __u64 IBStatusChangeCnt; | ||
190 | __u64 IBLinkErrRecoveryCnt; | ||
191 | __u64 IBLinkDownedCnt; | ||
192 | __u64 IBSymbolErrCnt; | ||
193 | }; | ||
194 | |||
195 | #define IPATH_KREG_OFFSET(field) (offsetof( \ | ||
196 | struct _infinipath_do_not_use_kernel_regs, field) / sizeof(u64)) | ||
150 | #define IPATH_CREG_OFFSET(field) (offsetof( \ | 197 | #define IPATH_CREG_OFFSET(field) (offsetof( \ |
151 | struct infinipath_counters, field) / sizeof(u64)) | 198 | struct _infinipath_do_not_use_counters, field) / sizeof(u64)) |
152 | 199 | ||
153 | static const struct ipath_kregs ipath_pe_kregs = { | 200 | static const struct ipath_kregs ipath_pe_kregs = { |
154 | .kr_control = IPATH_KREG_OFFSET(Control), | 201 | .kr_control = IPATH_KREG_OFFSET(Control), |
@@ -1368,6 +1415,105 @@ static void ipath_pe_free_irq(struct ipath_devdata *dd) | |||
1368 | dd->ipath_irq = 0; | 1415 | dd->ipath_irq = 0; |
1369 | } | 1416 | } |
1370 | 1417 | ||
1418 | static void ipath_pe_read_counters(struct ipath_devdata *dd, | ||
1419 | struct infinipath_counters *cntrs) | ||
1420 | { | ||
1421 | cntrs->LBIntCnt = | ||
1422 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(LBIntCnt)); | ||
1423 | cntrs->LBFlowStallCnt = | ||
1424 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(LBFlowStallCnt)); | ||
1425 | cntrs->TxSDmaDescCnt = 0; | ||
1426 | cntrs->TxUnsupVLErrCnt = | ||
1427 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxUnsupVLErrCnt)); | ||
1428 | cntrs->TxDataPktCnt = | ||
1429 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxDataPktCnt)); | ||
1430 | cntrs->TxFlowPktCnt = | ||
1431 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxFlowPktCnt)); | ||
1432 | cntrs->TxDwordCnt = | ||
1433 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxDwordCnt)); | ||
1434 | cntrs->TxLenErrCnt = | ||
1435 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxLenErrCnt)); | ||
1436 | cntrs->TxMaxMinLenErrCnt = | ||
1437 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxMaxMinLenErrCnt)); | ||
1438 | cntrs->TxUnderrunCnt = | ||
1439 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxUnderrunCnt)); | ||
1440 | cntrs->TxFlowStallCnt = | ||
1441 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxFlowStallCnt)); | ||
1442 | cntrs->TxDroppedPktCnt = | ||
1443 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(TxDroppedPktCnt)); | ||
1444 | cntrs->RxDroppedPktCnt = | ||
1445 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxDroppedPktCnt)); | ||
1446 | cntrs->RxDataPktCnt = | ||
1447 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxDataPktCnt)); | ||
1448 | cntrs->RxFlowPktCnt = | ||
1449 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxFlowPktCnt)); | ||
1450 | cntrs->RxDwordCnt = | ||
1451 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxDwordCnt)); | ||
1452 | cntrs->RxLenErrCnt = | ||
1453 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxLenErrCnt)); | ||
1454 | cntrs->RxMaxMinLenErrCnt = | ||
1455 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxMaxMinLenErrCnt)); | ||
1456 | cntrs->RxICRCErrCnt = | ||
1457 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxICRCErrCnt)); | ||
1458 | cntrs->RxVCRCErrCnt = | ||
1459 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxVCRCErrCnt)); | ||
1460 | cntrs->RxFlowCtrlErrCnt = | ||
1461 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxFlowCtrlErrCnt)); | ||
1462 | cntrs->RxBadFormatCnt = | ||
1463 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxBadFormatCnt)); | ||
1464 | cntrs->RxLinkProblemCnt = | ||
1465 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxLinkProblemCnt)); | ||
1466 | cntrs->RxEBPCnt = | ||
1467 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxEBPCnt)); | ||
1468 | cntrs->RxLPCRCErrCnt = | ||
1469 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxLPCRCErrCnt)); | ||
1470 | cntrs->RxBufOvflCnt = | ||
1471 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxBufOvflCnt)); | ||
1472 | cntrs->RxTIDFullErrCnt = | ||
1473 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxTIDFullErrCnt)); | ||
1474 | cntrs->RxTIDValidErrCnt = | ||
1475 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxTIDValidErrCnt)); | ||
1476 | cntrs->RxPKeyMismatchCnt = | ||
1477 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxPKeyMismatchCnt)); | ||
1478 | cntrs->RxP0HdrEgrOvflCnt = | ||
1479 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP0HdrEgrOvflCnt)); | ||
1480 | cntrs->RxP1HdrEgrOvflCnt = | ||
1481 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP1HdrEgrOvflCnt)); | ||
1482 | cntrs->RxP2HdrEgrOvflCnt = | ||
1483 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP2HdrEgrOvflCnt)); | ||
1484 | cntrs->RxP3HdrEgrOvflCnt = | ||
1485 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP3HdrEgrOvflCnt)); | ||
1486 | cntrs->RxP4HdrEgrOvflCnt = | ||
1487 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(RxP4HdrEgrOvflCnt)); | ||
1488 | cntrs->RxP5HdrEgrOvflCnt = 0; | ||
1489 | cntrs->RxP6HdrEgrOvflCnt = 0; | ||
1490 | cntrs->RxP7HdrEgrOvflCnt = 0; | ||
1491 | cntrs->RxP8HdrEgrOvflCnt = 0; | ||
1492 | cntrs->RxP9HdrEgrOvflCnt = 0; | ||
1493 | cntrs->RxP10HdrEgrOvflCnt = 0; | ||
1494 | cntrs->RxP11HdrEgrOvflCnt = 0; | ||
1495 | cntrs->RxP12HdrEgrOvflCnt = 0; | ||
1496 | cntrs->RxP13HdrEgrOvflCnt = 0; | ||
1497 | cntrs->RxP14HdrEgrOvflCnt = 0; | ||
1498 | cntrs->RxP15HdrEgrOvflCnt = 0; | ||
1499 | cntrs->RxP16HdrEgrOvflCnt = 0; | ||
1500 | cntrs->IBStatusChangeCnt = | ||
1501 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(IBStatusChangeCnt)); | ||
1502 | cntrs->IBLinkErrRecoveryCnt = | ||
1503 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(IBLinkErrRecoveryCnt)); | ||
1504 | cntrs->IBLinkDownedCnt = | ||
1505 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(IBLinkDownedCnt)); | ||
1506 | cntrs->IBSymbolErrCnt = | ||
1507 | ipath_snap_cntr(dd, IPATH_CREG_OFFSET(IBSymbolErrCnt)); | ||
1508 | cntrs->RxVL15DroppedPktCnt = 0; | ||
1509 | cntrs->RxOtherLocalPhyErrCnt = 0; | ||
1510 | cntrs->PcieRetryBufDiagQwordCnt = 0; | ||
1511 | cntrs->ExcessBufferOvflCnt = dd->ipath_overrun_thresh_errs; | ||
1512 | cntrs->LocalLinkIntegrityErrCnt = dd->ipath_lli_errs; | ||
1513 | cntrs->RxVlErrCnt = 0; | ||
1514 | cntrs->RxDlidFltrCnt = 0; | ||
1515 | } | ||
1516 | |||
1371 | /* | 1517 | /* |
1372 | * On platforms using this chip, and not having ordered WC stores, we | 1518 | * On platforms using this chip, and not having ordered WC stores, we |
1373 | * can get TXE parity errors due to speculative reads to the PIO buffers, | 1519 | * can get TXE parity errors due to speculative reads to the PIO buffers, |
@@ -1427,6 +1573,7 @@ void ipath_init_iba6120_funcs(struct ipath_devdata *dd) | |||
1427 | 1573 | ||
1428 | /* initialize chip-specific variables */ | 1574 | /* initialize chip-specific variables */ |
1429 | dd->ipath_f_tidtemplate = ipath_pe_tidtemplate; | 1575 | dd->ipath_f_tidtemplate = ipath_pe_tidtemplate; |
1576 | dd->ipath_f_read_counters = ipath_pe_read_counters; | ||
1430 | 1577 | ||
1431 | /* | 1578 | /* |
1432 | * setup the register offsets, since they are different for each | 1579 | * setup the register offsets, since they are different for each |
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index a59c06943de6..4f7bc08796bc 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -253,6 +253,8 @@ struct ipath_devdata { | |||
253 | int (*ipath_f_get_base_info)(struct ipath_portdata *, void *); | 253 | int (*ipath_f_get_base_info)(struct ipath_portdata *, void *); |
254 | /* free irq */ | 254 | /* free irq */ |
255 | void (*ipath_f_free_irq)(struct ipath_devdata *); | 255 | void (*ipath_f_free_irq)(struct ipath_devdata *); |
256 | void (*ipath_f_read_counters)(struct ipath_devdata *, | ||
257 | struct infinipath_counters *); | ||
256 | struct ipath_ibdev *verbs_dev; | 258 | struct ipath_ibdev *verbs_dev; |
257 | struct timer_list verbs_timer; | 259 | struct timer_list verbs_timer; |
258 | /* total dwords sent (summed from counter) */ | 260 | /* total dwords sent (summed from counter) */ |