提交 3002b7a3 编写于 作者: L Linus Torvalds

Merge tag 'staging-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver updates from Greg KH:
 "Here is the large set of staging driver changes for 6.1-rc1.

  Nothing really interesting in here at all except we deleted a driver
  (fwserial) as no one had been using it for a long time. Other than
  that, just the normal cleanups and minor fixes:

   - rtl8723bs driver cleanups

   - loads of r8188eu driver cleanups, making the driver smaller and
     fixing up some firmware dependency issues.

   - vt6655 driver cleanups.

   - lots of other small staging driver cleanups.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (266 commits)
  staging: rtl8192e: Rename variable Bandwidth to avoid CamelCase
  staging: r8188eu: remove PHY_RFConfig8188E()
  staging: r8188eu: remove PHY_RF6052_Config8188E()
  staging: r8188eu: convert ODM_ReadAndConfig_AGC_TAB_1T_8188E() to int
  staging: r8188eu: convert ODM_ReadAndConfig_PHY_REG_1T_8188E() to int
  staging: r8188eu: convert ODM_ReadAndConfig_RadioA_1T_8188E() to int
  staging: r8188eu: convert ODM_ReadAndConfig_MAC_REG_8188E() to int
  staging: rtl8192e: cmdpkt: Use skb_put_data() instead of skb_put/memcpy pair
  staging: r8188eu: Use skb_put_data() instead of skb_put/memcpy pair
  staging: r8188eu: remove hal/odm_RegConfig8188E.c
  staging: r8188eu: make odm_ConfigRF_RadioA_8188E() static
  staging: r8188eu: make odm_ConfigMAC_8188E() static
  staging: r8188eu: don't check for stop/removal in the blink worker
  staging: r8188eu: don't check bSurpriseRemoved in SwLedOff
  staging: rtl8192e: Remove unused variables ForcedAMSDUMaxSize, ...
  staging: rtl8192e: Rename CurrentMPDU..., ForcedAMPDU... and ForcedMPDU...
  staging: rtl8192e: Rename SelfMimoPs, CurrentOpMode and bForcedShortGI
  staging: rtl8192e: Rename PeerMimoPs, IOTAction and IOTRaFunc
  staging: rtl8192e: Rename RxRe...WinSize, RxReorder... and RxReorderDr...
  staging: rtl8192e: Rename szRT2RTAggBuffer, bRegRxRe... and bCurRxReo...
  ...
......@@ -60,8 +60,6 @@ source "drivers/staging/board/Kconfig"
source "drivers/staging/gdm724x/Kconfig"
source "drivers/staging/fwserial/Kconfig"
source "drivers/staging/clocking-wizard/Kconfig"
source "drivers/staging/fbtft/Kconfig"
......
......@@ -20,7 +20,6 @@ obj-$(CONFIG_USB_EMXX) += emxx_udc/
obj-$(CONFIG_MFD_NVEC) += nvec/
obj-$(CONFIG_STAGING_BOARD) += board/
obj-$(CONFIG_LTE_GDM724X) += gdm724x/
obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/
obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/
obj-$(CONFIG_FB_TFT) += fbtft/
obj-$(CONFIG_MOST) += most/
......
# SPDX-License-Identifier: GPL-2.0
config FIREWIRE_SERIAL
tristate "TTY over Firewire"
depends on FIREWIRE && TTY
help
This enables TTY over IEEE 1394, providing high-speed serial
connectivity to cabled peers. This driver implements a
ad-hoc transport protocol and is currently limited to
Linux-to-Linux communication.
To compile this driver as a module, say M here: the module will
be called firewire-serial.
if FIREWIRE_SERIAL
config FWTTY_MAX_TOTAL_PORTS
int "Maximum number of serial ports supported"
default "64"
help
Set this to the maximum number of serial ports you want the
firewire-serial driver to support.
config FWTTY_MAX_CARD_PORTS
int "Maximum number of serial ports supported per adapter"
range 0 FWTTY_MAX_TOTAL_PORTS
default "32"
help
Set this to the maximum number of serial ports each firewire
adapter supports. The actual number of serial ports registered
is set with the module parameter "ttys".
endif
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_FIREWIRE_SERIAL) += firewire-serial.o
firewire-serial-objs := fwserial.o dma_fifo.o
TODOs prior to this driver moving out of staging
------------------------------------------------
1. Implement retries for RCODE_BUSY, RCODE_NO_ACK and RCODE_SEND_ERROR
- I/O is handled asynchronously which presents some issues when error
conditions occur.
2. Implement _robust_ console on top of this. The existing prototype console
driver is not ready for the big leagues yet.
3. Expose means of controlling attach/detach of peers via sysfs. Include
GUID-to-port matching/whitelist/blacklist.
-- Issues with firewire stack --
1. This driver uses the same unregistered vendor id that the firewire core does
(0xd00d1e). Perhaps this could be exposed as a define in
firewire.h?
// SPDX-License-Identifier: GPL-2.0+
/*
* DMA-able FIFO implementation
*
* Copyright (C) 2012 Peter Hurley <peter@hurleysoftware.com>
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/bug.h>
#include "dma_fifo.h"
#ifdef DEBUG_TRACING
#define df_trace(s, args...) pr_debug(s, ##args)
#else
#define df_trace(s, args...)
#endif
#define FAIL(fifo, condition, format...) ({ \
fifo->corrupt = !!(condition); \
WARN(fifo->corrupt, format); \
})
/*
* private helper fn to determine if check is in open interval (lo,hi)
*/
static bool addr_check(unsigned int check, unsigned int lo, unsigned int hi)
{
return check - (lo + 1) < (hi - 1) - lo;
}
/**
* dma_fifo_init: initialize the fifo to a valid but inoperative state
* @fifo: address of in-place "struct dma_fifo" object
*/
void dma_fifo_init(struct dma_fifo *fifo)
{
memset(fifo, 0, sizeof(*fifo));
INIT_LIST_HEAD(&fifo->pending);
}
/**
* dma_fifo_alloc - initialize and allocate dma_fifo
* @fifo: address of in-place "struct dma_fifo" object
* @size: 'apparent' size, in bytes, of fifo
* @align: dma alignment to maintain (should be at least cpu cache alignment),
* must be power of 2
* @tx_limit: maximum # of bytes transmissible per dma (rounded down to
* multiple of alignment, but at least align size)
* @open_limit: maximum # of outstanding dma transactions allowed
* @gfp_mask: get_free_pages mask, passed to kmalloc()
*
* The 'apparent' size will be rounded up to next greater aligned size.
* Returns 0 if no error, otherwise an error code
*/
int dma_fifo_alloc(struct dma_fifo *fifo, int size, unsigned int align,
int tx_limit, int open_limit, gfp_t gfp_mask)
{
int capacity;
if (!is_power_of_2(align) || size < 0)
return -EINVAL;
size = round_up(size, align);
capacity = size + align * open_limit + align * DMA_FIFO_GUARD;
fifo->data = kmalloc(capacity, gfp_mask);
if (!fifo->data)
return -ENOMEM;
fifo->in = 0;
fifo->out = 0;
fifo->done = 0;
fifo->size = size;
fifo->avail = size;
fifo->align = align;
fifo->tx_limit = max_t(int, round_down(tx_limit, align), align);
fifo->open = 0;
fifo->open_limit = open_limit;
fifo->guard = size + align * open_limit;
fifo->capacity = capacity;
fifo->corrupt = 0;
return 0;
}
/**
* dma_fifo_free - frees the fifo
* @fifo: address of in-place "struct dma_fifo" to free
*
* Also reinits the fifo to a valid but inoperative state. This
* allows the fifo to be reused with a different target requiring
* different fifo parameters.
*/
void dma_fifo_free(struct dma_fifo *fifo)
{
struct dma_pending *pending, *next;
if (!fifo->data)
return;
list_for_each_entry_safe(pending, next, &fifo->pending, link)
list_del_init(&pending->link);
kfree(fifo->data);
fifo->data = NULL;
}
/**
* dma_fifo_reset - dumps the fifo contents and reinits for reuse
* @fifo: address of in-place "struct dma_fifo" to reset
*/
void dma_fifo_reset(struct dma_fifo *fifo)
{
struct dma_pending *pending, *next;
if (!fifo->data)
return;
list_for_each_entry_safe(pending, next, &fifo->pending, link)
list_del_init(&pending->link);
fifo->in = 0;
fifo->out = 0;
fifo->done = 0;
fifo->avail = fifo->size;
fifo->open = 0;
fifo->corrupt = 0;
}
/**
* dma_fifo_in - copies data into the fifo
* @fifo: address of in-place "struct dma_fifo" to write to
* @src: buffer to copy from
* @n: # of bytes to copy
*
* Returns the # of bytes actually copied, which can be less than requested if
* the fifo becomes full. If < 0, return is error code.
*/
int dma_fifo_in(struct dma_fifo *fifo, const void *src, int n)
{
int ofs, l;
if (!fifo->data)
return -ENOENT;
if (fifo->corrupt)
return -ENXIO;
if (n > fifo->avail)
n = fifo->avail;
if (n <= 0)
return 0;
ofs = fifo->in % fifo->capacity;
l = min(n, fifo->capacity - ofs);
memcpy(fifo->data + ofs, src, l);
memcpy(fifo->data, src + l, n - l);
if (FAIL(fifo, addr_check(fifo->done, fifo->in, fifo->in + n) ||
fifo->avail < n,
"fifo corrupt: in:%u out:%u done:%u n:%d avail:%d",
fifo->in, fifo->out, fifo->done, n, fifo->avail))
return -ENXIO;
fifo->in += n;
fifo->avail -= n;
df_trace("in:%u out:%u done:%u n:%d avail:%d", fifo->in, fifo->out,
fifo->done, n, fifo->avail);
return n;
}
/**
* dma_fifo_out_pend - gets address/len of next avail read and marks as pended
* @fifo: address of in-place "struct dma_fifo" to read from
* @pended: address of structure to fill with read address/len
* The data/len fields will be NULL/0 if no dma is pended.
*
* Returns the # of used bytes remaining in fifo (ie, if > 0, more data
* remains in the fifo that was not pended). If < 0, return is error code.
*/
int dma_fifo_out_pend(struct dma_fifo *fifo, struct dma_pending *pended)
{
unsigned int len, n, ofs, l, limit;
if (!fifo->data)
return -ENOENT;
if (fifo->corrupt)
return -ENXIO;
pended->len = 0;
pended->data = NULL;
pended->out = fifo->out;
len = fifo->in - fifo->out;
if (!len)
return -ENODATA;
if (fifo->open == fifo->open_limit)
return -EAGAIN;
n = len;
ofs = fifo->out % fifo->capacity;
l = fifo->capacity - ofs;
limit = min_t(unsigned int, l, fifo->tx_limit);
if (n > limit) {
n = limit;
fifo->out += limit;
} else if (ofs + n > fifo->guard) {
fifo->out += l;
fifo->in = fifo->out;
} else {
fifo->out += round_up(n, fifo->align);
fifo->in = fifo->out;
}
df_trace("in: %u out: %u done: %u n: %d len: %u avail: %d", fifo->in,
fifo->out, fifo->done, n, len, fifo->avail);
pended->len = n;
pended->data = fifo->data + ofs;
pended->next = fifo->out;
list_add_tail(&pended->link, &fifo->pending);
++fifo->open;
if (FAIL(fifo, fifo->open > fifo->open_limit,
"past open limit:%d (limit:%d)",
fifo->open, fifo->open_limit))
return -ENXIO;
if (FAIL(fifo, fifo->out & (fifo->align - 1),
"fifo out unaligned:%u (align:%u)",
fifo->out, fifo->align))
return -ENXIO;
return len - n;
}
/**
* dma_fifo_out_complete - marks pended dma as completed
* @fifo: address of in-place "struct dma_fifo" which was read from
* @complete: address of structure for previously pended dma to mark completed
*/
int dma_fifo_out_complete(struct dma_fifo *fifo, struct dma_pending *complete)
{
struct dma_pending *pending, *next, *tmp;
if (!fifo->data)
return -ENOENT;
if (fifo->corrupt)
return -ENXIO;
if (list_empty(&fifo->pending) && fifo->open == 0)
return -EINVAL;
if (FAIL(fifo, list_empty(&fifo->pending) != (fifo->open == 0),
"pending list disagrees with open count:%d",
fifo->open))
return -ENXIO;
tmp = complete->data;
*tmp = *complete;
list_replace(&complete->link, &tmp->link);
dp_mark_completed(tmp);
/* Only update the fifo in the original pended order */
list_for_each_entry_safe(pending, next, &fifo->pending, link) {
if (!dp_is_completed(pending)) {
df_trace("still pending: saved out: %u len: %d",
pending->out, pending->len);
break;
}
if (FAIL(fifo, pending->out != fifo->done ||
addr_check(fifo->in, fifo->done, pending->next),
"in:%u out:%u done:%u saved:%u next:%u",
fifo->in, fifo->out, fifo->done, pending->out,
pending->next))
return -ENXIO;
list_del_init(&pending->link);
fifo->done = pending->next;
fifo->avail += pending->len;
--fifo->open;
df_trace("in: %u out: %u done: %u len: %u avail: %d", fifo->in,
fifo->out, fifo->done, pending->len, fifo->avail);
}
if (FAIL(fifo, fifo->open < 0, "open dma:%d < 0", fifo->open))
return -ENXIO;
if (FAIL(fifo, fifo->avail > fifo->size, "fifo avail:%d > size:%d",
fifo->avail, fifo->size))
return -ENXIO;
return 0;
}
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* DMA-able FIFO interface
*
* Copyright (C) 2012 Peter Hurley <peter@hurleysoftware.com>
*/
#ifndef _DMA_FIFO_H_
#define _DMA_FIFO_H_
/**
* The design basis for the DMA FIFO is to provide an output side that
* complies with the streaming DMA API design that can be DMA'd from directly
* (without additional copying), coupled with an input side that maintains a
* logically consistent 'apparent' size (ie, bytes in + bytes avail is static
* for the lifetime of the FIFO).
*
* DMA output transactions originate on a cache line boundary and can be
* variably-sized. DMA output transactions can be retired out-of-order but
* the FIFO will only advance the output in the original input sequence.
* This means the FIFO will eventually stall if a transaction is never retired.
*
* Chunking the output side into cache line multiples means that some FIFO
* memory is unused. For example, if all the avail input has been pended out,
* then the in and out markers are re-aligned to the next cache line.
* The maximum possible waste is
* (cache line alignment - 1) * (max outstanding dma transactions)
* This potential waste requires additional hidden capacity within the FIFO
* to be able to accept input while the 'apparent' size has not been reached.
*
* Additional cache lines (ie, guard area) are used to minimize DMA
* fragmentation when wrapping at the end of the FIFO. Input is allowed into the
* guard area, but the in and out FIFO markers are wrapped when DMA is pended.
*/
#define DMA_FIFO_GUARD 3 /* # of cache lines to reserve for the guard area */
struct dma_fifo {
unsigned int in;
unsigned int out; /* updated when dma is pended */
unsigned int done; /* updated upon dma completion */
struct {
unsigned corrupt:1;
};
int size; /* 'apparent' size of fifo */
int guard; /* ofs of guard area */
int capacity; /* size + reserved */
int avail; /* # of unused bytes in fifo */
unsigned int align; /* must be power of 2 */
int tx_limit; /* max # of bytes per dma transaction */
int open_limit; /* max # of outstanding allowed */
int open; /* # of outstanding dma transactions */
struct list_head pending; /* fifo markers for outstanding dma */
void *data;
};
struct dma_pending {
struct list_head link;
void *data;
unsigned int len;
unsigned int next;
unsigned int out;
};
static inline void dp_mark_completed(struct dma_pending *dp)
{
dp->data += 1;
}
static inline bool dp_is_completed(struct dma_pending *dp)
{
return (unsigned long)dp->data & 1UL;
}
void dma_fifo_init(struct dma_fifo *fifo);
int dma_fifo_alloc(struct dma_fifo *fifo, int size, unsigned int align,
int tx_limit, int open_limit, gfp_t gfp_mask);
void dma_fifo_free(struct dma_fifo *fifo);
void dma_fifo_reset(struct dma_fifo *fifo);
int dma_fifo_in(struct dma_fifo *fifo, const void *src, int n);
int dma_fifo_out_pend(struct dma_fifo *fifo, struct dma_pending *pended);
int dma_fifo_out_complete(struct dma_fifo *fifo,
struct dma_pending *complete);
/* returns the # of used bytes in the fifo */
static inline int dma_fifo_level(struct dma_fifo *fifo)
{
return fifo->size - fifo->avail;
}
/* returns the # of bytes ready for output in the fifo */
static inline int dma_fifo_out_level(struct dma_fifo *fifo)
{
return fifo->in - fifo->out;
}
/* returns the # of unused bytes in the fifo */
static inline int dma_fifo_avail(struct dma_fifo *fifo)
{
return fifo->avail;
}
/* returns true if fifo has max # of outstanding dmas */
static inline bool dma_fifo_busy(struct dma_fifo *fifo)
{
return fifo->open == fifo->open_limit;
}
/* changes the max size of dma returned from dma_fifo_out_pend() */
static inline int dma_fifo_change_tx_limit(struct dma_fifo *fifo, int tx_limit)
{
tx_limit = round_down(tx_limit, fifo->align);
fifo->tx_limit = max_t(int, tx_limit, fifo->align);
return 0;
}
#endif /* _DMA_FIFO_H_ */
此差异已折叠。
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _FIREWIRE_FWSERIAL_H
#define _FIREWIRE_FWSERIAL_H
#include <linux/kernel.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/list.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <linux/spinlock.h>
#include <linux/rcupdate.h>
#include <linux/mutex.h>
#include <linux/serial.h>
#include <linux/serial_reg.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include "dma_fifo.h"
#ifdef FWTTY_PROFILING
#define DISTRIBUTION_MAX_SIZE 8192
#define DISTRIBUTION_MAX_INDEX (ilog2(DISTRIBUTION_MAX_SIZE) + 1)
static inline void fwtty_profile_data(unsigned int stat[], unsigned int val)
{
int n = (val) ? min(ilog2(val) + 1, DISTRIBUTION_MAX_INDEX) : 0;
++stat[n];
}
#else
#define DISTRIBUTION_MAX_INDEX 0
#define fwtty_profile_data(st, n)
#endif
/* Parameters for both VIRT_CABLE_PLUG & VIRT_CABLE_PLUG_RSP mgmt codes */
struct virt_plug_params {
__be32 status_hi;
__be32 status_lo;
__be32 fifo_hi;
__be32 fifo_lo;
__be32 fifo_len;
};
struct peer_work_params {
union {
struct virt_plug_params plug_req;
};
};
/**
* fwtty_peer: structure representing local & remote unit devices
* @unit: unit child device of fw_device node
* @serial: back pointer to associated fw_serial aggregate
* @guid: unique 64-bit guid for this unit device
* @generation: most recent bus generation
* @node_id: most recent node_id
* @speed: link speed of peer (0 = S100, 2 = S400, ... 5 = S3200)
* @mgmt_addr: bus addr region to write mgmt packets to
* @status_addr: bus addr register to write line status to
* @fifo_addr: bus addr region to write serial output to
* @fifo_len: max length for single write to fifo_addr
* @list: link for insertion into fw_serial's peer_list
* @rcu: for deferring peer reclamation
* @lock: spinlock to synchonize changes to state & port fields
* @work: only one work item can be queued at any one time
* Note: pending work is canceled prior to removal, so this
* peer is valid for at least the lifetime of the work function
* @work_params: parameter block for work functions
* @timer: timer for resetting peer state if remote request times out
* @state: current state
* @connect: work item for auto-connecting
* @connect_retries: # of connections already attempted
* @port: associated tty_port (usable if state == FWSC_ATTACHED)
*/
struct fwtty_peer {
struct fw_unit *unit;
struct fw_serial *serial;
u64 guid;
int generation;
int node_id;
unsigned int speed;
int max_payload;
u64 mgmt_addr;
/* these are usable only if state == FWSC_ATTACHED */
u64 status_addr;
u64 fifo_addr;
int fifo_len;
struct list_head list;
struct rcu_head rcu;
spinlock_t lock;
work_func_t workfn;
struct work_struct work;
struct peer_work_params work_params;
struct timer_list timer;
int state;
struct delayed_work connect;
int connect_retries;
struct fwtty_port *port;
};
#define to_peer(ptr, field) (container_of(ptr, struct fwtty_peer, field))
/* state values for fwtty_peer.state field */
enum fwtty_peer_state {
FWPS_GONE,
FWPS_NOT_ATTACHED,
FWPS_ATTACHED,
FWPS_PLUG_PENDING,
FWPS_PLUG_RESPONDING,
FWPS_UNPLUG_PENDING,
FWPS_UNPLUG_RESPONDING,
FWPS_NO_MGMT_ADDR = -1,
};
#define CONNECT_RETRY_DELAY HZ
#define MAX_CONNECT_RETRIES 10
/* must be holding peer lock for these state funclets */
static inline void peer_set_state(struct fwtty_peer *peer, int new)
{
peer->state = new;
}
static inline struct fwtty_port *peer_revert_state(struct fwtty_peer *peer)
{
struct fwtty_port *port = peer->port;
peer->port = NULL;
peer_set_state(peer, FWPS_NOT_ATTACHED);
return port;
}
struct fwserial_mgmt_pkt {
struct {
__be16 len;
__be16 code;
} hdr;
union {
struct virt_plug_params plug_req;
struct virt_plug_params plug_rsp;
};
} __packed;
/* fwserial_mgmt_packet codes */
#define FWSC_RSP_OK 0x0000
#define FWSC_RSP_NACK 0x8000
#define FWSC_CODE_MASK 0x0fff
#define FWSC_VIRT_CABLE_PLUG 1
#define FWSC_VIRT_CABLE_UNPLUG 2
#define FWSC_VIRT_CABLE_PLUG_RSP 3
#define FWSC_VIRT_CABLE_UNPLUG_RSP 4
/* 1 min. plug timeout -- suitable for userland authorization */
#define VIRT_CABLE_PLUG_TIMEOUT (60 * HZ)
struct stats {
unsigned int xchars;
unsigned int dropped;
unsigned int tx_stall;
unsigned int fifo_errs;
unsigned int sent;
unsigned int lost;
unsigned int throttled;
unsigned int reads[DISTRIBUTION_MAX_INDEX + 1];
unsigned int writes[DISTRIBUTION_MAX_INDEX + 1];
unsigned int txns[DISTRIBUTION_MAX_INDEX + 1];
unsigned int unthrottle[DISTRIBUTION_MAX_INDEX + 1];
};
struct fwconsole_ops {
void (*notify)(int code, void *data);
void (*stats)(struct stats *stats, void *data);
void (*proc_show)(struct seq_file *m, void *data);
};
/* codes for console ops notify */
#define FWCON_NOTIFY_ATTACH 1
#define FWCON_NOTIFY_DETACH 2
/**
* fwtty_port: structure used to track/represent underlying tty_port
* @port: underlying tty_port
* @device: tty device
* @index: index into port_table for this particular port
* note: minor = index + minor_start assigned by tty_alloc_driver()
* @serial: back pointer to the containing fw_serial
* @rx_handler: bus address handler for unique addr region used by remotes
* to communicate with this port. Every port uses
* fwtty_port_handler() for per port transactions.
* @fwcon_ops: ops for attached fw_console (if any)
* @con_data: private data for fw_console
* @wait_tx: waitqueue for sleeping until writer/drain completes tx
* @emit_breaks: delayed work responsible for generating breaks when the
* break line status is active
* @cps : characters per second computed from the termios settings
* @break_last: timestamp in jiffies from last emit_breaks
* @hangup: work responsible for HUPing when carrier is dropped/lost
* @mstatus: loose virtualization of LSR/MSR
* bits 15..0 correspond to TIOCM_* bits
* bits 19..16 reserved for mctrl
* bit 20 OOB_TX_THROTTLE
* bits 23..21 reserved
* bits 31..24 correspond to UART_LSR_* bits
* @lock: spinlock for protecting concurrent access to fields below it
* @mctrl: loose virtualization of MCR
* bits 15..0 correspond to TIOCM_* bits
* bit 16 OOB_RX_THROTTLE
* bits 19..17 reserved
* bits 31..20 reserved for mstatus
* @drain: delayed work scheduled to ensure that writes are flushed.
* The work can race with the writer but concurrent sending is
* prevented with the IN_TX flag. Scheduled under lock to
* limit scheduling when fifo has just been drained.
* @tx_fifo: fifo used to store & block-up writes for dma to remote
* @max_payload: max bytes transmissible per dma (based on peer's max_payload)
* @status_mask: UART_LSR_* bitmask significant to rx (based on termios)
* @ignore_mask: UART_LSR_* bitmask of states to ignore (also based on termios)
* @break_ctl: if set, port is 'sending break' to remote
* @write_only: self-explanatory
* @overrun: previous rx was lost (partially or completely)
* @loopback: if set, port is in loopback mode
* @flags: atomic bit flags
* bit 0: IN_TX - gate to allow only one cpu to send from the dma fifo
* at a time.
* bit 1: STOP_TX - force tx to exit while sending
* @peer: rcu-pointer to associated fwtty_peer (if attached)
* NULL if no peer attached
* @icount: predefined statistics reported by the TIOCGICOUNT ioctl
* @stats: additional statistics reported in /proc/tty/driver/firewire_serial
*/
struct fwtty_port {
struct tty_port port;
struct device *device;
unsigned int index;
struct fw_serial *serial;
struct fw_address_handler rx_handler;
struct fwconsole_ops *fwcon_ops;
void *con_data;
wait_queue_head_t wait_tx;
struct delayed_work emit_breaks;
unsigned int cps;
unsigned long break_last;
struct work_struct hangup;
unsigned int mstatus;
spinlock_t lock;
unsigned int mctrl;
struct delayed_work drain;
struct dma_fifo tx_fifo;
int max_payload;
unsigned int status_mask;
unsigned int ignore_mask;
unsigned int break_ctl:1,
write_only:1,
overrun:1,
loopback:1;
unsigned long flags;
struct fwtty_peer __rcu *peer;
struct async_icount icount;
struct stats stats;
};
#define to_port(ptr, field) (container_of(ptr, struct fwtty_port, field))
/* bit #s for flags field */
#define IN_TX 0
#define STOP_TX 1
/* bitmasks for special mctrl/mstatus bits */
#define OOB_RX_THROTTLE 0x00010000
#define MCTRL_RSRVD 0x000e0000
#define OOB_TX_THROTTLE 0x00100000
#define MSTATUS_RSRVD 0x00e00000
#define MCTRL_MASK (TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 | TIOCM_OUT2 | \
TIOCM_LOOP | OOB_RX_THROTTLE | MCTRL_RSRVD)
/* XXX even every 1/50th secs. may be unnecessarily accurate */
/* delay in jiffies between brk emits */
#define FREQ_BREAKS (HZ / 50)
/* Ports are allocated in blocks of num_ports for each fw_card */
#define MAX_CARD_PORTS CONFIG_FWTTY_MAX_CARD_PORTS
#define MAX_TOTAL_PORTS CONFIG_FWTTY_MAX_TOTAL_PORTS
/* tuning parameters */
#define FWTTY_PORT_TXFIFO_LEN 4096
#define FWTTY_PORT_MAX_PEND_DMA 8 /* costs a cache line per pend */
#define DRAIN_THRESHOLD 1024
#define MAX_ASYNC_PAYLOAD 4096 /* ohci-defined limit */
#define WRITER_MINIMUM 128
/* TODO: how to set watermark to AR context size? see fwtty_rx() */
#define HIGH_WATERMARK 32768 /* AR context is 32K */
/*
* Size of bus addr region above 4GB used per port as the recv addr
* - must be at least as big as the MAX_ASYNC_PAYLOAD
*/
#define FWTTY_PORT_RXFIFO_LEN MAX_ASYNC_PAYLOAD
/**
* fw_serial: aggregate used to associate tty ports with specific fw_card
* @card: fw_card associated with this fw_serial device (1:1 association)
* @kref: reference-counted multi-port management allows delayed destroy
* @self: local unit device as 'peer'. Not valid until local unit device
* is enumerated.
* @list: link for insertion into fwserial_list
* @peer_list: list of local & remote unit devices attached to this card
* @ports: fixed array of tty_ports provided by this serial device
*/
struct fw_serial {
struct fw_card *card;
struct kref kref;
struct dentry *debugfs;
struct fwtty_peer *self;
struct list_head list;
struct list_head peer_list;
struct fwtty_port *ports[MAX_CARD_PORTS];
};
#define to_serial(ptr, field) (container_of(ptr, struct fw_serial, field))
#define TTY_DEV_NAME "fwtty" /* ttyFW was taken */
static const char tty_dev_name[] = TTY_DEV_NAME;
static const char loop_dev_name[] = "fwloop";
extern struct tty_driver *fwtty_driver;
/*
* Returns the max send async payload size in bytes based on the unit device
* link speed. Self-limiting asynchronous bandwidth (via reducing the payload)
* is not necessary and does not work, because
* 1) asynchronous traffic will absorb all available bandwidth (less that
* being used for isochronous traffic)
* 2) isochronous arbitration always wins.
*/
static inline int link_speed_to_max_payload(unsigned int speed)
{
/* Max async payload is 4096 - see IEEE 1394-2008 tables 6-4, 16-18 */
return min(512 << speed, 4096);
}
#endif /* _FIREWIRE_FWSERIAL_H */
......@@ -3,7 +3,6 @@
* Greybus Audio Sound SoC helper APIs
*/
#include <linux/debugfs.h>
#include <sound/core.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
......@@ -116,10 +115,6 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm,
{
int i;
struct snd_soc_dapm_widget *w, *tmp_w;
#ifdef CONFIG_DEBUG_FS
struct dentry *parent = dapm->debugfs_dapm;
struct dentry *debugfs_w = NULL;
#endif
mutex_lock(&dapm->card->dapm_mutex);
for (i = 0; i < num; i++) {
......@@ -139,12 +134,6 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm,
continue;
}
widget++;
#ifdef CONFIG_DEBUG_FS
if (!parent)
debugfs_w = debugfs_lookup(w->name, parent);
debugfs_remove(debugfs_w);
debugfs_w = NULL;
#endif
gbaudio_dapm_free_widget(w);
}
mutex_unlock(&dapm->card->dapm_mutex);
......
......@@ -125,7 +125,7 @@ static void cvm_oct_free_tx_skbs(struct net_device *dev)
*
* Returns Always returns NETDEV_TX_OK
*/
int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
netdev_tx_t cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
{
union cvmx_pko_command_word0 pko_command;
union cvmx_buf_ptr hw_buffer;
......@@ -506,7 +506,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
* @dev: Device info structure
* Returns Always returns zero
*/
int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
netdev_tx_t cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
{
struct octeon_ethernet *priv = netdev_priv(dev);
void *packet_buffer;
......
......@@ -5,8 +5,8 @@
* Copyright (c) 2003-2007 Cavium Networks
*/
int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev);
int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev);
netdev_tx_t cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev);
netdev_tx_t cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev);
int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
int do_free, int qos);
void cvm_oct_tx_initialize(void);
......
......@@ -1149,19 +1149,7 @@ static int pi433_debugfs_regs_show(struct seq_file *m, void *p)
return ret;
}
static int pi433_debugfs_regs_open(struct inode *inode, struct file *filp)
{
return single_open(filp, pi433_debugfs_regs_show, inode->i_private);
}
static const struct file_operations debugfs_fops = {
.llseek = seq_lseek,
.open = pi433_debugfs_regs_open,
.owner = THIS_MODULE,
.read = seq_read,
.release = single_release
};
DEFINE_SHOW_ATTRIBUTE(pi433_debugfs_regs);
/*-------------------------------------------------------------------------*/
......@@ -1320,7 +1308,7 @@ static int pi433_probe(struct spi_device *spi)
entry = debugfs_create_dir(dev_name(device->dev),
debugfs_lookup(KBUILD_MODNAME, NULL));
debugfs_create_file("regs", 0400, entry, device, &debugfs_fops);
debugfs_create_file("regs", 0400, entry, device, &pi433_debugfs_regs_fops);
return 0;
......
......@@ -816,7 +816,7 @@ int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size)
if (size > FIFO_SIZE) {
dev_dbg(&spi->dev,
"read fifo: passed in buffer bigger then internal buffer\n");
"write fifo: passed in buffer bigger then internal buffer\n");
return -EMSGSIZE;
}
......
......@@ -10,7 +10,6 @@ r8188eu-y = \
hal/hal_com.o \
hal/odm.o \
hal/odm_HWConfig.o \
hal/odm_RegConfig8188E.o \
hal/odm_RTL8188E.o \
hal/rtl8188e_cmd.o \
hal/rtl8188e_dm.o \
......@@ -18,19 +17,14 @@ r8188eu-y = \
hal/rtl8188e_phycfg.o \
hal/rtl8188e_rf6052.o \
hal/rtl8188e_rxdesc.o \
hal/rtl8188e_xmit.o \
hal/rtl8188eu_recv.o \
hal/rtl8188eu_xmit.o \
hal/usb_halinit.o \
hal/usb_ops_linux.o \
os_dep/ioctl_linux.o \
os_dep/mlme_linux.o \
os_dep/os_intfs.o \
os_dep/osdep_service.o \
os_dep/recv_linux.o \
os_dep/usb_intf.o \
os_dep/usb_ops_linux.o \
os_dep/xmit_linux.o \
core/rtw_ap.o \
core/rtw_br_ext.o \
core/rtw_cmd.o \
......
......@@ -935,6 +935,48 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
return beacon_updated;
}
void rtw_indicate_sta_assoc_event(struct adapter *padapter, struct sta_info *psta)
{
union iwreq_data wrqu;
struct sta_priv *pstapriv = &padapter->stapriv;
if (!psta)
return;
if (psta->aid > NUM_STA)
return;
if (pstapriv->sta_aid[psta->aid - 1] != psta)
return;
wrqu.addr.sa_family = ARPHRD_ETHER;
memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN);
wireless_send_event(padapter->pnetdev, IWEVREGISTERED, &wrqu, NULL);
}
static void rtw_indicate_sta_disassoc_event(struct adapter *padapter, struct sta_info *psta)
{
union iwreq_data wrqu;
struct sta_priv *pstapriv = &padapter->stapriv;
if (!psta)
return;
if (psta->aid > NUM_STA)
return;
if (pstapriv->sta_aid[psta->aid - 1] != psta)
return;
wrqu.addr.sa_family = ARPHRD_ETHER;
memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN);
wireless_send_event(padapter->pnetdev, IWEVEXPIRED, &wrqu, NULL);
}
u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
bool active, u16 reason)
{
......
......@@ -12,7 +12,6 @@
#include "../include/drv_types.h"
#include "../include/rtw_br_ext.h"
#include "../include/usb_osintf.h"
#include "../include/recv_osdep.h"
#ifndef csum_ipv6_magic
#include "../include/net/ip6_checksum.h"
......
......@@ -5,8 +5,6 @@
#include "../include/osdep_service.h"
#include "../include/drv_types.h"
#include "../include/recv_osdep.h"
#include "../include/mlme_osdep.h"
#include "../include/rtw_br_ext.h"
#include "../include/rtw_mlme_ext.h"
#include "../include/rtl8188e_dm.h"
......@@ -58,8 +56,6 @@ static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
{
u32 res = _SUCCESS;
init_completion(&pcmdpriv->enqueue_cmd);
/* sema_init(&(pcmdpriv->cmd_done_sema), 0); */
init_completion(&pcmdpriv->start_cmd_thread);
......@@ -74,27 +70,24 @@ u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ,
GFP_KERNEL);
if (!pcmdpriv->cmd_allocated_buf) {
res = _FAIL;
goto exit;
}
if (!pcmdpriv->cmd_allocated_buf)
return _FAIL;
pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((size_t)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ - 1));
pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_KERNEL);
if (!pcmdpriv->rsp_allocated_buf) {
res = _FAIL;
goto exit;
kfree(pcmdpriv->cmd_allocated_buf);
return _FAIL;
}
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((size_t)(pcmdpriv->rsp_allocated_buf) & 3);
pcmdpriv->cmd_done_cnt = 0;
pcmdpriv->rsp_cnt = 0;
exit:
return res;
return _SUCCESS;
}
u32 rtw_init_evt_priv(struct evt_priv *pevtpriv)
......@@ -288,8 +281,7 @@ int rtw_cmd_thread(void *context)
* ### NOTE:#### (!!!!)
* MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock
*/
u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, int ssid_num,
struct rtw_ieee80211_channel *ch, int ch_num)
u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, int ssid_num)
{
u8 res = _FAIL;
struct cmd_obj *ph2c;
......@@ -331,17 +323,6 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid,
}
}
/* prepare channel list */
if (ch) {
int i;
for (i = 0; i < ch_num && i < RTW_CHANNEL_SCAN_AMOUNT; i++) {
if (ch[i].hw_value && !(ch[i].flags & RTW_IEEE80211_CHAN_DISABLED)) {
memcpy(&psurveyPara->ch[i], &ch[i], sizeof(struct rtw_ieee80211_channel));
psurveyPara->ch_num++;
}
}
}
set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
......@@ -1290,6 +1271,66 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
return res;
}
/* C2H event format:
* Field TRIGGER CONTENT CMD_SEQ CMD_LEN CMD_ID
* BITS [127:120] [119:16] [15:8] [7:4] [3:0]
*/
static s32 c2h_evt_read(struct adapter *adapter, u8 *buf)
{
s32 ret = _FAIL;
struct c2h_evt_hdr *c2h_evt;
int i;
u8 trigger;
if (!buf)
goto exit;
ret = rtw_read8(adapter, REG_C2HEVT_CLEAR, &trigger);
if (ret)
return _FAIL;
if (trigger == C2H_EVT_HOST_CLOSE)
goto exit; /* Not ready */
else if (trigger != C2H_EVT_FW_CLOSE)
goto clear_evt; /* Not a valid value */
c2h_evt = (struct c2h_evt_hdr *)buf;
memset(c2h_evt, 0, 16);
ret = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL, buf);
if (ret) {
ret = _FAIL;
goto clear_evt;
}
ret = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + 1, buf + 1);
if (ret) {
ret = _FAIL;
goto clear_evt;
}
/* Read the content */
for (i = 0; i < c2h_evt->plen; i++) {
ret = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL +
sizeof(*c2h_evt) + i, c2h_evt->payload + i);
if (ret) {
ret = _FAIL;
goto clear_evt;
}
}
ret = _SUCCESS;
clear_evt:
/* Clear event to notify FW we have read the command.
* If this field isn't clear, the FW won't update the next
* command message.
*/
rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE);
exit:
return ret;
}
static void c2h_evt_hdl(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt, c2h_id_filter filter)
{
u8 buf[16];
......
......@@ -236,7 +236,7 @@ static int load_firmware(struct rt_firmware *rtfw, struct device *device)
{
int ret = _SUCCESS;
const struct firmware *fw;
const char *fw_name = "rtlwifi/rtl8188eufw.bin";
const char *fw_name = FW_RTL8188EU;
int err = request_firmware(&fw, fw_name, device);
if (err) {
......
......@@ -11,8 +11,6 @@
#include "../include/usb_osintf.h"
#include "../include/usb_ops.h"
extern void indicate_wx_scan_complete_event(struct adapter *padapter);
u8 rtw_do_join(struct adapter *padapter)
{
struct list_head *plist, *phead;
......@@ -43,7 +41,7 @@ u8 rtw_do_join(struct adapter *padapter)
if (!pmlmepriv->LinkDetectInfo.bBusyTraffic ||
pmlmepriv->to_roaming > 0) {
/* submit site_survey_cmd */
ret = rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0);
ret = rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1);
if (ret != _SUCCESS)
pmlmepriv->to_join = false;
} else {
......@@ -89,7 +87,7 @@ u8 rtw_do_join(struct adapter *padapter)
/* we try to issue sitesurvey firstly */
if (!pmlmepriv->LinkDetectInfo.bBusyTraffic ||
pmlmepriv->to_roaming > 0) {
ret = rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0);
ret = rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1);
if (ret != _SUCCESS)
pmlmepriv->to_join = false;
} else {
......@@ -353,14 +351,9 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s
/* Scan or linking is in progress, do nothing. */
res = true;
} else {
if (rtw_is_scan_deny(padapter)) {
indicate_wx_scan_complete_event(padapter);
return _SUCCESS;
}
spin_lock_bh(&pmlmepriv->lock);
res = rtw_sitesurvey_cmd(padapter, pssid, ssid_max_num, NULL, 0);
res = rtw_sitesurvey_cmd(padapter, pssid, ssid_max_num);
spin_unlock_bh(&pmlmepriv->lock);
}
......
......@@ -25,9 +25,7 @@ static void ResetLedStatus(struct led_priv *pLed)
pLed->bLedWPSBlinkInProgress = false;
pLed->BlinkTimes = 0; /* Number of times to toggle led state for blinking. */
pLed->BlinkingLedState = LED_UNKNOWN; /* Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. */
pLed->bLedNoLinkBlinkInProgress = false;
pLed->bLedLinkBlinkInProgress = false;
pLed->bLedScanBlinkInProgress = false;
}
......@@ -37,7 +35,7 @@ static void SwLedOn(struct adapter *padapter, struct led_priv *pLed)
u8 LedCfg;
int res;
if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
if (padapter->bDriverStopped)
return;
res = rtw_read8(padapter, REG_LEDCFG2, &LedCfg);
......@@ -53,7 +51,7 @@ static void SwLedOff(struct adapter *padapter, struct led_priv *pLed)
u8 LedCfg;
int res;
if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
if (padapter->bDriverStopped)
goto exit;
res = rtw_read8(padapter, REG_LEDCFG2, &LedCfg);/* 0x4E */
......@@ -79,41 +77,25 @@ static void blink_work(struct work_struct *work)
struct adapter *padapter = pLed->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped))
return;
if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) {
SwLedOff(padapter, pLed);
ResetLedStatus(pLed);
return;
}
/* Change LED according to BlinkingLedState specified. */
if (pLed->BlinkingLedState == RTW_LED_ON)
SwLedOn(padapter, pLed);
else
if (pLed->bLedOn)
SwLedOff(padapter, pLed);
else
SwLedOn(padapter, pLed);
switch (pLed->CurrLedState) {
case LED_BLINK_SLOWLY:
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
break;
case LED_BLINK_NORMAL:
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
break;
case LED_BLINK_SCAN:
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
pLed->BlinkTimes--;
if (pLed->BlinkTimes == 0) {
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
......@@ -121,7 +103,6 @@ static void blink_work(struct work_struct *work)
pLed->CurrLedState = LED_BLINK_NORMAL;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
} else {
pLed->bLedNoLinkBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_SLOWLY;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
}
......@@ -131,10 +112,6 @@ static void blink_work(struct work_struct *work)
}
break;
case LED_BLINK_TXRX:
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
pLed->BlinkTimes--;
if (pLed->BlinkTimes == 0) {
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
......@@ -142,7 +119,6 @@ static void blink_work(struct work_struct *work)
pLed->CurrLedState = LED_BLINK_NORMAL;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
} else {
pLed->bLedNoLinkBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_SLOWLY;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
}
......@@ -152,25 +128,16 @@ static void blink_work(struct work_struct *work)
}
break;
case LED_BLINK_WPS:
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
break;
case LED_BLINK_WPS_STOP: /* WPS success */
if (pLed->BlinkingLedState != RTW_LED_ON) {
if (!pLed->bLedOn) {
pLed->bLedLinkBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_NORMAL;
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
pLed->bLedWPSBlinkInProgress = false;
} else {
pLed->BlinkingLedState = RTW_LED_OFF;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_WPS_SUCESS_INTVL);
}
break;
......@@ -217,192 +184,110 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
switch (LedAction) {
case LED_CTL_START_TO_LINK:
case LED_CTL_NO_LINK:
if (!pLed->bLedNoLinkBlinkInProgress) {
if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
return;
if (pLed->bLedLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
}
if (pLed->bLedBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedBlinkInProgress = false;
}
if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
return;
pLed->bLedNoLinkBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_SLOWLY;
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
}
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
pLed->bLedBlinkInProgress = false;
pLed->CurrLedState = LED_BLINK_SLOWLY;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
break;
case LED_CTL_LINK:
if (!pLed->bLedLinkBlinkInProgress) {
if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
return;
if (pLed->bLedNoLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedNoLinkBlinkInProgress = false;
}
if (pLed->bLedBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedBlinkInProgress = false;
}
pLed->bLedLinkBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_NORMAL;
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
}
if (!pLed->bLedLinkBlinkInProgress)
return;
if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
return;
cancel_delayed_work(&pLed->blink_work);
pLed->bLedBlinkInProgress = false;
pLed->bLedLinkBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_NORMAL;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
break;
case LED_CTL_SITE_SURVEY:
if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED))) {
;
} else if (!pLed->bLedScanBlinkInProgress) {
if (IS_LED_WPS_BLINKING(pLed))
return;
if (pLed->bLedNoLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedNoLinkBlinkInProgress = false;
}
if (pLed->bLedLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
}
if (pLed->bLedBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedBlinkInProgress = false;
}
pLed->bLedScanBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_SCAN;
pLed->BlinkTimes = 24;
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
}
if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)))
return;
if (pLed->bLedScanBlinkInProgress)
return;
if (IS_LED_WPS_BLINKING(pLed))
return;
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
pLed->bLedBlinkInProgress = false;
pLed->bLedScanBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_SCAN;
pLed->BlinkTimes = 24;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
break;
case LED_CTL_TX:
case LED_CTL_RX:
if (!pLed->bLedBlinkInProgress) {
if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
return;
if (pLed->bLedNoLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedNoLinkBlinkInProgress = false;
}
if (pLed->bLedLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
}
pLed->bLedBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_TXRX;
pLed->BlinkTimes = 2;
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_FASTER_INTVL);
}
if (pLed->bLedBlinkInProgress)
return;
if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
return;
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
pLed->bLedBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_TXRX;
pLed->BlinkTimes = 2;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_FASTER_INTVL);
break;
case LED_CTL_START_WPS: /* wait until xinpin finish */
if (!pLed->bLedWPSBlinkInProgress) {
if (pLed->bLedNoLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedNoLinkBlinkInProgress = false;
}
if (pLed->bLedLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
}
if (pLed->bLedBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedBlinkInProgress = false;
}
if (pLed->bLedScanBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedScanBlinkInProgress = false;
}
pLed->bLedWPSBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_WPS;
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
}
if (pLed->bLedWPSBlinkInProgress)
return;
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
pLed->bLedBlinkInProgress = false;
pLed->bLedScanBlinkInProgress = false;
pLed->bLedWPSBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_WPS;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
break;
case LED_CTL_STOP_WPS:
if (pLed->bLedNoLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedNoLinkBlinkInProgress = false;
}
if (pLed->bLedLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
}
if (pLed->bLedBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedBlinkInProgress = false;
}
if (pLed->bLedScanBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedScanBlinkInProgress = false;
}
if (pLed->bLedWPSBlinkInProgress)
cancel_delayed_work(&pLed->blink_work);
else
pLed->bLedWPSBlinkInProgress = true;
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
pLed->bLedBlinkInProgress = false;
pLed->bLedScanBlinkInProgress = false;
pLed->bLedWPSBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_WPS_STOP;
if (pLed->bLedOn) {
pLed->BlinkingLedState = RTW_LED_OFF;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_WPS_SUCESS_INTVL);
} else {
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, 0);
}
break;
case LED_CTL_STOP_WPS_FAIL:
if (pLed->bLedWPSBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedWPSBlinkInProgress = false;
}
pLed->bLedNoLinkBlinkInProgress = true;
cancel_delayed_work(&pLed->blink_work);
pLed->bLedWPSBlinkInProgress = false;
pLed->CurrLedState = LED_BLINK_SLOWLY;
if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF;
else
pLed->BlinkingLedState = RTW_LED_ON;
schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
break;
case LED_CTL_POWER_OFF:
pLed->CurrLedState = RTW_LED_OFF;
pLed->BlinkingLedState = RTW_LED_OFF;
if (pLed->bLedNoLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedNoLinkBlinkInProgress = false;
}
if (pLed->bLedLinkBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedLinkBlinkInProgress = false;
}
if (pLed->bLedBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedBlinkInProgress = false;
}
if (pLed->bLedWPSBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedWPSBlinkInProgress = false;
}
if (pLed->bLedScanBlinkInProgress) {
cancel_delayed_work(&pLed->blink_work);
pLed->bLedScanBlinkInProgress = false;
}
pLed->bLedLinkBlinkInProgress = false;
pLed->bLedBlinkInProgress = false;
pLed->bLedWPSBlinkInProgress = false;
pLed->bLedScanBlinkInProgress = false;
cancel_delayed_work(&pLed->blink_work);
SwLedOff(padapter, pLed);
break;
default:
......
......@@ -5,10 +5,7 @@
#include "../include/osdep_service.h"
#include "../include/drv_types.h"
#include "../include/recv_osdep.h"
#include "../include/xmit_osdep.h"
#include "../include/hal_intf.h"
#include "../include/mlme_osdep.h"
#include "../include/sta_info.h"
#include "../include/wifi.h"
#include "../include/wlan_bssdef.h"
......@@ -190,6 +187,37 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *ie)
return ie + 8;
}
static void rtw_join_timeout_handler(struct timer_list *t)
{
struct adapter *adapter = from_timer(adapter, t, mlmepriv.assoc_timer);
_rtw_join_timeout_handler(adapter);
}
static void _rtw_scan_timeout_handler(struct timer_list *t)
{
struct adapter *adapter = from_timer(adapter, t, mlmepriv.scan_to_timer);
rtw_scan_timeout_handler(adapter);
}
static void _dynamic_check_timer_handlder(struct timer_list *t)
{
struct adapter *adapter = from_timer(adapter, t, mlmepriv.dynamic_chk_timer);
rtw_dynamic_check_timer_handlder(adapter);
_set_timer(&adapter->mlmepriv.dynamic_chk_timer, 2000);
}
static void rtw_init_mlme_timer(struct adapter *padapter)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
timer_setup(&pmlmepriv->assoc_timer, rtw_join_timeout_handler, 0);
timer_setup(&pmlmepriv->scan_to_timer, _rtw_scan_timeout_handler, 0);
timer_setup(&pmlmepriv->dynamic_chk_timer, _dynamic_check_timer_handlder, 0);
}
int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv) */
{
int i;
......@@ -235,8 +263,6 @@ int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv)
/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
rtw_clear_scan_deny(padapter);
rtw_init_mlme_timer(padapter);
exit:
......@@ -641,6 +667,23 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf)
spin_unlock_bh(&pmlmepriv->lock);
}
static void rtw_xmit_schedule(struct adapter *padapter)
{
struct xmit_priv *pxmitpriv;
if (!padapter)
return;
pxmitpriv = &padapter->xmitpriv;
spin_lock_bh(&pxmitpriv->lock);
if (rtw_txframes_pending(padapter))
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
spin_unlock_bh(&pxmitpriv->lock);
}
void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
{
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
......@@ -697,7 +740,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
} else {
if (rtw_to_roaming(adapter) != 0) {
if (--pmlmepriv->to_roaming == 0 ||
rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0) != _SUCCESS) {
rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1) != _SUCCESS) {
rtw_set_roaming(adapter, 0);
rtw_free_assoc_resources(adapter, 1);
rtw_indicate_disconnect(adapter);
......@@ -719,7 +762,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
if (check_fwstate(pmlmepriv, _FW_LINKED))
p2p_ps_wk_cmd(adapter, P2P_PS_SCAN_DONE, 0);
rtw_os_xmit_schedule(adapter);
rtw_xmit_schedule(adapter);
}
static void free_scanqueue(struct mlme_priv *pmlmepriv)
......@@ -795,6 +838,48 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue)
}
static struct rt_pmkid_list backup_pmkid[NUM_PMKID_CACHE];
static void rtw_reset_securitypriv(struct adapter *adapter)
{
u8 backup_index;
u8 backup_counter;
u32 backup_time;
if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) {
/* 802.1x */
/* We have to backup the PMK information for WiFi PMK Caching test item. */
/* Backup the btkip_countermeasure information. */
/* When the countermeasure is trigger, the driver have to disconnect with AP for 60 seconds. */
memcpy(&backup_pmkid[0], &adapter->securitypriv.PMKIDList[0], sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
backup_index = adapter->securitypriv.PMKIDIndex;
backup_counter = adapter->securitypriv.btkip_countermeasure;
backup_time = adapter->securitypriv.btkip_countermeasure_time;
memset((unsigned char *)&adapter->securitypriv, 0, sizeof(struct security_priv));
/* Restore the PMK information to securitypriv structure for the following connection. */
memcpy(&adapter->securitypriv.PMKIDList[0],
&backup_pmkid[0],
sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
adapter->securitypriv.PMKIDIndex = backup_index;
adapter->securitypriv.btkip_countermeasure = backup_counter;
adapter->securitypriv.btkip_countermeasure_time = backup_time;
adapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
adapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled;
} else {
/* reset values in securitypriv */
struct security_priv *psec_priv = &adapter->securitypriv;
psec_priv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; /* open system */
psec_priv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
psec_priv->dot11PrivacyKeyIndex = 0;
psec_priv->dot118021XGrpPrivacy = _NO_PRIVACY_;
psec_priv->dot118021XGrpKeyid = 1;
psec_priv->ndisauthtype = Ndis802_11AuthModeOpen;
psec_priv->ndisencryptstatus = Ndis802_11WEPDisabled;
}
}
/*
*rtw_indicate_connect: the caller has to lock pmlmepriv->lock
*/
......@@ -809,12 +894,13 @@ void rtw_indicate_connect(struct adapter *padapter)
rtw_led_control(padapter, LED_CTL_LINK);
rtw_os_indicate_connect(padapter);
rtw_indicate_wx_assoc_event(padapter);
netif_carrier_on(padapter->pnetdev);
if (padapter->pid[2] != 0)
rtw_signal_process(padapter->pid[2], SIGALRM);
}
pmlmepriv->to_roaming = 0;
rtw_set_scan_deny(padapter, 3000);
}
/*
......@@ -831,11 +917,14 @@ void rtw_indicate_disconnect(struct adapter *padapter)
if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) ||
(pmlmepriv->to_roaming <= 0)) {
rtw_os_indicate_disconnect(padapter);
/* Do it first for tx broadcast pkt after disconnection issue! */
netif_carrier_off(padapter->pnetdev);
rtw_indicate_wx_disassoc_event(padapter);
rtw_reset_securitypriv(padapter);
_clr_fwstate_(pmlmepriv, _FW_LINKED);
rtw_led_control(padapter, LED_CTL_NO_LINK);
rtw_clear_scan_deny(padapter);
}
p2p_ps_wk_cmd(padapter, P2P_PS_DISABLE, 1);
......@@ -843,9 +932,9 @@ void rtw_indicate_disconnect(struct adapter *padapter)
}
inline void rtw_indicate_scan_done(struct adapter *padapter, bool aborted)
inline void rtw_indicate_scan_done(struct adapter *padapter)
{
rtw_os_indicate_scan_done(padapter, aborted);
indicate_wx_scan_complete_event(padapter);
}
static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, struct wlan_network *pnetwork)
......@@ -1068,8 +1157,7 @@ void rtw_joinbss_event_callback(struct adapter *adapter, u8 *pbuf)
mlmeext_joinbss_event_callback(adapter, pnetwork->join_res);
rtw_os_xmit_schedule(adapter);
rtw_xmit_schedule(adapter);
}
void rtw_set_max_rpt_macid(struct adapter *adapter, u8 macid)
......@@ -1316,7 +1404,7 @@ void rtw_scan_timeout_handler (struct adapter *adapter)
spin_lock_bh(&pmlmepriv->lock);
_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
spin_unlock_bh(&pmlmepriv->lock);
rtw_indicate_scan_done(adapter, true);
rtw_indicate_scan_done(adapter);
}
static void rtw_auto_scan_handler(struct adapter *padapter)
......@@ -1442,10 +1530,6 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv)
pmlmepriv->pscanned = phead->next;
while (phead != pmlmepriv->pscanned) {
pnetwork = container_of(pmlmepriv->pscanned, struct wlan_network, list);
if (!pnetwork) {
ret = _FAIL;
goto exit;
}
pmlmepriv->pscanned = pmlmepriv->pscanned->next;
rtw_check_join_candidate(pmlmepriv, &candidate, pnetwork);
}
......@@ -1639,6 +1723,33 @@ static int rtw_append_pmkid(struct adapter *Adapter, int iEntry, u8 *ie, uint ie
return ie_len;
}
static void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie)
{
uint len;
u8 *buff, *p, i;
union iwreq_data wrqu;
buff = NULL;
if (authmode == _WPA_IE_ID_) {
buff = kzalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
if (!buff)
return;
p = buff;
p += sprintf(p, "ASSOCINFO(ReqIEs =");
len = sec_ie[1] + 2;
len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX;
for (i = 0; i < len; i++)
p += sprintf(p, "%02x", sec_ie[i]);
p += sprintf(p, ")");
memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.length = p - buff;
wrqu.data.length = (wrqu.data.length < IW_CUSTOM_MAX) ?
wrqu.data.length : IW_CUSTOM_MAX;
wireless_send_event(adapter->pnetdev, IWEVCUSTOM, &wrqu, buff);
kfree(buff);
}
}
int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_len)
{
u8 authmode = 0;
......
......@@ -9,8 +9,6 @@
#include "../include/wifi.h"
#include "../include/rtw_mlme_ext.h"
#include "../include/wlan_bssdef.h"
#include "../include/mlme_osdep.h"
#include "../include/recv_osdep.h"
#include "../include/rtl8188e_xmit.h"
#include "../include/rtl8188e_dm.h"
......@@ -334,6 +332,28 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_c
return chanset_size;
}
static void _survey_timer_hdl(struct timer_list *t)
{
struct adapter *padapter = from_timer(padapter, t, mlmeextpriv.survey_timer);
survey_timer_hdl(padapter);
}
static void _link_timer_hdl(struct timer_list *t)
{
struct adapter *padapter = from_timer(padapter, t, mlmeextpriv.link_timer);
link_timer_hdl(padapter);
}
static void init_mlme_ext_timer(struct adapter *padapter)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
timer_setup(&pmlmeext->survey_timer, _survey_timer_hdl, 0);
timer_setup(&pmlmeext->link_timer, _link_timer_hdl, 0);
}
void init_mlme_ext_priv(struct adapter *padapter)
{
struct registry_priv *pregistrypriv = &padapter->registrypriv;
......@@ -910,6 +930,46 @@ unsigned int OnAuthClient(struct adapter *padapter, struct recv_frame *precv_fra
return _FAIL;
}
static void UpdateBrateTbl(u8 *mbrate)
{
u8 i;
u8 rate;
/* 1M, 2M, 5.5M, 11M, 6M, 12M, 24M are mandatory. */
for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
rate = mbrate[i] & 0x7f;
switch (rate) {
case IEEE80211_CCK_RATE_1MB:
case IEEE80211_CCK_RATE_2MB:
case IEEE80211_CCK_RATE_5MB:
case IEEE80211_CCK_RATE_11MB:
case IEEE80211_OFDM_RATE_6MB:
case IEEE80211_OFDM_RATE_12MB:
case IEEE80211_OFDM_RATE_24MB:
mbrate[i] |= IEEE80211_BASIC_RATE_MASK;
break;
}
}
}
static void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen)
{
u8 i;
u8 rate;
for (i = 0; i < bssratelen; i++) {
rate = bssrateset[i] & 0x7f;
switch (rate) {
case IEEE80211_CCK_RATE_1MB:
case IEEE80211_CCK_RATE_2MB:
case IEEE80211_CCK_RATE_5MB:
case IEEE80211_CCK_RATE_11MB:
bssrateset[i] |= IEEE80211_BASIC_RATE_MASK;
break;
}
}
}
unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame)
{
u16 capab_info;
......@@ -1320,9 +1380,9 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame
unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame)
{
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data;
uint i;
int res;
unsigned short status;
struct ndis_802_11_var_ie *pIE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
......@@ -1331,7 +1391,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame
uint pkt_len = precv_frame->len;
/* check A1 matches or not */
if (memcmp(myid(&padapter->eeprompriv), get_da(pframe), ETH_ALEN))
if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN))
return _SUCCESS;
if (!(pmlmeinfo->state & (WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE)))
......@@ -1342,28 +1402,24 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame
_cancel_timer_ex(&pmlmeext->link_timer);
/* status */
status = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + 2));
if (status > 0) {
if (le16_to_cpu(mgmt->u.assoc_resp.status_code) > 0) {
pmlmeinfo->state = WIFI_FW_NULL_STATE;
res = -4;
goto report_assoc_result;
}
/* get capabilities */
pmlmeinfo->capability = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN));
pmlmeinfo->capability = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
/* set slot time */
pmlmeinfo->slotTime = (pmlmeinfo->capability & BIT(10)) ? 9 : 20;
/* AID */
pmlmeinfo->aid = (int)(le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + 4)) & 0x3fff);
pmlmeinfo->aid = le16_to_cpu(mgmt->u.assoc_resp.aid) & 0x3fff;
res = pmlmeinfo->aid;
/* following are moved to join event callback function */
/* to handle HT, WMM, rate adaptive, update MAC reg */
/* for not to handle the synchronous IO in the tasklet */
for (i = (6 + WLAN_HDR_A3_LEN); i < pkt_len;) {
for (i = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); i < pkt_len;) {
pIE = (struct ndis_802_11_var_ie *)(pframe + i);
switch (pIE->ElementID) {
......@@ -1391,7 +1447,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame
pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
/* Update Basic Rate Table for spec, 2010-12-28 , by thomas */
UpdateBrateTbl(padapter, pmlmeinfo->network.SupportedRates);
UpdateBrateTbl(pmlmeinfo->network.SupportedRates);
report_assoc_result:
report_join_res(padapter, res);
......@@ -7858,7 +7914,7 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf)
spin_unlock_bh(&psta_bmc->sleep_q.lock);
if (rtl8188eu_hal_xmit(padapter, pxmitframe))
rtw_os_xmit_complete(padapter, pxmitframe);
rtw_xmit_complete(padapter, pxmitframe);
spin_lock_bh(&psta_bmc->sleep_q.lock);
}
spin_unlock_bh(&psta_bmc->sleep_q.lock);
......
......@@ -1883,15 +1883,14 @@ void init_wifidirect_info(struct adapter *padapter, enum P2P_ROLE role)
int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role)
{
int ret = _SUCCESS;
int ret;
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
if (role == P2P_ROLE_DEVICE || role == P2P_ROLE_CLIENT || role == P2P_ROLE_GO) {
/* leave IPS/Autosuspend */
if (rtw_pwr_wakeup(padapter)) {
ret = _FAIL;
goto exit;
}
ret = rtw_pwr_wakeup(padapter);
if (ret)
return ret;
/* Added by Albert 2011/03/22 */
/* In the P2P mode, the driver should not support the b mode. */
......@@ -1902,10 +1901,9 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role)
init_wifidirect_info(padapter, role);
} else if (role == P2P_ROLE_DISABLE) {
if (rtw_pwr_wakeup(padapter)) {
ret = _FAIL;
goto exit;
}
ret = rtw_pwr_wakeup(padapter);
if (ret)
return ret;
/* Disable P2P function */
if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) {
......@@ -1923,6 +1921,5 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role)
update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode);
}
exit:
return ret;
return 0;
}
......@@ -89,7 +89,7 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
struct wifidirect_info *pwdinfo = &adapter->wdinfo;
bool ret = false;
if (adapter->pwrctrlpriv.ips_deny_time >= jiffies)
if (time_after_eq(adapter->pwrctrlpriv.ips_deny_time, jiffies))
goto exit;
if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE | WIFI_SITE_MONITOR) ||
......
......@@ -5,9 +5,6 @@
#include "../include/osdep_service.h"
#include "../include/drv_types.h"
#include "../include/recv_osdep.h"
#include "../include/xmit_osdep.h"
#include "../include/mlme_osdep.h"
#include "../include/sta_info.h"
static void _rtw_init_stainfo(struct sta_info *psta)
......@@ -141,6 +138,31 @@ void _rtw_free_sta_priv(struct sta_priv *pstapriv)
}
}
static void _rtw_reordering_ctrl_timeout_handler(struct timer_list *t)
{
struct recv_reorder_ctrl *preorder_ctrl;
preorder_ctrl = from_timer(preorder_ctrl, t, reordering_ctrl_timer);
rtw_reordering_ctrl_timeout_handler(preorder_ctrl);
}
static void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
{
timer_setup(&preorder_ctrl->reordering_ctrl_timer, _rtw_reordering_ctrl_timeout_handler, 0);
}
static void _addba_timer_hdl(struct timer_list *t)
{
struct sta_info *psta = from_timer(psta, t, addba_retry_timer);
addba_timer_hdl(psta);
}
static void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta)
{
timer_setup(&psta->addba_retry_timer, _addba_timer_hdl, 0);
}
struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
s32 index;
......
......@@ -126,7 +126,12 @@ static u32 array_MAC_REG_8188E[] = {
0x70B, 0x00000087,
};
enum HAL_STATUS ODM_ReadAndConfig_MAC_REG_8188E(struct odm_dm_struct *dm_odm)
static void odm_ConfigMAC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u8 Data)
{
rtw_write8(pDM_Odm->Adapter, Addr, Data);
}
int ODM_ReadAndConfig_MAC_REG_8188E(struct odm_dm_struct *dm_odm)
{
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = array[i]; v2 = array[i + 1]; } while (0)
......@@ -139,7 +144,6 @@ enum HAL_STATUS ODM_ReadAndConfig_MAC_REG_8188E(struct odm_dm_struct *dm_odm)
struct adapter *adapt = dm_odm->Adapter;
struct xmit_frame *pxmit_frame = NULL;
u8 bndy_cnt = 1;
enum HAL_STATUS rst = HAL_STATUS_SUCCESS;
hex += ODM_ITRF_USB << 8;
hex += ODM_CE << 16;
hex += 0xFF000000;
......@@ -150,7 +154,7 @@ enum HAL_STATUS ODM_ReadAndConfig_MAC_REG_8188E(struct odm_dm_struct *dm_odm)
pxmit_frame = rtw_IOL_accquire_xmit_frame(adapt);
if (!pxmit_frame) {
pr_info("rtw_IOL_accquire_xmit_frame failed\n");
return HAL_STATUS_FAILURE;
return -ENOMEM;
}
}
......@@ -201,8 +205,8 @@ enum HAL_STATUS ODM_ReadAndConfig_MAC_REG_8188E(struct odm_dm_struct *dm_odm)
if (biol) {
if (!rtl8188e_IOL_exec_cmds_sync(dm_odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
pr_info("~~~ MAC IOL_exec_cmds Failed !!!\n");
rst = HAL_STATUS_FAILURE;
return -1;
}
}
return rst;
return 0;
}
......@@ -5,8 +5,6 @@
#include "../include/osdep_service.h"
#include "../include/drv_types.h"
#include "../include/recv_osdep.h"
#include "../include/mlme_osdep.h"
#include "../include/rtw_ioctl_set.h"
#include "../include/rtl8188e_hal.h"
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册