From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Juntong Deng <juntong.deng@outlook.com>,
willemdebruijn.kernel@gmail.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net/packet: Add getsockopt support for PACKET_COPY_THRESH
Date: Fri, 08 Mar 2024 06:43:31 -0500 [thread overview]
Message-ID: <65eaf9e336d07_133b25294db@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <AM6PR03MB5848595A20BB5D958C2D9DE299272@AM6PR03MB5848.eurprd03.prod.outlook.com>
Juntong Deng wrote:
> Currently getsockopt does not support PACKET_COPY_THRESH,
> and we are unable to get the value of PACKET_COPY_THRESH
> socket option through getsockopt.
>
> This patch adds getsockopt support for PACKET_COPY_THRESH.
>
> Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
> ---
> net/packet/af_packet.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 0db31ca4982d..65042edd1a97 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -4090,6 +4090,9 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
> case PACKET_VNET_HDR_SZ:
> val = READ_ONCE(po->vnet_hdr_sz);
> break;
> + case PACKET_COPY_THRESH:
> + val = pkt_sk(sk)->copy_thresh;
> + break;
This is probably a good opportunity to use READ_ONCE/WRITE_ONCE for
this variable that can be modified and read concurrently.
Alternatively I can fix up all three locations in a follow-on patch.
No concerns with adding the getsockopt itself.
> case PACKET_VERSION:
> val = po->tp_version;
> break;
> --
> 2.39.2
>
next prev parent reply other threads:[~2024-03-08 11:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 11:23 [PATCH net-next] net/packet: Add getsockopt support for PACKET_COPY_THRESH Juntong Deng
2024-03-08 11:43 ` Willem de Bruijn [this message]
2024-03-08 12:08 ` Juntong Deng
2024-03-08 12:24 ` Willem de Bruijn
2024-03-08 13:06 ` Jason Xing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65eaf9e336d07_133b25294db@willemb.c.googlers.com.notmuch \
--to=willemdebruijn.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=juntong.deng@outlook.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox