diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2009-07-30 12:41:52 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-04 16:44:17 -0400 |
commit | 2a4901bcbe9c122bd56e1f6c337fcb4ad75fafb7 (patch) | |
tree | 428a5163b3d925d2d5b9a31c1e7d5bc6ecb149b6 /drivers/net | |
parent | 27b7b5c131a1df6701a96e10d1056de8e3b15aa9 (diff) |
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/usb/rndis_host.c | 50 | ||||
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 31 |
2 files changed, 54 insertions, 27 deletions
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 2232232b798..d032bba9bc4 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c | |||
@@ -65,6 +65,32 @@ void rndis_status(struct usbnet *dev, struct urb *urb) | |||
65 | EXPORT_SYMBOL_GPL(rndis_status); | 65 | EXPORT_SYMBOL_GPL(rndis_status); |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * RNDIS indicate messages. | ||
69 | */ | ||
70 | static void rndis_msg_indicate(struct usbnet *dev, struct rndis_indicate *msg, | ||
71 | int buflen) | ||
72 | { | ||
73 | struct cdc_state *info = (void *)&dev->data; | ||
74 | struct device *udev = &info->control->dev; | ||
75 | |||
76 | if (dev->driver_info->indication) { | ||
77 | dev->driver_info->indication(dev, msg, buflen); | ||
78 | } else { | ||
79 | switch (msg->status) { | ||
80 | case RNDIS_STATUS_MEDIA_CONNECT: | ||
81 | dev_info(udev, "rndis media connect\n"); | ||
82 | break; | ||
83 | case RNDIS_STATUS_MEDIA_DISCONNECT: | ||
84 | dev_info(udev, "rndis media disconnect\n"); | ||
85 | break; | ||
86 | default: | ||
87 | dev_info(udev, "rndis indication: 0x%08x\n", | ||
88 | le32_to_cpu(msg->status)); | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | |||
93 | /* | ||
68 | * RPC done RNDIS-style. Caller guarantees: | 94 | * RPC done RNDIS-style. Caller guarantees: |
69 | * - message is properly byteswapped | 95 | * - message is properly byteswapped |
70 | * - there's no other request pending | 96 | * - there's no other request pending |
@@ -143,27 +169,9 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) | |||
143 | request_id, xid); | 169 | request_id, xid); |
144 | /* then likely retry */ | 170 | /* then likely retry */ |
145 | } else switch (buf->msg_type) { | 171 | } else switch (buf->msg_type) { |
146 | case RNDIS_MSG_INDICATE: { /* fault/event */ | 172 | case RNDIS_MSG_INDICATE: /* fault/event */ |
147 | struct rndis_indicate *msg = (void *)buf; | 173 | rndis_msg_indicate(dev, (void *)buf, buflen); |
148 | int state = 0; | 174 | |
149 | |||
150 | switch (msg->status) { | ||
151 | case RNDIS_STATUS_MEDIA_CONNECT: | ||
152 | state = 1; | ||
153 | case RNDIS_STATUS_MEDIA_DISCONNECT: | ||
154 | dev_info(&info->control->dev, | ||
155 | "rndis media %sconnect\n", | ||
156 | !state?"dis":""); | ||
157 | if (dev->driver_info->link_change) | ||
158 | dev->driver_info->link_change( | ||
159 | dev, state); | ||
160 | break; | ||
161 | default: | ||
162 | dev_info(&info->control->dev, | ||
163 | "rndis indication: 0x%08x\n", | ||
164 | le32_to_cpu(msg->status)); | ||
165 | } | ||
166 | } | ||
167 | break; | 175 | break; |
168 | case RNDIS_MSG_KEEPALIVE: { /* ping */ | 176 | case RNDIS_MSG_KEEPALIVE: { /* ping */ |
169 | struct rndis_keepalive_c *msg = (void *)buf; | 177 | struct rndis_keepalive_c *msg = (void *)buf; |
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index f6dcbb168b7..6b6452b0e8c 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -2211,13 +2211,32 @@ static void rndis_wlan_set_multicast_list(struct net_device *dev) | |||
2211 | queue_work(priv->workqueue, &priv->work); | 2211 | queue_work(priv->workqueue, &priv->work); |
2212 | } | 2212 | } |
2213 | 2213 | ||
2214 | static void rndis_wlan_link_change(struct usbnet *usbdev, int state) | 2214 | static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen) |
2215 | { | 2215 | { |
2216 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); | 2216 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); |
2217 | struct rndis_indicate *msg = ind; | ||
2217 | 2218 | ||
2218 | /* queue work to avoid recursive calls into rndis_command */ | 2219 | /* queue work to avoid recursive calls into rndis_command */ |
2219 | set_bit(state ? WORK_LINK_UP : WORK_LINK_DOWN, &priv->work_pending); | 2220 | switch (msg->status) { |
2220 | queue_work(priv->workqueue, &priv->work); | 2221 | case RNDIS_STATUS_MEDIA_CONNECT: |
2222 | devinfo(usbdev, "media connect"); | ||
2223 | |||
2224 | set_bit(WORK_LINK_UP, &priv->work_pending); | ||
2225 | queue_work(priv->workqueue, &priv->work); | ||
2226 | break; | ||
2227 | |||
2228 | case RNDIS_STATUS_MEDIA_DISCONNECT: | ||
2229 | devinfo(usbdev, "media disconnect"); | ||
2230 | |||
2231 | set_bit(WORK_LINK_DOWN, &priv->work_pending); | ||
2232 | queue_work(priv->workqueue, &priv->work); | ||
2233 | break; | ||
2234 | |||
2235 | default: | ||
2236 | devinfo(usbdev, "indication: 0x%08x", | ||
2237 | le32_to_cpu(msg->status)); | ||
2238 | break; | ||
2239 | } | ||
2221 | } | 2240 | } |
2222 | 2241 | ||
2223 | 2242 | ||
@@ -2666,7 +2685,7 @@ static const struct driver_info bcm4320b_info = { | |||
2666 | .reset = rndis_wlan_reset, | 2685 | .reset = rndis_wlan_reset, |
2667 | .stop = rndis_wlan_stop, | 2686 | .stop = rndis_wlan_stop, |
2668 | .early_init = bcm4320b_early_init, | 2687 | .early_init = bcm4320b_early_init, |
2669 | .link_change = rndis_wlan_link_change, | 2688 | .indication = rndis_wlan_indication, |
2670 | }; | 2689 | }; |
2671 | 2690 | ||
2672 | static const struct driver_info bcm4320a_info = { | 2691 | static const struct driver_info bcm4320a_info = { |
@@ -2681,7 +2700,7 @@ static const struct driver_info bcm4320a_info = { | |||
2681 | .reset = rndis_wlan_reset, | 2700 | .reset = rndis_wlan_reset, |
2682 | .stop = rndis_wlan_stop, | 2701 | .stop = rndis_wlan_stop, |
2683 | .early_init = bcm4320a_early_init, | 2702 | .early_init = bcm4320a_early_init, |
2684 | .link_change = rndis_wlan_link_change, | 2703 | .indication = rndis_wlan_indication, |
2685 | }; | 2704 | }; |
2686 | 2705 | ||
2687 | static const struct driver_info rndis_wlan_info = { | 2706 | static const struct driver_info rndis_wlan_info = { |
@@ -2696,7 +2715,7 @@ static const struct driver_info rndis_wlan_info = { | |||
2696 | .reset = rndis_wlan_reset, | 2715 | .reset = rndis_wlan_reset, |
2697 | .stop = rndis_wlan_stop, | 2716 | .stop = rndis_wlan_stop, |
2698 | .early_init = bcm4320a_early_init, | 2717 | .early_init = bcm4320a_early_init, |
2699 | .link_change = rndis_wlan_link_change, | 2718 | .indication = rndis_wlan_indication, |
2700 | }; | 2719 | }; |
2701 | 2720 | ||
2702 | /*-------------------------------------------------------------------------*/ | 2721 | /*-------------------------------------------------------------------------*/ |