All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath11k: Cleanup the access code of hw mac_id mapping
@ 2019-06-10  9:43 Karthikeyan Periyasamy
  2019-06-12  8:08 ` Kalle Valo
  2019-06-12 11:12 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Karthikeyan Periyasamy @ 2019-06-10  9:43 UTC (permalink / raw)
  To: ath11k; +Cc: Karthikeyan Periyasamy

Added separate function call to get the hw mac id from the pdev index.

Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/ahb.c  |  8 ++++----
 drivers/net/wireless/ath/ath11k/core.c | 23 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/core.h |  4 ++--
 drivers/net/wireless/ath/ath11k/mac.c  |  2 +-
 4 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c
index c3e487a..a2c697b 100644
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -803,22 +803,22 @@ static int ath11k_ahb_ext_irq_config(struct ath11k_base *sc)
 				if (ath11k_rxdma2host_ring_mask[i] & BIT(j)) {
 					irq_grp->irqs[num_irq++] =
 						rxdma2host_destination_ring_mac1
-						- hw_mac_id_map[j];
+						- ath11k_core_get_hw_mac_id(sc, j);
 				}
 
 				if (ath11k_host2rxdma_ring_mask[i] & BIT(j)) {
 					irq_grp->irqs[num_irq++] =
 						host2rxdma_host_buf_ring_mac1
-						- hw_mac_id_map[j];
+						- ath11k_core_get_hw_mac_id(sc, j);
 				}
 
 				if (rx_mon_status_ring_mask[i] & BIT(j)) {
 					irq_grp->irqs[num_irq++] =
 						ppdu_end_interrupts_mac1 -
-						hw_mac_id_map[j];
+						ath11k_core_get_hw_mac_id(sc, j);
 					irq_grp->irqs[num_irq++] =
 						rxdma2host_monitor_status_ring_mac1 -
-						hw_mac_id_map[j];
+						ath11k_core_get_hw_mac_id(sc, j);
 				}
 			}
 		}
diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 928d47b..5655df3 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -27,6 +27,29 @@
 			},
 };
 
+/* Map from pdev index to hw mac index */
+u8 ath11k_core_get_hw_mac_id(struct ath11k_base *ab, int pdev_idx)
+{
+	u8 mac_id;
+
+	switch (pdev_idx) {
+	case 0:
+		mac_id = 0;
+		break;
+	case 1:
+		mac_id = 2;
+		break;
+	case 2:
+		mac_id = 1;
+		break;
+	default:
+		mac_id = ATH11K_INVALID_HW_MAC_ID;
+		ath11k_warn(ab, "Invalid pdev idx %d\n", pdev_idx);
+		break;
+	}
+	return mac_id;
+}
+
 static int ath11k_core_create_board_name(struct ath11k_base *sc, char *name,
 					 size_t name_len)
 {
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 7ebb5a4..038f905 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -24,8 +24,7 @@
 
 #define ATH11K_TX_MGMT_NUM_PENDING_MAX	512
 
-/* Map from pdev index to hw mac index */
-static const u8 hw_mac_id_map[MAX_RADIOS] = { 0, 2, 1, };
+#define ATH11K_INVALID_HW_MAC_ID	0xFF
 
 enum ath11k_supported_bw {
 	ATH11K_BW_20	= 0,
@@ -828,6 +827,7 @@ struct ieee80211_regdomain *
 int ath11k_regd_update(struct ath11k *ar, bool init);
 int ath11k_reg_update_chan_list(struct ath11k *ar);
 void ath11k_core_halt(struct ath11k *ar);
+u8 ath11k_core_get_hw_mac_id(struct ath11k_base *ab, int pdev_idx);
 
 static inline const char *ath11k_scan_state_str(enum ath11k_scan_state state)
 {
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 13da2e8..ab4670f 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -5570,7 +5570,7 @@ int ath11k_mac_create(struct ath11k_base *ab)
 		ar->ab = ab;
 		ar->pdev = pdev;
 		ar->pdev_idx = i;
-		ar->lmac_id = hw_mac_id_map[i];
+		ar->lmac_id = ath11k_core_get_hw_mac_id(ab, i);
 
 		ar->wmi = &ab->wmi_sc.wmi[i];
 		/* FIXME wmi[0] is already initialized during attach,
-- 
1.9.1


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath11k: Cleanup the access code of hw mac_id mapping
  2019-06-10  9:43 [PATCH] ath11k: Cleanup the access code of hw mac_id mapping Karthikeyan Periyasamy
@ 2019-06-12  8:08 ` Kalle Valo
  2019-06-12  9:03   ` Karthikeyan Periyasamy
  2019-06-12 11:12 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2019-06-12  8:08 UTC (permalink / raw)
  To: Karthikeyan Periyasamy; +Cc: ath11k

Karthikeyan Periyasamy <periyasa@codeaurora.org> writes:

> Added separate function call to get the hw mac id from the pdev index.
>
> Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>

[...]

> +/* Map from pdev index to hw mac index */
> +u8 ath11k_core_get_hw_mac_id(struct ath11k_base *ab, int pdev_idx)
> +{
> +	u8 mac_id;
> +
> +	switch (pdev_idx) {
> +	case 0:
> +		mac_id = 0;
> +		break;
> +	case 1:
> +		mac_id = 2;
> +		break;
> +	case 2:
> +		mac_id = 1;
> +		break;
> +	default:
> +		mac_id = ATH11K_INVALID_HW_MAC_ID;
> +		ath11k_warn(ab, "Invalid pdev idx %d\n", pdev_idx);
> +		break;
> +	}
> +	return mac_id;
> +}

I simplified this function to:

u8 ath11k_core_get_hw_mac_id(struct ath11k_base *ab, int pdev_idx)
{
	switch (pdev_idx) {
	case 0:
		return 0;
	case 1:
		return 2;
	case 2:
		return 1;
	default:
		ath11k_warn(ab, "Invalid pdev idx %d\n", pdev_idx);
		return ATH11K_INVALID_HW_MAC_ID;
	}
}

-- 
Kalle Valo

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath11k: Cleanup the access code of hw mac_id mapping
  2019-06-12  8:08 ` Kalle Valo
