[dpdk-dev] [PATCH] net/ixgbe: fixed port can not link up in FreeBSD
In FreeBSD environment, nic_uio drivers do not support interrupts, rte_intr_callback_register() will fail to register interrupts. We can not make link status to change from down to up by interrupt callback. So we need to wait for the controller to acquire link when ports start. Through multiple tests, 5s should be enough. Fixes: b9bd0f09fa15 ("ethdev: fix link status query") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- drivers/net/ixgbe/ixgbe_ethdev.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 2c6fd0f13..e33b5483c 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2555,6 +2555,9 @@ ixgbe_dev_start(struct rte_eth_dev *dev) IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private); struct ixgbe_macsec_setting *macsec_setting = IXGBE_DEV_PRIVATE_TO_MACSEC_SETTING(dev->data->dev_private); +#ifdef RTE_EXEC_ENV_FREEBSD + int i; +#endif PMD_INIT_FUNC_TRACE(); @@ -2801,6 +2804,25 @@ ixgbe_dev_start(struct rte_eth_dev *dev) "please call hierarchy_commit() " "before starting the port"); +#ifdef RTE_EXEC_ENV_FREEBSD + /* +* In freebsd environment, nic_uio drivers do not support interrupts, +* rte_intr_callback_register() will fail to register interrupts. +* We can not make link status to change from down to up by interrupt +* callback. So we need to wait for the controller to acquire link +* when ports start. +*/ + for (i = 0; i < 25; i++) { + /* If link up, just jump out */ + err = ixgbe_check_link(hw, &speed, &link_up, 0); + if (err) + goto error; + if (link_up) + break; + msec_delay(200); + } +#endif + /* * Update link status right before return, because it may * start link configuration process in a separate thread. -- 2.17.1
[dpdk-dev] [PATCH v2] net/ixgbe: fixed port can not link up in FreeBSD
In FreeBSD environment, nic_uio drivers do not support interrupts, rte_intr_callback_register() will fail to register interrupts. We can not make link status to change from down to up by interrupt callback. So we need to wait for the controller to acquire link when ports start. Through multiple tests, 5s should be enough. Fixes: b9bd0f09fa15 ("ethdev: fix link status query") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- v2 changes: * Put waiting into a separate function to keep start() code clean. --- drivers/net/ixgbe/ixgbe_ethdev.c | 32 drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++ 2 files changed, 35 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 2c6fd0f13..fba666186 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2801,6 +2801,13 @@ ixgbe_dev_start(struct rte_eth_dev *dev) "please call hierarchy_commit() " "before starting the port"); +#ifdef RTE_EXEC_ENV_FREEBSD + /* wait for the controller to acquire link */ + err = ixgbe_wait_for_link_up(hw); + if (err) + goto error; +#endif + /* * Update link status right before return, because it may * start link configuration process in a separate thread. @@ -4114,6 +4121,31 @@ ixgbe_dev_setup_link_alarm_handler(void *param) intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; } +#ifdef RTE_EXEC_ENV_FREEBSD +/* + * In freebsd environment, nic_uio drivers do not support interrupts, + * rte_intr_callback_register() will fail to register interrupts. + * We can not make link status to change from down to up by interrupt + * callback. So we need to wait for the controller to acquire link + * when ports start. + * It returns 0 on link up. + */ +int32_t ixgbe_wait_for_link_up(struct ixgbe_hw *hw) +{ + int err, i, link_up = 0; + uint32_t speed = 0; + for (i = 0; i < 25; i++) { + err = ixgbe_check_link(hw, &speed, &link_up, 0); + if (err) + return err; + if (link_up) + return 0; + msec_delay(200); + } + return 0; +} +#endif + /* return 0 means link status changed, -1 means not changed */ int ixgbe_dev_link_update_share(struct rte_eth_dev *dev, diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 76a1b9d18..9a1d8c54c 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -700,6 +700,9 @@ int ixgbe_dev_link_update_share(struct rte_eth_dev *dev, int wait_to_complete, int vf); +#ifdef RTE_EXEC_ENV_FREEBSD +int32_t ixgbe_wait_for_link_up(struct ixgbe_hw *hw); +#endif /* * misc function prototypes */ -- 2.17.1
[dpdk-dev] [PATCH v3] net/ixgbe: fix port can not link up in FreeBSD
In FreeBSD environment, nic_uio drivers do not support interrupts, rte_intr_callback_register() will fail to register interrupts. We can not make link status to change from down to up by interrupt callback. So we need to wait for the controller to acquire link when ports start. Through multiple tests, 5s should be enough. Fixes: b9bd0f09fa15 ("ethdev: fix link status query") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- v3 changes: * Hide ifdef inside the function v2 changes: * Put waiting into a separate function to keep start() code clean. --- drivers/net/ixgbe/ixgbe_ethdev.c | 36 1 file changed, 36 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 2c6fd0f13..d9b0c5b02 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -378,6 +378,7 @@ static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *udp_tunnel); static int ixgbe_filter_restore(struct rte_eth_dev *dev); static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev); +static int ixgbe_wait_for_link_up(struct ixgbe_hw *hw); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -2801,6 +2802,11 @@ ixgbe_dev_start(struct rte_eth_dev *dev) "please call hierarchy_commit() " "before starting the port"); + /* wait for the controller to acquire link */ + err = ixgbe_wait_for_link_up(hw); + if (err) + goto error; + /* * Update link status right before return, because it may * start link configuration process in a separate thread. @@ -4114,6 +4120,36 @@ ixgbe_dev_setup_link_alarm_handler(void *param) intr->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; } +/* + * In freebsd environment, nic_uio drivers do not support interrupts, + * rte_intr_callback_register() will fail to register interrupts. + * We can not make link status to change from down to up by interrupt + * callback. So we need to wait for the controller to acquire link + * when ports start. + * It returns 0 on link up. + */ +static int +ixgbe_wait_for_link_up(struct ixgbe_hw *hw) +{ +#ifdef RTE_EXEC_ENV_FREEBSD + const int nb_iter = 25; +#else + const int nb_iter = 0; +#endif + int err, i, link_up = 0; + uint32_t speed = 0; + + for (i = 0; i < nb_iter; i++) { + err = ixgbe_check_link(hw, &speed, &link_up, 0); + if (err) + return err; + if (link_up) + return 0; + msec_delay(200); + } + return 0; +} + /* return 0 means link status changed, -1 means not changed */ int ixgbe_dev_link_update_share(struct rte_eth_dev *dev, -- 2.17.1
[dpdk-dev] [PATCH] net/ixgbe: fix ixgbevf link status
The link status for ixgbevf is not correct when PF link up. IXGBE_ESDP register is only used when media type is fiber. Fixes: 1ca05831b9be ("net/ixgbe: fix link status") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- drivers/net/ixgbe/ixgbe_ethdev.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 2c6fd0f13..a3f550c53 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -4155,9 +4155,11 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev, return rte_eth_linkstatus_set(dev, &link); } - esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); - if ((esdp_reg & IXGBE_ESDP_SDP3)) - link_up = 0; + if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) { + esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); + if ((esdp_reg & IXGBE_ESDP_SDP3)) + link_up = 0; + } if (link_up == 0) { if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) { -- 2.17.1
[dpdk-dev] [PATCH] net/i40e: add warning log for VF multi-queue Rx interrupt
Count of queues per port is over the max usable vector, it will cause missing packets. This patch is in order to add suggestive logs. Signed-off-by: Lunyuan Cui --- drivers/net/i40e/i40e_ethdev_vf.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 479f8282c..68a0cb8fa 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -682,8 +682,12 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) intr_handle->intr_vec[i] = vector_id; if (vector_id > I40E_MISC_VEC_ID) vector_id++; - if (vector_id > nb_msix) + if (vector_id >= nb_msix) { + PMD_DRV_LOG(WARNING, "Count of queues per port is " + "over the max usable vector(%d), it will " + "cause missing packets.", nb_msix - 1); vector_id = I40E_RX_VEC_START; + } } args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP; -- 2.17.1
[dpdk-dev] [PATCH] net/i40e: fixed multi-queue Rx interrupt for VF
The value of vectors bound to each queue could not large than the max usable vector. It will let devices start failed. This patch fixed this issue. Fixes: 5b8d2d89dd99 (net/i40e: enable multi-queue Rx interrupt for VF) Signed-off-by: Lunyuan Cui --- drivers/net/i40e/i40e_ethdev_vf.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 479f8282c..d514e8991 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -657,7 +657,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; uint32_t vector_id; int i, err; - uint16_t nb_msix; if (dev->data->dev_conf.intr_conf.rxq != 0 && rte_intr_allow_others(intr_handle)) @@ -665,9 +664,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) else vector_id = I40E_MISC_VEC_ID; - nb_msix = RTE_MIN(vf->vf_res->max_vectors, - intr_handle->nb_efd); - map_info = (struct virtchnl_irq_map_info *)cmd_buffer; map_info->num_vectors = dev->data->nb_rx_queues; for (i = 0; i < dev->data->nb_rx_queues; i++) { @@ -682,7 +678,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) intr_handle->intr_vec[i] = vector_id; if (vector_id > I40E_MISC_VEC_ID) vector_id++; - if (vector_id > nb_msix) + if (vector_id >= vf->vf_res->max_vectors) vector_id = I40E_RX_VEC_START; } -- 2.17.1
[dpdk-dev] [PATCH v2] net/i40e: fixed multi-queue Rx interrupt for VF
The value of vectors bound to each queue could not large than the max usable vector. It will let devices start failed. vf->vf_res->max_vectors is equal to the max vector number. intr_handle->nb_efd is equal to queue number. Whichever one is less, it is no need to check intr_handle->nb_efd when we keep vector value less than vector number. This patch fixed this issue. Signed-off-by: Lunyuan Cui --- v2: - Change commit message --- drivers/net/i40e/i40e_ethdev_vf.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 479f8282c..d514e8991 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -657,7 +657,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; uint32_t vector_id; int i, err; - uint16_t nb_msix; if (dev->data->dev_conf.intr_conf.rxq != 0 && rte_intr_allow_others(intr_handle)) @@ -665,9 +664,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) else vector_id = I40E_MISC_VEC_ID; - nb_msix = RTE_MIN(vf->vf_res->max_vectors, - intr_handle->nb_efd); - map_info = (struct virtchnl_irq_map_info *)cmd_buffer; map_info->num_vectors = dev->data->nb_rx_queues; for (i = 0; i < dev->data->nb_rx_queues; i++) { @@ -682,7 +678,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) intr_handle->intr_vec[i] = vector_id; if (vector_id > I40E_MISC_VEC_ID) vector_id++; - if (vector_id > nb_msix) + if (vector_id >= vf->vf_res->max_vectors) vector_id = I40E_RX_VEC_START; } -- 2.17.1
[dpdk-dev] [PATCH v3] net/i40e: fix multi-queue Rx interrupt for VF
The vector id bound to each queue could not large than the max usable vector. It will cause port start failed. This patch fixed this issue. And in this patch I changed judgement condition for the limit of vector id. vf->vf_res->max_vectors represents the number of usable vectors. It can effectively prevent vector id out of range. Fixes: 5b8d2d89dd99 (net/i40e: enable multi-queue Rx interrupt for VF) Signed-off-by: Lunyuan Cui --- v3: - Change commit message v2: - Change commit message --- drivers/net/i40e/i40e_ethdev_vf.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 479f8282c..d514e8991 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -657,7 +657,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; uint32_t vector_id; int i, err; - uint16_t nb_msix; if (dev->data->dev_conf.intr_conf.rxq != 0 && rte_intr_allow_others(intr_handle)) @@ -665,9 +664,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) else vector_id = I40E_MISC_VEC_ID; - nb_msix = RTE_MIN(vf->vf_res->max_vectors, - intr_handle->nb_efd); - map_info = (struct virtchnl_irq_map_info *)cmd_buffer; map_info->num_vectors = dev->data->nb_rx_queues; for (i = 0; i < dev->data->nb_rx_queues; i++) { @@ -682,7 +678,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) intr_handle->intr_vec[i] = vector_id; if (vector_id > I40E_MISC_VEC_ID) vector_id++; - if (vector_id > nb_msix) + if (vector_id >= vf->vf_res->max_vectors) vector_id = I40E_RX_VEC_START; } -- 2.17.1
[dpdk-dev] [PATCH v4] net/i40e: fix multi-queue Rx interrupt for VF
The interrupt vector which bind to queues should not larger than the max avaiable vertor. It will cause port start failed. This patch changed the judgement condition of the limited vector id. It can effectively avoid vector id out of range. Fixes: 5b8d2d89dd99 (net/i40e: enable multi-queue Rx interrupt for VF) Signed-off-by: Lunyuan Cui --- v4: - Change commit message v3: - Change commit message v2: - Change commit message --- drivers/net/i40e/i40e_ethdev_vf.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 479f8282c..d514e8991 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -657,7 +657,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; uint32_t vector_id; int i, err; - uint16_t nb_msix; if (dev->data->dev_conf.intr_conf.rxq != 0 && rte_intr_allow_others(intr_handle)) @@ -665,9 +664,6 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) else vector_id = I40E_MISC_VEC_ID; - nb_msix = RTE_MIN(vf->vf_res->max_vectors, - intr_handle->nb_efd); - map_info = (struct virtchnl_irq_map_info *)cmd_buffer; map_info->num_vectors = dev->data->nb_rx_queues; for (i = 0; i < dev->data->nb_rx_queues; i++) { @@ -682,7 +678,7 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) intr_handle->intr_vec[i] = vector_id; if (vector_id > I40E_MISC_VEC_ID) vector_id++; - if (vector_id > nb_msix) + if (vector_id >= vf->vf_res->max_vectors) vector_id = I40E_RX_VEC_START; } -- 2.17.1
[dpdk-dev] [PATCH v3] net/i40e: enable MAC address as FDIR input set
FVL enable src MAC address and dst MAC address as FDIR's input set for ipv4-other. When OVS-DPDK is working as a pure L2 switch, enable MAC address as FDIR input set with Mark+RSS action would help the performance speed up. And FVL FDIR supports to change input set with MAC address. Signed-off-by: Lunyuan Cui --- v3: - Enable MAC address as FDIR's input set v2: - Enable src MAC address as FDIR's input set --- doc/guides/rel_notes/release_20_05.rst | 6 +++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev.h | 9 +++- drivers/net/i40e/i40e_fdir.c | 6 +++ drivers/net/i40e/i40e_flow.c | 65 +++--- 5 files changed, 68 insertions(+), 19 deletions(-) diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 000bbf501..7139288d6 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -62,6 +62,12 @@ New Features * Added support for matching on IPv4 Time To Live and IPv6 Hop Limit. +* **Updated Intel i40e driver.** + + Updated i40e PMD with new features and improvements, including: + + * enable MAC address as FDIR input set for ipv4-other. + Removed Items - diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 9539b0470..041627ef5 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -9373,6 +9373,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_SCTP_VT, [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index aac89de91..dbb5d594a 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -544,12 +544,19 @@ struct i40e_ipv6_l2tpv3oip_flow { uint32_t session_id; /* Session ID in big endian. */ }; +/* A structure used to define the input for l2 dst type flow */ +struct i40e_l2_flow { + struct rte_ether_addr dst; + struct rte_ether_addr src; + uint16_t ether_type; /**< Ether type in big endian */ +}; + /* * A union contains the inputs for all types of flow * items in flows need to be in big endian */ union i40e_fdir_flow { - struct rte_eth_l2_flow l2_flow; + struct i40e_l2_flow l2_flow; struct rte_eth_udpv4_flow udp4_flow; struct rte_eth_tcpv4_flow tcp4_flow; struct rte_eth_sctpv4_flow sctp4_flow; diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 931f25976..2f24615b6 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1062,7 +1062,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; + rte_memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst, + sizeof(struct rte_ether_addr)); + rte_memcpy(raw_pkt + sizeof(struct rte_ether_addr), + &fdir_input->flow.l2_flow.src, + sizeof(struct rte_ether_addr)); raw_pkt += 2 * sizeof(struct rte_ether_addr); + if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index d877ac250..65922b39c 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2626,8 +2626,24 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, } if (eth_spec && eth_mask) { - if (!rte_is_zero_ether_addr(ð_mask->src) || - !rte_is_zero_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst) && + rte_is_zero_ether_addr(ð_mask->src)) { + filter->input.flow.l2_flow.dst = + eth_spec->dst; + input_set |= I40E_INSET_DMAC; + } else if (rte_is_zero_ether_addr(ð_mask->dst) && + rte_is_broadcast_ether_addr(ð_mask->src)) { + filter->input.flow.l2_flow.src = + eth_spec->src; + input_set |= I40
[dpdk-dev] [PATCH v2] net/iavf: enable port reset
This patch is intended to add iavf_dev_reset ops, enable iavf to support "port reset all". Signed-off-by: Lunyuan Cui Acked-by: Jingjing Wu --- drivers/net/iavf/iavf_ethdev.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 7a8bec9c9..382530a43 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -32,6 +32,7 @@ static int iavf_dev_configure(struct rte_eth_dev *dev); static int iavf_dev_start(struct rte_eth_dev *dev); static void iavf_dev_stop(struct rte_eth_dev *dev); static void iavf_dev_close(struct rte_eth_dev *dev); +static int iavf_dev_reset(struct rte_eth_dev *dev); static int iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev); @@ -91,6 +92,7 @@ static const struct eth_dev_ops iavf_eth_dev_ops = { .dev_start = iavf_dev_start, .dev_stop = iavf_dev_stop, .dev_close = iavf_dev_close, + .dev_reset = iavf_dev_reset, .dev_infos_get = iavf_dev_info_get, .dev_supported_ptypes_get = iavf_dev_supported_ptypes_get, .link_update= iavf_dev_link_update, @@ -1419,6 +1421,21 @@ iavf_dev_uninit(struct rte_eth_dev *dev) return 0; } +/* + * Reset VF device only to re-initialize resources in PMD layer + */ +static int +iavf_dev_reset(struct rte_eth_dev *dev) +{ + int ret; + + ret = iavf_dev_uninit(dev); + if (ret) + return ret; + + return iavf_dev_init(dev); +} + static int iavf_dcf_cap_check_handler(__rte_unused const char *key, const char *value, __rte_unused void *opaque) -- 2.17.1
[dpdk-dev] [PATCH v4] net/i40e: enable MAC address as FDIR input set
FVL enable src MAC address and dst MAC address as FDIR's input set for ipv4-other, ipv4-udp and ipv4-tcp. When OVS-DPDK is working as a pure L2 switch, enable MAC address as FDIR input set with Mark+RSS action would help the performance speed up. And FVL FDIR supports to change input set with MAC address. Signed-off-by: Lunyuan Cui --- v4: - Enable MAC address as FDIR's input set for ipv4-udp and ipv4-tcp v3: - Enable MAC address as FDIR's input set v2: - Enable src MAC address as FDIR's input set --- doc/guides/rel_notes/release_20_05.rst | 6 ++ drivers/net/i40e/i40e_ethdev.c | 3 + drivers/net/i40e/i40e_ethdev.h | 9 +- drivers/net/i40e/i40e_fdir.c | 6 ++ drivers/net/i40e/i40e_flow.c | 131 + 5 files changed, 114 insertions(+), 41 deletions(-) diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 000bbf501..9e55955c4 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -62,6 +62,12 @@ New Features * Added support for matching on IPv4 Time To Live and IPv6 Hop Limit. +* **Updated Intel i40e driver.** + + Updated i40e PMD with new features and improvements, including: + + * enable MAC address as FDIR input set for ipv4-other, ipv4-udp and ipv4-tcp. + Removed Items - diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 9539b0470..530908b0e 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -9342,6 +9342,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | I40E_INSET_IPV4_TTL, [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | @@ -9357,6 +9358,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT, [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | @@ -9373,6 +9375,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_SCTP_VT, [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index aac89de91..dbb5d594a 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -544,12 +544,19 @@ struct i40e_ipv6_l2tpv3oip_flow { uint32_t session_id; /* Session ID in big endian. */ }; +/* A structure used to define the input for l2 dst type flow */ +struct i40e_l2_flow { + struct rte_ether_addr dst; + struct rte_ether_addr src; + uint16_t ether_type; /**< Ether type in big endian */ +}; + /* * A union contains the inputs for all types of flow * items in flows need to be in big endian */ union i40e_fdir_flow { - struct rte_eth_l2_flow l2_flow; + struct i40e_l2_flow l2_flow; struct rte_eth_udpv4_flow udp4_flow; struct rte_eth_tcpv4_flow tcp4_flow; struct rte_eth_sctpv4_flow sctp4_flow; diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 931f25976..2f24615b6 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1062,7 +1062,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; + rte_memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst, + sizeof(struct rte_ether_addr)); + rte_memcpy(raw_pkt + sizeof(struct rte_ether_addr), + &fdir_input->flow.l2_flow.src, + sizeof(struct rte_ether_addr)); raw_pkt += 2 * sizeof(struct rte_ether_addr); + if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index d877ac250..42324b208 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2626,8 +2626,24 @@ i40e
[dpdk-dev] [PATCH v5] net/i40e: enable MAC address as FDIR input set
FVL enable src MAC address and dst MAC address as FDIR's input set for ipv4-other, ipv4-udp and ipv4-tcp. When OVS-DPDK is working as a pure L2 switch, enable MAC address as FDIR input set with Mark+RSS action would help the performance speed up. And FVL FDIR supports to change input set with MAC address. Signed-off-by: Lunyuan Cui --- v5: - Change error info v4: - Enable MAC address as FDIR's input set for ipv4-udp and ipv4-tcp v3: - Enable MAC address as FDIR's input set v2: - Enable src MAC address as FDIR's input set --- doc/guides/rel_notes/release_20_05.rst | 6 ++ drivers/net/i40e/i40e_ethdev.c | 3 + drivers/net/i40e/i40e_ethdev.h | 9 +- drivers/net/i40e/i40e_fdir.c | 6 ++ drivers/net/i40e/i40e_flow.c | 134 + 5 files changed, 117 insertions(+), 41 deletions(-) diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 000bbf501..9e55955c4 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -62,6 +62,12 @@ New Features * Added support for matching on IPv4 Time To Live and IPv6 Hop Limit. +* **Updated Intel i40e driver.** + + Updated i40e PMD with new features and improvements, including: + + * enable MAC address as FDIR input set for ipv4-other, ipv4-udp and ipv4-tcp. + Removed Items - diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 9539b0470..530908b0e 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -9342,6 +9342,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | I40E_INSET_IPV4_TTL, [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | @@ -9357,6 +9358,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT, [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | @@ -9373,6 +9375,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_SCTP_VT, [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index aac89de91..dbb5d594a 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -544,12 +544,19 @@ struct i40e_ipv6_l2tpv3oip_flow { uint32_t session_id; /* Session ID in big endian. */ }; +/* A structure used to define the input for l2 dst type flow */ +struct i40e_l2_flow { + struct rte_ether_addr dst; + struct rte_ether_addr src; + uint16_t ether_type; /**< Ether type in big endian */ +}; + /* * A union contains the inputs for all types of flow * items in flows need to be in big endian */ union i40e_fdir_flow { - struct rte_eth_l2_flow l2_flow; + struct i40e_l2_flow l2_flow; struct rte_eth_udpv4_flow udp4_flow; struct rte_eth_tcpv4_flow tcp4_flow; struct rte_eth_sctpv4_flow sctp4_flow; diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 931f25976..2f24615b6 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1062,7 +1062,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; + rte_memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst, + sizeof(struct rte_ether_addr)); + rte_memcpy(raw_pkt + sizeof(struct rte_ether_addr), + &fdir_input->flow.l2_flow.src, + sizeof(struct rte_ether_addr)); raw_pkt += 2 * sizeof(struct rte_ether_addr); + if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index d877ac250..e376ef632 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@
[dpdk-dev] [PATCH v6] net/i40e: enable MAC address as FDIR input set
FVL enable source MAC address and destination MAC address as FDIR's input set for ipv4-other, ipv4-udp and ipv4-tcp. When OVS-DPDK is working as a pure L2 switch, enable MAC address as FDIR input set with Mark+RSS action would help the performance speed up. And FVL FDIR supports to change input set with MAC address. Signed-off-by: Lunyuan Cui --- v6: - Change commit message v5: - Change error info v4: - Enable MAC address as FDIR's input set for ipv4-udp and ipv4-tcp v3: - Enable MAC address as FDIR's input set v2: - Enable src MAC address as FDIR's input set --- doc/guides/rel_notes/release_20_05.rst | 6 ++ drivers/net/i40e/i40e_ethdev.c | 3 + drivers/net/i40e/i40e_ethdev.h | 9 +- drivers/net/i40e/i40e_fdir.c | 6 ++ drivers/net/i40e/i40e_flow.c | 134 + 5 files changed, 117 insertions(+), 41 deletions(-) diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 000bbf501..65f76f001 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -62,6 +62,12 @@ New Features * Added support for matching on IPv4 Time To Live and IPv6 Hop Limit. +* **Updated Intel i40e driver.** + + Updated i40e PMD with new features and improvements, including: + + * Enable MAC address as FDIR input set for ipv4-other, ipv4-udp and ipv4-tcp. + Removed Items - diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 9539b0470..530908b0e 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -9342,6 +9342,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | I40E_INSET_IPV4_TTL, [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | @@ -9357,6 +9358,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT, [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | @@ -9373,6 +9375,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_SCTP_VT, [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index aac89de91..dbb5d594a 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -544,12 +544,19 @@ struct i40e_ipv6_l2tpv3oip_flow { uint32_t session_id; /* Session ID in big endian. */ }; +/* A structure used to define the input for l2 dst type flow */ +struct i40e_l2_flow { + struct rte_ether_addr dst; + struct rte_ether_addr src; + uint16_t ether_type; /**< Ether type in big endian */ +}; + /* * A union contains the inputs for all types of flow * items in flows need to be in big endian */ union i40e_fdir_flow { - struct rte_eth_l2_flow l2_flow; + struct i40e_l2_flow l2_flow; struct rte_eth_udpv4_flow udp4_flow; struct rte_eth_tcpv4_flow tcp4_flow; struct rte_eth_sctpv4_flow sctp4_flow; diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 931f25976..2f24615b6 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1062,7 +1062,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; + rte_memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst, + sizeof(struct rte_ether_addr)); + rte_memcpy(raw_pkt + sizeof(struct rte_ether_addr), + &fdir_input->flow.l2_flow.src, + sizeof(struct rte_ether_addr)); raw_pkt += 2 * sizeof(struct rte_ether_addr); + if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index d877ac250..e376ef632 100644 --- a/drivers/net/i40e/i40e_flow
[dpdk-dev] [PATCH v7] net/i40e: enable MAC address as FDIR input set
Enable source MAC address and destination MAC address as FDIR's input set for ipv4-other, ipv4-udp and ipv4-tcp. When OVS-DPDK is working as a pure L2 switch, enable MAC address as FDIR input set with Mark+RSS action would help the performance speed up. And FVL FDIR supports to change input set with MAC address. Signed-off-by: Lunyuan Cui --- v7: - Change commit message and error info v6: - Change commit message v5: - Change error info v4: - Enable MAC address as FDIR's input set for ipv4-udp and ipv4-tcp v3: - Enable MAC address as FDIR's input set v2: - Enable src MAC address as FDIR's input set --- doc/guides/rel_notes/release_20_05.rst | 6 ++ drivers/net/i40e/i40e_ethdev.c | 3 + drivers/net/i40e/i40e_ethdev.h | 9 +- drivers/net/i40e/i40e_fdir.c | 6 ++ drivers/net/i40e/i40e_flow.c | 131 + 5 files changed, 114 insertions(+), 41 deletions(-) diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 000bbf501..65f76f001 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -62,6 +62,12 @@ New Features * Added support for matching on IPv4 Time To Live and IPv6 Hop Limit. +* **Updated Intel i40e driver.** + + Updated i40e PMD with new features and improvements, including: + + * Enable MAC address as FDIR input set for ipv4-other, ipv4-udp and ipv4-tcp. + Removed Items - diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 9539b0470..530908b0e 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -9342,6 +9342,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | I40E_INSET_IPV4_TTL, [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | @@ -9357,6 +9358,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT, [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | @@ -9373,6 +9375,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_SCTP_VT, [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index aac89de91..dbb5d594a 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -544,12 +544,19 @@ struct i40e_ipv6_l2tpv3oip_flow { uint32_t session_id; /* Session ID in big endian. */ }; +/* A structure used to define the input for l2 dst type flow */ +struct i40e_l2_flow { + struct rte_ether_addr dst; + struct rte_ether_addr src; + uint16_t ether_type; /**< Ether type in big endian */ +}; + /* * A union contains the inputs for all types of flow * items in flows need to be in big endian */ union i40e_fdir_flow { - struct rte_eth_l2_flow l2_flow; + struct i40e_l2_flow l2_flow; struct rte_eth_udpv4_flow udp4_flow; struct rte_eth_tcpv4_flow tcp4_flow; struct rte_eth_sctpv4_flow sctp4_flow; diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 931f25976..2f24615b6 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1062,7 +1062,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; + rte_memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst, + sizeof(struct rte_ether_addr)); + rte_memcpy(raw_pkt + sizeof(struct rte_ether_addr), + &fdir_input->flow.l2_flow.src, + sizeof(struct rte_ether_addr)); raw_pkt += 2 * sizeof(struct rte_ether_addr); + if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index d877ac250..b1861a7db
[dpdk-dev] [PATCH] net/i40e: enable dst MAC address as FDIR input set
When OVS-DPDK is working as a pure L2 switch, Destination MAC match offload with Mark+RSS action would help the performance speed up. And FVL FDIR should support to change input set to be destination MAC. When create a FDIR rule which pattern only has ether dst_mac like below: flow create 0 ingress pattern eth dst is / end actions mark id / rss / end The following 11 pctypes of matched packets can Mark+RSS. PCTYPE_NONF_IPV4_UDP PCTYPE_NONF_IPV4_TCP PCTYPE_NONF_IPV4_SCTP PCTYPE_NONF_IPV4_OTHER PCTYPE_FRAG_IPV4 PCTYPE_NONF_IPV6_UDP PCTYPE_NONF_IPV6_TCP PCTYPE_NONF_IPV6_SCTP PCTYPE_NONF_IPV6_OTHER PCTYPE_FRAG_IPV6 PCTYPE_L2_PAYLOAD Signed-off-by: Lunyuan Cui --- drivers/net/i40e/i40e_ethdev.c | 92 +++--- drivers/net/i40e/i40e_ethdev.h | 10 +- drivers/net/i40e/i40e_fdir.c | 8 +- drivers/net/i40e/i40e_flow.c | 213 + 4 files changed, 226 insertions(+), 97 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 9fbda1c34..bc5522d53 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -9337,15 +9337,16 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, */ static const uint64_t valid_fdir_inset_table[] = { [I40E_FILTER_PCTYPE_FRAG_IPV4] = - I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | - I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | - I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | - I40E_INSET_IPV4_TTL, + I40E_INSET_DMAC | I40E_INSET_VLAN_OUTER | + I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | + I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | + I40E_INSET_IPV4_PROTO | I40E_INSET_IPV4_TTL, [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] = - I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | - I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | - I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | - I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT, + I40E_INSET_DMAC | I40E_INSET_VLAN_OUTER | + I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | + I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | + I40E_INSET_IPV4_TTL | I40E_INSET_SRC_PORT | + I40E_INSET_DST_PORT, [I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP] = I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | @@ -9357,36 +9358,38 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT, [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] = - I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | - I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | - I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | - I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT, + I40E_INSET_DMAC | I40E_INSET_VLAN_OUTER | + I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | + I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | + I40E_INSET_IPV4_TTL | I40E_INSET_SRC_PORT | + I40E_INSET_DST_PORT, [I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK] = I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT, [I40E_FILTER_PCTYPE_NONF_IPV4_SCTP] = - I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | - I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | - I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_TTL | - I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | - I40E_INSET_SCTP_VT, + I40E_INSET_DMAC | I40E_INSET_VLAN_OUTER | + I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | + I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | + I40E_INSET_IPV4_TTL | I40E_INSET_SRC_PORT | + I40E_INSET_DST_PORT | I40E_INSET_SCTP_VT, [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] = - I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | - I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | - I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | - I40E_INSET_IPV4_TTL, + I40E_INSET_DMAC | I40E_INSET_VLAN_OUTER | + I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | + I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | + I40E_INSET_IPV4_PROTO | I40E_INSET_IPV4_TTL, [I40E_FILTER_PCTYPE_FRAG_IPV6] = - I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | - I40E_INSET_IPV6_SRC | I40E_INSET_IPV6_DST | - I40E_INSET_IPV6_TC
[dpdk-dev] [PATCH] net/i40e: enable dst MAC address as FDIR input set
FVL enable Destination MAC address as FDIR's input set for ipv4-other. When OVS-DPDK is working as a pure L2 switch, destination MAC match offload with Mark+RSS action would help the performance speed up. And FVL FDir supports to change input set to be destination MAC. Signed-off-by: Lunyuan Cui --- doc/guides/rel_notes/release_20_05.rst | 6 +++ drivers/net/i40e/i40e_ethdev.c | 8 ++-- drivers/net/i40e/i40e_ethdev.h | 10 - drivers/net/i40e/i40e_fdir.c | 19 +++--- drivers/net/i40e/i40e_flow.c | 52 +- 5 files changed, 68 insertions(+), 27 deletions(-) diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 2190eaf85..a5aac0d2a 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -56,6 +56,12 @@ New Features Also, make sure to start the actual text at the margin. = +* **Updated Intel i40e driver.** + + Updated i40e PMD with new features and improvements, including: + + * enable dst MAC address as FDIR input set for ipv4-other + Removed Items - diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 9fbda1c34..0003b5ae6 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -9373,10 +9373,10 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_SCTP_VT, [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] = - I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | - I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | - I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | - I40E_INSET_IPV4_TTL, + I40E_INSET_DMAC | I40E_INSET_VLAN_OUTER | + I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | + I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | + I40E_INSET_IPV4_PROTO | I40E_INSET_IPV4_TTL, [I40E_FILTER_PCTYPE_FRAG_IPV6] = I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV6_SRC | I40E_INSET_IPV6_DST | diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index aac89de91..d8361118a 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -544,12 +544,19 @@ struct i40e_ipv6_l2tpv3oip_flow { uint32_t session_id; /* Session ID in big endian. */ }; +/* A structure used to define the input for l2 dst type flow */ +struct i40e_eth_l2_flow { + struct rte_ether_addr src; + struct rte_ether_addr dst; + uint16_t ether_type; /**< Ether type in big endian */ +}; + /* * A union contains the inputs for all types of flow * items in flows need to be in big endian */ union i40e_fdir_flow { - struct rte_eth_l2_flow l2_flow; + struct i40e_eth_l2_flow l2_flow; struct rte_eth_udpv4_flow udp4_flow; struct rte_eth_tcpv4_flow tcp4_flow; struct rte_eth_sctpv4_flow sctp4_flow; @@ -637,6 +644,7 @@ struct i40e_fdir_filter_conf { /* ID, an unique value is required when deal with FDIR entry */ struct i40e_fdir_input input;/* Input set */ struct i40e_fdir_action action; /* Action taken when match */ + bool fdir_dst_mac_rule; /* rule which only includes dst mac pattern */ }; /* diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 931f25976..b1d7b61b8 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1041,7 +1041,8 @@ static inline int i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, const struct i40e_fdir_input *fdir_input, unsigned char *raw_pkt, - bool vlan) + bool vlan, + bool fdir_dst_mac_input) { struct i40e_customized_pctype *cus_pctype = NULL; static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; @@ -1062,7 +1063,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; - raw_pkt += 2 * sizeof(struct rte_ether_addr); + if (fdir_dst_mac_input) { + rte_memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst, + sizeof(struct rte_ether_addr)); + raw_pkt += sizeof(struct rte_ether_addr); + } else { + raw_pkt += 2 * sizeof(struct rte_ether_addr); + } if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), @@ -1156,7 +1163,8 @@ i40e_flow_fdir_fill_eth_ip_head(struc
[dpdk-dev] [PATCH v2] net/i40e: enable MAC address as FDIR input set
FVL enable both src MAC address and dst MAC address as FDIR's input set for ipv4-other. And FVL enable only dst MAC address as FDIR's input set for ipv4-other. When OVS-DPDK is working as a pure L2 switch, Both two ways match offload with Mark+RSS action would help the performance speed up. And FVL FDIR supports to change input set as both two ways. Signed-off-by: Lunyuan Cui --- v2: - Enable src MAC address as FDIR's input set --- doc/guides/rel_notes/release_20_05.rst | 7 +++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev.h | 18 +++- drivers/net/i40e/i40e_fdir.c | 22 +++-- drivers/net/i40e/i40e_flow.c | 63 +++--- 5 files changed, 89 insertions(+), 22 deletions(-) diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 2190eaf85..f0efc5295 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -56,6 +56,13 @@ New Features Also, make sure to start the actual text at the margin. = +* **Updated Intel i40e driver.** + + Updated i40e PMD with new features and improvements, including: + + * enable only dst MAC address as FDIR input set for ipv4-other + * enable both src MAC address and dst MAC address as FDIR input set for ipv4-other + Removed Items - diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 9fbda1c34..d11df8d83 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -9373,6 +9373,7 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_SCTP_VT, [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] = + I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS | I40E_INSET_IPV4_PROTO | diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index aac89de91..e8b98b67e 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -544,12 +544,19 @@ struct i40e_ipv6_l2tpv3oip_flow { uint32_t session_id; /* Session ID in big endian. */ }; +/* A structure used to define the input for l2 dst type flow */ +struct i40e_eth_l2_flow { + struct rte_ether_addr dst; + struct rte_ether_addr src; + uint16_t ether_type; /**< Ether type in big endian */ +}; + /* * A union contains the inputs for all types of flow * items in flows need to be in big endian */ union i40e_fdir_flow { - struct rte_eth_l2_flow l2_flow; + struct i40e_eth_l2_flow l2_flow; struct rte_eth_udpv4_flow udp4_flow; struct rte_eth_tcpv4_flow tcp4_flow; struct rte_eth_sctpv4_flow sctp4_flow; @@ -628,6 +635,13 @@ struct i40e_fdir_action { uint8_t flex_off; }; +/* Ether input set kinds */ +enum i40e_fdir_eth_inset { + I40E_ETH_INSET_NULL = 0, + I40E_ETH_INSET_DMAC, + I40E_ETH_INSET_SMAC_DMAC, +}; + /* A structure used to define the flow director filter entry by filter_ctrl API * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_ADD and * RTE_ETH_FILTER_DELETE operations. @@ -637,6 +651,8 @@ struct i40e_fdir_filter_conf { /* ID, an unique value is required when deal with FDIR entry */ struct i40e_fdir_input input;/* Input set */ struct i40e_fdir_action action; /* Action taken when match */ + /* rule which only includes dst mac pattern */ + enum i40e_fdir_eth_inset fdir_dst_mac_rule; }; /* diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 931f25976..a14f14e75 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1041,7 +1041,8 @@ static inline int i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, const struct i40e_fdir_input *fdir_input, unsigned char *raw_pkt, - bool vlan) + bool vlan, + enum i40e_fdir_eth_inset fdir_dst_mac_input) { struct i40e_customized_pctype *cus_pctype = NULL; static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; @@ -1062,7 +1063,18 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; + if (fdir_dst_mac_input == I40E_ETH_INSET_DMAC) { + rte_memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst, + sizeof(struct rte_ether_addr)); + } else if (fdir_dst_mac_input == I40E_ETH_INSET_SMAC_DMAC) { + rte_memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst
[dpdk-dev] [PATCH] net/iavf: enable port reset
This patch is intended to add iavf_dev_reset ops, enable iavf to support "port reset all". Signed-off-by: Lunyuan Cui --- drivers/net/iavf/iavf_ethdev.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 34913f9c4..01366bc3c 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -32,6 +32,7 @@ static int iavf_dev_configure(struct rte_eth_dev *dev); static int iavf_dev_start(struct rte_eth_dev *dev); static void iavf_dev_stop(struct rte_eth_dev *dev); static void iavf_dev_close(struct rte_eth_dev *dev); +static int iavf_dev_reset(struct rte_eth_dev *dev); static int iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev); @@ -91,6 +92,7 @@ static const struct eth_dev_ops iavf_eth_dev_ops = { .dev_start = iavf_dev_start, .dev_stop = iavf_dev_stop, .dev_close = iavf_dev_close, + .dev_reset = iavf_dev_reset, .dev_infos_get = iavf_dev_info_get, .dev_supported_ptypes_get = iavf_dev_supported_ptypes_get, .link_update= iavf_dev_link_update, @@ -1416,6 +1418,23 @@ iavf_dev_uninit(struct rte_eth_dev *dev) return 0; } +/* + * Reset VF device only to re-initialize resources in PMD layer + */ +static int +iavf_dev_reset(struct rte_eth_dev *dev) +{ + int ret; + + ret = iavf_dev_uninit(dev); + if (ret) + return ret; + + ret = iavf_dev_init(dev); + + return ret; +} + static int eth_iavf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) { -- 2.17.1
[dpdk-dev] [PATCH v2] net/e1000: fix link status update
Unassigned variable should not be used as judgment, and there is no need to update link status according to old link status. This patch fix the issue. Fixes: 80ba61115e77 ("net/e1000: use link status helper functions") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- drivers/net/e1000/em_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 9a88b50b2..7959ee4e9 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1157,7 +1157,7 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete) memset(&link, 0, sizeof(link)); /* Now we check if a transition has happened */ - if (link_check && (link.link_status == ETH_LINK_DOWN)) { + if (link_check) { uint16_t duplex, speed; hw->mac.ops.get_link_up_info(hw, &speed, &duplex); link.link_duplex = (duplex == FULL_DUPLEX) ? @@ -1167,7 +1167,7 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete) link.link_status = ETH_LINK_UP; link.link_autoneg = !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); - } else if (!link_check && (link.link_status == ETH_LINK_UP)) { + } else { link.link_speed = ETH_SPEED_NUM_NONE; link.link_duplex = ETH_LINK_HALF_DUPLEX; link.link_status = ETH_LINK_DOWN; -- 2.17.1
[dpdk-dev] [PATCH v3] net/ixgbe: fix link status
After ports reset, tx laser register will be reset. The link status for 82599eb got from link status register was not correct. Set tx laser disable when port resets. ixgbe_flap_tx_laser_multispeed_fiber() can cause link status change from down to up. This treatment should work after port starts. Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link update") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- v3: * Correct countermeasure Don't delete ixgbe_dev_setup_link_alarm_handler(). v2: * Change commit log Add a log why I delete ixgbe_dev_setup_link_alarm_handler(). --- drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 8c1caac18..260484fbf 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1188,6 +1188,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) diag = ixgbe_bypass_init_hw(hw); #else diag = ixgbe_init_hw(hw); + hw->mac.autotry_restart = false; #endif /* RTE_LIBRTE_IXGBE_BYPASS */ /* @@ -1298,6 +1299,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) /* enable support intr */ ixgbe_enable_intr(eth_dev); + ixgbe_dev_set_link_down(eth_dev); + /* initialize filter info */ memset(filter_info, 0, sizeof(struct ixgbe_filter_info)); -- 2.17.1
[dpdk-dev] [PATCH v3] net/e1000: fix link status update
Unassigned variable should not be used as judgment, and there is no need to update link status according to old link status. This patch fix the issue. Change the variable from link_check to link_up. Fixes: 80ba61115e77 ("net/e1000: use link status helper functions") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- v3: * Change the variable from link_check to link_up. v2 * Delete incorrect judgment --- drivers/net/e1000/em_ethdev.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 9a88b50b2..080cbe2df 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1121,9 +1121,9 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct rte_eth_link link; - int link_check, count; + int link_up, count; - link_check = 0; + link_up = 0; hw->mac.get_link_status = 1; /* possible wait-to-complete in up to 9 seconds */ @@ -1133,31 +1133,31 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete) case e1000_media_type_copper: /* Do the work to read phy */ e1000_check_for_link(hw); - link_check = !hw->mac.get_link_status; + link_up = !hw->mac.get_link_status; break; case e1000_media_type_fiber: e1000_check_for_link(hw); - link_check = (E1000_READ_REG(hw, E1000_STATUS) & + link_up = (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU); break; case e1000_media_type_internal_serdes: e1000_check_for_link(hw); - link_check = hw->mac.serdes_has_link; + link_up = hw->mac.serdes_has_link; break; default: break; } - if (link_check || wait_to_complete == 0) + if (link_up || wait_to_complete == 0) break; rte_delay_ms(EM_LINK_UPDATE_CHECK_INTERVAL); } memset(&link, 0, sizeof(link)); /* Now we check if a transition has happened */ - if (link_check && (link.link_status == ETH_LINK_DOWN)) { + if (link_up) { uint16_t duplex, speed; hw->mac.ops.get_link_up_info(hw, &speed, &duplex); link.link_duplex = (duplex == FULL_DUPLEX) ? @@ -1167,7 +1167,7 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete) link.link_status = ETH_LINK_UP; link.link_autoneg = !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); - } else if (!link_check && (link.link_status == ETH_LINK_UP)) { + } else { link.link_speed = ETH_SPEED_NUM_NONE; link.link_duplex = ETH_LINK_HALF_DUPLEX; link.link_status = ETH_LINK_DOWN; -- 2.17.1
[dpdk-dev] [PATCH v4] net/ixgbe: fix link status
The link status for 82599eb got from link status register was not correct. Check the enable/disable flag of tx laser, set the link status down if tx laser disabled. Then, we can get correct status. But after port reset, tx laser register will be reset enable. Link status will always be up. So set tx laser disable when port resets. When hw->mac.autotry_restart is true, whether tx laser is disable or enable, it will be set enable in ixgbe_flap_tx_laser_multispeed_fiber(). hw->mac.autotry_restart can be set true in both port init and port start. Because we don't need this treatment before port starts, set hw->mac.autotry_restart false when port init. Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link update") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- v4: * modifier commit log Describe the problem in more detail. v3: * Correct countermeasure Don't delete ixgbe_dev_setup_link_alarm_handler(). v2: * modifier commit log Add a log why I delete ixgbe_dev_setup_link_alarm_handler(). --- drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 8c1caac18..260484fbf 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1188,6 +1188,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) diag = ixgbe_bypass_init_hw(hw); #else diag = ixgbe_init_hw(hw); + hw->mac.autotry_restart = false; #endif /* RTE_LIBRTE_IXGBE_BYPASS */ /* @@ -1298,6 +1299,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) /* enable support intr */ ixgbe_enable_intr(eth_dev); + ixgbe_dev_set_link_down(eth_dev); + /* initialize filter info */ memset(filter_info, 0, sizeof(struct ixgbe_filter_info)); -- 2.17.1
[dpdk-dev] [PATCH v4] net/e1000: fix link status update
There is no need to judge the original link state, only update the data according to the current link state. It can maintain better robustness. In addition, this patch change the variable from link_check to link_up. Fixes: 80ba61115e77 ("net/e1000: use link status helper functions") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- v4: * modifier commit log v3: * Change the variable from link_check to link_up. v2 * Delete incorrect judgment --- drivers/net/e1000/em_ethdev.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 9a88b50b2..080cbe2df 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1121,9 +1121,9 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct rte_eth_link link; - int link_check, count; + int link_up, count; - link_check = 0; + link_up = 0; hw->mac.get_link_status = 1; /* possible wait-to-complete in up to 9 seconds */ @@ -1133,31 +1133,31 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete) case e1000_media_type_copper: /* Do the work to read phy */ e1000_check_for_link(hw); - link_check = !hw->mac.get_link_status; + link_up = !hw->mac.get_link_status; break; case e1000_media_type_fiber: e1000_check_for_link(hw); - link_check = (E1000_READ_REG(hw, E1000_STATUS) & + link_up = (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU); break; case e1000_media_type_internal_serdes: e1000_check_for_link(hw); - link_check = hw->mac.serdes_has_link; + link_up = hw->mac.serdes_has_link; break; default: break; } - if (link_check || wait_to_complete == 0) + if (link_up || wait_to_complete == 0) break; rte_delay_ms(EM_LINK_UPDATE_CHECK_INTERVAL); } memset(&link, 0, sizeof(link)); /* Now we check if a transition has happened */ - if (link_check && (link.link_status == ETH_LINK_DOWN)) { + if (link_up) { uint16_t duplex, speed; hw->mac.ops.get_link_up_info(hw, &speed, &duplex); link.link_duplex = (duplex == FULL_DUPLEX) ? @@ -1167,7 +1167,7 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete) link.link_status = ETH_LINK_UP; link.link_autoneg = !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); - } else if (!link_check && (link.link_status == ETH_LINK_UP)) { + } else { link.link_speed = ETH_SPEED_NUM_NONE; link.link_duplex = ETH_LINK_HALF_DUPLEX; link.link_status = ETH_LINK_DOWN; -- 2.17.1
[dpdk-dev] [PATCH] net/i40e: enable multi-queue Rx interrupt for VF
Current implementation is that only one Rx queue can support interrupt, because all queues are mapped in the same vector id in vfio_enable_msix(). So VF can not support multi-queue Rx interrupt in the interrupt mode. In this patch, if the packet I/O interrupt on datapath is enabled (rte_intr_dp_is_en(intr_handle) is true), we map different interrupt vectors to each queue and send this map to PF. After PF sets the map to the register, all Rx queue interrupts will be received. In addition, vector id should less than the maximum vector value. When queue number is more than vector value, we set up a loop of interrupt vectors map. Signed-off-by: Lunyuan Cui --- drivers/net/i40e/i40e_ethdev_vf.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 5dba0928b..b08583c03 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -651,12 +651,13 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct vf_cmd_info args; uint8_t cmd_buffer[sizeof(struct virtchnl_irq_map_info) + \ - sizeof(struct virtchnl_vector_map)]; + sizeof(struct virtchnl_vector_map) * dev->data->nb_rx_queues]; struct virtchnl_irq_map_info *map_info; struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; uint32_t vector_id; int i, err; + uint16_t nb_msix; if (dev->data->dev_conf.intr_conf.rxq != 0 && rte_intr_allow_others(intr_handle)) @@ -664,19 +665,25 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) else vector_id = I40E_MISC_VEC_ID; + nb_msix = RTE_MIN(vf->vf_res->max_vectors, + intr_handle->nb_efd); + map_info = (struct virtchnl_irq_map_info *)cmd_buffer; - map_info->num_vectors = 1; - map_info->vecmap[0].rxitr_idx = I40E_ITR_INDEX_DEFAULT; - map_info->vecmap[0].vsi_id = vf->vsi_res->vsi_id; - /* Alway use default dynamic MSIX interrupt */ - map_info->vecmap[0].vector_id = vector_id; - /* Don't map any tx queue */ - map_info->vecmap[0].txq_map = 0; - map_info->vecmap[0].rxq_map = 0; + map_info->num_vectors = dev->data->nb_rx_queues; for (i = 0; i < dev->data->nb_rx_queues; i++) { - map_info->vecmap[0].rxq_map |= 1 << i; + map_info->vecmap[i].rxitr_idx = I40E_ITR_INDEX_DEFAULT; + map_info->vecmap[i].vsi_id = vf->vsi_res->vsi_id; + /* Alway use default dynamic MSIX interrupt */ + map_info->vecmap[i].vector_id = vector_id; + /* Don't map any tx queue */ + map_info->vecmap[i].txq_map = 0; + map_info->vecmap[i].rxq_map = 1 << i; if (rte_intr_dp_is_en(intr_handle)) intr_handle->intr_vec[i] = vector_id; + if (vector_id > I40E_MISC_VEC_ID) + vector_id++; + if (vector_id > nb_msix) + vector_id = I40E_RX_VEC_START; } args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP; -- 2.17.1
[dpdk-dev] [PATCH] net/ixgbe: fixed port can not link up in FreeBSD
In FreeBSD environment, nic_uio drivers do not support interrupts, rte_intr_callback_register() will fail to register interrupts. We can not make link status to change from down to up by interrupt callback. So we need to wait for the controller to acquire link when ports start. Through multiple tests, 5s should be enough. Fixes: b9bd0f09fa15 ("ethdev: fix link status query") Cc: sta...@dpdk.org Signed-off-by: Lunyuan Cui --- drivers/net/ixgbe/ixgbe_ethdev.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 2c6fd0f13..3023ee052 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2555,6 +2555,9 @@ ixgbe_dev_start(struct rte_eth_dev *dev) IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private); struct ixgbe_macsec_setting *macsec_setting = IXGBE_DEV_PRIVATE_TO_MACSEC_SETTING(dev->data->dev_private); +#ifdef RTE_EXEC_ENV_FREEBSD + int i; +#endif PMD_INIT_FUNC_TRACE(); @@ -2801,6 +2804,27 @@ ixgbe_dev_start(struct rte_eth_dev *dev) "please call hierarchy_commit() " "before starting the port"); + /* +* In freebsd environment, nic_uio drivers do not support interrupts, +* rte_intr_callback_register() will fail to register interrupts. +* We can not make link status to change +* from down to up by interrupt callback. +* So we need to wait for the controller +* to acquire link when ports start. +*/ +#ifdef RTE_EXEC_ENV_FREEBSD + for (i = 0; i < 25; i++) { + /* If we have link, just jump out */ + err = ixgbe_check_link(hw, &speed, &link_up, 0); + if (err) + goto error; + if (link_up) + break; + /* Wait for the link partner to also set speed */ + msec_delay(200); + } +#endif + /* * Update link status right before return, because it may * start link configuration process in a separate thread. -- 2.17.1