mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
move header pad insert/remove functions and utility header to a new core module
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Felix Fietkau <[email protected]>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "mt76x2.h"
|
||||
|
||||
void mt76_remove_hdr_pad(struct sk_buff *skb)
|
||||
{
|
||||
int len = ieee80211_get_hdrlen_from_skb(skb);
|
||||
memmove(skb->data + 2, skb->data, len);
|
||||
skb_pull(skb, 2);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_remove_hdr_pad);
|
||||
|
||||
int mt76_insert_hdr_pad(struct sk_buff *skb)
|
||||
{
|
||||
int len = ieee80211_get_hdrlen_from_skb(skb);
|
||||
int ret;
|
||||
|
||||
if (len % 4 == 0)
|
||||
return 0;
|
||||
|
||||
ret = skb_cow(skb, 2);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
skb_push(skb, 2);
|
||||
memmove(skb->data, skb->data + 2, len);
|
||||
|
||||
skb->data[len] = 0;
|
||||
skb->data[len + 1] = 0;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76_insert_hdr_pad);
|
||||
Reference in New Issue
Block a user