summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@broadcom.com>2017-10-26 11:51:31 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-28 00:02:45 +0900
commit5a84acbebb22f93dfc9ce1e5f0427c45c94acb33 (patch)
treecefba34b1f898f8c5e224ad87044b16160c5bad5 /drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
parentf484f6782e013138946122ae09c100c9e4b547e3 (diff)
bnxt_en: query cfa flow stats periodically to compute 'lastused' attribute
This patch implements periodic querying of cfa flow stats in batches to compute the 'lastused' attribute of TC flow stats. Signed-off-by: Sathya Perla <sathya.perla@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h')
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
index 2beccd41c886..404f98dea0ab 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
@@ -78,11 +78,6 @@ struct bnxt_tc_actions {
struct ip_tunnel_key tun_encap_key;
};
-struct bnxt_tc_flow_stats {
- u64 packets;
- u64 bytes;
-};
-
struct bnxt_tc_flow {
u32 flags;
#define BNXT_TC_FLOW_FLAGS_ETH_ADDRS BIT(1)
@@ -119,6 +114,10 @@ struct bnxt_tc_flow {
/* previous snap-shot of stats */
struct bnxt_tc_flow_stats prev_stats;
unsigned long lastused; /* jiffies */
+ /* for calculating delta from prev_stats and
+ * updating prev_stats atomically.
+ */
+ spinlock_t stats_lock;
};
/* Tunnel encap/decap hash table
@@ -195,6 +194,12 @@ int bnxt_tc_setup_flower(struct bnxt *bp, u16 src_fid,
struct tc_cls_flower_offload *cls_flower);
int bnxt_init_tc(struct bnxt *bp);
void bnxt_shutdown_tc(struct bnxt *bp);
+void bnxt_tc_flow_stats_work(struct bnxt *bp);
+
+static inline bool bnxt_tc_flower_enabled(struct bnxt *bp)
+{
+ return bp->tc_info.enabled;
+}
#else /* CONFIG_BNXT_FLOWER_OFFLOAD */
@@ -212,5 +217,14 @@ static inline int bnxt_init_tc(struct bnxt *bp)
static inline void bnxt_shutdown_tc(struct bnxt *bp)
{
}
+
+static inline void bnxt_tc_flow_stats_work(struct bnxt *bp)
+{
+}
+
+static inline bool bnxt_tc_flower_enabled(struct bnxt *bp)
+{
+ return false;
+}
#endif /* CONFIG_BNXT_FLOWER_OFFLOAD */
#endif /* BNXT_TC_H */