Re: [PATCH net] net: atlantic: keep rings across suspend/resume
From: Jakub Kicinski
Date: Thu Dec 12 2024 - 20:22:10 EST
On Thu, 12 Dec 2024 03:39:24 +0100 Lorenz Brun wrote:
> -void aq_nic_deinit(struct aq_nic_s *self, bool link_down)
> +void aq_nic_deinit(struct aq_nic_s *self, bool link_down, bool keep_rings)
> {
> struct aq_vec_s *aq_vec = NULL;
> unsigned int i = 0U;
> @@ -1433,7 +1433,8 @@ void aq_nic_deinit(struct aq_nic_s *self, bool link_down)
> for (i = 0U; i < self->aq_vecs; i++) {
> aq_vec = self->aq_vec[i];
> aq_vec_deinit(aq_vec);
> - aq_vec_ring_free(aq_vec);
> + if (!keep_rings)
> + aq_vec_ring_free(aq_vec);
> }
I'd suggest to break out the memory freeing from aq_nic_deinit(),
and conversely allocating from aq_nic_init(). Then explicitly call
free / alloc from where aq_nic_deinit() / aq_nic_init() are called.
The booleans passed into init functions are pretty error prone.
Pretty quickly one needs to grep the entire driver to find which
callsites pass what.
--
pw-bot: cr