| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) |
|---|
| 1 | 2 | /* QLogic qed NIC Driver |
|---|
| 2 | 3 | * Copyright (c) 2015-2017 QLogic Corporation |
|---|
| 3 | | - * |
|---|
| 4 | | - * This software is available to you under a choice of one of two |
|---|
| 5 | | - * licenses. You may choose to be licensed under the terms of the GNU |
|---|
| 6 | | - * General Public License (GPL) Version 2, available from the file |
|---|
| 7 | | - * COPYING in the main directory of this source tree, or the |
|---|
| 8 | | - * OpenIB.org BSD license below: |
|---|
| 9 | | - * |
|---|
| 10 | | - * Redistribution and use in source and binary forms, with or |
|---|
| 11 | | - * without modification, are permitted provided that the following |
|---|
| 12 | | - * conditions are met: |
|---|
| 13 | | - * |
|---|
| 14 | | - * - Redistributions of source code must retain the above |
|---|
| 15 | | - * copyright notice, this list of conditions and the following |
|---|
| 16 | | - * disclaimer. |
|---|
| 17 | | - * |
|---|
| 18 | | - * - Redistributions in binary form must reproduce the above |
|---|
| 19 | | - * copyright notice, this list of conditions and the following |
|---|
| 20 | | - * disclaimer in the documentation and /or other materials |
|---|
| 21 | | - * provided with the distribution. |
|---|
| 22 | | - * |
|---|
| 23 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|---|
| 24 | | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|---|
| 25 | | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|---|
| 26 | | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
|---|
| 27 | | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|---|
| 28 | | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|---|
| 29 | | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|---|
| 30 | | - * SOFTWARE. |
|---|
| 4 | + * Copyright (c) 2019-2020 Marvell International Ltd. |
|---|
| 31 | 5 | */ |
|---|
| 32 | 6 | |
|---|
| 33 | 7 | #include <linux/types.h> |
|---|
| .. | .. |
|---|
| 50 | 24 | #include "qed.h" |
|---|
| 51 | 25 | #include <linux/qed/qed_chain.h> |
|---|
| 52 | 26 | #include "qed_cxt.h" |
|---|
| 27 | +#include "qed_dcbx.h" |
|---|
| 53 | 28 | #include "qed_dev_api.h" |
|---|
| 54 | 29 | #include <linux/qed/qed_eth_if.h> |
|---|
| 55 | 30 | #include "qed_hsi.h" |
|---|
| .. | .. |
|---|
| 57 | 32 | #include "qed_int.h" |
|---|
| 58 | 33 | #include "qed_l2.h" |
|---|
| 59 | 34 | #include "qed_mcp.h" |
|---|
| 35 | +#include "qed_ptp.h" |
|---|
| 60 | 36 | #include "qed_reg_addr.h" |
|---|
| 61 | 37 | #include "qed_sp.h" |
|---|
| 62 | 38 | #include "qed_sriov.h" |
|---|
| .. | .. |
|---|
| 366 | 342 | struct qed_sp_vport_start_params *p_params) |
|---|
| 367 | 343 | { |
|---|
| 368 | 344 | struct vport_start_ramrod_data *p_ramrod = NULL; |
|---|
| 345 | + struct eth_vport_tpa_param *tpa_param; |
|---|
| 369 | 346 | struct qed_spq_entry *p_ent = NULL; |
|---|
| 370 | 347 | struct qed_sp_init_data init_data; |
|---|
| 348 | + u16 min_size, rx_mode = 0; |
|---|
| 371 | 349 | u8 abs_vport_id = 0; |
|---|
| 372 | | - int rc = -EINVAL; |
|---|
| 373 | | - u16 rx_mode = 0; |
|---|
| 350 | + int rc; |
|---|
| 374 | 351 | |
|---|
| 375 | 352 | rc = qed_fw_vport(p_hwfn, p_params->vport_id, &abs_vport_id); |
|---|
| 376 | 353 | if (rc) |
|---|
| .. | .. |
|---|
| 402 | 379 | p_ramrod->rx_mode.state = cpu_to_le16(rx_mode); |
|---|
| 403 | 380 | |
|---|
| 404 | 381 | /* TPA related fields */ |
|---|
| 405 | | - memset(&p_ramrod->tpa_param, 0, sizeof(struct eth_vport_tpa_param)); |
|---|
| 382 | + tpa_param = &p_ramrod->tpa_param; |
|---|
| 383 | + memset(tpa_param, 0, sizeof(*tpa_param)); |
|---|
| 406 | 384 | |
|---|
| 407 | | - p_ramrod->tpa_param.max_buff_num = p_params->max_buffers_per_cqe; |
|---|
| 385 | + tpa_param->max_buff_num = p_params->max_buffers_per_cqe; |
|---|
| 408 | 386 | |
|---|
| 409 | 387 | switch (p_params->tpa_mode) { |
|---|
| 410 | 388 | case QED_TPA_MODE_GRO: |
|---|
| 411 | | - p_ramrod->tpa_param.tpa_max_aggs_num = ETH_TPA_MAX_AGGS_NUM; |
|---|
| 412 | | - p_ramrod->tpa_param.tpa_max_size = (u16)-1; |
|---|
| 413 | | - p_ramrod->tpa_param.tpa_min_size_to_cont = p_params->mtu / 2; |
|---|
| 414 | | - p_ramrod->tpa_param.tpa_min_size_to_start = p_params->mtu / 2; |
|---|
| 415 | | - p_ramrod->tpa_param.tpa_ipv4_en_flg = 1; |
|---|
| 416 | | - p_ramrod->tpa_param.tpa_ipv6_en_flg = 1; |
|---|
| 417 | | - p_ramrod->tpa_param.tpa_pkt_split_flg = 1; |
|---|
| 418 | | - p_ramrod->tpa_param.tpa_gro_consistent_flg = 1; |
|---|
| 419 | | - break; |
|---|
| 389 | + min_size = p_params->mtu / 2; |
|---|
| 390 | + |
|---|
| 391 | + tpa_param->tpa_max_aggs_num = ETH_TPA_MAX_AGGS_NUM; |
|---|
| 392 | + tpa_param->tpa_max_size = cpu_to_le16(U16_MAX); |
|---|
| 393 | + tpa_param->tpa_min_size_to_cont = cpu_to_le16(min_size); |
|---|
| 394 | + tpa_param->tpa_min_size_to_start = cpu_to_le16(min_size); |
|---|
| 395 | + tpa_param->tpa_ipv4_en_flg = 1; |
|---|
| 396 | + tpa_param->tpa_ipv6_en_flg = 1; |
|---|
| 397 | + tpa_param->tpa_pkt_split_flg = 1; |
|---|
| 398 | + tpa_param->tpa_gro_consistent_flg = 1; |
|---|
| 420 | 399 | default: |
|---|
| 421 | 400 | break; |
|---|
| 422 | 401 | } |
|---|
| .. | .. |
|---|
| 625 | 604 | static void |
|---|
| 626 | 605 | qed_sp_vport_update_sge_tpa(struct qed_hwfn *p_hwfn, |
|---|
| 627 | 606 | struct vport_update_ramrod_data *p_ramrod, |
|---|
| 628 | | - struct qed_sge_tpa_params *p_params) |
|---|
| 607 | + const struct qed_sge_tpa_params *param) |
|---|
| 629 | 608 | { |
|---|
| 630 | | - struct eth_vport_tpa_param *p_tpa; |
|---|
| 609 | + struct eth_vport_tpa_param *tpa; |
|---|
| 631 | 610 | |
|---|
| 632 | | - if (!p_params) { |
|---|
| 611 | + if (!param) { |
|---|
| 633 | 612 | p_ramrod->common.update_tpa_param_flg = 0; |
|---|
| 634 | 613 | p_ramrod->common.update_tpa_en_flg = 0; |
|---|
| 635 | 614 | p_ramrod->common.update_tpa_param_flg = 0; |
|---|
| 636 | 615 | return; |
|---|
| 637 | 616 | } |
|---|
| 638 | 617 | |
|---|
| 639 | | - p_ramrod->common.update_tpa_en_flg = p_params->update_tpa_en_flg; |
|---|
| 640 | | - p_tpa = &p_ramrod->tpa_param; |
|---|
| 641 | | - p_tpa->tpa_ipv4_en_flg = p_params->tpa_ipv4_en_flg; |
|---|
| 642 | | - p_tpa->tpa_ipv6_en_flg = p_params->tpa_ipv6_en_flg; |
|---|
| 643 | | - p_tpa->tpa_ipv4_tunn_en_flg = p_params->tpa_ipv4_tunn_en_flg; |
|---|
| 644 | | - p_tpa->tpa_ipv6_tunn_en_flg = p_params->tpa_ipv6_tunn_en_flg; |
|---|
| 618 | + p_ramrod->common.update_tpa_en_flg = param->update_tpa_en_flg; |
|---|
| 619 | + tpa = &p_ramrod->tpa_param; |
|---|
| 620 | + tpa->tpa_ipv4_en_flg = param->tpa_ipv4_en_flg; |
|---|
| 621 | + tpa->tpa_ipv6_en_flg = param->tpa_ipv6_en_flg; |
|---|
| 622 | + tpa->tpa_ipv4_tunn_en_flg = param->tpa_ipv4_tunn_en_flg; |
|---|
| 623 | + tpa->tpa_ipv6_tunn_en_flg = param->tpa_ipv6_tunn_en_flg; |
|---|
| 645 | 624 | |
|---|
| 646 | | - p_ramrod->common.update_tpa_param_flg = p_params->update_tpa_param_flg; |
|---|
| 647 | | - p_tpa->max_buff_num = p_params->max_buffers_per_cqe; |
|---|
| 648 | | - p_tpa->tpa_pkt_split_flg = p_params->tpa_pkt_split_flg; |
|---|
| 649 | | - p_tpa->tpa_hdr_data_split_flg = p_params->tpa_hdr_data_split_flg; |
|---|
| 650 | | - p_tpa->tpa_gro_consistent_flg = p_params->tpa_gro_consistent_flg; |
|---|
| 651 | | - p_tpa->tpa_max_aggs_num = p_params->tpa_max_aggs_num; |
|---|
| 652 | | - p_tpa->tpa_max_size = p_params->tpa_max_size; |
|---|
| 653 | | - p_tpa->tpa_min_size_to_start = p_params->tpa_min_size_to_start; |
|---|
| 654 | | - p_tpa->tpa_min_size_to_cont = p_params->tpa_min_size_to_cont; |
|---|
| 625 | + p_ramrod->common.update_tpa_param_flg = param->update_tpa_param_flg; |
|---|
| 626 | + tpa->max_buff_num = param->max_buffers_per_cqe; |
|---|
| 627 | + tpa->tpa_pkt_split_flg = param->tpa_pkt_split_flg; |
|---|
| 628 | + tpa->tpa_hdr_data_split_flg = param->tpa_hdr_data_split_flg; |
|---|
| 629 | + tpa->tpa_gro_consistent_flg = param->tpa_gro_consistent_flg; |
|---|
| 630 | + tpa->tpa_max_aggs_num = param->tpa_max_aggs_num; |
|---|
| 631 | + tpa->tpa_max_size = cpu_to_le16(param->tpa_max_size); |
|---|
| 632 | + tpa->tpa_min_size_to_start = cpu_to_le16(param->tpa_min_size_to_start); |
|---|
| 633 | + tpa->tpa_min_size_to_cont = cpu_to_le16(param->tpa_min_size_to_cont); |
|---|
| 655 | 634 | } |
|---|
| 656 | 635 | |
|---|
| 657 | 636 | static void |
|---|
| .. | .. |
|---|
| 1894 | 1873 | struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; |
|---|
| 1895 | 1874 | struct qed_ptt *p_ptt = IS_PF(cdev) ? qed_ptt_acquire(p_hwfn) |
|---|
| 1896 | 1875 | : NULL; |
|---|
| 1876 | + bool b_get_port_stats; |
|---|
| 1897 | 1877 | |
|---|
| 1898 | 1878 | if (IS_PF(cdev)) { |
|---|
| 1899 | 1879 | /* The main vport index is relative first */ |
|---|
| .. | .. |
|---|
| 1908 | 1888 | continue; |
|---|
| 1909 | 1889 | } |
|---|
| 1910 | 1890 | |
|---|
| 1891 | + b_get_port_stats = IS_PF(cdev) && IS_LEAD_HWFN(p_hwfn); |
|---|
| 1911 | 1892 | __qed_get_vport_stats(p_hwfn, p_ptt, stats, fw_vport, |
|---|
| 1912 | | - IS_PF(cdev) ? true : false); |
|---|
| 1893 | + b_get_port_stats); |
|---|
| 1913 | 1894 | |
|---|
| 1914 | 1895 | out: |
|---|
| 1915 | 1896 | if (IS_PF(cdev) && p_ptt) |
|---|
| .. | .. |
|---|
| 1921 | 1902 | { |
|---|
| 1922 | 1903 | u32 i; |
|---|
| 1923 | 1904 | |
|---|
| 1924 | | - if (!cdev) { |
|---|
| 1905 | + if (!cdev || cdev->recov_in_prog) { |
|---|
| 1925 | 1906 | memset(stats, 0, sizeof(*stats)); |
|---|
| 1926 | 1907 | return; |
|---|
| 1927 | 1908 | } |
|---|
| .. | .. |
|---|
| 1999 | 1980 | struct qed_ptt *p_ptt, |
|---|
| 2000 | 1981 | struct qed_arfs_config_params *p_cfg_params) |
|---|
| 2001 | 1982 | { |
|---|
| 1983 | + if (test_bit(QED_MF_DISABLE_ARFS, &p_hwfn->cdev->mf_bits)) |
|---|
| 1984 | + return; |
|---|
| 1985 | + |
|---|
| 2002 | 1986 | if (p_cfg_params->mode != QED_FILTER_CONFIG_MODE_DISABLE) { |
|---|
| 2003 | 1987 | qed_gft_config(p_hwfn, p_ptt, p_hwfn->rel_pf_id, |
|---|
| 2004 | 1988 | p_cfg_params->tcp, |
|---|
| .. | .. |
|---|
| 2105 | 2089 | |
|---|
| 2106 | 2090 | rc = qed_dmae_grc2host(p_hwfn, p_ptt, CAU_REG_SB_VAR_MEMORY + |
|---|
| 2107 | 2091 | p_cid->sb_igu_id * sizeof(u64), |
|---|
| 2108 | | - (u64)(uintptr_t)&sb_entry, 2, 0); |
|---|
| 2092 | + (u64)(uintptr_t)&sb_entry, 2, NULL); |
|---|
| 2109 | 2093 | if (rc) { |
|---|
| 2110 | 2094 | DP_ERR(p_hwfn, "dmae_grc2host failed %d\n", rc); |
|---|
| 2111 | 2095 | return rc; |
|---|
| 2112 | 2096 | } |
|---|
| 2113 | 2097 | |
|---|
| 2114 | | - timer_res = GET_FIELD(sb_entry.params, CAU_SB_ENTRY_TIMER_RES0); |
|---|
| 2098 | + timer_res = GET_FIELD(le32_to_cpu(sb_entry.params), |
|---|
| 2099 | + CAU_SB_ENTRY_TIMER_RES0); |
|---|
| 2115 | 2100 | |
|---|
| 2116 | 2101 | address = BAR0_MAP_REG_USDM_RAM + |
|---|
| 2117 | 2102 | USTORM_ETH_QUEUE_ZONE_OFFSET(p_cid->abs.queue_id); |
|---|
| .. | .. |
|---|
| 2138 | 2123 | |
|---|
| 2139 | 2124 | rc = qed_dmae_grc2host(p_hwfn, p_ptt, CAU_REG_SB_VAR_MEMORY + |
|---|
| 2140 | 2125 | p_cid->sb_igu_id * sizeof(u64), |
|---|
| 2141 | | - (u64)(uintptr_t)&sb_entry, 2, 0); |
|---|
| 2126 | + (u64)(uintptr_t)&sb_entry, 2, NULL); |
|---|
| 2142 | 2127 | if (rc) { |
|---|
| 2143 | 2128 | DP_ERR(p_hwfn, "dmae_grc2host failed %d\n", rc); |
|---|
| 2144 | 2129 | return rc; |
|---|
| 2145 | 2130 | } |
|---|
| 2146 | 2131 | |
|---|
| 2147 | | - timer_res = GET_FIELD(sb_entry.params, CAU_SB_ENTRY_TIMER_RES1); |
|---|
| 2132 | + timer_res = GET_FIELD(le32_to_cpu(sb_entry.params), |
|---|
| 2133 | + CAU_SB_ENTRY_TIMER_RES1); |
|---|
| 2148 | 2134 | |
|---|
| 2149 | 2135 | address = BAR0_MAP_REG_XSDM_RAM + |
|---|
| 2150 | 2136 | XSTORM_ETH_QUEUE_ZONE_OFFSET(p_cid->abs.queue_id); |
|---|
| .. | .. |
|---|
| 2867 | 2853 | p_hwfn = p_cid->p_owner; |
|---|
| 2868 | 2854 | rc = qed_get_queue_coalesce(p_hwfn, coal, handle); |
|---|
| 2869 | 2855 | if (rc) |
|---|
| 2870 | | - DP_NOTICE(p_hwfn, "Unable to read queue coalescing\n"); |
|---|
| 2856 | + DP_VERBOSE(cdev, QED_MSG_DEBUG, |
|---|
| 2857 | + "Unable to read queue coalescing\n"); |
|---|
| 2871 | 2858 | |
|---|
| 2872 | 2859 | return rc; |
|---|
| 2873 | 2860 | } |
|---|
| .. | .. |
|---|
| 2896 | 2883 | |
|---|
| 2897 | 2884 | return 0; |
|---|
| 2898 | 2885 | } |
|---|
| 2899 | | - |
|---|
| 2900 | | -#ifdef CONFIG_QED_SRIOV |
|---|
| 2901 | | -extern const struct qed_iov_hv_ops qed_iov_ops_pass; |
|---|
| 2902 | | -#endif |
|---|
| 2903 | | - |
|---|
| 2904 | | -#ifdef CONFIG_DCB |
|---|
| 2905 | | -extern const struct qed_eth_dcbnl_ops qed_dcbnl_ops_pass; |
|---|
| 2906 | | -#endif |
|---|
| 2907 | | - |
|---|
| 2908 | | -extern const struct qed_eth_ptp_ops qed_ptp_ops_pass; |
|---|
| 2909 | 2886 | |
|---|
| 2910 | 2887 | static const struct qed_eth_ops qed_eth_ops_pass = { |
|---|
| 2911 | 2888 | .common = &qed_common_ops_pass, |
|---|