improve i40e VF VLAN performance
cover improve i40e VF VLAN performance
(target for v18.08)
Add vlan to vlan prune table cost additinal firmware cycle that cause significent performance downgrade (40~50%). While remove this will cause vlan anti spoof does not work on VF.
The dicision is to take performance as high priority, since 40~50% performance drop is unbearable for most cases, so code part for adding vlan to vlan prune table will be stripped out, while for vlan anti-spoof, we take an alternative way as below:
Due to hardware limitation, there is no perfect solution to enable VF vlan antispoof, to enable it means lost something else. So the solution is to introduce devarg "support-vf-vlan-antispoof" that turn on the feature to meet customer's specific requirement while no impact on normal case when it is turned off. Below impact is expected when support-vf-vlan-antispoof is turned on:
1. Multi-driver is not supported since some global register is changed in DPDK driver during init which is no expected by kernel driver.
2. Unicast / Multicase promiscuous mode can not be configured separately. So, function rte_pmd_i40e_set_vf_unicast_promics and rte_pmd_i40e_set_vf_multicast_promisc will fail and new funciton rte_pmd_i40e_set_vf_promics is introduced as a coarse-grain API.
3. VLAN anti-spoof and Mac anti-spoof are always enable/disable together. (rte_eth_set_vf_mac_anti_spoof and rte_eth_set_vf_vlan_anti_spoof do the same thing now.)
4. When VLAN/MAC anti-spoof is turned on, vlan tag will be added to vlan promisc table, so in the rx path, mac address match will be ignored, only vlan will be matched.
Qi Zhang (2):
net/i40e: improve VF VLAN performance
net/i40e: enable VF VLAN antispoof
doc/guides/nics/i40e.rst | 28 ++++ drivers/net/i40e/i40e_ethdev.c | 122 +++++++++----- drivers/net/i40e/i40e_ethdev.h | 2 +- drivers/net/i40e/i40e_pf.c | 30 +++- drivers/net/i40e/rte_pmd_i40e.c | 263 ++++++++++++++++-------------- drivers/net/i40e/rte_pmd_i40e.h | 22 +++ drivers/net/i40e/rte_pmd_i40e_version.map | 8 +- 7 files changed, 302 insertions(+), 173 deletions(-)
Signature · 1 line
2.13.6
PATCH 1/2 net/i40e: improve VF VLAN performance
Add vlan to vlan prune table cost additinal firmware cycle that cause significent performance downgrade. This patch remove related code when enable vlan filter, the side effect is vlan anti spoof will not work, following patch will deal with it.
--- drivers/net/i40e/i40e_ethdev.c | 23 --------- drivers/net/i40e/i40e_ethdev.h | 1 - drivers/net/i40e/rte_pmd_i40e.c | 110 +--------------------------------------- 3 files changed, 2 insertions(+), 132 deletions(-)
drivers/net/i40e/i40e_ethdev.c +0 -23
@@ -5337,7 +5337,6 @@ i40e_vsi_setup(struct i40e_pf *pf, vsi->parent_vsi = uplink_vsi ? uplink_vsi : pf->main_vsi; vsi->user_param = user_param; vsi->vlan_anti_spoof_on =0 ; - vsi->vlan_filter_on =0 ;/* Allocate queues */ switch (vsi->type) {case I40E_VSI_MAIN :
@@ -6710,32 +6709,10 @@ void i40e_set_vlan_filter(struct i40e_vsi *vsi, uint16_t vlan_id, bool on) { - struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); -struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0 }; -int ret; - if (vlan_id > ETH_VLAN_ID_MAX) return;i40e_store_vlan_filter (vsi, vlan_id, on); - -if ((!vsi->vlan_anti_spoof_on && !vsi->vlan_filter_on) || !vlan_id) -return ; - - vlan_data.vlan_tag =rte_cpu_to_le_16 (vlan_id); - -if (on) { - ret =i40e_aq_add_vlan (hw, vsi->seid, - &vlan_data,1 ,NULL ); -if (ret !=I40E_SUCCESS ) -PMD_DRV_LOG (ERR ,"Failed to add vlan filter" ); - }else { - ret =i40e_aq_remove_vlan (hw, vsi->seid, - &vlan_data,1 ,NULL ); -if (ret !=I40E_SUCCESS ) -PMD_DRV_LOG (ERR , -"Failed to remove vlan filter" ); - } }/**
drivers/net/i40e/i40e_ethdev.h +0 -1
@@ -378,7 +378,6 @@ struct i40e_vsi {uint16_t nb_msix;/* The max number of msix vector */ uint8_t enabled_tc;/* The traffic class enabled */ uint8_t vlan_anti_spoof_on;/* The VLAN anti-spoofing enabled */ -uint8_t vlan_filter_on;/* The VLAN filter enabled */ struct i40e_bw_info bw_info;/* VSI bandwidth information */ };
drivers/net/i40e/rte_pmd_i40e.c +2 -108
148 lines not on this page · raw message
Signature · 1 line
2.13.6
Re: [PATCH 1/2] net/i40e: improve VF VLAN performance
Quoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qi Zhang
Sent: Monday, May 28, 2018 10:01 AM
To: Xing, Beilei <[email protected]>
Cc: [email protected]; Zhang, Helin <[email protected]>; Wang, Liang-min <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [dpdk-dev] [PATCH 1/2] net/i40e: improve VF VLAN performance
Quoted 2 lines
Add vlan to vlan prune table cost additinal firmware cycle that cause significent performance downgrade. This patch remove related code when
The patch looks OK for me, just some typo:additinal->additional
Significent-> significant
Quoted 5 lines
enable vlan filter, the side effect is vlan anti spoof will not work, following patch will deal with it.
Signed-off-by Qi Zhang <[email protected]>---
PATCH 2/2 net/i40e: enable VF VLAN antispoof
In reply to Qi ZhangDue to hardware limitation, there is no perfect solution to enable VF vlan antispoof, to enable it means lost something else. So the solution is to introduce devarg "support-vf-vlan-antispoof" that turn on the feature to meet customer's specific requirement while no impact on normal case when it is turned off. Below impact is expected when support-vf-vlan-antispoof is turned on:
1. Multi-driver is not supported since some global register is changed in DPDK driver during init which is no expected by kernel driver.
2. Unicast / Multicase promiscuous mode can not be configured separately. So, function rte_pmd_i40e_set_vf_unicast_promics and rte_pmd_i40e_set_vf_multicast_promisc will fail and new funciton rte_pmd_i40e_set_vf_promics is introduced as a coarse-grain API.
3. VLAN anti-spoof and Mac anti-spoof are always enable/disable together. (rte_eth_set_vf_mac_anti_spoof and rte_eth_set_vf_vlan_anti_spoof do the same thing now.)
4. When VLAN/MAC anti-spoof is turned on, vlan tag will be added to vlan promisc table, so in the rx path, mac address match will be ignored, only vlan will be matched.
--- doc/guides/nics/i40e.rst | 28 +++++ drivers/net/i40e/i40e_ethdev.c | 99 +++++++++++++---- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_pf.c | 30 ++++-- drivers/net/i40e/rte_pmd_i40e.c | 171 ++++++++++++++++++++++++++---- drivers/net/i40e/rte_pmd_i40e.h | 22 ++++ drivers/net/i40e/rte_pmd_i40e_version.map | 8 +- 7 files changed, 309 insertions(+), 50 deletions(-)
doc/guides/nics/i40e.rst +28 -0
@@ -124,6 +124,34 @@ Runtime Config Options will switch PF interrupt from IntN to Int0 to avoid interrupt conflict between DPDK and Linux Kernel. +- ``Support VF VLAN anti-spoof`` (default ``disable``) + + This is a work around to enable vlan antispoof on VF to support customer with + this specific requirement, the reason not make it as a default config is: + due to hardware limitation, when turn on this feature, some global register will + be re-write and some device default behaviour will be changed. (see below for + more detail). ``devargs`` parameter ``support-vf-vlan-antispoof`` is introduced, + for example:: + + -w 84:00.0,support-vf-vlan-antispoof=1 + + By default its off, when it turn on, will have below impact: + + Multi-driver is not supported since some global register is changed in DPDK driver + during init which is no expected by kernel driver. + + Unicast / Multicase promiscuous mode can not be configured separately. So, function + ``rte_pmd_i40e_set_vf_unicast_promics`` and ``rte_pmd_i40e_set_vf_multicast_promisc`` + will fail and new funciton rte_pmd_i40e_set_vf_promics is introduced as a coarse-grain + API. + + VLAN anti-spoof and Mac anti-spoof are always enable/disable together. + (``rte_eth_set_vf_mac_anti_spoof`` and ``rte_eth_set_vf_vlan_anti_spoof`` now do the + same thing). + + When VLAN/MAC anti-spoof is turn on, vlan tag will be added to vlan promisc table, so + in the rx path, mac address match will be ignored, only vlan will be matched. + - ``Support VF Port Representor`` (default ``not enabled``) The i40e PF PMD supports the creation of VF port representors for the control
drivers/net/i40e/i40e_ethdev.c +78 -21
182 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -960,6 +960,7 @@ struct i40e_pf {bool qinq_replace_flag;/* QINQ filter replace is done */ struct i40e_tm_conf tm_conf;bool support_multi_driver;/* 1 - support multiple driver */ +bool support_vf_vlan_antispoof;/* 1 - support vf's vlan antispoof */ /* Dynamic Device Personalization */ bool gtp_support;/* 1 - support GTP-C and GTP-U */
drivers/net/i40e/i40e_pf.c +23 -7
@@ -1009,15 +1009,31 @@ i40e_pf_host_process_cmd_config_promisc_mode(if (promisc->flags &FLAG_VF_UNICAST_PROMISC ) unicast = TRUE; - ret =i40e_aq_set_vsi_unicast_promiscuous (hw, - vf->vsi->seid, unicast,NULL , true); -if (ret !=I40E_SUCCESS ) - goto send_msg; -if (promisc->flags &FLAG_VF_MULTICAST_PROMISC ) multicast = TRUE; - ret =i40e_aq_set_vsi_multicast_promiscuous (hw, vf->vsi->seid, - multicast,NULL ); + +if (vf->pf->support_vf_vlan_antispoof) { +if (unicast && multicast) + ret =i40e_aq_set_default_vsi (hw, vf->vsi->seid,NULL ); +else if (!unicast && !multicast) + ret =i40e_aq_clear_default_vsi (hw, + vf->vsi->seid, +NULL ); +else + ret =I40E_ERR_DEVICE_NOT_SUPPORTED ; + +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR , +"Failed to enable/disable promiscuous" ); + }else { + ret =i40e_aq_set_vsi_unicast_promiscuous (hw, + vf->vsi->seid, unicast,NULL , true); +if (ret !=I40E_SUCCESS ) + goto send_msg; + + ret =i40e_aq_set_vsi_multicast_promiscuous (hw, vf->vsi->seid, + multicast,NULL ); + } send_msg: i40e_pf_host_send_msg_to_vf(vf,
drivers/net/i40e/rte_pmd_i40e.c +150 -21
228 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +22 -0
@@ -395,6 +395,26 @@ int rte_pmd_i40e_set_tx_loopback(uint16_t port, uint8_t on);/** +* Enable/Disable VF promiscuous mode. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf_id +* VF on which to set. +* @param on +* 1 - Enable. +* 0 - Disable. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (-ENOTSUP) if support-vf-anti-spoof is off. +*/ +int rte_pmd_i40e_set_vf_promisc (uint16_t port, +uint16_t vf_id, +uint8_t on); + +/** * Enable/Disable VF unicast promiscuous mode. * * @param port
@@ -408,6 +428,7 @@ int rte_pmd_i40e_set_tx_loopback(uint16_t port,* - (0) if successful. * - (-ENODEV) if *port* invalid. * - (-EINVAL) if bad parameter. +* - (-ENOTSUP) if support-vf-anti-spoof is on. */ int rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port, uint16_t vf_id,
@@ -427,6 +448,7 @@ int rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port,* - (0) if successful. * - (-ENODEV) if *port* invalid. * - (-EINVAL) if bad parameter. +* - (-ENOTSUP) if support-vf-anti-spoof is on. */ int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, uint16_t vf_id,
drivers/net/i40e/rte_pmd_i40e_version.map +7 -1
@@ -64,4 +64,10 @@ DPDK_18.02 { rte_pmd_i40e_inset_get; rte_pmd_i40e_inset_set; -} DPDK_17.11; +} DPDK_17.11; + +DPDK_18.08 { + global: + + rte_pmd_i40e_set_vf_promisc; +} DPDK_18.2;
Signature · 1 line
2.13.6