net/i40e: support enable/disable source pruning
PATCH v3 1/1 net/i40e: support enable/disable source pruning
VRRP advertisement packets are dropped on i40e PF device because when a MAC address is added to a device, packets originating from that MAC address are dropped.
This patch adds a PMD specific API to enable/disable source pruning to fix above issue.
Bugzilla ID: 648
Fixes 94b3c1a72507 ("net/i40e: move testpmd commands")
Fixes bce83974ba2c ("net/i40e: set Tx loopback from PF")
Fixes 96974a6600ec ("net/i40e: move private APIs to a specific file")
Fixes 689bba33272d ("i40e: add VEB switching support")
Fixes 440499cf5376 ("net/i40e: support floating VEB")
Fixes ef4c16fd9148 ("net/i40e: refactor RSS flow")
Signed-off-by Mingjin Ye <[email protected]>
---
v3: The i40e specific commands are moved todrivers/net/i40e/i40e_testpmd.c.
--- drivers/net/i40e/i40e_ethdev.c | 43 ++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_testpmd.c | 88 +++++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.c | 20 ++++++++ drivers/net/i40e/rte_pmd_i40e.h | 17 +++++++ drivers/net/i40e/version.map | 1 + 6 files changed, 170 insertions(+)
drivers/net/i40e/i40e_ethdev.c +43 -0
@@ -5647,6 +5647,46 @@ i40e_enable_pf_lb(struct i40e_pf *pf) hw->aq.asq_last_status); } +/* i40e_pf_set_source_prune +* @pf: pointer to the pf structure +* @on: Enable/disable source prune +* +* set source prune on pf +*/ +int +i40e_pf_set_source_prune (struct i40e_pf *pf,int on) +{ +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +struct i40e_vsi_context ctxt; +int ret; + +memset (&ctxt,0 ,sizeof (ctxt)); + ctxt.seid = pf->main_vsi_seid; + ctxt.pf_num = hw->pf_id; + ret =i40e_aq_get_vsi_params (hw, &ctxt,NULL ); +if (ret) { +PMD_DRV_LOG (ERR ,"cannot get pf vsi config, err %d, aq_err %d" , + ret, hw->aq.asq_last_status); +return ret; + } + ctxt.flags =I40E_AQ_VSI_TYPE_PF ; + ctxt.info.valid_sections = +rte_cpu_to_le_16 (I40E_AQ_VSI_PROP_SWITCH_VALID ); +if (on) + ctxt.info.switch_id &= + ~rte_cpu_to_le_16 (I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB ); +else + ctxt.info.switch_id |= +rte_cpu_to_le_16 (I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB ); + + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret) +PMD_DRV_LOG (ERR ,"update vsi switch failed, aq_err=%d" , + hw->aq.asq_last_status); + +return ret; +} +/* Setup a VSI */ struct i40e_vsi * i40e_vsi_setup(struct i40e_pf *pf,
@@ -5704,6 +5744,9 @@ i40e_vsi_setup(struct i40e_pf *pf, } } +/* source prune is disabled to support VRRP in default*/ +i40e_pf_set_source_prune (pf,0 ); + vsi =rte_zmalloc ("i40e_vsi" ,sizeof (struct i40e_vsi ),0 );if (!vsi) {PMD_DRV_LOG (ERR ,"Failed to allocate memory for vsi" );
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -1430,6 +1430,7 @@ int i40e_pf_calc_configured_queues_num(struct i40e_pf *pf);int i40e_pf_reset_rss_reta (struct i40e_pf *pf);int i40e_pf_reset_rss_key (struct i40e_pf *pf);int i40e_pf_config_rss (struct i40e_pf *pf); +int i40e_pf_set_source_prune (struct i40e_pf *pf,int on);int i40e_set_rss_key (struct i40e_vsi *vsi,uint8_t *key,uint8_t key_len);int i40e_set_rss_lut (struct i40e_vsi *vsi,uint8_t *lut,uint16_t lut_size);int i40e_vf_representor_init (struct rte_eth_dev *ethdev,void *init_params);
drivers/net/i40e/i40e_testpmd.c +88 -0
100 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.c +20 -0
@@ -3282,3 +3282,23 @@ rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev)return 0 ; } + +int +rte_pmd_i40e_set_pf_src_prune (uint16_t port,uint8_t on) +{ +struct rte_eth_dev *dev; +struct i40e_pf *pf; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_i40e_supported (dev)) +return -ENOTSUP ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + + ret =i40e_pf_set_source_prune (pf, on); +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +17 -0
@@ -1134,6 +1134,23 @@ __rte_experimentalint rte_pmd_i40e_set_switch_dev (uint16_t port_id,struct rte_eth_dev *switch_dev); +/** +* Enable/Disable source prune on all the PF. +* +* @param port +* The port identifier of the Ethernet device. +* @param on +* 1 - Enable source prune. +* 0 - Disable source prune. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +__rte_experimental +int rte_pmd_i40e_set_pf_src_prune(uint16_t port, +uint8_t on); + #ifdef __cplusplus }#endif
drivers/net/i40e/version.map +1 -0
@@ -46,4 +46,5 @@ EXPERIMENTAL { rte_pmd_i40e_get_fdir_stats; rte_pmd_i40e_set_gre_key_len; rte_pmd_i40e_set_switch_dev; + rte_pmd_i40e_set_pf_src_prune; };
Signature · 1 line
2.25.1