aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/rndis_host.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb/rndis_host.c')
-rw-r--r--drivers/net/usb/rndis_host.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 2232232b7989..d032bba9bc4c 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)
65EXPORT_SYMBOL_GPL(rndis_status); 65EXPORT_SYMBOL_GPL(rndis_status);
66 66
67/* 67/*
68 * RNDIS indicate messages.
69 */
70static 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;