lkml.org 
[lkml]   [2021]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [net-next, v4, 08/11] net: sock: extend SO_TIMESTAMPING for PHC binding
Date
Hi Mat,

> -----Original Message-----
> From: Mat Martineau <mathew.j.martineau@linux.intel.com>
> Sent: 2021年6月26日 9:00
> To: Y.b. Lu <yangbo.lu@nxp.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> linux-kselftest@vger.kernel.org; mptcp@lists.linux.dev; Richard Cochran
> <richardcochran@gmail.com>; David S . Miller <davem@davemloft.net>;
> Jakub Kicinski <kuba@kernel.org>; Matthieu Baerts
> <matthieu.baerts@tessares.net>; Shuah Khan <shuah@kernel.org>; Michal
> Kubecek <mkubecek@suse.cz>; Florian Fainelli <f.fainelli@gmail.com>;
> Andrew Lunn <andrew@lunn.ch>; Rui Sousa <rui.sousa@nxp.com>; Sebastien
> Laveze <sebastien.laveze@nxp.com>
> 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(&timestamping, 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
> &timestamping.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(&timestamping, 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(&timestamping),
> > + 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
\
 
 \ /
  Last update: 2021-06-30 10:31    [W:2.693 / U:27.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site