Commit d514c8b5 authored by Alexander Lobakin's avatar Alexander Lobakin Committed by Jakub Kicinski

idpf: don't enable NAPI and interrupts prior to allocating Rx buffers

Currently, idpf enables NAPI and interrupts prior to allocating Rx
buffers.
This may lead to frame loss (there are no buffers to place incoming
frames) and even crashes on quick ifup-ifdown. Interrupts must be
enabled only after all the resources are here and available.
Split interrupt init into two phases: initialization and enabling,
and perform the second only after the queues are fully initialized.
Note that we can't just move interrupt initialization down the init
process, as the queues must have correct a ::q_vector pointer set
and NAPI already added in order to allocate buffers correctly.
Also, during the deinit process, disable HW interrupts first and
only then disable NAPI. Otherwise, there can be a HW event leading
to napi_schedule(), but the NAPI will already be unavailable.

Fixes: d4d55871 ("idpf: initialize interrupts and enable vport")
Reported-by: default avatarMichal Kubiak <michal.kubiak@intel.com>
Reviewed-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: default avatarAlexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Tested-by: default avatarKrishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20240523-net-2024-05-23-intel-net-fixes-v1-1-17a923e0bb5f@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 266aa3b4
...@@ -1394,6 +1394,7 @@ static int idpf_vport_open(struct idpf_vport *vport, bool alloc_res) ...@@ -1394,6 +1394,7 @@ static int idpf_vport_open(struct idpf_vport *vport, bool alloc_res)
} }
idpf_rx_init_buf_tail(vport); idpf_rx_init_buf_tail(vport);
idpf_vport_intr_ena(vport);
err = idpf_send_config_queues_msg(vport); err = idpf_send_config_queues_msg(vport);
if (err) { if (err) {
......
...@@ -3746,9 +3746,9 @@ static void idpf_vport_intr_ena_irq_all(struct idpf_vport *vport) ...@@ -3746,9 +3746,9 @@ static void idpf_vport_intr_ena_irq_all(struct idpf_vport *vport)
*/ */
void idpf_vport_intr_deinit(struct idpf_vport *vport) void idpf_vport_intr_deinit(struct idpf_vport *vport)
{ {
idpf_vport_intr_dis_irq_all(vport);
idpf_vport_intr_napi_dis_all(vport); idpf_vport_intr_napi_dis_all(vport);
idpf_vport_intr_napi_del_all(vport); idpf_vport_intr_napi_del_all(vport);
idpf_vport_intr_dis_irq_all(vport);
idpf_vport_intr_rel_irq(vport); idpf_vport_intr_rel_irq(vport);
} }
...@@ -4179,7 +4179,6 @@ int idpf_vport_intr_init(struct idpf_vport *vport) ...@@ -4179,7 +4179,6 @@ int idpf_vport_intr_init(struct idpf_vport *vport)
idpf_vport_intr_map_vector_to_qs(vport); idpf_vport_intr_map_vector_to_qs(vport);
idpf_vport_intr_napi_add_all(vport); idpf_vport_intr_napi_add_all(vport);
idpf_vport_intr_napi_ena_all(vport);
err = vport->adapter->dev_ops.reg_ops.intr_reg_init(vport); err = vport->adapter->dev_ops.reg_ops.intr_reg_init(vport);
if (err) if (err)
...@@ -4193,17 +4192,20 @@ int idpf_vport_intr_init(struct idpf_vport *vport) ...@@ -4193,17 +4192,20 @@ int idpf_vport_intr_init(struct idpf_vport *vport)
if (err) if (err)
goto unroll_vectors_alloc; goto unroll_vectors_alloc;
idpf_vport_intr_ena_irq_all(vport);
return 0; return 0;
unroll_vectors_alloc: unroll_vectors_alloc:
idpf_vport_intr_napi_dis_all(vport);
idpf_vport_intr_napi_del_all(vport); idpf_vport_intr_napi_del_all(vport);
return err; return err;
} }
void idpf_vport_intr_ena(struct idpf_vport *vport)
{
idpf_vport_intr_napi_ena_all(vport);
idpf_vport_intr_ena_irq_all(vport);
}
/** /**
* idpf_config_rss - Send virtchnl messages to configure RSS * idpf_config_rss - Send virtchnl messages to configure RSS
* @vport: virtual port * @vport: virtual port
......
...@@ -990,6 +990,7 @@ int idpf_vport_intr_alloc(struct idpf_vport *vport); ...@@ -990,6 +990,7 @@ int idpf_vport_intr_alloc(struct idpf_vport *vport);
void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector); void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector);
void idpf_vport_intr_deinit(struct idpf_vport *vport); void idpf_vport_intr_deinit(struct idpf_vport *vport);
int idpf_vport_intr_init(struct idpf_vport *vport); int idpf_vport_intr_init(struct idpf_vport *vport);
void idpf_vport_intr_ena(struct idpf_vport *vport);
enum pkt_hash_types idpf_ptype_to_htype(const struct idpf_rx_ptype_decoded *decoded); enum pkt_hash_types idpf_ptype_to_htype(const struct idpf_rx_ptype_decoded *decoded);
int idpf_config_rss(struct idpf_vport *vport); int idpf_config_rss(struct idpf_vport *vport);
int idpf_init_rss(struct idpf_vport *vport); int idpf_init_rss(struct idpf_vport *vport);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment