Skip to content

Commit

Permalink
Improvements #1
Browse files Browse the repository at this point in the history
  • Loading branch information
gogapp committed Jun 17, 2018
1 parent a3005ed commit c9797fc
Show file tree
Hide file tree
Showing 2 changed files with 677 additions and 618 deletions.
72 changes: 35 additions & 37 deletions include/space_saving.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,50 +25,49 @@
#include "gatekeeper_net.h"
#include "gatekeeper_flow.h"

/* Data structure for IP counter */
struct ip_counter
/* Data structure for Counter Table */
struct counter_table
{
struct counter_table
{
/* Counter for IPV4 address */
struct rte_hash *ct_ip4;

/* Counter for IPV6 address */
struct rte_hash *ct_ip6;
} ct_table;
};

struct counter_bucket
{
/* Bucket for IPV4 address */
struct rte_hash *bkt_ip4;
/* Data structure for Counter bucket */
struct counter_bucket {

int proto;

/* Bucket for IPV6 address */
struct rte_hash *bkt_ip6;
} ct_bkt;
union {
/* Bucket for IPV4 address */
struct rte_hash *bkt_ip4;

/* Bucket for IPV6 address */
struct rte_hash *bkt_ip6;
} bkt;
};

/* Data structure of bucket data */
struct bucket_data
{
int err;
int next_bkt_id;
struct ip_flow *flow;
/* Data present in a Counter bucket */
struct bucket_data {
int err;
struct ip_flow flow;
};

/* Data structure of IP data */
struct ip_data
{
int *bkt_id;
struct ip_flow *flow;
struct bucket_data *bkt_data;
struct ip_data {
int bkt_id;
struct bucket_data bkt_data;
};

static int
setup_bucket_params(unsigned int socket_id, int bkt_id, int ip_ver,
setup_bucket_params(unsigned int socket_id, int bkt_id, int ip_ver,
int bkt_size, struct rte_hash_parameters *bkt_hash_params);

static int
create_bucket(struct gatekeeper_if *iface, struct gk_config *gk_conf, int bkt_id);
create_bucket(struct gatekeeper_if *iface, struct gk_config *gk_conf,
int bkt_id);

static int
get_bucket(int bkt_id, int proto, struct counter_bucket *ct_bkt);
Expand All @@ -93,37 +92,36 @@ static int
create_counter_table(struct gatekeeper_if *iface, struct gk_config *gk_conf);

static int
get_bucket_id(struct counter_table *ct_table, struct ip_flow *flow, int *bkt_id);
get_bucket_id(struct counter_table *ct_table, struct ip_flow *flow,
int *bkt_id);

static int
add_bucket_id(struct counter_table *ct_table, struct ip_flow *flow, int *bkt_id);
add_bucket_id(struct counter_table *ct_table, struct ip_flow *flow,
int *bkt_id);

static int
delete_bucket_id(struct counter_table *ct_table, struct ip_flow *flow);

/*
static int
update_bucket_id(struct counter_table *ct_table, struct ip_flow *flow,
int *bkt_id, int *old_bkt_id);
*/
update_bucket_id(struct counter_table *ct_table, struct ip_flow *flow);

static int
get_ip_entry(struct ip_counter *counter, struct ip_flow *flow,
get_ip_data(struct counter_table *ct_table, struct ip_flow *flow,
struct ip_data *data);

static int
add_ip_entry(struct ip_counter *counter, struct ip_flow *flow,
add_ip_data(struct counter_table *ct_table, struct ip_flow *flow,
struct ip_data *data);

static int
delete_ip_entry(struct ip_counter *counter, struct ip_flow *flow);
delete_ip_data(struct counter_table *ct_table, struct ip_flow *flow);

static int
update_ip_entry(struct ip_counter *counter, struct ip_flow *flow, struct ip_data *data,
update_ip_data(struct counter_table *ct_table, struct ip_flow *flow,
struct gatekeeper_if *iface, struct gk_config *gk_conf);

static int
space_saving(struct ip_counter *counter, struct ip_flow *flow,
space_saving(struct counter_table *ct_table, struct ip_flow *flow,
struct gatekeeper_if *iface, struct gk_config *gk_conf);

int run (struct gatekeeper_if *iface, struct gk_config *gk_conf);
Expand Down
Loading

0 comments on commit c9797fc

Please sign in to comment.