Re: [PATCH net-next v2 6/6] net: dsa: factor skb freeing on xmit

From: Vivien Didelot
Date: Wed May 31 2017 - 14:20:48 EST


Hi Florian,

Florian Fainelli <f.fainelli@xxxxxxxxx> writes:

> On 05/30/2017 11:33 AM, Vivien Didelot wrote:
>> The taggers are currently responsible to free the original SKB if they
>> made a copy of it, or in case of error.
>>
>> This patch simplifies this by freeing the original SKB in the
>> dsa_slave_xmit caller, but only if an error (NULL) is returned.
>
> Is not it a clearer contract if the tagging protocol must always free
> the original SKB, whether it succeeded in creating a new one or not?

The rcv caller frees the original SKB on error, as of a86d8becc3f0
("net: dsa: Factor bottom tag receive functions").

It'd be nice if we could make both xmit and rcv symmetric, and limit the
tagging implementations to only do their real job: tag/untag an SKB with
the destination/source port.

Thanks,

Vivien