/* A non-zero value of dst->obsolete forces by-hand validation * of the route entry. Positive values are set by the generic * dst layer to indicate that the entry has been forcefully * destroyed. * * Negative values are used by the implementation layer code to * force invocation of the dst_ops->check() method.
*/ short obsolete; #define DST_OBSOLETE_NONE 0 #define DST_OBSOLETE_DEAD 2 #define DST_OBSOLETE_FORCE_CHK -1 #define DST_OBSOLETE_KILL -2 unsignedshort header_len; /* more space at head required */ unsignedshort trailer_len; /* space to reserve at tail */
/* * __rcuref wants to be on a different cache line from * input/output/ops or performance tanks badly
*/ #ifdef CONFIG_64BIT
rcuref_t __rcuref; /* 64-bit offset 64 */ #endif int __use; unsignedlong lastuse; struct rcu_head rcu_head; short error; short __pad;
__u32 tclassid; #ifndef CONFIG_64BIT struct lwtunnel_state *lwtstate;
rcuref_t __rcuref; /* 32-bit offset 64 */ #endif
netdevice_tracker dev_tracker;
/* * Used by rtable and rt6_info. Moves lwtstate into the next cache * line on 64bit so that lwtstate does not cause false sharing with * __rcuref under contention of __rcuref. This also puts the * frequently accessed members of rtable and rt6_info out of the * __rcuref cache line.
*/ struct list_head rt_uncached; struct uncached_list *rt_uncached_list; #ifdef CONFIG_64BIT struct lwtunnel_state *lwtstate; #endif
};
staticinlinevoid dst_destroy_metrics_generic(struct dst_entry *dst)
{ unsignedlong val = dst->_metrics; if (!(val & DST_METRICS_READ_ONLY))
__dst_destroy_metrics_generic(dst, val);
}
staticinline u32 *dst_metrics_write_ptr(struct dst_entry *dst)
{ unsignedlong p = dst->_metrics;
BUG_ON(!p);
if (p & DST_METRICS_READ_ONLY) return dst->ops->cow_metrics(dst, p); return __DST_METRICS_PTR(p);
}
/* This may only be invoked before the entry has reached global * visibility.
*/ staticinlinevoid dst_init_metrics(struct dst_entry *dst, const u32 *src_metrics, bool read_only)
{
dst->_metrics = ((unsignedlong) src_metrics) |
(read_only ? DST_METRICS_READ_ONLY : 0);
}
/* RTT metrics are stored in milliseconds for user ABI, but used as jiffies */ staticinlineunsignedlong dst_metric_rtt(conststruct dst_entry *dst, int metric)
{ return msecs_to_jiffies(dst_metric(dst, metric));
}
/** * dst_hold_safe - Take a reference on a dst if possible * @dst: pointer to dst entry * * This helper returns false if it could not safely * take a reference on a dst.
*/ staticinlinebool dst_hold_safe(struct dst_entry *dst)
{ return rcuref_get(&dst->__rcuref);
}
/** * skb_dst_force - makes sure skb dst is refcounted * @skb: buffer * * If dst is not yet refcounted and not destroyed, grab a ref on it. * Returns: true if dst is refcounted.
*/ staticinlinebool skb_dst_force(struct sk_buff *skb)
{ if (skb_dst_is_noref(skb)) { struct dst_entry *dst = skb_dst(skb);
WARN_ON(!rcu_read_lock_held()); if (!dst_hold_safe(dst))
dst = NULL;
/** * __skb_tunnel_rx - prepare skb for rx reinsert * @skb: buffer * @dev: tunnel device * @net: netns for packet i/o * * After decapsulation, packet is going to re-enter (netif_rx()) our stack, * so make some cleanups. (no accounting done)
*/ staticinlinevoid __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev, struct net *net)
{
skb->dev = dev;
/* * Clear hash so that we can recalculate the hash for the * encapsulated packet, unless we have already determine the hash * over the L4 4-tuple.
*/
skb_clear_hash_if_not_l4(skb);
skb_set_queue_mapping(skb, 0);
skb_scrub_packet(skb, !net_eq(net, dev_net(dev)));
}
/** * skb_tunnel_rx - prepare skb for rx reinsert * @skb: buffer * @dev: tunnel device * @net: netns for packet i/o * * After decapsulation, packet is going to re-enter (netif_rx()) our stack, * so make some cleanups, and perform accounting. * Note: this accounting is not SMP safe.
*/ staticinlinevoid skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev, struct net *net)
{
DEV_STATS_INC(dev, rx_packets);
DEV_STATS_ADD(dev, rx_bytes, skb->len);
__skb_tunnel_rx(skb, dev, net);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.