aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2014-11-16 09:23:13 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-16 15:59:12 -0500
commit22f258a1cc2f35d2f5800276360c2aeed385b24e (patch)
treef7d73be86d3e49f6f9114b8089532e373aea063d /drivers/net/ethernet/intel
parentc41a4fba4a220c644ba6641c779cf427729f2eec (diff)
i40e: use netdev_rss_key_fill() helper
Use of well known RSS key increases attack surface. Switch to a random one, using generic helper so that all ports share a common key. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c10
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c11
2 files changed, 6 insertions, 15 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index de664631c807..a0bee83ab2de 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7002,20 +7002,16 @@ static int i40e_setup_misc_vector(struct i40e_pf *pf)
7002 **/ 7002 **/
7003static int i40e_config_rss(struct i40e_pf *pf) 7003static int i40e_config_rss(struct i40e_pf *pf)
7004{ 7004{
7005 /* Set of random keys generated using kernel random number generator */ 7005 u32 rss_key[I40E_PFQF_HKEY_MAX_INDEX + 1];
7006 static const u32 seed[I40E_PFQF_HKEY_MAX_INDEX + 1] = {0x41b01687,
7007 0x183cfd8c, 0xce880440, 0x580cbc3c, 0x35897377,
7008 0x328b25e1, 0x4fa98922, 0xb7d90c14, 0xd5bad70d,
7009 0xcd15a2c1, 0xe8580225, 0x4a1e9d11, 0xfe5731be};
7010 struct i40e_hw *hw = &pf->hw; 7006 struct i40e_hw *hw = &pf->hw;
7011 u32 lut = 0; 7007 u32 lut = 0;
7012 int i, j; 7008 int i, j;
7013 u64 hena; 7009 u64 hena;
7014 u32 reg_val; 7010 u32 reg_val;
7015 7011
7016 /* Fill out hash function seed */ 7012 netdev_rss_key_fill(rss_key, sizeof(rss_key));
7017 for (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) 7013 for (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++)
7018 wr32(hw, I40E_PFQF_HKEY(i), seed[i]); 7014 wr32(hw, I40E_PFQF_HKEY(i), rss_key[i]);
7019 7015
7020 /* By default we enable TCP/UDP with IPv4/IPv6 ptypes */ 7016 /* By default we enable TCP/UDP with IPv4/IPv6 ptypes */
7021 hena = (u64)rd32(hw, I40E_PFQF_HENA(0)) | 7017 hena = (u64)rd32(hw, I40E_PFQF_HENA(0)) |
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index f0d07ad54198..489227891ffb 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -1434,18 +1434,12 @@ static int next_queue(struct i40evf_adapter *adapter, int j)
1434 **/ 1434 **/
1435static void i40evf_configure_rss(struct i40evf_adapter *adapter) 1435static void i40evf_configure_rss(struct i40evf_adapter *adapter)
1436{ 1436{
1437 u32 rss_key[I40E_VFQF_HKEY_MAX_INDEX + 1];
1437 struct i40e_hw *hw = &adapter->hw; 1438 struct i40e_hw *hw = &adapter->hw;
1438 u32 lut = 0; 1439 u32 lut = 0;
1439 int i, j; 1440 int i, j;
1440 u64 hena; 1441 u64 hena;
1441 1442
1442 /* Set of random keys generated using kernel random number generator */
1443 static const u32 seed[I40E_VFQF_HKEY_MAX_INDEX + 1] = {
1444 0x794221b4, 0xbca0c5ab, 0x6cd5ebd9, 0x1ada6127,
1445 0x983b3aa1, 0x1c4e71eb, 0x7f6328b2, 0xfcdc0da0,
1446 0xc135cafa, 0x7a6f7e2d, 0xe7102d28, 0x163cd12e,
1447 0x4954b126 };
1448
1449 /* No RSS for single queue. */ 1443 /* No RSS for single queue. */
1450 if (adapter->num_active_queues == 1) { 1444 if (adapter->num_active_queues == 1) {
1451 wr32(hw, I40E_VFQF_HENA(0), 0); 1445 wr32(hw, I40E_VFQF_HENA(0), 0);
@@ -1454,8 +1448,9 @@ static void i40evf_configure_rss(struct i40evf_adapter *adapter)
1454 } 1448 }
1455 1449
1456 /* Hash type is configured by the PF - we just supply the key */ 1450 /* Hash type is configured by the PF - we just supply the key */
1451 netdev_rss_key_fill(rss_key, sizeof(rss_key));
1457 for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) 1452 for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++)
1458 wr32(hw, I40E_VFQF_HKEY(i), seed[i]); 1453 wr32(hw, I40E_VFQF_HKEY(i), rss_key[i]);
1459 1454
1460 /* Enable PCTYPES for RSS, TCP/UDP with IPv4/IPv6 */ 1455 /* Enable PCTYPES for RSS, TCP/UDP with IPv4/IPv6 */
1461 hena = I40E_DEFAULT_RSS_HENA; 1456 hena = I40E_DEFAULT_RSS_HENA;