aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h70
1 files changed, 64 insertions, 6 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7cdfb4d52847..f5aa87e1e0c8 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -380,7 +380,10 @@ struct sk_buff {
380 kmemcheck_bitfield_begin(flags2); 380 kmemcheck_bitfield_begin(flags2);
381 __u16 queue_mapping:16; 381 __u16 queue_mapping:16;
382#ifdef CONFIG_IPV6_NDISC_NODETYPE 382#ifdef CONFIG_IPV6_NDISC_NODETYPE
383 __u8 ndisc_nodetype:2; 383 __u8 ndisc_nodetype:2,
384 deliver_no_wcard:1;
385#else
386 __u8 deliver_no_wcard:1;
384#endif 387#endif
385 kmemcheck_bitfield_end(flags2); 388 kmemcheck_bitfield_end(flags2);
386 389
@@ -501,7 +504,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
501 return __alloc_skb(size, priority, 1, -1); 504 return __alloc_skb(size, priority, 1, -1);
502} 505}
503 506
504extern int skb_recycle_check(struct sk_buff *skb, int skb_size); 507extern bool skb_recycle_check(struct sk_buff *skb, int skb_size);
505 508
506extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 509extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
507extern struct sk_buff *skb_clone(struct sk_buff *skb, 510extern struct sk_buff *skb_clone(struct sk_buff *skb,
@@ -1411,12 +1414,14 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1411 * 1414 *
1412 * Various parts of the networking layer expect at least 32 bytes of 1415 * Various parts of the networking layer expect at least 32 bytes of
1413 * headroom, you should not reduce this. 1416 * headroom, you should not reduce this.
1414 * With RPS, we raised NET_SKB_PAD to 64 so that get_rps_cpus() fetches span 1417 *
1415 * a 64 bytes aligned block to fit modern (>= 64 bytes) cache line sizes 1418 * Using max(32, L1_CACHE_BYTES) makes sense (especially with RPS)
1419 * to reduce average number of cache lines per packet.
1420 * get_rps_cpus() for example only access one 64 bytes aligned block :
1416 * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) 1421 * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
1417 */ 1422 */
1418#ifndef NET_SKB_PAD 1423#ifndef NET_SKB_PAD
1419#define NET_SKB_PAD 64 1424#define NET_SKB_PAD max(32, L1_CACHE_BYTES)
1420#endif 1425#endif
1421 1426
1422extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); 1427extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
@@ -1928,6 +1933,36 @@ static inline ktime_t net_invalid_timestamp(void)
1928 return ktime_set(0, 0); 1933 return ktime_set(0, 0);
1929} 1934}
1930 1935
1936extern void skb_timestamping_init(void);
1937
1938#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
1939
1940extern void skb_clone_tx_timestamp(struct sk_buff *skb);
1941extern bool skb_defer_rx_timestamp(struct sk_buff *skb);
1942
1943#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */
1944
1945static inline void skb_clone_tx_timestamp(struct sk_buff *skb)
1946{
1947}
1948
1949static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
1950{
1951 return false;
1952}
1953
1954#endif /* !CONFIG_NETWORK_PHY_TIMESTAMPING */
1955
1956/**
1957 * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps
1958 *
1959 * @skb: clone of the the original outgoing packet
1960 * @hwtstamps: hardware time stamps
1961 *
1962 */
1963void skb_complete_tx_timestamp(struct sk_buff *skb,
1964 struct skb_shared_hwtstamps *hwtstamps);
1965
1931/** 1966/**
1932 * skb_tstamp_tx - queue clone of skb with send time stamps 1967 * skb_tstamp_tx - queue clone of skb with send time stamps
1933 * @orig_skb: the original outgoing packet 1968 * @orig_skb: the original outgoing packet
@@ -1942,6 +1977,28 @@ static inline ktime_t net_invalid_timestamp(void)
1942extern void skb_tstamp_tx(struct sk_buff *orig_skb, 1977extern void skb_tstamp_tx(struct sk_buff *orig_skb,
1943 struct skb_shared_hwtstamps *hwtstamps); 1978 struct skb_shared_hwtstamps *hwtstamps);
1944 1979
1980static inline void sw_tx_timestamp(struct sk_buff *skb)
1981{
1982 union skb_shared_tx *shtx = skb_tx(skb);
1983 if (shtx->software && !shtx->in_progress)
1984 skb_tstamp_tx(skb, NULL);
1985}
1986
1987/**
1988 * skb_tx_timestamp() - Driver hook for transmit timestamping
1989 *
1990 * Ethernet MAC Drivers should call this function in their hard_xmit()
1991 * function as soon as possible after giving the sk_buff to the MAC
1992 * hardware, but before freeing the sk_buff.
1993 *
1994 * @skb: A socket buffer.
1995 */
1996static inline void skb_tx_timestamp(struct sk_buff *skb)
1997{
1998 skb_clone_tx_timestamp(skb);
1999 sw_tx_timestamp(skb);
2000}
2001
1945extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2002extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1946extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2003extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1947 2004
@@ -2129,7 +2186,8 @@ static inline bool skb_warn_if_lro(const struct sk_buff *skb)
2129 /* LRO sets gso_size but not gso_type, whereas if GSO is really 2186 /* LRO sets gso_size but not gso_type, whereas if GSO is really
2130 * wanted then gso_type will be set. */ 2187 * wanted then gso_type will be set. */
2131 struct skb_shared_info *shinfo = skb_shinfo(skb); 2188 struct skb_shared_info *shinfo = skb_shinfo(skb);
2132 if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) { 2189 if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 &&
2190 unlikely(shinfo->gso_type == 0)) {
2133 __skb_warn_lro_forwarding(skb); 2191 __skb_warn_lro_forwarding(skb);
2134 return true; 2192 return true;
2135 } 2193 }