RE: [PATCH 05/50] wifi: ath12k: add core.c

Ping-Ke Shih
2022-09-13T06:18:25Z

> -----Original Message-----
> From: Kalle Valo <kvalo@kernel.org>
> Sent: Saturday, August 13, 2022 12:09 AM
> To: linux-wireless@vger.kernel.org
> Cc: ath12k@lists.infradead.org
> Subject: [PATCH 05/50] wifi: ath12k: add core.c
>
> From: Kalle Valo <quic_kvalo@quicinc.com>
>
> (Patches split into one patch per file for easier review, but the final
> commit will be one big patch. See the cover letter for more info.)
>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
> ---
> drivers/net/wireless/ath/ath12k/core.c | 937 +++++++++++++++++++++++++++++++++
> 1 file changed, 937 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
> new file mode 100644
> index 000000000000..476c5ba55fb2
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath12k/core.c
> @@ -0,0 +1,937 @@
> +// SPDX-License-Identifier: BSD-3-Clause-Clear
> +/*
> + * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
> + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
> + */

[...]

> +
> +static int ath12k_core_start(struct ath12k_base *ab,
> + enum ath12k_firmware_mode mode)
> +{
> + int ret;
> +
> + ret = ath12k_wmi_attach(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to attach wmi: %d\n", ret);
> + return ret;
> + }
> +
> + ret = ath12k_htc_init(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to init htc: %d\n", ret);
> + goto err_wmi_detach;
> + }
> +
> + ret = ath12k_hif_start(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to start HIF: %d\n", ret);
> + goto err_wmi_detach;
> + }
> +
> + ret = ath12k_htc_wait_target(&ab->htc);
> + if (ret) {
> + ath12k_err(ab, "failed to connect to HTC: %d\n", ret);
> + goto err_hif_stop;
> + }
> +
> + ret = ath12k_dp_htt_connect(&ab->dp);
> + if (ret) {
> + ath12k_err(ab, "failed to connect to HTT: %d\n", ret);
> + goto err_hif_stop;
> + }
> +
> + ret = ath12k_wmi_connect(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to connect wmi: %d\n", ret);
> + goto err_hif_stop;
> + }
> +
> + ret = ath12k_htc_start(&ab->htc);
> + if (ret) {
> + ath12k_err(ab, "failed to start HTC: %d\n", ret);
> + goto err_hif_stop;
> + }
> +
> + ret = ath12k_wmi_wait_for_service_ready(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to receive wmi service ready event: %d\n",
> + ret);
> + goto err_hif_stop;
> + }
> +
> + ret = ath12k_mac_allocate(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to create new hw device with mac80211 :%d\n",
> + ret);
> + goto err_hif_stop;
> + }
> +
> + ath12k_dp_cc_config(ab);
> +
> + ath12k_dp_pdev_pre_alloc(ab);
> +
> + ret = ath12k_dp_rx_pdev_reo_setup(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to initialize reo destination rings: %d\n", ret);
> + goto err_mac_destroy;
> + }
> +
> + ret = ath12k_wmi_cmd_init(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to send wmi init cmd: %d\n", ret);
> + goto err_reo_cleanup;
> + }
> +
> + ret = ath12k_wmi_wait_for_unified_ready(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to receive wmi unified ready event: %d\n",
> + ret);
> + goto err_reo_cleanup;
> + }
> +
> + /* put hardware to DBS mode */
> + if (ab->hw_params->single_pdev_only) {
> + ret = ath12k_wmi_set_hw_mode(ab, WMI_HOST_HW_MODE_DBS);
> + if (ret) {
> + ath12k_err(ab, "failed to send dbs mode: %d\n", ret);
> + goto err_hif_stop;

Should it goto err_reo_cleanup?

> + }
> + }
> +
> + ret = ath12k_dp_tx_htt_h2t_ver_req_msg(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to send htt version request message: %d\n",
> + ret);
> + goto err_reo_cleanup;
> + }
> +
> + return 0;
> +
> +err_reo_cleanup:
> + ath12k_dp_rx_pdev_reo_cleanup(ab);
> +err_mac_destroy:
> + ath12k_mac_destroy(ab);
> +err_hif_stop:
> + ath12k_hif_stop(ab);
> +err_wmi_detach:
> + ath12k_wmi_detach(ab);
> + return ret;
> +}
> +

[...]

> +
> +MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11be wireless LAN cards.");
> +MODULE_LICENSE("Dual BSD/GPL");

// SPDX-License-Identifier: BSD-3-Clause-Clear

Out of curiosity, SPDX license and MODULE_LICENSE() are different.
Could I know the rules?

Ping-Ke