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.h45
1 files changed, 28 insertions, 17 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ec89301ada41..abde271c18ae 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -112,8 +112,7 @@
112#define CHECKSUM_COMPLETE 2 112#define CHECKSUM_COMPLETE 2
113#define CHECKSUM_PARTIAL 3 113#define CHECKSUM_PARTIAL 3
114 114
115#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ 115#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES)
116 ~(SMP_CACHE_BYTES - 1))
117#define SKB_WITH_OVERHEAD(X) \ 116#define SKB_WITH_OVERHEAD(X) \
118 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) 117 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
119#define SKB_MAX_ORDER(X, ORDER) \ 118#define SKB_MAX_ORDER(X, ORDER) \
@@ -211,18 +210,9 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
211 * struct skb_shared_hwtstamps - hardware time stamps 210 * struct skb_shared_hwtstamps - hardware time stamps
212 * @hwtstamp: hardware time stamp transformed into duration 211 * @hwtstamp: hardware time stamp transformed into duration
213 * since arbitrary point in time 212 * since arbitrary point in time
214 * @syststamp: hwtstamp transformed to system time base
215 * 213 *
216 * Software time stamps generated by ktime_get_real() are stored in 214 * Software time stamps generated by ktime_get_real() are stored in
217 * skb->tstamp. The relation between the different kinds of time 215 * skb->tstamp.
218 * stamps is as follows:
219 *
220 * syststamp and tstamp can be compared against each other in
221 * arbitrary combinations. The accuracy of a
222 * syststamp/tstamp/"syststamp from other device" comparison is
223 * limited by the accuracy of the transformation into system time
224 * base. This depends on the device driver and its underlying
225 * hardware.
226 * 216 *
227 * hwtstamps can only be compared against other hwtstamps from 217 * hwtstamps can only be compared against other hwtstamps from
228 * the same device. 218 * the same device.
@@ -232,7 +222,6 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
232 */ 222 */
233struct skb_shared_hwtstamps { 223struct skb_shared_hwtstamps {
234 ktime_t hwtstamp; 224 ktime_t hwtstamp;
235 ktime_t syststamp;
236}; 225};
237 226
238/* Definitions for tx_flags in struct skb_shared_info */ 227/* Definitions for tx_flags in struct skb_shared_info */
@@ -240,7 +229,7 @@ enum {
240 /* generate hardware time stamp */ 229 /* generate hardware time stamp */
241 SKBTX_HW_TSTAMP = 1 << 0, 230 SKBTX_HW_TSTAMP = 1 << 0,
242 231
243 /* generate software time stamp */ 232 /* generate software time stamp when queueing packet to NIC */
244 SKBTX_SW_TSTAMP = 1 << 1, 233 SKBTX_SW_TSTAMP = 1 << 1,
245 234
246 /* device driver is going to provide hardware time stamp */ 235 /* device driver is going to provide hardware time stamp */
@@ -258,8 +247,19 @@ enum {
258 * all frags to avoid possible bad checksum 247 * all frags to avoid possible bad checksum
259 */ 248 */
260 SKBTX_SHARED_FRAG = 1 << 5, 249 SKBTX_SHARED_FRAG = 1 << 5,
250
251 /* generate software time stamp when entering packet scheduling */
252 SKBTX_SCHED_TSTAMP = 1 << 6,
253
254 /* generate software timestamp on peer data acknowledgment */
255 SKBTX_ACK_TSTAMP = 1 << 7,
261}; 256};
262 257
258#define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | \
259 SKBTX_SCHED_TSTAMP | \
260 SKBTX_ACK_TSTAMP)
261#define SKBTX_ANY_TSTAMP (SKBTX_HW_TSTAMP | SKBTX_ANY_SW_TSTAMP)
262
263/* 263/*
264 * The callback notifies userspace to release buffers when skb DMA is done in 264 * The callback notifies userspace to release buffers when skb DMA is done in
265 * lower device, the skb last reference should be 0 when calling this. 265 * lower device, the skb last reference should be 0 when calling this.
@@ -286,6 +286,7 @@ struct skb_shared_info {
286 unsigned short gso_type; 286 unsigned short gso_type;
287 struct sk_buff *frag_list; 287 struct sk_buff *frag_list;
288 struct skb_shared_hwtstamps hwtstamps; 288 struct skb_shared_hwtstamps hwtstamps;
289 u32 tskey;
289 __be32 ip6_frag_id; 290 __be32 ip6_frag_id;
290 291
291 /* 292 /*
@@ -455,6 +456,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
455 * @ooo_okay: allow the mapping of a socket to a queue to be changed 456 * @ooo_okay: allow the mapping of a socket to a queue to be changed
456 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport 457 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
457 * ports. 458 * ports.
459 * @sw_hash: indicates hash was computed in software stack
458 * @wifi_acked_valid: wifi_acked was set 460 * @wifi_acked_valid: wifi_acked was set
459 * @wifi_acked: whether frame was acked on wifi or not 461 * @wifi_acked: whether frame was acked on wifi or not
460 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 462 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
@@ -562,6 +564,7 @@ struct sk_buff {
562 __u8 pfmemalloc:1; 564 __u8 pfmemalloc:1;
563 __u8 ooo_okay:1; 565 __u8 ooo_okay:1;
564 __u8 l4_hash:1; 566 __u8 l4_hash:1;
567 __u8 sw_hash:1;
565 __u8 wifi_acked_valid:1; 568 __u8 wifi_acked_valid:1;
566 __u8 wifi_acked:1; 569 __u8 wifi_acked:1;
567 __u8 no_fcs:1; 570 __u8 no_fcs:1;
@@ -575,7 +578,7 @@ struct sk_buff {
575 __u8 encap_hdr_csum:1; 578 __u8 encap_hdr_csum:1;
576 __u8 csum_valid:1; 579 __u8 csum_valid:1;
577 __u8 csum_complete_sw:1; 580 __u8 csum_complete_sw:1;
578 /* 3/5 bit hole (depending on ndisc_nodetype presence) */ 581 /* 2/4 bit hole (depending on ndisc_nodetype presence) */
579 kmemcheck_bitfield_end(flags2); 582 kmemcheck_bitfield_end(flags2);
580 583
581#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 584#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
@@ -830,13 +833,14 @@ static inline void
830skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) 833skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type)
831{ 834{
832 skb->l4_hash = (type == PKT_HASH_TYPE_L4); 835 skb->l4_hash = (type == PKT_HASH_TYPE_L4);
836 skb->sw_hash = 0;
833 skb->hash = hash; 837 skb->hash = hash;
834} 838}
835 839
836void __skb_get_hash(struct sk_buff *skb); 840void __skb_get_hash(struct sk_buff *skb);
837static inline __u32 skb_get_hash(struct sk_buff *skb) 841static inline __u32 skb_get_hash(struct sk_buff *skb)
838{ 842{
839 if (!skb->l4_hash) 843 if (!skb->l4_hash && !skb->sw_hash)
840 __skb_get_hash(skb); 844 __skb_get_hash(skb);
841 845
842 return skb->hash; 846 return skb->hash;
@@ -850,6 +854,7 @@ static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
850static inline void skb_clear_hash(struct sk_buff *skb) 854static inline void skb_clear_hash(struct sk_buff *skb)
851{ 855{
852 skb->hash = 0; 856 skb->hash = 0;
857 skb->sw_hash = 0;
853 skb->l4_hash = 0; 858 skb->l4_hash = 0;
854} 859}
855 860
@@ -862,6 +867,7 @@ static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb)
862static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from) 867static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from)
863{ 868{
864 to->hash = from->hash; 869 to->hash = from->hash;
870 to->sw_hash = from->sw_hash;
865 to->l4_hash = from->l4_hash; 871 to->l4_hash = from->l4_hash;
866}; 872};
867 873
@@ -2549,6 +2555,7 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2549void skb_scrub_packet(struct sk_buff *skb, bool xnet); 2555void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2550unsigned int skb_gso_transport_seglen(const struct sk_buff *skb); 2556unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
2551struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features); 2557struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2558struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
2552 2559
2553struct skb_checksum_ops { 2560struct skb_checksum_ops {
2554 __wsum (*update)(const void *mem, int len, __wsum wsum); 2561 __wsum (*update)(const void *mem, int len, __wsum wsum);
@@ -2697,6 +2704,10 @@ static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
2697void skb_complete_tx_timestamp(struct sk_buff *skb, 2704void skb_complete_tx_timestamp(struct sk_buff *skb,
2698 struct skb_shared_hwtstamps *hwtstamps); 2705 struct skb_shared_hwtstamps *hwtstamps);
2699 2706
2707void __skb_tstamp_tx(struct sk_buff *orig_skb,
2708 struct skb_shared_hwtstamps *hwtstamps,
2709 struct sock *sk, int tstype);
2710
2700/** 2711/**
2701 * skb_tstamp_tx - queue clone of skb with send time stamps 2712 * skb_tstamp_tx - queue clone of skb with send time stamps
2702 * @orig_skb: the original outgoing packet 2713 * @orig_skb: the original outgoing packet
@@ -3005,7 +3016,7 @@ static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
3005 return skb->queue_mapping != 0; 3016 return skb->queue_mapping != 0;
3006} 3017}
3007 3018
3008u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb, 3019u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
3009 unsigned int num_tx_queues); 3020 unsigned int num_tx_queues);
3010 3021
3011static inline struct sec_path *skb_sec_path(struct sk_buff *skb) 3022static inline struct sec_path *skb_sec_path(struct sk_buff *skb)