From: Kurt Kanzenbach <kurt@linutronix.de>
To: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Sven Auhagen <sven.auhagen@voleatech.de>,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
bpf@vger.kernel.org,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Richard Cochran <richardcochran@gmail.com>
Subject: Re: [PATCH net] igb: Fix XDP with PTP enabled
Date: Thu, 15 Apr 2021 14:19:55 +0200 [thread overview]
Message-ID: <871rbbhh90.fsf@kurt> (raw)
In-Reply-To: <YHgiffS6A0sDzLGW@lore-desk>
[-- Attachment #1: Type: text/plain, Size: 2072 bytes --]
On Thu Apr 15 2021, Lorenzo Bianconi wrote:
> [...]
>> @@ -8683,7 +8676,10 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
>> while (likely(total_packets < budget)) {
>> union e1000_adv_rx_desc *rx_desc;
>> struct igb_rx_buffer *rx_buffer;
>> + ktime_t timestamp = 0;
>> + int pkt_offset = 0;
>> unsigned int size;
>> + void *pktbuf;
>>
>> /* return some buffers to hardware, one at a time is too slow */
>> if (cleaned_count >= IGB_RX_BUFFER_WRITE) {
>> @@ -8703,15 +8699,22 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
>> dma_rmb();
>>
>> rx_buffer = igb_get_rx_buffer(rx_ring, size, &rx_buf_pgcnt);
>> + pktbuf = page_address(rx_buffer->page) + rx_buffer->page_offset;
>> +
>> + /* pull rx packet timestamp if available */
>> + if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
>> + timestamp = igb_ptp_rx_pktstamp(rx_ring->q_vector,
>> + pktbuf);
>> + pkt_offset += IGB_TS_HDR_LEN;
>> + size -= IGB_TS_HDR_LEN;
>> + }
>>
>> /* retrieve a buffer from the ring */
>> if (!skb) {
>> - unsigned int offset = igb_rx_offset(rx_ring);
>> - unsigned char *hard_start;
>> -
>> - hard_start = page_address(rx_buffer->page) +
>> - rx_buffer->page_offset - offset;
>> - xdp_prepare_buff(&xdp, hard_start, offset, size, true);
>> + xdp.data = pktbuf + pkt_offset;
>> + xdp.data_end = xdp.data + size;
>> + xdp.data_meta = xdp.data;
>> + xdp.data_hard_start = pktbuf - igb_rx_offset(rx_ring);
>
> in order to keep it aligned with other xdp drivers, I guess you can do something like:
>
> unsigned char *hard_start = pktbuf - igb_rx_offset(rx_ring);
> unsigned int offset = pkt_offset + igb_rx_offset(rx_ring);
>
> xdp_prepare_buff(&xdp, hard_start, offset, size, true);
This should work as well. I just kept it in sync with the igc driver,
because it doesn't use xdp_prepare_buff() either.
>
> Probably the compiler will optimize it.
Most likely.
Thanks,
Kurt
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2021-04-15 12:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-15 9:21 [PATCH net] igb: Fix XDP with PTP enabled Kurt Kanzenbach
2021-04-15 11:24 ` Lorenzo Bianconi
2021-04-15 12:19 ` Kurt Kanzenbach [this message]
2021-04-15 12:04 ` Jesper Dangaard Brouer
2021-04-15 12:16 ` Kurt Kanzenbach
2021-04-15 12:51 ` Jesper Dangaard Brouer
2021-04-15 13:20 ` Kurt Kanzenbach
2021-04-15 12:17 ` Nick Lowe
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=871rbbhh90.fsf@kurt \
--to=kurt@linutronix.de \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=sven.auhagen@voleatech.de \
/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;
as well as URLs for NNTP newsgroup(s).