net/iavf: fix missing check for interrupt errors
PATCH 1/2 net/iavf: fix missing check for interrupt errors
When registering interrupts, there was no check if the registration of the interrupt succeeded. Add in such a check, and go to fallback path if the check fails. This prevents errors on FreeBSD due to missed admin queue messages.
--- drivers/net/intel/iavf/iavf_ethdev.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +5 -7
@@ -2825,18 +2825,16 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) ð_dev->data->mac_addrs[0]); -if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_WB_ON_ITR ) { -/* register callback func to eal lib */ -rte_intr_callback_register (pci_dev->intr_handle, - iavf_dev_interrupt_handler, - (void *)eth_dev); +if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_WB_ON_ITR && +/* register callback func to eal lib */ +rte_intr_callback_register (pci_dev->intr_handle, + iavf_dev_interrupt_handler, (void *)eth_dev) ==0 )/* enable uio intr after callback register */ rte_intr_enable (pci_dev->intr_handle); - }else { +else rte_eal_alarm_set (IAVF_ALARM_INTERVAL , iavf_dev_alarm_handler, eth_dev); - }/* configure and enable device interrupt */ iavf_enable_irq0 (hw);
Signature · 1 line
2.43.0
PATCH 2/2 net/iavf: fix crash on app exit on FreeBSD
With the fallback interrupt path now enabled on FreeBSD there are segmentation faults on app exit, due to the alarm interrupt trying to access invalid pointers. Add checks for null to fix these crashes.
--- drivers/net/intel/iavf/iavf_ethdev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/intel/iavf/iavf_ethdev.c +3 -0
@@ -2698,6 +2698,9 @@ void iavf_dev_alarm_handler(void *param) {struct rte_eth_dev *dev = (struct rte_eth_dev *)param; +if (dev ==NULL || dev->data ==NULL || dev->data->dev_private ==NULL ) +return ; +struct iavf_hw *hw =IAVF_DEV_PRIVATE_TO_HW (dev->data->dev_private);uint32_t icr0;
Signature · 1 line
2.43.0
Re: [PATCH 2/2] net/iavf: fix crash on app exit on FreeBSD
Quoted 26 lines · Bruce Richardson
With the fallback interrupt path now enabled on FreeBSD there are segmentation faults on app exit, due to the alarm interrupt trying to access invalid pointers. Add checks for null to fix these crashes.
Fixes cd3b124955d4 ("net/iavf: enable interrupt polling")Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/iavf/iavf_ethdev.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/intel/iavf/iavf_ethdev.c +3
-0@@ -2698,6 +2698,9 @@ void iavf_dev_alarm_handler(void *param) {struct rte_eth_dev *dev = (struct rte_eth_dev *)param; +if (dev ==NULL || dev->data ==NULL || dev->data->dev_private ==NULL ) +return ; +struct iavf_hw *hw =IAVF_DEV_PRIVATE_TO_HW (dev->data->dev_private);uint32_t icr0;
Signature · 2 lines
Regards, Vladimir
Quoted 41 lines · Bruce Richardson
When registering interrupts, there was no check if the registration of the interrupt succeeded. Add in such a check, and go to fallback path if the check fails. This prevents errors on FreeBSD due to missed admin queue messages.
Fixes cd3b124955d4 ("net/iavf: enable interrupt polling")Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/iavf/iavf_ethdev.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)drivers/net/intel/iavf/iavf_ethdev.c +5
-7@@ -2825,18 +2825,16 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) ð_dev->data->mac_addrs[0]); -if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_WB_ON_ITR ) { -/* register callback func to eal lib */ -rte_intr_callback_register (pci_dev->intr_handle, - iavf_dev_interrupt_handler, - (void *)eth_dev); +if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_WB_ON_ITR && +/* register callback func to eal lib */ +rte_intr_callback_register (pci_dev->intr_handle, + iavf_dev_interrupt_handler, (void *)eth_dev) ==0 )/* enable uio intr after callback register */ rte_intr_enable (pci_dev->intr_handle); - }else { +else rte_eal_alarm_set (IAVF_ALARM_INTERVAL , iavf_dev_alarm_handler, eth_dev); - }/* configure and enable device interrupt */ iavf_enable_irq0 (hw);
Signature · 2 lines
Regards, Vladimir
Quoted 16 lines · Vladimir
Quoted 13 lines · Bruce Richardson
When registering interrupts, there was no check if the registration of the interrupt succeeded. Add in such a check, and go to fallback path if the check fails. This prevents errors on FreeBSD due to missed admin queue messages.
Fixes cd3b124955d4 ("net/iavf: enable interrupt polling")Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/iavf/iavf_ethdev.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
Series applied to dpdk-next-net-intel.
/Bruce