* [PATCH 1/2] ixgbe: Avoid to write the RETA table when unnecessary.
@ 2018-01-23 15:24 Tonghao Zhang
2018-01-23 15:24 ` [PATCH 2/2] ixgbe: Set rss key in order Tonghao Zhang
2018-01-23 15:28 ` [PATCH 1/2] ixgbe: Avoid to write the RETA table when unnecessary Jeff Kirsher
0 siblings, 2 replies; 4+ messages in thread
From: Tonghao Zhang @ 2018-01-23 15:24 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, Tonghao Zhang
If indir == 0 in the ixgbe_set_rxfh(), it is unnecessary
to write the HW. Because redirection table is not changed.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 0aaf70b..0f1d642 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -3060,6 +3060,8 @@ static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir,
for (i = 0; i < reta_entries; i++)
adapter->rss_indir_tbl[i] = indir[i];
+
+ ixgbe_store_reta(adapter);
}
/* Fill out the rss hash key */
@@ -3068,7 +3070,6 @@ static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir,
ixgbe_store_key(adapter);
}
- ixgbe_store_reta(adapter);
return 0;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ixgbe: Set rss key in order.
2018-01-23 15:24 [PATCH 1/2] ixgbe: Avoid to write the RETA table when unnecessary Tonghao Zhang
@ 2018-01-23 15:24 ` Tonghao Zhang
2018-01-23 16:24 ` Alexander Duyck
2018-01-23 15:28 ` [PATCH 1/2] ixgbe: Avoid to write the RETA table when unnecessary Jeff Kirsher
1 sibling, 1 reply; 4+ messages in thread
From: Tonghao Zhang @ 2018-01-23 15:24 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, Tonghao Zhang
If we use ethtool to set rss key, for example,
we except 0x6d is K[0], and 0x5a is K[1]. But
the ixgbe driver set the 0xda is K[0].
ethtool -X eth0 hkey 6d:5a:56:da:25:5b:0e:c2:41:67:25:3d
:43:a3:8f:b0:d0:ca:2b:cb:ae:7b:30:b4:77:cb:2d:a3
:80:30:f2:0c:6a:42:b7:3b:be:ac:01:fa
The key is the original Microsoft's key.
7.1.2.8.1 RSS Hash Function: (82599 datasheet)
Given an array K with k bytes, our nomenclature assumes
that the array is laid out as follows:
K[0] K[1] K[2] ... K[k-1]
K[0] is the left-most byte, and the MSB of K[0] is the
left-most bit. K[k-1] is the right-most byte, and the
LSB of K[k-1] is the right-most bit.
8.2.3.7.14 RSS Random Key Register:
The K[0] is the 7:0 bit of RSSRK (RSS Random Key Register).
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 95aba97..0ca2e0e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3777,10 +3777,18 @@ u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter)
void ixgbe_store_key(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
- int i;
+ u8 *rss_key = (u8 *)adapter->rss_key;
+ u32 key, i;
- for (i = 0; i < 10; i++)
- IXGBE_WRITE_REG(hw, IXGBE_RSSRK(i), adapter->rss_key[i]);
+ /* Fill out hash function seeds */
+ for (i = 0; i < 10; i++) {
+ key = rss_key[(i * 4)];
+ key |= rss_key[(i * 4) + 1] << 8;
+ key |= rss_key[(i * 4) + 2] << 16;
+ key |= rss_key[(i * 4) + 3] << 24;
+
+ IXGBE_WRITE_REG(hw, IXGBE_RSSRK(i), key);
+ }
}
/**
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ixgbe: Avoid to write the RETA table when unnecessary.
2018-01-23 15:24 [PATCH 1/2] ixgbe: Avoid to write the RETA table when unnecessary Tonghao Zhang
2018-01-23 15:24 ` [PATCH 2/2] ixgbe: Set rss key in order Tonghao Zhang
@ 2018-01-23 15:28 ` Jeff Kirsher
1 sibling, 0 replies; 4+ messages in thread
From: Jeff Kirsher @ 2018-01-23 15:28 UTC (permalink / raw)
To: Tonghao Zhang; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]
On Tue, 2018-01-23 at 07:24 -0800, Tonghao Zhang wrote:
> If indir == 0 in the ixgbe_set_rxfh(), it is unnecessary
> to write the HW. Because redirection table is not changed.
>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Please send this series to the intel-wired-lan@lists.osuosl.org mailing
list.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ixgbe: Set rss key in order.
2018-01-23 15:24 ` [PATCH 2/2] ixgbe: Set rss key in order Tonghao Zhang
@ 2018-01-23 16:24 ` Alexander Duyck
0 siblings, 0 replies; 4+ messages in thread
From: Alexander Duyck @ 2018-01-23 16:24 UTC (permalink / raw)
To: Tonghao Zhang; +Cc: Jeff Kirsher, Netdev
On Tue, Jan 23, 2018 at 7:24 AM, Tonghao Zhang <xiangxia.m.yue@gmail.com> wrote:
> If we use ethtool to set rss key, for example,
> we except 0x6d is K[0], and 0x5a is K[1]. But
> the ixgbe driver set the 0xda is K[0].
>
> ethtool -X eth0 hkey 6d:5a:56:da:25:5b:0e:c2:41:67:25:3d
> :43:a3:8f:b0:d0:ca:2b:cb:ae:7b:30:b4:77:cb:2d:a3
> :80:30:f2:0c:6a:42:b7:3b:be:ac:01:fa
>
> The key is the original Microsoft's key.
>
> 7.1.2.8.1 RSS Hash Function: (82599 datasheet)
> Given an array K with k bytes, our nomenclature assumes
> that the array is laid out as follows:
>
> K[0] K[1] K[2] ... K[k-1]
>
> K[0] is the left-most byte, and the MSB of K[0] is the
> left-most bit. K[k-1] is the right-most byte, and the
> LSB of K[k-1] is the right-most bit.
>
> 8.2.3.7.14 RSS Random Key Register:
> The K[0] is the 7:0 bit of RSSRK (RSS Random Key Register).
>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 95aba97..0ca2e0e 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -3777,10 +3777,18 @@ u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter)
> void ixgbe_store_key(struct ixgbe_adapter *adapter)
> {
> struct ixgbe_hw *hw = &adapter->hw;
> - int i;
> + u8 *rss_key = (u8 *)adapter->rss_key;
> + u32 key, i;
>
> - for (i = 0; i < 10; i++)
> - IXGBE_WRITE_REG(hw, IXGBE_RSSRK(i), adapter->rss_key[i]);
> + /* Fill out hash function seeds */
> + for (i = 0; i < 10; i++) {
> + key = rss_key[(i * 4)];
> + key |= rss_key[(i * 4) + 1] << 8;
> + key |= rss_key[(i * 4) + 2] << 16;
> + key |= rss_key[(i * 4) + 3] << 24;
> +
> + IXGBE_WRITE_REG(hw, IXGBE_RSSRK(i), key);
> + }
> }
>
> /**
I would argue the issue here isn't in ixgbe_store_key. The problem
appears to be in ixgbe_set_rxfh and ixgbe_get_rxfh. It seems the key
provided should be populated as if it were a __be32 array, not a u32
array. So doing a memcpy from the u8 to u32 isn't correct in this
case. Really what should probably be happening is the population of
rss_key should be done using a for loop with be32_to_cpu calls, and
when we display it we should be using cpu_to_be32 to translate it
back.
An alternative would be to convert the rss_key pointer in the adapter
struct to be a be32 array pointer in the first place, and then change
the key population code to use be32_to_cpup in order to do the correct
byte swapping before writing the the value to the register.
Also as pointed out by Jeff please submit this to the intel-wired-lan
mailing list next time.
Thanks.
- Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-23 16:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-23 15:24 [PATCH 1/2] ixgbe: Avoid to write the RETA table when unnecessary Tonghao Zhang
2018-01-23 15:24 ` [PATCH 2/2] ixgbe: Set rss key in order Tonghao Zhang
2018-01-23 16:24 ` Alexander Duyck
2018-01-23 15:28 ` [PATCH 1/2] ixgbe: Avoid to write the RETA table when unnecessary Jeff Kirsher
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).