diff options
author | Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com> | 2017-06-29 22:08:18 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-01 08:51:32 -0700 |
commit | abfcdc1de9bf38cdde6792a165c75d9037ea35fe (patch) | |
tree | dc25b91491344a9ece0f7bc4f0334155eb900101 /drivers/net/ethernet/netronome/nfp/flower/main.h | |
parent | 43f84b72c50d40c3eb2f59070e40ef51bfd483cc (diff) | |
download | linux-next-abfcdc1de9bf38cdde6792a165c75d9037ea35fe.tar.gz |
nfp: add a stats handler for flower offloads
Previously there was no way of updating flow rule stats after they
have been offloaded to hardware. This is solved by keeping track of
stats received from hardware and providing this to the TC handler
on request.
Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/flower/main.h')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/flower/main.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h index 61a80becf3b2..9e64c048e83f 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/main.h +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h @@ -43,6 +43,9 @@ struct tc_to_netdev; struct net_device; struct nfp_app; +#define NFP_FL_STATS_ENTRY_RS BIT(20) +#define NFP_FL_STATS_ELEM_RS 4 +#define NFP_FL_REPEATED_HASH_MAX BIT(17) #define NFP_FLOWER_HASH_BITS 19 #define NFP_FLOWER_MASK_ENTRY_RS 256 #define NFP_FLOWER_MASK_ELEMENT_RS 1 @@ -60,11 +63,18 @@ struct nfp_fl_mask_id { u8 init_unallocated; }; +struct nfp_fl_stats_id { + struct circ_buf free_list; + u32 init_unalloc; + u8 repeated_em_count; +}; + /** * struct nfp_flower_priv - Flower APP per-vNIC priv data * @nn: Pointer to vNIC * @mask_id_seed: Seed used for mask hash table * @flower_version: HW version of flower + * @stats_ids: List of free stats ids * @mask_ids: List of free mask ids * @mask_table: Hash table used to store masks * @flow_table: Hash table used to store flower rules @@ -73,6 +83,7 @@ struct nfp_flower_priv { struct nfp_net *nn; u32 mask_id_seed; u64 flower_version; + struct nfp_fl_stats_id stats_ids; struct nfp_fl_mask_id mask_ids; DECLARE_HASHTABLE(mask_table, NFP_FLOWER_MASK_HASH_BITS); DECLARE_HASHTABLE(flow_table, NFP_FLOWER_HASH_BITS); @@ -95,16 +106,31 @@ struct nfp_fl_rule_metadata { __be32 shortcut; }; +struct nfp_fl_stats { + u64 pkts; + u64 bytes; + u64 used; +}; + struct nfp_fl_payload { struct nfp_fl_rule_metadata meta; unsigned long tc_flower_cookie; struct hlist_node link; struct rcu_head rcu; + spinlock_t lock; /* lock stats */ + struct nfp_fl_stats stats; char *unmasked_data; char *mask_data; char *action_data; }; +struct nfp_fl_stats_frame { + __be32 stats_con_id; + __be32 pkt_count; + __be64 byte_count; + __be64 stats_cookie; +}; + int nfp_flower_metadata_init(struct nfp_app *app); void nfp_flower_metadata_cleanup(struct nfp_app *app); @@ -128,4 +154,6 @@ nfp_flower_search_fl_table(struct nfp_app *app, unsigned long tc_flower_cookie); struct nfp_fl_payload * nfp_flower_remove_fl_table(struct nfp_app *app, unsigned long tc_flower_cookie); +void nfp_flower_rx_flow_stats(struct nfp_app *app, struct sk_buff *skb); + #endif |