@ 2019-06-12  9:03   ` Karthikeyan Periyasamy
  0 siblings, 0 replies; 4+ messages in thread
From: Karthikeyan Periyasamy @ 2019-06-12  9:03 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k

> 
> I simplified this function to:
> 
> u8 ath11k_core_get_hw_mac_id(struct ath11k_base *ab, int pdev_idx)
> {
> 	switch (pdev_idx) {
> 	case 0:
> 		return 0;
> 	case 1:
> 		return 2;
> 	case 2:
> 		return 1;
> 	default:
> 		ath11k_warn(ab, "Invalid pdev idx %d\n", pdev_idx);
> 		return ATH11K_INVALID_HW_MAC_ID;
> 	}
> }

Look fine to me

Thanks,
Karthikeyan

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath11k: Cleanup the access code of hw mac_id mapping
  2019-06-10  9:43 [PATCH] ath11k: Cleanup the access code of hw mac_id mapping Karthikeyan Periyasamy
  2019-06-12  8:08 ` Kalle Valo
@ 2019-06-12 11:12 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2019-06-12 11:12 UTC (permalink / raw)
  To: Karthikeyan Periyasamy; +Cc: ath11k

Karthikeyan Periyasamy <periyasa@codeaurora.org> wrote:

> Added separate function call to get the hw mac id from the pdev index.
> 
> Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath11k-bringup branch of ath.git, thanks.

371886ba35ca ath11k: Cleanup the access code of hw mac_id mapping

-- 
https://patchwork.kernel.org/patch/10984583/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-12 11:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-10  9:43 [PATCH] ath11k: Cleanup the access code of hw mac_id mapping Karthikeyan Periyasamy
2019-06-12  8:08 ` Kalle Valo
2019-06-12  9:03   ` Karthikeyan Periyasamy
2019-06-12 11:12 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.