Re: [PATCH 8/8] socket: Add SO_TIMESTAMPING_NEW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 24, 2018 at 3:58 AM Deepa Dinamani <deepa.kernel@xxxxxxxxx> wrote:
>
> Add SO_TIMESTAMPING_NEW variant of socket timestamp options.
> This is the y2038 safe versions of the SO_TIMESTAMPING_OLD
> for all architectures.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@xxxxxxxxx>
> Cc: chris@xxxxxxxxxx
> Cc: fenghua.yu@xxxxxxxxx
> Cc: rth@xxxxxxxxxxx
> Cc: tglx@xxxxxxxxxxxxx
> Cc: ubraun@xxxxxxxxxxxxx
> Cc: linux-alpha@xxxxxxxxxxxxxxx
> Cc: linux-arch@xxxxxxxxxxxxxxx
> Cc: linux-ia64@xxxxxxxxxxxxxxx
> Cc: linux-mips@xxxxxxxxxxxxxx
> Cc: linux-s390@xxxxxxxxxxxxxxx
> Cc: linux-xtensa@xxxxxxxxxxxxxxxx
> Cc: sparclinux@xxxxxxxxxxxxxxx
> ---

>  /*
>   * called from sock_recv_timestamp() if sock_flag(sk, SOCK_RCVTSTAMP)
>   * or sock_flag(sk, SOCK_RCVTSTAMPNS)
> @@ -739,8 +740,8 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
>         struct sk_buff *skb)
>  {
>         int need_software_tstamp = sock_flag(sk, SOCK_RCVTSTAMP) || sock_flag(sk, SOCK_RCVTSTAMPNS);
> -       struct scm_timestamping tss;
> -       int empty = 1, false_tstamp = 0;
> +       struct scm_timestamping_internal tss;
> +       int empty = 1, false_tstamp = 0, new_tstamp = 0;
>         struct skb_shared_hwtstamps *shhwtstamps =
>                 skb_hwtstamps(skb);
>
> @@ -756,20 +757,23 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
>
>         memset(&tss, 0, sizeof(tss));
>         if ((sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) &&
> -           ktime_to_timespec_cond(skb->tstamp, tss.ts + 0))
> +           ktime_to_timespec64_cond(skb->tstamp, tss.ts + 0))
>                 empty = 0;
>         if (shhwtstamps &&
>             (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE) &&
>             !skb_is_swtx_tstamp(skb, false_tstamp) &&
> -           ktime_to_timespec_cond(shhwtstamps->hwtstamp, tss.ts + 2)) {
> +           ktime_to_timespec64_cond(shhwtstamps->hwtstamp, tss.ts + 2)) {
>                 empty = 0;
>                 if ((sk->sk_tsflags & SOF_TIMESTAMPING_OPT_PKTINFO) &&
>                     !skb_is_err_queue(skb))
>                         put_ts_pktinfo(msg, skb);
>         }
>         if (!empty) {
> -               put_cmsg(msg, SOL_SOCKET,
> -                        SO_TIMESTAMPING_OLD, sizeof(tss), &tss);
> +               new_tstamp = sock_flag(sk, SOCK_TSTAMP_NEW);
> +               if (new_tstamp)

nit: no need for explicit variable

> +                       put_cmsg_scm_timestamping64(msg, &tss);
> +               else
> +                       put_cmsg_scm_timestamping(msg, &tss);
>
>                 if (skb_is_err_queue(skb) && skb->len &&
>                     SKB_EXT_ERR(skb)->opt_stats)
> --
> 2.17.1
>



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux