summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorGreg Rose <gregory.v.rose@intel.com>2015-02-06 03:52:19 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-02-25 02:09:32 -0500
commit7e45ab44087c026398ff4d63c462f724b2c78deb (patch)
treec28057c49171b5a0466e6d897bfe11d03fb8784a /drivers/net
parent3b38cd17f8a022fdcc99342301bce52bf79a87a4 (diff)
i40e: Use ethtool private flags to display NPAR status
Allow an application to query the i40e driver's private flags to get the status of NPAR enablement. This will be used by applications to determine if there are NPAR specific features available. Change-ID: Ia6d9477a48f9c4cb41ca022bd433f77da3f2146c Signed-off-by: Greg Rose <gregory.v.rose@intel.com> Tested-by: Jim Young <james.m.young@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e.h3
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_ethtool.c41
2 files changed, 44 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 71092a983500..1e9576bb911e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -96,6 +96,9 @@
96#define I40E_QUEUE_WAIT_RETRY_LIMIT 10 96#define I40E_QUEUE_WAIT_RETRY_LIMIT 10
97#define I40E_INT_NAME_STR_LEN (IFNAMSIZ + 9) 97#define I40E_INT_NAME_STR_LEN (IFNAMSIZ + 9)
98 98
99/* Ethtool Private Flags */
100#define I40E_PRIV_FLAGS_NPAR_FLAG (1 << 0)
101
99#define I40E_NVM_VERSION_LO_SHIFT 0 102#define I40E_NVM_VERSION_LO_SHIFT 0
100#define I40E_NVM_VERSION_LO_MASK (0xff << I40E_NVM_VERSION_LO_SHIFT) 103#define I40E_NVM_VERSION_LO_MASK (0xff << I40E_NVM_VERSION_LO_SHIFT)
101#define I40E_NVM_VERSION_HI_SHIFT 12 104#define I40E_NVM_VERSION_HI_SHIFT 12
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 5ef77dd3763e..309bd1cf13e2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -217,6 +217,13 @@ static const char i40e_gstrings_test[][ETH_GSTRING_LEN] = {
217 217
218#define I40E_TEST_LEN (sizeof(i40e_gstrings_test) / ETH_GSTRING_LEN) 218#define I40E_TEST_LEN (sizeof(i40e_gstrings_test) / ETH_GSTRING_LEN)
219 219
220static const char i40e_priv_flags_strings[][ETH_GSTRING_LEN] = {
221 "NPAR",
222};
223
224#define I40E_PRIV_FLAGS_STR_LEN \
225 (sizeof(i40e_priv_flags_strings) / ETH_GSTRING_LEN)
226
220/** 227/**
221 * i40e_partition_setting_complaint - generic complaint for MFP restriction 228 * i40e_partition_setting_complaint - generic complaint for MFP restriction
222 * @pf: the PF struct 229 * @pf: the PF struct
@@ -1036,6 +1043,7 @@ static void i40e_get_drvinfo(struct net_device *netdev,
1036 sizeof(drvinfo->fw_version)); 1043 sizeof(drvinfo->fw_version));
1037 strlcpy(drvinfo->bus_info, pci_name(pf->pdev), 1044 strlcpy(drvinfo->bus_info, pci_name(pf->pdev),
1038 sizeof(drvinfo->bus_info)); 1045 sizeof(drvinfo->bus_info));
1046 drvinfo->n_priv_flags = I40E_PRIV_FLAGS_STR_LEN;
1039} 1047}
1040 1048
1041static void i40e_get_ringparam(struct net_device *netdev, 1049static void i40e_get_ringparam(struct net_device *netdev,
@@ -1223,6 +1231,8 @@ static int i40e_get_sset_count(struct net_device *netdev, int sset)
1223 } else { 1231 } else {
1224 return I40E_VSI_STATS_LEN(netdev); 1232 return I40E_VSI_STATS_LEN(netdev);
1225 } 1233 }
1234 case ETH_SS_PRIV_FLAGS:
1235 return I40E_PRIV_FLAGS_STR_LEN;
1226 default: 1236 default:
1227 return -EOPNOTSUPP; 1237 return -EOPNOTSUPP;
1228 } 1238 }
@@ -1396,6 +1406,13 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset,
1396 } 1406 }
1397 /* BUG_ON(p - data != I40E_STATS_LEN * ETH_GSTRING_LEN); */ 1407 /* BUG_ON(p - data != I40E_STATS_LEN * ETH_GSTRING_LEN); */
1398 break; 1408 break;
1409 case ETH_SS_PRIV_FLAGS:
1410 for (i = 0; i < I40E_PRIV_FLAGS_STR_LEN; i++) {
1411 memcpy(data, i40e_priv_flags_strings[i],
1412 ETH_GSTRING_LEN);
1413 data += ETH_GSTRING_LEN;
1414 }
1415 break;
1399 } 1416 }
1400} 1417}
1401 1418
@@ -2341,6 +2358,29 @@ static int i40e_set_channels(struct net_device *dev,
2341 return -EINVAL; 2358 return -EINVAL;
2342} 2359}
2343 2360
2361/**
2362 * i40e_get_priv_flags - report device private flags
2363 * @dev: network interface device structure
2364 *
2365 * The get string set count and the string set should be matched for each
2366 * flag returned. Add new strings for each flag to the i40e_priv_flags_strings
2367 * array.
2368 *
2369 * Returns a u32 bitmap of flags.
2370 **/
2371u32 i40e_get_priv_flags(struct net_device *dev)
2372{
2373 struct i40e_netdev_priv *np = netdev_priv(dev);
2374 struct i40e_vsi *vsi = np->vsi;
2375 struct i40e_pf *pf = vsi->back;
2376 u32 ret_flags = 0;
2377
2378 ret_flags |= pf->hw.func_caps.npar_enable ?
2379 I40E_PRIV_FLAGS_NPAR_FLAG : 0;
2380
2381 return ret_flags;
2382}
2383
2344static const struct ethtool_ops i40e_ethtool_ops = { 2384static const struct ethtool_ops i40e_ethtool_ops = {
2345 .get_settings = i40e_get_settings, 2385 .get_settings = i40e_get_settings,
2346 .set_settings = i40e_set_settings, 2386 .set_settings = i40e_set_settings,
@@ -2372,6 +2412,7 @@ static const struct ethtool_ops i40e_ethtool_ops = {
2372 .get_channels = i40e_get_channels, 2412 .get_channels = i40e_get_channels,
2373 .set_channels = i40e_set_channels, 2413 .set_channels = i40e_set_channels,
2374 .get_ts_info = i40e_get_ts_info, 2414 .get_ts_info = i40e_get_ts_info,
2415 .get_priv_flags = i40e_get_priv_flags,
2375}; 2416};
2376 2417
2377void i40e_set_ethtool_ops(struct net_device *netdev) 2418void i40e_set_ethtool_ops(struct net_device *netdev)