net/i40e: add device args to disable global configuration
PATCH 1/1 net/i40e: add device args to disable 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 patch is to add device parameters to disable global configuration.
---
This patch is based on 16.11.4 LTS version.
drivers/net/i40e/i40e_ethdev.c | 208 ++++++++++++++++++++++++++++++++--------- drivers/net/i40e/i40e_ethdev.h | 2 + 2 files changed, 165 insertions(+), 45 deletions(-)
drivers/net/i40e/i40e_ethdev.c +163 -45
@@ -933,6 +933,67 @@ config_floating_veb(struct rte_eth_dev *dev)#define I40E_L2_TAGS_S_TAG_SHIFT 1#define I40E_L2_TAGS_S_TAG_MASK I40E_MASK(0x1, I40E_L2_TAGS_S_TAG_SHIFT) +#define ETH_I40E_DISABLE_GLOBAL_CFG "disable-global-cfg" +RTE_PMD_REGISTER_PARAM_STRING (net_i40e, +ETH_I40E_DISABLE_GLOBAL_CFG "=0|1" ); + +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); +struct rte_pci_device *pci_dev = dev->pci_dev; +static const char *valid_keys[] = { +ETH_I40E_DISABLE_GLOBAL_CFG ,NULL }; +struct rte_kvargs *kvlist; + +/* Enable global configuration by default */ + pf->dis_global_cfg = false; + +if (!pci_dev->device.devargs) +return 0 ; + + kvlist =rte_kvargs_parse (pci_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) {
@@ -982,6 +1043,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);
@@ -1008,7 +1072,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)* 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);
@@ -1104,11 +1169,14 @@ 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 */
@@ -2743,11 +2811,17 @@ 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);uint64_t reg_r =0 , reg_w =0 ;uint16_t reg_id =0 ;int ret =0 ;int qinq = dev->data->dev_conf.rxmode.hw_vlan_extend; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Setting TPID is not supported." ); +return -ENOTSUP ; + } +switch (vlan_type) {case ETH_VLAN_TYPE_OUTER :if (qinq)
@@ -3025,19 +3099,23 @@ 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_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 , - (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); -I40E_WRITE_REG (hw,I40E_GLRPB_GHW , - pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ); -I40E_WRITE_REG (hw,I40E_GLRPB_GLW , - pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] - <<I40E_KILOSHIFT ); +if (!pf->dis_global_cfg) { +/* config water marker both based on the packets and bytes */ +I40E_WRITE_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 , + (pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ) /I40E_PACKET_AVERAGE_SIZE ); +I40E_WRITE_REG (hw,I40E_GLRPB_GHW , + pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ); +I40E_WRITE_REG (hw,I40E_GLRPB_GLW , + pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS ] + <<I40E_KILOSHIFT ); + }else +PMD_DRV_LOG (ERR , +"Water marker configuration is not supported." );I40E_WRITE_FLUSH (hw);
@@ -6855,9 +6933,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\n" , val);
@@ -7095,12 +7179,18 @@ static int i40e_set_hash_filter_global_config(struct i40e_hw *hw, struct rte_eth_hash_global_conf *g_cfg) { + struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;int ret;uint16_t i;uint32_t reg;uint32_t mask0 = g_cfg->valid_bit_mask[0 ];enum i40e_filter_pctype pctype; +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 (g_cfg);if (ret <0 )
@@ -7815,6 +7905,12 @@ 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);
@@ -7823,29 +7919,38 @@ 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), - (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 )); -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]); - } -/*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 ); - } +if (!pf->dis_global_cfg) { +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 )); + +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]); + } +/*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 ); + } + }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; } }
@@ -7860,6 +7965,11 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,uint32_t mask_reg[I40E_INSET_MASK_NUM_REG ] = {0 };int ret, i, num; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Hash input set setting is not supported." ); +return -ENOTSUP ; + } +if (!conf) {PMD_DRV_LOG (ERR ,"Invalid pointer" );return -EFAULT ;
@@ -7984,6 +8094,11 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,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); i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
@@ -7992,13 +8107,16 @@ 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_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 ); +if (!pf->dis_global_cfg) { +for (i =0 ; i < num; i++) +i40e_check_write_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 ); + }else +PMD_DRV_LOG (ERR ,"FDIR bit mask is not supported." );I40E_WRITE_FLUSH (hw); pf->fdir.input_set[pctype] = input_set;
drivers/net/i40e/i40e_ethdev.h +2 -0
@@ -477,6 +477,8 @@ struct i40e_pf {bool floating_veb;/* The flag to use the floating VEB */ /* The floating enable flag for the specific VF */ bool floating_veb_list[I40E_MAX_VF ]; + +bool dis_global_cfg;/* 1 - disable changing global register */ };enum pending_msg {
Signature · 1 line
2.5.5
v2 cover net/i40e: fix multiple driver support issue
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 logs for global configuration and adds device args to disable global configuration.
This patchset is based on 16.11.4 LTS. Commit id: 516447a5056c093e4d020011a69216b453576782
v2 changes:
- Add warning logs and debug logs.
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 | 319 +++++++++++++++++++++++++++++++---------- drivers/net/i40e/i40e_ethdev.h | 54 +++++++ 3 files changed, 309 insertions(+), 76 deletions(-)
Signature · 1 line
2.5.5
PATCH v2 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 | 15 +++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 43 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+)
doc/guides/nics/i40e.rst +12 -0
@@ -459,3 +459,15 @@ Receive packets with Ethertype 0x88A8 Due to the FW limitation, PF can receive packets with Ethertype 0x88A8 only when floating VEB is disabled. + +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.
drivers/net/i40e/i40e_ethdev.c +15 -0
@@ -738,6 +738,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x000000E0 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x000000E3 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x000000E6 ); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD );/* * Initialize registers for parsing packet type of QinQ
@@ -747,6 +748,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
@@ -2800,6 +2802,8 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,PMD_DRV_LOG (DEBUG ,"Debug write 0x%08" PRIx64" to " "I40E_GL_SWT_L2TAGCTRL[%d]" , reg_w, reg_id); +i40e_global_cfg_warning (I40E_WARNING_TPID ); +return ret; }
@@ -3038,6 +3042,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);
@@ -6875,6 +6880,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 ; }
@@ -7154,6 +7160,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, }else {i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (pctype), reg); } +i40e_global_cfg_warning (I40E_WARNING_HSYM ); } reg =i40e_read_rx_ctl (hw,I40E_GLQF_CTL );
@@ -7178,6 +7185,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);
@@ -7848,6 +7856,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
@@ -7913,6 +7925,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),
@@ -7921,6 +7934,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;
@@ -7999,6 +8013,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 +43 -0
55 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH v2 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 | 131 ++++++++++++++++++++++++++--------------- drivers/net/i40e/i40e_ethdev.h | 9 +++ 2 files changed, 92 insertions(+), 48 deletions(-)
drivers/net/i40e/i40e_ethdev.c +83 -48
@@ -716,6 +716,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.pci_drv);RTE_PMD_REGISTER_PCI_TABLE (net_i40e, pci_id_i40e_map);
@@ -735,9 +744,9 @@ 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 (33 ),0x000000E0 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x000000E3 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x000000E6 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (33 ),0x000000E0 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (34 ),0x000000E3 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (35 ),0x000000E6 );i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD );/*
@@ -746,8 +755,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 ); }
@@ -2799,8 +2808,9 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, "I40E_GL_SWT_L2TAGCTRL[%d]", reg_id);return ret; } -PMD_DRV_LOG (DEBUG ,"Debug write 0x%08" PRIx64" to " -"I40E_GL_SWT_L2TAGCTRL[%d]" , reg_w, reg_id); +PMD_DRV_LOG (DEBUG , +"Global register 0x%08x is changed with value 0x%08x" +I40E_GL_SWT_L2TAGCTRL (reg_id), (uint32_t )reg_w);i40e_global_cfg_warning (I40E_WARNING_TPID );
@@ -3030,16 +3040,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 );
@@ -6880,6 +6890,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 ;
@@ -7124,41 +7137,43 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, I40E_GLQF_HSYM_SYMH_ENA_MASK :0 ;if (hw->mac.type ==I40E_MAC_X722 ) {if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV4_UDP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV4_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP ), reg); }else if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV4_TCP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV4_TCP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK ), reg); }else if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV6_UDP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV6_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP ), reg); }else if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV6_TCP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV6_TCP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK ), reg); }else { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (pctype), - reg); +i40e_write_global_rx_ctl (hw, +I40E_GLQF_HSYM (pctype), + reg); } }else { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (pctype), reg); +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (pctype), + reg); }i40e_global_cfg_warning (I40E_WARNING_HSYM ); }
@@ -7184,7 +7199,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:
@@ -7799,6 +7814,18 @@ i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val) }static 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) {struct i40e_hw *hw =I40E_PF_TO_HW (pf);
@@ -7831,24 +7858,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);
@@ -7920,20 +7951,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);
@@ -8007,12 +8038,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);
@@ -9357,6 +9388,10 @@ i40e_vsi_config_tc(struct i40e_vsi *vsi, uint8_t tc_map)/* Check if enabled_tc is same as existing or new TCs */ if (vsi->enabled_tc == tc_map)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);/* configure tc bandwidth */ memset (&bw_data,0 ,sizeof (bw_data));
drivers/net/i40e/i40e_ethdev.h +9 -0
@@ -103,6 +103,15 @@ (((vf)->version_major ==I40E_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 ,
Signature · 1 line
2.5.5
PATCH v2 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 | 213 +++++++++++++++++++++++++++++++---------- drivers/net/i40e/i40e_ethdev.h | 2 + 2 files changed, 167 insertions(+), 48 deletions(-)
drivers/net/i40e/i40e_ethdev.c +165 -48
@@ -944,6 +944,67 @@ config_floating_veb(struct rte_eth_dev *dev)#define I40E_L2_TAGS_S_TAG_SHIFT 1#define I40E_L2_TAGS_S_TAG_MASK I40E_MASK(0x1, I40E_L2_TAGS_S_TAG_SHIFT) +#define ETH_I40E_DISABLE_GLOBAL_CFG "disable-global-cfg" +RTE_PMD_REGISTER_PARAM_STRING (net_i40e, +ETH_I40E_DISABLE_GLOBAL_CFG "=0|1" ); + +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); +struct rte_pci_device *pci_dev = dev->pci_dev; +static const char *valid_keys[] = { +ETH_I40E_DISABLE_GLOBAL_CFG ,NULL }; +struct rte_kvargs *kvlist; + +/* Enable global configuration by default */ + pf->dis_global_cfg = false; + +if (!pci_dev->device.devargs) +return 0 ; + + kvlist =rte_kvargs_parse (pci_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) {
@@ -993,6 +1054,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);
@@ -1019,7 +1083,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)* 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);
@@ -1115,11 +1180,14 @@ 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 */
@@ -2754,11 +2822,17 @@ 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);uint64_t reg_r =0 , reg_w =0 ;uint16_t reg_id =0 ;int ret =0 ;int qinq = dev->data->dev_conf.rxmode.hw_vlan_extend; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Setting TPID is not supported." ); +return -ENOTSUP ; + } +switch (vlan_type) {case ETH_VLAN_TYPE_OUTER :if (qinq)
@@ -3039,20 +3113,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);
@@ -6870,9 +6948,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\n" , val);
@@ -7114,12 +7198,18 @@ static int i40e_set_hash_filter_global_config(struct i40e_hw *hw, struct rte_eth_hash_global_conf *g_cfg) { + struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;int ret;uint16_t i;uint32_t reg;uint32_t mask0 = g_cfg->valid_bit_mask[0 ];enum i40e_filter_pctype pctype; +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 (g_cfg);if (ret <0 )
@@ -7850,6 +7940,12 @@ 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);
@@ -7858,39 +7954,45 @@ 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 ); - } +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
@@ -7903,6 +8005,11 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,uint32_t mask_reg[I40E_INSET_MASK_NUM_REG ] = {0 };int ret, i, num; +if (pf->dis_global_cfg) { +PMD_DRV_LOG (ERR ,"Hash input set setting is not supported." ); +return -ENOTSUP ; + } +if (!conf) {PMD_DRV_LOG (ERR ,"Invalid pointer" );return -EFAULT ;
@@ -8029,6 +8136,11 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,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); i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
@@ -8037,14 +8149,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;
drivers/net/i40e/i40e_ethdev.h +2 -0
@@ -486,6 +486,8 @@ struct i40e_pf {bool floating_veb;/* The flag to use the floating VEB */ /* The floating enable flag for the specific VF */ bool floating_veb_list[I40E_MAX_VF ]; + +bool dis_global_cfg;/* 1 - disable changing global register */ };enum pending_msg {
Signature · 1 line
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 logs for global configuration and adds device args to disable global configuration and change interrupt for PF.
This patchset is based on 16.11.4 LTS. Commit id: 516447a5056c093e4d020011a69216b453576782
v3 changes:
- Fix interrupt conflict when using multiple driver.
v2 changes:
- Add warning logs and debug logs.
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 | 412 ++++++++++++++++++++++++++++---------- drivers/net/i40e/i40e_ethdev.h | 63 +++++- drivers/net/i40e/i40e_ethdev_vf.c | 4 +- 4 files changed, 377 insertions(+), 114 deletions(-)
Signature · 1 line
2.5.5
PATCH v3 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 | 15 +++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 43 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+)
doc/guides/nics/i40e.rst +12 -0
@@ -459,3 +459,15 @@ Receive packets with Ethertype 0x88A8 Due to the FW limitation, PF can receive packets with Ethertype 0x88A8 only when floating VEB is disabled. + +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.
drivers/net/i40e/i40e_ethdev.c +15 -0
@@ -738,6 +738,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x000000E0 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x000000E3 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x000000E6 ); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD );/* * Initialize registers for parsing packet type of QinQ
@@ -747,6 +748,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
@@ -2800,6 +2802,8 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,PMD_DRV_LOG (DEBUG ,"Debug write 0x%08" PRIx64" to " "I40E_GL_SWT_L2TAGCTRL[%d]" , reg_w, reg_id); +i40e_global_cfg_warning (I40E_WARNING_TPID ); +return ret; }
@@ -3038,6 +3042,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);
@@ -6875,6 +6880,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 ; }
@@ -7154,6 +7160,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, }else {i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (pctype), reg); } +i40e_global_cfg_warning (I40E_WARNING_HSYM ); } reg =i40e_read_rx_ctl (hw,I40E_GLQF_CTL );
@@ -7178,6 +7185,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);
@@ -7848,6 +7856,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
@@ -7913,6 +7925,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),
@@ -7921,6 +7934,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;
@@ -7999,6 +8013,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 +43 -0
55 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH v3 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 | 127 +++++++++++++++++++++++++---------------- drivers/net/i40e/i40e_ethdev.h | 8 +++ 2 files changed, 87 insertions(+), 48 deletions(-)
drivers/net/i40e/i40e_ethdev.c +79 -48
@@ -716,6 +716,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.pci_drv);RTE_PMD_REGISTER_PCI_TABLE (net_i40e, pci_id_i40e_map);
@@ -735,9 +744,9 @@ 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 (33 ),0x000000E0 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x000000E3 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x000000E6 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (33 ),0x000000E0 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (34 ),0x000000E3 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (35 ),0x000000E6 );i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD );/*
@@ -746,8 +755,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 ); }
@@ -2799,8 +2808,9 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, "I40E_GL_SWT_L2TAGCTRL[%d]", reg_id);return ret; } -PMD_DRV_LOG (DEBUG ,"Debug write 0x%08" PRIx64" to " -"I40E_GL_SWT_L2TAGCTRL[%d]" , reg_w, reg_id); +PMD_DRV_LOG (DEBUG , +"Global register 0x%08x is changed with value 0x%08x" , +I40E_GL_SWT_L2TAGCTRL (reg_id), (uint32_t )reg_w);i40e_global_cfg_warning (I40E_WARNING_TPID );
@@ -3030,16 +3040,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 );
@@ -6880,6 +6890,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 ;
@@ -7124,41 +7137,43 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, I40E_GLQF_HSYM_SYMH_ENA_MASK :0 ;if (hw->mac.type ==I40E_MAC_X722 ) {if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV4_UDP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV4_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP ), reg); }else if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV4_TCP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV4_TCP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK ), reg); }else if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV6_UDP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV6_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP ), reg); }else if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV6_TCP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV6_TCP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK ), reg); }else { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (pctype), - reg); +i40e_write_global_rx_ctl (hw, +I40E_GLQF_HSYM (pctype), + reg); } }else { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (pctype), reg); +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (pctype), + reg); }i40e_global_cfg_warning (I40E_WARNING_HSYM ); }
@@ -7184,7 +7199,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:
@@ -7799,6 +7814,18 @@ i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val) }static 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) {struct i40e_hw *hw =I40E_PF_TO_HW (pf);
@@ -7831,24 +7858,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);
@@ -7920,20 +7951,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);
@@ -8007,12 +8038,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);
drivers/net/i40e/i40e_ethdev.h +8 -0
@@ -103,6 +103,14 @@ (((vf)->version_major ==I40E_VIRTCHNL_VERSION_MAJOR ) && \ ((vf)->version_minor == 1)) +static inline void +I40E_WRITE_GLB_REG (struct i40e_hw *hw,uint32_t reg,uint32_t value) { +I40E_WRITE_REG (hw, reg, value); +PMD_DRV_LOG (DEBUG ,"Global register 0x%08x is modified " +"with value 0x%08x" , + reg, value); +} +/* index flex payload per layer */ enum i40e_flxpld_layer_idx {I40E_FLXPLD_L2_IDX =0 ,
Signature · 1 line
2.5.5
PATCH v3 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 | 215 ++++++++++++++++++++++++++++++++--------- drivers/net/i40e/i40e_ethdev.h | 2 + 2 files changed, 171 insertions(+), 46 deletions(-)
drivers/net/i40e/i40e_ethdev.c +169 -46
@@ -944,6 +944,67 @@ config_floating_veb(struct rte_eth_dev *dev)#define I40E_L2_TAGS_S_TAG_SHIFT 1#define I40E_L2_TAGS_S_TAG_MASK I40E_MASK(0x1, I40E_L2_TAGS_S_TAG_SHIFT) +#define ETH_I40E_SUPPORT_MULTI_DRIVER "support-multi-driver" +RTE_PMD_REGISTER_PARAM_STRING (net_i40e, +ETH_I40E_SUPPORT_MULTI_DRIVER "=0|1" ); + +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); +struct rte_pci_device *pci_dev = dev->pci_dev; +static const char *valid_keys[] = { +ETH_I40E_SUPPORT_MULTI_DRIVER ,NULL }; +struct rte_kvargs *kvlist; + +/* Enable global configuration by default */ + pf->support_multi_driver = false; + +if (!pci_dev->device.devargs) +return 0 ; + + kvlist =rte_kvargs_parse (pci_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) {
@@ -993,6 +1054,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);
@@ -1019,7 +1083,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)* 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);
@@ -1115,11 +1180,14 @@ 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 */
@@ -2754,11 +2822,17 @@ 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);uint64_t reg_r =0 , reg_w =0 ;uint16_t reg_id =0 ;int ret =0 ;int qinq = dev->data->dev_conf.rxmode.hw_vlan_extend; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Setting TPID is not supported." ); +return -ENOTSUP ; + } +switch (vlan_type) {case ETH_VLAN_TYPE_OUTER :if (qinq)
@@ -3039,20 +3113,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);
@@ -6870,9 +6949,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\n" , val);
@@ -7114,12 +7199,18 @@ static int i40e_set_hash_filter_global_config(struct i40e_hw *hw, struct rte_eth_hash_global_conf *g_cfg) { + struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;int ret;uint16_t i;uint32_t reg;uint32_t mask0 = g_cfg->valid_bit_mask[0 ];enum i40e_filter_pctype pctype; +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 (g_cfg);if (ret <0 )
@@ -7850,6 +7941,12 @@ 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);
@@ -7858,39 +7955,49 @@ 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 ); +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
@@ -7903,6 +8010,11 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,uint32_t mask_reg[I40E_INSET_MASK_NUM_REG ] = {0 };int ret, i, num; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Hash input set setting is not supported." ); +return -ENOTSUP ; + } +if (!conf) {PMD_DRV_LOG (ERR ,"Invalid pointer" );return -EFAULT ;
@@ -8029,6 +8141,11 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,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); i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
@@ -8037,14 +8154,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;
drivers/net/i40e/i40e_ethdev.h +2 -0
@@ -485,6 +485,8 @@ struct i40e_pf {bool floating_veb;/* The flag to use the floating VEB */ /* The floating enable flag for the specific VF */ bool floating_veb_list[I40E_MAX_VF ]; + +bool support_multi_driver;/* 1 - support multiple driver */ };enum pending_msg {
Signature · 1 line
2.5.5
PATCH v3 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 | 93 +++++++++++++++++++++++++-------------- drivers/net/i40e/i40e_ethdev.h | 10 +++-- drivers/net/i40e/i40e_ethdev_vf.c | 4 +- 3 files changed, 68 insertions(+), 39 deletions(-)
drivers/net/i40e/i40e_ethdev.c +59 -34
@@ -760,6 +760,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/*
@@ -1077,6 +1094,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)return ret; } +i40e_config_automask (pf); +/* * To work around the NVM issue, initialize registers * for flexible payload and packet type of QinQ by
@@ -1463,6 +1482,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++) {
@@ -1481,7 +1501,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 ); +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL , + pf->support_multi_driver);if (msix_vect ==I40E_MISC_VEC_ID ) { I40E_WRITE_REG(hw, I40E_PFINT_LNKLST0,
@@ -1539,7 +1560,6 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi)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++) {
@@ -1547,13 +1567,6 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi)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,
@@ -1606,27 +1619,22 @@ i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi)struct rte_eth_dev *dev = vsi->adapter->eth_dev;struct rte_intr_handle *intr_handle = &dev->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 ); +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_INTENA_MASK | +I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | +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); }
@@ -1637,16 +1645,18 @@ i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi)struct rte_eth_dev *dev = vsi->adapter->eth_dev;struct rte_intr_handle *intr_handle = &dev->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); }
@@ -4618,16 +4628,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 ) {
@@ -5540,7 +5562,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); }
@@ -9861,10 +9884,12 @@ 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_intr_handle *intr_handle = &dev->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 ); +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL , + pf->support_multi_driver);uint16_t msix_intr; msix_intr = intr_handle->intr_vec[queue_id];
drivers/net/i40e/i40e_ethdev.h +7 -3
@@ -720,10 +720,14 @@ i40e_align_floor(int n) }static inline uint16_t -i40e_calc_itr_interval (int16_t interval) +i40e_calc_itr_interval (int16_t interval,bool is_multi_drv) { -if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) - interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; +if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) { +if (is_multi_drv) + interval =I40E_QUEUE_ITR_INTERVAL_MAX ; +else + interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; + }/* Convert to hardware count, as writing each 1 represents 2 us */ return interval /2 ;
drivers/net/i40e/i40e_ethdev_vf.c +2 -2
@@ -1246,7 +1246,7 @@ i40evf_init_vf(struct rte_eth_dev *dev)struct i40e_vf *vf =I40EVF_DEV_PRIVATE_TO_VF (dev->data->dev_private);struct ether_addr *p_mac_addr;uint16_t interval = -i40e_calc_itr_interval (I40E_QUEUE_ITR_INTERVAL_MAX ); +i40e_calc_itr_interval (I40E_QUEUE_ITR_INTERVAL_MAX ,0 ); vf->adapter =I40E_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); vf->dev_data = dev->data;
@@ -1986,7 +1986,7 @@ i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)struct rte_intr_handle *intr_handle = &dev->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 ); +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,0 );uint16_t msix_intr; msix_intr = intr_handle->intr_vec[queue_id];
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 logs for global configuration and adds device args to disable global configuration and change interrupt for PF.
This patchset is based on 16.11.4 LTS. Commit id: 516447a5056c093e4d020011a69216b453576782
v4 changes:
- Add doc for new parameter.
- Fix logical error.
v3 changes:
- Fix interrupt conflict when using multiple driver.
v2 changes:
- Add warning logs and debug logs.
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 | 27 +++ drivers/net/i40e/i40e_ethdev.c | 412 ++++++++++++++++++++++++++++---------- drivers/net/i40e/i40e_ethdev.h | 63 +++++- drivers/net/i40e/i40e_ethdev_vf.c | 4 +- 4 files changed, 392 insertions(+), 114 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 | 15 +++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 43 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+)
doc/guides/nics/i40e.rst +12 -0
@@ -459,3 +459,15 @@ Receive packets with Ethertype 0x88A8 Due to the FW limitation, PF can receive packets with Ethertype 0x88A8 only when floating VEB is disabled. + +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.
drivers/net/i40e/i40e_ethdev.c +15 -0
@@ -738,6 +738,7 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)I40E_WRITE_REG (hw,I40E_GLQF_ORT (33 ),0x000000E0 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x000000E3 );I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x000000E6 ); +i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD );/* * Initialize registers for parsing packet type of QinQ
@@ -747,6 +748,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
@@ -2800,6 +2802,8 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,PMD_DRV_LOG (DEBUG ,"Debug write 0x%08" PRIx64" to " "I40E_GL_SWT_L2TAGCTRL[%d]" , reg_w, reg_id); +i40e_global_cfg_warning (I40E_WARNING_TPID ); +return ret; }
@@ -3038,6 +3042,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);
@@ -6875,6 +6880,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 ; }
@@ -7154,6 +7160,7 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, }else {i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (pctype), reg); } +i40e_global_cfg_warning (I40E_WARNING_HSYM ); } reg =i40e_read_rx_ctl (hw,I40E_GLQF_CTL );
@@ -7178,6 +7185,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);
@@ -7848,6 +7856,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
@@ -7913,6 +7925,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),
@@ -7921,6 +7934,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;
@@ -7999,6 +8013,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 +43 -0
55 lines not on this page · raw message
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 | 127 +++++++++++++++++++++++++---------------- drivers/net/i40e/i40e_ethdev.h | 8 +++ 2 files changed, 87 insertions(+), 48 deletions(-)
drivers/net/i40e/i40e_ethdev.c +79 -48
@@ -716,6 +716,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.pci_drv);RTE_PMD_REGISTER_PCI_TABLE (net_i40e, pci_id_i40e_map);
@@ -735,9 +744,9 @@ 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 (33 ),0x000000E0 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (34 ),0x000000E3 ); -I40E_WRITE_REG (hw,I40E_GLQF_ORT (35 ),0x000000E6 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (33 ),0x000000E0 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (34 ),0x000000E3 ); +I40E_WRITE_GLB_REG (hw,I40E_GLQF_ORT (35 ),0x000000E6 );i40e_global_cfg_warning (I40E_WARNING_ENA_FLX_PLD );/*
@@ -746,8 +755,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 ); }
@@ -2799,8 +2808,9 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, "I40E_GL_SWT_L2TAGCTRL[%d]", reg_id);return ret; } -PMD_DRV_LOG (DEBUG ,"Debug write 0x%08" PRIx64" to " -"I40E_GL_SWT_L2TAGCTRL[%d]" , reg_w, reg_id); +PMD_DRV_LOG (DEBUG , +"Global register 0x%08x is changed with value 0x%08x" , +I40E_GL_SWT_L2TAGCTRL (reg_id), (uint32_t )reg_w);i40e_global_cfg_warning (I40E_WARNING_TPID );
@@ -3030,16 +3040,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 );
@@ -6880,6 +6890,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 ;
@@ -7124,41 +7137,43 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw, I40E_GLQF_HSYM_SYMH_ENA_MASK :0 ;if (hw->mac.type ==I40E_MAC_X722 ) {if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV4_UDP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV4_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP ), reg); }else if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV4_TCP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV4_TCP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK ), reg); }else if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV6_UDP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV6_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP ), reg); }else if (pctype ==I40E_FILTER_PCTYPE_NONF_IPV6_TCP ) { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV6_TCP ), reg); -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM ( +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK ), reg); }else { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (pctype), - reg); +i40e_write_global_rx_ctl (hw, +I40E_GLQF_HSYM (pctype), + reg); } }else { -i40e_write_rx_ctl (hw,I40E_GLQF_HSYM (pctype), reg); +i40e_write_global_rx_ctl (hw,I40E_GLQF_HSYM (pctype), + reg); }i40e_global_cfg_warning (I40E_WARNING_HSYM ); }
@@ -7184,7 +7199,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:
@@ -7799,6 +7814,18 @@ i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val) }static 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) {struct i40e_hw *hw =I40E_PF_TO_HW (pf);
@@ -7831,24 +7858,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);
@@ -7920,20 +7951,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);
@@ -8007,12 +8038,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);
drivers/net/i40e/i40e_ethdev.h +8 -0
@@ -103,6 +103,14 @@ (((vf)->version_major ==I40E_VIRTCHNL_VERSION_MAJOR ) && \ ((vf)->version_minor == 1)) +static inline void +I40E_WRITE_GLB_REG (struct i40e_hw *hw,uint32_t reg,uint32_t value) { +I40E_WRITE_REG (hw, reg, value); +PMD_DRV_LOG (DEBUG ,"Global register 0x%08x is modified " +"with value 0x%08x" , + reg, value); +} +/* index flex payload per layer */ enum i40e_flxpld_layer_idx {I40E_FLXPLD_L2_IDX =0 ,
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 | 215 ++++++++++++++++++++++++++++++++--------- drivers/net/i40e/i40e_ethdev.h | 2 + 2 files changed, 171 insertions(+), 46 deletions(-)
drivers/net/i40e/i40e_ethdev.c +169 -46
@@ -944,6 +944,67 @@ config_floating_veb(struct rte_eth_dev *dev)#define I40E_L2_TAGS_S_TAG_SHIFT 1#define I40E_L2_TAGS_S_TAG_MASK I40E_MASK(0x1, I40E_L2_TAGS_S_TAG_SHIFT) +#define ETH_I40E_SUPPORT_MULTI_DRIVER "support-multi-driver" +RTE_PMD_REGISTER_PARAM_STRING (net_i40e, +ETH_I40E_SUPPORT_MULTI_DRIVER "=0|1" ); + +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); +struct rte_pci_device *pci_dev = dev->pci_dev; +static const char *valid_keys[] = { +ETH_I40E_SUPPORT_MULTI_DRIVER ,NULL }; +struct rte_kvargs *kvlist; + +/* Enable global configuration by default */ + pf->support_multi_driver = false; + +if (!pci_dev->device.devargs) +return 0 ; + + kvlist =rte_kvargs_parse (pci_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) {
@@ -993,6 +1054,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);
@@ -1019,7 +1083,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)* 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);
@@ -1115,11 +1180,14 @@ 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 */
@@ -2754,11 +2822,17 @@ 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);uint64_t reg_r =0 , reg_w =0 ;uint16_t reg_id =0 ;int ret =0 ;int qinq = dev->data->dev_conf.rxmode.hw_vlan_extend; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Setting TPID is not supported." ); +return -ENOTSUP ; + } +switch (vlan_type) {case ETH_VLAN_TYPE_OUTER :if (qinq)
@@ -3039,20 +3113,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);
@@ -6870,9 +6949,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\n" , val);
@@ -7114,12 +7199,18 @@ static int i40e_set_hash_filter_global_config(struct i40e_hw *hw, struct rte_eth_hash_global_conf *g_cfg) { + struct i40e_pf *pf = &((struct i40e_adapter *)hw->back)->pf;int ret;uint16_t i;uint32_t reg;uint32_t mask0 = g_cfg->valid_bit_mask[0 ];enum i40e_filter_pctype pctype; +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 (g_cfg);if (ret <0 )
@@ -7850,6 +7941,12 @@ 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);
@@ -7858,39 +7955,49 @@ 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 ); +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
@@ -7903,6 +8010,11 @@ i40e_hash_filter_inset_select(struct i40e_hw *hw,uint32_t mask_reg[I40E_INSET_MASK_NUM_REG ] = {0 };int ret, i, num; +if (pf->support_multi_driver) { +PMD_DRV_LOG (ERR ,"Hash input set setting is not supported." ); +return -ENOTSUP ; + } +if (!conf) {PMD_DRV_LOG (ERR ,"Invalid pointer" );return -EFAULT ;
@@ -8029,6 +8141,11 @@ i40e_fdir_filter_inset_select(struct i40e_pf *pf,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); i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
@@ -8037,14 +8154,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;
drivers/net/i40e/i40e_ethdev.h +2 -0
@@ -485,6 +485,8 @@ struct i40e_pf {bool floating_veb;/* The flag to use the floating VEB */ /* The floating enable flag for the specific VF */ bool floating_veb_list[I40E_MAX_VF ]; + +bool support_multi_driver;/* 1 - support multiple driver */ };enum pending_msg {
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.
--- doc/guides/nics/i40e.rst | 15 +++++++ drivers/net/i40e/i40e_ethdev.c | 93 +++++++++++++++++++++++++-------------- drivers/net/i40e/i40e_ethdev.h | 10 +++-- drivers/net/i40e/i40e_ethdev_vf.c | 4 +- 4 files changed, 83 insertions(+), 39 deletions(-)
doc/guides/nics/i40e.rst +15 -0
@@ -130,6 +130,21 @@ Please note that enabling debugging options may affect system performance. Interrupt Throttling interval. +Runtime Config Options +~~~~~~~~~~~~~~~~~~~~~~ + +- ``Support multiple driver`` (default ``disable``) + + There was a multiple driver support issue during use of 700 series Ethernet + Adapter with both Linux kernel and DPDK PMD. To fix this issue, ``devargs`` + parameter ``support-multi-driver`` is introduced, for example:: + + -w 84:00.0,support-multi-driver=1 + + With the above configuration, DPDK PMD will not change global registers, and + will switch PF interrupt from IntN to Int0 to avoid interrupt conflict between + DPDK and Linux Kernel. + Driver Compilation ~~~~~~~~~~~~~~~~~~
drivers/net/i40e/i40e_ethdev.c +59 -34
180 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.h +7 -3
@@ -720,10 +720,14 @@ i40e_align_floor(int n) }static inline uint16_t -i40e_calc_itr_interval (int16_t interval) +i40e_calc_itr_interval (int16_t interval,bool is_multi_drv) { -if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) - interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; +if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) { +if (is_multi_drv) + interval =I40E_QUEUE_ITR_INTERVAL_MAX ; +else + interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; + }/* Convert to hardware count, as writing each 1 represents 2 us */ return interval /2 ;
drivers/net/i40e/i40e_ethdev_vf.c +2 -2
@@ -1246,7 +1246,7 @@ i40evf_init_vf(struct rte_eth_dev *dev)struct i40e_vf *vf =I40EVF_DEV_PRIVATE_TO_VF (dev->data->dev_private);struct ether_addr *p_mac_addr;uint16_t interval = -i40e_calc_itr_interval (I40E_QUEUE_ITR_INTERVAL_MAX ); +i40e_calc_itr_interval (I40E_QUEUE_ITR_INTERVAL_MAX ,0 ); vf->adapter =I40E_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private); vf->dev_data = dev->data;
@@ -1986,7 +1986,7 @@ i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)struct rte_intr_handle *intr_handle = &dev->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 ); +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ,0 );uint16_t msix_intr; msix_intr = intr_handle->intr_vec[queue_id];
Signature · 1 line
2.5.5