diff options
author | Steve Wise <swise@opengridcomputing.com> | 2008-07-15 02:48:48 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-07-15 02:48:48 -0400 |
commit | 14cc180f7b032f8484c1a3d0533b1129ffe307fd (patch) | |
tree | 0f544f596e00955f56cb38051c5e2ce3c40c0b40 /drivers/infiniband | |
parent | 7f624d023b5fb150831e02c1e4c0f2619ade72c2 (diff) |
RDMA/cxgb3: Add support for protocol statistics
- Add a new rdma ctl command called RDMA_GET_MIB to the cxgb3 low
level driver to obtain the protocol mib from the rnic hardware.
- Add new iw_cxgb3 provider method to get the MIB from the low level
driver.
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/cxgb3/iwch_provider.c | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index 5f4380657392..18a6609f5e01 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "iwch_provider.h" | 56 | #include "iwch_provider.h" |
57 | #include "iwch_cm.h" | 57 | #include "iwch_cm.h" |
58 | #include "iwch_user.h" | 58 | #include "iwch_user.h" |
59 | #include "common.h" | ||
59 | 60 | ||
60 | static int iwch_modify_port(struct ib_device *ibdev, | 61 | static int iwch_modify_port(struct ib_device *ibdev, |
61 | u8 port, int port_modify_mask, | 62 | u8 port, int port_modify_mask, |
@@ -1245,6 +1246,61 @@ static ssize_t show_board(struct device *dev, struct device_attribute *attr, | |||
1245 | iwch_dev->rdev.rnic_info.pdev->device); | 1246 | iwch_dev->rdev.rnic_info.pdev->device); |
1246 | } | 1247 | } |
1247 | 1248 | ||
1249 | static int iwch_get_mib(struct ib_device *ibdev, | ||
1250 | union rdma_protocol_stats *stats) | ||
1251 | { | ||
1252 | struct iwch_dev *dev; | ||
1253 | struct tp_mib_stats m; | ||
1254 | int ret; | ||
1255 | |||
1256 | PDBG("%s ibdev %p\n", __func__, ibdev); | ||
1257 | dev = to_iwch_dev(ibdev); | ||
1258 | ret = dev->rdev.t3cdev_p->ctl(dev->rdev.t3cdev_p, RDMA_GET_MIB, &m); | ||
1259 | if (ret) | ||
1260 | return -ENOSYS; | ||
1261 | |||
1262 | memset(stats, 0, sizeof *stats); | ||
1263 | stats->iw.ipInReceives = ((u64) m.ipInReceive_hi << 32) + | ||
1264 | m.ipInReceive_lo; | ||
1265 | stats->iw.ipInHdrErrors = ((u64) m.ipInHdrErrors_hi << 32) + | ||
1266 | m.ipInHdrErrors_lo; | ||
1267 | stats->iw.ipInAddrErrors = ((u64) m.ipInAddrErrors_hi << 32) + | ||
1268 | m.ipInAddrErrors_lo; | ||
1269 | stats->iw.ipInUnknownProtos = ((u64) m.ipInUnknownProtos_hi << 32) + | ||
1270 | m.ipInUnknownProtos_lo; | ||
1271 | stats->iw.ipInDiscards = ((u64) m.ipInDiscards_hi << 32) + | ||
1272 | m.ipInDiscards_lo; | ||
1273 | stats->iw.ipInDelivers = ((u64) m.ipInDelivers_hi << 32) + | ||
1274 | m.ipInDelivers_lo; | ||
1275 | stats->iw.ipOutRequests = ((u64) m.ipOutRequests_hi << 32) + | ||
1276 | m.ipOutRequests_lo; | ||
1277 | stats->iw.ipOutDiscards = ((u64) m.ipOutDiscards_hi << 32) + | ||
1278 | m.ipOutDiscards_lo; | ||
1279 | stats->iw.ipOutNoRoutes = ((u64) m.ipOutNoRoutes_hi << 32) + | ||
1280 | m.ipOutNoRoutes_lo; | ||
1281 | stats->iw.ipReasmTimeout = (u64) m.ipReasmTimeout; | ||
1282 | stats->iw.ipReasmReqds = (u64) m.ipReasmReqds; | ||
1283 | stats->iw.ipReasmOKs = (u64) m.ipReasmOKs; | ||
1284 | stats->iw.ipReasmFails = (u64) m.ipReasmFails; | ||
1285 | stats->iw.tcpActiveOpens = (u64) m.tcpActiveOpens; | ||
1286 | stats->iw.tcpPassiveOpens = (u64) m.tcpPassiveOpens; | ||
1287 | stats->iw.tcpAttemptFails = (u64) m.tcpAttemptFails; | ||
1288 | stats->iw.tcpEstabResets = (u64) m.tcpEstabResets; | ||
1289 | stats->iw.tcpOutRsts = (u64) m.tcpOutRsts; | ||
1290 | stats->iw.tcpCurrEstab = (u64) m.tcpCurrEstab; | ||
1291 | stats->iw.tcpInSegs = ((u64) m.tcpInSegs_hi << 32) + | ||
1292 | m.tcpInSegs_lo; | ||
1293 | stats->iw.tcpOutSegs = ((u64) m.tcpOutSegs_hi << 32) + | ||
1294 | m.tcpOutSegs_lo; | ||
1295 | stats->iw.tcpRetransSegs = ((u64) m.tcpRetransSeg_hi << 32) + | ||
1296 | m.tcpRetransSeg_lo; | ||
1297 | stats->iw.tcpInErrs = ((u64) m.tcpInErrs_hi << 32) + | ||
1298 | m.tcpInErrs_lo; | ||
1299 | stats->iw.tcpRtoMin = (u64) m.tcpRtoMin; | ||
1300 | stats->iw.tcpRtoMax = (u64) m.tcpRtoMax; | ||
1301 | return 0; | ||
1302 | } | ||
1303 | |||
1248 | static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); | 1304 | static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); |
1249 | static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); | 1305 | static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); |
1250 | static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); | 1306 | static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); |
@@ -1254,7 +1310,7 @@ static struct device_attribute *iwch_class_attributes[] = { | |||
1254 | &dev_attr_hw_rev, | 1310 | &dev_attr_hw_rev, |
1255 | &dev_attr_fw_ver, | 1311 | &dev_attr_fw_ver, |
1256 | &dev_attr_hca_type, | 1312 | &dev_attr_hca_type, |
1257 | &dev_attr_board_id | 1313 | &dev_attr_board_id, |
1258 | }; | 1314 | }; |
1259 | 1315 | ||
1260 | int iwch_register_device(struct iwch_dev *dev) | 1316 | int iwch_register_device(struct iwch_dev *dev) |
@@ -1325,15 +1381,13 @@ int iwch_register_device(struct iwch_dev *dev) | |||
1325 | dev->ibdev.alloc_fast_reg_mr = iwch_alloc_fast_reg_mr; | 1381 | dev->ibdev.alloc_fast_reg_mr = iwch_alloc_fast_reg_mr; |
1326 | dev->ibdev.alloc_fast_reg_page_list = iwch_alloc_fastreg_pbl; | 1382 | dev->ibdev.alloc_fast_reg_page_list = iwch_alloc_fastreg_pbl; |
1327 | dev->ibdev.free_fast_reg_page_list = iwch_free_fastreg_pbl; | 1383 | dev->ibdev.free_fast_reg_page_list = iwch_free_fastreg_pbl; |
1328 | |||
1329 | dev->ibdev.attach_mcast = iwch_multicast_attach; | 1384 | dev->ibdev.attach_mcast = iwch_multicast_attach; |
1330 | dev->ibdev.detach_mcast = iwch_multicast_detach; | 1385 | dev->ibdev.detach_mcast = iwch_multicast_detach; |
1331 | dev->ibdev.process_mad = iwch_process_mad; | 1386 | dev->ibdev.process_mad = iwch_process_mad; |
1332 | |||
1333 | dev->ibdev.req_notify_cq = iwch_arm_cq; | 1387 | dev->ibdev.req_notify_cq = iwch_arm_cq; |
1334 | dev->ibdev.post_send = iwch_post_send; | 1388 | dev->ibdev.post_send = iwch_post_send; |
1335 | dev->ibdev.post_recv = iwch_post_receive; | 1389 | dev->ibdev.post_recv = iwch_post_receive; |
1336 | 1390 | dev->ibdev.get_protocol_stats = iwch_get_mib; | |
1337 | 1391 | ||
1338 | dev->ibdev.iwcm = kmalloc(sizeof(struct iw_cm_verbs), GFP_KERNEL); | 1392 | dev->ibdev.iwcm = kmalloc(sizeof(struct iw_cm_verbs), GFP_KERNEL); |
1339 | if (!dev->ibdev.iwcm) | 1393 | if (!dev->ibdev.iwcm) |