2525#include "gatekeeper_net.h"
2626#include "gatekeeper_flow.h"
2727
28- /* Data structure for IP counter */
29- struct ip_counter
28+ /* Data structure for Counter Table */
29+ struct counter_table
3030{
31- struct counter_table
32- {
3331 /* Counter for IPV4 address */
3432 struct rte_hash * ct_ip4 ;
35-
33+
3634 /* Counter for IPV6 address */
3735 struct rte_hash * ct_ip6 ;
38- } ct_table ;
36+ } ;
3937
40- struct counter_bucket
41- {
42- /* Bucket for IPV4 address */
43- struct rte_hash * bkt_ip4 ;
38+ /* Data structure for Counter bucket */
39+ struct counter_bucket {
40+
41+ int proto ;
4442
45- /* Bucket for IPV6 address */
46- struct rte_hash * bkt_ip6 ;
47- } ct_bkt ;
43+ union {
44+ /* Bucket for IPV4 address */
45+ struct rte_hash * bkt_ip4 ;
46+
47+ /* Bucket for IPV6 address */
48+ struct rte_hash * bkt_ip6 ;
49+ } bkt ;
4850};
4951
50- /* Data structure of bucket data */
51- struct bucket_data
52- {
53- int err ;
54- int next_bkt_id ;
55- struct ip_flow * flow ;
52+ /* Data present in a Counter bucket */
53+ struct bucket_data {
54+ int err ;
55+ struct ip_flow flow ;
5656};
5757
5858/* Data structure of IP data */
59- struct ip_data
60- {
61- int * bkt_id ;
62- struct ip_flow * flow ;
63- struct bucket_data * bkt_data ;
59+ struct ip_data {
60+ int bkt_id ;
61+ struct bucket_data bkt_data ;
6462};
6563
6664static int
67- setup_bucket_params (unsigned int socket_id , int bkt_id , int ip_ver ,
65+ setup_bucket_params (unsigned int socket_id , int bkt_id , int ip_ver ,
6866 int bkt_size , struct rte_hash_parameters * bkt_hash_params );
6967
7068static int
71- create_bucket (struct gatekeeper_if * iface , struct gk_config * gk_conf , int bkt_id );
69+ create_bucket (struct gatekeeper_if * iface , struct gk_config * gk_conf ,
70+ int bkt_id );
7271
7372static int
7473get_bucket (int bkt_id , int proto , struct counter_bucket * ct_bkt );
@@ -93,37 +92,36 @@ static int
9392create_counter_table (struct gatekeeper_if * iface , struct gk_config * gk_conf );
9493
9594static int
96- get_bucket_id (struct counter_table * ct_table , struct ip_flow * flow , int * bkt_id );
95+ get_bucket_id (struct counter_table * ct_table , struct ip_flow * flow ,
96+ int * bkt_id );
9797
9898static int
99- add_bucket_id (struct counter_table * ct_table , struct ip_flow * flow , int * bkt_id );
99+ add_bucket_id (struct counter_table * ct_table , struct ip_flow * flow ,
100+ int * bkt_id );
100101
101102static int
102103delete_bucket_id (struct counter_table * ct_table , struct ip_flow * flow );
103104
104- /*
105105static int
106- update_bucket_id(struct counter_table *ct_table, struct ip_flow *flow,
107- int *bkt_id, int *old_bkt_id);
108- */
106+ update_bucket_id (struct counter_table * ct_table , struct ip_flow * flow );
109107
110108static int
111- get_ip_entry (struct ip_counter * counter , struct ip_flow * flow ,
109+ get_ip_data (struct counter_table * ct_table , struct ip_flow * flow ,
112110 struct ip_data * data );
113111
114112static int
115- add_ip_entry (struct ip_counter * counter , struct ip_flow * flow ,
113+ add_ip_data (struct counter_table * ct_table , struct ip_flow * flow ,
116114 struct ip_data * data );
117115
118116static int
119- delete_ip_entry (struct ip_counter * counter , struct ip_flow * flow );
117+ delete_ip_data (struct counter_table * ct_table , struct ip_flow * flow );
120118
121119static int
122- update_ip_entry (struct ip_counter * counter , struct ip_flow * flow , struct ip_data * data ,
120+ update_ip_data (struct counter_table * ct_table , struct ip_flow * flow ,
123121 struct gatekeeper_if * iface , struct gk_config * gk_conf );
124122
125123static int
126- space_saving (struct ip_counter * counter , struct ip_flow * flow ,
124+ space_saving (struct counter_table * ct_table , struct ip_flow * flow ,
127125 struct gatekeeper_if * iface , struct gk_config * gk_conf );
128126
129127int run (struct gatekeeper_if * iface , struct gk_config * gk_conf );
0 commit comments