| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2005 - 2016 Broadcom |
|---|
| 3 | 4 | * All rights reserved. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or |
|---|
| 6 | | - * modify it under the terms of the GNU General Public License version 2 |
|---|
| 7 | | - * as published by the Free Software Foundation. The full GNU General |
|---|
| 8 | | - * Public License is included in this distribution in the file called COPYING. |
|---|
| 9 | 5 | * |
|---|
| 10 | 6 | * Contact Information: |
|---|
| 11 | 7 | * linux-drivers@emulex.com |
|---|
| .. | .. |
|---|
| 27 | 23 | }; |
|---|
| 28 | 24 | |
|---|
| 29 | 25 | enum {DRVSTAT_TX, DRVSTAT_RX, DRVSTAT}; |
|---|
| 30 | | -#define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \ |
|---|
| 26 | +#define FIELDINFO(_struct, field) sizeof_field(_struct, field), \ |
|---|
| 31 | 27 | offsetof(_struct, field) |
|---|
| 32 | 28 | #define DRVSTAT_TX_INFO(field) #field, DRVSTAT_TX,\ |
|---|
| 33 | 29 | FIELDINFO(struct be_tx_stats, field) |
|---|
| .. | .. |
|---|
| 225 | 221 | struct be_adapter *adapter = netdev_priv(netdev); |
|---|
| 226 | 222 | |
|---|
| 227 | 223 | strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); |
|---|
| 228 | | - strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version)); |
|---|
| 229 | 224 | if (!memcmp(adapter->fw_ver, adapter->fw_on_flash, FW_VER_LEN)) |
|---|
| 230 | 225 | strlcpy(drvinfo->fw_version, adapter->fw_ver, |
|---|
| 231 | 226 | sizeof(drvinfo->fw_version)); |
|---|
| .. | .. |
|---|
| 274 | 269 | int status = 0; |
|---|
| 275 | 270 | |
|---|
| 276 | 271 | read_cmd.size = LANCER_READ_FILE_CHUNK; |
|---|
| 277 | | - read_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, read_cmd.size, |
|---|
| 278 | | - &read_cmd.dma, GFP_ATOMIC); |
|---|
| 272 | + read_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, read_cmd.size, |
|---|
| 273 | + &read_cmd.dma, GFP_ATOMIC); |
|---|
| 279 | 274 | |
|---|
| 280 | 275 | if (!read_cmd.va) { |
|---|
| 281 | 276 | dev_err(&adapter->pdev->dev, |
|---|
| .. | .. |
|---|
| 333 | 328 | et->tx_coalesce_usecs_high = aic->max_eqd; |
|---|
| 334 | 329 | et->tx_coalesce_usecs_low = aic->min_eqd; |
|---|
| 335 | 330 | |
|---|
| 336 | | - et->use_adaptive_rx_coalesce = aic->enable; |
|---|
| 337 | | - et->use_adaptive_tx_coalesce = aic->enable; |
|---|
| 331 | + et->use_adaptive_rx_coalesce = adapter->aic_enabled; |
|---|
| 332 | + et->use_adaptive_tx_coalesce = adapter->aic_enabled; |
|---|
| 338 | 333 | |
|---|
| 339 | 334 | return 0; |
|---|
| 340 | 335 | } |
|---|
| .. | .. |
|---|
| 350 | 345 | struct be_eq_obj *eqo; |
|---|
| 351 | 346 | int i; |
|---|
| 352 | 347 | |
|---|
| 348 | + adapter->aic_enabled = et->use_adaptive_rx_coalesce; |
|---|
| 349 | + |
|---|
| 353 | 350 | for_all_evt_queues(adapter, eqo, i) { |
|---|
| 354 | | - aic->enable = et->use_adaptive_rx_coalesce; |
|---|
| 355 | 351 | aic->max_eqd = min(et->rx_coalesce_usecs_high, BE_MAX_EQD); |
|---|
| 356 | 352 | aic->min_eqd = min(et->rx_coalesce_usecs_low, aic->max_eqd); |
|---|
| 357 | 353 | aic->et_eqd = min(et->rx_coalesce_usecs, aic->max_eqd); |
|---|
| .. | .. |
|---|
| 575 | 571 | break; |
|---|
| 576 | 572 | } |
|---|
| 577 | 573 | } |
|---|
| 578 | | - /* fall through */ |
|---|
| 574 | + fallthrough; |
|---|
| 579 | 575 | case PHY_TYPE_SFP_PLUS_10GB: |
|---|
| 580 | 576 | case PHY_TYPE_XFP_10GB: |
|---|
| 581 | 577 | case PHY_TYPE_SFP_1GB: |
|---|
| .. | .. |
|---|
| 815 | 811 | } |
|---|
| 816 | 812 | |
|---|
| 817 | 813 | cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config); |
|---|
| 818 | | - cmd.va = dma_zalloc_coherent(dev, cmd.size, &cmd.dma, GFP_KERNEL); |
|---|
| 814 | + cmd.va = dma_alloc_coherent(dev, cmd.size, &cmd.dma, GFP_KERNEL); |
|---|
| 819 | 815 | if (!cmd.va) |
|---|
| 820 | 816 | return -ENOMEM; |
|---|
| 821 | 817 | |
|---|
| .. | .. |
|---|
| 851 | 847 | }; |
|---|
| 852 | 848 | |
|---|
| 853 | 849 | ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test); |
|---|
| 854 | | - ddrdma_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, |
|---|
| 855 | | - ddrdma_cmd.size, &ddrdma_cmd.dma, |
|---|
| 856 | | - GFP_KERNEL); |
|---|
| 850 | + ddrdma_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, |
|---|
| 851 | + ddrdma_cmd.size, &ddrdma_cmd.dma, |
|---|
| 852 | + GFP_KERNEL); |
|---|
| 857 | 853 | if (!ddrdma_cmd.va) |
|---|
| 858 | 854 | return -ENOMEM; |
|---|
| 859 | 855 | |
|---|
| .. | .. |
|---|
| 1030 | 1026 | |
|---|
| 1031 | 1027 | memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem)); |
|---|
| 1032 | 1028 | eeprom_cmd.size = sizeof(struct be_cmd_req_seeprom_read); |
|---|
| 1033 | | - eeprom_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, |
|---|
| 1034 | | - eeprom_cmd.size, &eeprom_cmd.dma, |
|---|
| 1035 | | - GFP_KERNEL); |
|---|
| 1029 | + eeprom_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, |
|---|
| 1030 | + eeprom_cmd.size, &eeprom_cmd.dma, |
|---|
| 1031 | + GFP_KERNEL); |
|---|
| 1036 | 1032 | |
|---|
| 1037 | 1033 | if (!eeprom_cmd.va) |
|---|
| 1038 | 1034 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 1342 | 1338 | return -EOPNOTSUPP; |
|---|
| 1343 | 1339 | |
|---|
| 1344 | 1340 | status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
|---|
| 1345 | | - page_data); |
|---|
| 1341 | + 0, PAGE_DATA_LEN, page_data); |
|---|
| 1346 | 1342 | if (!status) { |
|---|
| 1347 | 1343 | if (!page_data[SFP_PLUS_SFF_8472_COMP]) { |
|---|
| 1348 | 1344 | modinfo->type = ETH_MODULE_SFF_8079; |
|---|
| .. | .. |
|---|
| 1360 | 1356 | { |
|---|
| 1361 | 1357 | struct be_adapter *adapter = netdev_priv(netdev); |
|---|
| 1362 | 1358 | int status; |
|---|
| 1359 | + u32 begin, end; |
|---|
| 1363 | 1360 | |
|---|
| 1364 | 1361 | if (!check_privilege(adapter, MAX_PRIVILEGES)) |
|---|
| 1365 | 1362 | return -EOPNOTSUPP; |
|---|
| 1366 | 1363 | |
|---|
| 1367 | | - status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
|---|
| 1368 | | - data); |
|---|
| 1369 | | - if (status) |
|---|
| 1370 | | - goto err; |
|---|
| 1364 | + begin = eeprom->offset; |
|---|
| 1365 | + end = eeprom->offset + eeprom->len; |
|---|
| 1371 | 1366 | |
|---|
| 1372 | | - if (eeprom->offset + eeprom->len > PAGE_DATA_LEN) { |
|---|
| 1373 | | - status = be_cmd_read_port_transceiver_data(adapter, |
|---|
| 1374 | | - TR_PAGE_A2, |
|---|
| 1375 | | - data + |
|---|
| 1376 | | - PAGE_DATA_LEN); |
|---|
| 1367 | + if (begin < PAGE_DATA_LEN) { |
|---|
| 1368 | + status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, begin, |
|---|
| 1369 | + min_t(u32, end, PAGE_DATA_LEN) - begin, |
|---|
| 1370 | + data); |
|---|
| 1371 | + if (status) |
|---|
| 1372 | + goto err; |
|---|
| 1373 | + |
|---|
| 1374 | + data += PAGE_DATA_LEN - begin; |
|---|
| 1375 | + begin = PAGE_DATA_LEN; |
|---|
| 1376 | + } |
|---|
| 1377 | + |
|---|
| 1378 | + if (end > PAGE_DATA_LEN) { |
|---|
| 1379 | + status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A2, |
|---|
| 1380 | + begin - PAGE_DATA_LEN, |
|---|
| 1381 | + end - begin, data); |
|---|
| 1377 | 1382 | if (status) |
|---|
| 1378 | 1383 | goto err; |
|---|
| 1379 | 1384 | } |
|---|
| 1380 | | - if (eeprom->offset) |
|---|
| 1381 | | - memcpy(data, data + eeprom->offset, eeprom->len); |
|---|
| 1382 | 1385 | err: |
|---|
| 1383 | 1386 | return be_cmd_status(status); |
|---|
| 1384 | 1387 | } |
|---|
| .. | .. |
|---|
| 1412 | 1415 | } |
|---|
| 1413 | 1416 | |
|---|
| 1414 | 1417 | const struct ethtool_ops be_ethtool_ops = { |
|---|
| 1418 | + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | |
|---|
| 1419 | + ETHTOOL_COALESCE_USE_ADAPTIVE | |
|---|
| 1420 | + ETHTOOL_COALESCE_USECS_LOW_HIGH, |
|---|
| 1415 | 1421 | .get_drvinfo = be_get_drvinfo, |
|---|
| 1416 | 1422 | .get_wol = be_get_wol, |
|---|
| 1417 | 1423 | .set_wol = be_set_wol, |
|---|