14 #include <linux/slab.h>
19 static void packet_came(
struct ieee80211_hw *
hw,
char *pRxBufferAddress,
int PacketSize)
28 skb = dev_alloc_skb(PacketSize);
30 printk(
"Not enough memory for packet, FIXME\n");
34 memcpy(
skb_put(skb, PacketSize), pRxBufferAddress, PacketSize);
36 memcpy(IEEE80211_SKB_RXCB(skb), &rx_status,
sizeof(rx_status));
42 u32 *pRxBufferAddress;
47 DecryptionMethod = pRxDes->
R01.R01_decryption_method;
55 if (DecryptionMethod == 3)
59 if (DecryptionMethod == 1) {
60 for (i = 6; i > 0; i--)
61 pRxBufferAddress[i] = pRxBufferAddress[i - 1];
64 }
else if (DecryptionMethod) {
65 for (i = 7; i > 1; i--)
66 pRxBufferAddress[i] = pRxBufferAddress[i - 2];
87 if (pWb35Rx->
RxOwner[RxBufferId])
93 pRxBufferAddress = pWb35Rx->
pDRx;
97 while (BufferSize >= 4) {
103 PacketSize = (
u16)RxDes.R00.R00_receive_byte_count;
106 if ((PacketSize & 0x03) > 0)
111 pr_debug(
"Serious ERROR : Rx data size too long, size =%d\n", PacketSize);
122 pRxBufferAddress += 8;
124 RxDes.buffer_address[0] = pRxBufferAddress;
126 RxDes.buffer_number = 1;
127 RxDes.buffer_start_index = 0;
128 RxDes.buffer_total_size = RxDes.buffer_size[0];
129 Wb35Rx_adjust(&RxDes);
131 packet_came(hw, pRxBufferAddress, PacketSize);
134 stmp = PacketSize + 3;
136 pRxBufferAddress += stmp;
149 static void Wb35Rx_Complete(
struct urb *
urb)
155 u8 *pRxBufferAddress;
167 pRxBufferAddress = pWb35Rx->
pDRx;
168 BulkLength = (
u16)urb->actual_length;
180 pWb35Rx->
RxOwner[RxBufferId] = 0;
185 pr_debug(
"EP3 IoCompleteRoutine return error\n");
192 SizeCheck =
R00.R00_receive_byte_count;
193 if ((SizeCheck & 0x03) > 0)
195 SizeCheck = (SizeCheck + 3) & ~0x03;
197 if ((BulkLength > 1600) ||
198 (SizeCheck > 1600) ||
199 (BulkLength != SizeCheck) ||
210 if (!pWb35Rx->
RxOwner[RxBufferId])
219 pWb35Rx->
RxOwner[RxBufferId] = 1;
230 u8 *pRxBufferAddress;
231 struct urb *urb = pWb35Rx->
RxUrb;
244 if (!pWb35Rx->
RxOwner[RxBufferId]) {
246 pr_debug(
"Rx driver fifo unavailable\n");
257 if (!pWb35Rx->
pDRx) {
258 printk(
"w35und: Rx memory alloc failed\n");
261 pRxBufferAddress = pWb35Rx->
pDRx;
263 usb_fill_bulk_urb(urb, pHwData->
udev,
264 usb_rcvbulkpipe(pHwData->
udev, 3),
266 Wb35Rx_Complete, hw);
273 printk(
"Rx URB sending error\n");
298 static void Wb35Rx_reset_descriptor(
struct hw_data *pHwData)
319 Wb35Rx_reset_descriptor(pHwData);
322 return !!pWb35Rx->
RxUrb;