Commit f398f02d authored by Michael Buesch's avatar Michael Buesch Committed by John W. Linville

[PATCH] bcm43xx: Move TX/RX related functions to its own file. Add basic RTS/CTS code.

Signed-off-by: default avatarMichael Buesch <mbuesch@freenet.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 1d1a73cc
...@@ -8,4 +8,5 @@ bcm43xx-objs := bcm43xx_main.o bcm43xx_ilt.o \ ...@@ -8,4 +8,5 @@ bcm43xx-objs := bcm43xx_main.o bcm43xx_ilt.o \
bcm43xx_radio.o bcm43xx_phy.o \ bcm43xx_radio.o bcm43xx_phy.o \
bcm43xx_power.o bcm43xx_wx.o \ bcm43xx_power.o bcm43xx_wx.o \
bcm43xx_leds.o bcm43xx_ethtool.o \ bcm43xx_leds.o bcm43xx_ethtool.o \
bcm43xx_xmit.o \
$(bcm43xx-obj-y) $(bcm43xx-obj-y)
...@@ -314,23 +314,6 @@ ...@@ -314,23 +314,6 @@
/* Initial default iw_mode */ /* Initial default iw_mode */
#define BCM43xx_INITIAL_IWMODE IW_MODE_INFRA #define BCM43xx_INITIAL_IWMODE IW_MODE_INFRA
/* Values/Masks for the device TX header */
#define BCM43xx_TXHDRFLAG_EXPECTACK 0x0001
#define BCM43xx_TXHDRFLAG_FIRSTFRAGMENT 0x0008
#define BCM43xx_TXHDRFLAG_DESTPSMODE 0x0020
#define BCM43xx_TXHDRFLAG_FALLBACKOFDM 0x0100
#define BCM43xx_TXHDRFLAG_FRAMEBURST 0x0800
#define BCM43xx_TXHDRCTL_OFDM 0x0001
#define BCM43xx_TXHDRCTL_SHORT_PREAMBLE 0x0010
#define BCM43xx_TXHDRCTL_ANTENNADIV_MASK 0x0030
#define BCM43xx_TXHDRCTL_ANTENNADIV_SHIFT 8
#define BCM43xx_TXHDR_WSEC_KEYINDEX_MASK 0x00F0
#define BCM43xx_TXHDR_WSEC_KEYINDEX_SHIFT 4
#define BCM43xx_TXHDR_WSEC_ALGO_MASK 0x0003
#define BCM43xx_TXHDR_WSEC_ALGO_SHIFT 0
/* Bus type PCI. */ /* Bus type PCI. */
#define BCM43xx_BUSTYPE_PCI 0 #define BCM43xx_BUSTYPE_PCI 0
/* Bus type Silicone Backplane Bus. */ /* Bus type Silicone Backplane Bus. */
...@@ -952,4 +935,10 @@ int bcm43xx_pci_write_config32(struct bcm43xx_private *bcm, int offset, u32 valu ...@@ -952,4 +935,10 @@ int bcm43xx_pci_write_config32(struct bcm43xx_private *bcm, int offset, u32 valu
__value; \ __value; \
}) })
/** Helpers to print MAC addresses. */
#define BCM43xx_MACFMT "%02x:%02x:%02x:%02x:%02x:%02x"
#define BCM43xx_MACARG(x) ((u8*)(x))[0], ((u8*)(x))[1], \
((u8*)(x))[2], ((u8*)(x))[3], \
((u8*)(x))[4], ((u8*)(x))[5]
#endif /* BCM43xx_H_ */ #endif /* BCM43xx_H_ */
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "bcm43xx_debugfs.h" #include "bcm43xx_debugfs.h"
#include "bcm43xx_dma.h" #include "bcm43xx_dma.h"
#include "bcm43xx_pio.h" #include "bcm43xx_pio.h"
#include "bcm43xx_xmit.h"
#define REALLY_BIG_BUFFER_SIZE (1024*256) #define REALLY_BIG_BUFFER_SIZE (1024*256)
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "bcm43xx_main.h" #include "bcm43xx_main.h"
#include "bcm43xx_debugfs.h" #include "bcm43xx_debugfs.h"
#include "bcm43xx_power.h" #include "bcm43xx_power.h"
#include "bcm43xx_xmit.h"
#include <linux/dmapool.h> #include <linux/dmapool.h>
#include <linux/pci.h> #include <linux/pci.h>
......
This diff is collapsed.
...@@ -52,134 +52,12 @@ static inline void e_aton(char *str, char *dest) ...@@ -52,134 +52,12 @@ static inline void e_aton(char *str, char *dest)
} }
#endif #endif
#define _bcm43xx_declare_plcp_hdr(size) \
struct bcm43xx_plcp_hdr##size { \
union { \
__le32 data; \
__u8 raw[size]; \
} __attribute__((__packed__)); \
} __attribute__((__packed__))
/* struct bcm43xx_plcp_hdr4 */
_bcm43xx_declare_plcp_hdr(4);
/* struct bcm430c_plcp_hdr6 */
_bcm43xx_declare_plcp_hdr(6);
#undef _bcm43xx_declare_plcp_hdr
#define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes] #define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes]
#define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes) #define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes)
/* Magic helper macro to pad structures. Ignore those above. It's magic. */ /* Magic helper macro to pad structures. Ignore those above. It's magic. */
#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes)) #define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes))
/* Device specific TX header. To be prepended to TX frames. */
struct bcm43xx_txhdr {
union {
struct {
u16 flags;
u16 wsec_rate;
u16 frame_control;
u16 unknown_zeroed_0;
u16 control;
unsigned char wep_iv[10];
unsigned char unknown_wsec_tkip_data[3]; //FIXME
PAD_BYTES(3);
unsigned char mac1[6];
u16 unknown_zeroed_1;
struct bcm43xx_plcp_hdr4 rts_cts_fallback_plcp;
u16 rts_cts_dur_fallback;
struct bcm43xx_plcp_hdr4 fallback_plcp;
u16 fallback_dur_id;
PAD_BYTES(2);
u16 cookie;
u16 unknown_scb_stuff; //FIXME
struct bcm43xx_plcp_hdr6 rts_cts_plcp;
u16 rts_cts_frame_type;
u16 rts_cts_dur;
unsigned char rts_cts_mac1[6];
unsigned char rts_cts_mac2[6];
PAD_BYTES(2);
struct bcm43xx_plcp_hdr6 plcp;
} __attribute__((__packed__));
unsigned char raw[82];
} __attribute__((__packed__));
} __attribute__((__packed__));
struct sk_buff;
void bcm43xx_generate_txhdr(struct bcm43xx_private *bcm,
struct bcm43xx_txhdr *txhdr,
const unsigned char *fragment_data,
const unsigned int fragment_len,
const int is_first_fragment,
const u16 cookie);
/* RX header as received from the hardware. */
struct bcm43xx_rxhdr {
/* Frame Length. Must be generated explicitely in PIO mode. */
__le16 frame_length;
PAD_BYTES(2);
/* Flags field 1 */
__le16 flags1;
u8 rssi;
u8 signal_quality;
PAD_BYTES(2);
/* Flags field 3 */
__le16 flags3;
/* Flags field 2 */
__le16 flags2;
/* Lower 16bits of the TSF at the time the frame started. */
__le16 mactime;
PAD_BYTES(14);
} __attribute__((__packed__));
#define BCM43xx_RXHDR_FLAGS1_OFDM (1 << 0)
/*#define BCM43xx_RXHDR_FLAGS1_SIGNAL??? (1 << 3) FIXME */
#define BCM43xx_RXHDR_FLAGS1_SHORTPREAMBLE (1 << 7)
#define BCM43xx_RXHDR_FLAGS1_2053RSSIADJ (1 << 14)
#define BCM43xx_RXHDR_FLAGS2_INVALIDFRAME (1 << 0)
#define BCM43xx_RXHDR_FLAGS2_TYPE2FRAME (1 << 2)
/*FIXME: WEP related flags */
#define BCM43xx_RXHDR_FLAGS3_2050RSSIADJ (1 << 10)
/* Transmit Status as received from the hardware. */
struct bcm43xx_hwxmitstatus {
PAD_BYTES(4);
__le16 cookie;
u8 flags;
u8 cnt1:4,
cnt2:4;
PAD_BYTES(2);
__le16 seq;
__le16 unknown; //FIXME
} __attribute__((__packed__));
/* Transmit Status in CPU byteorder. */
struct bcm43xx_xmitstatus {
u16 cookie;
u8 flags;
u8 cnt1:4,
cnt2:4;
u16 seq;
u16 unknown; //FIXME
};
#define BCM43xx_TXSTAT_FLAG_ACK 0x01
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x02
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x04
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x08
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x10
#define BCM43xx_TXSTAT_FLAG_IGNORE 0x20
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x40
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x80
/* Lightweight function to convert a frequency (in Mhz) to a channel number. */ /* Lightweight function to convert a frequency (in Mhz) to a channel number. */
static inline static inline
u8 bcm43xx_freq_to_channel_a(int freq) u8 bcm43xx_freq_to_channel_a(int freq)
...@@ -259,10 +137,6 @@ int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, ...@@ -259,10 +137,6 @@ int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm,
void bcm43xx_tsf_read(struct bcm43xx_private *bcm, u64 *tsf); void bcm43xx_tsf_read(struct bcm43xx_private *bcm, u64 *tsf);
void bcm43xx_tsf_write(struct bcm43xx_private *bcm, u64 tsf); void bcm43xx_tsf_write(struct bcm43xx_private *bcm, u64 tsf);
int bcm43xx_rx(struct bcm43xx_private *bcm,
struct sk_buff *skb,
struct bcm43xx_rxhdr *rxhdr);
void bcm43xx_set_iwmode(struct bcm43xx_private *bcm, void bcm43xx_set_iwmode(struct bcm43xx_private *bcm,
int iw_mode); int iw_mode);
...@@ -283,11 +157,6 @@ int bcm43xx_switch_core(struct bcm43xx_private *bcm, struct bcm43xx_coreinfo *ne ...@@ -283,11 +157,6 @@ int bcm43xx_switch_core(struct bcm43xx_private *bcm, struct bcm43xx_coreinfo *ne
void bcm43xx_wireless_core_reset(struct bcm43xx_private *bcm, int connect_phy); void bcm43xx_wireless_core_reset(struct bcm43xx_private *bcm, int connect_phy);
int bcm43xx_pci_read_config_16(struct pci_dev *pdev, u16 offset, u16 *val);
int bcm43xx_pci_read_config_32(struct pci_dev *pdev, u16 offset, u32 *val);
int bcm43xx_pci_write_config_16(struct pci_dev *pdev, int offset, u16 val);
int bcm43xx_pci_write_config_32(struct pci_dev *pdev, int offset, u32 val);
void bcm43xx_mac_suspend(struct bcm43xx_private *bcm); void bcm43xx_mac_suspend(struct bcm43xx_private *bcm);
void bcm43xx_mac_enable(struct bcm43xx_private *bcm); void bcm43xx_mac_enable(struct bcm43xx_private *bcm);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "bcm43xx.h" #include "bcm43xx.h"
#include "bcm43xx_pio.h" #include "bcm43xx_pio.h"
#include "bcm43xx_main.h" #include "bcm43xx_main.h"
#include "bcm43xx_xmit.h"
#include <linux/delay.h> #include <linux/delay.h>
......
This diff is collapsed.
#ifndef BCM43xx_XMIT_H_
#define BCM43xx_XMIT_H_
#include "bcm43xx_main.h"
#define _bcm43xx_declare_plcp_hdr(size) \
struct bcm43xx_plcp_hdr##size { \
union { \
__le32 data; \
__u8 raw[size]; \
} __attribute__((__packed__)); \
} __attribute__((__packed__))
/* struct bcm43xx_plcp_hdr4 */
_bcm43xx_declare_plcp_hdr(4);
/* struct bcm43xx_plcp_hdr6 */
_bcm43xx_declare_plcp_hdr(6);
#undef _bcm43xx_declare_plcp_hdr
/* Device specific TX header. To be prepended to TX frames. */
struct bcm43xx_txhdr {
union {
struct {
__le16 flags;
__le16 wsec_rate;
__le16 frame_control;
u16 unknown_zeroed_0;
__le16 control;
u8 wep_iv[10];
u8 unknown_wsec_tkip_data[3]; //FIXME
PAD_BYTES(3);
u8 mac1[6];
u16 unknown_zeroed_1;
struct bcm43xx_plcp_hdr4 rts_cts_fallback_plcp;
__le16 rts_cts_dur_fallback;
struct bcm43xx_plcp_hdr4 fallback_plcp;
__le16 fallback_dur_id;
PAD_BYTES(2);
__le16 cookie;
__le16 unknown_scb_stuff; //FIXME
struct bcm43xx_plcp_hdr6 rts_cts_plcp;
__le16 rts_cts_frame_control;
__le16 rts_cts_dur;
u8 rts_cts_mac1[6];
u8 rts_cts_mac2[6];
PAD_BYTES(2);
struct bcm43xx_plcp_hdr6 plcp;
} __attribute__((__packed__));
u8 raw[82];
} __attribute__((__packed__));
} __attribute__((__packed__));
/* Values/Masks for the device TX header */
#define BCM43xx_TXHDRFLAG_EXPECTACK 0x0001
#define BCM43xx_TXHDRFLAG_RTSCTS 0x0002
#define BCM43xx_TXHDRFLAG_RTS 0x0004
#define BCM43xx_TXHDRFLAG_FIRSTFRAGMENT 0x0008
#define BCM43xx_TXHDRFLAG_DESTPSMODE 0x0020
#define BCM43xx_TXHDRFLAG_RTSCTS_OFDM 0x0080
#define BCM43xx_TXHDRFLAG_FALLBACKOFDM 0x0100
#define BCM43xx_TXHDRFLAG_RTSCTSFALLBACK_OFDM 0x0200
#define BCM43xx_TXHDRFLAG_CTS 0x0400
#define BCM43xx_TXHDRFLAG_FRAMEBURST 0x0800
#define BCM43xx_TXHDRCTL_OFDM 0x0001
#define BCM43xx_TXHDRCTL_SHORT_PREAMBLE 0x0010
#define BCM43xx_TXHDRCTL_ANTENNADIV_MASK 0x0030
#define BCM43xx_TXHDRCTL_ANTENNADIV_SHIFT 8
#define BCM43xx_TXHDR_RATE_MASK 0x0F00
#define BCM43xx_TXHDR_RATE_SHIFT 8
#define BCM43xx_TXHDR_RTSRATE_MASK 0xF000
#define BCM43xx_TXHDR_RTSRATE_SHIFT 12
#define BCM43xx_TXHDR_WSEC_KEYINDEX_MASK 0x00F0
#define BCM43xx_TXHDR_WSEC_KEYINDEX_SHIFT 4
#define BCM43xx_TXHDR_WSEC_ALGO_MASK 0x0003
#define BCM43xx_TXHDR_WSEC_ALGO_SHIFT 0
void bcm43xx_generate_txhdr(struct bcm43xx_private *bcm,
struct bcm43xx_txhdr *txhdr,
const unsigned char *fragment_data,
const unsigned int fragment_len,
const int is_first_fragment,
const u16 cookie);
/* RX header as received from the hardware. */
struct bcm43xx_rxhdr {
/* Frame Length. Must be generated explicitely in PIO mode. */
__le16 frame_length;
PAD_BYTES(2);
/* Flags field 1 */
__le16 flags1;
u8 rssi;
u8 signal_quality;
PAD_BYTES(2);
/* Flags field 3 */
__le16 flags3;
/* Flags field 2 */
__le16 flags2;
/* Lower 16bits of the TSF at the time the frame started. */
__le16 mactime;
PAD_BYTES(14);
} __attribute__((__packed__));
#define BCM43xx_RXHDR_FLAGS1_OFDM (1 << 0)
/*#define BCM43xx_RXHDR_FLAGS1_SIGNAL??? (1 << 3) FIXME */
#define BCM43xx_RXHDR_FLAGS1_SHORTPREAMBLE (1 << 7)
#define BCM43xx_RXHDR_FLAGS1_2053RSSIADJ (1 << 14)
#define BCM43xx_RXHDR_FLAGS2_INVALIDFRAME (1 << 0)
#define BCM43xx_RXHDR_FLAGS2_TYPE2FRAME (1 << 2)
/*FIXME: WEP related flags */
#define BCM43xx_RXHDR_FLAGS3_2050RSSIADJ (1 << 10)
/* Transmit Status as received from the hardware. */
struct bcm43xx_hwxmitstatus {
PAD_BYTES(4);
__le16 cookie;
u8 flags;
u8 cnt1:4,
cnt2:4;
PAD_BYTES(2);
__le16 seq;
__le16 unknown; //FIXME
} __attribute__((__packed__));
/* Transmit Status in CPU byteorder. */
struct bcm43xx_xmitstatus {
u16 cookie;
u8 flags;
u8 cnt1:4,
cnt2:4;
u16 seq;
u16 unknown; //FIXME
};
#define BCM43xx_TXSTAT_FLAG_ACK 0x01
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x02
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x04
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x08
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x10
#define BCM43xx_TXSTAT_FLAG_IGNORE 0x20
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x40
//TODO #define BCM43xx_TXSTAT_FLAG_??? 0x80
u8 bcm43xx_plcp_get_ratecode_cck(const u8 bitrate);
u8 bcm43xx_plcp_get_ratecode_ofdm(const u8 bitrate);
int bcm43xx_rx(struct bcm43xx_private *bcm,
struct sk_buff *skb,
struct bcm43xx_rxhdr *rxhdr);
#endif /* BCM43xx_XMIT_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment