]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/core/skbuff.c
net: allow simultaneous SW and HW transmit timestamping
[karo-tx-linux.git] / net / core / skbuff.c
index 346d3e85dfbc2eca1ded0442ecb78d31e1768523..780b7c1563d03d9f38ab97fd21bf157ebf62a01a 100644 (file)
@@ -2243,6 +2243,32 @@ __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
 }
 EXPORT_SYMBOL(skb_copy_and_csum_bits);
 
+static __wsum warn_crc32c_csum_update(const void *buff, int len, __wsum sum)
+{
+       net_warn_ratelimited(
+               "%s: attempt to compute crc32c without libcrc32c.ko\n",
+               __func__);
+       return 0;
+}
+
+static __wsum warn_crc32c_csum_combine(__wsum csum, __wsum csum2,
+                                      int offset, int len)
+{
+       net_warn_ratelimited(
+               "%s: attempt to compute crc32c without libcrc32c.ko\n",
+               __func__);
+       return 0;
+}
+
+static const struct skb_checksum_ops default_crc32c_ops = {
+       .update  = warn_crc32c_csum_update,
+       .combine = warn_crc32c_csum_combine,
+};
+
+const struct skb_checksum_ops *crc32c_csum_stub __read_mostly =
+       &default_crc32c_ops;
+EXPORT_SYMBOL(crc32c_csum_stub);
+
  /**
  *     skb_zerocopy_headlen - Calculate headroom needed for skb_zerocopy()
  *     @from: source buffer
@@ -3875,6 +3901,10 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb,
        if (!sk)
                return;
 
+       if (!hwtstamps && !(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_TX_SWHW) &&
+           skb_shinfo(orig_skb)->tx_flags & SKBTX_IN_PROGRESS)
+               return;
+
        tsonly = sk->sk_tsflags & SOF_TIMESTAMPING_OPT_TSONLY;
        if (!skb_may_tx_timestamp(sk, tsonly))
                return;