Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba73d4c8 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.26

parents b8ad0cbc deedf504
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -11,7 +11,8 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
	    procfs-guide.xml writing_usb_driver.xml networking.xml \
	    kernel-api.xml filesystems.xml lsm.xml usb.xml \
	    gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
	    genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml
	    genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
	    mac80211.xml

###
# The build process is as follows (targets):
+335 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>

<book id="mac80211-developers-guide">
  <bookinfo>
    <title>The mac80211 subsystem for kernel developers</title>

    <authorgroup>
      <author>
        <firstname>Johannes</firstname>
        <surname>Berg</surname>
        <affiliation>
          <address><email>johannes@sipsolutions.net</email></address>
        </affiliation>
      </author>
    </authorgroup>

    <copyright>
      <year>2007</year>
      <year>2008</year>
      <holder>Johannes Berg</holder>
    </copyright>

    <legalnotice>
      <para>
        This documentation is free software; you can redistribute
        it and/or modify it under the terms of the GNU General Public
        License version 2 as published by the Free Software Foundation.
      </para>

      <para>
        This documentation is distributed in the hope that it will be
        useful, but WITHOUT ANY WARRANTY; without even the implied
        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
        See the GNU General Public License for more details.
      </para>

      <para>
        You should have received a copy of the GNU General Public
        License along with this documentation; if not, write to the Free
        Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
        MA 02111-1307 USA
      </para>

      <para>
        For more details see the file COPYING in the source
        distribution of Linux.
      </para>
    </legalnotice>

    <abstract>
!Pinclude/net/mac80211.h Introduction
!Pinclude/net/mac80211.h Warning
    </abstract>
  </bookinfo>

  <toc></toc>

<!--
Generally, this document shall be ordered by increasing complexity.
It is important to note that readers should be able to read only
the first few sections to get a working driver and only advanced
usage should require reading the full document.
-->

  <part>
    <title>The basic mac80211 driver interface</title>
    <partintro>
      <para>
        You should read and understand the information contained
        within this part of the book while implementing a driver.
        In some chapters, advanced usage is noted, that may be
        skipped at first.
      </para>
      <para>
        This part of the book only covers station and monitor mode
        functionality, additional information required to implement
        the other modes is covered in the second part of the book.
      </para>
    </partintro>

    <chapter id="basics">
      <title>Basic hardware handling</title>
      <para>TBD</para>
      <para>
        This chapter shall contain information on getting a hw
        struct allocated and registered with mac80211.
      </para>
      <para>
        Since it is required to allocate rates/modes before registering
        a hw struct, this chapter shall also contain information on setting
        up the rate/mode structs.
      </para>
      <para>
        Additionally, some discussion about the callbacks and
        the general programming model should be in here, including
        the definition of ieee80211_ops which will be referred to
        a lot.
      </para>
      <para>
        Finally, a discussion of hardware capabilities should be done
        with references to other parts of the book.
      </para>
<!-- intentionally multiple !F lines to get proper order -->
!Finclude/net/mac80211.h ieee80211_hw
!Finclude/net/mac80211.h ieee80211_hw_flags
!Finclude/net/mac80211.h SET_IEEE80211_DEV
!Finclude/net/mac80211.h SET_IEEE80211_PERM_ADDR
!Finclude/net/mac80211.h ieee80211_ops
!Finclude/net/mac80211.h ieee80211_alloc_hw
!Finclude/net/mac80211.h ieee80211_register_hw
!Finclude/net/mac80211.h ieee80211_get_tx_led_name
!Finclude/net/mac80211.h ieee80211_get_rx_led_name
!Finclude/net/mac80211.h ieee80211_get_assoc_led_name
!Finclude/net/mac80211.h ieee80211_get_radio_led_name
!Finclude/net/mac80211.h ieee80211_unregister_hw
!Finclude/net/mac80211.h ieee80211_free_hw
    </chapter>

    <chapter id="phy-handling">
      <title>PHY configuration</title>
      <para>TBD</para>
      <para>
        This chapter should describe PHY handling including
        start/stop callbacks and the various structures used.
      </para>
!Finclude/net/mac80211.h ieee80211_conf
!Finclude/net/mac80211.h ieee80211_conf_flags
    </chapter>

    <chapter id="iface-handling">
      <title>Virtual interfaces</title>
      <para>TBD</para>
      <para>
        This chapter should describe virtual interface basics
        that are relevant to the driver (VLANs, MGMT etc are not.)
        It should explain the use of the add_iface/remove_iface
        callbacks as well as the interface configuration callbacks.
      </para>
      <para>Things related to AP mode should be discussed there.</para>
      <para>
        Things related to supporting multiple interfaces should be
        in the appropriate chapter, a BIG FAT note should be here about
        this though and the recommendation to allow only a single
        interface in STA mode at first!
      </para>
!Finclude/net/mac80211.h ieee80211_if_types
!Finclude/net/mac80211.h ieee80211_if_init_conf
!Finclude/net/mac80211.h ieee80211_if_conf
    </chapter>

    <chapter id="rx-tx">
      <title>Receive and transmit processing</title>
      <sect1>
        <title>what should be here</title>
        <para>TBD</para>
        <para>
          This should describe the receive and transmit
          paths in mac80211/the drivers as well as
          transmit status handling.
        </para>
      </sect1>
      <sect1>
        <title>Frame format</title>
!Pinclude/net/mac80211.h Frame format
      </sect1>
      <sect1>
        <title>Alignment issues</title>
        <para>TBD</para>
      </sect1>
      <sect1>
        <title>Calling into mac80211 from interrupts</title>
!Pinclude/net/mac80211.h Calling mac80211 from interrupts
      </sect1>
      <sect1>
        <title>functions/definitions</title>
!Finclude/net/mac80211.h ieee80211_rx_status
!Finclude/net/mac80211.h mac80211_rx_flags
!Finclude/net/mac80211.h ieee80211_tx_control
!Finclude/net/mac80211.h ieee80211_tx_status_flags
!Finclude/net/mac80211.h ieee80211_rx
!Finclude/net/mac80211.h ieee80211_rx_irqsafe
!Finclude/net/mac80211.h ieee80211_tx_status
!Finclude/net/mac80211.h ieee80211_tx_status_irqsafe
!Finclude/net/mac80211.h ieee80211_rts_get
!Finclude/net/mac80211.h ieee80211_rts_duration
!Finclude/net/mac80211.h ieee80211_ctstoself_get
!Finclude/net/mac80211.h ieee80211_ctstoself_duration
!Finclude/net/mac80211.h ieee80211_generic_frame_duration
!Finclude/net/mac80211.h ieee80211_get_hdrlen_from_skb
!Finclude/net/mac80211.h ieee80211_get_hdrlen
!Finclude/net/mac80211.h ieee80211_wake_queue
!Finclude/net/mac80211.h ieee80211_stop_queue
!Finclude/net/mac80211.h ieee80211_start_queues
!Finclude/net/mac80211.h ieee80211_stop_queues
!Finclude/net/mac80211.h ieee80211_wake_queues
      </sect1>
    </chapter>

    <chapter id="filters">
      <title>Frame filtering</title>
!Pinclude/net/mac80211.h Frame filtering
!Finclude/net/mac80211.h ieee80211_filter_flags
    </chapter>
  </part>

  <part id="advanced">
    <title>Advanced driver interface</title>
    <partintro>
      <para>
       Information contained within this part of the book is
       of interest only for advanced interaction of mac80211
       with drivers to exploit more hardware capabilities and
       improve performance.
      </para>
    </partintro>

    <chapter id="hardware-crypto-offload">
      <title>Hardware crypto acceleration</title>
!Pinclude/net/mac80211.h Hardware crypto acceleration
<!-- intentionally multiple !F lines to get proper order -->
!Finclude/net/mac80211.h set_key_cmd
!Finclude/net/mac80211.h ieee80211_key_conf
!Finclude/net/mac80211.h ieee80211_key_alg
!Finclude/net/mac80211.h ieee80211_key_flags
    </chapter>

    <chapter id="qos">
      <title>Multiple queues and QoS support</title>
      <para>TBD</para>
!Finclude/net/mac80211.h ieee80211_tx_queue_params
!Finclude/net/mac80211.h ieee80211_tx_queue_stats_data
!Finclude/net/mac80211.h ieee80211_tx_queue
    </chapter>

    <chapter id="AP">
      <title>Access point mode support</title>
      <para>TBD</para>
      <para>Some parts of the if_conf should be discussed here instead</para>
      <para>
        Insert notes about VLAN interfaces with hw crypto here or
        in the hw crypto chapter.
      </para>
!Finclude/net/mac80211.h ieee80211_get_buffered_bc
!Finclude/net/mac80211.h ieee80211_beacon_get
    </chapter>

    <chapter id="multi-iface">
      <title>Supporting multiple virtual interfaces</title>
      <para>TBD</para>
      <para>
        Note: WDS with identical MAC address should almost always be OK
      </para>
      <para>
        Insert notes about having multiple virtual interfaces with
        different MAC addresses here, note which configurations are
        supported by mac80211, add notes about supporting hw crypto
        with it.
      </para>
    </chapter>

    <chapter id="hardware-scan-offload">
      <title>Hardware scan offload</title>
      <para>TBD</para>
!Finclude/net/mac80211.h ieee80211_scan_completed
    </chapter>
  </part>

  <part id="rate-control">
    <title>Rate control interface</title>
    <partintro>
      <para>TBD</para>
      <para>
       This part of the book describes the rate control algorithm
       interface and how it relates to mac80211 and drivers.
      </para>
    </partintro>
    <chapter id="dummy">
      <title>dummy chapter</title>
      <para>TBD</para>
    </chapter>
  </part>

  <part id="internal">
    <title>Internals</title>
    <partintro>
      <para>TBD</para>
      <para>
       This part of the book describes mac80211 internals.
      </para>
    </partintro>

    <chapter id="key-handling">
      <title>Key handling</title>
      <sect1>
        <title>Key handling basics</title>
!Pnet/mac80211/key.c Key handling basics
      </sect1>
      <sect1>
        <title>MORE TBD</title>
        <para>TBD</para>
      </sect1>
    </chapter>

    <chapter id="rx-processing">
      <title>Receive processing</title>
      <para>TBD</para>
    </chapter>

    <chapter id="tx-processing">
      <title>Transmit processing</title>
      <para>TBD</para>
    </chapter>

    <chapter id="sta-info">
      <title>Station info handling</title>
      <sect1>
        <title>Programming information</title>
!Fnet/mac80211/sta_info.h sta_info
!Fnet/mac80211/sta_info.h ieee80211_sta_info_flags
      </sect1>
      <sect1>
        <title>STA information lifetime rules</title>
!Pnet/mac80211/sta_info.c STA information lifetime rules
      </sect1>
    </chapter>

    <chapter id="synchronisation">
      <title>Synchronisation</title>
      <para>TBD</para>
      <para>Locking, lots of RCU</para>
    </chapter>
  </part>
</book>
+27 −26
Original line number Diff line number Diff line
@@ -140,7 +140,8 @@ enum ath5k_radio {
	AR5K_RF5110	= 0,
	AR5K_RF5111	= 1,
	AR5K_RF5112	= 2,
	AR5K_RF5413	= 3,
	AR5K_RF2413	= 3,
	AR5K_RF5413	= 4,
};

/*
@@ -168,12 +169,15 @@ struct ath5k_srev_name {
#define AR5K_SREV_VER_AR5212	0x50
#define AR5K_SREV_VER_AR5213	0x55
#define AR5K_SREV_VER_AR5213A	0x59
#define AR5K_SREV_VER_AR2424	0xa0
#define AR5K_SREV_VER_AR5424	0xa3
#define AR5K_SREV_VER_AR2413	0x78
#define AR5K_SREV_VER_AR2414	0x79
#define AR5K_SREV_VER_AR2424	0xa0 /* PCI-E */
#define AR5K_SREV_VER_AR5424	0xa3 /* PCI-E */
#define AR5K_SREV_VER_AR5413	0xa4
#define AR5K_SREV_VER_AR5414	0xa5
#define AR5K_SREV_VER_AR5416	0xc0	/* ? */
#define AR5K_SREV_VER_AR5418	0xca
#define AR5K_SREV_VER_AR5416	0xc0 /* PCI-E */
#define AR5K_SREV_VER_AR5418	0xca /* PCI-E */
#define AR5K_SREV_VER_AR2425	0xe2 /* PCI-E */

#define AR5K_SREV_RAD_5110	0x00
#define AR5K_SREV_RAD_5111	0x10
@@ -183,8 +187,9 @@ struct ath5k_srev_name {
#define AR5K_SREV_RAD_5112A	0x35
#define AR5K_SREV_RAD_2112	0x40
#define AR5K_SREV_RAD_2112A	0x45
#define AR5K_SREV_RAD_SC0	0x56	/* Found on 2413/2414 */
#define AR5K_SREV_RAD_SC1	0x63	/* Found on 5413/5414 */
#define AR5K_SREV_RAD_SC2	0xa2	/* Found on 2424/5424 */
#define AR5K_SREV_RAD_SC2	0xa2	/* Found on 2424-5/5424 */
#define AR5K_SREV_RAD_5133	0xc0	/* MIMO found on 5418 */

/* IEEE defs */
@@ -268,12 +273,13 @@ enum ath5k_driver_mode {
#define SHPREAMBLE_FLAG(_ix) \
	(HAS_SHPREAMBLE(_ix) ? AR5K_SET_SHORT_PREAMBLE : 0)


/****************\
  TX DEFINITIONS
\****************/

/*
 * Tx Descriptor
 * TX Status
 */
struct ath5k_tx_status {
	u16	ts_seqnum;
@@ -421,7 +427,7 @@ enum ath5k_dmasize {
\****************/

/*
 * Rx Descriptor
 * RX Status
 */
struct ath5k_rx_status {
	u16	rs_datalen;
@@ -452,8 +458,6 @@ struct ath5k_mib_stats {
};




/**************************\
 BEACON TIMERS DEFINITIONS
\**************************/
@@ -495,29 +499,23 @@ struct ath5k_beacon_state {
#define TSF_TO_TU(_tsf) (u32)((_tsf) >> 10)



/********************\
  COMMON DEFINITIONS
\********************/

/*
 * Atheros descriptor
 * Atheros hardware descriptor
 * This is read and written to by the hardware
 */
struct ath5k_desc {
	u32	ds_link;
	u32	ds_data;
	u32	ds_ctl0;
	u32	ds_ctl1;
	u32	ds_hw[4];
	u32	ds_link;	/* physical address of the next descriptor */
	u32	ds_data;	/* physical address of data buffer (skb) */

	union {
		struct ath5k_rx_status rx;
		struct ath5k_tx_status tx;
	} ds_us;

#define ds_rxstat ds_us.rx
#define ds_txstat ds_us.tx

		struct ath5k_hw_5210_tx_desc	ds_tx5210;
		struct ath5k_hw_5212_tx_desc	ds_tx5212;
		struct ath5k_hw_all_rx_desc	ds_rx;
	} ud;
} __packed;

#define AR5K_RXDESC_INTREQ	0x0020
@@ -961,6 +959,7 @@ struct ath5k_hw {
	u16			ah_phy_revision;
	u16			ah_radio_5ghz_revision;
	u16			ah_radio_2ghz_revision;
	u32			ah_phy_spending;

	enum ath5k_version	ah_version;
	enum ath5k_radio	ah_radio;
@@ -1036,8 +1035,10 @@ struct ath5k_hw {
	int (*ah_setup_xtx_desc)(struct ath5k_hw *, struct ath5k_desc *,
		unsigned int, unsigned int, unsigned int, unsigned int,
		unsigned int, unsigned int);
	int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *);
	int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *);
	int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *,
		struct ath5k_tx_status *);
	int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *,
		struct ath5k_rx_status *);
};

/*
+94 −53

File changed.

Preview size limit exceeded, changes collapsed.

+24 −13
Original line number Diff line number Diff line
@@ -200,7 +200,8 @@ static ssize_t read_file_tsf(struct file *file, char __user *user_buf,
{
	struct ath5k_softc *sc = file->private_data;
	char buf[100];
	snprintf(buf, sizeof(buf), "0x%016llx\n", ath5k_hw_get_tsf64(sc->ah));
	snprintf(buf, sizeof(buf), "0x%016llx\n",
		 (unsigned long long)ath5k_hw_get_tsf64(sc->ah));
	return simple_read_from_buffer(user_buf, count, ppos, buf, 19);
}

@@ -271,7 +272,8 @@ static ssize_t read_file_beacon(struct file *file, char __user *user_buf,

	tsf = ath5k_hw_get_tsf64(sc->ah);
	len += snprintf(buf+len, sizeof(buf)-len,
		"TSF\t\t0x%016llx\tTU: %08x\n", tsf, TSF_TO_TU(tsf));
		"TSF\t\t0x%016llx\tTU: %08x\n",
		(unsigned long long)tsf, TSF_TO_TU(tsf));

	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
@@ -497,15 +499,18 @@ ath5k_debug_dump_bands(struct ath5k_softc *sc)
}

static inline void
ath5k_debug_printrxbuf(struct ath5k_buf *bf, int done)
ath5k_debug_printrxbuf(struct ath5k_buf *bf, int done,
		       struct ath5k_rx_status *rs)
{
	struct ath5k_desc *ds = bf->desc;
	struct ath5k_hw_all_rx_desc *rd = &ds->ud.ds_rx;

	printk(KERN_DEBUG "R (%p %llx) %08x %08x %08x %08x %08x %08x %c\n",
		ds, (unsigned long long)bf->daddr,
		ds->ds_link, ds->ds_data, ds->ds_ctl0, ds->ds_ctl1,
		ds->ds_hw[0], ds->ds_hw[1],
		!done ? ' ' : (ds->ds_rxstat.rs_status == 0) ? '*' : '!');
		ds->ds_link, ds->ds_data,
		rd->rx_ctl.rx_control_0, rd->rx_ctl.rx_control_1,
		rd->u.rx_stat.rx_status_0, rd->u.rx_stat.rx_status_0,
		!done ? ' ' : (rs->rs_status == 0) ? '*' : '!');
}

void
@@ -513,6 +518,7 @@ ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah)
{
	struct ath5k_desc *ds;
	struct ath5k_buf *bf;
	struct ath5k_rx_status rs = {};
	int status;

	if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET)))
@@ -524,9 +530,9 @@ ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah)
	spin_lock_bh(&sc->rxbuflock);
	list_for_each_entry(bf, &sc->rxbuf, list) {
		ds = bf->desc;
		status = ah->ah_proc_rx_desc(ah, ds);
		status = ah->ah_proc_rx_desc(ah, ds, &rs);
		if (!status)
			ath5k_debug_printrxbuf(bf, status == 0);
			ath5k_debug_printrxbuf(bf, status == 0, &rs);
	}
	spin_unlock_bh(&sc->rxbuflock);
}
@@ -550,19 +556,24 @@ ath5k_debug_dump_skb(struct ath5k_softc *sc,
}

void
ath5k_debug_printtxbuf(struct ath5k_softc *sc,
			struct ath5k_buf *bf, int done)
ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf)
{
	struct ath5k_desc *ds = bf->desc;
	struct ath5k_hw_5212_tx_desc *td = &ds->ud.ds_tx5212;
	struct ath5k_tx_status ts = {};
	int done;

	if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET)))
		return;

	done = sc->ah->ah_proc_tx_desc(sc->ah, bf->desc, &ts);

	printk(KERN_DEBUG "T (%p %llx) %08x %08x %08x %08x %08x %08x %08x "
		"%08x %c\n", ds, (unsigned long long)bf->daddr, ds->ds_link,
		ds->ds_data, ds->ds_ctl0, ds->ds_ctl1,
		ds->ds_hw[0], ds->ds_hw[1], ds->ds_hw[2], ds->ds_hw[3],
		!done ? ' ' : (ds->ds_txstat.ts_status == 0) ? '*' : '!');
		ds->ds_data, td->tx_ctl.tx_control_0, td->tx_ctl.tx_control_1,
		td->tx_ctl.tx_control_2, td->tx_ctl.tx_control_3,
		td->tx_stat.tx_status_0, td->tx_stat.tx_status_1,
		done ? ' ' : (ts.ts_status == 0) ? '*' : '!');
}

#endif /* ifdef CONFIG_ATH5K_DEBUG */
Loading