From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Charles McLachlan <cmclachlan@solarflare.com>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
<linux-net-drivers@solarflare.com>,
brouer@redhat.com
Subject: Re: [PATCH net-next 1/6] sfc: support encapsulation of xdp_frames in efx_tx_buffer.
Date: Wed, 23 Oct 2019 00:19:17 +0200 [thread overview]
Message-ID: <20191023001917.59f51f52@carbon> (raw)
In-Reply-To: <7eca8299-a6bf-5d47-1815-4d2cfa87c070@solarflare.com>
On Tue, 22 Oct 2019 16:37:53 +0100
Charles McLachlan <cmclachlan@solarflare.com> wrote:
> Add a field to efx_tx_buffer so that we can track xdp_frames. Add a
> flag so that buffers that contain xdp_frames can be identified and
> passed to xdp_return_frame.
>
> Signed-off-by: Charles McLachlan <cmclachlan@solarflare.com>
> ---
> drivers/net/ethernet/sfc/net_driver.h | 10 ++++++++--
> drivers/net/ethernet/sfc/tx.c | 2 ++
> 2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
> index 284a1b047ac2..7394d901e021 100644
> --- a/drivers/net/ethernet/sfc/net_driver.h
> +++ b/drivers/net/ethernet/sfc/net_driver.h
> @@ -27,6 +27,7 @@
> #include <linux/i2c.h>
> #include <linux/mtd/mtd.h>
> #include <net/busy_poll.h>
> +#include <net/xdp.h>
>
> #include "enum.h"
> #include "bitfield.h"
> @@ -136,7 +137,8 @@ struct efx_special_buffer {
> * struct efx_tx_buffer - buffer state for a TX descriptor
> * @skb: When @flags & %EFX_TX_BUF_SKB, the associated socket buffer to be
> * freed when descriptor completes
> - * @option: When @flags & %EFX_TX_BUF_OPTION, a NIC-specific option descriptor.
> + * @xdpf: When @flags & %EFX_TX_BUF_XDP, the XDP frame information; its @data
> + * member is the associated buffer to drop a page reference on.
> * @dma_addr: DMA address of the fragment.
> * @flags: Flags for allocation and DMA mapping type
> * @len: Length of this fragment.
> @@ -146,7 +148,10 @@ struct efx_special_buffer {
> * Only valid if @unmap_len != 0.
> */
> struct efx_tx_buffer {
> - const struct sk_buff *skb;
> + union {
> + const struct sk_buff *skb;
> + struct xdp_frame *xdpf;
> + };
> union {
> efx_qword_t option;
> dma_addr_t dma_addr;
> @@ -160,6 +165,7 @@ struct efx_tx_buffer {
> #define EFX_TX_BUF_SKB 2 /* buffer is last part of skb */
> #define EFX_TX_BUF_MAP_SINGLE 8 /* buffer was mapped with dma_map_single() */
> #define EFX_TX_BUF_OPTION 0x10 /* empty buffer for option descriptor */
> +#define EFX_TX_BUF_XDP 0x20 /* buffer was sent with XDP */
>
> /**
> * struct efx_tx_queue - An Efx TX queue
> diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
> index 65e81ec1b314..9905e8952a45 100644
> --- a/drivers/net/ethernet/sfc/tx.c
> +++ b/drivers/net/ethernet/sfc/tx.c
> @@ -95,6 +95,8 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
> netif_vdbg(tx_queue->efx, tx_done, tx_queue->efx->net_dev,
> "TX queue %d transmission id %x complete\n",
> tx_queue->queue, tx_queue->read_count);
> + } else if (buffer->flags & EFX_TX_BUF_XDP) {
> + xdp_return_frame(buffer->xdpf);
Is this efx_dequeue_buffer() function always called under NAPI protection?
(So it could use the faster xdp_return_frame_rx_napi() ... ?)
> }
>
> buffer->len = 0;
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2019-10-22 22:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 14:53 [PATCH net-next 0/6] sfc: Add XDP support Charles McLachlan
2019-10-22 15:37 ` [PATCH net-next 1/6] sfc: support encapsulation of xdp_frames in efx_tx_buffer Charles McLachlan
2019-10-22 22:19 ` Jesper Dangaard Brouer [this message]
2019-10-24 14:44 ` Charles McLachlan
2019-10-22 15:38 ` [PATCH net-next 2/6] sfc: perform XDP processing on received packets Charles McLachlan
2019-10-22 16:26 ` Edward Cree
2019-10-24 14:42 ` Charles McLachlan
2019-10-22 22:45 ` Jesper Dangaard Brouer
2019-10-24 14:45 ` Charles McLachlan
2019-10-22 15:38 ` [PATCH net-next 3/6] sfc: Enable setting of xdp_prog Charles McLachlan
2019-10-22 15:38 ` [PATCH net-next 4/6] sfc: allocate channels for XDP tx queues Charles McLachlan
2019-10-22 15:39 ` [PATCH net-next 5/6] sfc: handle XDP_TX outcomes of XDP eBPF programs Charles McLachlan
2019-10-22 15:39 ` [PATCH net-next 6/6] sfc: add XDP counters to ethtool stats Charles McLachlan
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=20191023001917.59f51f52@carbon \
--to=brouer@redhat.com \
--cc=cmclachlan@solarflare.com \
--cc=davem@davemloft.net \
--cc=linux-net-drivers@solarflare.com \
--cc=netdev@vger.kernel.org \
/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).