Part of the split. Please, take a look at the cover letter for more details Reviewed-by: Viktor Barna <viktor.barna.rj@xxxxxxxxxxxxxx> Reviewed-by: Gal Gur <gal.gur.jx@xxxxxxxxxxx> Signed-off-by: Alexander Savchenko <oleksandr.savchenko.dn@xxxxxxxxxxxxxx> --- drivers/net/wireless/renesas/ra6w/status.h | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 drivers/net/wireless/renesas/ra6w/status.h diff --git a/drivers/net/wireless/renesas/ra6w/status.h b/drivers/net/wireless/renesas/ra6w/status.h new file mode 100644 index 000000000000..3736e2a2fdb7 --- /dev/null +++ b/drivers/net/wireless/renesas/ra6w/status.h @@ -0,0 +1,73 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) [2022-2025] Renesas Electronics Corporation and/or its affiliates. + */ + +#ifndef RA6W_STATUS_H +#define RA6W_STATUS_H + +#include <linux/types.h> +#include <linux/mutex.h> + +enum ra6w_status_code { + RA6W_STATUS_CODE_SUCCESS = 0, + RA6W_STATUS_CODE_FAIL, + RA6W_STATUS_CODE_EMPTY, + RA6W_STATUS_CODE_FULL, + RA6W_STATUS_CODE_INVALID_PARAM, + RA6W_STATUS_CODE_NOT_FOUND, + RA6W_STATUS_CODE_NO_MORE, + RA6W_STATUS_CODE_NOT_IN_USE, + RA6W_STATUS_CODE_BUSY, + RA6W_STATUS_CODE_IN_PROGRESS, + RA6W_STATUS_CODE_MEMORY_FAIL, + RA6W_STATUS_CODE_NOT_SUPPORT, + RA6W_STATUS_CODE_EXIST, + + RA6W_STATUS_CODE_MAX +}; + +enum ra6w_status_byte { + RA6W_STATUS_BYTE_STATUS, + RA6W_STATUS_BYTE_TX_AVAIL_CNT, + RA6W_STATUS_BYTE_TX_POWER_AVAIL_CNT, + RA6W_STATUS_BYTE_RESERVED, + + RA6W_STATUS_BYTE_MAX +}; + +enum ra6w_status_byte_bits { + RA6W_STATUS_BIT_RX_EMPTY, + RA6W_STATUS_BIT_TX_AC_FULL, + RA6W_STATUS_BIT_TX_POWER_FULL, + + RA6W_STATUS_BITS_MAX +}; + +struct ra6w_status { + u8 value[RA6W_STATUS_BYTE_MAX]; + spinlock_t lock; +}; + +struct ra6w_status_ext_hdr { + u32 status : 32; +}; + +struct ra6w_status_buf { + u8 cmd; + u8 ext_len; + __le16 data_len; + struct ra6w_status_ext_hdr ext_hdr; +}; + +#define RA6W_STATUS_EXT_LEN (sizeof(struct ra6w_status_ext_hdr)) + +void ra6w_status_init(struct ra6w_status *status); +void ra6w_status_set(struct ra6w_status *status, u32 value); +u8 ra6w_status_rx_get(struct ra6w_status *status); +u8 ra6w_status_tx_get(struct ra6w_status *status, u8 ac); +u8 ra6w_status_tx_avail_cnt_get(struct ra6w_status *status, u8 ac); +int ra6w_status_err_code_to_errno(u8 err); +void ra6w_status_event_post(struct ra6w_status *status, const struct sk_buff *skb); + +#endif /* RA6W_STATUS_H */ -- 2.17.1