linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h

// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2012 Broadcom Corporation
 */


#ifndef FWEH_H_
#define FWEH_H_

#include <linux/unaligned.h>
#include <linux/skbuff.h>
#include <linux/if_ether.h>
#include <linux/if.h>

/* formward declarations */
struct brcmf_pub;
struct brcmf_if;
struct brcmf_cfg80211_info;

#define BRCMF_ABSTRACT_EVENT_BIT
#define BRCMF_ABSTRACT_ENUM_DEF(_id, _val)

/* list of firmware events */
#define BRCMF_FWEH_EVENT_ENUM_DEFLIST

#define BRCMF_ENUM_DEF

/* firmware event codes sent by the dongle */
enum brcmf_fweh_event_code {};
#undef BRCMF_ENUM_DEF

/* flags field values in struct brcmf_event_msg */
#define BRCMF_EVENT_MSG_LINK
#define BRCMF_EVENT_MSG_FLUSHTXQ
#define BRCMF_EVENT_MSG_GROUP

/* status field values in struct brcmf_event_msg */
#define BRCMF_E_STATUS_SUCCESS
#define BRCMF_E_STATUS_FAIL
#define BRCMF_E_STATUS_TIMEOUT
#define BRCMF_E_STATUS_NO_NETWORKS
#define BRCMF_E_STATUS_ABORT
#define BRCMF_E_STATUS_NO_ACK
#define BRCMF_E_STATUS_UNSOLICITED
#define BRCMF_E_STATUS_ATTEMPT
#define BRCMF_E_STATUS_PARTIAL
#define BRCMF_E_STATUS_NEWSCAN
#define BRCMF_E_STATUS_NEWASSOC
#define BRCMF_E_STATUS_11HQUIET
#define BRCMF_E_STATUS_SUPPRESS
#define BRCMF_E_STATUS_NOCHANS
#define BRCMF_E_STATUS_CS_ABORT
#define BRCMF_E_STATUS_ERROR

/* status field values for PSK_SUP event */
#define BRCMF_E_STATUS_FWSUP_WAIT_M1
#define BRCMF_E_STATUS_FWSUP_PREP_M2
#define BRCMF_E_STATUS_FWSUP_COMPLETED
#define BRCMF_E_STATUS_FWSUP_TIMEOUT
#define BRCMF_E_STATUS_FWSUP_WAIT_M3
#define BRCMF_E_STATUS_FWSUP_PREP_M4
#define BRCMF_E_STATUS_FWSUP_WAIT_G1
#define BRCMF_E_STATUS_FWSUP_PREP_G2

/* reason field values in struct brcmf_event_msg */
#define BRCMF_E_REASON_INITIAL_ASSOC
#define BRCMF_E_REASON_LOW_RSSI
#define BRCMF_E_REASON_DEAUTH
#define BRCMF_E_REASON_DISASSOC
#define BRCMF_E_REASON_BCNS_LOST
#define BRCMF_E_REASON_MINTXRATE
#define BRCMF_E_REASON_TXFAIL

#define BRCMF_E_REASON_LINK_BSSCFG_DIS
#define BRCMF_E_REASON_FAST_ROAM_FAILED
#define BRCMF_E_REASON_DIRECTED_ROAM
#define BRCMF_E_REASON_TSPEC_REJECTED
#define BRCMF_E_REASON_BETTER_AP

#define BRCMF_E_REASON_TDLS_PEER_DISCOVERED
#define BRCMF_E_REASON_TDLS_PEER_CONNECTED
#define BRCMF_E_REASON_TDLS_PEER_DISCONNECTED

/* reason field values for PSK_SUP event */
#define BRCMF_E_REASON_FWSUP_OTHER
#define BRCMF_E_REASON_FWSUP_DECRYPT_KEY_DATA
#define BRCMF_E_REASON_FWSUP_BAD_UCAST_WEP128
#define BRCMF_E_REASON_FWSUP_BAD_UCAST_WEP40
#define BRCMF_E_REASON_FWSUP_UNSUP_KEY_LEN
#define BRCMF_E_REASON_FWSUP_PW_KEY_CIPHER
#define BRCMF_E_REASON_FWSUP_MSG3_TOO_MANY_IE
#define BRCMF_E_REASON_FWSUP_MSG3_IE_MISMATCH
#define BRCMF_E_REASON_FWSUP_NO_INSTALL_FLAG
#define BRCMF_E_REASON_FWSUP_MSG3_NO_GTK
#define BRCMF_E_REASON_FWSUP_GRP_KEY_CIPHER
#define BRCMF_E_REASON_FWSUP_GRP_MSG1_NO_GTK
#define BRCMF_E_REASON_FWSUP_GTK_DECRYPT_FAIL
#define BRCMF_E_REASON_FWSUP_SEND_FAIL
#define BRCMF_E_REASON_FWSUP_DEAUTH
#define BRCMF_E_REASON_FWSUP_WPA_PSK_TMO
#define BRCMF_E_REASON_FWSUP_WPA_PSK_M1_TMO
#define BRCMF_E_REASON_FWSUP_WPA_PSK_M3_TMO

