All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerhard Engleder <gerhard@engleder-embedded.com>
To: richardcochran@gmail.com, yangbo.lu@nxp.com, davem@davemloft.net,
	kuba@kernel.org
Cc: mlichvar@redhat.com, vinicius.gomes@intel.com,
	netdev@vger.kernel.org,
	Gerhard Engleder <gerhard@engleder-embedded.com>
Subject: [RFC PATCH net-next 1/6] bpf: Access hwtstamp field of hwtstamps directly
Date: Sun,  6 Mar 2022 09:56:53 +0100	[thread overview]
Message-ID: <20220306085658.1943-2-gerhard@engleder-embedded.com> (raw)
In-Reply-To: <20220306085658.1943-1-gerhard@engleder-embedded.com>

skb_shared_hwtstamps contains only the field hwtstamp. That property is
hard-coded and checked during build in BPF. bpf_target_off() gets the
whole structure as argument (hwtstamps) instead of the actually accessed
field hwtstamp.

Access hwtstamp field directly and allow future extensions of
skb_shared_hwtstamps.

Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
---
 net/core/filter.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 88767f7da150..09e202b60060 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -9364,13 +9364,12 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
 		break;
 	case offsetof(struct __sk_buff, hwtstamp):
 		BUILD_BUG_ON(sizeof_field(struct skb_shared_hwtstamps, hwtstamp) != 8);
-		BUILD_BUG_ON(offsetof(struct skb_shared_hwtstamps, hwtstamp) != 0);
 
 		insn = bpf_convert_shinfo_access(si, insn);
 		*insn++ = BPF_LDX_MEM(BPF_DW,
 				      si->dst_reg, si->dst_reg,
 				      bpf_target_off(struct skb_shared_info,
-						     hwtstamps, 8,
+						     hwtstamps.hwtstamp, 8,
 						     target_size));
 		break;
 	}
-- 
2.20.1


  reply	other threads:[~2022-03-06  8:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-06  8:56 [RFC PATCH net-next 0/6] ptp: Support hardware clocks with additional free running time Gerhard Engleder
2022-03-06  8:56 ` Gerhard Engleder [this message]
2022-03-06  8:56 ` [RFC PATCH net-next 2/6] ptp: Initialize skb_shared_hwtstamps Gerhard Engleder
2022-03-06  8:56 ` [RFC PATCH net-next 3/6] ptp: Add free running time support Gerhard Engleder
2022-03-06 16:36   ` Richard Cochran
2022-03-06  8:56 ` [RFC PATCH net-next 4/6] ptp: Support time stamps based on free running time Gerhard Engleder
2022-03-06 16:42   ` Richard Cochran
2022-03-06  8:56 ` [RFC PATCH net-next 5/6] ptp: Allow vclocks without free running physical clock Gerhard Engleder
2022-03-06  8:56 ` [RFC PATCH net-next 6/6] tsnep: Add free running time support Gerhard Engleder
2022-03-06 16:49 ` [RFC PATCH net-next 0/6] ptp: Support hardware clocks with additional free running time Richard Cochran
2022-03-06 16:53   ` Richard Cochran
2022-03-06 17:05 ` Richard Cochran
2022-03-06 18:38   ` Gerhard Engleder
2022-03-06 21:50     ` Richard Cochran
2022-03-07 14:34       ` Richard Cochran
2022-03-07 17:54         ` Gerhard Engleder
2022-03-07 21:30           ` Richard Cochran
2022-03-08  0:55           ` Richard Cochran
2022-03-08 19:49             ` Gerhard Engleder
2022-03-08 20:52               ` Richard Cochran
2022-03-08  0:57           ` Richard Cochran
2022-03-07 12:07 ` Michael Walle
2022-03-07 14:05   ` Richard Cochran
2022-03-07 14:23     ` Miroslav Lichvar
2022-03-07 14:37       ` Richard Cochran
2022-03-08 20:55         ` Richard Cochran
2022-03-07 16:01   ` Gerhard Engleder

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=20220306085658.1943-2-gerhard@engleder-embedded.com \
    --to=gerhard@engleder-embedded.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mlichvar@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=vinicius.gomes@intel.com \
    --cc=yangbo.lu@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.