brintos

brintos / linux-shallow public Read only

0
0
Text · 6.4 KiB · 39226b9 Raw
229 lines · c
1// SPDX-License-Identifier: ISC2/*3 * Copyright (c) 2010 Broadcom Corporation4 */5 6/****************7 * Common types *8 */9 10#ifndef BRCMFMAC_CORE_H11#define BRCMFMAC_CORE_H12 13#include <net/cfg80211.h>14#include "fweh.h"15 16#if IS_MODULE(CONFIG_BRCMFMAC)17#define BRCMF_EXPORT_SYMBOL_GPL(__sym)	EXPORT_SYMBOL_NS_GPL(__sym, BRCMFMAC)18#else19#define BRCMF_EXPORT_SYMBOL_GPL(__sym)20#endif21 22#define TOE_TX_CSUM_OL		0x0000000123#define TOE_RX_CSUM_OL		0x0000000224 25/* For supporting multiple interfaces */26#define BRCMF_MAX_IFS	1627 28/* Small, medium and maximum buffer size for dcmd29 */30#define BRCMF_DCMD_SMLEN	25631#define BRCMF_DCMD_MEDLEN	153632#define BRCMF_DCMD_MAXLEN	819233 34/* IOCTL from host to device are limited in length. A device can only handle35 * ethernet frame size. This limitation is to be applied by protocol layer.36 */37#define BRCMF_TX_IOCTL_MAX_MSG_SIZE	(ETH_FRAME_LEN+ETH_FCS_LEN)38 39#define BRCMF_AMPDU_RX_REORDER_MAXFLOWS		25640 41/* Length of firmware version string stored for42 * ethtool driver info which uses 32 bytes as well.43 */44#define BRCMF_DRIVER_FIRMWARE_VERSION_LEN	3245 46#define NDOL_MAX_ENTRIES	847 48/**49 * struct brcmf_ampdu_rx_reorder - AMPDU receive reorder info50 *51 * @flow_id: AMPDU flow identifier.52 * @cur_idx: last AMPDU index from firmware.53 * @exp_idx: expected next AMPDU index.54 * @max_idx: maximum amount of packets per AMPDU.55 * @pend_pkts: number of packets currently in @pktslots.56 * @pktslots: array for ordering AMPDU packets.57 */58struct brcmf_ampdu_rx_reorder {59	u8 flow_id;60	u8 cur_idx;61	u8 exp_idx;62	u8 max_idx;63	u8 pend_pkts;64	struct sk_buff *pktslots[];65};66 67/* Forward decls for struct brcmf_pub (see below) */68struct brcmf_proto;	/* device communication protocol info */69struct brcmf_fws_info;	/* firmware signalling info */70struct brcmf_mp_device;	/* module paramateres, device specific */71 72/*73 * struct brcmf_rev_info74 *75 * The result field stores the error code of the76 * revision info request from firmware. For the77 * other fields see struct brcmf_rev_info_le in78 * fwil_types.h79 */80struct brcmf_rev_info {81	int result;82	u32 vendorid;83	u32 deviceid;84	u32 radiorev;85	u32 corerev;86	u32 boardid;87	u32 boardvendor;88	u32 boardrev;89	u32 driverrev;90	u32 ucoderev;91	u32 bus;92	char chipname[12];93	u32 phytype;94	u32 phyrev;95	u32 anarev;96	u32 chippkg;97	u32 nvramrev;98};99 100/* Common structure for module and instance linkage */101struct brcmf_pub {102	/* Linkage ponters */103	struct brcmf_bus *bus_if;104	struct brcmf_proto *proto;105	struct wiphy *wiphy;106	struct cfg80211_ops *ops;107	struct brcmf_cfg80211_info *config;108 109	/* Internal brcmf items */110	uint hdrlen;		/* Total BRCMF header length (proto + bus) */111 112	/* Dongle media info */113	char fwver[BRCMF_DRIVER_FIRMWARE_VERSION_LEN];114	u8 mac[ETH_ALEN];		/* MAC address obtained from dongle */115 116	struct mac_address addresses[BRCMF_MAX_IFS];117 118	struct brcmf_if *iflist[BRCMF_MAX_IFS];119	s32 if2bss[BRCMF_MAX_IFS];120	struct brcmf_if *mon_if;121 122	struct mutex proto_block;123	unsigned char proto_buf[BRCMF_DCMD_MAXLEN];124 125	struct brcmf_fweh_info *fweh;126 127	struct brcmf_ampdu_rx_reorder128		*reorder_flows[BRCMF_AMPDU_RX_REORDER_MAXFLOWS];129 130	u32 feat_flags;131	u32 chip_quirks;132 133	struct brcmf_rev_info revinfo;134#ifdef DEBUG135	struct dentry *dbgfs_dir;136#endif137 138	struct notifier_block inetaddr_notifier;139	struct notifier_block inet6addr_notifier;140	struct brcmf_mp_device *settings;141 142	struct work_struct bus_reset;143 144	u8 clmver[BRCMF_DCMD_SMLEN];145	u8 sta_mac_idx;146	const struct brcmf_fwvid_ops *vops;147	void *vdata;148};149 150/* forward declarations */151struct brcmf_cfg80211_vif;152struct brcmf_fws_mac_descriptor;153 154/**155 * enum brcmf_netif_stop_reason - reason for stopping netif queue.156 *157 * @BRCMF_NETIF_STOP_REASON_FWS_FC:158 *	netif stopped due to firmware signalling flow control.159 * @BRCMF_NETIF_STOP_REASON_FLOW:160 *	netif stopped due to flowring full.161 * @BRCMF_NETIF_STOP_REASON_DISCONNECTED:162 *	netif stopped due to not being connected (STA mode).163 */164enum brcmf_netif_stop_reason {165	BRCMF_NETIF_STOP_REASON_FWS_FC = BIT(0),166	BRCMF_NETIF_STOP_REASON_FLOW = BIT(1),167	BRCMF_NETIF_STOP_REASON_DISCONNECTED = BIT(2)168};169 170/**171 * struct brcmf_if - interface control information.172 *173 * @drvr: points to device related information.174 * @vif: points to cfg80211 specific interface information.175 * @ndev: associated network device.176 * @multicast_work: worker object for multicast provisioning.177 * @ndoffload_work: worker object for neighbor discovery offload configuration.178 * @fws_desc: interface specific firmware-signalling descriptor.179 * @ifidx: interface index in device firmware.180 * @bsscfgidx: index of bss associated with this interface.181 * @mac_addr: assigned mac address.182 * @netif_stop: bitmap indicates reason why netif queues are stopped.183 * @netif_stop_lock: spinlock for update netif_stop from multiple sources.184 * @pend_8021x_cnt: tracks outstanding number of 802.1x frames.185 * @pend_8021x_wait: used for signalling change in count.186 * @fwil_fwerr: flag indicating fwil layer should return firmware error codes.187 */188struct brcmf_if {189	struct brcmf_pub *drvr;190	struct brcmf_cfg80211_vif *vif;191	struct net_device *ndev;192	struct work_struct multicast_work;193	struct work_struct ndoffload_work;194	struct brcmf_fws_mac_descriptor *fws_desc;195	int ifidx;196	s32 bsscfgidx;197	u8 mac_addr[ETH_ALEN];198	u8 netif_stop;199	spinlock_t netif_stop_lock;200	atomic_t pend_8021x_cnt;201	wait_queue_head_t pend_8021x_wait;202	struct in6_addr ipv6_addr_tbl[NDOL_MAX_ENTRIES];203	u8 ipv6addr_idx;204	bool fwil_fwerr;205};206 207int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);208 209/* Return pointer to interface name */210char *brcmf_ifname(struct brcmf_if *ifp);211struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);212void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable);213int brcmf_net_attach(struct brcmf_if *ifp, bool locked);214struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,215			      bool is_p2pdev, const char *name, u8 *mac_addr);216void brcmf_remove_interface(struct brcmf_if *ifp, bool locked);217void brcmf_txflowblock_if(struct brcmf_if *ifp,218			  enum brcmf_netif_stop_reason reason, bool state);219void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);220void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);221void brcmf_netif_mon_rx(struct brcmf_if *ifp, struct sk_buff *skb);222void brcmf_net_detach(struct net_device *ndev, bool locked);223int brcmf_net_mon_attach(struct brcmf_if *ifp);224void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);225int __init brcmf_core_init(void);226void __exit brcmf_core_exit(void);227 228#endif /* BRCMFMAC_CORE_H */229