/* action field values for brcmf_ifevent */
#define BRCMF_E_IF_ADD
#define BRCMF_E_IF_DEL
#define BRCMF_E_IF_CHANGE

/* flag field values for brcmf_ifevent */
#define BRCMF_E_IF_FLAG_NOIF

/* role field values for brcmf_ifevent */
#define BRCMF_E_IF_ROLE_STA
#define BRCMF_E_IF_ROLE_AP
#define BRCMF_E_IF_ROLE_WDS
#define BRCMF_E_IF_ROLE_P2P_GO
#define BRCMF_E_IF_ROLE_P2P_CLIENT

/**
 * definitions for event packet validation.
 */
#define BRCM_OUI
#define BCMILCP_BCM_SUBTYPE_EVENT
#define BCMILCP_SUBTYPE_VENDOR_LONG

/**
 * struct brcm_ethhdr - broadcom specific ether header.
 *
 * @subtype: subtype for this packet.
 * @length: TODO: length of appended data.
 * @version: version indication.
 * @oui: OUI of this packet.
 * @usr_subtype: subtype for this OUI.
 */
struct brcm_ethhdr {} __packed;

struct brcmf_event_msg_be {} __packed;

/**
 * struct brcmf_event - contents of broadcom event packet.
 *
 * @eth: standard ether header.
 * @hdr: broadcom specific ether header.
 * @msg: common part of the actual event message.
 */
struct brcmf_event {} __packed;

/**
 * struct brcmf_event_msg - firmware event message.
 *
 * @version: version information.
 * @flags: event flags.
 * @event_code: firmware event code.
 * @status: status information.
 * @reason: reason code.
 * @auth_type: authentication type.
 * @datalen: length of event data buffer.
 * @addr: ether address.
 * @ifname: interface name.
 * @ifidx: interface index.
 * @bsscfgidx: bsscfg index.
 */
struct brcmf_event_msg {};

struct brcmf_if_event {};

brcmf_fweh_handler_t;

/**
 * struct brcmf_fweh_event_map_item - fweh event and firmware event pair.
 *
 * @code: fweh event code as used by higher layers.
 * @fwevt_code: firmware event code as used by firmware.
 *
 * This mapping is needed when a functionally identical event has a
 * different numerical definition between vendors. When such mapping
 * is needed the higher layer event code should not collide with the
 * firmware event.
 */
struct brcmf_fweh_event_map_item {};

/**
 * struct brcmf_fweh_event_map - mapping between firmware event and fweh event.
 *
 * @n_items: number of mapping items.
 * @items: array of fweh event and firmware event pairs.
 */
struct brcmf_fweh_event_map {};

/**
 * struct brcmf_fweh_info - firmware event handling information.
 *
 * @p2pdev_setup_ongoing: P2P device creation in progress.
 * @event_work: event worker.
 * @evt_q_lock: lock for event queue protection.
 * @event_q: event queue.
 * @event_mask_len: length of @event_mask used to enable firmware events.
 * @event_mask: byte array used in 'event_msgs' iovar command.
 * @event_map: mapping between fweh event and firmware event which
 *	may be provided by vendor-specific module for events that need
 *	mapping.
 * @num_event_codes: number of firmware events supported by firmware which
 *	does a minimum length check for the @event_mask. This value is to
 *	be provided by vendor-specific module determining @event_mask_len
 *	and consequently the allocation size for @event_mask.
 * @evt_handler: event handler registry indexed by firmware event code.
 */
struct brcmf_fweh_info {};

const char *brcmf_fweh_event_name(enum brcmf_fweh_event_code code);

int brcmf_fweh_attach(struct brcmf_pub *drvr);
void brcmf_fweh_detach(struct brcmf_pub *drvr);
int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code,
			int (*handler)(struct brcmf_if *ifp,
				       const struct brcmf_event_msg *evtmsg,
				       void *data));
void brcmf_fweh_unregister(struct brcmf_pub *drvr,
			   enum brcmf_fweh_event_code code);
int brcmf_fweh_activate_events(struct brcmf_if *ifp);
void brcmf_fweh_process_event(struct brcmf_pub *drvr,
			      struct brcmf_event *event_packet,
			      u32 packet_len, gfp_t gfp);
void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing);

static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
					  struct sk_buff *skb, u16 stype,
					  gfp_t gfp)
{}

#endif /* FWEH_H_ */