diff mbox series

[v2,2/2] backports: add skb_list_del_init

Message ID 20200814142958.7773-2-nbd@nbd.name (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] backports: add netif_receive_skb_list | expand

Commit Message

Felix Fietkau Aug. 14, 2020, 2:29 p.m. UTC
It is needed for mac80211

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/skbuff.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Hauke Mehrtens Aug. 31, 2020, 6:46 p.m. UTC | #1
On 8/14/20 4:29 PM, Felix Fietkau wrote:
> It is needed for mac80211
> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
>  backport/backport-include/linux/skbuff.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
> index 3ed990d0d2ef..7b825630d391 100644
> --- a/backport/backport-include/linux/skbuff.h
> +++ b/backport/backport-include/linux/skbuff.h
> @@ -384,6 +384,12 @@ static inline void skb_mark_not_on_list(struct sk_buff *skb)
>  {
>  	skb->next = NULL;
>  }
> +
> +static inline void skb_list_del_init(struct sk_buff *skb)
> +{
> +	__list_del_entry(&skb->list);
> +	skb_mark_not_on_list(skb);
> +}
>  #endif /* 4.19.10 <= x < 4.20 */
>  #endif
>  
> 

Hi Felix,

These two backports are not working.

The list member was only added in kernel 4.19 to the sk_buff structure,
see here:
https://git.kernel.org/linus/d4546c2509b1e9cd082e3682dcec98472e37ee5a

Hauke
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Felix Fietkau Sept. 28, 2020, 6:31 a.m. UTC | #2
On 2020-08-31 20:46, Hauke Mehrtens wrote:
> On 8/14/20 4:29 PM, Felix Fietkau wrote:
>> It is needed for mac80211
>> 
>> Signed-off-by: Felix Fietkau <nbd@nbd.name>
>> ---
>>  backport/backport-include/linux/skbuff.h | 6 ++++++
>>  1 file changed, 6 insertions(+)
>> 
>> diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
>> index 3ed990d0d2ef..7b825630d391 100644
>> --- a/backport/backport-include/linux/skbuff.h
>> +++ b/backport/backport-include/linux/skbuff.h
>> @@ -384,6 +384,12 @@ static inline void skb_mark_not_on_list(struct sk_buff *skb)
>>  {
>>  	skb->next = NULL;
>>  }
>> +
>> +static inline void skb_list_del_init(struct sk_buff *skb)
>> +{
>> +	__list_del_entry(&skb->list);
>> +	skb_mark_not_on_list(skb);
>> +}
>>  #endif /* 4.19.10 <= x < 4.20 */
>>  #endif
>>  
>> 
> 
> Hi Felix,
> 
> These two backports are not working.
> 
> The list member was only added in kernel 4.19 to the sk_buff structure,
> see here:
> https://git.kernel.org/linus/d4546c2509b1e9cd082e3682dcec98472e37ee5a
I guess it was working for me on 4.14 because the list member was
backported in 4.14.71.
So it works for kernels with that backport, and I guess other versions
which don't have that will need a more intrusive backport that patches
mac80211 anyway.

- Felix
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Johannes Berg Sept. 28, 2020, 7:20 a.m. UTC | #3
On Mon, 2020-09-28 at 08:31 +0200, Felix Fietkau wrote:
> 
> > The list member was only added in kernel 4.19 to the sk_buff structure,
> > see here:
> > https://git.kernel.org/linus/d4546c2509b1e9cd082e3682dcec98472e37ee5a
> I guess it was working for me on 4.14 because the list member was
> backported in 4.14.71.
> So it works for kernels with that backport, and I guess other versions
> which don't have that will need a more intrusive backport that patches
> mac80211 anyway.

I think Luca (+) just made some internally - we should push that out.

johannes

--
To unsubscribe from this list: send the line "unsubscribe backports" in
Luca Coelho Sept. 28, 2020, 9:12 a.m. UTC | #4
On Mon, 2020-09-28 at 09:20 +0200, Johannes Berg wrote:
> On Mon, 2020-09-28 at 08:31 +0200, Felix Fietkau wrote:
> > > The list member was only added in kernel 4.19 to the sk_buff structure,
> > > see here:
> > > https://git.kernel.org/linus/d4546c2509b1e9cd082e3682dcec98472e37ee5a
> > I guess it was working for me on 4.14 because the list member was
> > backported in 4.14.71.
> > So it works for kernels with that backport, and I guess other versions
> > which don't have that will need a more intrusive backport that patches
> > mac80211 anyway.
> 
> I think Luca (+) just made some internally - we should push that out.

This is what I have (I'm planning to send my updates later this week):

diff --cc backport-include/linux/skbuff.h
index 0843446bd2d5,be2f955cc24e..ae504f0703e1
--- a/backport-include/linux/skbuff.h
+++ b/backport-include/linux/skbuff.h
@@@ -383,19 -375,19 +383,25 @@@ static inline void skb_put_u8(struct sk
  }
  #endif
  
++#if LINUX_VERSION_IS_LESS(4,20,0) && !LINUX_VERSION_IN_RANGE(4,19,10, 4,20,0)
++static inline void skb_mark_not_on_list(struct sk_buff *skb)
++{
++      skb->next = NULL;
++}
++#endif /* < 4.20 || 4.19.10 <= x < 4.20 */
++
  #if LINUX_VERSION_IS_LESS(4,20,0)
  static inline struct sk_buff *__skb_peek(const struct sk_buff_head *list_)
  {
        return list_->next;
  }
- #endif
  
- #if LINUX_VERSION_IS_LESS(4,20,0) && !LINUX_VERSION_IN_RANGE(4,19,10, 4,20,0)
 -#if !LINUX_VERSION_IN_RANGE(4,19,10, 4,20,0)
--static inline void skb_mark_not_on_list(struct sk_buff *skb)
++static inline void skb_list_del_init(struct sk_buff *skb)
  {
--      skb->next = NULL;
++      __list_del_entry((struct list_head *)&skb->next);
++      skb_mark_not_on_list(skb);
  }
- #endif /* < 4.20 || 4.19.10 <= x < 4.20 */
 -#endif /* 4.19.10 <= x < 4.20 */
+ #endif
  
  #if LINUX_VERSION_IS_LESS(4,11,0)
  #define skb_mac_offset LINUX_BACKPORT(skb_mac_offset)

--
Cheers,
Luca.
Hauke Mehrtens Nov. 10, 2020, 11:24 p.m. UTC | #5
On 9/28/20 11:12 AM, Coelho, Luciano wrote:
> On Mon, 2020-09-28 at 09:20 +0200, Johannes Berg wrote:
>> On Mon, 2020-09-28 at 08:31 +0200, Felix Fietkau wrote:
>>>> The list member was only added in kernel 4.19 to the sk_buff structure,
>>>> see here:
>>>> https://git.kernel.org/linus/d4546c2509b1e9cd082e3682dcec98472e37ee5a
>>> I guess it was working for me on 4.14 because the list member was
>>> backported in 4.14.71.
>>> So it works for kernels with that backport, and I guess other versions
>>> which don't have that will need a more intrusive backport that patches
>>> mac80211 anyway.
>>
>> I think Luca (+) just made some internally - we should push that out.
> 
> This is what I have (I'm planning to send my updates later this week):
> 

Hi,

I have something which looks good to me and is compiling, I have to test 
it on some devices and send the patches soon.

With kernel 5.10 I see some changes in netlink again. Do you already 
have some patches for that?

Hauke
Johannes Berg Nov. 11, 2020, 7:43 a.m. UTC | #6
On Wed, 2020-11-11 at 00:24 +0100, Hauke Mehrtens wrote:
> 
> With kernel 5.10 I see some changes in netlink again. Do you already 
> have some patches for that?

Not yet. It's likely going to be rather tricky, though in nl80211 we
don't have multiple policies, so we could just basically revert commit
66a9b9287d24 ("genetlink: move to smaller ops wherever possible").

johannes

--
To unsubscribe from this list: send the line "unsubscribe backports" in
diff mbox series

Patch

diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
index 3ed990d0d2ef..7b825630d391 100644
--- a/backport/backport-include/linux/skbuff.h
+++ b/backport/backport-include/linux/skbuff.h
@@ -384,6 +384,12 @@  static inline void skb_mark_not_on_list(struct sk_buff *skb)
 {
 	skb->next = NULL;
 }
+
+static inline void skb_list_del_init(struct sk_buff *skb)
+{
+	__list_del_entry(&skb->list);
+	skb_mark_not_on_list(skb);
+}
 #endif /* 4.19.10 <= x < 4.20 */
 #endif