mirror of https://github.com/F-Stack/f-stack.git
Add vlan_filter argument in config.ini for RSS with vlan.
Set Rx VLAN filter, and then the dirvier(such as MLX5) will set FLOW RSS to enable L3/L4 RSS below vlan hdr. This action won't need after DPDK-20.11.
This commit is contained in:
parent
49a21bc2e0
commit
2b8b0936db
|
@ -24,6 +24,10 @@ tso=0
|
|||
# HW vlan strip, default: enabled.
|
||||
vlan_strip=1
|
||||
|
||||
# Set vlan filter id, to enable L3/L4 RSS below vlan hdr.
|
||||
# the format is same as port_list
|
||||
#vlan_filter=1,2,4-6
|
||||
|
||||
# sleep when no pkts incomming
|
||||
# unit: microseconds
|
||||
idle_sleep=0
|
||||
|
|
|
@ -367,6 +367,14 @@ parse_port_slave_list(struct ff_port_cfg *cfg, const char *v_str)
|
|||
return res;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_vlan_filter_list(struct ff_config *cfg, const char *v_str)
|
||||
{
|
||||
cfg->dpdk.nb_vlan_filter = DPDK_MAX_VLAN_FILTER;
|
||||
uint16_t *vlan_filter = cfg->dpdk.vlan_filter_id;
|
||||
return __parse_config_list(vlan_filter, &cfg->dpdk.nb_vlan_filter, v_str);
|
||||
}
|
||||
|
||||
static int
|
||||
vip_cfg_handler(struct ff_port_cfg *cur)
|
||||
{
|
||||
|
@ -689,6 +697,8 @@ ini_parse_handler(void* user, const char* section, const char* name,
|
|||
pconfig->dpdk.tx_csum_offoad_skip = atoi(value);
|
||||
} else if (MATCH("dpdk", "vlan_strip")) {
|
||||
pconfig->dpdk.vlan_strip = atoi(value);
|
||||
} else if (MATCH("dpdk", "vlan_filter")) {
|
||||
return parse_vlan_filter_list(pconfig, value);
|
||||
} else if (MATCH("dpdk", "idle_sleep")) {
|
||||
pconfig->dpdk.idle_sleep = atoi(value);
|
||||
} else if (MATCH("dpdk", "pkt_tx_delay")) {
|
||||
|
|
|
@ -35,6 +35,7 @@ extern "C" {
|
|||
#define DPDK_CONFIG_NUM 16
|
||||
#define DPDK_CONFIG_MAXLEN 256
|
||||
#define DPDK_MAX_LCORE 128
|
||||
#define DPDK_MAX_VLAN_FILTER 128
|
||||
#define PCAP_SNAP_MINLEN 94
|
||||
#define PCAP_SAVE_MINLEN (2<<22)
|
||||
|
||||
|
@ -150,6 +151,8 @@ struct ff_config {
|
|||
int tso;
|
||||
int tx_csum_offoad_skip;
|
||||
int vlan_strip;
|
||||
int nb_vlan_filter;
|
||||
uint16_t vlan_filter_id[DPDK_MAX_VLAN_FILTER];
|
||||
int symmetric_rss;
|
||||
|
||||
/* sleep x microseconds when no pkts incomming */
|
||||
|
|
|
@ -658,6 +658,21 @@ init_port_start(void)
|
|||
if (ff_global_cfg.dpdk.vlan_strip) {
|
||||
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) {
|
||||
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
|
||||
printf("RX vlan strip offload supported\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set Rx VLAN filter, and then the dirvier(such as MLX5) will set
|
||||
* FLOW RSS to enable L3/L4 RSS below vlan hdr.
|
||||
* This action won't need after DPDK-20.11.
|
||||
*/
|
||||
if (ff_global_cfg.dpdk.nb_vlan_filter) {
|
||||
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_FILTER) {
|
||||
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
|
||||
printf("RX vlan filter offload supported\n");
|
||||
} else {
|
||||
printf("RX vlan filter offload not supported\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -730,6 +745,24 @@ init_port_start(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Enable vlan filter for RSS */
|
||||
if (ff_global_cfg.dpdk.nb_vlan_filter) {
|
||||
uint16_t vlan_id ;
|
||||
int on = 1, vlan_idx;
|
||||
|
||||
for (vlan_idx = 0; vlan_idx < ff_global_cfg.dpdk.nb_vlan_filter; vlan_idx++) {
|
||||
vlan_id = ff_global_cfg.dpdk.vlan_filter_id[vlan_idx];
|
||||
|
||||
if (rte_eth_dev_vlan_filter(port_id, vlan_id, on)) {
|
||||
printf("Port %u set vlan %u on %d failed.\n",
|
||||
port_id, vlan_id, on);
|
||||
} else {
|
||||
printf("Port %u set vlan %u on %d success.\n",
|
||||
port_id, vlan_id, on);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t nb_rxd = RX_QUEUE_SIZE;
|
||||
static uint16_t nb_txd = TX_QUEUE_SIZE;
|
||||
ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd);
|
||||
|
|
Loading…
Reference in New Issue