Lines Matching refs:dev
45 struct usbnet *dev; member
54 static int cx82310_cmd(struct usbnet *dev, enum cx82310_cmd cmd, bool reply, in cx82310_cmd() argument
58 struct usb_device *udev = dev->udev; in cx82310_cmd()
74 netdev_err(dev->net, "send command %#x: error %d\n", in cx82310_cmd()
87 netdev_err(dev->net, "reply receive error %d\n", in cx82310_cmd()
95 netdev_err(dev->net, "no reply to command %#x\n", cmd); in cx82310_cmd()
100 netdev_err(dev->net, "got reply to command %#x, expected: %#x\n", in cx82310_cmd()
106 netdev_err(dev->net, "command %#x failed: %#x\n", cmd, in cx82310_cmd()
120 static int cx82310_enable_ethernet(struct usbnet *dev) in cx82310_enable_ethernet() argument
122 int ret = cx82310_cmd(dev, CMD_ETHERNET_MODE, true, "\x01", 1, NULL, 0); in cx82310_enable_ethernet()
125 netdev_err(dev->net, "unable to enable ethernet mode: %d\n", in cx82310_enable_ethernet()
134 cx82310_enable_ethernet(priv->dev); in cx82310_reenable_work()
141 static int cx82310_bind(struct usbnet *dev, struct usb_interface *intf) in cx82310_bind() argument
145 struct usb_device *udev = dev->udev; in cx82310_bind()
154 dev_info(&udev->dev, "ignoring: probably an ADSL modem\n"); in cx82310_bind()
158 ret = usbnet_get_endpoints(dev, intf); in cx82310_bind()
166 dev->net->hard_header_len = 0; in cx82310_bind()
168 dev->hard_mtu = CX82310_MTU + 2; in cx82310_bind()
170 dev->rx_urb_size = 4096; in cx82310_bind()
172 dev->partial_data = (unsigned long) kmalloc(dev->hard_mtu, GFP_KERNEL); in cx82310_bind()
173 if (!dev->partial_data) in cx82310_bind()
181 dev->driver_priv = priv; in cx82310_bind()
183 priv->dev = dev; in cx82310_bind()
187 ret = cx82310_cmd(dev, CMD_GET_LINK_STATUS, true, NULL, 0, in cx82310_bind()
195 netdev_err(dev->net, "firmware not ready in time\n"); in cx82310_bind()
201 ret = cx82310_enable_ethernet(dev); in cx82310_bind()
206 ret = cx82310_cmd(dev, CMD_GET_MAC_ADDR, true, NULL, 0, addr, ETH_ALEN); in cx82310_bind()
208 netdev_err(dev->net, "unable to read MAC address: %d\n", ret); in cx82310_bind()
211 eth_hw_addr_set(dev->net, addr); in cx82310_bind()
214 ret = cx82310_cmd(dev, CMD_START, false, NULL, 0, NULL, 0); in cx82310_bind()
220 kfree(dev->driver_priv); in cx82310_bind()
222 kfree((void *)dev->partial_data); in cx82310_bind()
226 static void cx82310_unbind(struct usbnet *dev, struct usb_interface *intf) in cx82310_unbind() argument
228 struct cx82310_priv *priv = dev->driver_priv; in cx82310_unbind()
230 kfree((void *)dev->partial_data); in cx82310_unbind()
232 kfree(dev->driver_priv); in cx82310_unbind()
243 static int cx82310_rx_fixup(struct usbnet *dev, struct sk_buff *skb) in cx82310_rx_fixup() argument
247 struct cx82310_priv *priv = dev->driver_priv; in cx82310_rx_fixup()
253 if (dev->partial_rem) { in cx82310_rx_fixup()
254 len = dev->partial_len + dev->partial_rem; in cx82310_rx_fixup()
259 memcpy(skb2->data, (void *)dev->partial_data, in cx82310_rx_fixup()
260 dev->partial_len); in cx82310_rx_fixup()
261 memcpy(skb2->data + dev->partial_len, skb->data, in cx82310_rx_fixup()
262 dev->partial_rem); in cx82310_rx_fixup()
263 usbnet_skb_return(dev, skb2); in cx82310_rx_fixup()
264 skb_pull(skb, (dev->partial_rem + 1) & ~1); in cx82310_rx_fixup()
265 dev->partial_rem = 0; in cx82310_rx_fixup()
283 netdev_info(dev->net, "router was rebooted, re-enabling ethernet mode"); in cx82310_rx_fixup()
286 netdev_err(dev->net, "RX packet too long: %d B\n", len); in cx82310_rx_fixup()
292 dev->partial_len = skb->len; in cx82310_rx_fixup()
293 dev->partial_rem = len - skb->len; in cx82310_rx_fixup()
294 memcpy((void *)dev->partial_data, skb->data, in cx82310_rx_fixup()
295 dev->partial_len); in cx82310_rx_fixup()
306 usbnet_skb_return(dev, skb2); in cx82310_rx_fixup()
316 static struct sk_buff *cx82310_tx_fixup(struct usbnet *dev, struct sk_buff *skb, in cx82310_tx_fixup() argument