| .. | .. |
|---|
| 372 | 372 | /** |
|---|
| 373 | 373 | * free_rx_bufs - free the Rx buffers on an SGE free list |
|---|
| 374 | 374 | * @pdev: the PCI device associated with the adapter |
|---|
| 375 | | - * @rxq: the SGE free list to clean up |
|---|
| 375 | + * @q: the SGE free list to clean up |
|---|
| 376 | 376 | * |
|---|
| 377 | 377 | * Release the buffers on an SGE free-buffer Rx queue. HW fetching from |
|---|
| 378 | 378 | * this queue should be stopped before calling this function. |
|---|
| .. | .. |
|---|
| 493 | 493 | |
|---|
| 494 | 494 | /** |
|---|
| 495 | 495 | * refill_fl - refill an SGE free-buffer list |
|---|
| 496 | | - * @adapter: the adapter |
|---|
| 496 | + * @adap: the adapter |
|---|
| 497 | 497 | * @q: the free-list to refill |
|---|
| 498 | 498 | * @n: the number of new buffers to allocate |
|---|
| 499 | 499 | * @gfp: the gfp flags for allocating new buffers |
|---|
| .. | .. |
|---|
| 568 | 568 | |
|---|
| 569 | 569 | /** |
|---|
| 570 | 570 | * recycle_rx_buf - recycle a receive buffer |
|---|
| 571 | | - * @adapter: the adapter |
|---|
| 571 | + * @adap: the adapter |
|---|
| 572 | 572 | * @q: the SGE free list |
|---|
| 573 | 573 | * @idx: index of buffer to recycle |
|---|
| 574 | 574 | * |
|---|
| .. | .. |
|---|
| 620 | 620 | { |
|---|
| 621 | 621 | size_t len = nelem * elem_size; |
|---|
| 622 | 622 | void *s = NULL; |
|---|
| 623 | | - void *p = dma_zalloc_coherent(&pdev->dev, len, phys, GFP_KERNEL); |
|---|
| 623 | + void *p = dma_alloc_coherent(&pdev->dev, len, phys, GFP_KERNEL); |
|---|
| 624 | 624 | |
|---|
| 625 | 625 | if (!p) |
|---|
| 626 | 626 | return NULL; |
|---|
| .. | .. |
|---|
| 825 | 825 | * get_packet_pg - return the next ingress packet buffer from a free list |
|---|
| 826 | 826 | * @adap: the adapter that received the packet |
|---|
| 827 | 827 | * @fl: the SGE free list holding the packet |
|---|
| 828 | + * @q: the queue |
|---|
| 828 | 829 | * @len: the packet length including any SGE padding |
|---|
| 829 | 830 | * @drop_thres: # of remaining buffers before we start dropping packets |
|---|
| 830 | 831 | * |
|---|
| .. | .. |
|---|
| 1173 | 1174 | * @q: the Tx queue |
|---|
| 1174 | 1175 | * @ndesc: number of descriptors the packet will occupy |
|---|
| 1175 | 1176 | * @compl: the value of the COMPL bit to use |
|---|
| 1177 | + * @addr: address |
|---|
| 1176 | 1178 | * |
|---|
| 1177 | 1179 | * Generate a TX_PKT work request to send the supplied packet. |
|---|
| 1178 | 1180 | */ |
|---|
| .. | .. |
|---|
| 1516 | 1518 | |
|---|
| 1517 | 1519 | /** |
|---|
| 1518 | 1520 | * restart_ctrlq - restart a suspended control queue |
|---|
| 1519 | | - * @qs: the queue set cotaining the control queue |
|---|
| 1521 | + * @t: pointer to the tasklet associated with this handler |
|---|
| 1520 | 1522 | * |
|---|
| 1521 | 1523 | * Resumes transmission on a suspended Tx control queue. |
|---|
| 1522 | 1524 | */ |
|---|
| 1523 | | -static void restart_ctrlq(unsigned long data) |
|---|
| 1525 | +static void restart_ctrlq(struct tasklet_struct *t) |
|---|
| 1524 | 1526 | { |
|---|
| 1525 | 1527 | struct sk_buff *skb; |
|---|
| 1526 | | - struct sge_qset *qs = (struct sge_qset *)data; |
|---|
| 1528 | + struct sge_qset *qs = from_tasklet(qs, t, txq[TXQ_CTRL].qresume_tsk); |
|---|
| 1527 | 1529 | struct sge_txq *q = &qs->txq[TXQ_CTRL]; |
|---|
| 1528 | 1530 | |
|---|
| 1529 | 1531 | spin_lock(&q->lock); |
|---|
| .. | .. |
|---|
| 1622 | 1624 | * @pidx: index of the first Tx descriptor to write |
|---|
| 1623 | 1625 | * @gen: the generation value to use |
|---|
| 1624 | 1626 | * @ndesc: number of descriptors the packet will occupy |
|---|
| 1627 | + * @addr: the address |
|---|
| 1625 | 1628 | * |
|---|
| 1626 | 1629 | * Write an offload work request to send the supplied packet. The packet |
|---|
| 1627 | 1630 | * data already carry the work request with most fields populated. |
|---|
| .. | .. |
|---|
| 1733 | 1736 | |
|---|
| 1734 | 1737 | /** |
|---|
| 1735 | 1738 | * restart_offloadq - restart a suspended offload queue |
|---|
| 1736 | | - * @qs: the queue set cotaining the offload queue |
|---|
| 1739 | + * @t: pointer to the tasklet associated with this handler |
|---|
| 1737 | 1740 | * |
|---|
| 1738 | 1741 | * Resumes transmission on a suspended Tx offload queue. |
|---|
| 1739 | 1742 | */ |
|---|
| 1740 | | -static void restart_offloadq(unsigned long data) |
|---|
| 1743 | +static void restart_offloadq(struct tasklet_struct *t) |
|---|
| 1741 | 1744 | { |
|---|
| 1742 | 1745 | struct sk_buff *skb; |
|---|
| 1743 | | - struct sge_qset *qs = (struct sge_qset *)data; |
|---|
| 1746 | + struct sge_qset *qs = from_tasklet(qs, t, txq[TXQ_OFLD].qresume_tsk); |
|---|
| 1744 | 1747 | struct sge_txq *q = &qs->txq[TXQ_OFLD]; |
|---|
| 1745 | 1748 | const struct port_info *pi = netdev_priv(qs->netdev); |
|---|
| 1746 | 1749 | struct adapter *adap = pi->adapter; |
|---|
| .. | .. |
|---|
| 1883 | 1886 | |
|---|
| 1884 | 1887 | /** |
|---|
| 1885 | 1888 | * ofld_poll - NAPI handler for offload packets in interrupt mode |
|---|
| 1886 | | - * @dev: the network device doing the polling |
|---|
| 1889 | + * @napi: the network device doing the polling |
|---|
| 1887 | 1890 | * @budget: polling budget |
|---|
| 1888 | 1891 | * |
|---|
| 1889 | 1892 | * The NAPI handler for offload packets when a response queue is serviced |
|---|
| .. | .. |
|---|
| 2007 | 2010 | |
|---|
| 2008 | 2011 | /** |
|---|
| 2009 | 2012 | * cxgb3_arp_process - process an ARP request probing a private IP address |
|---|
| 2010 | | - * @adapter: the adapter |
|---|
| 2013 | + * @pi: the port info |
|---|
| 2011 | 2014 | * @skb: the skbuff containing the ARP request |
|---|
| 2012 | 2015 | * |
|---|
| 2013 | 2016 | * Check if the ARP request is probing the private IP address |
|---|
| .. | .. |
|---|
| 2069 | 2072 | * @adap: the adapter |
|---|
| 2070 | 2073 | * @rq: the response queue that received the packet |
|---|
| 2071 | 2074 | * @skb: the packet |
|---|
| 2072 | | - * @pad: amount of padding at the start of the buffer |
|---|
| 2075 | + * @pad: padding |
|---|
| 2076 | + * @lro: large receive offload |
|---|
| 2073 | 2077 | * |
|---|
| 2074 | 2078 | * Process an ingress ethernet pakcet and deliver it to the stack. |
|---|
| 2075 | 2079 | * The padding is 2 if the packet was delivered in an Rx buffer and 0 |
|---|
| .. | .. |
|---|
| 2132 | 2136 | struct port_info *pi = netdev_priv(qs->netdev); |
|---|
| 2133 | 2137 | struct sk_buff *skb = NULL; |
|---|
| 2134 | 2138 | struct cpl_rx_pkt *cpl; |
|---|
| 2135 | | - struct skb_frag_struct *rx_frag; |
|---|
| 2139 | + skb_frag_t *rx_frag; |
|---|
| 2136 | 2140 | int nr_frags; |
|---|
| 2137 | 2141 | int offset = 0; |
|---|
| 2138 | 2142 | |
|---|
| .. | .. |
|---|
| 2182 | 2186 | |
|---|
| 2183 | 2187 | rx_frag += nr_frags; |
|---|
| 2184 | 2188 | __skb_frag_set_page(rx_frag, sd->pg_chunk.page); |
|---|
| 2185 | | - rx_frag->page_offset = sd->pg_chunk.offset + offset; |
|---|
| 2189 | + skb_frag_off_set(rx_frag, sd->pg_chunk.offset + offset); |
|---|
| 2186 | 2190 | skb_frag_size_set(rx_frag, len); |
|---|
| 2187 | 2191 | |
|---|
| 2188 | 2192 | skb->len += len; |
|---|
| .. | .. |
|---|
| 2239 | 2243 | |
|---|
| 2240 | 2244 | /** |
|---|
| 2241 | 2245 | * check_ring_db - check if we need to ring any doorbells |
|---|
| 2242 | | - * @adapter: the adapter |
|---|
| 2246 | + * @adap: the adapter |
|---|
| 2243 | 2247 | * @qs: the queue set whose Tx queues are to be examined |
|---|
| 2244 | 2248 | * @sleeping: indicates which Tx queue sent GTS |
|---|
| 2245 | 2249 | * |
|---|
| .. | .. |
|---|
| 2372 | 2376 | if (fl->use_pages) { |
|---|
| 2373 | 2377 | void *addr = fl->sdesc[fl->cidx].pg_chunk.va; |
|---|
| 2374 | 2378 | |
|---|
| 2375 | | - prefetch(addr); |
|---|
| 2376 | | -#if L1_CACHE_BYTES < 128 |
|---|
| 2377 | | - prefetch(addr + L1_CACHE_BYTES); |
|---|
| 2378 | | -#endif |
|---|
| 2379 | + net_prefetch(addr); |
|---|
| 2379 | 2380 | __refill_fl(adap, fl); |
|---|
| 2380 | 2381 | if (lro > 0) { |
|---|
| 2381 | 2382 | lro_add_page(adap, qs, fl, |
|---|
| 2382 | 2383 | G_RSPD_LEN(len), |
|---|
| 2383 | 2384 | flags & F_RSPD_EOP); |
|---|
| 2384 | | - goto next_fl; |
|---|
| 2385 | + goto next_fl; |
|---|
| 2385 | 2386 | } |
|---|
| 2386 | 2387 | |
|---|
| 2387 | 2388 | skb = get_packet_pg(adap, fl, q, |
|---|
| .. | .. |
|---|
| 2902 | 2903 | |
|---|
| 2903 | 2904 | /** |
|---|
| 2904 | 2905 | * sge_timer_tx - perform periodic maintenance of an SGE qset |
|---|
| 2905 | | - * @data: the SGE queue set to maintain |
|---|
| 2906 | + * @t: a timer list containing the SGE queue set to maintain |
|---|
| 2906 | 2907 | * |
|---|
| 2907 | 2908 | * Runs periodically from a timer to perform maintenance of an SGE queue |
|---|
| 2908 | 2909 | * set. It performs two tasks: |
|---|
| .. | .. |
|---|
| 2946 | 2947 | |
|---|
| 2947 | 2948 | /** |
|---|
| 2948 | 2949 | * sge_timer_rx - perform periodic maintenance of an SGE qset |
|---|
| 2949 | | - * @data: the SGE queue set to maintain |
|---|
| 2950 | + * @t: the timer list containing the SGE queue set to maintain |
|---|
| 2950 | 2951 | * |
|---|
| 2951 | 2952 | * a) Replenishes Rx queues that have run out due to memory shortage. |
|---|
| 2952 | 2953 | * Normally new Rx buffers are added when existing ones are consumed but |
|---|
| .. | .. |
|---|
| 3024 | 3025 | * @irq_vec_idx: the IRQ vector index for response queue interrupts |
|---|
| 3025 | 3026 | * @p: configuration parameters for this queue set |
|---|
| 3026 | 3027 | * @ntxq: number of Tx queues for the queue set |
|---|
| 3027 | | - * @netdev: net device associated with this queue set |
|---|
| 3028 | + * @dev: net device associated with this queue set |
|---|
| 3028 | 3029 | * @netdevq: net device TX queue associated with this queue set |
|---|
| 3029 | 3030 | * |
|---|
| 3030 | 3031 | * Allocate resources and initialize an SGE queue set. A queue set |
|---|
| .. | .. |
|---|
| 3084 | 3085 | skb_queue_head_init(&q->txq[i].sendq); |
|---|
| 3085 | 3086 | } |
|---|
| 3086 | 3087 | |
|---|
| 3087 | | - tasklet_init(&q->txq[TXQ_OFLD].qresume_tsk, restart_offloadq, |
|---|
| 3088 | | - (unsigned long)q); |
|---|
| 3089 | | - tasklet_init(&q->txq[TXQ_CTRL].qresume_tsk, restart_ctrlq, |
|---|
| 3090 | | - (unsigned long)q); |
|---|
| 3088 | + tasklet_setup(&q->txq[TXQ_OFLD].qresume_tsk, restart_offloadq); |
|---|
| 3089 | + tasklet_setup(&q->txq[TXQ_CTRL].qresume_tsk, restart_ctrlq); |
|---|
| 3091 | 3090 | |
|---|
| 3092 | 3091 | q->fl[0].gen = q->fl[1].gen = 1; |
|---|
| 3093 | 3092 | q->fl[0].size = p->fl_size; |
|---|
| .. | .. |
|---|
| 3215 | 3214 | for (i = 0; i < SGE_QSETS; ++i) { |
|---|
| 3216 | 3215 | struct sge_qset *q = &adap->sge.qs[i]; |
|---|
| 3217 | 3216 | |
|---|
| 3218 | | - if (q->tx_reclaim_timer.function) |
|---|
| 3219 | | - mod_timer(&q->tx_reclaim_timer, jiffies + TX_RECLAIM_PERIOD); |
|---|
| 3217 | + if (q->tx_reclaim_timer.function) |
|---|
| 3218 | + mod_timer(&q->tx_reclaim_timer, |
|---|
| 3219 | + jiffies + TX_RECLAIM_PERIOD); |
|---|
| 3220 | 3220 | |
|---|
| 3221 | | - if (q->rx_reclaim_timer.function) |
|---|
| 3222 | | - mod_timer(&q->rx_reclaim_timer, jiffies + RX_RECLAIM_PERIOD); |
|---|
| 3221 | + if (q->rx_reclaim_timer.function) |
|---|
| 3222 | + mod_timer(&q->rx_reclaim_timer, |
|---|
| 3223 | + jiffies + RX_RECLAIM_PERIOD); |
|---|
| 3223 | 3224 | } |
|---|
| 3224 | 3225 | } |
|---|
| 3225 | 3226 | |
|---|
| .. | .. |
|---|
| 3270 | 3271 | } |
|---|
| 3271 | 3272 | |
|---|
| 3272 | 3273 | /** |
|---|
| 3273 | | - * t3_sge_stop - disable SGE operation |
|---|
| 3274 | + * t3_sge_stop_dma - Disable SGE DMA engine operation |
|---|
| 3274 | 3275 | * @adap: the adapter |
|---|
| 3275 | 3276 | * |
|---|
| 3276 | | - * Disables the DMA engine. This can be called in emeregencies (e.g., |
|---|
| 3277 | | - * from error interrupts) or from normal process context. In the latter |
|---|
| 3278 | | - * case it also disables any pending queue restart tasklets. Note that |
|---|
| 3279 | | - * if it is called in interrupt context it cannot disable the restart |
|---|
| 3280 | | - * tasklets as it cannot wait, however the tasklets will have no effect |
|---|
| 3281 | | - * since the doorbells are disabled and the driver will call this again |
|---|
| 3282 | | - * later from process context, at which time the tasklets will be stopped |
|---|
| 3283 | | - * if they are still running. |
|---|
| 3277 | + * Can be invoked from interrupt context e.g. error handler. |
|---|
| 3278 | + * |
|---|
| 3279 | + * Note that this function cannot disable the restart of tasklets as |
|---|
| 3280 | + * it cannot wait if called from interrupt context, however the |
|---|
| 3281 | + * tasklets will have no effect since the doorbells are disabled. The |
|---|
| 3282 | + * driver will call tg3_sge_stop() later from process context, at |
|---|
| 3283 | + * which time the tasklets will be stopped if they are still running. |
|---|
| 3284 | + */ |
|---|
| 3285 | +void t3_sge_stop_dma(struct adapter *adap) |
|---|
| 3286 | +{ |
|---|
| 3287 | + t3_set_reg_field(adap, A_SG_CONTROL, F_GLOBALENABLE, 0); |
|---|
| 3288 | +} |
|---|
| 3289 | + |
|---|
| 3290 | +/** |
|---|
| 3291 | + * t3_sge_stop - disable SGE operation completly |
|---|
| 3292 | + * @adap: the adapter |
|---|
| 3293 | + * |
|---|
| 3294 | + * Called from process context. Disables the DMA engine and any |
|---|
| 3295 | + * pending queue restart tasklets. |
|---|
| 3284 | 3296 | */ |
|---|
| 3285 | 3297 | void t3_sge_stop(struct adapter *adap) |
|---|
| 3286 | 3298 | { |
|---|
| 3287 | | - t3_set_reg_field(adap, A_SG_CONTROL, F_GLOBALENABLE, 0); |
|---|
| 3288 | | - if (!in_interrupt()) { |
|---|
| 3289 | | - int i; |
|---|
| 3299 | + int i; |
|---|
| 3290 | 3300 | |
|---|
| 3291 | | - for (i = 0; i < SGE_QSETS; ++i) { |
|---|
| 3292 | | - struct sge_qset *qs = &adap->sge.qs[i]; |
|---|
| 3301 | + t3_sge_stop_dma(adap); |
|---|
| 3293 | 3302 | |
|---|
| 3294 | | - tasklet_kill(&qs->txq[TXQ_OFLD].qresume_tsk); |
|---|
| 3295 | | - tasklet_kill(&qs->txq[TXQ_CTRL].qresume_tsk); |
|---|
| 3296 | | - } |
|---|
| 3303 | + for (i = 0; i < SGE_QSETS; ++i) { |
|---|
| 3304 | + struct sge_qset *qs = &adap->sge.qs[i]; |
|---|
| 3305 | + |
|---|
| 3306 | + tasklet_kill(&qs->txq[TXQ_OFLD].qresume_tsk); |
|---|
| 3307 | + tasklet_kill(&qs->txq[TXQ_CTRL].qresume_tsk); |
|---|
| 3297 | 3308 | } |
|---|
| 3298 | 3309 | } |
|---|
| 3299 | 3310 | |
|---|