netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Ioana Ciornei <ioana.ciornei@nxp.com>,
	"netdev\@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem\@davemloft.net" <davem@davemloft.net>
Cc: Ioana Ciocoi Radulescu <ruxandra.radulescu@nxp.com>,
	"brouer\@redhat.com" <brouer@redhat.com>,
	"ilias.apalodimas\@linaro.org" <ilias.apalodimas@linaro.org>,
	Ioana Ciornei <ioana.ciornei@nxp.com>
Subject: Re: [PATCH 2/2] dpaa2-eth: add XDP_REDIRECT support
Date: Fri, 01 Mar 2019 16:56:54 +0100	[thread overview]
Message-ID: <87o96ulha1.fsf@toke.dk> (raw)
In-Reply-To: <1551455248-26405-3-git-send-email-ioana.ciornei@nxp.com>

Ioana Ciornei <ioana.ciornei@nxp.com> writes:

> From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
>
> Implement support for the XDP_REDIRECT action.
>
> The redirected frame is transmitted and confirmed on the regular Tx/Tx
> conf queues. Frame is marked with the "XDP" type in the software
> annotation, since it requires special treatment.
>
> We don't have good hardware support for TX batching, so the
> XDP_XMIT_FLUSH flag doesn't make a difference for now; ndo_xdp_xmit
> performs the actual Tx operation on the spot.
>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
> ---
>  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c   | 171 +++++++++++++++++++--
>  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h   |  13 ++
>  .../net/ethernet/freescale/dpaa2/dpaa2-ethtool.c   |   1 +
>  3 files changed, 170 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> index 3acfd8c..fbd2f82 100644
> --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> @@ -296,6 +296,7 @@ static u32 run_xdp(struct dpaa2_eth_priv *priv,
>  	xdp.data_end = xdp.data + dpaa2_fd_get_len(fd);
>  	xdp.data_hard_start = xdp.data - XDP_PACKET_HEADROOM;
>  	xdp_set_data_meta_invalid(&xdp);
> +	xdp.rxq = &ch->xdp_rxq;
>  
>  	xdp_act = bpf_prog_run_xdp(xdp_prog, &xdp);
>  
> @@ -328,6 +329,17 @@ static u32 run_xdp(struct dpaa2_eth_priv *priv,
>  		xdp_release_buf(priv, ch, addr);
>  		ch->stats.xdp_drop++;
>  		break;
> +	case XDP_REDIRECT:
> +		dma_unmap_page(priv->net_dev->dev.parent, addr,
> +			       DPAA2_ETH_RX_BUF_SIZE, DMA_BIDIRECTIONAL);
> +		ch->buf_count--;
> +		xdp.data_hard_start = vaddr;
> +		err = xdp_do_redirect(priv->net_dev, &xdp, xdp_prog);
> +		if (unlikely(err))
> +			ch->stats.xdp_drop++;
> +		else
> +			ch->stats.xdp_redirect++;
> +		break;
>  	}

You're missing a call to xdp_do_flush_map() somewhere; things are not
going to work properly without it. From a quick perusal of dpaa2-eth.c I
would guess it should be somewhere near the end of dpaa2_eth_poll()...

-Toke

  reply	other threads:[~2019-03-01 15:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 15:47 [PATCH 0/2] dpaa2-eth: add XDP_REDIRECT support Ioana Ciornei
2019-03-01 15:47 ` [PATCH 1/2] dpaa2-eth: Add software annotation types Ioana Ciornei
2019-03-01 15:47 ` [PATCH 2/2] dpaa2-eth: add XDP_REDIRECT support Ioana Ciornei
2019-03-01 15:56   ` Toke Høiland-Jørgensen [this message]
2019-03-01 16:42     ` Ioana Ciornei

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=87o96ulha1.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ilias.apalodimas@linaro.org \
    --cc=ioana.ciornei@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=ruxandra.radulescu@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 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).