[NETFILTER]: reduce netfilter sk_buff enlargement
As discussed at netconf'05, we're trying to save every bit in sk_buff. The patch below makes sk_buff 8 bytes smaller. I did some basic testing on my notebook and it seems to work. The only real in-tree user of nfcache was IPVS, who only needs a single bit. Unfortunately I couldn't find some other free bit in sk_buff to stuff that bit into, so I introduced a separate field for them. Maybe the IPVS guys can resolve that to further save space. Initially I wanted to shrink pkt_type to three bits (PACKET_HOST and alike are only 6 values defined), but unfortunately the bluetooth code overloads pkt_type :( The conntrack-event-api (out-of-tree) uses nfcache, but Rusty just came up with a way how to do it without any skb fields, so it's safe to remove it. - remove all never-implemented 'nfcache' code - don't have ipvs code abuse 'nfcache' field. currently get's their own compile-conditional skb->ipvs_property field. IPVS maintainers can decide to move this bit elswhere, but nfcache needs to die. - remove skb->nfcache field to save 4 bytes - move skb->nfctinfo into three unused bits to save further 4 bytes Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
bf3a46aa9b
commit
6869c4d8e0
27 changed files with 36 additions and 64 deletions
|
@ -21,10 +21,13 @@
|
|||
#define NF_STOP 5
|
||||
#define NF_MAX_VERDICT NF_STOP
|
||||
|
||||
/* only for userspace compatibility */
|
||||
#ifndef __KERNEL__
|
||||
/* Generic cache responses from hook functions.
|
||||
<= 0x2000 is used for protocol-flags. */
|
||||
#define NFC_UNKNOWN 0x4000
|
||||
#define NFC_ALTERED 0x8000
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/config.h>
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <linux/netfilter.h>
|
||||
|
||||
/* only for userspace compatibility */
|
||||
#ifndef __KERNEL__
|
||||
/* IP Cache bits. */
|
||||
/* Src IP address. */
|
||||
#define NFC_DN_SRC 0x0001
|
||||
|
@ -18,6 +20,7 @@
|
|||
#define NFC_DN_IF_IN 0x0004
|
||||
/* Output device. */
|
||||
#define NFC_DN_IF_OUT 0x0008
|
||||
#endif /* ! __KERNEL__ */
|
||||
|
||||
/* DECnet Hooks */
|
||||
/* After promisc drops, checksum checks. */
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <linux/config.h>
|
||||
#include <linux/netfilter.h>
|
||||
|
||||
/* only for userspace compatibility */
|
||||
#ifndef __KERNEL__
|
||||
/* IP Cache bits. */
|
||||
/* Src IP address. */
|
||||
#define NFC_IP_SRC 0x0001
|
||||
|
@ -35,6 +37,7 @@
|
|||
#define NFC_IP_DST_PT 0x0400
|
||||
/* Something else about the proto */
|
||||
#define NFC_IP_PROTO_UNKNOWN 0x2000
|
||||
#endif /* ! __KERNEL__ */
|
||||
|
||||
/* IP Hooks */
|
||||
/* After promisc drops, checksum checks. */
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <linux/netfilter.h>
|
||||
|
||||
/* only for userspace compatibility */
|
||||
#ifndef __KERNEL__
|
||||
/* IP Cache bits. */
|
||||
/* Src IP address. */
|
||||
#define NFC_IP6_SRC 0x0001
|
||||
|
@ -38,6 +40,7 @@
|
|||
#define NFC_IP6_DST_PT 0x0400
|
||||
/* Something else about the proto */
|
||||
#define NFC_IP6_PROTO_UNKNOWN 0x2000
|
||||
#endif /* ! __KERNEL__ */
|
||||
|
||||
|
||||
/* IP6 Hooks */
|
||||
|
|
|
@ -190,7 +190,6 @@ struct skb_shared_info {
|
|||
* @end: End pointer
|
||||
* @destructor: Destruct function
|
||||
* @nfmark: Can be used for communication between hooks
|
||||
* @nfcache: Cache info
|
||||
* @nfct: Associated connection, if any
|
||||
* @nfctinfo: Relationship of this skb to the connection
|
||||
* @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
|
||||
|
@ -252,17 +251,18 @@ struct sk_buff {
|
|||
__u8 local_df:1,
|
||||
cloned:1,
|
||||
ip_summed:2,
|
||||
nohdr:1;
|
||||
/* 3 bits spare */
|
||||
nohdr:1,
|
||||
nfctinfo:3;
|
||||
__u8 pkt_type;
|
||||
__be16 protocol;
|
||||
|
||||
void (*destructor)(struct sk_buff *skb);
|
||||
#ifdef CONFIG_NETFILTER
|
||||
__u32 nfmark;
|
||||
__u32 nfcache;
|
||||
__u32 nfctinfo;
|
||||
struct nf_conntrack *nfct;
|
||||
#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
|
||||
__u8 ipvs_property:1;
|
||||
#endif
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
struct nf_bridge_info *nf_bridge;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue