summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
diff options
context:
space:
mode:
authorKumar Sanghvi2017-11-01 04:23:03 +0100
committerDavid S. Miller2017-11-01 14:06:03 +0100
commit9d922d4b016d3d7908dd70112aaf46a38313d866 (patch)
treec8e6ab827d6c662b94348e5b30aad7a87c2ba404 /drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
parentcxgb4: add support to delete hash filter (diff)
downloadkernel-qcow2-linux-9d922d4b016d3d7908dd70112aaf46a38313d866.tar.gz
kernel-qcow2-linux-9d922d4b016d3d7908dd70112aaf46a38313d866.tar.xz
kernel-qcow2-linux-9d922d4b016d3d7908dd70112aaf46a38313d866.zip
cxgb4: add support to retrieve stats for hash filters
Add support to retrieve packet-count and byte-count for hash-filters by retrieving filter-entry appropriately based on whether the request is for hash-filter or not. Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
index eb6ba9824501..9b3ff6209eb5 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
@@ -341,7 +341,7 @@ static int get_filter_steerq(struct net_device *dev,
}
static int get_filter_count(struct adapter *adapter, unsigned int fidx,
- u64 *pkts, u64 *bytes)
+ u64 *pkts, u64 *bytes, bool hash)
{
unsigned int tcb_base, tcbaddr;
unsigned int word_offset;
@@ -350,14 +350,24 @@ static int get_filter_count(struct adapter *adapter, unsigned int fidx,
int ret;
tcb_base = t4_read_reg(adapter, TP_CMM_TCB_BASE_A);
- if ((fidx != (adapter->tids.nftids + adapter->tids.nsftids - 1)) &&
- fidx >= adapter->tids.nftids)
- return -E2BIG;
-
- f = &adapter->tids.ftid_tab[fidx];
- if (!f->valid)
- return -EINVAL;
+ if (is_hashfilter(adapter) && hash) {
+ if (fidx < adapter->tids.ntids) {
+ f = adapter->tids.tid_tab[fidx];
+ if (!f)
+ return -EINVAL;
+ } else {
+ return -E2BIG;
+ }
+ } else {
+ if ((fidx != (adapter->tids.nftids +
+ adapter->tids.nsftids - 1)) &&
+ fidx >= adapter->tids.nftids)
+ return -E2BIG;
+ f = &adapter->tids.ftid_tab[fidx];
+ if (!f->valid)
+ return -EINVAL;
+ }
tcbaddr = tcb_base + f->tid * TCB_SIZE;
spin_lock(&adapter->win0_lock);
@@ -409,11 +419,11 @@ out:
}
int cxgb4_get_filter_counters(struct net_device *dev, unsigned int fidx,
- u64 *hitcnt, u64 *bytecnt)
+ u64 *hitcnt, u64 *bytecnt, bool hash)
{
struct adapter *adapter = netdev2adap(dev);
- return get_filter_count(adapter, fidx, hitcnt, bytecnt);
+ return get_filter_count(adapter, fidx, hitcnt, bytecnt, hash);
}
int cxgb4_get_free_ftid(struct net_device *dev, int family)