[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20150721.223553.650568423958457767.davem@davemloft.net>
Date: Tue, 21 Jul 2015 22:35:53 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: sergei.shtylyov@...entembedded.com
Cc: netdev@...r.kernel.org, linux-sh@...r.kernel.org
Subject: Re: [PATCH] ravb: fix ring memory allocation
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Date: Wed, 22 Jul 2015 01:31:59 +0300
> The driver is written as if it can adapt to a low memory situation allocating
> less RX skbs and TX aligned buffers than the respective RX/TX ring sizes. In
> reality though the driver would malfunction in this case. Stop being overly
> smart and just fail in such situation -- this is achieved by moving the memory
> allocation from ravb_ring_format() to ravb_ring_init().
>
> We leave dma_map_single() calls in place but make their failure non-fatal
> by marking the corresponding RX descriptors with zero data size which should
> prevent DMA to an invalid addresses.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Applied.
But the real way to handle this is to allocate all of the necessary
resources for the replacement RX SKB before unmapping and passing the
original SKB up into the stack.
That way you _NEVER_ starve the device of RX packets to receive into,
since if you fail the memory allocation or the DMA mapping, you just
put the original SKB back into the ring.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists