All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [RFC PATCH 19/20] ixgbe: Add private flag to control buffer mode
Date: Mon, 19 Dec 2016 12:12:34 -0800	[thread overview]
Message-ID: <20161219201234.27116.38972.stgit@localhost.localdomain> (raw)
In-Reply-To: <20161219200456.27116.28900.stgit@localhost.localdomain>

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

Since there are potential drawbacks to the new Rx allocation approach I
thought it best to add a "chicken bit" so that we can turn the feature off
if in the event that a problem is found.

It also provides a means of validating the legacy Rx path in the event that
we are forced to fall back.  At some point int he future when we are
convinced we don't need it anymore we might be able to drop the legacy-rx
flag.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |   47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index fd192bf29b26..5117c1845b35 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -151,6 +151,13 @@ struct ixgbe_stats {
 };
 #define IXGBE_TEST_LEN sizeof(ixgbe_gstrings_test) / ETH_GSTRING_LEN
 
+static const char ixgbe_priv_flags_strings[][ETH_GSTRING_LEN] = {
+#define IXGBE_PRIV_FLAGS_LEGACY_RX	BIT(0)
+	"legacy-rx",
+};
+
+#define IXGBE_PRIV_FLAGS_STR_LEN ARRAY_SIZE(ixgbe_priv_flags_strings)
+
 /* currently supported speeds for 10G */
 #define ADVRTSD_MSK_10G (SUPPORTED_10000baseT_Full | \
 			 SUPPORTED_10000baseKX4_Full | \
@@ -989,6 +996,8 @@ static void ixgbe_get_drvinfo(struct net_device *netdev,
 
 	strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
 		sizeof(drvinfo->bus_info));
+
+	drvinfo->n_priv_flags = IXGBE_PRIV_FLAGS_STR_LEN;
 }
 
 static void ixgbe_get_ringparam(struct net_device *netdev,
@@ -1128,6 +1137,8 @@ static int ixgbe_get_sset_count(struct net_device *netdev, int sset)
 		return IXGBE_TEST_LEN;
 	case ETH_SS_STATS:
 		return IXGBE_STATS_LEN;
+	case ETH_SS_PRIV_FLAGS:
+		return IXGBE_PRIV_FLAGS_STR_LEN;
 	default:
 		return -EOPNOTSUPP;
 	}
@@ -1292,6 +1303,9 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
 		}
 		/* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */
 		break;
+	case ETH_SS_PRIV_FLAGS:
+		memcpy(data, ixgbe_priv_flags_strings,
+		       IXGBE_PRIV_FLAGS_STR_LEN * ETH_GSTRING_LEN);
 	}
 }
 
@@ -3237,6 +3251,37 @@ static int ixgbe_get_module_eeprom(struct net_device *dev,
 	return 0;
 }
 
+static u32 ixgbe_get_priv_flags(struct net_device *netdev)
+{
+	struct ixgbe_adapter *adapter = netdev_priv(netdev);
+	u32 priv_flags = 0;
+
+	if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY)
+		priv_flags |= IXGBE_PRIV_FLAGS_LEGACY_RX;
+
+	return priv_flags;
+}
+
+static int ixgbe_set_priv_flags(struct net_device *netdev, u32 priv_flags)
+{
+	struct ixgbe_adapter *adapter = netdev_priv(netdev);
+	unsigned int flags2 = adapter->flags2;
+
+	flags2 &= ~IXGBE_FLAG2_RX_LEGACY;
+	if (priv_flags & IXGBE_PRIV_FLAGS_LEGACY_RX)
+		flags2 |= IXGBE_FLAG2_RX_LEGACY;
+
+	if (flags2 != adapter->flags2) {
+		adapter->flags2 = flags2;
+
+		/* reset interface to repopulate queues */
+		if (netif_running(netdev))
+			ixgbe_reinit_locked(adapter);
+	}
+
+	return 0;
+}
+
 static const struct ethtool_ops ixgbe_ethtool_ops = {
 	.get_settings           = ixgbe_get_settings,
 	.set_settings           = ixgbe_set_settings,
@@ -3271,6 +3316,8 @@ static int ixgbe_get_module_eeprom(struct net_device *dev,
 	.set_rxfh		= ixgbe_set_rxfh,
 	.get_channels		= ixgbe_get_channels,
 	.set_channels		= ixgbe_set_channels,
+	.get_priv_flags		= ixgbe_get_priv_flags,
+	.set_priv_flags		= ixgbe_set_priv_flags,
 	.get_ts_info		= ixgbe_get_ts_info,
 	.get_module_info	= ixgbe_get_module_info,
 	.get_module_eeprom	= ixgbe_get_module_eeprom,


  parent reply	other threads:[~2016-12-19 20:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 20:10 [Intel-wired-lan] [RFC PATCH 00/20] Enable the use of build_skb in igb/ixgbe Alexander Duyck
2016-12-19 20:10 ` [Intel-wired-lan] [RFC PATCH 01/20] mm: Rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free Alexander Duyck
2016-12-19 20:10 ` [Intel-wired-lan] [RFC PATCH 02/20] mm: Rename __page_frag functions to __page_frag_cache, drop order from drain Alexander Duyck
2016-12-19 20:10 ` [Intel-wired-lan] [RFC PATCH 03/20] mm: Add documentation for page fragment APIs Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 04/20] igb: Add support for DMA_ATTR_WEAK_ORDERING Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 05/20] igb: Use length to determine if descriptor is done Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 06/20] igb: Limit maximum frame Rx based on MTU Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 07/20] igb: Add support for padding packet Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 08/20] igb: Add support for ethtool private flag to allow use of legacy Rx Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 09/20] igb: Break out Rx buffer page management Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 10/20] igb: Revert "igb: Revert support for build_skb in igb" Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 11/20] ixgbe: Add function for checking to see if we can reuse page Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 12/20] ixgbe: Only DMA sync frame length Alexander Duyck
2016-12-19 20:11 ` [Intel-wired-lan] [RFC PATCH 13/20] ixgbe: Update driver to make use of DMA attributes in Rx path Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 14/20] ixgbe: Update code to better handle incrementing page count Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 15/20] ixgbe: Make use of order 1 pages and 3K buffers independent of FCoE Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 16/20] ixgbe: Use length to determine if descriptor is done Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 17/20] ixgbe: Break out Rx buffer page management Alexander Duyck
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 18/20] ixgbe: Add support for padding packet Alexander Duyck
2016-12-19 20:12 ` Alexander Duyck [this message]
2016-12-19 20:12 ` [Intel-wired-lan] [RFC PATCH 20/20] ixgbe: Add support for build_skb Alexander Duyck

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=20161219201234.27116.38972.stgit@localhost.localdomain \
    --to=alexander.duyck@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.