diff mbox series

[08/50] wifi: ath12k: add dbring.h

Message ID 20220812161003.27279-9-kvalo@kernel.org (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices | expand

Commit Message

Kalle Valo Aug. 12, 2022, 4:09 p.m. UTC
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/dbring.h | 80 ++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

Comments

Jeff Johnson Aug. 15, 2022, 7:59 p.m. UTC | #1
On 8/12/2022 9:09 AM, Kalle Valo wrote:
> 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/dbring.h | 80 ++++++++++++++++++++++++++++++++
>   1 file changed, 80 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/dbring.h b/drivers/net/wireless/ath/ath12k/dbring.h
> new file mode 100644
> index 000000000000..2be2d8def3f0
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath12k/dbring.h
> @@ -0,0 +1,80 @@
> +/* SPDX-License-Identifier: BSD-3-Clause-Clear */
> +/*
> + * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
> + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +
> +#ifndef ATH12K_DBRING_H
> +#define ATH12K_DBRING_H
> +
> +#include <linux/types.h>
> +#include <linux/idr.h>
> +#include <linux/spinlock.h>
> +#include "dp.h"
> +
> +struct ath12k_dbring_element {
> +	dma_addr_t paddr;
> +	u8 payload[0];

should just be payload[]

<https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays>
Kalle Valo Oct. 21, 2022, 11:07 a.m. UTC | #2
Jeff Johnson <quic_jjohnson@quicinc.com> writes:

> On 8/12/2022 9:09 AM, Kalle Valo wrote:
>
>> 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/dbring.h | 80 ++++++++++++++++++++++++++++++++
>>   1 file changed, 80 insertions(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath12k/dbring.h
>> b/drivers/net/wireless/ath/ath12k/dbring.h
>> new file mode 100644
>> index 000000000000..2be2d8def3f0
>> --- /dev/null
>> +++ b/drivers/net/wireless/ath/ath12k/dbring.h
>> @@ -0,0 +1,80 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause-Clear */
>> +/*
>> + * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
>> + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
>> + */
>> +
>> +#ifndef ATH12K_DBRING_H
>> +#define ATH12K_DBRING_H
>> +
>> +#include <linux/types.h>
>> +#include <linux/idr.h>
>> +#include <linux/spinlock.h>
>> +#include "dp.h"
>> +
>> +struct ath12k_dbring_element {
>> +	dma_addr_t paddr;
>> +	u8 payload[0];
>
> should just be payload[]
>
> <https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays>

Praneesh fixed this:

c568d8bc26de ath12k: convert payload[0] to payload[], use ab variable and fix __ath12k_dbg() signature
Kalle Valo Oct. 21, 2022, 11:12 a.m. UTC | #3
Kalle Valo <kvalo@kernel.org> writes:

> Jeff Johnson <quic_jjohnson@quicinc.com> writes:
>
>> On 8/12/2022 9:09 AM, Kalle Valo wrote:
>>
>>> 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/dbring.h | 80 ++++++++++++++++++++++++++++++++
>>>   1 file changed, 80 insertions(+)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath12k/dbring.h
>>> b/drivers/net/wireless/ath/ath12k/dbring.h
>>> new file mode 100644
>>> index 000000000000..2be2d8def3f0
>>> --- /dev/null
>>> +++ b/drivers/net/wireless/ath/ath12k/dbring.h
>>> @@ -0,0 +1,80 @@
>>> +/* SPDX-License-Identifier: BSD-3-Clause-Clear */
>>> +/*
>>> + * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
>>> + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
>>> + */
>>> +
>>> +#ifndef ATH12K_DBRING_H
>>> +#define ATH12K_DBRING_H
>>> +
>>> +#include <linux/types.h>
>>> +#include <linux/idr.h>
>>> +#include <linux/spinlock.h>
>>> +#include "dp.h"
>>> +
>>> +struct ath12k_dbring_element {
>>> +	dma_addr_t paddr;
>>> +	u8 payload[0];
>>
>> should just be payload[]
>>
>> <https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays>
>
> Praneesh fixed this:
>
> c568d8bc26de ath12k: convert payload[0] to payload[], use ab variable
> and fix __ath12k_dbg() signature

But there's still more of these:

ce.h:138:	struct sk_buff *skb[0];
core.h:738:	u8 drv_priv[0] __aligned(sizeof(void *));
dp.h:1336:	u8 data[0];
dp.h:1341:	u8 value[0];
dp.h:1597:	u8 payload[0];
rx_desc.h:1397:	u8 msdu_payload[0];
rx_desc.h:1418:	u8 msdu_payload[0];

I added these to my todo list, need to investigate in detail.
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/dbring.h b/drivers/net/wireless/ath/ath12k/dbring.h
new file mode 100644
index 000000000000..2be2d8def3f0
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/dbring.h
@@ -0,0 +1,80 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#ifndef ATH12K_DBRING_H
+#define ATH12K_DBRING_H
+
+#include <linux/types.h>
+#include <linux/idr.h>
+#include <linux/spinlock.h>
+#include "dp.h"
+
+struct ath12k_dbring_element {
+	dma_addr_t paddr;
+	u8 payload[0];
+};
+
+struct ath12k_dbring_data {
+	void *data;
+	u32 data_sz;
+	struct ath12k_wmi_dma_buf_release_meta_data_params meta;
+};
+
+struct ath12k_dbring_buf_release_event {
+	struct ath12k_wmi_dma_buf_release_fixed_params fixed;
+	const struct ath12k_wmi_dma_buf_release_entry_params *buf_entry;
+	const struct ath12k_wmi_dma_buf_release_meta_data_params *meta_data;
+	u32 num_buf_entry;
+	u32 num_meta;
+};
+
+struct ath12k_dbring_cap {
+	u32 pdev_id;
+	enum wmi_direct_buffer_module id;
+	u32 min_elem;
+	u32 min_buf_sz;
+	u32 min_buf_align;
+};
+
+struct ath12k_dbring {
+	struct dp_srng refill_srng;
+	struct idr bufs_idr;
+	/* Protects bufs_idr */
+	spinlock_t idr_lock;
+	dma_addr_t tp_addr;
+	dma_addr_t hp_addr;
+	int bufs_max;
+	u32 pdev_id;
+	u32 buf_sz;
+	u32 buf_align;
+	u32 num_resp_per_event;
+	u32 event_timeout_ms;
+	int (*handler)(struct ath12k *ar, struct ath12k_dbring_data *data);
+};
+
+int ath12k_dbring_set_cfg(struct ath12k *ar,
+			  struct ath12k_dbring *ring,
+			  u32 num_resp_per_event,
+			  u32 event_timeout_ms,
+			  int (*handler)(struct ath12k *,
+					 struct ath12k_dbring_data *));
+int ath12k_dbring_wmi_cfg_setup(struct ath12k *ar,
+				struct ath12k_dbring *ring,
+				enum wmi_direct_buffer_module id);
+int ath12k_dbring_buf_setup(struct ath12k *ar,
+			    struct ath12k_dbring *ring,
+			    struct ath12k_dbring_cap *db_cap);
+int ath12k_dbring_srng_setup(struct ath12k *ar, struct ath12k_dbring *ring,
+			     int ring_num, int num_entries);
+int ath12k_dbring_buffer_release_event(struct ath12k_base *ab,
+				       struct ath12k_dbring_buf_release_event *ev);
+int ath12k_dbring_get_cap(struct ath12k_base *ab,
+			  u8 pdev_idx,
+			  enum wmi_direct_buffer_module id,
+			  struct ath12k_dbring_cap *db_cap);
+void ath12k_dbring_srng_cleanup(struct ath12k *ar, struct ath12k_dbring *ring);
+void ath12k_dbring_buf_cleanup(struct ath12k *ar, struct ath12k_dbring *ring);
+#endif /* ATH12K_DBRING_H */