From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Mitch Williams <mitch.a.williams@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 13/17] i40evf: refactor ethtool RSS handling
Date: Fri, 21 Nov 2014 21:55:04 -0800 [thread overview]
Message-ID: <1416635708-4765-15-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1416635708-4765-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Mitch Williams <mitch.a.williams@intel.com>
Add support for setting the RSS key as it is now implemented.
Change-ID: I9290ae3ea99d0e46053540650f95e24a24e453f1
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 66 ++++++++++++++++------
1 file changed, 50 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
index 69a269b..ed0e4dc 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
@@ -608,6 +608,19 @@ static void i40evf_get_channels(struct net_device *netdev,
ch->combined_count = adapter->num_active_queues;
}
+#define I40EVF_HLUT_ARRAY_SIZE ((I40E_VFQF_HLUT_MAX_INDEX + 1) * 4)
+#define I40EVF_HKEY_ARRAY_SIZE ((I40E_VFQF_HKEY_MAX_INDEX * 1) * 4)
+/**
+ * i40evf_get_rxfh_key_size - get the RSS hash key size
+ * @netdev: network interface device structure
+ *
+ * Returns the table size.
+ **/
+static u32 i40evf_get_rxfh_key_size(struct net_device *netdev)
+{
+ return I40EVF_HKEY_ARRAY_SIZE;
+}
+
/**
* i40evf_get_rxfh_indir_size - get the rx flow hash indirection table size
* @netdev: network interface device structure
@@ -616,7 +629,7 @@ static void i40evf_get_channels(struct net_device *netdev,
**/
static u32 i40evf_get_rxfh_indir_size(struct net_device *netdev)
{
- return (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
+ return I40EVF_HLUT_ARRAY_SIZE;
}
/**
@@ -631,19 +644,28 @@ static int i40evf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
{
struct i40evf_adapter *adapter = netdev_priv(netdev);
struct i40e_hw *hw = &adapter->hw;
- u32 hlut_val;
+ u32 reg_val;
int i, j;
for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
- hlut_val = rd32(hw, I40E_VFQF_HLUT(i));
- indir[j++] = hlut_val & 0xff;
- indir[j++] = (hlut_val >> 8) & 0xff;
- indir[j++] = (hlut_val >> 16) & 0xff;
- indir[j++] = (hlut_val >> 24) & 0xff;
+ reg_val = rd32(hw, I40E_VFQF_HLUT(i));
+ indir[j++] = reg_val & 0xff;
+ indir[j++] = (reg_val >> 8) & 0xff;
+ indir[j++] = (reg_val >> 16) & 0xff;
+ indir[j++] = (reg_val >> 24) & 0xff;
+ }
+
+ if (key) {
+ for (i = 0, j = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) {
+ reg_val = rd32(hw, I40E_VFQF_HKEY(i));
+ key[j++] = (u8)(reg_val & 0xff);
+ key[j++] = (u8)((reg_val >> 8) & 0xff);
+ key[j++] = (u8)((reg_val >> 16) & 0xff);
+ key[j++] = (u8)((reg_val >> 24) & 0xff);
+ }
}
return 0;
}
-
/**
* i40evf_set_rxfh - set the rx flow hash indirection table
* @netdev: network interface device structure
@@ -658,17 +680,27 @@ static int i40evf_set_rxfh(struct net_device *netdev, const u32 *indir,
{
struct i40evf_adapter *adapter = netdev_priv(netdev);
struct i40e_hw *hw = &adapter->hw;
- u32 hlut_val;
+ u32 reg_val;
int i, j;
- for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
- hlut_val = indir[j++];
- hlut_val |= indir[j++] << 8;
- hlut_val |= indir[j++] << 16;
- hlut_val |= indir[j++] << 24;
- wr32(hw, I40E_VFQF_HLUT(i), hlut_val);
+ if (indir) {
+ for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
+ reg_val = indir[j++];
+ reg_val |= indir[j++] << 8;
+ reg_val |= indir[j++] << 16;
+ reg_val |= indir[j++] << 24;
+ wr32(hw, I40E_VFQF_HLUT(i), reg_val);
+ }
+ }
+ if (key) {
+ for (i = 0, j = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) {
+ reg_val = key[j++];
+ reg_val |= key[j++] << 8;
+ reg_val |= key[j++] << 16;
+ reg_val |= key[j++] << 24;
+ wr32(hw, I40E_VFQF_HKEY(i), reg_val);
+ }
}
-
return 0;
}
@@ -687,10 +719,12 @@ static const struct ethtool_ops i40evf_ethtool_ops = {
.set_coalesce = i40evf_set_coalesce,
.get_rxnfc = i40evf_get_rxnfc,
.set_rxnfc = i40evf_set_rxnfc,
+ .get_rxfh_key_size = i40evf_get_rxfh_key_size,
.get_rxfh_indir_size = i40evf_get_rxfh_indir_size,
.get_rxfh = i40evf_get_rxfh,
.set_rxfh = i40evf_set_rxfh,
.get_channels = i40evf_get_channels,
+
};
/**
--
1.9.3
next prev parent reply other threads:[~2014-11-22 5:55 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-22 5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
2014-11-22 5:54 ` [net-next 01/17] i40e: Remove unneeded break statement Jeff Kirsher
2014-11-22 5:58 ` Jeff Kirsher
2014-11-22 5:54 ` Jeff Kirsher
2014-11-22 5:54 ` [net-next 02/17] i40e: remove useless debug noise Jeff Kirsher
2014-11-22 5:54 ` [net-next 03/17] i40e: allow various base numbers in debugfs aq commands Jeff Kirsher
2014-11-24 16:50 ` David Laight
2014-11-24 17:26 ` Nelson, Shannon
2014-11-22 5:54 ` [net-next 04/17] i40e: Add description to misc and fd interrupts Jeff Kirsher
2014-11-22 5:54 ` [net-next 05/17] i40e: don't enable PTP support on more than one PF per port Jeff Kirsher
2014-11-22 5:54 ` [net-next 06/17] i40e: Add a virtual channel op to config RSS Jeff Kirsher
2014-11-22 5:54 ` [net-next 07/17] i40e: Define and use i40e_is_vf macro Jeff Kirsher
2014-11-22 5:54 ` [net-next 08/17] i40e: fix netdev_stat macro definition Jeff Kirsher
2014-11-22 5:55 ` [net-next 09/17] i40evf: make early init sequence even more robust Jeff Kirsher
2014-11-22 5:55 ` [net-next 10/17] i40e: Increase reset delay Jeff Kirsher
2014-11-22 5:55 ` [net-next 11/17] i40e: Add new update VSI flow to accommodate FW fix with VSI Loopback mode Jeff Kirsher
2014-11-22 5:55 ` [net-next 12/17] i40e: Re enable Main VSI loopback setting in the reset path Jeff Kirsher
2014-11-22 5:55 ` Jeff Kirsher [this message]
2014-11-23 3:44 ` [net-next 13/17] i40evf: refactor ethtool RSS handling Ben Hutchings
2014-11-22 5:55 ` [net-next 14/17] i40e: implement ethtool RSS config Jeff Kirsher
2014-11-22 18:22 ` Eric Dumazet
2014-11-23 3:52 ` Ben Hutchings
2014-11-23 3:53 ` Ben Hutchings
2014-11-22 5:55 ` [net-next 15/17] i40e: increase ARQ size Jeff Kirsher
2014-11-22 5:55 ` [net-next 16/17] i40e: get pf_id from HW rather than PCI function Jeff Kirsher
2014-11-22 5:55 ` [net-next 17/17] i40e: Bump i40e version to 1.2.2 and i40evf version to 1.0.6 Jeff Kirsher
2014-11-23 19:22 ` [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 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=1416635708-4765-15-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=jogreene@redhat.com \
--cc=mitch.a.williams@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).