From: John Fastabend <john.fastabend@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [net-next PATCH v3 1/3] ixgbe: add XDP support for pass and drop actions
Date: Thu, 9 Mar 2017 08:33:39 -0800 [thread overview]
Message-ID: <58C183E3.7000300@gmail.com> (raw)
In-Reply-To: <CAKgT0Uce50xKSYvVdnZxFeKyPoNtUF=kzguMOascwvev5ue5Lw@mail.gmail.com>
On 17-03-03 12:55 PM, Alexander Duyck wrote:
> On Fri, Mar 3, 2017 at 9:57 AM, John Fastabend <john.fastabend@gmail.com> wrote:
>> Basic XDP drop support for ixgbe. Uses READ_ONCE/xchg semantics on XDP
>> programs instead of rcu primitives as suggested by Daniel Borkmann and
>> Alex Duyck.
>>
>> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>> ---
>> drivers/net/ethernet/intel/ixgbe/ixgbe.h | 4 +
>> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 -
>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 123 +++++++++++++++++++++-
>> 3 files changed, 120 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
>> index b812913..6eaf506 100644
[...]
I'll fix style comments in next version.
>> if (!skb) {
>> @@ -6061,7 +6120,8 @@ static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter)
>> *
>> * Returns 0 on success, negative on failure
>> **/
>> -int ixgbe_setup_rx_resources(struct ixgbe_ring *rx_ring)
>> +int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
>> + struct ixgbe_ring *rx_ring)
>> {
>> struct device *dev = rx_ring->dev;
>> int orig_node = dev_to_node(dev);
>> @@ -6098,6 +6158,8 @@ int ixgbe_setup_rx_resources(struct ixgbe_ring *rx_ring)
>> rx_ring->next_to_clean = 0;
>> rx_ring->next_to_use = 0;
>>
>> + xchg(&rx_ring->xdp_prog, adapter->xdp_prog);
>> +
>> return 0;
>> err:
>> vfree(rx_ring->rx_buffer_info);
>
> It occurs to me that I am not sure we even need the xchg here. This
> should be protected by an the rtnl lock anyway. So I don't think we
> need the xchg unless XDP can update things outside the rtnl lock which
> if it can we have other issues since adapter->xdp_prog could then be
> updated while this is going on.
>
>> @@ -6121,10 +6183,11 @@ static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter)
>> int i, err = 0;
>>
>> for (i = 0; i < adapter->num_rx_queues; i++) {
>> - err = ixgbe_setup_rx_resources(adapter->rx_ring[i]);
>> + struct ixgbe_ring *rx_ring = adapter->rx_ring[i];
>> +
>> + err = ixgbe_setup_rx_resources(adapter, rx_ring);
>> if (!err)
>> continue;
>> -
>
> There is a bunch of noise here. Don't bother modifying white space,
> just add the adapter reference to the function call. It will still
> be below 80 characters anyway.
>
>> e_err(probe, "Allocation for Rx Queue %u failed\n", i);
>> goto err_setup_rx;
>> }
>> @@ -6189,6 +6252,7 @@ void ixgbe_free_rx_resources(struct ixgbe_ring *rx_ring)
>> {
>> ixgbe_clean_rx_ring(rx_ring);
>>
>> + xchg(&rx_ring->xdp_prog, NULL);
>> vfree(rx_ring->rx_buffer_info);
>> rx_ring->rx_buffer_info = NULL;
>>
>
> Same question that I had for the other xchg. Do we even need it? The
> NAPI polling routine should already be unregistered since we are
> freeing rings at this point. Odds are we can probably just assign
> NULL as a value and skip the xchg assuming all callers of this
> function are holding the rtnl.
>
As long as we can guarantee the ring is down and no traffic is being received
then the xchg is not needed. In both of the above cases.
Thanks,
John
next prev parent reply other threads:[~2017-03-09 16:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 17:56 [Intel-wired-lan] [net-next PATCH v3 0/3] ixgbe XDP series John Fastabend
2017-03-03 17:57 ` [Intel-wired-lan] [net-next PATCH v3 1/3] ixgbe: add XDP support for pass and drop actions John Fastabend
2017-03-03 20:55 ` Alexander Duyck
2017-03-09 16:33 ` John Fastabend [this message]
2017-03-09 21:35 ` Alexander Duyck
2017-03-03 17:57 ` [Intel-wired-lan] [net-next PATCH v3 2/3] ixgbe: add support for XDP_TX action John Fastabend
2017-03-03 21:31 ` Alexander Duyck
2017-03-03 17:57 ` [Intel-wired-lan] [net-next PATCH v3 3/3] ixgbe: xdp support for adjust head 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=58C183E3.7000300@gmail.com \
--to=john.fastabend@gmail.com \
--cc=intel-wired-lan@osuosl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.