[ofa-general] [PATCH RFCv2 2/2] RDMA/cxgb3: Add support for protocol statistics.
Steve Wise
swise at opengridcomputing.com
Tue Jun 17 14:38:59 PDT 2008
- 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 at opengridcomputing.com>
---
drivers/infiniband/hw/cxgb3/iwch_provider.c | 50 +++++++++++++++++++++++++--
drivers/net/cxgb3/cxgb3_ctl_defs.h | 1 +
drivers/net/cxgb3/cxgb3_offload.c | 7 ++++
3 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 193dfe7..89af953 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -56,6 +56,7 @@
#include "iwch_provider.h"
#include "iwch_cm.h"
#include "iwch_user.h"
+#include "common.h"
static int iwch_modify_port(struct ib_device *ibdev,
u8 port, int port_modify_mask,
@@ -1210,6 +1211,49 @@ static ssize_t show_board(struct device *dev, struct device_attribute *attr,
iwch_dev->rdev.rnic_info.pdev->device);
}
+static int iwch_get_mib(struct ib_device *ibdev,
+ union rdma_protocol_stats *stats)
+{
+ struct iwch_dev *dev;
+ struct tp_mib_stats m;
+ int ret;
+
+ PDBG("%s ibdev %p\n", __func__, ibdev);
+ dev = to_iwch_dev(ibdev);
+ ret = dev->rdev.t3cdev_p->ctl(dev->rdev.t3cdev_p, RDMA_GET_MIB, &m);
+ if (ret)
+ return -ENOSYS;
+
+ memset(stats, 0, sizeof *stats);
+ stats->iw.ipInReceive = m.ipInReceive_hi + m.ipInReceive_lo;
+ stats->iw.ipInHdrErrors = m.ipInHdrErrors_hi + m.ipInHdrErrors_lo;
+ stats->iw.ipInAddrErrors = m.ipInAddrErrors_hi + m.ipInAddrErrors_lo;
+ stats->iw.ipInUnknownProtos = m.ipInUnknownProtos_hi +
+ m.ipInUnknownProtos_lo;
+ stats->iw.ipInDiscards = m.ipInDiscards_hi + m.ipInDiscards_lo;
+ stats->iw.ipInDelivers = m.ipInDelivers_hi + m.ipInDelivers_lo;
+ stats->iw.ipOutRequests = m.ipOutRequests_hi + m.ipOutRequests_lo;
+ stats->iw.ipOutDiscards = m.ipOutDiscards_hi + m.ipOutDiscards_lo;
+ stats->iw.ipOutNoRoutes = m.ipOutNoRoutes_hi + m.ipOutNoRoutes_lo;
+ stats->iw.ipReasmTimeout = m.ipReasmTimeout;
+ stats->iw.ipReasmReqds = m.ipReasmReqds;
+ stats->iw.ipReasmOKs = m.ipReasmOKs;
+ stats->iw.ipReasmFails = m.ipReasmFails;
+ stats->iw.tcpActiveOpens = m.tcpActiveOpens;
+ stats->iw.tcpPassiveOpens = m.tcpPassiveOpens;
+ stats->iw.tcpAttemptFails = m.tcpAttemptFails;
+ stats->iw.tcpEstabResets = m.tcpEstabResets;
+ stats->iw.tcpOutRsts = m.tcpOutRsts;
+ stats->iw.tcpCurrEstab = m.tcpCurrEstab;
+ stats->iw.tcpInSegs = m.tcpInSegs_hi + m.tcpInSegs_lo;
+ stats->iw.tcpOutSegs = m.tcpOutSegs_hi + m.tcpOutSegs_lo;
+ stats->iw.tcpRetransSeg = m.tcpRetransSeg_hi + m.tcpRetransSeg_lo;
+ stats->iw.tcpInErrs = m.tcpInErrs_hi + m.tcpInErrs_lo;
+ stats->iw.tcpRtoMin = m.tcpRtoMin;
+ stats->iw.tcpRtoMax = m.tcpRtoMax;
+ return 0;
+}
+
static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL);
static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL);
static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL);
@@ -1219,7 +1263,7 @@ static struct device_attribute *iwch_class_attributes[] = {
&dev_attr_hw_rev,
&dev_attr_fw_ver,
&dev_attr_hca_type,
- &dev_attr_board_id
+ &dev_attr_board_id,
};
int iwch_register_device(struct iwch_dev *dev)
@@ -1290,15 +1334,13 @@ int iwch_register_device(struct iwch_dev *dev)
dev->ibdev.alloc_fast_reg_mr = iwch_alloc_fast_reg_mr;
dev->ibdev.alloc_fast_reg_page_list = iwch_alloc_fastreg_pbl;
dev->ibdev.free_fast_reg_page_list = iwch_free_fastreg_pbl;
-
dev->ibdev.attach_mcast = iwch_multicast_attach;
dev->ibdev.detach_mcast = iwch_multicast_detach;
dev->ibdev.process_mad = iwch_process_mad;
-
dev->ibdev.req_notify_cq = iwch_arm_cq;
dev->ibdev.post_send = iwch_post_send;
dev->ibdev.post_recv = iwch_post_receive;
-
+ dev->ibdev.get_protocol_stats = iwch_get_mib;
dev->ibdev.iwcm = kmalloc(sizeof(struct iw_cm_verbs), GFP_KERNEL);
if (!dev->ibdev.iwcm)
diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 6c4f320..ed0ecd9 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -54,6 +54,7 @@ enum {
RDMA_CQ_DISABLE = 16,
RDMA_CTRL_QP_SETUP = 17,
RDMA_GET_MEM = 18,
+ RDMA_GET_MIB = 19,
GET_RX_PAGE_INFO = 50,
};
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index ff9c013..cf26968 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -303,6 +303,12 @@ static int cxgb_rdma_ctl(struct adapter *adapter, unsigned int req, void *data)
spin_unlock_irq(&adapter->sge.reg_lock);
break;
}
+ case RDMA_GET_MIB: {
+ spin_lock(&adapter->stats_lock);
+ t3_tp_get_mib_stats(adapter, (struct tp_mib_stats *)data);
+ spin_unlock(&adapter->stats_lock);
+ break;
+ }
default:
ret = -EOPNOTSUPP;
}
@@ -381,6 +387,7 @@ static int cxgb_offload_ctl(struct t3cdev *tdev, unsigned int req, void *data)
case RDMA_CQ_DISABLE:
case RDMA_CTRL_QP_SETUP:
case RDMA_GET_MEM:
+ case RDMA_GET_MIB:
if (!offload_running(adapter))
return -EAGAIN;
return cxgb_rdma_ctl(adapter, req, data);
More information about the general
mailing list