-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathskbuff.h
More file actions
75 lines (67 loc) · 2.41 KB
/
skbuff.h
File metadata and controls
75 lines (67 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* \file linux/skbuff.c
* \brief Defines simplified 'struct sk_buff' and function kfree_skb() only.
*
* \details This file has the exact same name and path as the one supplied by
* the Linux Kernel source-code, however the contents have been
* completely replaced. This has been done to keep the rest of the
* Linux Kernel source-code unchanged so that ongoing updates to the
* Linux Kernel can be propagated to this project easily.
*
* Copyright (C) 2022 Deniz Eren <deniz.eren@outlook.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _LINUX_SKBUFF_H
#define _LINUX_SKBUFF_H
#include <linux/kernel.h>
#include <linux/compiler.h>
#include <net/dropreason-core.h>
/**
* struct sk_buff
* @data: Data head pointer
* @dev: Used to access device data and callbacks
*/
struct sk_buff {
unsigned int len, data_len, is_echo;
unsigned char *head, *data;
struct net_device* dev;
};
/**
* kfree_skb - free an sk_buff
* @skb: buffer to free
*/
static inline void kfree_skb (struct sk_buff* skb) {
// TODO: Check if any of the Linux implementation house-keeping is needed
fixed_free(skb->head);
fixed_free(skb);
}
/**
* skb_tx_timestamp() - Driver hook for transmit timestamping
*
* Ethernet MAC Drivers should call this function in their hard_xmit()
* function immediately before giving the sk_buff to the MAC hardware.
*
* Specifically, one should make absolutely sure that this function is
* called before TX completion of this packet can trigger. Otherwise
* the packet could potentially already be freed.
*
* @skb: A socket buffer.
*/
static inline void skb_tx_timestamp(struct sk_buff *skb)
{
// TODO: perform timestamp functionality here if needed
}
#endif /* _LINUX_SKBUFF_H */