RE: [net-next, v4, 08/11] net: sock: extend SO_TIMESTAMPING for PHC binding
From: Y.b. Lu
Date: Wed Jun 30 2021 - 04:30:04 EST
Hi Mat,
> -----Original Message-----
> From: Mat Martineau <mathew.j.martineau@xxxxxxxxxxxxxxx>
> Sent: 2021年6月26日 9:00
> To: Y.b. Lu <yangbo.lu@xxxxxxx>
> Cc: netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> linux-kselftest@xxxxxxxxxxxxxxx; mptcp@xxxxxxxxxxxxxxx; Richard Cochran
> <richardcochran@xxxxxxxxx>; David S . Miller <davem@xxxxxxxxxxxxx>;
> Jakub Kicinski <kuba@xxxxxxxxxx>; Matthieu Baerts
> <matthieu.baerts@xxxxxxxxxxxx>; Shuah Khan <shuah@xxxxxxxxxx>; Michal
> Kubecek <mkubecek@xxxxxxx>; Florian Fainelli <f.fainelli@xxxxxxxxx>;
> Andrew Lunn <andrew@xxxxxxx>; Rui Sousa <rui.sousa@xxxxxxx>; Sebastien
> Laveze <sebastien.laveze@xxxxxxx>
> Subject: Re: [net-next, v4, 08/11] net: sock: extend SO_TIMESTAMPING for
> PHC binding
>
> On Fri, 25 Jun 2021, Yangbo Lu wrote:
>
[...]
> > diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
> > index ea38cbcd2ad4..e20aefc20d75 100644
> > --- a/net/mptcp/sockopt.c
> > +++ b/net/mptcp/sockopt.c
> > @@ -207,14 +207,26 @@ static int
> mptcp_setsockopt_sol_socket_timestamping(struct mptcp_sock *msk,
> > {
> > struct mptcp_subflow_context *subflow;
> > struct sock *sk = (struct sock *)msk;
> > + struct so_timestamping timestamping;
> > int val, ret;
> >
> > - ret = mptcp_get_int_option(msk, optval, optlen, &val);
> > - if (ret)
> > - return ret;
> > + if (optlen == sizeof(timestamping)) {
> > + if (copy_from_sockptr(×tamping, optval,
> > + sizeof(timestamping)))
> > + return -EFAULT;
> > + } else if (optlen == sizeof(int)) {
> > + if (copy_from_sockptr(val, optval, sizeof(*val)))
> ^^^
>
> As the kbuild bot noted, this needs to be a pointer. You could pass in
> ×tamping.flags and you wouldn't need the 'val' variable at all.
>
>
Ok, I sent v5 to fix.
Sorry for the trouble. It seemed my test config missed to enable MPTCP.
Thanks.
> -Mat
>
>
> > + return -EFAULT;
> > +
> > + memset(×tamping, 0, sizeof(timestamping));
> > + timestamping.flags = val;
> > + } else {
> > + return -EINVAL;
> > + }
> >
> > ret = sock_setsockopt(sk->sk_socket, SOL_SOCKET, optname,
> > - KERNEL_SOCKPTR(&val), sizeof(val));
> > + KERNEL_SOCKPTR(×tamping),
> > + sizeof(timestamping));
> > if (ret)
> > return ret;
> >
> > @@ -224,7 +236,7 @@ static int
> mptcp_setsockopt_sol_socket_timestamping(struct mptcp_sock *msk,
> > struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
> > bool slow = lock_sock_fast(ssk);
> >
> > - sock_set_timestamping(sk, optname, val);
> > + sock_set_timestamping(sk, optname, timestamping);
> > unlock_sock_fast(ssk, slow);
> > }
> >
> > --
> > 2.25.1
> >
> >
>
> --
> Mat Martineau
> Intel