Skip to content

Commit

Permalink
Added jumbo_frames option
Browse files Browse the repository at this point in the history
  • Loading branch information
max197616 committed Jun 21, 2018
1 parent 2196321 commit 5a4da2f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#define EXTF_TX_DESC_DEFAULT 512
#define PERCENT_URL_ENTRIES 0.20

#define MAX_JUMBO_PKT_LEN 9600

#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 */
Expand Down
2 changes: 2 additions & 0 deletions include/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ struct global_params_t
uint64_t flow_lifetime[2]; // [0] для flows, который завершены или установлены без данных, [1] для flows с данными
uint8_t answer_duplication;
operation_modes operation_mode;
bool jumbo_frames;
unsigned int max_pkt_len;
};

struct common_data_t
Expand Down
27 changes: 25 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ void extFilter::initParams()
}

prm->operation_mode = _operation_mode;
prm->jumbo_frames = config().getBool("jumbo_frames", false);
if(prm->jumbo_frames)
{
unsigned int max_pkt_len = config().getInt("max_pkt_len", MAX_JUMBO_PKT_LEN);
if(max_pkt_len < 64 || max_pkt_len > MAX_JUMBO_PKT_LEN)
{
logger().warning("Invalid packet length in max_pkt_len!");
max_pkt_len = MAX_JUMBO_PKT_LEN;
}
prm->max_pkt_len = max_pkt_len;
}
}

static inline unsigned get_port_max_rx_queues(uint8_t port_id)
Expand Down Expand Up @@ -327,10 +338,22 @@ int extFilter::initPort(uint8_t port, struct ether_addr *addr, bool no_promisc)
portConf.rxmode.header_split = DPDK_CONFIG_HEADER_SPLIT;
portConf.rxmode.hw_ip_checksum = DPDK_CONFIG_HW_IP_CHECKSUM;
portConf.rxmode.hw_vlan_filter = DPDK_CONFIG_HW_VLAN_FILTER;
portConf.rxmode.jumbo_frame = DPDK_CONFIG_JUMBO_FRAME;
if(global_prm->jumbo_frames)
{
portConf.rxmode.jumbo_frame = 1;
portConf.rxmode.max_rx_pkt_len = global_prm->max_pkt_len;
// for dpdk >= 18
/* portConf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
portConf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS; */
}
else
{
// for dpdk >= 18
/* portConf.rxmode.jumbo_frame = DPDK_CONFIG_JUMBO_FRAME; */
portConf.rxmode.max_rx_pkt_len = ETHER_MAX_LEN;
}
portConf.rxmode.hw_strip_crc = DPDK_CONFIG_HW_STRIP_CRC;
portConf.rxmode.mq_mode = DPDK_CONFIG_MQ_MODE;
//<---->portConf.rxmode.max_rx_pkt_len = ETHER_MAX_LEN;

portConf.rx_adv_conf.rss_conf.rss_key = m_RSSKey;
portConf.rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6;
Expand Down

0 comments on commit 5a4da2f

Please sign in to comment.