[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220819110041.l3ww5xlxjx7bqx7d@skbuf>
Date: Fri, 19 Aug 2022 14:00:41 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Sergei Antonov <saproj@...il.com>
Cc: Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH 2/2] net: moxa: prevent double-mapping of DMA areas
On Fri, Aug 19, 2022 at 11:12:11AM +0300, Sergei Antonov wrote:
> On Thu, 18 Aug 2022 at 22:27, Andrew Lunn <andrew@...n.ch> wrote:
> > > Unmap RX memory areas in moxart_mac_stop(), so that moxart_mac_open()
> > > will map them anew instead of double-mapping. To avoid code duplication,
> > > create a new function moxart_mac_unmap_rx(). Nullify unmapped pointers to
> > > prevent double-unmapping (ex: moxart_mac_stop(), then moxart_remove()).
> >
> > This makes the code symmetric, which is good.
> >
> > However, moxart_mac_free_memory() will also free the descriptors,
> > which is not required. moxart_remove() should undo what the probe did,
> > nothing more.
>
> Having considered your comments, I now think I should make another
> patch, which fixes two problems at once. To unmap DMA areas only in
> moxart_mac_stop() and not in moxart_remove(). It will fix error
> unwinding during probe and double-mapping on link down, link up. It
> will be correct if Linux always calls moxart_mac_stop() before calling
> moxart_remove().
The way this is supposed to work is that from moxart_remove() you call
unregister_netdev(), and this calls dev_close[_many]() internally. The
dev_close() method calls your ndo_stop callback.
Powered by blists - more mailing lists