]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/net/dst.h
net: dst: Force 4-byte alignment of dst_metrics
[mirror_ubuntu-bionic-kernel.git] / include / net / dst.h
index b091fd536098918e425394c55c46aae33e923239..f95335e3790ffa8706e114d0b7475f6a84b5c550 100644 (file)
@@ -110,7 +110,7 @@ struct dst_entry {
 struct dst_metrics {
        u32             metrics[RTAX_MAX];
        refcount_t      refcnt;
-};
+} __aligned(4);                /* Low pointer bits contain DST_METRICS_FLAGS */
 extern const struct dst_metrics dst_default_metrics;
 
 u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
@@ -330,8 +330,9 @@ static inline bool dst_hold_safe(struct dst_entry *dst)
  * @skb: buffer
  *
  * If dst is not yet refcounted and not destroyed, grab a ref on it.
+ * Returns true if dst is refcounted.
  */
-static inline void skb_dst_force(struct sk_buff *skb)
+static inline bool skb_dst_force(struct sk_buff *skb)
 {
        if (skb_dst_is_noref(skb)) {
                struct dst_entry *dst = skb_dst(skb);
@@ -342,6 +343,8 @@ static inline void skb_dst_force(struct sk_buff *skb)
 
                skb->_skb_refdst = (unsigned long)dst;
        }
+
+       return skb->_skb_refdst != 0UL;
 }
 
 
@@ -521,4 +524,12 @@ static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
 }
 #endif
 
+static inline void skb_dst_update_pmtu(struct sk_buff *skb, u32 mtu)
+{
+       struct dst_entry *dst = skb_dst(skb);
+
+       if (dst && dst->ops->update_pmtu)
+               dst->ops->update_pmtu(dst, NULL, skb, mtu);
+}
+
 #endif /* _NET_DST_H */