summaryrefslogtreecommitdiffstats
path: root/sys/dev/cxgbe
diff options
context:
space:
mode:
authornp <np@FreeBSD.org>2011-06-01 01:32:58 +0000
committernp <np@FreeBSD.org>2011-06-01 01:32:58 +0000
commitc63bfb04c3139c3af9cec31b0e1e350c7bd0bef4 (patch)
treee3d673952540f5676c230a5b2e057b92557f08d3 /sys/dev/cxgbe
parent999fa1966e91a080a0cc5c20ed92bdb7630206f7 (diff)
downloadFreeBSD-src-c63bfb04c3139c3af9cec31b0e1e350c7bd0bef4.zip
FreeBSD-src-c63bfb04c3139c3af9cec31b0e1e350c7bd0bef4.tar.gz
Provide hit-count with rest of the information about a filter.
MFC after: 1 week
Diffstat (limited to 'sys/dev/cxgbe')
-rw-r--r--sys/dev/cxgbe/t4_main.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index d6ce2a5..165a677 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -305,6 +305,7 @@ static uint32_t mode_to_fconf(uint32_t);
static uint32_t fspec_to_fconf(struct t4_filter_specification *);
static int get_filter_mode(struct adapter *, uint32_t *);
static int set_filter_mode(struct adapter *, uint32_t);
+static inline uint64_t get_filter_hits(struct adapter *, uint32_t);
static int get_filter(struct adapter *, struct t4_filter *);
static int set_filter(struct adapter *, struct t4_filter *);
static int del_filter(struct adapter *, struct t4_filter *);
@@ -3064,6 +3065,20 @@ done:
return (rc);
}
+static inline uint64_t
+get_filter_hits(struct adapter *sc, uint32_t fid)
+{
+ uint32_t tcb_base = t4_read_reg(sc, A_TP_CMM_TCB_BASE);
+ uint64_t hits;
+
+ t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, 0),
+ tcb_base + (fid + sc->tids.ftid_base) * TCB_SIZE);
+ t4_read_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, 0));
+ hits = t4_read_reg64(sc, MEMWIN0_BASE + 16);
+
+ return (be64toh(hits));
+}
+
static int
get_filter(struct adapter *sc, struct t4_filter *t)
{
@@ -3087,7 +3102,10 @@ get_filter(struct adapter *sc, struct t4_filter *t)
t->idx = i;
t->l2tidx = f->l2t ? f->l2t->idx : 0;
t->smtidx = f->smtidx;
- t->hits = 0; /* XXX implement */
+ if (f->fs.hitcnts)
+ t->hits = get_filter_hits(sc, t->idx);
+ else
+ t->hits = UINT64_MAX;
t->fs = f->fs;
return (0);
OpenPOWER on IntegriCloud