All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Alexander Duyck <alexander.h.duyck@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, guru.anbalagane@oracle.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 02/17] i40e: Rewrite Flow Director busy wait loop
Date: Sat, 29 Oct 2016 00:30:43 -0700	[thread overview]
Message-ID: <1477726258-111563-3-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1477726258-111563-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Alexander Duyck <alexander.h.duyck@intel.com>

We can reorder the busy wait loop at the start of the Flow Director
transmit function to reduce the overall code size while still retaining the
same functionality.  As such I am taking advantage of the opportunity to do
so.

Change-ID: I34c403ca001953c6ac9816e65d5305e73d869026
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 6287bf6..af36c44 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -122,7 +122,6 @@ static int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data,
 	struct device *dev;
 	dma_addr_t dma;
 	u32 td_cmd = 0;
-	u16 delay = 0;
 	u16 i;
 
 	/* find existing FDIR VSI */
@@ -137,15 +136,11 @@ static int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data,
 	dev = tx_ring->dev;
 
 	/* we need two descriptors to add/del a filter and we can wait */
-	do {
-		if (I40E_DESC_UNUSED(tx_ring) > 1)
-			break;
+	for (i = I40E_FD_CLEAN_DELAY; I40E_DESC_UNUSED(tx_ring) < 2; i--) {
+		if (!i)
+			return -EAGAIN;
 		msleep_interruptible(1);
-		delay++;
-	} while (delay < I40E_FD_CLEAN_DELAY);
-
-	if (!(I40E_DESC_UNUSED(tx_ring) > 1))
-		return -EAGAIN;
+	}
 
 	dma = dma_map_single(dev, raw_packet,
 			     I40E_FDIR_MAX_RAW_PACKET_SIZE, DMA_TO_DEVICE);
-- 
2.7.4

  parent reply	other threads:[~2016-10-29  7:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-29  7:30 [net-next 00/17][pull request] 40GbE Intel Wired LAN Driver Updates 2016-10-28 Jeff Kirsher
2016-10-29  7:30 ` [net-next 01/17] i40e: Fix client interaction Jeff Kirsher
2016-10-29  7:30 ` Jeff Kirsher [this message]
2016-10-29  7:30 ` [net-next 03/17] i40e: Bit test mask correction Jeff Kirsher
2016-10-29  7:30 ` [net-next 04/17] i40e: Remove unused function i40e_vsi_lookup Jeff Kirsher
2016-10-29  7:30 ` [net-next 05/17] i40e: Drop code for unsupported flow types Jeff Kirsher
2016-10-29  7:30 ` [net-next 06/17] i40e: reopen client after reset Jeff Kirsher
2016-10-29  7:30 ` [net-next 07/17] i40e: group base mode VF offload flags Jeff Kirsher
2016-10-29  7:30 ` [net-next 08/17] i40e/i40evf: fix interrupt affinity bug Jeff Kirsher
2016-10-29  7:30 ` [net-next 09/17] i40e/i40evf: Changed version from 1.6.16 to 1.6.19 Jeff Kirsher
2016-10-29  7:30 ` [net-next 10/17] i40e: Make struct i40e_stats const Jeff Kirsher
2016-10-29  7:30 ` [net-next 11/17] i40e: fix confusing dmesg info for ethtool -L option Jeff Kirsher
2016-10-29  7:30 ` [net-next 12/17] i40e: Drop redundant Rx descriptor processing code Jeff Kirsher
2016-10-29  7:30 ` [net-next 13/17] i40e: Fix for long link down notification time Jeff Kirsher
2016-10-29  7:30 ` [net-next 14/17] i40e: Removal of workaround for simple MAC address filter deletion Jeff Kirsher
2016-10-29  7:30 ` [net-next 15/17] i40e/i40evf: Changed version from 1.6.19 to 1.6.21 Jeff Kirsher
2016-10-29  7:30 ` [net-next 16/17] i40e: Fix bit logic error in failure case Jeff Kirsher
2016-10-29  7:30 ` [net-next 17/17] i40e: Clean up handling of msglevel flags and debug parameter Jeff Kirsher
2016-10-29 20:21 ` [net-next 00/17][pull request] 40GbE Intel Wired LAN Driver Updates 2016-10-28 David Miller

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=1477726258-111563-3-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=guru.anbalagane@oracle.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.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 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.