lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1eed5fe05a59f86ff868580e3ae89e251f498ec.camel@intel.com>
Date:   Tue, 20 Apr 2021 16:33:33 +0000
From:   "Nguyen, Anthony L" <anthony.l.nguyen@...el.com>
To:     "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
        "kurt@...utronix.de" <kurt@...utronix.de>
CC:     "bigeasy@...utronix.de" <bigeasy@...utronix.de>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "ast@...nel.org" <ast@...nel.org>,
        "hawk@...nel.org" <hawk@...nel.org>,
        "lorenzo@...nel.org" <lorenzo@...nel.org>,
        "john.fastabend@...il.com" <john.fastabend@...il.com>,
        "alexander.duyck@...il.com" <alexander.duyck@...il.com>,
        "ilias.apalodimas@...aro.org" <ilias.apalodimas@...aro.org>,
        "richardcochran@...il.com" <richardcochran@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "sven.auhagen@...eatech.de" <sven.auhagen@...eatech.de>,
        "intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>
Subject: Re: [PATCH net v2] igb: Fix XDP with PTP enabled

On Mon, 2021-04-19 at 09:23 +0200, Kurt Kanzenbach wrote:
> When using native XDP with the igb driver, the XDP frame data doesn't
> point to
> the beginning of the packet. It's off by 16 bytes. Everything works
> as expected
> with XDP skb mode.
> 
> Actually these 16 bytes are used to store the packet timestamps.
> Therefore, pull
> the timestamp before executing any XDP operations and adjust all
> other code
> accordingly. The igc driver does it like that as well.
> 
> Tested with Intel i210 card and AF_XDP sockets.
> 
> Fixes: 9cbc948b5a20 ("igb: add XDP support")
> Signed-off-by: Kurt Kanzenbach <kurt@...utronix.de>
> ---

<snip>

> @@ -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,14 +8699,21 @@ 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);

The timestamp should be checked for failure and not adjust these values
if the timestamp was invalid.
 
> +			pkt_offset += IGB_TS_HDR_LEN;
> +			size -= IGB_TS_HDR_LEN;
> +		}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