root/drivers/net/wireless/mediatek/mt7601u/util.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. mt76_remove_hdr_pad
  2. mt76_insert_hdr_pad

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 /*
   3  * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
   4  */
   5 
   6 #include "mt7601u.h"
   7 
   8 void mt76_remove_hdr_pad(struct sk_buff *skb)
   9 {
  10         int len = ieee80211_get_hdrlen_from_skb(skb);
  11 
  12         memmove(skb->data + 2, skb->data, len);
  13         skb_pull(skb, 2);
  14 }
  15 
  16 int mt76_insert_hdr_pad(struct sk_buff *skb)
  17 {
  18         int len = ieee80211_get_hdrlen_from_skb(skb);
  19         int ret;
  20 
  21         if (len % 4 == 0)
  22                 return 0;
  23 
  24         ret = skb_cow(skb, 2);
  25         if (ret)
  26                 return ret;
  27 
  28         skb_push(skb, 2);
  29         memmove(skb->data, skb->data + 2, len);
  30 
  31         skb->data[len] = 0;
  32         skb->data[len + 1] = 0;
  33         return 0;
  34 }

/* [<][>][^][v][top][bottom][index][help] */