[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1c37f945-0e2f-1eec-fe88-a740815026d3@redhat.com>
Date: Fri, 29 Sep 2017 17:49:23 +0800
From: Jason Wang <jasowang@...hat.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>, netdev@...r.kernel.org
Cc: jakub.kicinski@...ronome.com,
"Michael S. Tsirkin" <mst@...hat.com>, mchan@...adcom.com,
John Fastabend <john.fastabend@...il.com>,
peter.waskiewicz.jr@...el.com,
Daniel Borkmann <borkmann@...earbox.net>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Andy Gospodarek <andy@...yhouse.net>
Subject: Re: [net-next PATCH 3/5] bpf: cpumap xdp_buff to skb conversion and
allocation
On 2017年09月28日 20:57, Jesper Dangaard Brouer wrote:
> +};
> +
> +/* Convert xdp_buff to xdp_pkt */
> +static struct xdp_pkt *convert_to_xdp_pkt(struct xdp_buff *xdp)
> +{
> + struct xdp_pkt *xdp_pkt;
> + int headroom;
> +
> + /* Assure headroom is available for storing info */
> + headroom = xdp->data - xdp->data_hard_start;
> + if (headroom < sizeof(*xdp_pkt))
> + return NULL;
Hi Jesper:
Do you consider this as a trick or a long term solution? Is it better to
store XDP in a circular buffer? (I'm asking since I meet similar issue
when doing xdp_xmit for tun).
> +
> + /* Store info in top of packet */
> + xdp_pkt = xdp->data_hard_start;
> +
> + xdp_pkt->data = xdp->data;
> + xdp_pkt->len = xdp->data_end - xdp->data;
> + xdp_pkt->headroom = headroom - sizeof(*xdp_pkt);
> +
Is wmb() needed here?
> + return xdp_pkt;
> +}
Thanks
Powered by blists - more mailing lists