Skip to content

Commit

Permalink
Version 0.99a
Browse files Browse the repository at this point in the history
  • Loading branch information
max197616 committed Jun 21, 2018
1 parent 870745e commit cb95e36
Show file tree
Hide file tree
Showing 17 changed files with 774 additions and 431 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT(extFilter, 0.97, [email protected])
AC_INIT(extFilter, 0.99a, [email protected])

DPDK_HOME=
DPDK_TARGET=
Expand Down
2 changes: 1 addition & 1 deletion include/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

noinst_HEADERS = main.h worker.h statistictask.h sender.h sendertask.h stats.h reloadtask.h flow.h dtypes.h dpdk.h acl.h cmdlinetask.h notification.h tries.h cfg.h utils.h http.h params.h arr.h ssl.h ssli.h
noinst_HEADERS = main.h worker.h statistictask.h sender.h sendertask.h stats.h reloadtask.h flow.h dtypes.h dpdk.h acl.h cmdlinetask.h notification.h tries.h cfg.h utils.h http.h params.h arr.h ssl.h ssli.h bworker.h
5 changes: 3 additions & 2 deletions include/acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
#include <rte_ip.h>
#include <map>
#include <string>
#include "worker.h"
#include "main.h"
#include <set>
//#include "worker.h"
#include "cfg.h"

#define MAX_ACL_RULE_NUM 100000
#define DEFAULT_MAX_CATEGORIES 1
Expand Down
14 changes: 14 additions & 0 deletions include/bworker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

#pragma once

#include "worker.h"

class BWorkerThread: public WorkerThread
{
public:
BWorkerThread(uint8_t worker_id, const std::string& name, WorkerConfig &workerConfig, dpi_library_state_t* state, struct ESender::nparams &sp, struct rte_mempool *mp);
~BWorkerThread() {}

bool run(uint32_t coreId);
};

20 changes: 15 additions & 5 deletions include/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,33 @@

#pragma once

#include "params.h"

// maximum active threads
#define MAX_WORKER_THREADS 10

#define DEFAULT_MBUF_POOL_SIZE 8191
#define MAX_RX_QUEUE_PER_LCORE 16
#define MAX_LCORE_PARAMS 1024
#define NB_SOCKETS 4
#define MAX_RX_QUEUE_PER_PORT 128
#define EXTF_RX_DESC_DEFAULT 256
#define EXTF_TX_DESC_DEFAULT 512
#define PERCENT_URL_ENTRIES 0.20

#define EXTFILTER_CAPTURE_BURST_SIZE 32
#define EXTFILTER_WORKER_BURST_SIZE EXTFILTER_CAPTURE_BURST_SIZE
#define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */

#define MAX_REDIRECT_URL_SIZE 1189


const char r_line1[] = "HTTP/1.1 302 Moved Temporarily\r\n";
const char r_line2[] = "Location: ";
const char r_line3[] = "\r\nContent-Length: 0\r\nConnection: close\r\n\r\n";
const char f_lines[] = "HTTP/1.1 403 Forbidden\r\nConnection: close\r\n\r\n";
const char f_lines[] = "HTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\nConnection: close\r\n\r\n";

const char uri_p[] = "uri=http%3A%2F%2F";

#define OUR_REDIR_SIZE (sizeof(r_line1) + sizeof(r_line2) + sizeof(r_line3) - 3)
#define OUR_PAYLOAD_SIZE 1400

extern const global_params_t *global_prm;
extern worker_params_t worker_params[MAX_WORKER_THREADS];

59 changes: 5 additions & 54 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,52 +28,11 @@
#include "notification.h"
#include "tries.h"

#define DEFAULT_MBUF_POOL_SIZE 8191
#define MAX_RX_QUEUE_PER_LCORE 16
#define MAX_LCORE_PARAMS 1024
#define NB_SOCKETS 4
#define MAX_RX_QUEUE_PER_PORT 128
#define EXTF_RX_DESC_DEFAULT 256
#define EXTF_TX_DESC_DEFAULT 512
#define PERCENT_URL_ENTRIES 0.20
#define EXTF_MAX_PKT_BURST 32

class AhoCorasickPlus;
class Patricia;
class ACL;

struct lcore_params {
uint8_t port_id;
uint8_t port_type;
uint8_t queue_id;
uint8_t lcore_id;
uint8_t mapto;
} __rte_cache_aligned;

