On 25/11/2015 13:45, Måns Rullgård wrote:
> Mason wrote:
>
>> On 19/11/2015 14:02, Mans Rullgard wrote:
>>
>>> + if (dma_mapping_error(&dev->dev, dma_addr)) {
>>> + skb_free_frag(data);
>>> + return -ENOMEM;
>>> + }
>>
>> I'm back-porting this driver to 4.1
>>
>> skb_free_frag() was introduced in 4.2 by 181edb2bfa22b IIUC.
>>
>> +static inline void skb_free_frag(void *addr)
>> +{
>> + __free_page_frag(addr);
>> +}
>>
>> Should I just copy the definition of __free_page_frag() ?
>
> Looks like it ought to work. Try and find out. Not that you'll ever
> hit that error condition unless you fake it.
Turns out __free_pages_ok() is static and I'd rather not touch
mm/page_alloc.c in my back-port.
Since you say the error condition is rare, I think I'll go with
the code that 181edb2bfa22b replaced (put_page, IIUC).
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
#define skb_free_frag(data) put_page(virt_to_head_page(data))
#else
#error DELETE ME NOW (see commit 181edb2bfa22b)
#endif
Alexander, does that look correct?
Regards.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html