Thread (23 messages) 23 messages, 4 authors, 2018-12-18

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

From: Deepa Dinamani <hidden>
Date: 2018-12-18 21:22:21
Also in: linux-alpha, linux-arch, linux-s390, lkml, sparclinux

On Tue, Dec 18, 2018 at 8:16 AM Arnd Bergmann [off-list ref] wrote:
On Wed, Dec 12, 2018 at 4:25 PM Willem de Bruijn
[off-list ref] wrote:
quoted
On Tue, Dec 11, 2018 at 3:30 PM Deepa Dinamani [off-list ref] wrote:
quoted
quoted
@@ -851,39 +890,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
                break;

        case SO_TIMESTAMPING_OLD:
-               if (val & ~SOF_TIMESTAMPING_MASK) {
-                       ret = -EINVAL;
-                       break;
-               }
-
-               if (val & SOF_TIMESTAMPING_OPT_ID &&
-                   !(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)) {
-                       if (sk->sk_protocol == IPPROTO_TCP &&
-                           sk->sk_type == SOCK_STREAM) {
-                               if ((1 << sk->sk_state) &
-                                   (TCPF_CLOSE | TCPF_LISTEN)) {
-                                       ret = -EINVAL;
-                                       break;
-                               }
-                               sk->sk_tskey = tcp_sk(sk)->snd_una;
-                       } else {
-                               sk->sk_tskey = 0;
-                       }
-               }
-
-               if (val & SOF_TIMESTAMPING_OPT_STATS &&
-                   !(val & SOF_TIMESTAMPING_OPT_TSONLY)) {
-                       ret = -EINVAL;
-                       break;
-               }
-
-               sk->sk_tsflags = val;
-               if (val & SOF_TIMESTAMPING_RX_SOFTWARE)
-                       sock_enable_timestamp(sk,
-                                             SOCK_TIMESTAMPING_RX_SOFTWARE);
-               else
-                       sock_disable_timestamp(sk,
-                                              (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE));
+               ret = setsockopt_timestamping(sk, optname, val);
Once again a lot of needless code churn. The only functional change is adding
I think moving the code out into a separate function is a useful cleanup,
but if we want to do that, it may be better done in another patch, to
make it easier to review.
I already removed this addition of function. I have open coded all the
logic here and in the patch 6.
I will post an update.

-Deepa
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help