aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorAndrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru>2013-11-14 00:00:27 -0500
committerBen Hutchings <bhutchings@solarflare.com>2013-12-12 17:07:21 -0500
commitd43050c0c7d930cdeb10fb9201d9e2d005cef02a (patch)
treefac858aa8ab412550d1bcd66d050d5ca0e1fcf87 /drivers/net/ethernet
parent48ce5634a79265cd83e5bdb268728165c0ea85a0 (diff)
sfc: Change efx_nic_type::rx_push_indir_table to push hash key as well
The EF10 implementation already does this, and it makes more logical sense to group the RSS hash key and indirection table together. Rename the operation to rx_push_rss_config. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/sfc/ef10.c10
-rw-r--r--drivers/net/ethernet/sfc/ethtool.c2
-rw-r--r--drivers/net/ethernet/sfc/falcon.c26
-rw-r--r--drivers/net/ethernet/sfc/farch.c5
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h4
-rw-r--r--drivers/net/ethernet/sfc/nic.h4
-rw-r--r--drivers/net/ethernet/sfc/siena.c45
7 files changed, 57 insertions, 39 deletions
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 9ec6072896c2..137c46b4b405 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -77,7 +77,7 @@ struct efx_ef10_filter_table {
77/* An arbitrary search limit for the software hash table */ 77/* An arbitrary search limit for the software hash table */
78#define EFX_EF10_FILTER_SEARCH_LIMIT 200 78#define EFX_EF10_FILTER_SEARCH_LIMIT 200
79 79
80static void efx_ef10_rx_push_indir_table(struct efx_nic *efx); 80static void efx_ef10_rx_push_rss_config(struct efx_nic *efx);
81static void efx_ef10_rx_free_indir_table(struct efx_nic *efx); 81static void efx_ef10_rx_free_indir_table(struct efx_nic *efx);
82static void efx_ef10_filter_table_remove(struct efx_nic *efx); 82static void efx_ef10_filter_table_remove(struct efx_nic *efx);
83 83
@@ -679,7 +679,7 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
679 nic_data->must_restore_piobufs = false; 679 nic_data->must_restore_piobufs = false;
680 } 680 }
681 681
682 efx_ef10_rx_push_indir_table(efx); 682 efx_ef10_rx_push_rss_config(efx);
683 return 0; 683 return 0;
684} 684}
685 685
@@ -1420,12 +1420,12 @@ static void efx_ef10_rx_free_indir_table(struct efx_nic *efx)
1420 nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; 1420 nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID;
1421} 1421}
1422 1422
1423static void efx_ef10_rx_push_indir_table(struct efx_nic *efx) 1423static void efx_ef10_rx_push_rss_config(struct efx_nic *efx)
1424{ 1424{
1425 struct efx_ef10_nic_data *nic_data = efx->nic_data; 1425 struct efx_ef10_nic_data *nic_data = efx->nic_data;
1426 int rc; 1426 int rc;
1427 1427
1428 netif_dbg(efx, drv, efx->net_dev, "pushing RX indirection table\n"); 1428 netif_dbg(efx, drv, efx->net_dev, "pushing RSS config\n");
1429 1429
1430 if (nic_data->rx_rss_context == EFX_EF10_RSS_CONTEXT_INVALID) { 1430 if (nic_data->rx_rss_context == EFX_EF10_RSS_CONTEXT_INVALID) {
1431 rc = efx_ef10_alloc_rss_context(efx, &nic_data->rx_rss_context); 1431 rc = efx_ef10_alloc_rss_context(efx, &nic_data->rx_rss_context);
@@ -3574,7 +3574,7 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
3574 .tx_init = efx_ef10_tx_init, 3574 .tx_init = efx_ef10_tx_init,
3575 .tx_remove = efx_ef10_tx_remove, 3575 .tx_remove = efx_ef10_tx_remove,
3576 .tx_write = efx_ef10_tx_write, 3576 .tx_write = efx_ef10_tx_write,
3577 .rx_push_indir_table = efx_ef10_rx_push_indir_table, 3577 .rx_push_rss_config = efx_ef10_rx_push_rss_config,
3578 .rx_probe = efx_ef10_rx_probe, 3578 .rx_probe = efx_ef10_rx_probe,
3579 .rx_init = efx_ef10_rx_init, 3579 .rx_init = efx_ef10_rx_init,
3580 .rx_remove = efx_ef10_rx_remove, 3580 .rx_remove = efx_ef10_rx_remove,
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index fb8993806167..bb2af8045281 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -1034,7 +1034,7 @@ static int efx_ethtool_set_rxfh_indir(struct net_device *net_dev,
1034 struct efx_nic *efx = netdev_priv(net_dev); 1034 struct efx_nic *efx = netdev_priv(net_dev);
1035 1035
1036 memcpy(efx->rx_indir_table, indir, sizeof(efx->rx_indir_table)); 1036 memcpy(efx->rx_indir_table, indir, sizeof(efx->rx_indir_table));
1037 efx_nic_push_rx_indir_table(efx); 1037 efx->type->rx_push_rss_config(efx);
1038 return 0; 1038 return 0;
1039} 1039}
1040 1040
diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c
index 76699f4e6e04..5c6d63cfc394 100644
--- a/drivers/net/ethernet/sfc/falcon.c
+++ b/drivers/net/ethernet/sfc/falcon.c
@@ -469,6 +469,24 @@ static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id)
469} 469}
470/************************************************************************** 470/**************************************************************************
471 * 471 *
472 * RSS
473 *
474 **************************************************************************
475 */
476
477static void falcon_b0_rx_push_rss_config(struct efx_nic *efx)
478{
479 efx_oword_t temp;
480
481 /* Set hash key for IPv4 */
482 memcpy(&temp, efx->rx_hash_key, sizeof(temp));
483 efx_writeo(efx, &temp, FR_BZ_RX_RSS_TKEY);
484
485 efx_farch_rx_push_indir_table(efx);
486}
487
488/**************************************************************************
489 *
472 * EEPROM/flash 490 * EEPROM/flash
473 * 491 *
474 ************************************************************************** 492 **************************************************************************
@@ -2484,9 +2502,7 @@ static int falcon_init_nic(struct efx_nic *efx)
2484 falcon_init_rx_cfg(efx); 2502 falcon_init_rx_cfg(efx);
2485 2503
2486 if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) { 2504 if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) {
2487 /* Set hash key for IPv4 */ 2505 falcon_b0_rx_push_rss_config(efx);
2488 memcpy(&temp, efx->rx_hash_key, sizeof(temp));
2489 efx_writeo(efx, &temp, FR_BZ_RX_RSS_TKEY);
2490 2506
2491 /* Set destination of both TX and RX Flush events */ 2507 /* Set destination of both TX and RX Flush events */
2492 EFX_POPULATE_OWORD_1(temp, FRF_BZ_FLS_EVQ_ID, 0); 2508 EFX_POPULATE_OWORD_1(temp, FRF_BZ_FLS_EVQ_ID, 0);
@@ -2703,7 +2719,7 @@ const struct efx_nic_type falcon_a1_nic_type = {
2703 .tx_init = efx_farch_tx_init, 2719 .tx_init = efx_farch_tx_init,
2704 .tx_remove = efx_farch_tx_remove, 2720 .tx_remove = efx_farch_tx_remove,
2705 .tx_write = efx_farch_tx_write, 2721 .tx_write = efx_farch_tx_write,
2706 .rx_push_indir_table = efx_farch_rx_push_indir_table, 2722 .rx_push_rss_config = efx_port_dummy_op_void,
2707 .rx_probe = efx_farch_rx_probe, 2723 .rx_probe = efx_farch_rx_probe,
2708 .rx_init = efx_farch_rx_init, 2724 .rx_init = efx_farch_rx_init,
2709 .rx_remove = efx_farch_rx_remove, 2725 .rx_remove = efx_farch_rx_remove,
@@ -2798,7 +2814,7 @@ const struct efx_nic_type falcon_b0_nic_type = {
2798 .tx_init = efx_farch_tx_init, 2814 .tx_init = efx_farch_tx_init,
2799 .tx_remove = efx_farch_tx_remove, 2815 .tx_remove = efx_farch_tx_remove,
2800 .tx_write = efx_farch_tx_write, 2816 .tx_write = efx_farch_tx_write,
2801 .rx_push_indir_table = efx_farch_rx_push_indir_table, 2817 .rx_push_rss_config = falcon_b0_rx_push_rss_config,
2802 .rx_probe = efx_farch_rx_probe, 2818 .rx_probe = efx_farch_rx_probe,
2803 .rx_init = efx_farch_rx_init, 2819 .rx_init = efx_farch_rx_init,
2804 .rx_remove = efx_farch_rx_remove, 2820 .rx_remove = efx_farch_rx_remove,
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index 984e85ee76f6..4c64ad7c9200 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -1618,8 +1618,7 @@ void efx_farch_rx_push_indir_table(struct efx_nic *efx)
1618 size_t i = 0; 1618 size_t i = 0;
1619 efx_dword_t dword; 1619 efx_dword_t dword;
1620 1620
1621 if (efx_nic_rev(efx) < EFX_REV_FALCON_B0) 1621 BUG_ON(efx_nic_rev(efx) < EFX_REV_FALCON_B0);
1622 return;
1623 1622
1624 BUILD_BUG_ON(ARRAY_SIZE(efx->rx_indir_table) != 1623 BUILD_BUG_ON(ARRAY_SIZE(efx->rx_indir_table) !=
1625 FR_BZ_RX_INDIRECTION_TBL_ROWS); 1624 FR_BZ_RX_INDIRECTION_TBL_ROWS);
@@ -1745,8 +1744,6 @@ void efx_farch_init_common(struct efx_nic *efx)
1745 EFX_INVERT_OWORD(temp); 1744 EFX_INVERT_OWORD(temp);
1746 efx_writeo(efx, &temp, FR_AZ_FATAL_INTR_KER); 1745 efx_writeo(efx, &temp, FR_AZ_FATAL_INTR_KER);
1747 1746
1748 efx_farch_rx_push_indir_table(efx);
1749
1750 /* Disable the ugly timer-based TX DMA backoff and allow TX DMA to be 1747 /* Disable the ugly timer-based TX DMA backoff and allow TX DMA to be
1751 * controlled by the RX FIFO fill level. Set arbitration to one pkt/Q. 1748 * controlled by the RX FIFO fill level. Set arbitration to one pkt/Q.
1752 */ 1749 */
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 653b8782c956..1b3c4e5207c5 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -1024,7 +1024,7 @@ struct efx_mtd_partition {
1024 * @tx_init: Initialise TX queue on the NIC 1024 * @tx_init: Initialise TX queue on the NIC
1025 * @tx_remove: Free resources for TX queue 1025 * @tx_remove: Free resources for TX queue
1026 * @tx_write: Write TX descriptors and doorbell 1026 * @tx_write: Write TX descriptors and doorbell
1027 * @rx_push_indir_table: Write RSS indirection table to the NIC 1027 * @rx_push_rss_config: Write RSS hash key and indirection table to the NIC
1028 * @rx_probe: Allocate resources for RX queue 1028 * @rx_probe: Allocate resources for RX queue
1029 * @rx_init: Initialise RX queue on the NIC 1029 * @rx_init: Initialise RX queue on the NIC
1030 * @rx_remove: Free resources for RX queue 1030 * @rx_remove: Free resources for RX queue
@@ -1141,7 +1141,7 @@ struct efx_nic_type {
1141 void (*tx_init)(struct efx_tx_queue *tx_queue); 1141 void (*tx_init)(struct efx_tx_queue *tx_queue);
1142 void (*tx_remove)(struct efx_tx_queue *tx_queue); 1142 void (*tx_remove)(struct efx_tx_queue *tx_queue);
1143 void (*tx_write)(struct efx_tx_queue *tx_queue); 1143 void (*tx_write)(struct efx_tx_queue *tx_queue);
1144 void (*rx_push_indir_table)(struct efx_nic *efx); 1144 void (*rx_push_rss_config)(struct efx_nic *efx);
1145 int (*rx_probe)(struct efx_rx_queue *rx_queue); 1145 int (*rx_probe)(struct efx_rx_queue *rx_queue);
1146 void (*rx_init)(struct efx_rx_queue *rx_queue); 1146 void (*rx_init)(struct efx_rx_queue *rx_queue);
1147 void (*rx_remove)(struct efx_rx_queue *rx_queue); 1147 void (*rx_remove)(struct efx_rx_queue *rx_queue);
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h
index 5d9e2dc121f7..c665ff6c8012 100644
--- a/drivers/net/ethernet/sfc/nic.h
+++ b/drivers/net/ethernet/sfc/nic.h
@@ -762,10 +762,6 @@ int falcon_reset_xaui(struct efx_nic *efx);
762void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw); 762void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw);
763void efx_farch_init_common(struct efx_nic *efx); 763void efx_farch_init_common(struct efx_nic *efx);
764void efx_ef10_handle_drain_event(struct efx_nic *efx); 764void efx_ef10_handle_drain_event(struct efx_nic *efx);
765static inline void efx_nic_push_rx_indir_table(struct efx_nic *efx)
766{
767 efx->type->rx_push_indir_table(efx);
768}
769void efx_farch_rx_push_indir_table(struct efx_nic *efx); 765void efx_farch_rx_push_indir_table(struct efx_nic *efx);
770 766
771int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, 767int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer,
diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c
index f65db356fe09..23f3a6f7737a 100644
--- a/drivers/net/ethernet/sfc/siena.c
+++ b/drivers/net/ethernet/sfc/siena.c
@@ -321,6 +321,31 @@ fail1:
321 return rc; 321 return rc;
322} 322}
323 323
324static void siena_rx_push_rss_config(struct efx_nic *efx)
325{
326 efx_oword_t temp;
327
328 /* Set hash key for IPv4 */
329 memcpy(&temp, efx->rx_hash_key, sizeof(temp));
330 efx_writeo(efx, &temp, FR_BZ_RX_RSS_TKEY);
331
332 /* Enable IPv6 RSS */
333 BUILD_BUG_ON(sizeof(efx->rx_hash_key) <
334 2 * sizeof(temp) + FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8 ||
335 FRF_CZ_RX_RSS_IPV6_TKEY_HI_LBN != 0);
336 memcpy(&temp, efx->rx_hash_key, sizeof(temp));
337 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG1);
338 memcpy(&temp, efx->rx_hash_key + sizeof(temp), sizeof(temp));
339 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG2);
340 EFX_POPULATE_OWORD_2(temp, FRF_CZ_RX_RSS_IPV6_THASH_ENABLE, 1,
341 FRF_CZ_RX_RSS_IPV6_IP_THASH_ENABLE, 1);
342 memcpy(&temp, efx->rx_hash_key + 2 * sizeof(temp),
343 FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8);
344 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG3);
345
346 efx_farch_rx_push_indir_table(efx);
347}
348
324/* This call performs hardware-specific global initialisation, such as 349/* This call performs hardware-specific global initialisation, such as
325 * defining the descriptor cache sizes and number of RSS channels. 350 * defining the descriptor cache sizes and number of RSS channels.
326 * It does not set up any buffers, descriptor rings or event queues. 351 * It does not set up any buffers, descriptor rings or event queues.
@@ -361,23 +386,7 @@ static int siena_init_nic(struct efx_nic *efx)
361 EFX_RX_USR_BUF_SIZE >> 5); 386 EFX_RX_USR_BUF_SIZE >> 5);
362 efx_writeo(efx, &temp, FR_AZ_RX_CFG); 387 efx_writeo(efx, &temp, FR_AZ_RX_CFG);
363 388
364 /* Set hash key for IPv4 */ 389 siena_rx_push_rss_config(efx);
365 memcpy(&temp, efx->rx_hash_key, sizeof(temp));
366 efx_writeo(efx, &temp, FR_BZ_RX_RSS_TKEY);
367
368 /* Enable IPv6 RSS */
369 BUILD_BUG_ON(sizeof(efx->rx_hash_key) <
370 2 * sizeof(temp) + FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8 ||
371 FRF_CZ_RX_RSS_IPV6_TKEY_HI_LBN != 0);
372 memcpy(&temp, efx->rx_hash_key, sizeof(temp));
373 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG1);
374 memcpy(&temp, efx->rx_hash_key + sizeof(temp), sizeof(temp));
375 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG2);
376 EFX_POPULATE_OWORD_2(temp, FRF_CZ_RX_RSS_IPV6_THASH_ENABLE, 1,
377 FRF_CZ_RX_RSS_IPV6_IP_THASH_ENABLE, 1);
378 memcpy(&temp, efx->rx_hash_key + 2 * sizeof(temp),
379 FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8);
380 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG3);
381 390
382 /* Enable event logging */ 391 /* Enable event logging */
383 rc = efx_mcdi_log_ctrl(efx, true, false, 0); 392 rc = efx_mcdi_log_ctrl(efx, true, false, 0);
@@ -940,7 +949,7 @@ const struct efx_nic_type siena_a0_nic_type = {
940 .tx_init = efx_farch_tx_init, 949 .tx_init = efx_farch_tx_init,
941 .tx_remove = efx_farch_tx_remove, 950 .tx_remove = efx_farch_tx_remove,
942 .tx_write = efx_farch_tx_write, 951 .tx_write = efx_farch_tx_write,
943 .rx_push_indir_table = efx_farch_rx_push_indir_table, 952 .rx_push_rss_config = siena_rx_push_rss_config,
944 .rx_probe = efx_farch_rx_probe, 953 .rx_probe = efx_farch_rx_probe,
945 .rx_init = efx_farch_rx_init, 954 .rx_init = efx_farch_rx_init,
946 .rx_remove = efx_farch_rx_remove, 955 .rx_remove = efx_farch_rx_remove,