struct lcore_rx_queue {
uint8_t port_id;
uint8_t port_type;
uint8_t queue_id;
} __rte_cache_aligned;

struct mbuf_table
{
uint16_t len;
struct rte_mbuf* m_table[EXTF_MAX_PKT_BURST];
};

struct lcore_conf {
uint16_t n_rx_queue;
struct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE];
struct rte_acl_ctx *cur_acx_ipv4, *new_acx_ipv4;
struct rte_acl_ctx *cur_acx_ipv6, *new_acx_ipv6;
uint8_t sender_port;
uint16_t tx_queue;
uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
} __rte_cache_aligned;


class extFilter: public Poco::Util::ServerApplication
{

Expand Down Expand Up @@ -126,16 +85,6 @@ class extFilter: public Poco::Util::ServerApplication
return _notify_acl_file;
}

static inline uint64_t getTscHz()
{
return _tsc_hz;
}

static inline struct rte_mempool *getPktInfoPool()
{
return packet_info_pool[rte_socket_id()];
}

static inline struct lcore_conf *getLcoreConf(uint32_t lcore_id)
{
return &_lcore_conf[lcore_id];
Expand Down Expand Up @@ -195,7 +144,10 @@ class extFilter: public Poco::Util::ServerApplication
return &_tries;
}

static rte_mempool *packet_info_pool[NB_SOCKETS];
inline operation_modes getOperationMode()
{
return _operation_mode;
}

static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
private:
Expand All @@ -209,6 +161,7 @@ class extFilter: public Poco::Util::ServerApplication
int _init_lcore_rx_queues(void);
int _check_lcore_params(void);
int _check_port_config(const unsigned nb_ports);
int initDPIMemPools();

bool _helpRequested;
bool _listDPDKPorts;
Expand All @@ -226,8 +179,6 @@ class extFilter: public Poco::Util::ServerApplication
int _statistic_interval;

struct CSender::params _sender_params;

static uint64_t _tsc_hz;

int _numa_on;
uint32_t _enabled_port_mask;
Expand Down
62 changes: 62 additions & 0 deletions include/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include <rte_config.h>
#include <rte_malloc.h>
#include "dtypes.h"
#include "cfg.h"

class FlowStorage;
struct rte_mempool;
Expand Down Expand Up @@ -64,6 +66,18 @@ struct fragmentation_configs_t
fragmentation_config_t ipv6;
};

struct memory_pool_t
{
rte_mempool *mempool;
uint32_t entries; // количество элементов
};

struct memory_pools_t
{
memory_pool_t ssl_entries;
memory_pool_t http_entries;
};

struct global_params_t
{
memory_configs_t memory_configs;
Expand All @@ -72,6 +86,12 @@ struct global_params_t
uint8_t workers_number;
uint64_t flow_lifetime[2]; // [0] для flows, который завершены или установлены без данных, [1] для flows с данными
uint8_t answer_duplication;
operation_modes operation_mode;
};

struct common_data_t
{
memory_pools_t mempools;
};

struct flow_storage_t
Expand All @@ -89,4 +109,46 @@ struct worker_params_t
uint16_t tx_queue_id;
} __rte_cache_aligned;

struct lcore_params {
uint8_t port_id;
uint8_t port_type;
uint8_t queue_id;
uint8_t lcore_id;
uint8_t mapto;
} __rte_cache_aligned;

struct lcore_rx_queue {
uint8_t port_id;
uint8_t port_type;
uint8_t queue_id;
} __rte_cache_aligned;

struct mbuf_table
{
uint16_t len;
struct rte_mbuf* m_table[EXTFILTER_CAPTURE_BURST_SIZE];
};

struct lcore_conf {
uint16_t n_rx_queue;
struct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE];
struct rte_acl_ctx *cur_acx_ipv4, *new_acx_ipv4;
struct rte_acl_ctx *cur_acx_ipv6, *new_acx_ipv6;
uint8_t sender_port;
uint16_t n_tx_port;
uint16_t tx_queue;
uint16_t tx_port_id[RTE_MAX_ETHPORTS];
uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
} __rte_cache_aligned;

struct filter_tx
{
struct mbuf_table *mbuf;
bool to_client;
};


extern const global_params_t *global_prm;
extern common_data_t *common_data;
extern worker_params_t worker_params[MAX_WORKER_THREADS];
Loading

0 comments on commit cb95e36

Please sign in to comment.