linux/drivers/net/wireless/zydas/zd1211rw/zd_mac.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/* ZD1211 USB-WLAN driver for Linux
 *
 * Copyright (C) 2005-2007 Ulrich Kunitz <[email protected]>
 * Copyright (C) 2006-2007 Daniel Drake <[email protected]>
 */

#ifndef _ZD_MAC_H
#define _ZD_MAC_H

#include <linux/kernel.h>
#include <net/mac80211.h>

#include "zd_chip.h"

struct zd_ctrlset {} __packed;

#define ZD_CS_RESERVED_SIZE

/* The field modulation of struct zd_ctrlset controls the bit rate, the use
 * of short or long preambles in 802.11b (CCK mode) or the use of 802.11a or
 * 802.11g in OFDM mode.
 *
 * The term zd-rate is used for the combination of the modulation type flag
 * and the "pure" rate value.
 */
#define ZD_PURE_RATE_MASK
#define ZD_MODULATION_TYPE_MASK
#define ZD_RATE_MASK
#define ZD_PURE_RATE(modulation)
#define ZD_MODULATION_TYPE(modulation)
#define ZD_RATE(modulation)

/* The two possible modulation types. Notify that 802.11b doesn't use the CCK
 * codeing for the 1 and 2 MBit/s rate. We stay with the term here to remain
 * consistent with uses the term at other places.
 */
#define ZD_CCK
#define ZD_OFDM

/* The ZD1211 firmware uses proprietary encodings of the 802.11b (CCK) rates.
 * For OFDM the PLCP rate encodings are used. We combine these "pure" rates
 * with the modulation type flag and call the resulting values zd-rates.
 */
#define ZD_CCK_RATE_1M
#define ZD_CCK_RATE_2M
#define ZD_CCK_RATE_5_5M
#define ZD_CCK_RATE_11M
#define ZD_OFDM_RATE_6M
#define ZD_OFDM_RATE_9M
#define ZD_OFDM_RATE_12M
#define ZD_OFDM_RATE_18M
#define ZD_OFDM_RATE_24M
#define ZD_OFDM_RATE_36M
#define ZD_OFDM_RATE_48M
#define ZD_OFDM_RATE_54M

/* The bit 5 of the zd_ctrlset modulation field controls the preamble in CCK
 * mode or the 802.11a/802.11g selection in OFDM mode.
 */
#define ZD_CCK_PREA_LONG
#define ZD_CCK_PREA_SHORT
#define ZD_OFDM_MODE_11G
#define ZD_OFDM_MODE_11A

/* zd_ctrlset control field */
#define ZD_CS_NEED_RANDOM_BACKOFF
#define ZD_CS_NO_ACK

#define ZD_CS_FRAME_TYPE_MASK
#define ZD_CS_DATA_FRAME
#define ZD_CS_PS_POLL_FRAME
#define ZD_CS_MANAGEMENT_FRAME
#define ZD_CS_NO_SEQUENCE_CTL_FRAME

#define ZD_CS_WAKE_DESTINATION
#define ZD_CS_RTS
#define ZD_CS_ENCRYPT
#define ZD_CS_SELF_CTS

/* Incoming frames are prepended by a PLCP header */
#define ZD_PLCP_HEADER_SIZE

struct rx_length_info {} __packed;

#define RX_LENGTH_INFO_TAG

struct rx_status {} __packed;

/* rx_status field decryption_type */
#define ZD_RX_NO_WEP
#define ZD_RX_WEP64
#define ZD_RX_TKIP
#define ZD_RX_AES
#define ZD_RX_WEP128
#define ZD_RX_WEP256

/* rx_status field frame_status */
#define ZD_RX_FRAME_MODULATION_MASK
#define ZD_RX_CCK
#define ZD_RX_OFDM

#define ZD_RX_TIMEOUT_ERROR
#define ZD_RX_FIFO_OVERRUN_ERROR
#define ZD_RX_DECRYPTION_ERROR
#define ZD_RX_CRC32_ERROR
#define ZD_RX_NO_ADDR1_MATCH_ERROR
#define ZD_RX_CRC16_ERROR
#define ZD_RX_ERROR

struct tx_retry_rate {};

struct tx_status {} __packed;

enum mac_flags {};

struct housekeeping {};

struct beacon {};

enum zd_device_flags {};

#define ZD_MAC_STATS_BUFFER_SIZE

#define ZD_MAC_MAX_ACK_WAITERS

struct zd_mac {};

#define ZD_REGDOMAIN_FCC
#define ZD_REGDOMAIN_IC
#define ZD_REGDOMAIN_ETSI
#define ZD_REGDOMAIN_SPAIN
#define ZD_REGDOMAIN_FRANCE
#define ZD_REGDOMAIN_JAPAN_2
#define ZD_REGDOMAIN_JAPAN
#define ZD_REGDOMAIN_JAPAN_3

enum {};

#define ZD_PLCP_SERVICE_LENGTH_EXTENSION

struct ofdm_plcp_header {} __packed;

static inline u8 zd_ofdm_plcp_header_rate(const struct ofdm_plcp_header *header)
{}

/* The following defines give the encoding of the 4-bit rate field in the
 * OFDM (802.11a/802.11g) PLCP header. Notify that these values are used to
 * define the zd-rate values for OFDM.
 *
 * See the struct zd_ctrlset definition in zd_mac.h.
 */
#define ZD_OFDM_PLCP_RATE_6M
#define ZD_OFDM_PLCP_RATE_9M
#define ZD_OFDM_PLCP_RATE_12M
#define ZD_OFDM_PLCP_RATE_18M
#define ZD_OFDM_PLCP_RATE_24M
#define ZD_OFDM_PLCP_RATE_36M
#define ZD_OFDM_PLCP_RATE_48M
#define ZD_OFDM_PLCP_RATE_54M

struct cck_plcp_header {} __packed;

static inline u8 zd_cck_plcp_header_signal(const struct cck_plcp_header *header)
{}

/* These defines give the encodings of the signal field in the 802.11b PLCP
 * header. The signal field gives the bit rate of the following packet. Even
 * if technically wrong we use CCK here also for the 1 MBit/s and 2 MBit/s
 * rate to stay consistent with Zydas and our use of the term.
 *
 * Notify that these values are *not* used in the zd-rates.
 */
#define ZD_CCK_PLCP_SIGNAL_1M
#define ZD_CCK_PLCP_SIGNAL_2M
#define ZD_CCK_PLCP_SIGNAL_5M5
#define ZD_CCK_PLCP_SIGNAL_11M

static inline struct zd_mac *zd_hw_mac(struct ieee80211_hw *hw)
{}

static inline struct zd_mac *zd_chip_to_mac(struct zd_chip *chip)
{}

static inline struct zd_mac *zd_usb_to_mac(struct zd_usb *usb)
{}

static inline u8 *zd_mac_get_perm_addr(struct zd_mac *mac)
{}

#define zd_mac_dev(mac)

struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf);
void zd_mac_clear(struct zd_mac *mac);

int zd_mac_preinit_hw(struct ieee80211_hw *hw);
int zd_mac_init_hw(struct ieee80211_hw *hw);

int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length);
void zd_mac_tx_failed(struct urb *urb);
void zd_mac_tx_to_dev(struct sk_buff *skb, int error);

int zd_op_start(struct ieee80211_hw *hw);
void zd_op_stop(struct ieee80211_hw *hw, bool suspend);
int zd_restore_settings(struct zd_mac *mac);

#ifdef DEBUG
void zd_dump_rx_status(const struct rx_status *status);
#else
#define zd_dump_rx_status
#endif /* DEBUG */

#endif /* _ZD_MAC_H */