struct list_head list, info_list;
struct urb *urb;
struct r8152 *context;
+ struct page *page;
void *buffer;
- void *head;
};
struct tx_agg {
list_del(&agg->info_list);
usb_free_urb(agg->urb);
- kfree(agg->buffer);
+ __free_pages(agg->page, get_order(tp->rx_buf_sz));
kfree(agg);
atomic_dec(&tp->rx_count);
{
struct net_device *netdev = tp->netdev;
int node = netdev->dev.parent ? dev_to_node(netdev->dev.parent) : -1;
+ unsigned int order = get_order(tp->rx_buf_sz);
struct rx_agg *rx_agg;
unsigned long flags;
- u8 *buf;
rx_agg = kmalloc_node(sizeof(*rx_agg), mflags, node);
if (!rx_agg)
return NULL;
- buf = kmalloc_node(tp->rx_buf_sz, mflags, node);
- if (!buf)
+ rx_agg->page = alloc_pages(mflags, order);
+ if (!rx_agg->page)
goto free_rx;
- if (buf != rx_agg_align(buf)) {
- kfree(buf);
- buf = kmalloc_node(tp->rx_buf_sz + RX_ALIGN, mflags,
- node);
- if (!buf)
- goto free_rx;
- }
-
- rx_agg->buffer = buf;
- rx_agg->head = rx_agg_align(buf);
+ rx_agg->buffer = page_address(rx_agg->page);
rx_agg->urb = usb_alloc_urb(0, mflags);
if (!rx_agg->urb)
return rx_agg;
free_buf:
- kfree(rx_agg->buffer);
+ __free_pages(rx_agg->page, order);
free_rx:
kfree(rx_agg);
return NULL;
if (urb->actual_length < ETH_ZLEN)
goto submit;
- rx_desc = agg->head;
- rx_data = agg->head;
+ rx_desc = agg->buffer;
+ rx_data = agg->buffer;
len_used += sizeof(struct rx_desc);
while (urb->actual_length > len_used) {
find_next_rx:
rx_data = rx_agg_align(rx_data + pkt_len + ETH_FCS_LEN);
rx_desc = (struct rx_desc *)rx_data;
- len_used = (int)(rx_data - (u8 *)agg->head);
+ len_used = (int)(rx_data - (u8 *)agg->buffer);
len_used += sizeof(struct rx_desc);
}
return 0;
usb_fill_bulk_urb(agg->urb, tp->udev, usb_rcvbulkpipe(tp->udev, 1),
- agg->head, tp->rx_buf_sz,
+ agg->buffer, tp->rx_buf_sz,
(usb_complete_t)read_bulk_callback, agg);
ret = usb_submit_urb(agg->urb, mem_flags);