rndis_host: allow rndis_wlan to see all indications

Allow rndis_wlan to see all indications. Currently rndis_host lets rndis_wlan to
know about link state changes only, but there is whole set of other
802.11-specific indications that rndis_wlan should handle properly. So rename
link_change() to indication() and convert rndis_wlan to use it.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Jussi Kivilinna 2009-07-30 19:41:52 +03:00 коммит произвёл John W. Linville
Родитель 27b7b5c131
Коммит 2a4901bcbe
3 изменённых файлов: 55 добавлений и 29 удалений

Просмотреть файл

@ -64,6 +64,32 @@ void rndis_status(struct usbnet *dev, struct urb *urb)
}
EXPORT_SYMBOL_GPL(rndis_status);
/*
* RNDIS indicate messages.
*/
static void rndis_msg_indicate(struct usbnet *dev, struct rndis_indicate *msg,
int buflen)
{
struct cdc_state *info = (void *)&dev->data;
struct device *udev = &info->control->dev;
if (dev->driver_info->indication) {
dev->driver_info->indication(dev, msg, buflen);
} else {
switch (msg->status) {
case RNDIS_STATUS_MEDIA_CONNECT:
dev_info(udev, "rndis media connect\n");
break;
case RNDIS_STATUS_MEDIA_DISCONNECT:
dev_info(udev, "rndis media disconnect\n");
break;
default:
dev_info(udev, "rndis indication: 0x%08x\n",
le32_to_cpu(msg->status));
}
}
}
/*
* RPC done RNDIS-style. Caller guarantees:
* - message is properly byteswapped
@ -143,27 +169,9 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
request_id, xid);
/* then likely retry */
} else switch (buf->msg_type) {
case RNDIS_MSG_INDICATE: { /* fault/event */
struct rndis_indicate *msg = (void *)buf;
int state = 0;
case RNDIS_MSG_INDICATE: /* fault/event */
rndis_msg_indicate(dev, (void *)buf, buflen);
switch (msg->status) {
case RNDIS_STATUS_MEDIA_CONNECT:
state = 1;
case RNDIS_STATUS_MEDIA_DISCONNECT:
dev_info(&info->control->dev,
"rndis media %sconnect\n",
!state?"dis":"");
if (dev->driver_info->link_change)
dev->driver_info->link_change(
dev, state);
break;
default:
dev_info(&info->control->dev,
"rndis indication: 0x%08x\n",
le32_to_cpu(msg->status));
}
}
break;
case RNDIS_MSG_KEEPALIVE: { /* ping */
struct rndis_keepalive_c *msg = (void *)buf;

Просмотреть файл

@ -2211,13 +2211,32 @@ static void rndis_wlan_set_multicast_list(struct net_device *dev)
queue_work(priv->workqueue, &priv->work);
}
static void rndis_wlan_link_change(struct usbnet *usbdev, int state)
static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen)
{
struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
struct rndis_indicate *msg = ind;
/* queue work to avoid recursive calls into rndis_command */
set_bit(state ? WORK_LINK_UP : WORK_LINK_DOWN, &priv->work_pending);
queue_work(priv->workqueue, &priv->work);
switch (msg->status) {
case RNDIS_STATUS_MEDIA_CONNECT:
devinfo(usbdev, "media connect");
set_bit(WORK_LINK_UP, &priv->work_pending);
queue_work(priv->workqueue, &priv->work);
break;
case RNDIS_STATUS_MEDIA_DISCONNECT:
devinfo(usbdev, "media disconnect");
set_bit(WORK_LINK_DOWN, &priv->work_pending);
queue_work(priv->workqueue, &priv->work);
break;
default:
devinfo(usbdev, "indication: 0x%08x",
le32_to_cpu(msg->status));
break;
}
}
@ -2666,7 +2685,7 @@ static const struct driver_info bcm4320b_info = {
.reset = rndis_wlan_reset,
.stop = rndis_wlan_stop,
.early_init = bcm4320b_early_init,
.link_change = rndis_wlan_link_change,
.indication = rndis_wlan_indication,
};
static const struct driver_info bcm4320a_info = {
@ -2681,7 +2700,7 @@ static const struct driver_info bcm4320a_info = {
.reset = rndis_wlan_reset,
.stop = rndis_wlan_stop,
.early_init = bcm4320a_early_init,
.link_change = rndis_wlan_link_change,
.indication = rndis_wlan_indication,
};
static const struct driver_info rndis_wlan_info = {
@ -2696,7 +2715,7 @@ static const struct driver_info rndis_wlan_info = {
.reset = rndis_wlan_reset,
.stop = rndis_wlan_stop,
.early_init = bcm4320a_early_init,
.link_change = rndis_wlan_link_change,
.indication = rndis_wlan_indication,
};
/*-------------------------------------------------------------------------*/

Просмотреть файл

@ -122,9 +122,8 @@ struct driver_info {
* right after minidriver have initialized hardware. */
int (*early_init)(struct usbnet *dev);
/* called by minidriver when link state changes, state: 0=disconnect,
* 1=connect */
void (*link_change)(struct usbnet *dev, int state);
/* called by minidriver when receiving indication */
void (*indication)(struct usbnet *dev, void *ind, int indlen);
/* for new devices, use the descriptor-reading code instead */
int in; /* rx endpoint */