Commit c5596049 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb

* 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb:
  uwb: Orphan the UWB and WUSB subsystems
  uwb: Remove the WLP subsystem and drivers
parents fbaab1dc 10c6c9c9
......@@ -1562,9 +1562,8 @@ F: net/ceph
F: include/linux/ceph
CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM:
M: David Vrabel <david.vrabel@csr.com>
L: linux-usb@vger.kernel.org
S: Supported
S: Orphan
F: Documentation/usb/WUSB-Design-overview.txt
F: Documentation/usb/wusb-cbaf
F: drivers/usb/host/hwa-hc.c
......@@ -5991,13 +5990,9 @@ F: Documentation/filesystems/ufs.txt
F: fs/ufs/
ULTRA-WIDEBAND (UWB) SUBSYSTEM:
M: David Vrabel <david.vrabel@csr.com>
L: linux-usb@vger.kernel.org
S: Supported
S: Orphan
F: drivers/uwb/
X: drivers/uwb/wlp/
X: drivers/uwb/i1480/i1480u-wlp/
X: drivers/uwb/i1480/i1480-wlp.h
F: include/linux/uwb.h
F: include/linux/uwb/
......@@ -6533,15 +6528,6 @@ F: include/linux/wimax/debug.h
F: include/net/wimax.h
F: net/wimax/
WIMEDIA LLC PROTOCOL (WLP) SUBSYSTEM
M: David Vrabel <david.vrabel@csr.com>
L: netdev@vger.kernel.org
S: Maintained
F: include/linux/wlp.h
F: drivers/uwb/wlp/
F: drivers/uwb/i1480/i1480u-wlp/
F: drivers/uwb/i1480/i1480-wlp.h
WISTRON LAPTOP BUTTON DRIVER
M: Miloslav Trmac <mitr@volny.cz>
S: Maintained
......
......@@ -12,8 +12,7 @@ menuconfig UWB
technology using a wide spectrum (3.1-10.6GHz). It is
optimized for in-room use (480Mbps at 2 meters, 110Mbps at
10m). It serves as the transport layer for other protocols,
such as Wireless USB (WUSB), IP (WLP) and upcoming
Bluetooth and 1394
such as Wireless USB (WUSB).
The topology is peer to peer; however, higher level
protocols (such as WUSB) might impose a master/slave
......@@ -58,13 +57,6 @@ config UWB_WHCI
To compile this driver select Y (built in) or M (module). It
is safe to select any even if you do not have the hardware.
config UWB_WLP
tristate "Support WiMedia Link Protocol (Ethernet/IP over UWB)"
depends on UWB && NET
help
This is a common library for drivers that implement
networking over UWB.
config UWB_I1480U
tristate "Support for Intel Wireless UWB Link 1480 HWA"
depends on UWB_HWA
......@@ -77,14 +69,4 @@ config UWB_I1480U
To compile this driver select Y (built in) or M (module). It
is safe to select any even if you do not have the hardware.
config UWB_I1480U_WLP
tristate "Support for Intel Wireless UWB Link 1480 HWA's WLP interface"
depends on UWB_I1480U && UWB_WLP && NET
help
This driver enables WLP support for the i1480 when connected via
USB. WLP is the WiMedia Link Protocol, or IP over UWB.
To compile this driver select Y (built in) or M (module). It
is safe to select any even if you don't have the hardware.
endif # UWB
obj-$(CONFIG_UWB) += uwb.o
obj-$(CONFIG_UWB_WLP) += wlp/
obj-$(CONFIG_UWB_WHCI) += umc.o whci.o whc-rc.o
obj-$(CONFIG_UWB_HWA) += hwa-rc.o
obj-$(CONFIG_UWB_I1480U) += i1480/
......
obj-$(CONFIG_UWB_I1480U) += dfu/ i1480-est.o
obj-$(CONFIG_UWB_I1480U_WLP) += i1480u-wlp/
/*
* Intel 1480 Wireless UWB Link
* WLP specific definitions
*
*
* Copyright (C) 2005-2006 Intel Corporation
* Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
*
* This program 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.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*
* FIXME: docs
*/
#ifndef __i1480_wlp_h__
#define __i1480_wlp_h__
#include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/uwb.h>
#include <linux/if_ether.h>
#include <asm/byteorder.h>
/* New simplified header format? */
#undef WLP_HDR_FMT_2 /* FIXME: rename */
/**
* Values of the Delivery ID & Type field when PCA or DRP
*
* The Delivery ID & Type field in the WLP TX header indicates whether
* the frame is PCA or DRP. This is done based on the high level bit of
* this field.
* We use this constant to test if the traffic is PCA or DRP as follows:
* if (wlp_tx_hdr_delivery_id_type(wlp_tx_hdr) & WLP_DRP)
* this is DRP traffic
* else
* this is PCA traffic
*/
enum deliver_id_type_bit {
WLP_DRP = 8,
};
/**
* WLP TX header
*
* Indicates UWB/WLP-specific transmission parameters for a network
* packet.
*/
struct wlp_tx_hdr {
/* dword 0 */
struct uwb_dev_addr dstaddr;
u8 key_index;
u8 mac_params;
/* dword 1 */
u8 phy_params;
#ifndef WLP_HDR_FMT_2
u8 reserved;
__le16 oui01; /* FIXME: not so sure if __le16 or u8[2] */
/* dword 2 */
u8 oui2; /* if all LE, it could be merged */
__le16 prid;
#endif
} __attribute__((packed));
static inline int wlp_tx_hdr_delivery_id_type(const struct wlp_tx_hdr *hdr)
{
return hdr->mac_params & 0x0f;
}
static inline int wlp_tx_hdr_ack_policy(const struct wlp_tx_hdr *hdr)
{
return (hdr->mac_params >> 4) & 0x07;
}
static inline int wlp_tx_hdr_rts_cts(const struct wlp_tx_hdr *hdr)
{
return (hdr->mac_params >> 7) & 0x01;
}
static inline void wlp_tx_hdr_set_delivery_id_type(struct wlp_tx_hdr *hdr, int id)
{
hdr->mac_params = (hdr->mac_params & ~0x0f) | id;
}
static inline void wlp_tx_hdr_set_ack_policy(struct wlp_tx_hdr *hdr,
enum uwb_ack_pol policy)
{
hdr->mac_params = (hdr->mac_params & ~0x70) | (policy << 4);
}
static inline void wlp_tx_hdr_set_rts_cts(struct wlp_tx_hdr *hdr, int rts_cts)
{
hdr->mac_params = (hdr->mac_params & ~0x80) | (rts_cts << 7);
}
static inline enum uwb_phy_rate wlp_tx_hdr_phy_rate(const struct wlp_tx_hdr *hdr)
{
return hdr->phy_params & 0x0f;
}
static inline int wlp_tx_hdr_tx_power(const struct wlp_tx_hdr *hdr)
{
return (hdr->phy_params >> 4) & 0x0f;
}
static inline void wlp_tx_hdr_set_phy_rate(struct wlp_tx_hdr *hdr, enum uwb_phy_rate rate)
{
hdr->phy_params = (hdr->phy_params & ~0x0f) | rate;
}
static inline void wlp_tx_hdr_set_tx_power(struct wlp_tx_hdr *hdr, int pwr)
{
hdr->phy_params = (hdr->phy_params & ~0xf0) | (pwr << 4);
}
/**
* WLP RX header
*
* Provides UWB/WLP-specific transmission data for a received
* network packet.
*/
struct wlp_rx_hdr {
/* dword 0 */
struct uwb_dev_addr dstaddr;
struct uwb_dev_addr srcaddr;
/* dword 1 */
u8 LQI;
s8 RSSI;
u8 reserved3;
#ifndef WLP_HDR_FMT_2
u8 oui0;
/* dword 2 */
__le16 oui12;
__le16 prid;
#endif
} __attribute__((packed));
/** User configurable options for WLP */
struct wlp_options {
struct mutex mutex; /* access to user configurable options*/
struct wlp_tx_hdr def_tx_hdr; /* default tx hdr */
u8 pca_base_priority;
u8 bw_alloc; /*index into bw_allocs[] for PCA/DRP reservations*/
};
static inline
void wlp_options_init(struct wlp_options *options)
{
mutex_init(&options->mutex);
wlp_tx_hdr_set_ack_policy(&options->def_tx_hdr, UWB_ACK_INM);
wlp_tx_hdr_set_rts_cts(&options->def_tx_hdr, 1);
/* FIXME: default to phy caps */
wlp_tx_hdr_set_phy_rate(&options->def_tx_hdr, UWB_PHY_RATE_480);
#ifndef WLP_HDR_FMT_2
options->def_tx_hdr.prid = cpu_to_le16(0x0000);
#endif
}
/* sysfs helpers */
extern ssize_t uwb_pca_base_priority_store(struct wlp_options *,
const char *, size_t);
extern ssize_t uwb_pca_base_priority_show(const struct wlp_options *, char *);
extern ssize_t uwb_bw_alloc_store(struct wlp_options *, const char *, size_t);
extern ssize_t uwb_bw_alloc_show(const struct wlp_options *, char *);
extern ssize_t uwb_ack_policy_store(struct wlp_options *,
const char *, size_t);
extern ssize_t uwb_ack_policy_show(const struct wlp_options *, char *);
extern ssize_t uwb_rts_cts_store(struct wlp_options *, const char *, size_t);
extern ssize_t uwb_rts_cts_show(const struct wlp_options *, char *);
extern ssize_t uwb_phy_rate_store(struct wlp_options *, const char *, size_t);
extern ssize_t uwb_phy_rate_show(const struct wlp_options *, char *);
/** Simple bandwidth allocation (temporary and too simple) */
struct wlp_bw_allocs {
const char *name;
struct {
u8 mask, stream;
} tx, rx;
};
#endif /* #ifndef __i1480_wlp_h__ */
obj-$(CONFIG_UWB_I1480U_WLP) += i1480u-wlp.o
i1480u-wlp-objs := \
lc.o \
netdev.o \
rx.o \
sysfs.o \
tx.o
/*
* Intel 1480 Wireless UWB Link USB
* Header formats, constants, general internal interfaces
*
*
* Copyright (C) 2005-2006 Intel Corporation
* Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
*
* This program 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.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*
* This is not an standard interface.
*
* FIXME: docs
*
* i1480u-wlp is pretty simple: two endpoints, one for tx, one for
* rx. rx is polled. Network packets (ethernet, whatever) are wrapped
* in i1480 TX or RX headers (for sending over the air), and these
* packets are wrapped in UNTD headers (for sending to the WLP UWB
* controller).
*
* UNTD packets (UNTD hdr + i1480 hdr + network packet) packets
* cannot be bigger than i1480u_MAX_FRG_SIZE. When this happens, the
* i1480 packet is broken in chunks/packets:
*
* UNTD-1st.hdr + i1480.hdr + payload
* UNTD-next.hdr + payload
* ...
* UNTD-last.hdr + payload
*
* so that each packet is smaller or equal than i1480u_MAX_FRG_SIZE.
*
* All HW structures and bitmaps are little endian, so we need to play
* ugly tricks when defining bitfields. Hoping for the day GCC
* implements __attribute__((endian(1234))).
*
* FIXME: ROADMAP to the whole implementation
*/
#ifndef __i1480u_wlp_h__
#define __i1480u_wlp_h__
#include <linux/usb.h>
#include <linux/netdevice.h>
#include <linux/uwb.h> /* struct uwb_rc, struct uwb_notifs_handler */
#include <linux/wlp.h>
#include "../i1480-wlp.h"
#undef i1480u_FLOW_CONTROL /* Enable flow control code */
/**
* Basic flow control
*/
enum {
i1480u_TX_INFLIGHT_MAX = 1000,
i1480u_TX_INFLIGHT_THRESHOLD = 100,
};
/** Maximum size of a transaction that we can tx/rx */
enum {
/* Maximum packet size computed as follows: max UNTD header (8) +
* i1480 RX header (8) + max Ethernet header and payload (4096) +
* Padding added by skb_reserve (2) to make post Ethernet payload
* start on 16 byte boundary*/
i1480u_MAX_RX_PKT_SIZE = 4114,
i1480u_MAX_FRG_SIZE = 512,
i1480u_RX_BUFS = 9,
};
/**
* UNTD packet type
*
* We need to fragment any payload whose UNTD packet is going to be
* bigger than i1480u_MAX_FRG_SIZE.
*/
enum i1480u_pkt_type {
i1480u_PKT_FRAG_1ST = 0x1,
i1480u_PKT_FRAG_NXT = 0x0,
i1480u_PKT_FRAG_LST = 0x2,
i1480u_PKT_FRAG_CMP = 0x3
};
enum {
i1480u_PKT_NONE = 0x4,
};
/** USB Network Transfer Descriptor - common */
struct untd_hdr {
u8 type;
__le16 len;
} __attribute__((packed));
static inline enum i1480u_pkt_type untd_hdr_type(const struct untd_hdr *hdr)
{
return hdr->type & 0x03;
}
static inline int untd_hdr_rx_tx(const struct untd_hdr *hdr)
{
return (hdr->type >> 2) & 0x01;
}
static inline void untd_hdr_set_type(struct untd_hdr *hdr, enum i1480u_pkt_type type)
{
hdr->type = (hdr->type & ~0x03) | type;
}
static inline void untd_hdr_set_rx_tx(struct untd_hdr *hdr, int rx_tx)
{
hdr->type = (hdr->type & ~0x04) | (rx_tx << 2);
}
/**
* USB Network Transfer Descriptor - Complete Packet
*
* This is for a packet that is smaller (header + payload) than
* i1480u_MAX_FRG_SIZE.
*
* @hdr.total_len is the size of the payload; the payload doesn't
* count this header nor the padding, but includes the size of i1480
* header.
*/
struct untd_hdr_cmp {
struct untd_hdr hdr;
u8 padding;
} __attribute__((packed));
/**
* USB Network Transfer Descriptor - First fragment
*
* @hdr.len is the size of the *whole packet* (excluding UNTD
* headers); @fragment_len is the size of the payload (excluding UNTD
* headers, but including i1480 headers).
*/
struct untd_hdr_1st {
struct untd_hdr hdr;
__le16 fragment_len;
u8 padding[3];
} __attribute__((packed));
/**
* USB Network Transfer Descriptor - Next / Last [Rest]
*
* @hdr.len is the size of the payload, not including headrs.
*/
struct untd_hdr_rst {
struct untd_hdr hdr;
u8 padding;
} __attribute__((packed));
/**
* Transmission context
*
* Wraps all the stuff needed to track a pending/active tx
* operation.
*/
struct i1480u_tx {
struct list_head list_node;
struct i1480u *i1480u;
struct urb *urb;
struct sk_buff *skb;
struct wlp_tx_hdr *wlp_tx_hdr;
void *buf; /* if NULL, no new buf was used */
size_t buf_size;
};
/**
* Basic flow control
*
* We maintain a basic flow control counter. "count" how many TX URBs are
* outstanding. Only allow "max"
* TX URBs to be outstanding. If this value is reached the queue will be
* stopped. The queue will be restarted when there are
* "threshold" URBs outstanding.
* Maintain a counter of how many time the TX queue needed to be restarted
* due to the "max" being exceeded and the "threshold" reached again. The
* timestamp "restart_ts" is to keep track from when the counter was last
* queried (see sysfs handling of file wlp_tx_inflight).
*/
struct i1480u_tx_inflight {
atomic_t count;
unsigned long max;
unsigned long threshold;
unsigned long restart_ts;
atomic_t restart_count;
};
/**
* Instance of a i1480u WLP interface
*
* Keeps references to the USB device that wraps it, as well as it's
* interface and associated UWB host controller. As well, it also
* keeps a link to the netdevice for integration into the networking
* stack.
* We maintian separate error history for the tx and rx endpoints because
* the implementation does not rely on locking - having one shared
* structure between endpoints may cause problems. Adding locking to the
* implementation will have higher cost than adding a separate structure.
*/
struct i1480u {
struct usb_device *usb_dev;
struct usb_interface *usb_iface;
struct net_device *net_dev;
spinlock_t lock;
/* RX context handling */
struct sk_buff *rx_skb;
struct uwb_dev_addr rx_srcaddr;
size_t rx_untd_pkt_size;
struct i1480u_rx_buf {
struct i1480u *i1480u; /* back pointer */
struct urb *urb;
struct sk_buff *data; /* i1480u_MAX_RX_PKT_SIZE each */
} rx_buf[i1480u_RX_BUFS]; /* N bufs */
spinlock_t tx_list_lock; /* TX context */
struct list_head tx_list;
u8 tx_stream;
struct stats lqe_stats, rssi_stats; /* radio statistics */
/* Options we can set from sysfs */
struct wlp_options options;
struct uwb_notifs_handler uwb_notifs_handler;
struct edc tx_errors;
struct edc rx_errors;
struct wlp wlp;
#ifdef i1480u_FLOW_CONTROL
struct urb *notif_urb;
struct edc notif_edc; /* error density counter */
u8 notif_buffer[1];
#endif
struct i1480u_tx_inflight tx_inflight;
};
/* Internal interfaces */
extern void i1480u_rx_cb(struct urb *urb);
extern int i1480u_rx_setup(struct i1480u *);
extern void i1480u_rx_release(struct i1480u *);
extern void i1480u_tx_release(struct i1480u *);
extern int i1480u_xmit_frame(struct wlp *, struct sk_buff *,
struct uwb_dev_addr *);
extern void i1480u_stop_queue(struct wlp *);
extern void i1480u_start_queue(struct wlp *);
extern int i1480u_sysfs_setup(struct i1480u *);
extern void i1480u_sysfs_release(struct i1480u *);
/* netdev interface */
extern int i1480u_open(struct net_device *);
extern int i1480u_stop(struct net_device *);
extern netdev_tx_t i1480u_hard_start_xmit(struct sk_buff *,
struct net_device *);
extern void i1480u_tx_timeout(struct net_device *);
extern int i1480u_set_config(struct net_device *, struct ifmap *);
extern int i1480u_change_mtu(struct net_device *, int);
extern void i1480u_uwb_notifs_cb(void *, struct uwb_dev *, enum uwb_notifs);
/* bandwidth allocation callback */
extern void i1480u_bw_alloc_cb(struct uwb_rsv *);
/* Sys FS */
extern struct attribute_group i1480u_wlp_attr_group;
#endif /* #ifndef __i1480u_wlp_h__ */
This diff is collapsed.
/*
* WUSB Wire Adapter: WLP interface
* Driver for the Linux Network stack.
*
* Copyright (C) 2005-2006 Intel Corporation
* Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
*
* This program 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.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*
* FIXME: docs
*
* Implementation of the netdevice linkage (except tx and rx related stuff).
*
* ROADMAP:
*
* ENTRY POINTS (Net device):
*
* i1480u_open(): Called when we ifconfig up the interface;
* associates to a UWB host controller, reserves
* bandwidth (MAS), sets up RX USB URB and starts
* the queue.
*
* i1480u_stop(): Called when we ifconfig down a interface;
* reverses _open().
*
* i1480u_set_config():
*/
#include <linux/slab.h>
#include <linux/if_arp.h>
#include <linux/etherdevice.h>
#include "i1480u-wlp.h"
struct i1480u_cmd_set_ip_mas {
struct uwb_rccb rccb;
struct uwb_dev_addr addr;
u8 stream;
u8 owner;
u8 type; /* enum uwb_drp_type */
u8 baMAS[32];
} __attribute__((packed));
static
int i1480u_set_ip_mas(
struct uwb_rc *rc,
const struct uwb_dev_addr *dstaddr,
u8 stream, u8 owner, u8 type, unsigned long *mas)
{
int result;
struct i1480u_cmd_set_ip_mas *cmd;
struct uwb_rc_evt_confirm reply;
result = -ENOMEM;
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (cmd == NULL)
goto error_kzalloc;
cmd->rccb.bCommandType = 0xfd;
cmd->rccb.wCommand = cpu_to_le16(0x000e);
cmd->addr = *dstaddr;
cmd->stream = stream;
cmd->owner = owner;
cmd->type = type;
if (mas == NULL)
memset(cmd->baMAS, 0x00, sizeof(cmd->baMAS));
else
memcpy(cmd->baMAS, mas, sizeof(cmd->baMAS));
reply.rceb.bEventType = 0xfd;
reply.rceb.wEvent = cpu_to_le16(0x000e);
result = uwb_rc_cmd(rc, "SET-IP-MAS", &cmd->rccb, sizeof(*cmd),
&reply.rceb, sizeof(reply));
if (result < 0)
goto error_cmd;
if (reply.bResultCode != UWB_RC_RES_FAIL) {
dev_err(&rc->uwb_dev.dev,
"SET-IP-MAS: command execution failed: %d\n",
reply.bResultCode);
result = -EIO;
}
error_cmd:
kfree(cmd);
error_kzalloc:
return result;
}
/*
* Inform a WLP interface of a MAS reservation
*
* @rc is assumed refcnted.
*/
/* FIXME: detect if remote device is WLP capable? */
static int i1480u_mas_set_dev(struct uwb_dev *uwb_dev, struct uwb_rc *rc,
u8 stream, u8 owner, u8 type, unsigned long *mas)
{
int result = 0;
struct device *dev = &rc->uwb_dev.dev;
result = i1480u_set_ip_mas(rc, &uwb_dev->dev_addr, stream, owner,
type, mas);
if (result < 0) {
char rcaddrbuf[UWB_ADDR_STRSIZE], devaddrbuf[UWB_ADDR_STRSIZE];
uwb_dev_addr_print(rcaddrbuf, sizeof(rcaddrbuf),
&rc->uwb_dev.dev_addr);
uwb_dev_addr_print(devaddrbuf, sizeof(devaddrbuf),
&uwb_dev->dev_addr);
dev_err(dev, "Set IP MAS (%s to %s) failed: %d\n",
rcaddrbuf, devaddrbuf, result);
}
return result;
}
/**
* Called by bandwidth allocator when change occurs in reservation.
*
* @rsv: The reservation that is being established, modified, or
* terminated.
*
* When a reservation is established, modified, or terminated the upper layer
* (WLP here) needs set/update the currently available Media Access Slots
* that can be use for IP traffic.
*
* Our action taken during failure depends on how the reservation is being
* changed:
* - if reservation is being established we do nothing if we cannot set the
* new MAS to be used
* - if reservation is being terminated we revert back to PCA whether the
* SET IP MAS command succeeds or not.
*/
void i1480u_bw_alloc_cb(struct uwb_rsv *rsv)
{
int result = 0;
struct i1480u *i1480u = rsv->pal_priv;
struct device *dev = &i1480u->usb_iface->dev;
struct uwb_dev *target_dev = rsv->target.dev;
struct uwb_rc *rc = i1480u->wlp.rc;
u8 stream = rsv->stream;
int type = rsv->type;
int is_owner = rsv->owner == &rc->uwb_dev;
unsigned long *bmp = rsv->mas.bm;
dev_err(dev, "WLP callback called - sending set ip mas\n");
/*user cannot change options while setting configuration*/
mutex_lock(&i1480u->options.mutex);
switch (rsv->state) {
case UWB_RSV_STATE_T_ACCEPTED:
case UWB_RSV_STATE_O_ESTABLISHED:
result = i1480u_mas_set_dev(target_dev, rc, stream, is_owner,
type, bmp);
if (result < 0) {
dev_err(dev, "MAS reservation failed: %d\n", result);
goto out;
}
if (is_owner) {
wlp_tx_hdr_set_delivery_id_type(&i1480u->options.def_tx_hdr,
WLP_DRP | stream);
wlp_tx_hdr_set_rts_cts(&i1480u->options.def_tx_hdr, 0);
}
break;
case UWB_RSV_STATE_NONE:
/* revert back to PCA */
result = i1480u_mas_set_dev(target_dev, rc, stream, is_owner,
type, bmp);
if (result < 0)
dev_err(dev, "MAS reservation failed: %d\n", result);
/* Revert to PCA even though SET IP MAS failed. */
wlp_tx_hdr_set_delivery_id_type(&i1480u->options.def_tx_hdr,
i1480u->options.pca_base_priority);
wlp_tx_hdr_set_rts_cts(&i1480u->options.def_tx_hdr, 1);
break;
default:
dev_err(dev, "unexpected WLP reservation state: %s (%d).\n",
uwb_rsv_state_str(rsv->state), rsv->state);
break;
}
out:
mutex_unlock(&i1480u->options.mutex);
return;
}
/**
*
* Called on 'ifconfig up'
*/
int i1480u_open(struct net_device *net_dev)
{
int result;
struct i1480u *i1480u = netdev_priv(net_dev);
struct wlp *wlp = &i1480u->wlp;
struct uwb_rc *rc;
struct device *dev = &i1480u->usb_iface->dev;
rc = wlp->rc;
result = i1480u_rx_setup(i1480u); /* Alloc RX stuff */
if (result < 0)
goto error_rx_setup;
result = uwb_radio_start(&wlp->pal);
if (result < 0)
goto error_radio_start;
netif_wake_queue(net_dev);
#ifdef i1480u_FLOW_CONTROL
result = usb_submit_urb(i1480u->notif_urb, GFP_KERNEL);
if (result < 0) {
dev_err(dev, "Can't submit notification URB: %d\n", result);
goto error_notif_urb_submit;
}
#endif
/* Interface is up with an address, now we can create WSS */
result = wlp_wss_setup(net_dev, &wlp->wss);
if (result < 0) {
dev_err(dev, "Can't create WSS: %d. \n", result);
goto error_wss_setup;
}
return 0;
error_wss_setup:
#ifdef i1480u_FLOW_CONTROL
usb_kill_urb(i1480u->notif_urb);
error_notif_urb_submit:
#endif
uwb_radio_stop(&wlp->pal);
error_radio_start:
netif_stop_queue(net_dev);
i1480u_rx_release(i1480u);
error_rx_setup:
return result;
}
/**
* Called on 'ifconfig down'
*/
int i1480u_stop(struct net_device *net_dev)
{
struct i1480u *i1480u = netdev_priv(net_dev);
struct wlp *wlp = &i1480u->wlp;
BUG_ON(wlp->rc == NULL);
wlp_wss_remove(&wlp->wss);
netif_carrier_off(net_dev);
#ifdef i1480u_FLOW_CONTROL
usb_kill_urb(i1480u->notif_urb);
#endif
netif_stop_queue(net_dev);
uwb_radio_stop(&wlp->pal);
i1480u_rx_release(i1480u);
i1480u_tx_release(i1480u);
return 0;
}
/**
*
* Change the interface config--we probably don't have to do anything.
*/
int i1480u_set_config(struct net_device *net_dev, struct ifmap *map)
{
int result;
struct i1480u *i1480u = netdev_priv(net_dev);
BUG_ON(i1480u->wlp.rc == NULL);
result = 0;
return result;
}
/**
* Change the MTU of the interface
*/
int i1480u_change_mtu(struct net_device *net_dev, int mtu)
{
static union {
struct wlp_tx_hdr tx;
struct wlp_rx_hdr rx;
} i1480u_all_hdrs;
if (mtu < ETH_HLEN) /* We encap eth frames */
return -ERANGE;
if (mtu > 4000 - sizeof(i1480u_all_hdrs))
return -ERANGE;
net_dev->mtu = mtu;
return 0;
}
/**
* Stop the network queue
*
* Enable WLP substack to stop network queue. We also set the flow control
* threshold at this time to prevent the flow control from restarting the
* queue.
*
* we are loosing the current threshold value here ... FIXME?
*/
void i1480u_stop_queue(struct wlp *wlp)
{
struct i1480u *i1480u = container_of(wlp, struct i1480u, wlp);
struct net_device *net_dev = i1480u->net_dev;
i1480u->tx_inflight.threshold = 0;
netif_stop_queue(net_dev);
}
/**
* Start the network queue
*
* Enable WLP substack to start network queue. Also re-enable the flow
* control to manage the queue again.
*
* We re-enable the flow control by storing the default threshold in the
* flow control threshold. This means that if the user modified the
* threshold before the queue was stopped and restarted that information
* will be lost. FIXME?
*/
void i1480u_start_queue(struct wlp *wlp)
{
struct i1480u *i1480u = container_of(wlp, struct i1480u, wlp);
struct net_device *net_dev = i1480u->net_dev;
i1480u->tx_inflight.threshold = i1480u_TX_INFLIGHT_THRESHOLD;
netif_start_queue(net_dev);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
obj-$(CONFIG_UWB_WLP) := wlp.o
wlp-objs := \
driver.o \
eda.o \
messages.o \
sysfs.o \
txrx.o \
wlp-lc.o \
wss-lc.o
/*
* WiMedia Logical Link Control Protocol (WLP)
*
* Copyright (C) 2007 Intel Corporation
* Reinette Chatre <reinette.chatre@intel.com>
*
* This program 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.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*
* Life cycle of WLP substack
*
* FIXME: Docs
*/
#include <linux/module.h>
static int __init wlp_subsys_init(void)
{
return 0;
}
module_init(wlp_subsys_init);
static void __exit wlp_subsys_exit(void)
{
return;
}
module_exit(wlp_subsys_exit);
MODULE_AUTHOR("Reinette Chatre <reinette.chatre@intel.com>");
MODULE_DESCRIPTION("WiMedia Logical Link Control Protocol (WLP)");
MODULE_LICENSE("GPL");
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* WiMedia Logical Link Control Protocol (WLP)
* Internal API
*
* Copyright (C) 2007 Intel Corporation
* Reinette Chatre <reinette.chatre@intel.com>
*
* This program 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.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*/
#ifndef __WLP_INTERNAL_H__
#define __WLP_INTERNAL_H__
/**
* State of WSS connection
*
* A device needs to connect to a neighbor in an activated WSS before data
* can be transmitted. The spec also distinguishes between a new connection
* attempt and a connection attempt after previous connection attempts. The
* state WLP_WSS_CONNECT_FAILED is used for this scenario. See WLP 0.99
* [7.2.6]
*/
enum wlp_wss_connect {
WLP_WSS_UNCONNECTED = 0,
WLP_WSS_CONNECTED,
WLP_WSS_CONNECT_FAILED,
};
extern struct kobj_type wss_ktype;
extern struct attribute_group wss_attr_group;
/* This should be changed to a dynamic array where entries are sorted
* by eth_addr and search is done in a binary form
*
* Although thinking twice about it: this technologie's maximum reach
* is 10 meters...unless you want to pack too much stuff in around
* your radio controller/WLP device, the list will probably not be
* too big.
*
* In any case, there is probably some data structure in the kernel
* than we could reused for that already.
*
* The below structure is really just good while we support one WSS per
* host.
*/
struct wlp_eda_node {
struct list_head list_node;
unsigned char eth_addr[ETH_ALEN];
struct uwb_dev_addr dev_addr;
struct wlp_wss *wss;
unsigned char virt_addr[ETH_ALEN];
u8 tag;
enum wlp_wss_connect state;
};
typedef int (*wlp_eda_for_each_f)(struct wlp *, struct wlp_eda_node *, void *);
extern void wlp_eda_init(struct wlp_eda *);
extern void wlp_eda_release(struct wlp_eda *);
extern int wlp_eda_create_node(struct wlp_eda *,
const unsigned char eth_addr[ETH_ALEN],
const struct uwb_dev_addr *);
extern void wlp_eda_rm_node(struct wlp_eda *, const struct uwb_dev_addr *);
extern int wlp_eda_update_node(struct wlp_eda *,
const struct uwb_dev_addr *,
struct wlp_wss *,
const unsigned char virt_addr[ETH_ALEN],
const u8, const enum wlp_wss_connect);
extern int wlp_eda_update_node_state(struct wlp_eda *,
const struct uwb_dev_addr *,
const enum wlp_wss_connect);
extern int wlp_copy_eda_node(struct wlp_eda *, struct uwb_dev_addr *,
struct wlp_eda_node *);
extern int wlp_eda_for_each(struct wlp_eda *, wlp_eda_for_each_f , void *);
extern int wlp_eda_for_virtual(struct wlp_eda *,
const unsigned char eth_addr[ETH_ALEN],
struct uwb_dev_addr *,
wlp_eda_for_each_f , void *);
extern void wlp_remove_neighbor_tmp_info(struct wlp_neighbor_e *);
extern size_t wlp_wss_key_print(char *, size_t, u8 *);
/* Function called when no more references to WSS exists */
extern void wlp_wss_release(struct kobject *);
extern void wlp_wss_reset(struct wlp_wss *);
extern int wlp_wss_create_activate(struct wlp_wss *, struct wlp_uuid *,
char *, unsigned, unsigned);
extern int wlp_wss_enroll_activate(struct wlp_wss *, struct wlp_uuid *,
struct uwb_dev_addr *);
extern ssize_t wlp_discover(struct wlp *);
extern int wlp_enroll_neighbor(struct wlp *, struct wlp_neighbor_e *,
struct wlp_wss *, struct wlp_uuid *);
extern int wlp_wss_is_active(struct wlp *, struct wlp_wss *,
struct uwb_dev_addr *);
struct wlp_assoc_conn_ctx {
struct work_struct ws;
struct wlp *wlp;
struct sk_buff *skb;
struct wlp_eda_node eda_entry;
};
extern int wlp_wss_connect_prep(struct wlp *, struct wlp_eda_node *, void *);
extern int wlp_wss_send_copy(struct wlp *, struct wlp_eda_node *, void *);
/* Message handling */
struct wlp_assoc_frame_ctx {
struct work_struct ws;
struct wlp *wlp;
struct sk_buff *skb;
struct uwb_dev_addr src;
};
extern int wlp_wss_prep_hdr(struct wlp *, struct wlp_eda_node *, void *);
extern void wlp_handle_d1_frame(struct work_struct *);
extern int wlp_parse_d2_frame_to_cache(struct wlp *, struct sk_buff *,
struct wlp_neighbor_e *);
extern int wlp_parse_d2_frame_to_enroll(struct wlp_wss *, struct sk_buff *,
struct wlp_neighbor_e *,
struct wlp_uuid *);
extern void wlp_handle_c1_frame(struct work_struct *);
extern void wlp_handle_c3_frame(struct work_struct *);
extern int wlp_parse_c3c4_frame(struct wlp *, struct sk_buff *,
struct wlp_uuid *, u8 *,
struct uwb_mac_addr *);
extern int wlp_parse_f0(struct wlp *, struct sk_buff *);
extern int wlp_send_assoc_frame(struct wlp *, struct wlp_wss *,
struct uwb_dev_addr *, enum wlp_assoc_type);
extern ssize_t wlp_get_version(struct wlp *, struct wlp_attr_version *,
u8 *, ssize_t);
extern ssize_t wlp_get_wssid(struct wlp *, struct wlp_attr_wssid *,
struct wlp_uuid *, ssize_t);
extern int __wlp_alloc_device_info(struct wlp *);
extern int __wlp_setup_device_info(struct wlp *);
extern struct wlp_wss_attribute wss_attribute_properties;
extern struct wlp_wss_attribute wss_attribute_members;
extern struct wlp_wss_attribute wss_attribute_state;
static inline
size_t wlp_wss_uuid_print(char *buf, size_t bufsize, struct wlp_uuid *uuid)
{
size_t result;
result = scnprintf(buf, bufsize,
"%02x:%02x:%02x:%02x:%02x:%02x:"
"%02x:%02x:%02x:%02x:%02x:%02x:"
"%02x:%02x:%02x:%02x",
uuid->data[0], uuid->data[1],
uuid->data[2], uuid->data[3],
uuid->data[4], uuid->data[5],
uuid->data[6], uuid->data[7],
uuid->data[8], uuid->data[9],
uuid->data[10], uuid->data[11],
uuid->data[12], uuid->data[13],
uuid->data[14], uuid->data[15]);
return result;
}
/**
* FIXME: How should a nonce be displayed?
*/
static inline
size_t wlp_wss_nonce_print(char *buf, size_t bufsize, struct wlp_nonce *nonce)
{
size_t result;
result = scnprintf(buf, bufsize,
"%02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x",
nonce->data[0], nonce->data[1],
nonce->data[2], nonce->data[3],
nonce->data[4], nonce->data[5],
nonce->data[6], nonce->data[7],
nonce->data[8], nonce->data[9],
nonce->data[10], nonce->data[11],
nonce->data[12], nonce->data[13],
nonce->data[14], nonce->data[15]);
return result;
}
static inline
void wlp_session_cb(struct wlp *wlp)
{
struct completion *completion = wlp->session->cb_priv;
complete(completion);
}
static inline
int wlp_uuid_is_set(struct wlp_uuid *uuid)
{
struct wlp_uuid zero_uuid = { .data = { 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00} };
if (!memcmp(uuid, &zero_uuid, sizeof(*uuid)))
return 0;
return 1;
}
#endif /* __WLP_INTERNAL_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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