net/i40e: add warning log during writing global register
PATCH 1/1 net/i40e: add warning log during writing global register
This patch adds warning log when writing global register, and add limitation doc for impact during use of 700 series NIC with both kernel driver and DPDK PMD.
--- doc/guides/nics/i40e.rst | 12 ++++++++++++ drivers/net/i40e/i40e_ethdev.c | 16 ++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 39 +++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_fdir.c | 1 + drivers/net/i40e/i40e_flow.c | 1 + 5 files changed, 69 insertions(+)
doc/guides/nics/i40e.rst +12 -0
@@ -543,6 +543,18 @@ DCB function DCB works only when RSS is enabled. +Global configuration warning +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +I40E PMD will set some global registers to enable some function or set some +configure. Then when using different ports of the same NIC with Linux kernel +and DPDK, the port with Linux kernel will be impacted by the port with DPDK. +For example, register I40E_GL_SWT_L2TAGCTRL is used to control L2 tag, i40e +PMD uses I40E_GL_SWT_L2TAGCTRL to set vlan TPID. If setting TPID in port A +with DPDK, then the configuration will also impact port B in the NIC with +kernel driver, which don't want to use the TPID. +So PMD reports warning to clarify what is changed by writing global register. + High Performance of Small Packets on 40G NIC --------------------------------------------
drivers/net/i40e/i40e_ethdev.c +16 -0
@@ -680,6 +680,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)*/ I40E_WRITE_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 );I40E_WRITE_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 ); +i40e_global_cfg_warning (I40E_WARNING_QINQ_PARSER ); }#define I40E_FLOW_CONTROL_ETHERTYPE 0x8808
@@ -1133,6 +1134,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) 0x00000028, NULL);if (ret)PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); +i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER );/* Need the special FW version to support floating VEB */ config_floating_veb (dev);
@@ -1413,6 +1415,7 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 ); +i40e_global_cfg_warning (I40E_WARNING_DIS_FLX_PLD ); } static int
@@ -3260,6 +3263,7 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,/* If NVM API < 1.7, keep the register setting */ ret =i40e_vlan_tpid_set_by_registers (dev, vlan_type, tpid, qinq); +i40e_global_cfg_warning (I40E_WARNING_TPID );return ret; }
@@ -3502,6 +3506,7 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)I40E_WRITE_REG (hw,I40E_GLRPB_GLW , pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ); +i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL );I40E_WRITE_FLUSH (hw);
@@ -7981,6 +7986,7 @@ i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len) reg, NULL);if (ret !=0 )return ret; +i40e_global_cfg_warning (I40E_WARNING_GRE_KEY_LEN ); }else { ret =0 ; }
@@ -8239,6 +8245,8 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (j), reg); +i40e_global_cfg_warning ( +I40E_WARNING_HSYM ); } } }
@@ -8265,6 +8273,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, goto out;i40e_write_rx_ctl (hw,I40E_GLQF_CTL , reg); +i40e_global_cfg_warning (I40E_WARNING_QF_CTL ); out:I40E_WRITE_FLUSH (hw);
@@ -8909,6 +8918,10 @@ i40e_filter_input_set_init(struct i40e_pf *pf) pf->hash_input_set[pctype] = input_set; pf->fdir.input_set[pctype] = input_set; } + +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); }int
@@ -8969,6 +8982,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET );for (i =0 ; i < num; i++) i40e_check_write_reg(hw, I40E_GLQF_HASH_MSK(i, pctype),
@@ -8977,6 +8991,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++)i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype),0 ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK );I40E_WRITE_FLUSH (hw); pf->hash_input_set[pctype] = input_set;
@@ -9050,6 +9065,7 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++)i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype),0 ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK );I40E_WRITE_FLUSH (hw); pf->fdir.input_set[pctype] = input_set;
drivers/net/i40e/i40e_ethdev.h +39 -0
@@ -1069,6 +1069,21 @@ struct i40e_valid_pattern {parse_filter_t parse_filter; }; +enum I40E_WARNING_IDX { +I40E_WARNING_DIS_FLX_PLD , +I40E_WARNING_ENA_FLX_PLD , +I40E_WARNING_QINQ_PARSER , +I40E_WARNING_QINQ_CLOUD_FILTER , +I40E_WARNING_TPID , +I40E_WARNING_FLOW_CTL , +I40E_WARNING_GRE_KEY_LEN , +I40E_WARNING_QF_CTL , +I40E_WARNING_HASH_INSET , +I40E_WARNING_HSYM , +I40E_WARNING_HASH_MSK , +I40E_WARNING_FD_MSK , +}; +int i40e_dev_switch_queues (struct i40e_pf *pf,bool on);int i40e_vsi_release (struct i40e_vsi *vsi); struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf,
@@ -1277,6 +1292,30 @@ i40e_calc_itr_interval(int16_t interval, bool is_pf)return interval /2 ; } +static inline void +i40e_global_cfg_warning (enum I40E_WARNING_IDX idx) +{ +const char *warning; +static const char *const warning_list[] = { + [I40E_WARNING_DIS_FLX_PLD ] ="disable FDIR flexible payload" , + [I40E_WARNING_ENA_FLX_PLD ] ="enable FDIR flexible payload" , + [I40E_WARNING_QINQ_PARSER ] ="support QinQ parser" , + [I40E_WARNING_QINQ_CLOUD_FILTER ] ="support QinQ cloud filter" , + [I40E_WARNING_TPID ] ="support TPID configuration" , + [I40E_WARNING_FLOW_CTL ] ="configure water marker" , + [I40E_WARNING_GRE_KEY_LEN ] ="support GRE key length setting" , + [I40E_WARNING_QF_CTL ] ="support hash function setting" , + [I40E_WARNING_HASH_INSET ] ="configure hash input set" , + [I40E_WARNING_HSYM ] ="set symmetric hash" , + [I40E_WARNING_HASH_MSK ] ="configure hash mask" , + [I40E_WARNING_FD_MSK ] ="configure fdir mask" , + }; + + warning = warning_list[idx]; + +PMD_DRV_LOG (WARNING ,"Global register is changed during %s" , warning); +} +#define I40E_VALID_FLOW (flow_type) \ ((flow_type) == RTE_ETH_FLOW_FRAG_IPV4 || \ (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || \
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -527,6 +527,7 @@ i40e_set_flx_pld_cfg(struct i40e_pf *pf, (num <<I40E_GLQF_ORT_FIELD_CNT_SHIFT ) | (layer_idx *I40E_MAX_FLXPLD_FIED );I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 + layer_idx), flx_ort); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD ); }for (i =0 ; i < num; i++) {
drivers/net/i40e/i40e_flow.c +1 -0
@@ -2260,6 +2260,7 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf, (raw_id <<I40E_GLQF_ORT_FIELD_CNT_SHIFT ) | (layer_idx *I40E_MAX_FLXPLD_FIED );I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 + layer_idx), flx_ort); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD ); }/* Set flex pit */
Signature · 1 line
2.5.5
v2 cover net/i40e: global configuration
DPDK i40e PMD will modify some global registers during initialization and post initialization, there'll be impact during use of 700 series Ethernet Adapter with both Linux kernel and DPDK PMD.
This patchset adds log for global configuration and adds device args to disable global configuration.
Beilei Xing (3):
net/i40e: add warning log for global configuration net/i40e: add debug log for global configuration net/i40e: add device args to disable global configuration
doc/guides/nics/i40e.rst | 12 ++ drivers/net/i40e/i40e_ethdev.c | 384 +++++++++++++++++++++++++++++++++-------- drivers/net/i40e/i40e_ethdev.h | 53 ++++++ drivers/net/i40e/i40e_fdir.c | 40 +++-- drivers/net/i40e/i40e_flow.c | 9 + 5 files changed, 411 insertions(+), 87 deletions(-)
Signature · 1 line
2.5.5
PATCH v2 1/3 net/i40e: add warning log for global configuration
This patch adds warning log during global configuration, and add limitation doc for impact during use of 700 series NIC with both kernel driver and DPDK PMD.
--- doc/guides/nics/i40e.rst | 12 ++++++++++++ drivers/net/i40e/i40e_ethdev.c | 25 +++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 41 +++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_fdir.c | 1 + drivers/net/i40e/i40e_flow.c | 1 + 5 files changed, 80 insertions(+)
doc/guides/nics/i40e.rst +12 -0
@@ -566,6 +566,18 @@ DCB function DCB works only when RSS is enabled. +Global configuration warning +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +I40E PMD will set some global registers to enable some function or set some +configure. Then when using different ports of the same NIC with Linux kernel +and DPDK, the port with Linux kernel will be impacted by the port with DPDK. +For example, register I40E_GL_SWT_L2TAGCTRL is used to control L2 tag, i40e +PMD uses I40E_GL_SWT_L2TAGCTRL to set vlan TPID. If setting TPID in port A +with DPDK, then the configuration will also impact port B in the NIC with +kernel driver, which don't want to use the TPID. +So PMD reports warning to clarify what is changed by writing global register. + High Performance of Small Packets on 40G NIC --------------------------------------------
drivers/net/i40e/i40e_ethdev.c +25 -0
@@ -680,6 +680,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)*/ I40E_WRITE_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 );I40E_WRITE_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 ); +i40e_global_cfg_warning (I40E_WARNING_QINQ_PARSER ); }#define I40E_FLOW_CONTROL_ETHERTYPE 0x8808
@@ -1133,6 +1134,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) 0x00000028, NULL);if (ret)PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); +i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER );/* Need the special FW version to support floating VEB */ config_floating_veb (dev);
@@ -1413,6 +1415,7 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 ); +i40e_global_cfg_warning (I40E_WARNING_DIS_FLX_PLD ); } static int
@@ -3260,6 +3263,7 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,/* If NVM API < 1.7, keep the register setting */ ret =i40e_vlan_tpid_set_by_registers (dev, vlan_type, tpid, qinq); +i40e_global_cfg_warning (I40E_WARNING_TPID );return ret; }
@@ -3502,6 +3506,7 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)I40E_WRITE_REG (hw,I40E_GLRPB_GLW , pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ); +i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL );I40E_WRITE_FLUSH (hw);
@@ -7284,6 +7289,8 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -7338,6 +7345,8 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -7405,6 +7414,8 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -7457,6 +7468,8 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -8006,6 +8019,7 @@ i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len) reg, NULL);if (ret !=0 )return ret; +i40e_global_cfg_warning (I40E_WARNING_GRE_KEY_LEN ); }else { ret =0 ; }
@@ -8265,6 +8279,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,I40E_GLQF_HSYM (j), reg); } +i40e_global_cfg_warning (I40E_WARNING_HSYM ); } }
@@ -8290,6 +8305,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, goto out;i40e_write_rx_ctl (hw,I40E_GLQF_CTL , reg); +i40e_global_cfg_warning (I40E_WARNING_QF_CTL ); out:I40E_WRITE_FLUSH (hw);
@@ -8934,6 +8950,10 @@ i40e_filter_input_set_init(struct i40e_pf *pf) pf->hash_input_set[pctype] = input_set; pf->fdir.input_set[pctype] = input_set; } + +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); }int
@@ -8994,6 +9014,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET );for (i =0 ; i < num; i++) i40e_check_write_reg(hw, I40E_GLQF_HASH_MSK(i, pctype),
@@ -9002,6 +9023,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++)i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype),0 ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK );I40E_WRITE_FLUSH (hw); pf->hash_input_set[pctype] = input_set;
@@ -9075,6 +9097,7 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++)i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype),0 ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK );I40E_WRITE_FLUSH (hw); pf->fdir.input_set[pctype] = input_set;
@@ -11642,6 +11665,8 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED ; ret =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!ret) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return ret; }
drivers/net/i40e/i40e_ethdev.h +41 -0
53 lines not on this page · raw message
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -526,6 +526,7 @@ i40e_set_flx_pld_cfg(struct i40e_pf *pf, (num <<I40E_GLQF_ORT_FIELD_CNT_SHIFT ) | (layer_idx *I40E_MAX_FLXPLD_FIED );I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 + layer_idx), flx_ort); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD ); }for (i =0 ; i < num; i++) {
drivers/net/i40e/i40e_flow.c +1 -0
@@ -2260,6 +2260,7 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf, (raw_id <<I40E_GLQF_ORT_FIELD_CNT_SHIFT ) | (layer_idx *I40E_MAX_FLXPLD_FIED );I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 + layer_idx), flx_ort); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD ); }/* Set flex pit */
Signature · 1 line
2.5.5
PATCH v2 2/3 net/i40e: add debug log for global configuration
In reply to Beilei XingAdd debug log during global configuration.
--- drivers/net/i40e/i40e_ethdev.c | 153 ++++++++++++++++++++++++++++++----------- drivers/net/i40e/i40e_ethdev.h | 11 +++ 2 files changed, 123 insertions(+), 41 deletions(-)
drivers/net/i40e/i40e_ethdev.c +112 -41
@@ -656,6 +656,15 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,return 0 ; } +static inline void +i40e_write_global_rx_ctl (struct i40e_hw *hw,u32 reg_addr,u32 reg_val) +{ +i40e_write_rx_ctl (hw, reg_addr, reg_val); +PMD_DRV_LOG (DEBUG ,"Global register 0x%08x is modified " +"with value 0x%08x" , + reg_addr, reg_val); +} +RTE_PMD_REGISTER_PCI (net_i40e, rte_i40e_pmd);RTE_PMD_REGISTER_PCI_TABLE (net_i40e, pci_id_i40e_map);RTE_PMD_REGISTER_KMOD_DEP (net_i40e,"* igb_uio | uio_pci_generic | vfio-pci" );
@@ -678,8 +687,8 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)* configuration API is added to avoid configuration conflicts * between ports of the same device. */ -I40E_WRITE_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 ); -I40E_WRITE_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 );i40e_global_cfg_warning (I40E_WARNING_QINQ_PARSER ); }
@@ -1134,6 +1143,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) 0x00000028, NULL);if (ret)PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); +PMD_INIT_LOG (DEBUG ,"Global register 0x%08x is changed with value 0x28" , +I40E_GLQF_L3_MAP (40 ));i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER );/* Need the special FW version to support floating VEB */
@@ -1412,9 +1423,9 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)* Disable by default flexible payload * for corresponding L2/L3/L4 layers. */ -I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 );i40e_global_cfg_warning (I40E_WARNING_DIS_FLX_PLD ); }
@@ -3219,8 +3230,8 @@ i40e_vlan_tpid_set_by_registers(struct rte_eth_dev *dev,return -EIO ; }PMD_DRV_LOG (DEBUG , -"Debug write 0x%08" PRIx64" to I40E_GL_SWT_L2TAGCTRL[%d]" , - reg_w, reg_id); +"Global register 0x%08x is changed with value 0x%08x" , +I40E_GL_SWT_L2TAGCTRL (reg_id), (uint32_t )reg_w);return 0 ; }
@@ -3494,16 +3505,16 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) }/* config the water marker both based on the packets and bytes */ -I40E_WRITE_REG (hw,I40E_GLRPB_PHW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PHW , (pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_REG (hw,I40E_GLRPB_PLW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PLW , (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_REG (hw,I40E_GLRPB_GHW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GHW , pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ); -I40E_WRITE_REG (hw,I40E_GLRPB_GLW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GLW , pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT );i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL );
@@ -7289,8 +7300,13 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -7323,6 +7339,10 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) &filter_replace_buf);if (status <0 )return status; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* For MPLSoGRE */ memset(&filter_replace, 0,
@@ -7345,8 +7365,13 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -7386,6 +7411,10 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) &filter_replace_buf);if (status <0 )return status; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* for GTP-U */ memset(&filter_replace, 0,
@@ -7414,8 +7443,13 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -7447,6 +7481,10 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) &filter_replace_buf);if (status <0 )return status; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* for GTP-U */ memset(&filter_replace, 0,
@@ -7468,8 +7506,13 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -8019,6 +8062,9 @@ i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len) reg, NULL);if (ret !=0 )return ret; +PMD_DRV_LOG (DEBUG ,"Global register 0x%08x is changed " +"with value 0x%08x" , +I40E_GL_PRS_FVBM (2 ), reg);i40e_global_cfg_warning (I40E_WARNING_GRE_KEY_LEN ); }else { ret =0 ;
@@ -8275,7 +8321,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,for (j =I40E_FILTER_PCTYPE_INVALID +1 ; j <I40E_FILTER_PCTYPE_MAX ; j++) {if (adapter->pctypes_tbl[i] & (1ULL << j)) -i40e_write_rx_ctl (hw, +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (j), reg); }
@@ -8304,7 +8350,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,/* Use the default, and keep it as it is */ goto out; -i40e_write_rx_ctl (hw,I40E_GLQF_CTL , reg); +i40e_write_global_rx_ctl (hw,I40E_GLQF_CTL , reg);i40e_global_cfg_warning (I40E_WARNING_QF_CTL ); out:
@@ -8894,6 +8940,18 @@ i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val) (uint32_t)i40e_read_rx_ctl(hw, addr)); } +void +i40e_check_write_global_reg (struct i40e_hw *hw,uint32_t addr,uint32_t val) +{ +uint32_t reg =i40e_read_rx_ctl (hw, addr); + +PMD_DRV_LOG (DEBUG ,"[0x%08x] original: 0x%08x" , addr, reg); +if (reg != val) +i40e_write_global_rx_ctl (hw, addr, val); +PMD_DRV_LOG (DEBUG ,"[0x%08x] after: 0x%08x" , addr, + (uint32_t )i40e_read_rx_ctl (hw, addr)); +} +static void i40e_filter_input_set_init (struct i40e_pf *pf) {
@@ -8925,24 +8983,28 @@ i40e_filter_input_set_init(struct i40e_pf *pf)i40e_check_write_reg (hw,I40E_PRTQF_FD_INSET (pctype,1 ), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), (uint32_t )(inset_reg &UINT32_MAX )); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX ));for (i =0 ; i < num; i++) { -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), - mask_reg[i]); -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), - mask_reg[i]); +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), + mask_reg[i]); +i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_MSK (i, pctype), + mask_reg[i]); }/*clear unused mask registers of the pctype */ for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) { -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), -0 ); -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), -0 ); +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), +0 ); +i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_MSK (i, pctype), +0 ); }I40E_WRITE_FLUSH (hw);
@@ -9009,20 +9071,20 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw, inset_reg |=i40e_translate_input_set_reg (hw->mac.type, input_set); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), - (uint32_t )(inset_reg &UINT32_MAX )); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), - (uint32_t )((inset_reg >> -I40E_32_BIT_WIDTH ) &UINT32_MAX )); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), + (uint32_t )(inset_reg &UINT32_MAX )); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), + (uint32_t )((inset_reg >> +I40E_32_BIT_WIDTH ) &UINT32_MAX ));i40e_global_cfg_warning (I40E_WARNING_HASH_INSET );for (i =0 ; i < num; i++) -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), - mask_reg[i]); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), + mask_reg[i]);/*clear unused mask registers of the pctype */ for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), -0 ); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), +0 );i40e_global_cfg_warning (I40E_WARNING_HASH_MSK );I40E_WRITE_FLUSH (hw);
@@ -9091,12 +9153,12 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf, I40E_32_BIT_WIDTH) & UINT32_MAX));for (i =0 ; i < num; i++) -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), - mask_reg[i]); +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), + mask_reg[i]);/*clear unused mask registers of the pctype */ for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), -0 ); +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), +0 );i40e_global_cfg_warning (I40E_WARNING_FD_MSK );I40E_WRITE_FLUSH (hw);
@@ -11644,6 +11706,10 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf) &filter_replace_buf);if (ret !=I40E_SUCCESS )return ret; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* Apply the second L2 cloud filter */ memset(&filter_replace, 0,
@@ -11665,8 +11731,13 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED ; ret =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!ret) +if (!ret) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return ret; }
drivers/net/i40e/i40e_ethdev.h +11 -0
@@ -78,6 +78,15 @@ (((vf)->version_major ==VIRTCHNL_VERSION_MAJOR ) && \ ((vf)->version_minor == 1)) +#define I40E_WRITE_GLB_REG (hw, reg, value) \ + do { \ + I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((hw), \ + (reg)), (value)); \ + PMD_DRV_LOG(DEBUG, "Global register 0x%08x is modified " \ + "with value 0x%08x", \ + reg, value); \ + } while (0) +/* index flex payload per layer */ enum i40e_flxpld_layer_idx {I40E_FLXPLD_L2_IDX =0 ,
@@ -1187,6 +1196,8 @@ int i40e_generate_inset_mask_reg(uint64_t inset, uint32_t *mask, uint8_t nb_elem);uint64_t i40e_translate_input_set_reg (enum i40e_mac_type type,uint64_t input);void i40e_check_write_reg (struct i40e_hw *hw,uint32_t addr,uint32_t val); +void i40e_check_write_global_reg (struct i40e_hw *hw, +uint32_t addr,uint32_t val);int i40e_tm_ops_get (struct rte_eth_dev *dev,void *ops);void i40e_tm_conf_init (struct rte_eth_dev *dev);
Signature · 1 line
2.5.5
PATCH v2 3/3 net/i40e: add device args to disable global configuration
In reply to Beilei XingDPDK i40e PMD will modify some global registers during initialization and post initialization, there'll be impact during use of 700 series Ethernet Adapter with both Linux kernel and DPDK PMD.
This patch is to add device parameters to disable global configuration.
--- drivers/net/i40e/i40e_ethdev.c | 260 ++++++++++++++++++++++++++++++++--------- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_fdir.c | 39 ++++--- drivers/net/i40e/i40e_flow.c | 8 ++ 4 files changed, 235 insertions(+), 73 deletions(-)
drivers/net/i40e/i40e_ethdev.c +203 -57
@@ -1039,6 +1039,64 @@ i40e_init_queue_region_conf(struct rte_eth_dev *dev)memset (info,0 ,sizeof (struct i40e_queue_regions )); } +#define ETH_I40E_DISABLE_GLOBAL_CFG "disable-global-cfg" + +static int +i40e_parse_global_cfg_handler(__rte_unused const char *key, +const char *value, +void *opaque) +{ +struct i40e_pf *pf; +unsigned long dis_global_cfg; +char *end; + + pf = (struct i40e_pf *)opaque; + + errno =0 ; + dis_global_cfg =strtoul (value, &end,10 ); +if (errno !=0 || end == value || *end !=0 ) { +PMD_DRV_LOG (WARNING ,"Wrong global configuration" ); +return -(EINVAL ); + } + +if (dis_global_cfg ==1 || dis_global_cfg ==0 ) + pf->dis_global_cfg = (bool )dis_global_cfg; +else +PMD_DRV_LOG (WARNING ,"%s must be 1 or 0," , +"enable global configuration by default." +ETH_I40E_DISABLE_GLOBAL_CFG ); +return 0 ; +} + +static int +i40e_disable_global_cfg (struct rte_eth_dev *dev) +{ +struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); +static const char *const valid_keys[] = { +ETH_I40E_DISABLE_GLOBAL_CFG ,NULL }; +struct rte_kvargs *kvlist; + +/* Enable global configuration by default */ + pf->dis_global_cfg = false; + +if (!dev->device->devargs) +return 0 ; + + kvlist =rte_kvargs_parse (dev->device->devargs->args, valid_keys); +if (!kvlist) +return -EINVAL ; + +if (rte_kvargs_count (kvlist,ETH_I40E_DISABLE_GLOBAL_CFG ) >1 ) +PMD_DRV_LOG (WARNING ,"More than one argument \"%s\" and only " +"the first invalid or last valid one is used !" , +ETH_I40E_DISABLE_GLOBAL_CFG ); + +rte_kvargs_process (kvlist,ETH_I40E_DISABLE_GLOBAL_CFG , + i40e_parse_global_cfg_handler, pf); +rte_kvargs_free (kvlist); +return 0 ; +} +static int eth_i40e_dev_init (struct rte_eth_dev *dev) {
@@ -1092,6 +1150,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) hw->bus.func = pci_dev->addr.function; hw->adapter_stopped =0 ; +/* Check if need to disable global registers configuration */ +i40e_disable_global_cfg (dev); +/* Make sure all is clean before doing PF reset */ i40e_clear_hw (hw);
@@ -1119,7 +1180,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)* for packet type of QinQ by software. * It should be removed once issues are fixed in NVM. */ -i40e_GLQF_reg_init (hw); +if (!pf->dis_global_cfg) +i40e_GLQF_reg_init (hw);/* Initialize the input set for filters (hash and fd) to default value */ i40e_filter_input_set_init (pf);
@@ -1139,13 +1201,17 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) (hw->nvm.version & 0xf), hw->nvm.eetrack);/* initialise the L3_MAP register */ - ret =i40e_aq_debug_write_register (hw,I40E_GLQF_L3_MAP (40 ), -0x00000028 ,NULL ); -if (ret) -PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); -PMD_INIT_LOG (DEBUG ,"Global register 0x%08x is changed with value 0x28" , -I40E_GLQF_L3_MAP (40 )); -i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER ); +if (!pf->dis_global_cfg) { + ret =i40e_aq_debug_write_register (hw,I40E_GLQF_L3_MAP (40 ), +0x00000028 ,NULL ); +if (ret) +PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , + ret); +PMD_INIT_LOG (DEBUG , +"Global register 0x%08x is changed with 0x28" , +I40E_GLQF_L3_MAP (40 )); +i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER ); + }/* Need the special FW version to support floating VEB */ config_floating_veb (dev);
@@ -1221,11 +1287,15 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)i40e_set_fc (hw, &aq_fail, TRUE);/* Set the global registers with default ether type value */ - ret =i40e_vlan_tpid_set (dev,ETH_VLAN_TYPE_OUTER ,ETHER_TYPE_VLAN ); -if (ret !=I40E_SUCCESS ) { -PMD_INIT_LOG (ERR , -"Failed to set the default outer VLAN ether type" ); - goto err_setup_pf_switch; +if (!pf->dis_global_cfg) { + ret =i40e_vlan_tpid_set (dev,ETH_VLAN_TYPE_OUTER , +ETHER_TYPE_VLAN ); +if (ret !=I40E_SUCCESS ) { +PMD_INIT_LOG (ERR , +"Failed to set the default outer " +"VLAN ether type" ); + goto err_setup_pf_switch; + } }/* PF setup, which includes VSI setup */
@@ -1291,7 +1361,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)rte_intr_enable (intr_handle);/* By default disable flexible payload in global configuration */ -i40e_flex_payload_reg_set_default (hw); +if (!pf->dis_global_cfg) +i40e_flex_payload_reg_set_default (hw);/* * Add an ethertype filter to drop all flow control frames transmitted
@@ -2225,7 +2296,8 @@ i40e_dev_close(struct rte_eth_dev *dev)i40e_res_pool_destroy (&pf->msix_pool);/* Disable flexible payload in global configuration */ -i40e_flex_payload_reg_set_default (hw); +if (!pf->dis_global_cfg) +i40e_flex_payload_reg_set_default (hw);/* force a PF reset to clean anything leftover */ reg =I40E_READ_REG (hw,I40E_PFGEN_CTRL );
@@ -3242,6 +3314,7 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, uint16_t tpid) {struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private);int qinq = dev->data->dev_conf.rxmode.hw_vlan_extend;int ret =0 ;
@@ -3252,6 +3325,12 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, "Unsupported vlan type.");return -EINVAL ; } + +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Setting TPID is not supported." ); +return -ENOTSUP ; + } +/* 802.1ad frames ability is added in NVM API 1.7*/ if (hw->flags &I40E_HW_FLAG_802_1AD_CAPABLE ) {if (qinq) {
@@ -3504,20 +3583,24 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)I40E_WRITE_REG (hw,I40E_PRTDCB_MFLCN , mflcn_reg); } -/* config the water marker both based on the packets and bytes */ -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PHW , - (pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PLW , - (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GHW , - pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ); -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GLW , - pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ); -i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL ); +if (!pf->dis_global_cfg) { +/* config water marker both based on the packets and bytes */ +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PHW , + (pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PLW , + (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GHW , + pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ); +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GLW , + pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ); +i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL ); + }else +PMD_DRV_LOG (ERR , +"Water marker configuration is not supported." );I40E_WRITE_FLUSH (hw);
@@ -4050,7 +4133,6 @@ i40e_get_cap(struct i40e_hw *hw)#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4#define QUEUE_NUM_PER_VF_ARG "queue-num-per-vf" -RTE_PMD_REGISTER_PARAM_STRING (net_i40e,QUEUE_NUM_PER_VF_ARG "=1|2|4|8|16" ); static int i40e_pf_parse_vf_queue_number_handler(const char *key, const char *value,
@@ -7264,6 +7346,11 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace l1 filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd )); memset(&filter_replace_buf, 0,
@@ -7318,6 +7405,11 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace cloud filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +/* For MPLSoUDP */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -7383,6 +7475,11 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace l1 filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +/* For GTP-C */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -7461,6 +7558,11 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace cloud filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +/* for GTP-C */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -8042,9 +8144,15 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,static int i40e_dev_set_gre_key_len (struct i40e_hw *hw,uint8_t len) { +struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;uint32_t val, reg;int ret = -EINVAL ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"GRE key length configuration is unsupported" ); +return -ENOTSUP ; + } + val =I40E_READ_REG (hw,I40E_GL_PRS_FVBM (2 ));PMD_DRV_LOG (DEBUG ,"Read original GL_PRS_FVBM with 0x%08x" , val);
@@ -8299,11 +8407,17 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, struct rte_eth_hash_global_conf *g_cfg) {struct i40e_adapter *adapter = (struct i40e_adapter *)hw->back; +struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;int ret;uint16_t i, j;uint32_t reg;uint64_t mask0 = g_cfg->valid_bit_mask[0 ] & adapter->flow_types_mask; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Hash global configuration is not supported." ); +return -ENOTSUP ; + } +/* Check the input parameters */ ret =i40e_hash_global_config_check (adapter, g_cfg);if (ret <0 )
@@ -8975,6 +9089,10 @@ i40e_filter_input_set_init(struct i40e_pf *pf) I40E_INSET_MASK_NUM_REG);if (num <0 )return ; +if (pf->dis_global_cfg && num >0 ) { +PMD_DRV_LOG (ERR ,"Input set setting is not supported." ); +return ; + } inset_reg =i40e_translate_input_set_reg (hw->mac.type, input_set);
@@ -8983,39 +9101,44 @@ i40e_filter_input_set_init(struct i40e_pf *pf)i40e_check_write_reg (hw,I40E_PRTQF_FD_INSET (pctype,1 ), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); -i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), - (uint32_t )(inset_reg &UINT32_MAX )); -i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), - (uint32_t )((inset_reg >> -I40E_32_BIT_WIDTH ) &UINT32_MAX )); - -for (i =0 ; i < num; i++) { +if (!pf->dis_global_cfg) { +i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_INSET (0 , pctype), + (uint32_t )(inset_reg &UINT32_MAX ));i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_INSET (1 , pctype), + (uint32_t )((inset_reg >> +I40E_32_BIT_WIDTH ) &UINT32_MAX )); + +for (i =0 ; i < num; i++) { +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), mask_reg[i]); -i40e_check_write_global_reg (hw, +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), mask_reg[i]); - } -/*clear unused mask registers of the pctype */ -for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) { -i40e_check_write_global_reg (hw, + } +/*clear unused mask registers of the pctype */ +for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) { +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype),0 ); -i40e_check_write_global_reg (hw, +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype),0 ); - } + } +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); + }else +PMD_DRV_LOG (ERR ,"Input set setting is not supported." );I40E_WRITE_FLUSH (hw);/* store the default input set */ - pf->hash_input_set[pctype] = input_set; +if (!pf->dis_global_cfg) + pf->hash_input_set[pctype] = input_set; pf->fdir.input_set[pctype] = input_set; } - -i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); -i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); -i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); }int
@@ -9038,6 +9161,11 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,return -EINVAL ; } +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Hash input set setting is not supported." ); +return -ENOTSUP ; + } + pctype =i40e_flowtype_to_pctype (pf->adapter, conf->flow_type);if (pctype ==I40E_FILTER_PCTYPE_INVALID ) {PMD_DRV_LOG (ERR ,"invalid flow_type input." );
@@ -9143,6 +9271,10 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf, I40E_INSET_MASK_NUM_REG);if (num <0 )return -EINVAL ; +if (pf->dis_global_cfg && num >0 ) { +PMD_DRV_LOG (ERR ,"FDIR bit mask is not supported." ); +return -ENOTSUP ; + } inset_reg |=i40e_translate_input_set_reg (hw->mac.type, input_set);
@@ -9152,14 +9284,19 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf, (uint32_t )((inset_reg >> I40E_32_BIT_WIDTH) & UINT32_MAX)); -for (i =0 ; i < num; i++) -i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), - mask_reg[i]); -/*clear unused mask registers of the pctype */ -for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) -i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), -0 ); -i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +if (!pf->dis_global_cfg) { +for (i =0 ; i < num; i++) +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), + mask_reg[i]); +/*clear unused mask registers of the pctype */ +for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), +0 ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); + }else +PMD_DRV_LOG (ERR ,"FDIR bit mask is not supported." );I40E_WRITE_FLUSH (hw); pf->fdir.input_set[pctype] = input_set;
@@ -11676,6 +11813,11 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf;struct i40e_hw *hw =I40E_PF_TO_HW (pf); +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace cloud filter is not supported." ); +return ret; + } +/* Init */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -11828,3 +11970,7 @@ i40e_init_log(void)if (i40e_logtype_driver >=0 )rte_log_set_level (i40e_logtype_driver,RTE_LOG_NOTICE ); } + +RTE_PMD_REGISTER_PARAM_STRING (net_i40e, +QUEUE_NUM_PER_VF_ARG "=1|2|4|8|16" +ETH_I40E_DISABLE_GLOBAL_CFG "=1" );
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -950,6 +950,7 @@ struct i40e_pf {bool gtp_replace_flag;/* 1 - GTP-C/U filter replace is done */ bool qinq_replace_flag;/* QINQ filter replace is done */ struct i40e_tm_conf tm_conf; +bool dis_global_cfg;/* 1 - disable changing global register */ /* Dynamic Device Personalization */ bool gtp_support;/* 1 - support GTP-C and GTP-U */
drivers/net/i40e/i40e_fdir.c +23 -16
@@ -649,23 +649,30 @@ i40e_fdir_configure(struct rte_eth_dev *dev)PMD_DRV_LOG (ERR ," invalid configuration arguments." );return -EINVAL ; } -/* configure flex payload */ -for (i =0 ; i < conf->nb_payloads; i++) -i40e_set_flx_pld_cfg (pf, &conf->flex_set[i]); -/* configure flex mask*/ -for (i =0 ; i < conf->nb_flexmasks; i++) { -if (hw->mac.type ==I40E_MAC_X722 ) { -/* get translated pctype value in fd pctype register */ - pctype = (enum i40e_filter_pctype )i40e_read_rx_ctl ( - hw,I40E_GLQF_FD_PCTYPES ( - (int )i40e_flowtype_to_pctype (pf->adapter, - conf->flex_mask[i].flow_type))); - }else - pctype =i40e_flowtype_to_pctype (pf->adapter, - conf->flex_mask[i].flow_type); -i40e_set_flex_mask_on_pctype (pf, pctype, &conf->flex_mask[i]); - } +if (!pf->dis_global_cfg) { +/* configure flex payload */ +for (i =0 ; i < conf->nb_payloads; i++) +i40e_set_flx_pld_cfg (pf, &conf->flex_set[i]); +/* configure flex mask*/ +for (i =0 ; i < conf->nb_flexmasks; i++) { +if (hw->mac.type ==I40E_MAC_X722 ) { +/* get pctype value in fd pctype register */ + pctype = (enum i40e_filter_pctype ) +i40e_read_rx_ctl (hw, +I40E_GLQF_FD_PCTYPES ( + (int )i40e_flowtype_to_pctype ( + pf->adapter, + conf->flex_mask[i].flow_type))); + }else + pctype =i40e_flowtype_to_pctype (pf->adapter, + conf->flex_mask[i].flow_type); + +i40e_set_flex_mask_on_pctype (pf, pctype, + &conf->flex_mask[i]); + } + }else +PMD_DRV_LOG (ERR ,"Not support flexible payload." );return ret; }
drivers/net/i40e/i40e_flow.c +8 -0
@@ -2851,6 +2851,14 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,return -rte_errno; } +if (pf->dis_global_cfg) { +rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Unsupported flexible payload." ); +return -rte_errno; + } + ret =i40e_flow_check_raw_item (item, raw_spec, error);if (ret <0 )return ret;
Signature · 1 line
2.5.5
Re: [PATCH v2 0/3] net/i40e: global configuration
In reply to Beilei XingHi folks
It is a bit too late for 18.02, and I'd prefer to defer it to 18.05 after being well reviewed and tested. Thanks!
/Helin
Quoted 28 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Beilei Xing
Sent: Monday, January 29, 2018 5:54 PM
To: Zhang, Qi Z; Wu, Jingjing
Cc: [email protected]; Chilikin, Andrey
Subject: [dpdk-dev] [PATCH v2 0/3] net/i40e: global configurationDPDK i40e PMD will modify some global registers during initialization and post initialization, there'll be impact during use of 700 series Ethernet Adapter with both Linux kernel and DPDK PMD.
This patchset adds log for global configuration and adds device args to disable global configuration.Beilei Xing (3):
net/i40e: add warning log for global configuration net/i40e: add debug log for global configuration net/i40e: add device args to disable global configurationdoc/guides/nics/i40e.rst | 12 ++ drivers/net/i40e/i40e_ethdev.c | 384 +++++++++++++++++++++++++++++++++- ------- drivers/net/i40e/i40e_ethdev.h | 53 ++++++ drivers/net/i40e/i40e_fdir.c | 40 +++-- drivers/net/i40e/i40e_flow.c | 9 + 5 files changed, 411 insertions(+), 87 deletions(-)--
2.5.5
v3 cover net/i40e: fix multiple driver support issue
In reply to Beilei XingDPDK i40e PMD will modify some global registers during initialization and post initialization, there'll be impact during use of 700 series Ethernet Adapter with both Linux kernel and DPDK PMD.
This patchset adds log for global configuration and adds device args to disable global configuration.
v3 changes:
- Reword commit log.
v2 changes:
- Add debug log when writing global registers
- Add option to disable writing global registers
Beilei Xing (3):
net/i40e: add warnings when writing global registers net/i40e: add debug logs when writing global registers net/i40e: fix multiple driver support issue
doc/guides/nics/i40e.rst | 12 ++ drivers/net/i40e/i40e_ethdev.c | 384 +++++++++++++++++++++++++++++++++-------- drivers/net/i40e/i40e_ethdev.h | 55 ++++++ drivers/net/i40e/i40e_fdir.c | 40 +++-- drivers/net/i40e/i40e_flow.c | 9 + 5 files changed, 413 insertions(+), 87 deletions(-)
Signature · 1 line
2.5.5
PATCH v3 1/3 net/i40e: add warnings when writing global registers
Add warnings when writing global registers.
--- doc/guides/nics/i40e.rst | 12 ++++++++++++ drivers/net/i40e/i40e_ethdev.c | 25 ++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 43 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_fdir.c | 1 + drivers/net/i40e/i40e_flow.c | 1 + 5 files changed, 82 insertions(+)
doc/guides/nics/i40e.rst +12 -0
@@ -566,6 +566,18 @@ DCB function DCB works only when RSS is enabled. +Global configuration warning +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +I40E PMD will set some global registers to enable some function or set some +configure. Then when using different ports of the same NIC with Linux kernel +and DPDK, the port with Linux kernel will be impacted by the port with DPDK. +For example, register I40E_GL_SWT_L2TAGCTRL is used to control L2 tag, i40e +PMD uses I40E_GL_SWT_L2TAGCTRL to set vlan TPID. If setting TPID in port A +with DPDK, then the configuration will also impact port B in the NIC with +kernel driver, which don't want to use the TPID. +So PMD reports warning to clarify what is changed by writing global register. + High Performance of Small Packets on 40G NIC --------------------------------------------
drivers/net/i40e/i40e_ethdev.c +25 -0
@@ -680,6 +680,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)*/ I40E_WRITE_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 );I40E_WRITE_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 ); +i40e_global_cfg_warning (I40E_WARNING_QINQ_PARSER ); }#define I40E_FLOW_CONTROL_ETHERTYPE 0x8808
@@ -1133,6 +1134,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) 0x00000028, NULL);if (ret)PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); +i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER );/* Need the special FW version to support floating VEB */ config_floating_veb (dev);
@@ -1413,6 +1415,7 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 ); +i40e_global_cfg_warning (I40E_WARNING_DIS_FLX_PLD ); } static int
@@ -3260,6 +3263,7 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,/* If NVM API < 1.7, keep the register setting */ ret =i40e_vlan_tpid_set_by_registers (dev, vlan_type, tpid, qinq); +i40e_global_cfg_warning (I40E_WARNING_TPID );return ret; }
@@ -3502,6 +3506,7 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)I40E_WRITE_REG (hw,I40E_GLRPB_GLW , pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ); +i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL );I40E_WRITE_FLUSH (hw);
@@ -7284,6 +7289,8 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -7338,6 +7345,8 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -7405,6 +7414,8 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -7457,6 +7468,8 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -8006,6 +8019,7 @@ i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len) reg, NULL);if (ret !=0 )return ret; +i40e_global_cfg_warning (I40E_WARNING_GRE_KEY_LEN ); }else { ret =0 ; }
@@ -8265,6 +8279,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,I40E_GLQF_HSYM (j), reg); } +i40e_global_cfg_warning (I40E_WARNING_HSYM ); } }
@@ -8290,6 +8305,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, goto out;i40e_write_rx_ctl (hw,I40E_GLQF_CTL , reg); +i40e_global_cfg_warning (I40E_WARNING_QF_CTL ); out:I40E_WRITE_FLUSH (hw);
@@ -8934,6 +8950,10 @@ i40e_filter_input_set_init(struct i40e_pf *pf) pf->hash_input_set[pctype] = input_set; pf->fdir.input_set[pctype] = input_set; } + +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); }int
@@ -8994,6 +9014,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET );for (i =0 ; i < num; i++) i40e_check_write_reg(hw, I40E_GLQF_HASH_MSK(i, pctype),
@@ -9002,6 +9023,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++)i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype),0 ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK );I40E_WRITE_FLUSH (hw); pf->hash_input_set[pctype] = input_set;
@@ -9075,6 +9097,7 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++)i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype),0 ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK );I40E_WRITE_FLUSH (hw); pf->fdir.input_set[pctype] = input_set;
@@ -11642,6 +11665,8 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED ; ret =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!ret) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return ret; }
drivers/net/i40e/i40e_ethdev.h +43 -0
55 lines not on this page · raw message
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -526,6 +526,7 @@ i40e_set_flx_pld_cfg(struct i40e_pf *pf, (num <<I40E_GLQF_ORT_FIELD_CNT_SHIFT ) | (layer_idx *I40E_MAX_FLXPLD_FIED );I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 + layer_idx), flx_ort); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD ); }for (i =0 ; i < num; i++) {
drivers/net/i40e/i40e_flow.c +1 -0
@@ -2260,6 +2260,7 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf, (raw_id <<I40E_GLQF_ORT_FIELD_CNT_SHIFT ) | (layer_idx *I40E_MAX_FLXPLD_FIED );I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 + layer_idx), flx_ort); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD ); }/* Set flex pit */
Signature · 1 line
2.5.5
PATCH v3 2/3 net/i40e: add debug logs when writing global registers
In reply to Beilei XingAdd debug logs when writing global registers.
--- drivers/net/i40e/i40e_ethdev.c | 153 ++++++++++++++++++++++++++++++----------- drivers/net/i40e/i40e_ethdev.h | 11 +++ 2 files changed, 123 insertions(+), 41 deletions(-)
drivers/net/i40e/i40e_ethdev.c +112 -41
@@ -656,6 +656,15 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,return 0 ; } +static inline void +i40e_write_global_rx_ctl (struct i40e_hw *hw,u32 reg_addr,u32 reg_val) +{ +i40e_write_rx_ctl (hw, reg_addr, reg_val); +PMD_DRV_LOG (DEBUG ,"Global register 0x%08x is modified " +"with value 0x%08x" , + reg_addr, reg_val); +} +RTE_PMD_REGISTER_PCI (net_i40e, rte_i40e_pmd);RTE_PMD_REGISTER_PCI_TABLE (net_i40e, pci_id_i40e_map);RTE_PMD_REGISTER_KMOD_DEP (net_i40e,"* igb_uio | uio_pci_generic | vfio-pci" );
@@ -678,8 +687,8 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)* configuration API is added to avoid configuration conflicts * between ports of the same device. */ -I40E_WRITE_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 ); -I40E_WRITE_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 );i40e_global_cfg_warning (I40E_WARNING_QINQ_PARSER ); }
@@ -1134,6 +1143,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) 0x00000028, NULL);if (ret)PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); +PMD_INIT_LOG (DEBUG ,"Global register 0x%08x is changed with value 0x28" , +I40E_GLQF_L3_MAP (40 ));i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER );/* Need the special FW version to support floating VEB */
@@ -1412,9 +1423,9 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)* Disable by default flexible payload * for corresponding L2/L3/L4 layers. */ -I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 );i40e_global_cfg_warning (I40E_WARNING_DIS_FLX_PLD ); }
@@ -3219,8 +3230,8 @@ i40e_vlan_tpid_set_by_registers(struct rte_eth_dev *dev,return -EIO ; }PMD_DRV_LOG (DEBUG , -"Debug write 0x%08" PRIx64" to I40E_GL_SWT_L2TAGCTRL[%d]" , - reg_w, reg_id); +"Global register 0x%08x is changed with value 0x%08x" , +I40E_GL_SWT_L2TAGCTRL (reg_id), (uint32_t )reg_w);return 0 ; }
@@ -3494,16 +3505,16 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) }/* config the water marker both based on the packets and bytes */ -I40E_WRITE_REG (hw,I40E_GLRPB_PHW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PHW , (pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_REG (hw,I40E_GLRPB_PLW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PLW , (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_REG (hw,I40E_GLRPB_GHW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GHW , pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ); -I40E_WRITE_REG (hw,I40E_GLRPB_GLW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GLW , pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT );i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL );
@@ -7289,8 +7300,13 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -7323,6 +7339,10 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) &filter_replace_buf);if (status <0 )return status; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* For MPLSoGRE */ memset(&filter_replace, 0,
@@ -7345,8 +7365,13 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -7386,6 +7411,10 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) &filter_replace_buf);if (status <0 )return status; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* for GTP-U */ memset(&filter_replace, 0,
@@ -7414,8 +7443,13 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -7447,6 +7481,10 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) &filter_replace_buf);if (status <0 )return status; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* for GTP-U */ memset(&filter_replace, 0,
@@ -7468,8 +7506,13 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -8019,6 +8062,9 @@ i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len) reg, NULL);if (ret !=0 )return ret; +PMD_DRV_LOG (DEBUG ,"Global register 0x%08x is changed " +"with value 0x%08x" , +I40E_GL_PRS_FVBM (2 ), reg);i40e_global_cfg_warning (I40E_WARNING_GRE_KEY_LEN ); }else { ret =0 ;
@@ -8275,7 +8321,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,for (j =I40E_FILTER_PCTYPE_INVALID +1 ; j <I40E_FILTER_PCTYPE_MAX ; j++) {if (adapter->pctypes_tbl[i] & (1ULL << j)) -i40e_write_rx_ctl (hw, +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (j), reg); }
@@ -8304,7 +8350,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,/* Use the default, and keep it as it is */ goto out; -i40e_write_rx_ctl (hw,I40E_GLQF_CTL , reg); +i40e_write_global_rx_ctl (hw,I40E_GLQF_CTL , reg);i40e_global_cfg_warning (I40E_WARNING_QF_CTL ); out:
@@ -8894,6 +8940,18 @@ i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val) (uint32_t)i40e_read_rx_ctl(hw, addr)); } +void +i40e_check_write_global_reg (struct i40e_hw *hw,uint32_t addr,uint32_t val) +{ +uint32_t reg =i40e_read_rx_ctl (hw, addr); + +PMD_DRV_LOG (DEBUG ,"[0x%08x] original: 0x%08x" , addr, reg); +if (reg != val) +i40e_write_global_rx_ctl (hw, addr, val); +PMD_DRV_LOG (DEBUG ,"[0x%08x] after: 0x%08x" , addr, + (uint32_t )i40e_read_rx_ctl (hw, addr)); +} +static void i40e_filter_input_set_init (struct i40e_pf *pf) {
@@ -8925,24 +8983,28 @@ i40e_filter_input_set_init(struct i40e_pf *pf)i40e_check_write_reg (hw,I40E_PRTQF_FD_INSET (pctype,1 ), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), (uint32_t )(inset_reg &UINT32_MAX )); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX ));for (i =0 ; i < num; i++) { -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), - mask_reg[i]); -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), - mask_reg[i]); +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), + mask_reg[i]); +i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_MSK (i, pctype), + mask_reg[i]); }/*clear unused mask registers of the pctype */ for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) { -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), -0 ); -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), -0 ); +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), +0 ); +i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_MSK (i, pctype), +0 ); }I40E_WRITE_FLUSH (hw);
@@ -9009,20 +9071,20 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw, inset_reg |=i40e_translate_input_set_reg (hw->mac.type, input_set); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), - (uint32_t )(inset_reg &UINT32_MAX )); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), - (uint32_t )((inset_reg >> -I40E_32_BIT_WIDTH ) &UINT32_MAX )); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), + (uint32_t )(inset_reg &UINT32_MAX )); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), + (uint32_t )((inset_reg >> +I40E_32_BIT_WIDTH ) &UINT32_MAX ));i40e_global_cfg_warning (I40E_WARNING_HASH_INSET );for (i =0 ; i < num; i++) -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), - mask_reg[i]); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), + mask_reg[i]);/*clear unused mask registers of the pctype */ for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), -0 ); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), +0 );i40e_global_cfg_warning (I40E_WARNING_HASH_MSK );I40E_WRITE_FLUSH (hw);
@@ -9091,12 +9153,12 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf, I40E_32_BIT_WIDTH) & UINT32_MAX));for (i =0 ; i < num; i++) -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), - mask_reg[i]); +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), + mask_reg[i]);/*clear unused mask registers of the pctype */ for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), -0 ); +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), +0 );i40e_global_cfg_warning (I40E_WARNING_FD_MSK );I40E_WRITE_FLUSH (hw);
@@ -11644,6 +11706,10 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf) &filter_replace_buf);if (ret !=I40E_SUCCESS )return ret; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* Apply the second L2 cloud filter */ memset(&filter_replace, 0,
@@ -11665,8 +11731,13 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED ; ret =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!ret) +if (!ret) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return ret; }
drivers/net/i40e/i40e_ethdev.h +11 -0
@@ -78,6 +78,15 @@ (((vf)->version_major ==VIRTCHNL_VERSION_MAJOR ) && \ ((vf)->version_minor == 1)) +#define I40E_WRITE_GLB_REG (hw, reg, value) \ + do { \ + I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((hw), \ + (reg)), (value)); \ + PMD_DRV_LOG(DEBUG, "Global register 0x%08x is modified " \ + "with value 0x%08x", \ + reg, value); \ + } while (0) +/* index flex payload per layer */ enum i40e_flxpld_layer_idx {I40E_FLXPLD_L2_IDX =0 ,
@@ -1187,6 +1196,8 @@ int i40e_generate_inset_mask_reg(uint64_t inset, uint32_t *mask, uint8_t nb_elem);uint64_t i40e_translate_input_set_reg (enum i40e_mac_type type,uint64_t input);void i40e_check_write_reg (struct i40e_hw *hw,uint32_t addr,uint32_t val); +void i40e_check_write_global_reg (struct i40e_hw *hw, +uint32_t addr,uint32_t val);int i40e_tm_ops_get (struct rte_eth_dev *dev,void *ops);void i40e_tm_conf_init (struct rte_eth_dev *dev);
Signature · 1 line
2.5.5
PATCH v3 3/3 net/i40e: fix multiple driver support issue
In reply to Beilei XingThis patch provides the option to disable writing some global registers in PMD, in order to avoid affecting other drivers, when multiple drivers run on the same NIC and control different physical ports. Because there are few global resources shared among different physical ports.
--- drivers/net/i40e/i40e_ethdev.c | 260 ++++++++++++++++++++++++++++++++--------- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_fdir.c | 39 ++++--- drivers/net/i40e/i40e_flow.c | 8 ++ 4 files changed, 235 insertions(+), 73 deletions(-)
drivers/net/i40e/i40e_ethdev.c +203 -57
@@ -1039,6 +1039,64 @@ i40e_init_queue_region_conf(struct rte_eth_dev *dev)memset (info,0 ,sizeof (struct i40e_queue_regions )); } +#define ETH_I40E_DISABLE_GLOBAL_CFG "disable-global-cfg" + +static int +i40e_parse_global_cfg_handler(__rte_unused const char *key, +const char *value, +void *opaque) +{ +struct i40e_pf *pf; +unsigned long dis_global_cfg; +char *end; + + pf = (struct i40e_pf *)opaque; + + errno =0 ; + dis_global_cfg =strtoul (value, &end,10 ); +if (errno !=0 || end == value || *end !=0 ) { +PMD_DRV_LOG (WARNING ,"Wrong global configuration" ); +return -(EINVAL ); + } + +if (dis_global_cfg ==1 || dis_global_cfg ==0 ) + pf->dis_global_cfg = (bool )dis_global_cfg; +else +PMD_DRV_LOG (WARNING ,"%s must be 1 or 0," , +"enable global configuration by default." +ETH_I40E_DISABLE_GLOBAL_CFG ); +return 0 ; +} + +static int +i40e_disable_global_cfg (struct rte_eth_dev *dev) +{ +struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); +static const char *const valid_keys[] = { +ETH_I40E_DISABLE_GLOBAL_CFG ,NULL }; +struct rte_kvargs *kvlist; + +/* Enable global configuration by default */ + pf->dis_global_cfg = false; + +if (!dev->device->devargs) +return 0 ; + + kvlist =rte_kvargs_parse (dev->device->devargs->args, valid_keys); +if (!kvlist) +return -EINVAL ; + +if (rte_kvargs_count (kvlist,ETH_I40E_DISABLE_GLOBAL_CFG ) >1 ) +PMD_DRV_LOG (WARNING ,"More than one argument \"%s\" and only " +"the first invalid or last valid one is used !" , +ETH_I40E_DISABLE_GLOBAL_CFG ); + +rte_kvargs_process (kvlist,ETH_I40E_DISABLE_GLOBAL_CFG , + i40e_parse_global_cfg_handler, pf); +rte_kvargs_free (kvlist); +return 0 ; +} +static int eth_i40e_dev_init (struct rte_eth_dev *dev) {
@@ -1092,6 +1150,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) hw->bus.func = pci_dev->addr.function; hw->adapter_stopped =0 ; +/* Check if need to disable global registers configuration */ +i40e_disable_global_cfg (dev); +/* Make sure all is clean before doing PF reset */ i40e_clear_hw (hw);
@@ -1119,7 +1180,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)* for packet type of QinQ by software. * It should be removed once issues are fixed in NVM. */ -i40e_GLQF_reg_init (hw); +if (!pf->dis_global_cfg) +i40e_GLQF_reg_init (hw);/* Initialize the input set for filters (hash and fd) to default value */ i40e_filter_input_set_init (pf);
@@ -1139,13 +1201,17 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) (hw->nvm.version & 0xf), hw->nvm.eetrack);/* initialise the L3_MAP register */ - ret =i40e_aq_debug_write_register (hw,I40E_GLQF_L3_MAP (40 ), -0x00000028 ,NULL ); -if (ret) -PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); -PMD_INIT_LOG (DEBUG ,"Global register 0x%08x is changed with value 0x28" , -I40E_GLQF_L3_MAP (40 )); -i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER ); +if (!pf->dis_global_cfg) { + ret =i40e_aq_debug_write_register (hw,I40E_GLQF_L3_MAP (40 ), +0x00000028 ,NULL ); +if (ret) +PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , + ret); +PMD_INIT_LOG (DEBUG , +"Global register 0x%08x is changed with 0x28" , +I40E_GLQF_L3_MAP (40 )); +i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER ); + }/* Need the special FW version to support floating VEB */ config_floating_veb (dev);
@@ -1221,11 +1287,15 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)i40e_set_fc (hw, &aq_fail, TRUE);/* Set the global registers with default ether type value */ - ret =i40e_vlan_tpid_set (dev,ETH_VLAN_TYPE_OUTER ,ETHER_TYPE_VLAN ); -if (ret !=I40E_SUCCESS ) { -PMD_INIT_LOG (ERR , -"Failed to set the default outer VLAN ether type" ); - goto err_setup_pf_switch; +if (!pf->dis_global_cfg) { + ret =i40e_vlan_tpid_set (dev,ETH_VLAN_TYPE_OUTER , +ETHER_TYPE_VLAN ); +if (ret !=I40E_SUCCESS ) { +PMD_INIT_LOG (ERR , +"Failed to set the default outer " +"VLAN ether type" ); + goto err_setup_pf_switch; + } }/* PF setup, which includes VSI setup */
@@ -1291,7 +1361,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)rte_intr_enable (intr_handle);/* By default disable flexible payload in global configuration */ -i40e_flex_payload_reg_set_default (hw); +if (!pf->dis_global_cfg) +i40e_flex_payload_reg_set_default (hw);/* * Add an ethertype filter to drop all flow control frames transmitted
@@ -2225,7 +2296,8 @@ i40e_dev_close(struct rte_eth_dev *dev)i40e_res_pool_destroy (&pf->msix_pool);/* Disable flexible payload in global configuration */ -i40e_flex_payload_reg_set_default (hw); +if (!pf->dis_global_cfg) +i40e_flex_payload_reg_set_default (hw);/* force a PF reset to clean anything leftover */ reg =I40E_READ_REG (hw,I40E_PFGEN_CTRL );
@@ -3242,6 +3314,7 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, uint16_t tpid) {struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private);int qinq = dev->data->dev_conf.rxmode.hw_vlan_extend;int ret =0 ;
@@ -3252,6 +3325,12 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, "Unsupported vlan type.");return -EINVAL ; } + +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Setting TPID is not supported." ); +return -ENOTSUP ; + } +/* 802.1ad frames ability is added in NVM API 1.7*/ if (hw->flags &I40E_HW_FLAG_802_1AD_CAPABLE ) {if (qinq) {
@@ -3504,20 +3583,24 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)I40E_WRITE_REG (hw,I40E_PRTDCB_MFLCN , mflcn_reg); } -/* config the water marker both based on the packets and bytes */ -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PHW , - (pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PLW , - (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GHW , - pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ); -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GLW , - pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ); -i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL ); +if (!pf->dis_global_cfg) { +/* config water marker both based on the packets and bytes */ +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PHW , + (pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PLW , + (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GHW , + pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ); +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GLW , + pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ); +i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL ); + }else +PMD_DRV_LOG (ERR , +"Water marker configuration is not supported." );I40E_WRITE_FLUSH (hw);
@@ -4050,7 +4133,6 @@ i40e_get_cap(struct i40e_hw *hw)#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4#define QUEUE_NUM_PER_VF_ARG "queue-num-per-vf" -RTE_PMD_REGISTER_PARAM_STRING (net_i40e,QUEUE_NUM_PER_VF_ARG "=1|2|4|8|16" ); static int i40e_pf_parse_vf_queue_number_handler(const char *key, const char *value,
@@ -7264,6 +7346,11 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace l1 filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd )); memset(&filter_replace_buf, 0,
@@ -7318,6 +7405,11 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace cloud filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +/* For MPLSoUDP */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -7383,6 +7475,11 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace l1 filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +/* For GTP-C */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -7461,6 +7558,11 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace cloud filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +/* for GTP-C */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -8042,9 +8144,15 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,static int i40e_dev_set_gre_key_len (struct i40e_hw *hw,uint8_t len) { +struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;uint32_t val, reg;int ret = -EINVAL ; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"GRE key length configuration is unsupported" ); +return -ENOTSUP ; + } + val =I40E_READ_REG (hw,I40E_GL_PRS_FVBM (2 ));PMD_DRV_LOG (DEBUG ,"Read original GL_PRS_FVBM with 0x%08x" , val);
@@ -8299,11 +8407,17 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, struct rte_eth_hash_global_conf *g_cfg) {struct i40e_adapter *adapter = (struct i40e_adapter *)hw->back; +struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;int ret;uint16_t i, j;uint32_t reg;uint64_t mask0 = g_cfg->valid_bit_mask[0 ] & adapter->flow_types_mask; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Hash global configuration is not supported." ); +return -ENOTSUP ; + } +/* Check the input parameters */ ret =i40e_hash_global_config_check (adapter, g_cfg);if (ret <0 )
@@ -8975,6 +9089,10 @@ i40e_filter_input_set_init(struct i40e_pf *pf) I40E_INSET_MASK_NUM_REG);if (num <0 )return ; +if (pf->dis_global_cfg && num >0 ) { +PMD_DRV_LOG (ERR ,"Input set setting is not supported." ); +return ; + } inset_reg =i40e_translate_input_set_reg (hw->mac.type, input_set);
@@ -8983,39 +9101,44 @@ i40e_filter_input_set_init(struct i40e_pf *pf)i40e_check_write_reg (hw,I40E_PRTQF_FD_INSET (pctype,1 ), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); -i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), - (uint32_t )(inset_reg &UINT32_MAX )); -i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), - (uint32_t )((inset_reg >> -I40E_32_BIT_WIDTH ) &UINT32_MAX )); - -for (i =0 ; i < num; i++) { +if (!pf->dis_global_cfg) { +i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_INSET (0 , pctype), + (uint32_t )(inset_reg &UINT32_MAX ));i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_INSET (1 , pctype), + (uint32_t )((inset_reg >> +I40E_32_BIT_WIDTH ) &UINT32_MAX )); + +for (i =0 ; i < num; i++) { +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), mask_reg[i]); -i40e_check_write_global_reg (hw, +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), mask_reg[i]); - } -/*clear unused mask registers of the pctype */ -for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) { -i40e_check_write_global_reg (hw, + } +/*clear unused mask registers of the pctype */ +for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) { +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype),0 ); -i40e_check_write_global_reg (hw, +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype),0 ); - } + } +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); + }else +PMD_DRV_LOG (ERR ,"Input set setting is not supported." );I40E_WRITE_FLUSH (hw);/* store the default input set */ - pf->hash_input_set[pctype] = input_set; +if (!pf->dis_global_cfg) + pf->hash_input_set[pctype] = input_set; pf->fdir.input_set[pctype] = input_set; } - -i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); -i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); -i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); }int
@@ -9038,6 +9161,11 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,return -EINVAL ; } +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Hash input set setting is not supported." ); +return -ENOTSUP ; + } + pctype =i40e_flowtype_to_pctype (pf->adapter, conf->flow_type);if (pctype ==I40E_FILTER_PCTYPE_INVALID ) {PMD_DRV_LOG (ERR ,"invalid flow_type input." );
@@ -9143,6 +9271,10 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf, I40E_INSET_MASK_NUM_REG);if (num <0 )return -EINVAL ; +if (pf->dis_global_cfg && num >0 ) { +PMD_DRV_LOG (ERR ,"FDIR bit mask is not supported." ); +return -ENOTSUP ; + } inset_reg |=i40e_translate_input_set_reg (hw->mac.type, input_set);
@@ -9152,14 +9284,19 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf, (uint32_t )((inset_reg >> I40E_32_BIT_WIDTH) & UINT32_MAX)); -for (i =0 ; i < num; i++) -i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), - mask_reg[i]); -/*clear unused mask registers of the pctype */ -for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) -i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), -0 ); -i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +if (!pf->dis_global_cfg) { +for (i =0 ; i < num; i++) +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), + mask_reg[i]); +/*clear unused mask registers of the pctype */ +for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), +0 ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); + }else +PMD_DRV_LOG (ERR ,"FDIR bit mask is not supported." );I40E_WRITE_FLUSH (hw); pf->fdir.input_set[pctype] = input_set;
@@ -11676,6 +11813,11 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf;struct i40e_hw *hw =I40E_PF_TO_HW (pf); +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Replace cloud filter is not supported." ); +return ret; + } +/* Init */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -11828,3 +11970,7 @@ i40e_init_log(void)if (i40e_logtype_driver >=0 )rte_log_set_level (i40e_logtype_driver,RTE_LOG_NOTICE ); } + +RTE_PMD_REGISTER_PARAM_STRING (net_i40e, +QUEUE_NUM_PER_VF_ARG "=1|2|4|8|16" +ETH_I40E_DISABLE_GLOBAL_CFG "=1" );
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -950,6 +950,7 @@ struct i40e_pf {bool gtp_replace_flag;/* 1 - GTP-C/U filter replace is done */ bool qinq_replace_flag;/* QINQ filter replace is done */ struct i40e_tm_conf tm_conf; +bool dis_global_cfg;/* 1 - disable changing global register */ /* Dynamic Device Personalization */ bool gtp_support;/* 1 - support GTP-C and GTP-U */
drivers/net/i40e/i40e_fdir.c +23 -16
@@ -649,23 +649,30 @@ i40e_fdir_configure(struct rte_eth_dev *dev)PMD_DRV_LOG (ERR ," invalid configuration arguments." );return -EINVAL ; } -/* configure flex payload */ -for (i =0 ; i < conf->nb_payloads; i++) -i40e_set_flx_pld_cfg (pf, &conf->flex_set[i]); -/* configure flex mask*/ -for (i =0 ; i < conf->nb_flexmasks; i++) { -if (hw->mac.type ==I40E_MAC_X722 ) { -/* get translated pctype value in fd pctype register */ - pctype = (enum i40e_filter_pctype )i40e_read_rx_ctl ( - hw,I40E_GLQF_FD_PCTYPES ( - (int )i40e_flowtype_to_pctype (pf->adapter, - conf->flex_mask[i].flow_type))); - }else - pctype =i40e_flowtype_to_pctype (pf->adapter, - conf->flex_mask[i].flow_type); -i40e_set_flex_mask_on_pctype (pf, pctype, &conf->flex_mask[i]); - } +if (!pf->dis_global_cfg) { +/* configure flex payload */ +for (i =0 ; i < conf->nb_payloads; i++) +i40e_set_flx_pld_cfg (pf, &conf->flex_set[i]); +/* configure flex mask*/ +for (i =0 ; i < conf->nb_flexmasks; i++) { +if (hw->mac.type ==I40E_MAC_X722 ) { +/* get pctype value in fd pctype register */ + pctype = (enum i40e_filter_pctype ) +i40e_read_rx_ctl (hw, +I40E_GLQF_FD_PCTYPES ( + (int )i40e_flowtype_to_pctype ( + pf->adapter, + conf->flex_mask[i].flow_type))); + }else + pctype =i40e_flowtype_to_pctype (pf->adapter, + conf->flex_mask[i].flow_type); + +i40e_set_flex_mask_on_pctype (pf, pctype, + &conf->flex_mask[i]); + } + }else +PMD_DRV_LOG (ERR ,"Not support flexible payload." );return ret; }
drivers/net/i40e/i40e_flow.c +8 -0
@@ -2851,6 +2851,14 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,return -rte_errno; } +if (pf->dis_global_cfg) { +rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Unsupported flexible payload." ); +return -rte_errno; + } + ret =i40e_flow_check_raw_item (item, raw_spec, error);if (ret <0 )return ret;
Signature · 1 line
2.5.5
v4 cover net/i40e: fix multiple driver support issue
In reply to Beilei XingDPDK i40e PMD will modify some global registers during initialization and post initialization, there'll be impact during use of 700 series Ethernet Adapter with both Linux kernel and DPDK PMD.
This patchset adds log for global configuration and adds device args to disable global configuration and change interrupt for PF.
v4 changes:
- Fix interrupt conflict when using multiple driver.
v3 changes:
- Reword commit log.
v2 changes:
- Add debug log when writing global registers
- Add option to disable writing global registers
Beilei Xing (4):
net/i40e: add warnings when writing global registers net/i40e: add debug logs when writing global registers net/i40e: fix multiple driver support issue net/i40e: fix interrupt conflict when using multi-driver
doc/guides/nics/i40e.rst | 12 + drivers/net/i40e/i40e_ethdev.c | 477 ++++++++++++++++++++++++++++++-------- drivers/net/i40e/i40e_ethdev.h | 69 +++++- drivers/net/i40e/i40e_ethdev_vf.c | 4 +- drivers/net/i40e/i40e_fdir.c | 40 ++-- drivers/net/i40e/i40e_flow.c | 9 + 6 files changed, 487 insertions(+), 124 deletions(-)
Signature · 1 line
2.5.5
PATCH v4 1/4 net/i40e: add warnings when writing global registers
Add warnings when writing global registers.
--- doc/guides/nics/i40e.rst | 12 ++++++++++++ drivers/net/i40e/i40e_ethdev.c | 25 ++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 43 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_fdir.c | 1 + drivers/net/i40e/i40e_flow.c | 1 + 5 files changed, 82 insertions(+)
doc/guides/nics/i40e.rst +12 -0
@@ -566,6 +566,18 @@ DCB function DCB works only when RSS is enabled. +Global configuration warning +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +I40E PMD will set some global registers to enable some function or set some +configure. Then when using different ports of the same NIC with Linux kernel +and DPDK, the port with Linux kernel will be impacted by the port with DPDK. +For example, register I40E_GL_SWT_L2TAGCTRL is used to control L2 tag, i40e +PMD uses I40E_GL_SWT_L2TAGCTRL to set vlan TPID. If setting TPID in port A +with DPDK, then the configuration will also impact port B in the NIC with +kernel driver, which don't want to use the TPID. +So PMD reports warning to clarify what is changed by writing global register. + High Performance of Small Packets on 40G NIC --------------------------------------------
drivers/net/i40e/i40e_ethdev.c +25 -0
@@ -680,6 +680,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)*/ I40E_WRITE_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 );I40E_WRITE_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 ); +i40e_global_cfg_warning (I40E_WARNING_QINQ_PARSER ); }#define I40E_FLOW_CONTROL_ETHERTYPE 0x8808
@@ -1133,6 +1134,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) 0x00000028, NULL);if (ret)PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); +i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER );/* Need the special FW version to support floating VEB */ config_floating_veb (dev);
@@ -1413,6 +1415,7 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 ); +i40e_global_cfg_warning (I40E_WARNING_DIS_FLX_PLD ); } static int
@@ -3260,6 +3263,7 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,/* If NVM API < 1.7, keep the register setting */ ret =i40e_vlan_tpid_set_by_registers (dev, vlan_type, tpid, qinq); +i40e_global_cfg_warning (I40E_WARNING_TPID );return ret; }
@@ -3502,6 +3506,7 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)I40E_WRITE_REG (hw,I40E_GLRPB_GLW , pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ); +i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL );I40E_WRITE_FLUSH (hw);
@@ -7284,6 +7289,8 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -7338,6 +7345,8 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -7405,6 +7414,8 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -7457,6 +7468,8 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!status) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return status; }
@@ -8006,6 +8019,7 @@ i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len) reg, NULL);if (ret !=0 )return ret; +i40e_global_cfg_warning (I40E_WARNING_GRE_KEY_LEN ); }else { ret =0 ; }
@@ -8265,6 +8279,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,I40E_GLQF_HSYM (j), reg); } +i40e_global_cfg_warning (I40E_WARNING_HSYM ); } }
@@ -8290,6 +8305,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, goto out;i40e_write_rx_ctl (hw,I40E_GLQF_CTL , reg); +i40e_global_cfg_warning (I40E_WARNING_QF_CTL ); out:I40E_WRITE_FLUSH (hw);
@@ -8934,6 +8950,10 @@ i40e_filter_input_set_init(struct i40e_pf *pf) pf->hash_input_set[pctype] = input_set; pf->fdir.input_set[pctype] = input_set; } + +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); }int
@@ -8994,6 +9014,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET );for (i =0 ; i < num; i++) i40e_check_write_reg(hw, I40E_GLQF_HASH_MSK(i, pctype),
@@ -9002,6 +9023,7 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++)i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype),0 ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK );I40E_WRITE_FLUSH (hw); pf->hash_input_set[pctype] = input_set;
@@ -9075,6 +9097,7 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++)i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype),0 ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK );I40E_WRITE_FLUSH (hw); pf->fdir.input_set[pctype] = input_set;
@@ -11642,6 +11665,8 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED ; ret =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); +if (!ret) +i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER );return ret; }
drivers/net/i40e/i40e_ethdev.h +43 -0
55 lines not on this page · raw message
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -526,6 +526,7 @@ i40e_set_flx_pld_cfg(struct i40e_pf *pf, (num <<I40E_GLQF_ORT_FIELD_CNT_SHIFT ) | (layer_idx *I40E_MAX_FLXPLD_FIED );I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 + layer_idx), flx_ort); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD ); }for (i =0 ; i < num; i++) {
drivers/net/i40e/i40e_flow.c +1 -0
@@ -2260,6 +2260,7 @@ i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf, (raw_id <<I40E_GLQF_ORT_FIELD_CNT_SHIFT ) | (layer_idx *I40E_MAX_FLXPLD_FIED );I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 + layer_idx), flx_ort); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD ); }/* Set flex pit */
Signature · 1 line
2.5.5
PATCH v4 2/4 net/i40e: add debug logs when writing global registers
In reply to Beilei XingAdd debug logs when writing global registers.
--- drivers/net/i40e/i40e_ethdev.c | 153 ++++++++++++++++++++++++++++++----------- drivers/net/i40e/i40e_ethdev.h | 11 +++ 2 files changed, 123 insertions(+), 41 deletions(-)
drivers/net/i40e/i40e_ethdev.c +112 -41
@@ -656,6 +656,15 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev,return 0 ; } +static inline void +i40e_write_global_rx_ctl (struct i40e_hw *hw,u32 reg_addr,u32 reg_val) +{ +i40e_write_rx_ctl (hw, reg_addr, reg_val); +PMD_DRV_LOG (DEBUG ,"Global register 0x%08x is modified " +"with value 0x%08x" , + reg_addr, reg_val); +} +RTE_PMD_REGISTER_PCI (net_i40e, rte_i40e_pmd);RTE_PMD_REGISTER_PCI_TABLE (net_i40e, pci_id_i40e_map);RTE_PMD_REGISTER_KMOD_DEP (net_i40e,"* igb_uio | uio_pci_generic | vfio-pci" );
@@ -678,8 +687,8 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)* configuration API is added to avoid configuration conflicts * between ports of the same device. */ -I40E_WRITE_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 ); -I40E_WRITE_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (40 ),0x00000029 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_PIT (9 ),0x00009420 );i40e_global_cfg_warning (I40E_WARNING_QINQ_PARSER ); }
@@ -1134,6 +1143,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) 0x00000028, NULL);if (ret)PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); +PMD_INIT_LOG (DEBUG ,"Global register 0x%08x is changed with value 0x28" , +I40E_GLQF_L3_MAP (40 ));i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER );/* Need the special FW version to support floating VEB */
@@ -1412,9 +1423,9 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)* Disable by default flexible payload * for corresponding L2/L3/L4 layers. */ -I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (33 ),0x00000000 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (34 ),0x00000000 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (35 ),0x00000000 );i40e_global_cfg_warning (I40E_WARNING_DIS_FLX_PLD ); }
@@ -3219,8 +3230,8 @@ i40e_vlan_tpid_set_by_registers(struct rte_eth_dev *dev,return -EIO ; }PMD_DRV_LOG (DEBUG , -"Debug write 0x%08" PRIx64" to I40E_GL_SWT_L2TAGCTRL[%d]" , - reg_w, reg_id); +"Global register 0x%08x is changed with value 0x%08x" , +I40E_GL_SWT_L2TAGCTRL (reg_id), (uint32_t )reg_w);return 0 ; }
@@ -3494,16 +3505,16 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) }/* config the water marker both based on the packets and bytes */ -I40E_WRITE_REG (hw,I40E_GLRPB_PHW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PHW , (pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_REG (hw,I40E_GLRPB_PLW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PLW , (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_REG (hw,I40E_GLRPB_GHW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GHW , pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT ); -I40E_WRITE_REG (hw,I40E_GLRPB_GLW , +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GLW , pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] <<I40E_KILOSHIFT );i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL );
@@ -7289,8 +7300,13 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -7323,6 +7339,10 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) &filter_replace_buf);if (status <0 )return status; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* For MPLSoGRE */ memset(&filter_replace, 0,
@@ -7345,8 +7365,13 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -7386,6 +7411,10 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) &filter_replace_buf);if (status <0 )return status; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* for GTP-U */ memset(&filter_replace, 0,
@@ -7414,8 +7443,13 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -7447,6 +7481,10 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) &filter_replace_buf);if (status <0 )return status; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* for GTP-U */ memset(&filter_replace, 0,
@@ -7468,8 +7506,13 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) status =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!status) +if (!status) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return status; }
@@ -8019,6 +8062,9 @@ i40e_dev_set_gre_key_len(struct i40e_hw *hw, uint8_t len) reg, NULL);if (ret !=0 )return ret; +PMD_DRV_LOG (DEBUG ,"Global register 0x%08x is changed " +"with value 0x%08x" , +I40E_GL_PRS_FVBM (2 ), reg);i40e_global_cfg_warning (I40E_WARNING_GRE_KEY_LEN ); }else { ret =0 ;
@@ -8275,7 +8321,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,for (j =I40E_FILTER_PCTYPE_INVALID +1 ; j <I40E_FILTER_PCTYPE_MAX ; j++) {if (adapter->pctypes_tbl[i] & (1ULL << j)) -i40e_write_rx_ctl (hw, +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (j), reg); }
@@ -8304,7 +8350,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,/* Use the default, and keep it as it is */ goto out; -i40e_write_rx_ctl (hw,I40E_GLQF_CTL , reg); +i40e_write_global_rx_ctl (hw,I40E_GLQF_CTL , reg);i40e_global_cfg_warning (I40E_WARNING_QF_CTL ); out:
@@ -8894,6 +8940,18 @@ i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val) (uint32_t)i40e_read_rx_ctl(hw, addr)); } +void +i40e_check_write_global_reg (struct i40e_hw *hw,uint32_t addr,uint32_t val) +{ +uint32_t reg =i40e_read_rx_ctl (hw, addr); + +PMD_DRV_LOG (DEBUG ,"[0x%08x] original: 0x%08x" , addr, reg); +if (reg != val) +i40e_write_global_rx_ctl (hw, addr, val); +PMD_DRV_LOG (DEBUG ,"[0x%08x] after: 0x%08x" , addr, + (uint32_t )i40e_read_rx_ctl (hw, addr)); +} +static void i40e_filter_input_set_init (struct i40e_pf *pf) {
@@ -8925,24 +8983,28 @@ i40e_filter_input_set_init(struct i40e_pf *pf)i40e_check_write_reg (hw,I40E_PRTQF_FD_INSET (pctype,1 ), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), (uint32_t )(inset_reg &UINT32_MAX )); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX ));for (i =0 ; i < num; i++) { -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), - mask_reg[i]); -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), - mask_reg[i]); +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), + mask_reg[i]); +i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_MSK (i, pctype), + mask_reg[i]); }/*clear unused mask registers of the pctype */ for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) { -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), -0 ); -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), -0 ); +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), +0 ); +i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_MSK (i, pctype), +0 ); }I40E_WRITE_FLUSH (hw);
@@ -9009,20 +9071,20 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw, inset_reg |=i40e_translate_input_set_reg (hw->mac.type, input_set); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), - (uint32_t )(inset_reg &UINT32_MAX )); -i40e_check_write_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), - (uint32_t )((inset_reg >> -I40E_32_BIT_WIDTH ) &UINT32_MAX )); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), + (uint32_t )(inset_reg &UINT32_MAX )); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), + (uint32_t )((inset_reg >> +I40E_32_BIT_WIDTH ) &UINT32_MAX ));i40e_global_cfg_warning (I40E_WARNING_HASH_INSET );for (i =0 ; i < num; i++) -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), - mask_reg[i]); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), + mask_reg[i]);/*clear unused mask registers of the pctype */ for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) -i40e_check_write_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), -0 ); +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), +0 );i40e_global_cfg_warning (I40E_WARNING_HASH_MSK );I40E_WRITE_FLUSH (hw);
@@ -9091,12 +9153,12 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf, I40E_32_BIT_WIDTH) & UINT32_MAX));for (i =0 ; i < num; i++) -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), - mask_reg[i]); +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), + mask_reg[i]);/*clear unused mask registers of the pctype */ for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) -i40e_check_write_reg (hw,I40E_GLQF_FD_MSK (i, pctype), -0 ); +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), +0 );i40e_global_cfg_warning (I40E_WARNING_FD_MSK );I40E_WRITE_FLUSH (hw);
@@ -11644,6 +11706,10 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf) &filter_replace_buf);if (ret !=I40E_SUCCESS )return ret; +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud l1 type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type);/* Apply the second L2 cloud filter */ memset(&filter_replace, 0,
@@ -11665,8 +11731,13 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED ; ret =i40e_aq_replace_cloud_filters (hw, &filter_replace, &filter_replace_buf); -if (!ret) +if (!ret) {i40e_global_cfg_warning (I40E_WARNING_RPL_CLD_FILTER ); +PMD_DRV_LOG (DEBUG ,"Global configuration modification: " +"cloud filter type is changed from 0x%x to 0x%x" , + filter_replace.old_filter_type, + filter_replace.new_filter_type); + }return ret; }
drivers/net/i40e/i40e_ethdev.h +11 -0
@@ -78,6 +78,15 @@ (((vf)->version_major ==VIRTCHNL_VERSION_MAJOR ) && \ ((vf)->version_minor == 1)) +#define I40E_WRITE_GLB_REG (hw, reg, value) \ + do { \ + I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((hw), \ + (reg)), (value)); \ + PMD_DRV_LOG(DEBUG, "Global register 0x%08x is modified " \ + "with value 0x%08x", \ + (reg), (value)); \ + } while (0) +/* index flex payload per layer */ enum i40e_flxpld_layer_idx {I40E_FLXPLD_L2_IDX =0 ,
@@ -1187,6 +1196,8 @@ int i40e_generate_inset_mask_reg(uint64_t inset, uint32_t *mask, uint8_t nb_elem);uint64_t i40e_translate_input_set_reg (enum i40e_mac_type type,uint64_t input);void i40e_check_write_reg (struct i40e_hw *hw,uint32_t addr,uint32_t val); +void i40e_check_write_global_reg (struct i40e_hw *hw, +uint32_t addr,uint32_t val);int i40e_tm_ops_get (struct rte_eth_dev *dev,void *ops);void i40e_tm_conf_init (struct rte_eth_dev *dev);
Signature · 1 line
2.5.5
PATCH v4 3/4 net/i40e: fix multiple driver support issue
In reply to Beilei XingThis patch provides the option to disable writing some global registers in PMD, in order to avoid affecting other drivers, when multiple drivers run on the same NIC and control different physical ports. Because there are few global resources shared among different physical ports.
--- drivers/net/i40e/i40e_ethdev.c | 262 ++++++++++++++++++++++++++++++++--------- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_fdir.c | 39 +++--- drivers/net/i40e/i40e_flow.c | 8 ++ 4 files changed, 240 insertions(+), 70 deletions(-)
drivers/net/i40e/i40e_ethdev.c +207 -55
@@ -1039,6 +1039,64 @@ i40e_init_queue_region_conf(struct rte_eth_dev *dev)memset (info,0 ,sizeof (struct i40e_queue_regions )); } +#define ETH_I40E_SUPPORT_MULTI_DRIVER "support-multi-driver" + +static int +i40e_parse_multi_drv_handler(__rte_unused const char *key, +const char *value, +void *opaque) +{ +struct i40e_pf *pf; +unsigned long support_multi_driver; +char *end; + + pf = (struct i40e_pf *)opaque; + + errno =0 ; + support_multi_driver =strtoul (value, &end,10 ); +if (errno !=0 || end == value || *end !=0 ) { +PMD_DRV_LOG (WARNING ,"Wrong global configuration" ); +return -(EINVAL ); + } + +if (support_multi_driver ==1 || support_multi_driver ==0 ) + pf->support_multi_driver = (bool )support_multi_driver; +else +PMD_DRV_LOG (WARNING ,"%s must be 1 or 0," , +"enable global configuration by default." +ETH_I40E_SUPPORT_MULTI_DRIVER ); +return 0 ; +} + +static int +i40e_support_multi_driver (struct rte_eth_dev *dev) +{ +struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); +static const char *const valid_keys[] = { +ETH_I40E_SUPPORT_MULTI_DRIVER ,NULL }; +struct rte_kvargs *kvlist; + +/* Enable global configuration by default */ + pf->support_multi_driver = false; + +if (!dev->device->devargs) +return 0 ; + + kvlist =rte_kvargs_parse (dev->device->devargs->args, valid_keys); +if (!kvlist) +return -EINVAL ; + +if (rte_kvargs_count (kvlist,ETH_I40E_SUPPORT_MULTI_DRIVER ) >1 ) +PMD_DRV_LOG (WARNING ,"More than one argument \"%s\" and only " +"the first invalid or last valid one is used !" , +ETH_I40E_SUPPORT_MULTI_DRIVER ); + +rte_kvargs_process (kvlist,ETH_I40E_SUPPORT_MULTI_DRIVER , + i40e_parse_multi_drv_handler, pf); +rte_kvargs_free (kvlist); +return 0 ; +} +static int eth_i40e_dev_init (struct rte_eth_dev *dev) {
@@ -1092,6 +1150,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) hw->bus.func = pci_dev->addr.function; hw->adapter_stopped =0 ; +/* Check if need to support multi-driver */ +i40e_support_multi_driver (dev); +/* Make sure all is clean before doing PF reset */ i40e_clear_hw (hw);
@@ -1119,7 +1180,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)* for packet type of QinQ by software. * It should be removed once issues are fixed in NVM. */ -i40e_GLQF_reg_init (hw); +if (!pf->support_multi_driver) +i40e_GLQF_reg_init (hw);/* Initialize the input set for filters (hash and fd) to default value */ i40e_filter_input_set_init (pf);
@@ -1139,13 +1201,17 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) (hw->nvm.version & 0xf), hw->nvm.eetrack);/* initialise the L3_MAP register */ - ret =i40e_aq_debug_write_register (hw,I40E_GLQF_L3_MAP (40 ), -0x00000028 ,NULL ); -if (ret) -PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , ret); -PMD_INIT_LOG (DEBUG ,"Global register 0x%08x is changed with value 0x28" , -I40E_GLQF_L3_MAP (40 )); -i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER ); +if (!pf->support_multi_driver) { + ret =i40e_aq_debug_write_register (hw,I40E_GLQF_L3_MAP (40 ), +0x00000028 ,NULL ); +if (ret) +PMD_INIT_LOG (ERR ,"Failed to write L3 MAP register %d" , + ret); +PMD_INIT_LOG (DEBUG , +"Global register 0x%08x is changed with 0x28" , +I40E_GLQF_L3_MAP (40 )); +i40e_global_cfg_warning (I40E_WARNING_QINQ_CLOUD_FILTER ); + }/* Need the special FW version to support floating VEB */ config_floating_veb (dev);
@@ -1221,11 +1287,15 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)i40e_set_fc (hw, &aq_fail, TRUE);/* Set the global registers with default ether type value */ - ret =i40e_vlan_tpid_set (dev,ETH_VLAN_TYPE_OUTER ,ETHER_TYPE_VLAN ); -if (ret !=I40E_SUCCESS ) { -PMD_INIT_LOG (ERR , -"Failed to set the default outer VLAN ether type" ); - goto err_setup_pf_switch; +if (!pf->support_multi_driver) { + ret =i40e_vlan_tpid_set (dev,ETH_VLAN_TYPE_OUTER , +ETHER_TYPE_VLAN ); +if (ret !=I40E_SUCCESS ) { +PMD_INIT_LOG (ERR , +"Failed to set the default outer " +"VLAN ether type" ); + goto err_setup_pf_switch; + } }/* PF setup, which includes VSI setup */
@@ -1291,7 +1361,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)rte_intr_enable (intr_handle);/* By default disable flexible payload in global configuration */ -i40e_flex_payload_reg_set_default (hw); +if (!pf->support_multi_driver) +i40e_flex_payload_reg_set_default (hw);/* * Add an ethertype filter to drop all flow control frames transmitted
@@ -2225,7 +2296,8 @@ i40e_dev_close(struct rte_eth_dev *dev)i40e_res_pool_destroy (&pf->msix_pool);/* Disable flexible payload in global configuration */ -i40e_flex_payload_reg_set_default (hw); +if (!pf->support_multi_driver) +i40e_flex_payload_reg_set_default (hw);/* force a PF reset to clean anything leftover */ reg =I40E_READ_REG (hw,I40E_PFGEN_CTRL );
@@ -3242,6 +3314,7 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, uint16_t tpid) {struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private);int qinq = dev->data->dev_conf.rxmode.hw_vlan_extend;int ret =0 ;
@@ -3252,6 +3325,12 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, "Unsupported vlan type.");return -EINVAL ; } + +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Setting TPID is not supported." ); +return -ENOTSUP ; + } +/* 802.1ad frames ability is added in NVM API 1.7*/ if (hw->flags &I40E_HW_FLAG_802_1AD_CAPABLE ) {if (qinq) {
@@ -3504,20 +3583,25 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)I40E_WRITE_REG (hw,I40E_PRTDCB_MFLCN , mflcn_reg); } -/* config the water marker both based on the packets and bytes */ -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PHW , - (pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PLW , - (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GHW , - pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ); -I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GLW , - pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ); -i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL ); +if (!pf->support_multi_driver) { +/* config water marker both based on the packets and bytes */ +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PHW , + (pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_PLW , + (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GHW , + pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ); +I40E_WRITE_GLB_REG (hw,I40E_GLRPB_GLW , + pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ); +i40e_global_cfg_warning (I40E_WARNING_FLOW_CTL ); + }else { +PMD_DRV_LOG (ERR , +"Water marker configuration is not supported." ); + }I40E_WRITE_FLUSH (hw);
@@ -4050,7 +4134,6 @@ i40e_get_cap(struct i40e_hw *hw)#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4#define QUEUE_NUM_PER_VF_ARG "queue-num-per-vf" -RTE_PMD_REGISTER_PARAM_STRING (net_i40e,QUEUE_NUM_PER_VF_ARG "=1|2|4|8|16" ); static int i40e_pf_parse_vf_queue_number_handler(const char *key, const char *value,
@@ -7264,6 +7347,11 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Replace l1 filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd )); memset(&filter_replace_buf, 0,
@@ -7318,6 +7406,11 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Replace cloud filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +/* For MPLSoUDP */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -7383,6 +7476,11 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Replace l1 filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +/* For GTP-C */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -7461,6 +7559,11 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf)struct i40e_hw *hw =I40E_PF_TO_HW (pf);enum i40e_status_code status =I40E_SUCCESS ; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Replace cloud filter is not supported." ); +return I40E_NOT_SUPPORTED ; + } +/* for GTP-C */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -8042,9 +8145,15 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,static int i40e_dev_set_gre_key_len (struct i40e_hw *hw,uint8_t len) { +struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;uint32_t val, reg;int ret = -EINVAL ; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"GRE key length configuration is unsupported" ); +return -ENOTSUP ; + } + val =I40E_READ_REG (hw,I40E_GL_PRS_FVBM (2 ));PMD_DRV_LOG (DEBUG ,"Read original GL_PRS_FVBM with 0x%08x" , val);
@@ -8299,11 +8408,17 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, struct rte_eth_hash_global_conf *g_cfg) {struct i40e_adapter *adapter = (struct i40e_adapter *)hw->back; +struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;int ret;uint16_t i, j;uint32_t reg;uint64_t mask0 = g_cfg->valid_bit_mask[0 ] & adapter->flow_types_mask; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Hash global configuration is not supported." ); +return -ENOTSUP ; + } +/* Check the input parameters */ ret =i40e_hash_global_config_check (adapter, g_cfg);if (ret <0 )
@@ -8975,6 +9090,10 @@ i40e_filter_input_set_init(struct i40e_pf *pf) I40E_INSET_MASK_NUM_REG);if (num <0 )return ; +if (pf->support_multi_driver && num >0 ) { +PMD_DRV_LOG (ERR ,"Input set setting is not supported." ); +return ; + } inset_reg =i40e_translate_input_set_reg (hw->mac.type, input_set);
@@ -8983,39 +9102,48 @@ i40e_filter_input_set_init(struct i40e_pf *pf)i40e_check_write_reg (hw,I40E_PRTQF_FD_INSET (pctype,1 ), (uint32_t )((inset_reg >>I40E_32_BIT_WIDTH ) &UINT32_MAX )); -i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (0 , pctype), - (uint32_t )(inset_reg &UINT32_MAX )); -i40e_check_write_global_reg (hw,I40E_GLQF_HASH_INSET (1 , pctype), - (uint32_t )((inset_reg >> -I40E_32_BIT_WIDTH ) &UINT32_MAX )); - -for (i =0 ; i < num; i++) { +if (!pf->support_multi_driver) { +i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_INSET (0 , pctype), + (uint32_t )(inset_reg &UINT32_MAX ));i40e_check_write_global_reg (hw, +I40E_GLQF_HASH_INSET (1 , pctype), + (uint32_t )((inset_reg >> +I40E_32_BIT_WIDTH ) &UINT32_MAX )); + +for (i =0 ; i < num; i++) { +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), mask_reg[i]); -i40e_check_write_global_reg (hw, +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype), mask_reg[i]); - } -/*clear unused mask registers of the pctype */ -for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) { -i40e_check_write_global_reg (hw, + } +/*clear unused mask registers of the pctype */ +for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) { +i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype),0 ); -i40e_check_write_global_reg (hw, +i40e_check_write_global_reg (hw,I40E_GLQF_HASH_MSK (i, pctype),0 ); + } + }else { +PMD_DRV_LOG (ERR ,"Input set setting is not supported." ); }I40E_WRITE_FLUSH (hw);/* store the default input set */ - pf->hash_input_set[pctype] = input_set; +if (!pf->support_multi_driver) + pf->hash_input_set[pctype] = input_set; pf->fdir.input_set[pctype] = input_set; } -i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); -i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); -i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); +if (!pf->support_multi_driver) { +i40e_global_cfg_warning (I40E_WARNING_HASH_INSET ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +i40e_global_cfg_warning (I40E_WARNING_HASH_MSK ); + } }int
@@ -9038,6 +9166,11 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,return -EINVAL ; } +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Hash input set setting is not supported." ); +return -ENOTSUP ; + } + pctype =i40e_flowtype_to_pctype (pf->adapter, conf->flow_type);if (pctype ==I40E_FILTER_PCTYPE_INVALID ) {PMD_DRV_LOG (ERR ,"invalid flow_type input." );
@@ -9143,6 +9276,10 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf, I40E_INSET_MASK_NUM_REG);if (num <0 )return -EINVAL ; +if (pf->support_multi_driver && num >0 ) { +PMD_DRV_LOG (ERR ,"FDIR bit mask is not supported." ); +return -ENOTSUP ; + } inset_reg |=i40e_translate_input_set_reg (hw->mac.type, input_set);
@@ -9152,14 +9289,20 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf, (uint32_t )((inset_reg >> I40E_32_BIT_WIDTH) & UINT32_MAX)); -for (i =0 ; i < num; i++) -i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), - mask_reg[i]); -/*clear unused mask registers of the pctype */ -for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) -i40e_check_write_global_reg (hw,I40E_GLQF_FD_MSK (i, pctype), -0 ); -i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); +if (!pf->support_multi_driver) { +for (i =0 ; i < num; i++) +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), + mask_reg[i]); +/*clear unused mask registers of the pctype */ +for (i = num; i <I40E_INSET_MASK_NUM_REG ; i++) +i40e_check_write_global_reg (hw, +I40E_GLQF_FD_MSK (i, pctype), +0 ); +i40e_global_cfg_warning (I40E_WARNING_FD_MSK ); + }else { +PMD_DRV_LOG (ERR ,"FDIR bit mask is not supported." ); + }I40E_WRITE_FLUSH (hw); pf->fdir.input_set[pctype] = input_set;
@@ -11676,6 +11819,11 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf)struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf;struct i40e_hw *hw =I40E_PF_TO_HW (pf); +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Replace cloud filter is not supported." ); +return ret; + } +/* Init */ memset (&filter_replace,0 ,sizeof (struct i40e_aqc_replace_cloud_filters_cmd ));
@@ -11828,3 +11976,7 @@ i40e_init_log(void)if (i40e_logtype_driver >=0 )rte_log_set_level (i40e_logtype_driver,RTE_LOG_NOTICE ); } + +RTE_PMD_REGISTER_PARAM_STRING (net_i40e, +QUEUE_NUM_PER_VF_ARG "=1|2|4|8|16" +ETH_I40E_SUPPORT_MULTI_DRIVER "=1" );
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -950,6 +950,7 @@ struct i40e_pf {bool gtp_replace_flag;/* 1 - GTP-C/U filter replace is done */ bool qinq_replace_flag;/* QINQ filter replace is done */ struct i40e_tm_conf tm_conf; +bool support_multi_driver;/* 1 - support multiple driver */ /* Dynamic Device Personalization */ bool gtp_support;/* 1 - support GTP-C and GTP-U */
drivers/net/i40e/i40e_fdir.c +24 -15
@@ -649,22 +649,31 @@ i40e_fdir_configure(struct rte_eth_dev *dev)PMD_DRV_LOG (ERR ," invalid configuration arguments." );return -EINVAL ; } -/* configure flex payload */ -for (i =0 ; i < conf->nb_payloads; i++) -i40e_set_flx_pld_cfg (pf, &conf->flex_set[i]); -/* configure flex mask*/ -for (i =0 ; i < conf->nb_flexmasks; i++) { -if (hw->mac.type ==I40E_MAC_X722 ) { -/* get translated pctype value in fd pctype register */ - pctype = (enum i40e_filter_pctype )i40e_read_rx_ctl ( - hw,I40E_GLQF_FD_PCTYPES ( - (int )i40e_flowtype_to_pctype (pf->adapter, - conf->flex_mask[i].flow_type))); - }else - pctype =i40e_flowtype_to_pctype (pf->adapter, - conf->flex_mask[i].flow_type); -i40e_set_flex_mask_on_pctype (pf, pctype, &conf->flex_mask[i]); +if (!pf->support_multi_driver) { +/* configure flex payload */ +for (i =0 ; i < conf->nb_payloads; i++) +i40e_set_flx_pld_cfg (pf, &conf->flex_set[i]); +/* configure flex mask*/ +for (i =0 ; i < conf->nb_flexmasks; i++) { +if (hw->mac.type ==I40E_MAC_X722 ) { +/* get pctype value in fd pctype register */ + pctype = (enum i40e_filter_pctype ) +i40e_read_rx_ctl (hw, +I40E_GLQF_FD_PCTYPES ( + (int )i40e_flowtype_to_pctype ( + pf->adapter, + conf->flex_mask[i].flow_type))); + }else { + pctype =i40e_flowtype_to_pctype (pf->adapter, + conf->flex_mask[i].flow_type); + } + +i40e_set_flex_mask_on_pctype (pf, pctype, + &conf->flex_mask[i]); + } + }else { +PMD_DRV_LOG (ERR ,"Not support flexible payload." ); }return ret;
drivers/net/i40e/i40e_flow.c +8 -0
@@ -2851,6 +2851,14 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,return -rte_errno; } +if (pf->support_multi_driver) { +rte_flow_error_set (error,ENOTSUP , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Unsupported flexible payload." ); +return -rte_errno; + } + ret =i40e_flow_check_raw_item (item, raw_spec, error);if (ret <0 )return ret;
Signature · 1 line
2.5.5
PATCH v4 4/4 net/i40e: fix interrupt conflict when using multi-driver
In reply to Beilei XingThere's interrupt conflict when using DPDK and Linux i40e on different ports of the same Ethernet controller, this patch fixes it by switching from IntN to Int0 if multiple drivers are used.
--- drivers/net/i40e/i40e_ethdev.c | 89 +++++++++++++++++++++++++-------------- drivers/net/i40e/i40e_ethdev.h | 14 +++--- drivers/net/i40e/i40e_ethdev_vf.c | 4 +- 3 files changed, 68 insertions(+), 39 deletions(-)
drivers/net/i40e/i40e_ethdev.c +57 -32
@@ -692,6 +692,23 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)i40e_global_cfg_warning (I40E_WARNING_QINQ_PARSER ); } +static inline void i40e_config_automask (struct i40e_pf *pf) +{ +struct i40e_hw *hw =I40E_PF_TO_HW (pf); +uint32_t val; + +/* INTENA flag is not auto-cleared for interrupt */ + val =I40E_READ_REG (hw,I40E_GLINT_CTL ); + val |=I40E_GLINT_CTL_DIS_AUTOMASK_PF0_MASK | +I40E_GLINT_CTL_DIS_AUTOMASK_VF0_MASK ; + +/* If support multi-driver, PF will use INT0. */ +if (!pf->support_multi_driver) + val |=I40E_GLINT_CTL_DIS_AUTOMASK_N_MASK ; + +I40E_WRITE_REG (hw,I40E_GLINT_CTL , val); +} +#define I40E_FLOW_CONTROL_ETHERTYPE 0x8808/*
@@ -1173,6 +1190,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)return ret; } +i40e_config_automask (pf); +i40e_set_default_pctype_table (dev);/*
@@ -1705,6 +1724,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect,int i;uint32_t val;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +struct i40e_pf *pf =I40E_VSI_TO_PF (vsi);/* Bind all RX queues to allocated MSIX interrupt */ for (i =0 ; i < nb_queue; i++) {
@@ -1723,7 +1743,8 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect,/* Write first RX queue to Link list register as the head element */ if (vsi->type !=I40E_VSI_SRIOV ) {uint16_t interval = -i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,1 ); +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,1 , + pf->support_multi_driver);if (msix_vect ==I40E_MISC_VEC_ID ) { I40E_WRITE_REG(hw, I40E_PFINT_LNKLST0,
@@ -1782,7 +1803,6 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)uint16_t nb_msix =RTE_MIN (vsi->nb_msix, intr_handle->nb_efd);uint16_t queue_idx =0 ;int record =0 ; -uint32_t val;int i;for (i =0 ; i < vsi->nb_qps; i++) {
@@ -1790,13 +1810,6 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)I40E_WRITE_REG (hw,I40E_QINT_RQCTL (vsi->base_queue + i),0 ); } -/* INTENA flag is not auto-cleared for interrupt */ - val =I40E_READ_REG (hw,I40E_GLINT_CTL ); - val |=I40E_GLINT_CTL_DIS_AUTOMASK_PF0_MASK | -I40E_GLINT_CTL_DIS_AUTOMASK_N_MASK | -I40E_GLINT_CTL_DIS_AUTOMASK_VF0_MASK ; -I40E_WRITE_REG (hw,I40E_GLINT_CTL , val); -/* VF bind interrupt */ if (vsi->type ==I40E_VSI_SRIOV ) { __vsi_queues_bind_intr(vsi, msix_vect,
@@ -1853,27 +1866,22 @@ i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi)struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev);struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); -uint16_t interval =i40e_calc_itr_interval (\ -RTE_LIBRTE_I40E_ITR_INTERVAL ,1 ); +struct i40e_pf *pf =I40E_VSI_TO_PF (vsi);uint16_t msix_intr, i; -if (rte_intr_allow_others (intr_handle)) +if (rte_intr_allow_others (intr_handle) || !pf->support_multi_driver)for (i =0 ; i < vsi->nb_msix; i++) { msix_intr = vsi->msix_intr + i;I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (msix_intr -1 ),I40E_PFINT_DYN_CTLN_INTENA_MASK |I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | - (0 <<I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT ) | - (interval << -I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT )); +I40E_PFINT_DYN_CTLN_ITR_INDX_MASK ); }else I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 ,I40E_PFINT_DYN_CTL0_INTENA_MASK |I40E_PFINT_DYN_CTL0_CLEARPBA_MASK | - (0 <<I40E_PFINT_DYN_CTL0_ITR_INDX_SHIFT ) | - (interval << -I40E_PFINT_DYN_CTL0_INTERVAL_SHIFT )); +I40E_PFINT_DYN_CTL0_ITR_INDX_MASK );I40E_WRITE_FLUSH (hw); }
@@ -1885,16 +1893,18 @@ i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi)struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev);struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +struct i40e_pf *pf =I40E_VSI_TO_PF (vsi);uint16_t msix_intr, i; -if (rte_intr_allow_others (intr_handle)) +if (rte_intr_allow_others (intr_handle) || !pf->support_multi_driver)for (i =0 ; i < vsi->nb_msix; i++) { msix_intr = vsi->msix_intr + i;I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (msix_intr -1 ), -0 ); +I40E_PFINT_DYN_CTLN_ITR_INDX_MASK ); }else -I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 ,0 ); +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 , +I40E_PFINT_DYN_CTL0_ITR_INDX_MASK );I40E_WRITE_FLUSH (hw); }
@@ -5175,16 +5185,28 @@ i40e_vsi_setup(struct i40e_pf *pf,/* VF has MSIX interrupt in VF range, don't allocate here */ if (type ==I40E_VSI_MAIN ) { - ret =i40e_res_pool_alloc (&pf->msix_pool, -RTE_MIN (vsi->nb_qps, -RTE_MAX_RXTX_INTR_VEC_ID )); -if (ret <0 ) { -PMD_DRV_LOG (ERR ,"VSI MAIN %d get heap failed %d" , - vsi->seid, ret); - goto fail_queue_alloc; +if (pf->support_multi_driver) { +/* If support multi-driver, need to use INT0 instead of +* allocating from msix pool. The Msix pool is init from +* INT1, so it's OK just set msix_intr to 0 and nb_msix +* to 1 without calling i40e_res_pool_alloc. +*/ + vsi->msix_intr =0 ; + vsi->nb_msix =1 ; + }else { + ret =i40e_res_pool_alloc (&pf->msix_pool, +RTE_MIN (vsi->nb_qps, +RTE_MAX_RXTX_INTR_VEC_ID )); +if (ret <0 ) { +PMD_DRV_LOG (ERR , +"VSI MAIN %d get heap failed %d" , + vsi->seid, ret); + goto fail_queue_alloc; + } + vsi->msix_intr = ret; + vsi->nb_msix =RTE_MIN (vsi->nb_qps, +RTE_MAX_RXTX_INTR_VEC_ID ); } - vsi->msix_intr = ret; - vsi->nb_msix =RTE_MIN (vsi->nb_qps,RTE_MAX_RXTX_INTR_VEC_ID ); }else if (type !=I40E_VSI_SRIOV ) { ret =i40e_res_pool_alloc (&pf->msix_pool,1 );if (ret <0 ) {
@@ -6101,7 +6123,8 @@ void i40e_pf_disable_irq0(struct i40e_hw *hw) {/* Disable all interrupt types */ -I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 ,0 ); +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 , +I40E_PFINT_DYN_CTL0_ITR_INDX_MASK );I40E_WRITE_FLUSH (hw); }
@@ -11089,11 +11112,13 @@ i40e_dev_get_dcb_info(struct rte_eth_dev *dev,static int i40e_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id) { +struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev);struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private);uint16_t interval = -i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,1 ); +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,1 , + pf->support_multi_driver);uint16_t msix_intr; msix_intr = intr_handle->intr_vec[queue_id];
drivers/net/i40e/i40e_ethdev.h +9 -5
@@ -1292,13 +1292,17 @@ i40e_align_floor(int n) }static inline uint16_t -i40e_calc_itr_interval (int16_t interval,bool is_pf) +i40e_calc_itr_interval (int16_t interval,bool is_pf,bool is_multi_drv) {if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) { -if (is_pf) - interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; -else - interval =I40E_VF_QUEUE_ITR_INTERVAL_DEFAULT ; +if (is_multi_drv) { + interval =I40E_QUEUE_ITR_INTERVAL_MAX ; + }else { +if (is_pf) + interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; +else + interval =I40E_VF_QUEUE_ITR_INTERVAL_DEFAULT ; + } }/* Convert to hardware count, as writing each 1 represents 2 us */
drivers/net/i40e/i40e_ethdev_vf.c +2 -2
@@ -1138,7 +1138,7 @@ i40evf_init_vf(struct rte_eth_dev *dev)struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct i40e_vf *vf =I40EVF_DEV_PRIVATE_TO_VF (dev->data->dev_private);uint16_t interval = -i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,0 ); +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,0 ,0 ); vf->adapter =I40E_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); vf->dev_data = dev->data;
@@ -1841,7 +1841,7 @@ i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private);uint16_t interval = -i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,0 ); +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,0 ,0 );uint16_t msix_intr; msix_intr = intr_handle->intr_vec[queue_id];
Signature · 1 line
2.5.5
Re: [PATCH v4 0/4] net/i40e: fix multiple driver support issue
In reply to Beilei XingQuoted 39 lines
-----Original Message-----
From: Xing, Beilei
Sent: Friday, February 2, 2018 8:06 PM
To: [email protected]; Wu, Jingjing <[email protected]>
Subject: [PATCH v4 0/4] net/i40e: fix multiple driver support issueDPDK i40e PMD will modify some global registers during initialization and post initialization, there'll be impact during use of 700 series Ethernet Adapter with both Linux kernel and DPDK PMD.
This patchset adds log for global configuration and adds device args to disable global configuration and change interrupt for PF.v4 changes:
- Fix interrupt conflict when using multiple driver.v3 changes:
- Reword commit log.v2 changes:
- Add debug log when writing global registers
- Add option to disable writing global registersBeilei Xing (4):
net/i40e: add warnings when writing global registers net/i40e: add debug logs when writing global registers net/i40e: fix multiple driver support issue net/i40e: fix interrupt conflict when using multi-driverdoc/guides/nics/i40e.rst | 12 + drivers/net/i40e/i40e_ethdev.c | 477 ++++++++++++++++++++++++++++++-------- drivers/net/i40e/i40e_ethdev.h | 69 +++++- drivers/net/i40e/i40e_ethdev_vf.c | 4 +- drivers/net/i40e/i40e_fdir.c | 40 ++-- drivers/net/i40e/i40e_flow.c | 9 + 6 files changed, 487 insertions(+), 124 deletions(-)
Quoted 2 lines
--
2.5.5
Zhang, Helin
AppliedRe: [PATCH v4 0/4] net/i40e: fix multiple driver support issue
Quoted 49 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wu, Jingjing
Sent: Friday, February 2, 2018 8:42 PM
To: Xing, Beilei; [email protected]
Subject: Re: [dpdk-dev] [PATCH v4 0/4] net/i40e: fix multiple driver support issueQuoted 23 lines
-----Original Message-----
From: Xing, Beilei
Sent: Friday, February 2, 2018 8:06 PM
To: [email protected]; Wu, Jingjing <[email protected]>
Subject: [PATCH v4 0/4] net/i40e: fix multiple driver support issueDPDK i40e PMD will modify some global registers during initialization and post initialization, there'll be impact during use of 700 series Ethernet Adapter with both Linux kernel and DPDK PMD.
This patchset adds log for global configuration and adds device args to disable global configuration and change interrupt for PF.v4 changes:
- Fix interrupt conflict when using multiple driver.v3 changes:
- Reword commit log.v2 changes:
- Add debug log when writing global registers
- Add option to disable writing global registersQuoted 8 lines
Beilei Xing (4):
net/i40e: add warnings when writing global registers net/i40e: add debug logs when writing global registers net/i40e: fix multiple driver support issue net/i40e: fix interrupt conflict when using multi-driverdoc/guides/nics/i40e.rst | 12 + drivers/net/i40e/i40e_ethdev.c | 477 ++++++++++++++++++++++++++++++--------
Quoted 6 lines
drivers/net/i40e/i40e_ethdev.h | 69 +++++- drivers/net/i40e/i40e_ethdev_vf.c | 4 +- drivers/net/i40e/i40e_fdir.c | 40 ++-- drivers/net/i40e/i40e_flow.c | 9 + 6 files changed, 487 insertions(+), 124 deletions(-)
Quoted 4 lines
Quoted 2 lines
--
2.5.5Acked-by Jingjing Wu <[email protected]>
Applied the series to dpdk-next-net-intel sub tree, thanks!
/Helin