summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@penguin.transmeta.com>2002-03-11 21:25:49 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-03-11 21:25:49 -0800
commitd9f2d50eabbb92ceef65221933651fcfb728c800 (patch)
tree6a72c96d24cbf025be8a1be2c9f3fbbccff476cd /include
parent0602954430012c56ed351ca92fbd52da4db8dd84 (diff)
parent04c1e5a1457257b3325e0510cebedebb9b054a19 (diff)
Merge master.kernel.org:/home/davem/BK/net-2.5
into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
Diffstat (limited to 'include')
-rw-r--r--include/linux/if_ec.h1
-rw-r--r--include/linux/if_pppox.h1
-rw-r--r--include/linux/if_vlan.h155
-rw-r--r--include/linux/ip.h11
-rw-r--r--include/linux/netdevice.h12
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h5
-rw-r--r--include/net/ip.h3
-rw-r--r--include/net/sock.h36
-rw-r--r--include/net/tcp.h41
-rw-r--r--include/net/udp.h3
10 files changed, 120 insertions, 148 deletions
diff --git a/include/linux/if_ec.h b/include/linux/if_ec.h
index 8e2e4a1fe424..b5ee8425325f 100644
--- a/include/linux/if_ec.h
+++ b/include/linux/if_ec.h
@@ -53,6 +53,7 @@ struct econet_opt
unsigned char port;
unsigned char station;
unsigned char net;
+ unsigned short num;
};
#define ec_sk(__sk) ((struct econet_opt *)(__sk)->protinfo)
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 64b16b277e3c..9d2206b1d06f 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -127,6 +127,7 @@ struct pppox_opt {
union {
struct pppoe_opt pppoe;
} proto;
+ unsigned short num;
};
#define pppoe_dev proto.pppoe.dev
#define pppoe_pa proto.pppoe.pa
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d1d8425b181c..99d7f1663f30 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -52,70 +52,16 @@ struct vlan_hdr {
unsigned short h_vlan_encapsulated_proto; /* packet type ID field (or len) */
};
-/* Find a VLAN device by the MAC address of it's Ethernet device, and
- * it's VLAN ID. The default configuration is to have VLAN's scope
- * to be box-wide, so the MAC will be ignored. The mac will only be
- * looked at if we are configured to have a seperate set of VLANs per
- * each MAC addressable interface. Note that this latter option does
- * NOT follow the spec for VLANs, but may be useful for doing very
- * large quantities of VLAN MUX/DEMUX onto FrameRelay or ATM PVCs.
- */
-struct net_device *find_802_1Q_vlan_dev(struct net_device* real_dev,
- unsigned short VID); /* vlan.c */
+#define VLAN_VID_MASK 0xfff
/* found in af_inet.c */
extern int (*vlan_ioctl_hook)(unsigned long arg);
-/* found in vlan_dev.c */
-struct net_device_stats* vlan_dev_get_stats(struct net_device* dev);
-int vlan_dev_rebuild_header(struct sk_buff *skb);
-int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type* ptype);
-int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
- unsigned short type, void *daddr, void *saddr,
- unsigned len);
-int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
-int vlan_dev_change_mtu(struct net_device *dev, int new_mtu);
-int vlan_dev_set_mac_address(struct net_device *dev, void* addr);
-int vlan_dev_open(struct net_device* dev);
-int vlan_dev_stop(struct net_device* dev);
-int vlan_dev_init(struct net_device* dev);
-void vlan_dev_destruct(struct net_device* dev);
-void vlan_dev_copy_and_sum(struct sk_buff *dest, unsigned char *src,
- int length, int base);
-int vlan_dev_set_ingress_priority(char* dev_name, __u32 skb_prio, short vlan_prio);
-int vlan_dev_set_egress_priority(char* dev_name, __u32 skb_prio, short vlan_prio);
-int vlan_dev_set_vlan_flag(char* dev_name, __u32 flag, short flag_val);
-
-/* VLAN multicast stuff */
-/* Delete all of the MC list entries from this vlan device. Also deals
- * with the underlying device...
- */
-void vlan_flush_mc_list(struct net_device* dev);
-/* copy the mc_list into the vlan_info structure. */
-void vlan_copy_mc_list(struct dev_mc_list* mc_list, struct vlan_dev_info* vlan_info);
-/** dmi is a single entry into a dev_mc_list, a single node. mc_list is
- * an entire list, and we'll iterate through it.
- */
-int vlan_should_add_mc(struct dev_mc_list *dmi, struct dev_mc_list *mc_list);
-/** Taken from Gleb + Lennert's VLAN code, and modified... */
-void vlan_dev_set_multicast_list(struct net_device *vlan_dev);
-
-int vlan_collection_add_vlan(struct vlan_collection* vc, unsigned short vlan_id,
- unsigned short flags);
-int vlan_collection_remove_vlan(struct vlan_collection* vc,
- struct net_device* vlan_dev);
-int vlan_collection_remove_vlan_id(struct vlan_collection* vc, unsigned short vlan_id);
-
-/* found in vlan.c */
-/* Our listing of VLAN group(s) */
-extern struct vlan_group* p802_1Q_vlan_list;
-
#define VLAN_NAME "vlan"
/* if this changes, algorithm will have to be reworked because this
* depends on completely exhausting the VLAN identifier space. Thus
- * it gives constant time look-up, but it many cases it wastes memory.
+ * it gives constant time look-up, but in many cases it wastes memory.
*/
#define VLAN_GROUP_ARRAY_LEN 4096
@@ -170,56 +116,73 @@ struct vlan_dev_info {
/* inline functions */
-/* Used in vlan_skb_recv */
-static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
+static inline struct net_device_stats *vlan_dev_get_stats(struct net_device *dev)
{
- if (VLAN_DEV_INFO(skb->dev)->flags & 1) {
- skb = skb_share_check(skb, GFP_ATOMIC);
- if (skb) {
- /* Lifted from Gleb's VLAN code... */
- memmove(skb->data - ETH_HLEN,
- skb->data - VLAN_ETH_HLEN, 12);
- skb->mac.raw += VLAN_HLEN;
- }
- }
-
- return skb;
+ return &(VLAN_DEV_INFO(dev)->dev_stats);
}
-static inline unsigned short vlan_dev_get_egress_qos_mask(struct net_device* dev,
- struct sk_buff* skb)
+static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
+ unsigned short vlan_tag)
{
- struct vlan_priority_tci_mapping *mp =
- VLAN_DEV_INFO(dev)->egress_priority_map[(skb->priority & 0xF)];
-
- while (mp) {
- if (mp->priority == skb->priority) {
- return mp->vlan_qos; /* This should already be shifted to mask
- * correctly with the VLAN's TCI
- */
- }
- mp = mp->next;
- }
- return 0;
-}
+ struct vlan_dev_info *vip = VLAN_DEV_INFO(dev);
-static inline int vlan_dmi_equals(struct dev_mc_list *dmi1,
- struct dev_mc_list *dmi2)
-{
- return ((dmi1->dmi_addrlen == dmi2->dmi_addrlen) &&
- (memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0));
+ return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7];
}
-static inline void vlan_destroy_mc_list(struct dev_mc_list *mc_list)
+/* VLAN tx hw acceleration helpers. */
+struct vlan_skb_tx_cookie {
+ u32 magic;
+ u32 vlan_tag;
+};
+
+#define VLAN_TX_COOKIE_MAGIC 0x564c414e /* "VLAN" in ascii. */
+#define VLAN_TX_SKB_CB(__skb) ((struct vlan_skb_tx_cookie *)&((__skb)->cb[0]))
+#define vlan_tx_tag_present(__skb) \
+ (VLAN_TX_SKB_CB(__skb)->magic == VLAN_TX_COOKIE_MAGIC)
+#define vlan_tx_tag_get(__skb) (VLAN_TX_SKB_CB(__skb)->vlan_tag)
+
+/* VLAN rx hw acceleration helper. This acts like netif_rx(). */
+static inline int vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
+ unsigned short vlan_tag)
{
- struct dev_mc_list *dmi = mc_list;
- struct dev_mc_list *next;
+ struct net_device_stats *stats;
- while(dmi) {
- next = dmi->next;
- kfree(dmi);
- dmi = next;
+ skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK];
+ if (skb->dev == NULL) {
+ kfree_skb(skb);
+
+ /* Not NET_RX_DROP, this is not being dropped
+ * due to congestion.
+ */
+ return 0;
}
+
+ skb->dev->last_rx = jiffies;
+
+ stats = vlan_dev_get_stats(skb->dev);
+ stats->rx_packets++;
+ stats->rx_bytes += skb->len;
+
+ skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tag);
+ switch (skb->pkt_type) {
+ case PACKET_BROADCAST:
+ break;
+
+ case PACKET_MULTICAST:
+ stats->multicast++;
+ break;
+
+ case PACKET_OTHERHOST:
+ /* Our lower layer thinks this is not local, let's make sure.
+ * This allows the VLAN to have a different MAC than the underlying
+ * device, and still route correctly.
+ */
+ if (!memcmp(skb->mac.ethernet->h_dest, skb->dev->dev_addr, ETH_ALEN))
+ skb->pkt_type = PACKET_HOST;
+ break;
+ };
+
+ return netif_rx(skb);
}
#endif /* __KERNEL__ */
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 97e388ade261..3ba8e804b0d8 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -116,17 +116,24 @@ struct ip_options {
#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
struct inet_opt {
+ /* Socket demultiplex comparisons on incoming packets. */
+ __u32 daddr; /* Foreign IPv4 addr */
+ __u32 rcv_saddr; /* Bound local IPv4 addr */
+ __u16 dport; /* Destination port */
+ __u16 num; /* Local port */
+ __u32 saddr; /* Sending source */
int ttl; /* TTL setting */
int tos; /* TOS */
unsigned cmsg_flags;
struct ip_options *opt;
+ __u16 sport; /* Source port */
unsigned char hdrincl; /* Include headers ? */
__u8 mc_ttl; /* Multicasting TTL */
__u8 mc_loop; /* Loopback */
+ __u8 pmtudisc;
+ __u16 id; /* ID counter for DF pkts */
unsigned recverr : 1,
freebind : 1;
- __u16 id; /* ID counter for DF pkts */
- __u8 pmtudisc;
int mc_index; /* Multicast device index */
__u32 mc_addr;
struct ip_mc_socklist *mc_list; /* Group array */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8096e640c416..178f6a5a0fe6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -40,6 +40,7 @@
#endif
struct divert_blk;
+struct vlan_group;
#define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev
functions are available. */
@@ -357,6 +358,10 @@ struct net_device
#define NETIF_F_DYNALLOC 16 /* Self-dectructable device. */
#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
+#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
+#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
+#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
+#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
/* Called after device is detached from network. */
void (*uninit)(struct net_device *dev);
@@ -398,6 +403,13 @@ struct net_device
#define HAVE_TX_TIMEOUT
void (*tx_timeout) (struct net_device *dev);
+ void (*vlan_rx_register)(struct net_device *dev,
+ struct vlan_group *grp);
+ void (*vlan_rx_add_vid)(struct net_device *dev,
+ unsigned short vid);
+ void (*vlan_rx_kill_vid)(struct net_device *dev,
+ unsigned short vid);
+
int (*hard_header_parse)(struct sk_buff *skb,
unsigned char *haddr);
int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index f0e8b9927eab..107cce0c67a3 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -82,10 +82,7 @@ struct ip_conntrack_expect
#endif
#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
-
-#if defined(CONFIG_IP_NF_IRC) || defined(CONFIG_IP_NF_IRC_MODULE)
#include <linux/netfilter_ipv4/ip_conntrack_irc.h>
-#endif
struct ip_conntrack
{
@@ -125,9 +122,7 @@ struct ip_conntrack
union {
struct ip_ct_ftp ct_ftp_info;
-#if defined(CONFIG_IP_NF_IRC) || defined(CONFIG_IP_NF_IRC_MODULE)
struct ip_ct_irc ct_irc_info;
-#endif
} help;
#ifdef CONFIG_IP_NF_NAT_NEEDED
diff --git a/include/net/ip.h b/include/net/ip.h
index 705fed205357..e2da92393da8 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -197,7 +197,8 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
* does not change, they drop every other packet in
* a TCP stream using header compression.
*/
- iph->id = (sk && sk->daddr) ? htons(inet_sk(sk)->id++) : 0;
+ iph->id = (sk && inet_sk(sk)->daddr) ?
+ htons(inet_sk(sk)->id++) : 0;
} else
__ip_select_ident(iph, dst);
}
diff --git a/include/net/sock.h b/include/net/sock.h
index 898193d61fc3..d50815f55ff3 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -83,28 +83,22 @@ do { spin_lock_init(&((__sk)->lock.slock)); \
} while(0);
struct sock {
- /* Socket demultiplex comparisons on incoming packets. */
- __u32 daddr; /* Foreign IPv4 addr */
- __u32 rcv_saddr; /* Bound local IPv4 addr */
- __u16 dport; /* Destination port */
- unsigned short num; /* Local port */
- int bound_dev_if; /* Bound device index if != 0 */
-
+ /* Begin of struct sock/struct tcp_tw_bucket shared layout */
+ volatile unsigned char state, /* Connection state */
+ zapped; /* ax25 & ipx means !linked */
+ unsigned char reuse; /* SO_REUSEADDR setting */
+ unsigned char shutdown;
+ int bound_dev_if; /* Bound device index if != 0 */
/* Main hash linkage for various protocol lookup tables. */
struct sock *next;
struct sock **pprev;
struct sock *bind_next;
struct sock **bind_pprev;
-
- volatile unsigned char state, /* Connection state */
- zapped; /* In ax25 & ipx means not linked */
- __u16 sport; /* Source port */
-
- unsigned short family; /* Address family */
- unsigned char reuse; /* SO_REUSEADDR setting */
- unsigned char shutdown;
atomic_t refcnt; /* Reference count */
-
+ unsigned short family; /* Address family */
+ /* End of struct sock/struct tcp_tw_bucket shared layout */
+ unsigned char use_write_queue;
+ unsigned char userlocks;
socket_lock_t lock; /* Synchronizer... */
int rcvbuf; /* Size of receive buffer in bytes */
@@ -118,7 +112,6 @@ struct sock {
atomic_t omem_alloc; /* "o" is "option" or "other" */
int wmem_queued; /* Persistent queue size */
int forward_alloc; /* Space allocated forward. */
- __u32 saddr; /* Sending source */
unsigned int allocation; /* Allocation mode */
int sndbuf; /* Size of send buffer in bytes */
struct sock *prev;
@@ -137,9 +130,7 @@ struct sock {
bsdism;
unsigned char debug;
unsigned char rcvtstamp;
- unsigned char use_write_queue;
- unsigned char userlocks;
- /* Hole of 3 bytes. Try to pack. */
+ /* Hole of 1 byte. Try to pack. */
int route_caps;
int proc;
unsigned long lingertime;
@@ -759,16 +750,13 @@ static inline void sk_wake_async(struct sock *sk, int how, int band)
#define SOCK_MIN_SNDBUF 2048
#define SOCK_MIN_RCVBUF 256
-/* Must be less or equal SOCK_MIN_SNDBUF */
-#define SOCK_MIN_WRITE_SPACE SOCK_MIN_SNDBUF
/*
* Default write policy as shown to user space via poll/select/SIGIO
- * Kernel internally doesn't use the MIN_WRITE_SPACE threshold.
*/
static inline int sock_writeable(struct sock *sk)
{
- return sock_wspace(sk) >= SOCK_MIN_WRITE_SPACE;
+ return atomic_read(&sk->wmem_alloc) < (sk->sndbuf / 2);
}
static inline int gfp_any(void)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index bccbac72b43e..c45fc3e12845 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -53,7 +53,7 @@ struct tcp_ehash_bucket {
* 2) If all sockets have sk->reuse set, and none of them are in
* TCP_LISTEN state, the port may be shared.
* Failing that, goto test 3.
- * 3) If all sockets are bound to a specific sk->rcv_saddr local
+ * 3) If all sockets are bound to a specific inet_sk(sk)->rcv_saddr local
* address, and none of them are the same, the port may be
* shared.
* Failing this, the port cannot be shared.
@@ -162,23 +162,26 @@ struct tcp_tw_bucket {
* XXX Yes I know this is gross, but I'd have to edit every single
* XXX networking file if I created a "struct sock_header". -DaveM
*/
- __u32 daddr;
- __u32 rcv_saddr;
- __u16 dport;
- unsigned short num;
+ volatile unsigned char state, /* Connection state */
+ substate; /* "zapped" -> "substate" */
+ unsigned char reuse; /* SO_REUSEADDR setting */
+ unsigned char rcv_wscale; /* also TW bucket specific */
int bound_dev_if;
+ /* Main hash linkage for various protocol lookup tables. */
struct sock *next;
struct sock **pprev;
struct sock *bind_next;
struct sock **bind_pprev;
- unsigned char state,
- substate; /* "zapped" is replaced with "substate" */
- __u16 sport;
- unsigned short family;
- unsigned char reuse,
- rcv_wscale; /* It is also TW bucket specific */
atomic_t refcnt;
-
+ unsigned short family;
+ /* End of struct sock/struct tcp_tw_bucket shared layout */
+ __u16 sport;
+ /* Socket demultiplex comparisons on incoming packets. */
+ /* these five are in inet_opt */
+ __u32 daddr;
+ __u32 rcv_saddr;
+ __u16 dport;
+ __u16 num;
/* And these are ours. */
int hashent;
int timeout;
@@ -236,20 +239,20 @@ extern void tcp_tw_deschedule(struct tcp_tw_bucket *tw);
__u64 __name = (((__u64)(__daddr))<<32)|((__u64)(__saddr));
#endif /* __BIG_ENDIAN */
#define TCP_IPV4_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
- (((*((__u64 *)&((__sk)->daddr)))== (__cookie)) && \
- ((*((__u32 *)&((__sk)->dport)))== (__ports)) && \
+ (((*((__u64 *)&(inet_sk(__sk)->daddr)))== (__cookie)) && \
+ ((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \
(!((__sk)->bound_dev_if) || ((__sk)->bound_dev_if == (__dif))))
#else /* 32-bit arch */
#define TCP_V4_ADDR_COOKIE(__name, __saddr, __daddr)
#define TCP_IPV4_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
- (((__sk)->daddr == (__saddr)) && \
- ((__sk)->rcv_saddr == (__daddr)) && \
- ((*((__u32 *)&((__sk)->dport)))== (__ports)) && \
+ ((inet_sk(__sk)->daddr == (__saddr)) && \
+ (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
+ ((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \
(!((__sk)->bound_dev_if) || ((__sk)->bound_dev_if == (__dif))))
#endif /* 64-bit arch */
#define TCP_IPV6_MATCH(__sk, __saddr, __daddr, __ports, __dif) \
- (((*((__u32 *)&((__sk)->dport)))== (__ports)) && \
+ (((*((__u32 *)&(inet_sk(__sk)->dport)))== (__ports)) && \
((__sk)->family == AF_INET6) && \
!ipv6_addr_cmp(&inet6_sk(__sk)->daddr, (__saddr)) && \
!ipv6_addr_cmp(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
@@ -263,7 +266,7 @@ static __inline__ int tcp_lhashfn(unsigned short num)
static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
{
- return tcp_lhashfn(sk->num);
+ return tcp_lhashfn(inet_sk(sk)->num);
}
#define MAX_TCP_HEADER (128 + MAX_HEADER)
diff --git a/include/net/udp.h b/include/net/udp.h
index c7049c5b4bf8..15f7626f7dcd 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -23,6 +23,7 @@
#define _UDP_H
#include <linux/udp.h>
+#include <linux/ip.h>
#include <net/sock.h>
#define UDP_HTABLE_SIZE 128
@@ -41,7 +42,7 @@ static inline int udp_lport_inuse(u16 num)
struct sock *sk = udp_hash[num & (UDP_HTABLE_SIZE - 1)];
for(; sk != NULL; sk = sk->next) {
- if(sk->num == num)
+ if (inet_sk(sk)->num == num)
return 1;
}
return 0;