diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 11:00:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 11:00:01 -0400 |
commit | 199f4c9f76fd8b030405abddf294e771f888de03 (patch) | |
tree | ee4f104a7562e1fd76882bc40f2de7d90812e1df /include | |
parent | 37224470c8c6d90a4062e76a08d4dc1fcf91fc89 (diff) | |
parent | ca6bb5d7ab22ac79f608fe6cbc6b12de6a5a19f0 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
[NET]: Require CAP_NET_ADMIN to create tuntap devices.
[NET]: fix net-core kernel-doc
[TCP]: Move inclusion of <linux/dmaengine.h> to correct place in <linux/tcp.h>
[IPSEC]: Handle GSO packets
[NET]: Added GSO toggle
[NET]: Add software TSOv4
[NET]: Add generic segmentation offload
[NET]: Merge TSO/UFO fields in sk_buff
[NET]: Prevent transmission after dev_deactivate
[IPV6] ADDRCONF: Fix default source address selection without CONFIG_IPV6_PRIVACY
[IPV6]: Fix source address selection.
[NET]: Avoid allocating skb in skb_pad
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ethtool.h | 2 | ||||
-rw-r--r-- | include/linux/netdevice.h | 23 | ||||
-rw-r--r-- | include/linux/skbuff.h | 26 | ||||
-rw-r--r-- | include/linux/tcp.h | 2 | ||||
-rw-r--r-- | include/net/protocol.h | 1 | ||||
-rw-r--r-- | include/net/sock.h | 5 | ||||
-rw-r--r-- | include/net/tcp.h | 6 |
7 files changed, 50 insertions, 15 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index cf2abeca92..c6310aef5a 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -411,6 +411,8 @@ struct ethtool_ops { | |||
411 | #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ | 411 | #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ |
412 | #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ | 412 | #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ |
413 | #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ | 413 | #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ |
414 | #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ | ||
415 | #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ | ||
414 | 416 | ||
415 | /* compatibility with older code */ | 417 | /* compatibility with older code */ |
416 | #define SPARC_ETH_GSET ETHTOOL_GSET | 418 | #define SPARC_ETH_GSET ETHTOOL_GSET |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cead6be467..bc747e5d71 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -308,9 +308,13 @@ struct net_device | |||
308 | #define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ | 308 | #define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */ |
309 | #define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ | 309 | #define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */ |
310 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ | 310 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ |
311 | #define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */ | 311 | #define NETIF_F_GSO 2048 /* Enable software GSO. */ |
312 | #define NETIF_F_LLTX 4096 /* LockLess TX */ | 312 | #define NETIF_F_LLTX 4096 /* LockLess TX */ |
313 | #define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/ | 313 | |
314 | /* Segmentation offload features */ | ||
315 | #define NETIF_F_GSO_SHIFT 16 | ||
316 | #define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) | ||
317 | #define NETIF_F_UFO (SKB_GSO_UDPV4 << NETIF_F_GSO_SHIFT) | ||
314 | 318 | ||
315 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) | 319 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) |
316 | #define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) | 320 | #define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) |
@@ -402,6 +406,9 @@ struct net_device | |||
402 | struct list_head qdisc_list; | 406 | struct list_head qdisc_list; |
403 | unsigned long tx_queue_len; /* Max frames per queue allowed */ | 407 | unsigned long tx_queue_len; /* Max frames per queue allowed */ |
404 | 408 | ||
409 | /* Partially transmitted GSO packet. */ | ||
410 | struct sk_buff *gso_skb; | ||
411 | |||
405 | /* ingress path synchronizer */ | 412 | /* ingress path synchronizer */ |
406 | spinlock_t ingress_lock; | 413 | spinlock_t ingress_lock; |
407 | struct Qdisc *qdisc_ingress; | 414 | struct Qdisc *qdisc_ingress; |
@@ -536,6 +543,7 @@ struct packet_type { | |||
536 | struct net_device *, | 543 | struct net_device *, |
537 | struct packet_type *, | 544 | struct packet_type *, |
538 | struct net_device *); | 545 | struct net_device *); |
546 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg); | ||
539 | void *af_packet_priv; | 547 | void *af_packet_priv; |
540 | struct list_head list; | 548 | struct list_head list; |
541 | }; | 549 | }; |
@@ -686,7 +694,8 @@ extern int dev_change_name(struct net_device *, char *); | |||
686 | extern int dev_set_mtu(struct net_device *, int); | 694 | extern int dev_set_mtu(struct net_device *, int); |
687 | extern int dev_set_mac_address(struct net_device *, | 695 | extern int dev_set_mac_address(struct net_device *, |
688 | struct sockaddr *); | 696 | struct sockaddr *); |
689 | extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); | 697 | extern int dev_hard_start_xmit(struct sk_buff *skb, |
698 | struct net_device *dev); | ||
690 | 699 | ||
691 | extern void dev_init(void); | 700 | extern void dev_init(void); |
692 | 701 | ||
@@ -960,6 +969,7 @@ extern int netdev_max_backlog; | |||
960 | extern int weight_p; | 969 | extern int weight_p; |
961 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); | 970 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); |
962 | extern int skb_checksum_help(struct sk_buff *skb, int inward); | 971 | extern int skb_checksum_help(struct sk_buff *skb, int inward); |
972 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg); | ||
963 | #ifdef CONFIG_BUG | 973 | #ifdef CONFIG_BUG |
964 | extern void netdev_rx_csum_fault(struct net_device *dev); | 974 | extern void netdev_rx_csum_fault(struct net_device *dev); |
965 | #else | 975 | #else |
@@ -979,6 +989,13 @@ extern void dev_seq_stop(struct seq_file *seq, void *v); | |||
979 | 989 | ||
980 | extern void linkwatch_run_queue(void); | 990 | extern void linkwatch_run_queue(void); |
981 | 991 | ||
992 | static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) | ||
993 | { | ||
994 | int feature = skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT; | ||
995 | return skb_shinfo(skb)->gso_size && | ||
996 | (dev->features & feature) != feature; | ||
997 | } | ||
998 | |||
982 | #endif /* __KERNEL__ */ | 999 | #endif /* __KERNEL__ */ |
983 | 1000 | ||
984 | #endif /* _LINUX_DEV_H */ | 1001 | #endif /* _LINUX_DEV_H */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 66f8819f95..16eef03ce0 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -134,9 +134,10 @@ struct skb_frag_struct { | |||
134 | struct skb_shared_info { | 134 | struct skb_shared_info { |
135 | atomic_t dataref; | 135 | atomic_t dataref; |
136 | unsigned short nr_frags; | 136 | unsigned short nr_frags; |
137 | unsigned short tso_size; | 137 | unsigned short gso_size; |
138 | unsigned short tso_segs; | 138 | /* Warning: this field is not always filled in (UFO)! */ |
139 | unsigned short ufo_size; | 139 | unsigned short gso_segs; |
140 | unsigned short gso_type; | ||
140 | unsigned int ip6_frag_id; | 141 | unsigned int ip6_frag_id; |
141 | struct sk_buff *frag_list; | 142 | struct sk_buff *frag_list; |
142 | skb_frag_t frags[MAX_SKB_FRAGS]; | 143 | skb_frag_t frags[MAX_SKB_FRAGS]; |
@@ -168,6 +169,11 @@ enum { | |||
168 | SKB_FCLONE_CLONE, | 169 | SKB_FCLONE_CLONE, |
169 | }; | 170 | }; |
170 | 171 | ||
172 | enum { | ||
173 | SKB_GSO_TCPV4 = 1 << 0, | ||
174 | SKB_GSO_UDPV4 = 1 << 1, | ||
175 | }; | ||
176 | |||
171 | /** | 177 | /** |
172 | * struct sk_buff - socket buffer | 178 | * struct sk_buff - socket buffer |
173 | * @next: Next buffer in list | 179 | * @next: Next buffer in list |
@@ -209,6 +215,8 @@ enum { | |||
209 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c | 215 | * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c |
210 | * @tc_index: Traffic control index | 216 | * @tc_index: Traffic control index |
211 | * @tc_verd: traffic control verdict | 217 | * @tc_verd: traffic control verdict |
218 | * @dma_cookie: a cookie to one of several possible DMA operations | ||
219 | * done by skb DMA functions | ||
212 | * @secmark: security marking | 220 | * @secmark: security marking |
213 | */ | 221 | */ |
214 | 222 | ||
@@ -345,7 +353,7 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, | |||
345 | extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, | 353 | extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, |
346 | int newheadroom, int newtailroom, | 354 | int newheadroom, int newtailroom, |
347 | gfp_t priority); | 355 | gfp_t priority); |
348 | extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); | 356 | extern int skb_pad(struct sk_buff *skb, int pad); |
349 | #define dev_kfree_skb(a) kfree_skb(a) | 357 | #define dev_kfree_skb(a) kfree_skb(a) |
350 | extern void skb_over_panic(struct sk_buff *skb, int len, | 358 | extern void skb_over_panic(struct sk_buff *skb, int len, |
351 | void *here); | 359 | void *here); |
@@ -1122,16 +1130,15 @@ static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) | |||
1122 | * | 1130 | * |
1123 | * Pads up a buffer to ensure the trailing bytes exist and are | 1131 | * Pads up a buffer to ensure the trailing bytes exist and are |
1124 | * blanked. If the buffer already contains sufficient data it | 1132 | * blanked. If the buffer already contains sufficient data it |
1125 | * is untouched. Returns the buffer, which may be a replacement | 1133 | * is untouched. Otherwise it is extended. Returns zero on |
1126 | * for the original, or NULL for out of memory - in which case | 1134 | * success. The skb is freed on error. |
1127 | * the original buffer is still freed. | ||
1128 | */ | 1135 | */ |
1129 | 1136 | ||
1130 | static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len) | 1137 | static inline int skb_padto(struct sk_buff *skb, unsigned int len) |
1131 | { | 1138 | { |
1132 | unsigned int size = skb->len; | 1139 | unsigned int size = skb->len; |
1133 | if (likely(size >= len)) | 1140 | if (likely(size >= len)) |
1134 | return skb; | 1141 | return 0; |
1135 | return skb_pad(skb, len-size); | 1142 | return skb_pad(skb, len-size); |
1136 | } | 1143 | } |
1137 | 1144 | ||
@@ -1292,6 +1299,7 @@ extern void skb_split(struct sk_buff *skb, | |||
1292 | struct sk_buff *skb1, const u32 len); | 1299 | struct sk_buff *skb1, const u32 len); |
1293 | 1300 | ||
1294 | extern void skb_release_data(struct sk_buff *skb); | 1301 | extern void skb_release_data(struct sk_buff *skb); |
1302 | extern struct sk_buff *skb_segment(struct sk_buff *skb, int sg); | ||
1295 | 1303 | ||
1296 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | 1304 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, |
1297 | int len, void *buffer) | 1305 | int len, void *buffer) |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 420a689c3f..8ebf497907 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #define _LINUX_TCP_H | 18 | #define _LINUX_TCP_H |
19 | 19 | ||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/dmaengine.h> | ||
22 | #include <asm/byteorder.h> | 21 | #include <asm/byteorder.h> |
23 | 22 | ||
24 | struct tcphdr { | 23 | struct tcphdr { |
@@ -161,6 +160,7 @@ struct tcp_info | |||
161 | #ifdef __KERNEL__ | 160 | #ifdef __KERNEL__ |
162 | 161 | ||
163 | #include <linux/skbuff.h> | 162 | #include <linux/skbuff.h> |
163 | #include <linux/dmaengine.h> | ||
164 | #include <net/sock.h> | 164 | #include <net/sock.h> |
165 | #include <net/inet_connection_sock.h> | 165 | #include <net/inet_connection_sock.h> |
166 | #include <net/inet_timewait_sock.h> | 166 | #include <net/inet_timewait_sock.h> |
diff --git a/include/net/protocol.h b/include/net/protocol.h index bcaee39bd2..3b6dc15c68 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
@@ -36,6 +36,7 @@ | |||
36 | struct net_protocol { | 36 | struct net_protocol { |
37 | int (*handler)(struct sk_buff *skb); | 37 | int (*handler)(struct sk_buff *skb); |
38 | void (*err_handler)(struct sk_buff *skb, u32 info); | 38 | void (*err_handler)(struct sk_buff *skb, u32 info); |
39 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg); | ||
39 | int no_policy; | 40 | int no_policy; |
40 | }; | 41 | }; |
41 | 42 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index d10dfecb6c..2d8d6adf16 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1030,9 +1030,13 @@ static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) | |||
1030 | { | 1030 | { |
1031 | __sk_dst_set(sk, dst); | 1031 | __sk_dst_set(sk, dst); |
1032 | sk->sk_route_caps = dst->dev->features; | 1032 | sk->sk_route_caps = dst->dev->features; |
1033 | if (sk->sk_route_caps & NETIF_F_GSO) | ||
1034 | sk->sk_route_caps |= NETIF_F_TSO; | ||
1033 | if (sk->sk_route_caps & NETIF_F_TSO) { | 1035 | if (sk->sk_route_caps & NETIF_F_TSO) { |
1034 | if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len) | 1036 | if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len) |
1035 | sk->sk_route_caps &= ~NETIF_F_TSO; | 1037 | sk->sk_route_caps &= ~NETIF_F_TSO; |
1038 | else | ||
1039 | sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; | ||
1036 | } | 1040 | } |
1037 | } | 1041 | } |
1038 | 1042 | ||
@@ -1265,6 +1269,7 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | |||
1265 | * sk_eat_skb - Release a skb if it is no longer needed | 1269 | * sk_eat_skb - Release a skb if it is no longer needed |
1266 | * @sk: socket to eat this skb from | 1270 | * @sk: socket to eat this skb from |
1267 | * @skb: socket buffer to eat | 1271 | * @skb: socket buffer to eat |
1272 | * @copied_early: flag indicating whether DMA operations copied this data early | ||
1268 | * | 1273 | * |
1269 | * This routine must be called with interrupts disabled or with the socket | 1274 | * This routine must be called with interrupts disabled or with the socket |
1270 | * locked so that the sk_buff queue operation is ok. | 1275 | * locked so that the sk_buff queue operation is ok. |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 5f4eb5c796..ca3d38dfc0 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -569,13 +569,13 @@ struct tcp_skb_cb { | |||
569 | */ | 569 | */ |
570 | static inline int tcp_skb_pcount(const struct sk_buff *skb) | 570 | static inline int tcp_skb_pcount(const struct sk_buff *skb) |
571 | { | 571 | { |
572 | return skb_shinfo(skb)->tso_segs; | 572 | return skb_shinfo(skb)->gso_segs; |
573 | } | 573 | } |
574 | 574 | ||
575 | /* This is valid iff tcp_skb_pcount() > 1. */ | 575 | /* This is valid iff tcp_skb_pcount() > 1. */ |
576 | static inline int tcp_skb_mss(const struct sk_buff *skb) | 576 | static inline int tcp_skb_mss(const struct sk_buff *skb) |
577 | { | 577 | { |
578 | return skb_shinfo(skb)->tso_size; | 578 | return skb_shinfo(skb)->gso_size; |
579 | } | 579 | } |
580 | 580 | ||
581 | static inline void tcp_dec_pcount_approx(__u32 *count, | 581 | static inline void tcp_dec_pcount_approx(__u32 *count, |
@@ -1086,6 +1086,8 @@ extern struct request_sock_ops tcp_request_sock_ops; | |||
1086 | 1086 | ||
1087 | extern int tcp_v4_destroy_sock(struct sock *sk); | 1087 | extern int tcp_v4_destroy_sock(struct sock *sk); |
1088 | 1088 | ||
1089 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg); | ||
1090 | |||
1089 | #ifdef CONFIG_PROC_FS | 1091 | #ifdef CONFIG_PROC_FS |
1090 | extern int tcp4_proc_init(void); | 1092 | extern int tcp4_proc_init(void); |
1091 | extern void tcp4_proc_exit(void); | 1093 | extern void tcp4_proc_exit(void); |