Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | * Driver for Solarflare Solarstorm network controllers and boards |
| 3 | * Copyright 2005-2006 Fen Systems Ltd. |
Ben Hutchings | 906bb26 | 2009-11-29 15:16:19 +0000 | [diff] [blame] | 4 | * Copyright 2005-2009 Solarflare Communications Inc. |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License version 2 as published |
| 8 | * by the Free Software Foundation, incorporated herein by reference. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/socket.h> |
| 12 | #include <linux/in.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 13 | #include <linux/slab.h> |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 14 | #include <linux/ip.h> |
| 15 | #include <linux/tcp.h> |
| 16 | #include <linux/udp.h> |
| 17 | #include <net/ip.h> |
| 18 | #include <net/checksum.h> |
| 19 | #include "net_driver.h" |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 20 | #include "efx.h" |
Ben Hutchings | 744093c | 2009-11-29 15:12:08 +0000 | [diff] [blame] | 21 | #include "nic.h" |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 22 | #include "selftest.h" |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 23 | #include "workarounds.h" |
| 24 | |
| 25 | /* Number of RX descriptors pushed at once. */ |
| 26 | #define EFX_RX_BATCH 8 |
| 27 | |
| 28 | /* Size of buffer allocated for skb header area. */ |
| 29 | #define EFX_SKB_HEADERS 64u |
| 30 | |
| 31 | /* |
| 32 | * rx_alloc_method - RX buffer allocation method |
| 33 | * |
| 34 | * This driver supports two methods for allocating and using RX buffers: |
| 35 | * each RX buffer may be backed by an skb or by an order-n page. |
| 36 | * |
| 37 | * When LRO is in use then the second method has a lower overhead, |
| 38 | * since we don't have to allocate then free skbs on reassembled frames. |
| 39 | * |
| 40 | * Values: |
| 41 | * - RX_ALLOC_METHOD_AUTO = 0 |
| 42 | * - RX_ALLOC_METHOD_SKB = 1 |
| 43 | * - RX_ALLOC_METHOD_PAGE = 2 |
| 44 | * |
| 45 | * The heuristic for %RX_ALLOC_METHOD_AUTO is a simple hysteresis count |
| 46 | * controlled by the parameters below. |
| 47 | * |
| 48 | * - Since pushing and popping descriptors are separated by the rx_queue |
| 49 | * size, so the watermarks should be ~rxd_size. |
| 50 | * - The performance win by using page-based allocation for LRO is less |
| 51 | * than the performance hit of using page-based allocation of non-LRO, |
| 52 | * so the watermarks should reflect this. |
| 53 | * |
| 54 | * Per channel we maintain a single variable, updated by each channel: |
| 55 | * |
| 56 | * rx_alloc_level += (lro_performed ? RX_ALLOC_FACTOR_LRO : |
| 57 | * RX_ALLOC_FACTOR_SKB) |
| 58 | * Per NAPI poll interval, we constrain rx_alloc_level to 0..MAX (which |
| 59 | * limits the hysteresis), and update the allocation strategy: |
| 60 | * |
| 61 | * rx_alloc_method = (rx_alloc_level > RX_ALLOC_LEVEL_LRO ? |
| 62 | * RX_ALLOC_METHOD_PAGE : RX_ALLOC_METHOD_SKB) |
| 63 | */ |
Ben Hutchings | c3c6336 | 2009-10-29 07:21:33 +0000 | [diff] [blame] | 64 | static int rx_alloc_method = RX_ALLOC_METHOD_AUTO; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 65 | |
| 66 | #define RX_ALLOC_LEVEL_LRO 0x2000 |
| 67 | #define RX_ALLOC_LEVEL_MAX 0x3000 |
| 68 | #define RX_ALLOC_FACTOR_LRO 1 |
| 69 | #define RX_ALLOC_FACTOR_SKB (-2) |
| 70 | |
| 71 | /* This is the percentage fill level below which new RX descriptors |
| 72 | * will be added to the RX descriptor ring. |
| 73 | */ |
| 74 | static unsigned int rx_refill_threshold = 90; |
| 75 | |
| 76 | /* This is the percentage fill level to which an RX queue will be refilled |
| 77 | * when the "RX refill threshold" is reached. |
| 78 | */ |
| 79 | static unsigned int rx_refill_limit = 95; |
| 80 | |
| 81 | /* |
| 82 | * RX maximum head room required. |
| 83 | * |
| 84 | * This must be at least 1 to prevent overflow and at least 2 to allow |
| 85 | * pipelined receives. |
| 86 | */ |
| 87 | #define EFX_RXD_HEAD_ROOM 2 |
| 88 | |
Ben Hutchings | 5566861 | 2008-05-16 21:16:10 +0100 | [diff] [blame] | 89 | static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf) |
| 90 | { |
| 91 | /* Offset is always within one page, so we don't need to consider |
| 92 | * the page order. |
| 93 | */ |
Ben Hutchings | 184be0c | 2008-05-16 21:16:31 +0100 | [diff] [blame] | 94 | return (__force unsigned long) buf->data & (PAGE_SIZE - 1); |
Ben Hutchings | 5566861 | 2008-05-16 21:16:10 +0100 | [diff] [blame] | 95 | } |
| 96 | static inline unsigned int efx_rx_buf_size(struct efx_nic *efx) |
| 97 | { |
| 98 | return PAGE_SIZE << efx->rx_buffer_order; |
| 99 | } |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 100 | |
| 101 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 102 | /** |
| 103 | * efx_init_rx_buffer_skb - create new RX buffer using skb-based allocation |
| 104 | * |
| 105 | * @rx_queue: Efx RX queue |
| 106 | * @rx_buf: RX buffer structure to populate |
| 107 | * |
| 108 | * This allocates memory for a new receive buffer, maps it for DMA, |
| 109 | * and populates a struct efx_rx_buffer with the relevant |
| 110 | * information. Return a negative error code or 0 on success. |
| 111 | */ |
Ben Hutchings | 4d56606 | 2008-09-01 12:47:12 +0100 | [diff] [blame] | 112 | static int efx_init_rx_buffer_skb(struct efx_rx_queue *rx_queue, |
| 113 | struct efx_rx_buffer *rx_buf) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 114 | { |
| 115 | struct efx_nic *efx = rx_queue->efx; |
| 116 | struct net_device *net_dev = efx->net_dev; |
| 117 | int skb_len = efx->rx_buffer_len; |
| 118 | |
| 119 | rx_buf->skb = netdev_alloc_skb(net_dev, skb_len); |
| 120 | if (unlikely(!rx_buf->skb)) |
| 121 | return -ENOMEM; |
| 122 | |
| 123 | /* Adjust the SKB for padding and checksum */ |
| 124 | skb_reserve(rx_buf->skb, NET_IP_ALIGN); |
| 125 | rx_buf->len = skb_len - NET_IP_ALIGN; |
| 126 | rx_buf->data = (char *)rx_buf->skb->data; |
| 127 | rx_buf->skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 128 | |
| 129 | rx_buf->dma_addr = pci_map_single(efx->pci_dev, |
| 130 | rx_buf->data, rx_buf->len, |
| 131 | PCI_DMA_FROMDEVICE); |
| 132 | |
FUJITA Tomonori | 8d8bb39 | 2008-07-25 19:44:49 -0700 | [diff] [blame] | 133 | if (unlikely(pci_dma_mapping_error(efx->pci_dev, rx_buf->dma_addr))) { |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 134 | dev_kfree_skb_any(rx_buf->skb); |
| 135 | rx_buf->skb = NULL; |
| 136 | return -EIO; |
| 137 | } |
| 138 | |
| 139 | return 0; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * efx_init_rx_buffer_page - create new RX buffer using page-based allocation |
| 144 | * |
| 145 | * @rx_queue: Efx RX queue |
| 146 | * @rx_buf: RX buffer structure to populate |
| 147 | * |
| 148 | * This allocates memory for a new receive buffer, maps it for DMA, |
| 149 | * and populates a struct efx_rx_buffer with the relevant |
| 150 | * information. Return a negative error code or 0 on success. |
| 151 | */ |
Ben Hutchings | 4d56606 | 2008-09-01 12:47:12 +0100 | [diff] [blame] | 152 | static int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue, |
| 153 | struct efx_rx_buffer *rx_buf) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 154 | { |
| 155 | struct efx_nic *efx = rx_queue->efx; |
| 156 | int bytes, space, offset; |
| 157 | |
| 158 | bytes = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN; |
| 159 | |
| 160 | /* If there is space left in the previously allocated page, |
| 161 | * then use it. Otherwise allocate a new one */ |
| 162 | rx_buf->page = rx_queue->buf_page; |
| 163 | if (rx_buf->page == NULL) { |
| 164 | dma_addr_t dma_addr; |
| 165 | |
| 166 | rx_buf->page = alloc_pages(__GFP_COLD | __GFP_COMP | GFP_ATOMIC, |
| 167 | efx->rx_buffer_order); |
| 168 | if (unlikely(rx_buf->page == NULL)) |
| 169 | return -ENOMEM; |
| 170 | |
| 171 | dma_addr = pci_map_page(efx->pci_dev, rx_buf->page, |
Ben Hutchings | 5566861 | 2008-05-16 21:16:10 +0100 | [diff] [blame] | 172 | 0, efx_rx_buf_size(efx), |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 173 | PCI_DMA_FROMDEVICE); |
| 174 | |
FUJITA Tomonori | 8d8bb39 | 2008-07-25 19:44:49 -0700 | [diff] [blame] | 175 | if (unlikely(pci_dma_mapping_error(efx->pci_dev, dma_addr))) { |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 176 | __free_pages(rx_buf->page, efx->rx_buffer_order); |
| 177 | rx_buf->page = NULL; |
| 178 | return -EIO; |
| 179 | } |
| 180 | |
| 181 | rx_queue->buf_page = rx_buf->page; |
| 182 | rx_queue->buf_dma_addr = dma_addr; |
Ben Hutchings | d3208b5 | 2008-05-16 21:20:00 +0100 | [diff] [blame] | 183 | rx_queue->buf_data = (page_address(rx_buf->page) + |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 184 | EFX_PAGE_IP_ALIGN); |
| 185 | } |
| 186 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 187 | rx_buf->len = bytes; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 188 | rx_buf->data = rx_queue->buf_data; |
Ben Hutchings | 184be0c | 2008-05-16 21:16:31 +0100 | [diff] [blame] | 189 | offset = efx_rx_buf_offset(rx_buf); |
| 190 | rx_buf->dma_addr = rx_queue->buf_dma_addr + offset; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 191 | |
| 192 | /* Try to pack multiple buffers per page */ |
| 193 | if (efx->rx_buffer_order == 0) { |
| 194 | /* The next buffer starts on the next 512 byte boundary */ |
| 195 | rx_queue->buf_data += ((bytes + 0x1ff) & ~0x1ff); |
| 196 | offset += ((bytes + 0x1ff) & ~0x1ff); |
| 197 | |
Ben Hutchings | 5566861 | 2008-05-16 21:16:10 +0100 | [diff] [blame] | 198 | space = efx_rx_buf_size(efx) - offset; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 199 | if (space >= bytes) { |
| 200 | /* Refs dropped on kernel releasing each skb */ |
| 201 | get_page(rx_queue->buf_page); |
| 202 | goto out; |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | /* This is the final RX buffer for this page, so mark it for |
| 207 | * unmapping */ |
| 208 | rx_queue->buf_page = NULL; |
| 209 | rx_buf->unmap_addr = rx_queue->buf_dma_addr; |
| 210 | |
| 211 | out: |
| 212 | return 0; |
| 213 | } |
| 214 | |
| 215 | /* This allocates memory for a new receive buffer, maps it for DMA, |
| 216 | * and populates a struct efx_rx_buffer with the relevant |
| 217 | * information. |
| 218 | */ |
Ben Hutchings | 4d56606 | 2008-09-01 12:47:12 +0100 | [diff] [blame] | 219 | static int efx_init_rx_buffer(struct efx_rx_queue *rx_queue, |
| 220 | struct efx_rx_buffer *new_rx_buf) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 221 | { |
| 222 | int rc = 0; |
| 223 | |
| 224 | if (rx_queue->channel->rx_alloc_push_pages) { |
| 225 | new_rx_buf->skb = NULL; |
| 226 | rc = efx_init_rx_buffer_page(rx_queue, new_rx_buf); |
| 227 | rx_queue->alloc_page_count++; |
| 228 | } else { |
| 229 | new_rx_buf->page = NULL; |
| 230 | rc = efx_init_rx_buffer_skb(rx_queue, new_rx_buf); |
| 231 | rx_queue->alloc_skb_count++; |
| 232 | } |
| 233 | |
| 234 | if (unlikely(rc < 0)) |
| 235 | EFX_LOG_RL(rx_queue->efx, "%s RXQ[%d] =%d\n", __func__, |
| 236 | rx_queue->queue, rc); |
| 237 | return rc; |
| 238 | } |
| 239 | |
Ben Hutchings | 4d56606 | 2008-09-01 12:47:12 +0100 | [diff] [blame] | 240 | static void efx_unmap_rx_buffer(struct efx_nic *efx, |
| 241 | struct efx_rx_buffer *rx_buf) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 242 | { |
| 243 | if (rx_buf->page) { |
| 244 | EFX_BUG_ON_PARANOID(rx_buf->skb); |
| 245 | if (rx_buf->unmap_addr) { |
| 246 | pci_unmap_page(efx->pci_dev, rx_buf->unmap_addr, |
Ben Hutchings | 5566861 | 2008-05-16 21:16:10 +0100 | [diff] [blame] | 247 | efx_rx_buf_size(efx), |
| 248 | PCI_DMA_FROMDEVICE); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 249 | rx_buf->unmap_addr = 0; |
| 250 | } |
| 251 | } else if (likely(rx_buf->skb)) { |
| 252 | pci_unmap_single(efx->pci_dev, rx_buf->dma_addr, |
| 253 | rx_buf->len, PCI_DMA_FROMDEVICE); |
| 254 | } |
| 255 | } |
| 256 | |
Ben Hutchings | 4d56606 | 2008-09-01 12:47:12 +0100 | [diff] [blame] | 257 | static void efx_free_rx_buffer(struct efx_nic *efx, |
| 258 | struct efx_rx_buffer *rx_buf) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 259 | { |
| 260 | if (rx_buf->page) { |
| 261 | __free_pages(rx_buf->page, efx->rx_buffer_order); |
| 262 | rx_buf->page = NULL; |
| 263 | } else if (likely(rx_buf->skb)) { |
| 264 | dev_kfree_skb_any(rx_buf->skb); |
| 265 | rx_buf->skb = NULL; |
| 266 | } |
| 267 | } |
| 268 | |
Ben Hutchings | 4d56606 | 2008-09-01 12:47:12 +0100 | [diff] [blame] | 269 | static void efx_fini_rx_buffer(struct efx_rx_queue *rx_queue, |
| 270 | struct efx_rx_buffer *rx_buf) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 271 | { |
| 272 | efx_unmap_rx_buffer(rx_queue->efx, rx_buf); |
| 273 | efx_free_rx_buffer(rx_queue->efx, rx_buf); |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * efx_fast_push_rx_descriptors - push new RX descriptors quickly |
| 278 | * @rx_queue: RX descriptor queue |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 279 | * This will aim to fill the RX descriptor queue up to |
| 280 | * @rx_queue->@fast_fill_limit. If there is insufficient atomic |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 281 | * memory to do so, a slow fill will be scheduled. |
| 282 | * |
| 283 | * The caller must provide serialisation (none is used here). In practise, |
| 284 | * this means this function must run from the NAPI handler, or be called |
| 285 | * when NAPI is disabled. |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 286 | */ |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 287 | void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 288 | { |
| 289 | struct efx_rx_buffer *rx_buf; |
| 290 | unsigned fill_level, index; |
| 291 | int i, space, rc = 0; |
| 292 | |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 293 | /* Calculate current fill level, and exit if we don't need to fill */ |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 294 | fill_level = (rx_queue->added_count - rx_queue->removed_count); |
Ben Hutchings | 3ffeabd | 2009-10-23 08:30:58 +0000 | [diff] [blame] | 295 | EFX_BUG_ON_PARANOID(fill_level > EFX_RXQ_SIZE); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 296 | if (fill_level >= rx_queue->fast_fill_trigger) |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 297 | return; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 298 | |
| 299 | /* Record minimum fill level */ |
Ben Hutchings | b347564 | 2008-05-16 21:15:49 +0100 | [diff] [blame] | 300 | if (unlikely(fill_level < rx_queue->min_fill)) { |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 301 | if (fill_level) |
| 302 | rx_queue->min_fill = fill_level; |
Ben Hutchings | b347564 | 2008-05-16 21:15:49 +0100 | [diff] [blame] | 303 | } |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 304 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 305 | space = rx_queue->fast_fill_limit - fill_level; |
| 306 | if (space < EFX_RX_BATCH) |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 307 | return; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 308 | |
| 309 | EFX_TRACE(rx_queue->efx, "RX queue %d fast-filling descriptor ring from" |
| 310 | " level %d to level %d using %s allocation\n", |
| 311 | rx_queue->queue, fill_level, rx_queue->fast_fill_limit, |
| 312 | rx_queue->channel->rx_alloc_push_pages ? "page" : "skb"); |
| 313 | |
| 314 | do { |
| 315 | for (i = 0; i < EFX_RX_BATCH; ++i) { |
Ben Hutchings | 3ffeabd | 2009-10-23 08:30:58 +0000 | [diff] [blame] | 316 | index = rx_queue->added_count & EFX_RXQ_MASK; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 317 | rx_buf = efx_rx_buffer(rx_queue, index); |
| 318 | rc = efx_init_rx_buffer(rx_queue, rx_buf); |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 319 | if (unlikely(rc)) { |
| 320 | /* Ensure that we don't leave the rx queue |
| 321 | * empty */ |
| 322 | if (rx_queue->added_count == rx_queue->removed_count) |
| 323 | efx_schedule_slow_fill(rx_queue); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 324 | goto out; |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 325 | } |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 326 | ++rx_queue->added_count; |
| 327 | } |
| 328 | } while ((space -= EFX_RX_BATCH) >= EFX_RX_BATCH); |
| 329 | |
| 330 | EFX_TRACE(rx_queue->efx, "RX queue %d fast-filled descriptor ring " |
| 331 | "to level %d\n", rx_queue->queue, |
| 332 | rx_queue->added_count - rx_queue->removed_count); |
| 333 | |
| 334 | out: |
| 335 | /* Send write pointer to card. */ |
Ben Hutchings | 152b6a6 | 2009-11-29 03:43:56 +0000 | [diff] [blame] | 336 | efx_nic_notify_rx_desc(rx_queue); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 337 | } |
| 338 | |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 339 | void efx_rx_slow_fill(unsigned long context) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 340 | { |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 341 | struct efx_rx_queue *rx_queue = (struct efx_rx_queue *)context; |
| 342 | struct efx_channel *channel = rx_queue->channel; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 343 | |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 344 | /* Post an event to cause NAPI to run and refill the queue */ |
| 345 | efx_nic_generate_fill_event(channel); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 346 | ++rx_queue->slow_fill_count; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 347 | } |
| 348 | |
Ben Hutchings | 4d56606 | 2008-09-01 12:47:12 +0100 | [diff] [blame] | 349 | static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue, |
| 350 | struct efx_rx_buffer *rx_buf, |
| 351 | int len, bool *discard, |
| 352 | bool *leak_packet) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 353 | { |
| 354 | struct efx_nic *efx = rx_queue->efx; |
| 355 | unsigned max_len = rx_buf->len - efx->type->rx_buffer_padding; |
| 356 | |
| 357 | if (likely(len <= max_len)) |
| 358 | return; |
| 359 | |
| 360 | /* The packet must be discarded, but this is only a fatal error |
| 361 | * if the caller indicated it was |
| 362 | */ |
Ben Hutchings | dc8cfa5 | 2008-09-01 12:46:50 +0100 | [diff] [blame] | 363 | *discard = true; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 364 | |
| 365 | if ((len > rx_buf->len) && EFX_WORKAROUND_8071(efx)) { |
| 366 | EFX_ERR_RL(efx, " RX queue %d seriously overlength " |
| 367 | "RX event (0x%x > 0x%x+0x%x). Leaking\n", |
| 368 | rx_queue->queue, len, max_len, |
| 369 | efx->type->rx_buffer_padding); |
| 370 | /* If this buffer was skb-allocated, then the meta |
| 371 | * data at the end of the skb will be trashed. So |
| 372 | * we have no choice but to leak the fragment. |
| 373 | */ |
| 374 | *leak_packet = (rx_buf->skb != NULL); |
| 375 | efx_schedule_reset(efx, RESET_TYPE_RX_RECOVERY); |
| 376 | } else { |
| 377 | EFX_ERR_RL(efx, " RX queue %d overlength RX event " |
| 378 | "(0x%x > 0x%x)\n", rx_queue->queue, len, max_len); |
| 379 | } |
| 380 | |
| 381 | rx_queue->channel->n_rx_overlength++; |
| 382 | } |
| 383 | |
| 384 | /* Pass a received packet up through the generic LRO stack |
| 385 | * |
| 386 | * Handles driverlink veto, and passes the fragment up via |
| 387 | * the appropriate LRO method |
| 388 | */ |
Ben Hutchings | 4d56606 | 2008-09-01 12:47:12 +0100 | [diff] [blame] | 389 | static void efx_rx_packet_lro(struct efx_channel *channel, |
Ben Hutchings | 345056a | 2009-10-28 03:43:49 -0700 | [diff] [blame] | 390 | struct efx_rx_buffer *rx_buf, |
| 391 | bool checksummed) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 392 | { |
Herbert Xu | da3bc07 | 2009-01-18 21:50:16 -0800 | [diff] [blame] | 393 | struct napi_struct *napi = &channel->napi_str; |
Ben Hutchings | 18e1d2b | 2009-10-29 07:21:24 +0000 | [diff] [blame] | 394 | gro_result_t gro_result; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 395 | |
| 396 | /* Pass the skb/page into the LRO engine */ |
| 397 | if (rx_buf->page) { |
Ben Hutchings | 1241e95 | 2009-11-23 16:02:25 +0000 | [diff] [blame] | 398 | struct page *page = rx_buf->page; |
| 399 | struct sk_buff *skb; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 400 | |
Ben Hutchings | 1241e95 | 2009-11-23 16:02:25 +0000 | [diff] [blame] | 401 | EFX_BUG_ON_PARANOID(rx_buf->skb); |
| 402 | rx_buf->page = NULL; |
| 403 | |
| 404 | skb = napi_get_frags(napi); |
Herbert Xu | 76620aa | 2009-04-16 02:02:07 -0700 | [diff] [blame] | 405 | if (!skb) { |
Ben Hutchings | 1241e95 | 2009-11-23 16:02:25 +0000 | [diff] [blame] | 406 | put_page(page); |
| 407 | return; |
Herbert Xu | 76620aa | 2009-04-16 02:02:07 -0700 | [diff] [blame] | 408 | } |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 409 | |
Ben Hutchings | 1241e95 | 2009-11-23 16:02:25 +0000 | [diff] [blame] | 410 | skb_shinfo(skb)->frags[0].page = page; |
Herbert Xu | 76620aa | 2009-04-16 02:02:07 -0700 | [diff] [blame] | 411 | skb_shinfo(skb)->frags[0].page_offset = |
| 412 | efx_rx_buf_offset(rx_buf); |
| 413 | skb_shinfo(skb)->frags[0].size = rx_buf->len; |
| 414 | skb_shinfo(skb)->nr_frags = 1; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 415 | |
Herbert Xu | 76620aa | 2009-04-16 02:02:07 -0700 | [diff] [blame] | 416 | skb->len = rx_buf->len; |
| 417 | skb->data_len = rx_buf->len; |
| 418 | skb->truesize += rx_buf->len; |
Ben Hutchings | 345056a | 2009-10-28 03:43:49 -0700 | [diff] [blame] | 419 | skb->ip_summed = |
| 420 | checksummed ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE; |
Herbert Xu | 76620aa | 2009-04-16 02:02:07 -0700 | [diff] [blame] | 421 | |
Ben Hutchings | 3eadb7b | 2009-11-23 16:02:40 +0000 | [diff] [blame] | 422 | skb_record_rx_queue(skb, channel->channel); |
| 423 | |
Ben Hutchings | 18e1d2b | 2009-10-29 07:21:24 +0000 | [diff] [blame] | 424 | gro_result = napi_gro_frags(napi); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 425 | } else { |
Ben Hutchings | 1241e95 | 2009-11-23 16:02:25 +0000 | [diff] [blame] | 426 | struct sk_buff *skb = rx_buf->skb; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 427 | |
Ben Hutchings | 1241e95 | 2009-11-23 16:02:25 +0000 | [diff] [blame] | 428 | EFX_BUG_ON_PARANOID(!skb); |
| 429 | EFX_BUG_ON_PARANOID(!checksummed); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 430 | rx_buf->skb = NULL; |
Ben Hutchings | 1241e95 | 2009-11-23 16:02:25 +0000 | [diff] [blame] | 431 | |
| 432 | gro_result = napi_gro_receive(napi, skb); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 433 | } |
Ben Hutchings | 18e1d2b | 2009-10-29 07:21:24 +0000 | [diff] [blame] | 434 | |
| 435 | if (gro_result == GRO_NORMAL) { |
| 436 | channel->rx_alloc_level += RX_ALLOC_FACTOR_SKB; |
| 437 | } else if (gro_result != GRO_DROP) { |
| 438 | channel->rx_alloc_level += RX_ALLOC_FACTOR_LRO; |
| 439 | channel->irq_mod_score += 2; |
| 440 | } |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 441 | } |
| 442 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 443 | void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, |
Ben Hutchings | dc8cfa5 | 2008-09-01 12:46:50 +0100 | [diff] [blame] | 444 | unsigned int len, bool checksummed, bool discard) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 445 | { |
| 446 | struct efx_nic *efx = rx_queue->efx; |
| 447 | struct efx_rx_buffer *rx_buf; |
Ben Hutchings | dc8cfa5 | 2008-09-01 12:46:50 +0100 | [diff] [blame] | 448 | bool leak_packet = false; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 449 | |
| 450 | rx_buf = efx_rx_buffer(rx_queue, index); |
| 451 | EFX_BUG_ON_PARANOID(!rx_buf->data); |
| 452 | EFX_BUG_ON_PARANOID(rx_buf->skb && rx_buf->page); |
| 453 | EFX_BUG_ON_PARANOID(!(rx_buf->skb || rx_buf->page)); |
| 454 | |
| 455 | /* This allows the refill path to post another buffer. |
| 456 | * EFX_RXD_HEAD_ROOM ensures that the slot we are using |
| 457 | * isn't overwritten yet. |
| 458 | */ |
| 459 | rx_queue->removed_count++; |
| 460 | |
| 461 | /* Validate the length encoded in the event vs the descriptor pushed */ |
| 462 | efx_rx_packet__check_len(rx_queue, rx_buf, len, |
| 463 | &discard, &leak_packet); |
| 464 | |
| 465 | EFX_TRACE(efx, "RX queue %d received id %x at %llx+%x %s%s\n", |
| 466 | rx_queue->queue, index, |
| 467 | (unsigned long long)rx_buf->dma_addr, len, |
| 468 | (checksummed ? " [SUMMED]" : ""), |
| 469 | (discard ? " [DISCARD]" : "")); |
| 470 | |
| 471 | /* Discard packet, if instructed to do so */ |
| 472 | if (unlikely(discard)) { |
| 473 | if (unlikely(leak_packet)) |
| 474 | rx_queue->channel->n_skbuff_leaks++; |
| 475 | else |
| 476 | /* We haven't called efx_unmap_rx_buffer yet, |
| 477 | * so fini the entire rx_buffer here */ |
| 478 | efx_fini_rx_buffer(rx_queue, rx_buf); |
| 479 | return; |
| 480 | } |
| 481 | |
| 482 | /* Release card resources - assumes all RX buffers consumed in-order |
| 483 | * per RX queue |
| 484 | */ |
| 485 | efx_unmap_rx_buffer(efx, rx_buf); |
| 486 | |
| 487 | /* Prefetch nice and early so data will (hopefully) be in cache by |
| 488 | * the time we look at it. |
| 489 | */ |
| 490 | prefetch(rx_buf->data); |
| 491 | |
| 492 | /* Pipeline receives so that we give time for packet headers to be |
| 493 | * prefetched into cache. |
| 494 | */ |
| 495 | rx_buf->len = len; |
| 496 | if (rx_queue->channel->rx_pkt) |
| 497 | __efx_rx_packet(rx_queue->channel, |
| 498 | rx_queue->channel->rx_pkt, |
| 499 | rx_queue->channel->rx_pkt_csummed); |
| 500 | rx_queue->channel->rx_pkt = rx_buf; |
| 501 | rx_queue->channel->rx_pkt_csummed = checksummed; |
| 502 | } |
| 503 | |
| 504 | /* Handle a received packet. Second half: Touches packet payload. */ |
| 505 | void __efx_rx_packet(struct efx_channel *channel, |
Ben Hutchings | dc8cfa5 | 2008-09-01 12:46:50 +0100 | [diff] [blame] | 506 | struct efx_rx_buffer *rx_buf, bool checksummed) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 507 | { |
| 508 | struct efx_nic *efx = channel->efx; |
| 509 | struct sk_buff *skb; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 510 | |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 511 | /* If we're in loopback test, then pass the packet directly to the |
| 512 | * loopback layer, and free the rx_buf here |
| 513 | */ |
| 514 | if (unlikely(efx->loopback_selftest)) { |
| 515 | efx_loopback_rx_packet(efx, rx_buf->data, rx_buf->len); |
| 516 | efx_free_rx_buffer(efx, rx_buf); |
Ben Hutchings | d96d7dc | 2009-11-23 16:01:44 +0000 | [diff] [blame] | 517 | return; |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 518 | } |
| 519 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 520 | if (rx_buf->skb) { |
| 521 | prefetch(skb_shinfo(rx_buf->skb)); |
| 522 | |
| 523 | skb_put(rx_buf->skb, rx_buf->len); |
| 524 | |
| 525 | /* Move past the ethernet header. rx_buf->data still points |
| 526 | * at the ethernet header */ |
| 527 | rx_buf->skb->protocol = eth_type_trans(rx_buf->skb, |
| 528 | efx->net_dev); |
Ben Hutchings | 3eadb7b | 2009-11-23 16:02:40 +0000 | [diff] [blame] | 529 | |
| 530 | skb_record_rx_queue(rx_buf->skb, channel->channel); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 531 | } |
| 532 | |
Herbert Xu | da3bc07 | 2009-01-18 21:50:16 -0800 | [diff] [blame] | 533 | if (likely(checksummed || rx_buf->page)) { |
Ben Hutchings | 345056a | 2009-10-28 03:43:49 -0700 | [diff] [blame] | 534 | efx_rx_packet_lro(channel, rx_buf, checksummed); |
Ben Hutchings | d96d7dc | 2009-11-23 16:01:44 +0000 | [diff] [blame] | 535 | return; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 536 | } |
| 537 | |
Herbert Xu | da3bc07 | 2009-01-18 21:50:16 -0800 | [diff] [blame] | 538 | /* We now own the SKB */ |
| 539 | skb = rx_buf->skb; |
| 540 | rx_buf->skb = NULL; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 541 | EFX_BUG_ON_PARANOID(!skb); |
| 542 | |
| 543 | /* Set the SKB flags */ |
Herbert Xu | da3bc07 | 2009-01-18 21:50:16 -0800 | [diff] [blame] | 544 | skb->ip_summed = CHECKSUM_NONE; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 545 | |
| 546 | /* Pass the packet up */ |
| 547 | netif_receive_skb(skb); |
| 548 | |
| 549 | /* Update allocation strategy method */ |
| 550 | channel->rx_alloc_level += RX_ALLOC_FACTOR_SKB; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 551 | } |
| 552 | |
| 553 | void efx_rx_strategy(struct efx_channel *channel) |
| 554 | { |
| 555 | enum efx_rx_alloc_method method = rx_alloc_method; |
| 556 | |
| 557 | /* Only makes sense to use page based allocation if LRO is enabled */ |
Herbert Xu | da3bc07 | 2009-01-18 21:50:16 -0800 | [diff] [blame] | 558 | if (!(channel->efx->net_dev->features & NETIF_F_GRO)) { |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 559 | method = RX_ALLOC_METHOD_SKB; |
| 560 | } else if (method == RX_ALLOC_METHOD_AUTO) { |
| 561 | /* Constrain the rx_alloc_level */ |
| 562 | if (channel->rx_alloc_level < 0) |
| 563 | channel->rx_alloc_level = 0; |
| 564 | else if (channel->rx_alloc_level > RX_ALLOC_LEVEL_MAX) |
| 565 | channel->rx_alloc_level = RX_ALLOC_LEVEL_MAX; |
| 566 | |
| 567 | /* Decide on the allocation method */ |
| 568 | method = ((channel->rx_alloc_level > RX_ALLOC_LEVEL_LRO) ? |
| 569 | RX_ALLOC_METHOD_PAGE : RX_ALLOC_METHOD_SKB); |
| 570 | } |
| 571 | |
| 572 | /* Push the option */ |
| 573 | channel->rx_alloc_push_pages = (method == RX_ALLOC_METHOD_PAGE); |
| 574 | } |
| 575 | |
| 576 | int efx_probe_rx_queue(struct efx_rx_queue *rx_queue) |
| 577 | { |
| 578 | struct efx_nic *efx = rx_queue->efx; |
| 579 | unsigned int rxq_size; |
| 580 | int rc; |
| 581 | |
| 582 | EFX_LOG(efx, "creating RX queue %d\n", rx_queue->queue); |
| 583 | |
| 584 | /* Allocate RX buffers */ |
Ben Hutchings | 3ffeabd | 2009-10-23 08:30:58 +0000 | [diff] [blame] | 585 | rxq_size = EFX_RXQ_SIZE * sizeof(*rx_queue->buffer); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 586 | rx_queue->buffer = kzalloc(rxq_size, GFP_KERNEL); |
Ben Hutchings | 8831da7 | 2008-09-01 12:47:48 +0100 | [diff] [blame] | 587 | if (!rx_queue->buffer) |
| 588 | return -ENOMEM; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 589 | |
Ben Hutchings | 152b6a6 | 2009-11-29 03:43:56 +0000 | [diff] [blame] | 590 | rc = efx_nic_probe_rx(rx_queue); |
Ben Hutchings | 8831da7 | 2008-09-01 12:47:48 +0100 | [diff] [blame] | 591 | if (rc) { |
| 592 | kfree(rx_queue->buffer); |
| 593 | rx_queue->buffer = NULL; |
| 594 | } |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 595 | return rc; |
| 596 | } |
| 597 | |
Ben Hutchings | bc3c90a | 2008-09-01 12:48:46 +0100 | [diff] [blame] | 598 | void efx_init_rx_queue(struct efx_rx_queue *rx_queue) |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 599 | { |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 600 | unsigned int max_fill, trigger, limit; |
| 601 | |
| 602 | EFX_LOG(rx_queue->efx, "initialising RX queue %d\n", rx_queue->queue); |
| 603 | |
| 604 | /* Initialise ptr fields */ |
| 605 | rx_queue->added_count = 0; |
| 606 | rx_queue->notified_count = 0; |
| 607 | rx_queue->removed_count = 0; |
| 608 | rx_queue->min_fill = -1U; |
| 609 | rx_queue->min_overfill = -1U; |
| 610 | |
| 611 | /* Initialise limit fields */ |
Ben Hutchings | 3ffeabd | 2009-10-23 08:30:58 +0000 | [diff] [blame] | 612 | max_fill = EFX_RXQ_SIZE - EFX_RXD_HEAD_ROOM; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 613 | trigger = max_fill * min(rx_refill_threshold, 100U) / 100U; |
| 614 | limit = max_fill * min(rx_refill_limit, 100U) / 100U; |
| 615 | |
| 616 | rx_queue->max_fill = max_fill; |
| 617 | rx_queue->fast_fill_trigger = trigger; |
| 618 | rx_queue->fast_fill_limit = limit; |
| 619 | |
| 620 | /* Set up RX descriptor ring */ |
Ben Hutchings | 152b6a6 | 2009-11-29 03:43:56 +0000 | [diff] [blame] | 621 | efx_nic_init_rx(rx_queue); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 622 | } |
| 623 | |
| 624 | void efx_fini_rx_queue(struct efx_rx_queue *rx_queue) |
| 625 | { |
| 626 | int i; |
| 627 | struct efx_rx_buffer *rx_buf; |
| 628 | |
| 629 | EFX_LOG(rx_queue->efx, "shutting down RX queue %d\n", rx_queue->queue); |
| 630 | |
Steve Hodgson | 90d683a | 2010-06-01 11:19:39 +0000 | [diff] [blame^] | 631 | del_timer_sync(&rx_queue->slow_fill); |
Ben Hutchings | 152b6a6 | 2009-11-29 03:43:56 +0000 | [diff] [blame] | 632 | efx_nic_fini_rx(rx_queue); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 633 | |
| 634 | /* Release RX buffers NB start at index 0 not current HW ptr */ |
| 635 | if (rx_queue->buffer) { |
Ben Hutchings | 3ffeabd | 2009-10-23 08:30:58 +0000 | [diff] [blame] | 636 | for (i = 0; i <= EFX_RXQ_MASK; i++) { |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 637 | rx_buf = efx_rx_buffer(rx_queue, i); |
| 638 | efx_fini_rx_buffer(rx_queue, rx_buf); |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | /* For a page that is part-way through splitting into RX buffers */ |
| 643 | if (rx_queue->buf_page != NULL) { |
| 644 | pci_unmap_page(rx_queue->efx->pci_dev, rx_queue->buf_dma_addr, |
Ben Hutchings | 5566861 | 2008-05-16 21:16:10 +0100 | [diff] [blame] | 645 | efx_rx_buf_size(rx_queue->efx), |
| 646 | PCI_DMA_FROMDEVICE); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 647 | __free_pages(rx_queue->buf_page, |
| 648 | rx_queue->efx->rx_buffer_order); |
| 649 | rx_queue->buf_page = NULL; |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | void efx_remove_rx_queue(struct efx_rx_queue *rx_queue) |
| 654 | { |
| 655 | EFX_LOG(rx_queue->efx, "destroying RX queue %d\n", rx_queue->queue); |
| 656 | |
Ben Hutchings | 152b6a6 | 2009-11-29 03:43:56 +0000 | [diff] [blame] | 657 | efx_nic_remove_rx(rx_queue); |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 658 | |
| 659 | kfree(rx_queue->buffer); |
| 660 | rx_queue->buffer = NULL; |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 661 | } |
| 662 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 663 | |
| 664 | module_param(rx_alloc_method, int, 0644); |
| 665 | MODULE_PARM_DESC(rx_alloc_method, "Allocation method used for RX buffers"); |
| 666 | |
| 667 | module_param(rx_refill_threshold, uint, 0444); |
| 668 | MODULE_PARM_DESC(rx_refill_threshold, |
| 669 | "RX descriptor ring fast/slow fill threshold (%)"); |
| 670 | |