]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ixgbe: Add private flag to control buffer mode
authorAlexander Duyck <alexander.h.duyck@intel.com>
Tue, 17 Jan 2017 16:37:03 +0000 (08:37 -0800)
committerJack Vogel <jack.vogel@oracle.com>
Fri, 16 Jun 2017 06:01:23 +0000 (23:01 -0700)
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 in the 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>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Orabug: 26242766
(cherry picked from commit 2ccdf26ff614dd49b14e76c0c076f5f4e9562e79)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Ethan Zhao <ethan.zhao@oracle.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

index f9ae99a5b5b830c75555f4a0e8b7a7d939d7f971..9fa463f7ab18b49c11c3ff18203e3f248d4299d2 100644 (file)
@@ -151,6 +151,13 @@ static const char ixgbe_gstrings_test[][ETH_GSTRING_LEN] = {
 };
 #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 | \
@@ -1143,6 +1150,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;
        }
@@ -1267,6 +1276,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);
        }
 }
 
@@ -3348,6 +3360,37 @@ static int ixgbe_set_eee(struct net_device *netdev, struct ethtool_eee *edata)
        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,
@@ -3384,6 +3427,8 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
        .set_eee                = ixgbe_set_eee,
        .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,