public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jakub Kicinski <kubakici@wp•pl>
To: John Fastabend <john.fastabend@gmail•com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel•com>,
	davem@davemloft•net, netdev@vger•kernel.org, nhorman@redhat•com,
	sassmann@redhat•com, jogreene@redhat•com,
	John Fastabend <john.r.fastabend@intel•com>
Subject: Re: [net-next 03/11] ixgbe: add support for XDP_TX action
Date: Sat, 22 Apr 2017 20:52:25 -0700	[thread overview]
Message-ID: <20170422205226.1389d2dc@cakuba.lan> (raw)
In-Reply-To: <58FC2226.3070207@gmail.com>

On Sat, 22 Apr 2017 20:40:22 -0700, John Fastabend wrote:
> >> @@ -9557,7 +9739,21 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog)
> >>  			return -EINVAL;
> >>  	}
> >>  
> >> +	if (nr_cpu_ids > MAX_XDP_QUEUES)
> >> +		return -ENOMEM;
> >> +
> >>  	old_prog = xchg(&adapter->xdp_prog, prog);
> >> +
> >> +	/* If transitioning XDP modes reconfigure rings */
> >> +	if (!!prog != !!old_prog) {
> >> +		int err = ixgbe_setup_tc(dev, netdev_get_num_tc(dev));
> >> +
> >> +		if (err) {
> >> +			rcu_assign_pointer(adapter->xdp_prog, old_prog);
> >> +			return -EINVAL;
> >> +		}
> >> +	}
> >> +
> >>  	for (i = 0; i < adapter->num_rx_queues; i++)
> >>  		xchg(&adapter->rx_ring[i]->xdp_prog, adapter->xdp_prog);
> >>    
> > 
> > In case of disabling XDP I assume ixgbe_setup_tc() will free the rings
> > before the xdp_prog on the rings is swapped to NULL.  Is there anything
> > preventing TX in that time window?  I think usual ordering would be to
> > install the prog after reconfig but uninstall before.
> >   
> 
> Well in the ixgbe_setup_tc() case we set the rx_ring->xdp_prog in
> ixgbe_setup_rx_resorources(), while the dma engine is disabled, so the for
> loop is just doing another set on the rx_ring assigning it to the program
> already set previously.
> 
> Its not really buggy its just extra useless work so I'll change it to this,
> 
> 	if (!!prog != !!old_prog) {
> 		...
> 	} else {
> 		for ( ... )
> 			swap xdp prog
> 	}
> 
> Nice spot, thanks for reviewing. And I missed a build error so I'll roll these
> fixes in a resend.

Ah, thanks for explaining.  No bugs that I can spot then :)

  reply	other threads:[~2017-04-23  3:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21  1:50 [net-next 00/11][pull request] 10GbE Intel Wired LAN Driver Updates 2017-04-20 Jeff Kirsher
2017-04-21  1:50 ` [net-next 01/11] ixgbe: Acquire PHY semaphore before device reset Jeff Kirsher
2017-04-21  1:50 ` [net-next 02/11] ixgbe: add XDP support for pass and drop actions Jeff Kirsher
2017-04-21 16:52   ` Tantilov, Emil S
2017-04-21  1:50 ` [net-next 03/11] ixgbe: add support for XDP_TX action Jeff Kirsher
2017-04-23  2:24   ` Jakub Kicinski
2017-04-23  3:40     ` John Fastabend
2017-04-23  3:52       ` Jakub Kicinski [this message]
2017-04-21  1:50 ` [net-next 04/11] ixgbe: delay tail write to every 'n' packets Jeff Kirsher
2017-04-21  1:50 ` [net-next 05/11] ixgbe: clean macvlan MAC filter table on VF reset Jeff Kirsher
2017-04-21  1:50 ` [net-next 06/11] ixgbevf: fix size of queue stats length Jeff Kirsher
2017-04-21  1:50 ` [net-next 07/11] ixgbe: Allow setting zero MAC address for VF Jeff Kirsher
2017-04-21  1:50 ` [net-next 08/11] ixgbe: Add 1000Base-T device based on X550EM_X MAC Jeff Kirsher
2017-04-21  1:50 ` [net-next 09/11] ixgbe: Check for RSS key before setting value Jeff Kirsher
2017-04-21  1:50 ` [net-next 10/11] ixgbevf: Fix errors in retrieving RETA and RSS from PF Jeff Kirsher
2017-04-21  1:50 ` [net-next 11/11] ixgbevf: Check for RSS key before setting value Jeff Kirsher
2017-04-21 18:18 ` [net-next 00/11][pull request] 10GbE Intel Wired LAN Driver Updates 2017-04-20 David Miller
2017-04-23  3:41   ` John Fastabend

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=20170422205226.1389d2dc@cakuba.lan \
    --to=kubakici@wp$(echo .)pl \
    --cc=davem@davemloft$(echo .)net \
    --cc=jeffrey.t.kirsher@intel$(echo .)com \
    --cc=jogreene@redhat$(echo .)com \
    --cc=john.fastabend@gmail$(echo .)com \
    --cc=john.r.fastabend@intel$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nhorman@redhat$(echo .)com \
    --cc=sassmann@redhat$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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