netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Camelia Alexandra Groza <camelia.groza@nxp.com>
Cc: "kuba@kernel.org" <kuba@kernel.org>,
	"brouer@redhat.com" <brouer@redhat.com>,
	"saeed@kernel.org" <saeed@kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"Madalin Bucur (OSS)" <madalin.bucur@oss.nxp.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v3 4/7] dpaa_eth: add XDP_TX support
Date: Mon, 23 Nov 2020 23:18:29 +0100	[thread overview]
Message-ID: <20201123221829.GC11618@ranger.igk.intel.com> (raw)
In-Reply-To: <VI1PR04MB5807F56500D25ECD20657618F2FF0@VI1PR04MB5807.eurprd04.prod.outlook.com>

On Fri, Nov 20, 2020 at 06:54:42PM +0000, Camelia Alexandra Groza wrote:
> > -----Original Message-----
> > From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> > Sent: Friday, November 20, 2020 01:51
> > To: Camelia Alexandra Groza <camelia.groza@nxp.com>
> > Cc: kuba@kernel.org; brouer@redhat.com; saeed@kernel.org;
> > davem@davemloft.net; Madalin Bucur (OSS)
> > <madalin.bucur@oss.nxp.com>; Ioana Ciornei <ioana.ciornei@nxp.com>;
> > netdev@vger.kernel.org
> > Subject: Re: [PATCH net-next v3 4/7] dpaa_eth: add XDP_TX support
> > 
> > On Thu, Nov 19, 2020 at 06:29:33PM +0200, Camelia Groza wrote:
> > > Use an xdp_frame structure for managing the frame. Store a backpointer
> > to
> > > the structure at the start of the buffer before enqueueing. Use the XDP
> > > API for freeing the buffer when it returns to the driver on the TX
> > > confirmation path.
> > 

[...]

> > >  static u32 dpaa_run_xdp(struct dpaa_priv *priv, struct qm_fd *fd, void
> > *vaddr,
> > > -			unsigned int *xdp_meta_len)
> > > +			struct dpaa_fq *dpaa_fq, unsigned int
> > *xdp_meta_len)
> > >  {
> > >  	ssize_t fd_off = qm_fd_get_offset(fd);
> > >  	struct bpf_prog *xdp_prog;
> > > +	struct xdp_frame *xdpf;
> > >  	struct xdp_buff xdp;
> > >  	u32 xdp_act;
> > >
> > > @@ -2370,7 +2470,8 @@ static u32 dpaa_run_xdp(struct dpaa_priv *priv,
> > struct qm_fd *fd, void *vaddr,
> > >  	xdp.data_meta = xdp.data;
> > >  	xdp.data_hard_start = xdp.data - XDP_PACKET_HEADROOM;
> > >  	xdp.data_end = xdp.data + qm_fd_get_length(fd);
> > > -	xdp.frame_sz = DPAA_BP_RAW_SIZE;
> > > +	xdp.frame_sz = DPAA_BP_RAW_SIZE - DPAA_TX_PRIV_DATA_SIZE;
> > > +	xdp.rxq = &dpaa_fq->xdp_rxq;
> > >
> > >  	xdp_act = bpf_prog_run_xdp(xdp_prog, &xdp);
> > >
> > > @@ -2381,6 +2482,22 @@ static u32 dpaa_run_xdp(struct dpaa_priv *priv,
> > struct qm_fd *fd, void *vaddr,
> > >  	case XDP_PASS:
> > >  		*xdp_meta_len = xdp.data - xdp.data_meta;
> > >  		break;
> > > +	case XDP_TX:
> > > +		/* We can access the full headroom when sending the frame
> > > +		 * back out
> > 
> > And normally why a piece of headroom is taken away? I probably should
> > have
> > started from the basic XDP support patch, but if you don't mind, please
> > explain it a bit.
> 
> I mentioned we require DPAA_TX_PRIV_DATA_SIZE bytes at the start of the buffer in order to make sure we have enough space for our private info.

What is your private info?

> 
> When setting up the xdp_buff, this area is reserved from the frame size exposed to the XDP program.
>  -	xdp.frame_sz = DPAA_BP_RAW_SIZE;
>  +	xdp.frame_sz = DPAA_BP_RAW_SIZE - DPAA_TX_PRIV_DATA_SIZE;
> 
> After the XDP_TX verdict, we're sure that DPAA_TX_PRIV_DATA_SIZE bytes at the start of the buffer are free and we can use the full headroom how it suits us, hence the increase of the frame size back to DPAA_BP_RAW_SIZE.

Not at the *end* of the buffer?

> 
> Thanks for all your feedback.
> 
> > > +		 */
> > > +		xdp.data_hard_start = vaddr;
> > > +		xdp.frame_sz = DPAA_BP_RAW_SIZE;
> > > +		xdpf = xdp_convert_buff_to_frame(&xdp);
> > > +		if (unlikely(!xdpf)) {
> > > +			free_pages((unsigned long)vaddr, 0);
> > > +			break;
> > > +		}
> > > +
> > > +		if (dpaa_xdp_xmit_frame(priv->net_dev, xdpf))
> > > +			xdp_return_frame_rx_napi(xdpf);
> > > +
> > > +		break;
> > >  	default:
> > >  		bpf_warn_invalid_xdp_action(xdp_act);
> > >  		fallthrough;
> > > @@ -2415,6 +2532,7 @@ static enum qman_cb_dqrr_result

  reply	other threads:[~2020-11-23 22:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 16:29 [PATCH net-next v3 0/7] dpaa_eth: add XDP support Camelia Groza
2020-11-19 16:29 ` [PATCH net-next v3 1/7] dpaa_eth: add struct for software backpointers Camelia Groza
2020-11-19 16:29 ` [PATCH net-next v3 2/7] dpaa_eth: add basic XDP support Camelia Groza
2020-11-20  0:18   ` Maciej Fijalkowski
2020-11-20 18:50     ` Camelia Alexandra Groza
2020-11-23 22:07       ` Maciej Fijalkowski
2020-11-24 13:47         ` Camelia Alexandra Groza
2020-11-19 16:29 ` [PATCH net-next v3 3/7] dpaa_eth: limit the possible MTU range when XDP is enabled Camelia Groza
2020-11-19 16:29 ` [PATCH net-next v3 4/7] dpaa_eth: add XDP_TX support Camelia Groza
2020-11-19 23:50   ` Maciej Fijalkowski
2020-11-20 18:54     ` Camelia Alexandra Groza
2020-11-23 22:18       ` Maciej Fijalkowski [this message]
2020-11-24 13:06         ` Camelia Alexandra Groza
2020-11-19 16:29 ` [PATCH net-next v3 5/7] dpaa_eth: add XDP_REDIRECT support Camelia Groza
2020-11-19 16:29 ` [PATCH net-next v3 6/7] dpaa_eth: rename current skb A050385 erratum workaround Camelia Groza
2020-11-19 16:29 ` [PATCH net-next v3 7/7] dpaa_eth: implement the A050385 erratum workaround for XDP Camelia Groza

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=20201123221829.GC11618@ranger.igk.intel.com \
    --to=maciej.fijalkowski@intel.com \
    --cc=brouer@redhat.com \
    --cc=camelia.groza@nxp.com \
    --cc=davem@davemloft.net \
    --cc=ioana.ciornei@nxp.com \
    --cc=kuba@kernel.org \
    --cc=madalin.bucur@oss.nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeed@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).