diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-04-28 05:29:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-28 15:44:37 -0400 |
commit | d614cfbc2f6f631e4dba72f945f185ea45ff3f78 (patch) | |
tree | 37316d72ccb0d6f363387abae2de14e32d7f60d6 /drivers/net/sfc | |
parent | 97e1eaa0e943439208a692b00dce4a8a3006760f (diff) |
sfc: Enable IPv6 RSS using random key for Toeplitz hash
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r-- | drivers/net/sfc/nic.h | 2 | ||||
-rw-r--r-- | drivers/net/sfc/siena.c | 19 |
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h index 7e3bec8561b8..5825f37b51bd 100644 --- a/drivers/net/sfc/nic.h +++ b/drivers/net/sfc/nic.h | |||
@@ -135,12 +135,14 @@ static inline struct falcon_board *falcon_board(struct efx_nic *efx) | |||
135 | * @fw_build: Firmware build number | 135 | * @fw_build: Firmware build number |
136 | * @mcdi: Management-Controller-to-Driver Interface | 136 | * @mcdi: Management-Controller-to-Driver Interface |
137 | * @wol_filter_id: Wake-on-LAN packet filter id | 137 | * @wol_filter_id: Wake-on-LAN packet filter id |
138 | * @ipv6_rss_key: Toeplitz hash key for IPv6 RSS | ||
138 | */ | 139 | */ |
139 | struct siena_nic_data { | 140 | struct siena_nic_data { |
140 | u64 fw_version; | 141 | u64 fw_version; |
141 | u32 fw_build; | 142 | u32 fw_build; |
142 | struct efx_mcdi_iface mcdi; | 143 | struct efx_mcdi_iface mcdi; |
143 | int wol_filter_id; | 144 | int wol_filter_id; |
145 | u8 ipv6_rss_key[40]; | ||
144 | }; | 146 | }; |
145 | 147 | ||
146 | extern void siena_print_fwver(struct efx_nic *efx, char *buf, size_t len); | 148 | extern void siena_print_fwver(struct efx_nic *efx, char *buf, size_t len); |
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index 38dcc42c4f79..7bf93faff3ab 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/random.h> | ||
16 | #include "net_driver.h" | 17 | #include "net_driver.h" |
17 | #include "bitfield.h" | 18 | #include "bitfield.h" |
18 | #include "efx.h" | 19 | #include "efx.h" |
@@ -274,6 +275,9 @@ static int siena_probe_nic(struct efx_nic *efx) | |||
274 | goto fail5; | 275 | goto fail5; |
275 | } | 276 | } |
276 | 277 | ||
278 | get_random_bytes(&nic_data->ipv6_rss_key, | ||
279 | sizeof(nic_data->ipv6_rss_key)); | ||
280 | |||
277 | return 0; | 281 | return 0; |
278 | 282 | ||
279 | fail5: | 283 | fail5: |
@@ -293,6 +297,7 @@ fail1: | |||
293 | */ | 297 | */ |
294 | static int siena_init_nic(struct efx_nic *efx) | 298 | static int siena_init_nic(struct efx_nic *efx) |
295 | { | 299 | { |
300 | struct siena_nic_data *nic_data = efx->nic_data; | ||
296 | efx_oword_t temp; | 301 | efx_oword_t temp; |
297 | int rc; | 302 | int rc; |
298 | 303 | ||
@@ -319,6 +324,20 @@ static int siena_init_nic(struct efx_nic *efx) | |||
319 | EFX_SET_OWORD_FIELD(temp, FRF_BZ_RX_INGR_EN, 1); | 324 | EFX_SET_OWORD_FIELD(temp, FRF_BZ_RX_INGR_EN, 1); |
320 | efx_writeo(efx, &temp, FR_AZ_RX_CFG); | 325 | efx_writeo(efx, &temp, FR_AZ_RX_CFG); |
321 | 326 | ||
327 | /* Enable IPv6 RSS */ | ||
328 | BUILD_BUG_ON(sizeof(nic_data->ipv6_rss_key) != | ||
329 | 2 * sizeof(temp) + FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8 || | ||
330 | FRF_CZ_RX_RSS_IPV6_TKEY_HI_LBN != 0); | ||
331 | memcpy(&temp, nic_data->ipv6_rss_key, sizeof(temp)); | ||
332 | efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG1); | ||
333 | memcpy(&temp, nic_data->ipv6_rss_key + sizeof(temp), sizeof(temp)); | ||
334 | efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG2); | ||
335 | EFX_POPULATE_OWORD_2(temp, FRF_CZ_RX_RSS_IPV6_THASH_ENABLE, 1, | ||
336 | FRF_CZ_RX_RSS_IPV6_IP_THASH_ENABLE, 1); | ||
337 | memcpy(&temp, nic_data->ipv6_rss_key + 2 * sizeof(temp), | ||
338 | FRF_CZ_RX_RSS_IPV6_TKEY_HI_WIDTH / 8); | ||
339 | efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG3); | ||
340 | |||
322 | if (efx_nic_rx_xoff_thresh >= 0 || efx_nic_rx_xon_thresh >= 0) | 341 | if (efx_nic_rx_xoff_thresh >= 0 || efx_nic_rx_xon_thresh >= 0) |
323 | /* No MCDI operation has been defined to set thresholds */ | 342 | /* No MCDI operation has been defined to set thresholds */ |
324 | EFX_ERR(efx, "ignoring RX flow control thresholds\n"); | 343 | EFX_ERR(efx, "ignoring RX flow control thresholds\n"); |