Lines Matching +full:queue +full:- +full:pkt +full:- +full:tx

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) ST-Ericsson AB 2011
23 MODULE_DESCRIPTION("ST-Ericsson CAIF modem protocol USB support");
28 #define CFUSB_MAX_HEADLEN (CFUSB_PAD_DESCR_SZ + CFUSB_ALIGNMENT-1)
29 #define STE_USB_VID 0x04cc /* USB Product ID for ST-Ericsson */
39 static int cfusbl_receive(struct cflayer *layr, struct cfpkt *pkt) in cfusbl_receive() argument
44 cfpkt_extr_head(pkt, &hpad, 1); in cfusbl_receive()
45 cfpkt_extr_head(pkt, NULL, hpad); in cfusbl_receive()
46 return layr->up->receive(layr->up, pkt); in cfusbl_receive()
49 static int cfusbl_transmit(struct cflayer *layr, struct cfpkt *pkt) in cfusbl_transmit() argument
57 skb = cfpkt_tonative(pkt); in cfusbl_transmit()
60 skb->protocol = htons(ETH_P_IP); in cfusbl_transmit()
62 info = cfpkt_info(pkt); in cfusbl_transmit()
63 hpad = (info->hdr_len + CFUSB_PAD_DESCR_SZ) & (CFUSB_ALIGNMENT - 1); in cfusbl_transmit()
68 return -EIO; in cfusbl_transmit()
72 cfpkt_add_head(pkt, zeros, hpad); in cfusbl_transmit()
73 cfpkt_add_head(pkt, &hpad, 1); in cfusbl_transmit()
74 cfpkt_add_head(pkt, usbl->tx_eth_hdr, sizeof(usbl->tx_eth_hdr)); in cfusbl_transmit()
75 return layr->dn->transmit(layr->dn, pkt); in cfusbl_transmit()
81 if (layr->up && layr->up->ctrlcmd) in cfusbl_ctrlcmd()
82 layr->up->ctrlcmd(layr->up, ctrl, layr->id); in cfusbl_ctrlcmd()
95 memset(&this->layer, 0, sizeof(this->layer)); in cfusbl_create()
96 this->layer.receive = cfusbl_receive; in cfusbl_create()
97 this->layer.transmit = cfusbl_transmit; in cfusbl_create()
98 this->layer.ctrlcmd = cfusbl_ctrlcmd; in cfusbl_create()
99 snprintf(this->layer.name, CAIF_LAYER_NAME_SZ, "usb%d", phyid); in cfusbl_create()
100 this->layer.id = phyid; in cfusbl_create()
103 * Construct TX ethernet header: in cfusbl_create()
104 * 0-5 destination address in cfusbl_create()
105 * 5-11 source address in cfusbl_create()
106 * 12-13 protocol type in cfusbl_create()
108 ether_addr_copy(&this->tx_eth_hdr[ETH_ALEN], braddr); in cfusbl_create()
109 ether_addr_copy(&this->tx_eth_hdr[ETH_ALEN], ethaddr); in cfusbl_create()
110 this->tx_eth_hdr[12] = cpu_to_be16(ETH_P_802_EX1) & 0xff; in cfusbl_create()
111 this->tx_eth_hdr[13] = (cpu_to_be16(ETH_P_802_EX1) >> 8) & 0xff; in cfusbl_create()
112 pr_debug("caif ethernet TX-header dst:%pM src:%pM type:%02x%02x\n", in cfusbl_create()
113 this->tx_eth_hdr, this->tx_eth_hdr + ETH_ALEN, in cfusbl_create()
114 this->tx_eth_hdr[12], this->tx_eth_hdr[13]); in cfusbl_create()
138 if (what == NETDEV_UNREGISTER && dev->reg_state >= NETREG_UNREGISTERED) in cfusbl_device_notify()
142 if (!(dev->dev.parent && dev->dev.parent->driver && in cfusbl_device_notify()
143 strcmp(dev->dev.parent->driver->name, "cdc_ncm") == 0)) in cfusbl_device_notify()
147 usbdev = usbnet->udev; in cfusbl_device_notify()
150 le16_to_cpu(usbdev->descriptor.idVendor), in cfusbl_device_notify()
151 le16_to_cpu(usbdev->descriptor.idProduct)); in cfusbl_device_notify()
154 if (!(le16_to_cpu(usbdev->descriptor.idVendor) == STE_USB_VID && in cfusbl_device_notify()
155 le16_to_cpu(usbdev->descriptor.idProduct) == STE_USB_PID_CAIF)) in cfusbl_device_notify()
173 link_support = cfusbl_create(dev->ifindex, dev->dev_addr, in cfusbl_device_notify()
174 dev->broadcast); in cfusbl_device_notify()
177 return -ENOMEM; in cfusbl_device_notify()
179 if (dev->num_tx_queues > 1) in cfusbl_device_notify()
180 pr_warn("USB device uses more than one tx queue\n"); in cfusbl_device_notify()
191 strscpy(layer->name, dev->name, sizeof(layer->name)); in cfusbl_device_notify()