diff options
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index f89e7fd59a4c..d20d9e7a9bbd 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -169,6 +169,7 @@ struct skb_shared_hwtstamps { | |||
169 | * @software: generate software time stamp | 169 | * @software: generate software time stamp |
170 | * @in_progress: device driver is going to provide | 170 | * @in_progress: device driver is going to provide |
171 | * hardware time stamp | 171 | * hardware time stamp |
172 | * @prevent_sk_orphan: make sk reference available on driver level | ||
172 | * @flags: all shared_tx flags | 173 | * @flags: all shared_tx flags |
173 | * | 174 | * |
174 | * These flags are attached to packets as part of the | 175 | * These flags are attached to packets as part of the |
@@ -178,7 +179,8 @@ union skb_shared_tx { | |||
178 | struct { | 179 | struct { |
179 | __u8 hardware:1, | 180 | __u8 hardware:1, |
180 | software:1, | 181 | software:1, |
181 | in_progress:1; | 182 | in_progress:1, |
183 | prevent_sk_orphan:1; | ||
182 | }; | 184 | }; |
183 | __u8 flags; | 185 | __u8 flags; |
184 | }; | 186 | }; |
@@ -202,10 +204,11 @@ struct skb_shared_info { | |||
202 | */ | 204 | */ |
203 | atomic_t dataref; | 205 | atomic_t dataref; |
204 | 206 | ||
205 | skb_frag_t frags[MAX_SKB_FRAGS]; | ||
206 | /* Intermediate layers must ensure that destructor_arg | 207 | /* Intermediate layers must ensure that destructor_arg |
207 | * remains valid until skb destructor */ | 208 | * remains valid until skb destructor */ |
208 | void * destructor_arg; | 209 | void * destructor_arg; |
210 | /* must be last field, see pskb_expand_head() */ | ||
211 | skb_frag_t frags[MAX_SKB_FRAGS]; | ||
209 | }; | 212 | }; |
210 | 213 | ||
211 | /* We divide dataref into two halves. The higher 16 bits hold references | 214 | /* We divide dataref into two halves. The higher 16 bits hold references |
@@ -1414,12 +1417,14 @@ static inline int skb_network_offset(const struct sk_buff *skb) | |||
1414 | * | 1417 | * |
1415 | * Various parts of the networking layer expect at least 32 bytes of | 1418 | * Various parts of the networking layer expect at least 32 bytes of |
1416 | * headroom, you should not reduce this. | 1419 | * headroom, you should not reduce this. |
1417 | * With RPS, we raised NET_SKB_PAD to 64 so that get_rps_cpus() fetches span | 1420 | * |
1418 | * a 64 bytes aligned block to fit modern (>= 64 bytes) cache line sizes | 1421 | * Using max(32, L1_CACHE_BYTES) makes sense (especially with RPS) |
1422 | * to reduce average number of cache lines per packet. | ||
1423 | * get_rps_cpus() for example only access one 64 bytes aligned block : | ||
1419 | * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) | 1424 | * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) |
1420 | */ | 1425 | */ |
1421 | #ifndef NET_SKB_PAD | 1426 | #ifndef NET_SKB_PAD |
1422 | #define NET_SKB_PAD 64 | 1427 | #define NET_SKB_PAD max(32, L1_CACHE_BYTES) |
1423 | #endif | 1428 | #endif |
1424 | 1429 | ||
1425 | extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); | 1430 | extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); |
@@ -1931,6 +1936,36 @@ static inline ktime_t net_invalid_timestamp(void) | |||
1931 | return ktime_set(0, 0); | 1936 | return ktime_set(0, 0); |
1932 | } | 1937 | } |
1933 | 1938 | ||
1939 | extern void skb_timestamping_init(void); | ||
1940 | |||
1941 | #ifdef CONFIG_NETWORK_PHY_TIMESTAMPING | ||
1942 | |||
1943 | extern void skb_clone_tx_timestamp(struct sk_buff *skb); | ||
1944 | extern bool skb_defer_rx_timestamp(struct sk_buff *skb); | ||
1945 | |||
1946 | #else /* CONFIG_NETWORK_PHY_TIMESTAMPING */ | ||
1947 | |||
1948 | static inline void skb_clone_tx_timestamp(struct sk_buff *skb) | ||
1949 | { | ||
1950 | } | ||
1951 | |||
1952 | static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) | ||
1953 | { | ||
1954 | return false; | ||
1955 | } | ||
1956 | |||
1957 | #endif /* !CONFIG_NETWORK_PHY_TIMESTAMPING */ | ||
1958 | |||
1959 | /** | ||
1960 | * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps | ||
1961 | * | ||
1962 | * @skb: clone of the the original outgoing packet | ||
1963 | * @hwtstamps: hardware time stamps | ||
1964 | * | ||
1965 | */ | ||
1966 | void skb_complete_tx_timestamp(struct sk_buff *skb, | ||
1967 | struct skb_shared_hwtstamps *hwtstamps); | ||
1968 | |||
1934 | /** | 1969 | /** |
1935 | * skb_tstamp_tx - queue clone of skb with send time stamps | 1970 | * skb_tstamp_tx - queue clone of skb with send time stamps |
1936 | * @orig_skb: the original outgoing packet | 1971 | * @orig_skb: the original outgoing packet |
@@ -1945,6 +1980,28 @@ static inline ktime_t net_invalid_timestamp(void) | |||
1945 | extern void skb_tstamp_tx(struct sk_buff *orig_skb, | 1980 | extern void skb_tstamp_tx(struct sk_buff *orig_skb, |
1946 | struct skb_shared_hwtstamps *hwtstamps); | 1981 | struct skb_shared_hwtstamps *hwtstamps); |
1947 | 1982 | ||
1983 | static inline void sw_tx_timestamp(struct sk_buff *skb) | ||
1984 | { | ||
1985 | union skb_shared_tx *shtx = skb_tx(skb); | ||
1986 | if (shtx->software && !shtx->in_progress) | ||
1987 | skb_tstamp_tx(skb, NULL); | ||
1988 | } | ||
1989 | |||
1990 | /** | ||
1991 | * skb_tx_timestamp() - Driver hook for transmit timestamping | ||
1992 | * | ||
1993 | * Ethernet MAC Drivers should call this function in their hard_xmit() | ||
1994 | * function as soon as possible after giving the sk_buff to the MAC | ||
1995 | * hardware, but before freeing the sk_buff. | ||
1996 | * | ||
1997 | * @skb: A socket buffer. | ||
1998 | */ | ||
1999 | static inline void skb_tx_timestamp(struct sk_buff *skb) | ||
2000 | { | ||
2001 | skb_clone_tx_timestamp(skb); | ||
2002 | sw_tx_timestamp(skb); | ||
2003 | } | ||
2004 | |||
1948 | extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); | 2005 | extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); |
1949 | extern __sum16 __skb_checksum_complete(struct sk_buff *skb); | 2006 | extern __sum16 __skb_checksum_complete(struct sk_buff *skb); |
1950 | 2007 | ||
@@ -2132,7 +2189,8 @@ static inline bool skb_warn_if_lro(const struct sk_buff *skb) | |||
2132 | /* LRO sets gso_size but not gso_type, whereas if GSO is really | 2189 | /* LRO sets gso_size but not gso_type, whereas if GSO is really |
2133 | * wanted then gso_type will be set. */ | 2190 | * wanted then gso_type will be set. */ |
2134 | struct skb_shared_info *shinfo = skb_shinfo(skb); | 2191 | struct skb_shared_info *shinfo = skb_shinfo(skb); |
2135 | if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) { | 2192 | if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 && |
2193 | unlikely(shinfo->gso_type == 0)) { | ||
2136 | __skb_warn_lro_forwarding(skb); | 2194 | __skb_warn_lro_forwarding(skb); |
2137 | return true; | 2195 | return true; |
2138 | } | 2196 | } |