Lines Matching full:offload

9 #include <linux/can/rx-offload.h>
24 can_rx_offload_le(struct can_rx_offload *offload, in can_rx_offload_le() argument
27 if (offload->inc) in can_rx_offload_le()
34 can_rx_offload_inc(struct can_rx_offload *offload, unsigned int *val) in can_rx_offload_inc() argument
36 if (offload->inc) in can_rx_offload_inc()
44 struct can_rx_offload *offload = container_of(napi, in can_rx_offload_napi_poll() local
47 struct net_device *dev = offload->dev; in can_rx_offload_napi_poll()
53 (skb = skb_dequeue(&offload->skb_queue))) { in can_rx_offload_napi_poll()
69 if (!skb_queue_empty(&offload->skb_queue)) in can_rx_offload_napi_poll()
70 napi_schedule(&offload->napi); in can_rx_offload_napi_poll()
121 * @offload: pointer to rx_offload context
141 can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n) in can_rx_offload_offload_one() argument
149 if (unlikely(skb_queue_len(&offload->skb_queue) > in can_rx_offload_offload_one()
150 offload->skb_queue_len_max)) in can_rx_offload_offload_one()
153 skb = offload->mailbox_read(offload, n, &timestamp, drop); in can_rx_offload_offload_one()
162 offload->dev->stats.rx_dropped++; in can_rx_offload_offload_one()
163 offload->dev->stats.rx_fifo_errors++; in can_rx_offload_offload_one()
175 int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, in can_rx_offload_irq_offload_timestamp() argument
181 for (i = offload->mb_first; in can_rx_offload_irq_offload_timestamp()
182 can_rx_offload_le(offload, i, offload->mb_last); in can_rx_offload_irq_offload_timestamp()
183 can_rx_offload_inc(offload, &i)) { in can_rx_offload_irq_offload_timestamp()
189 skb = can_rx_offload_offload_one(offload, i); in can_rx_offload_irq_offload_timestamp()
193 __skb_queue_add_sort(&offload->skb_irq_queue, skb, in can_rx_offload_irq_offload_timestamp()
202 int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) in can_rx_offload_irq_offload_fifo() argument
208 skb = can_rx_offload_offload_one(offload, 0); in can_rx_offload_irq_offload_fifo()
214 __skb_queue_tail(&offload->skb_irq_queue, skb); in can_rx_offload_irq_offload_fifo()
222 int can_rx_offload_queue_timestamp(struct can_rx_offload *offload, in can_rx_offload_queue_timestamp() argument
227 if (skb_queue_len(&offload->skb_queue) > in can_rx_offload_queue_timestamp()
228 offload->skb_queue_len_max) { in can_rx_offload_queue_timestamp()
236 __skb_queue_add_sort(&offload->skb_irq_queue, skb, in can_rx_offload_queue_timestamp()
244 can_rx_offload_get_echo_skb_queue_timestamp(struct can_rx_offload *offload, in can_rx_offload_get_echo_skb_queue_timestamp() argument
248 struct net_device *dev = offload->dev; in can_rx_offload_get_echo_skb_queue_timestamp()
258 err = can_rx_offload_queue_timestamp(offload, skb, timestamp); in can_rx_offload_get_echo_skb_queue_timestamp()
268 int can_rx_offload_queue_tail(struct can_rx_offload *offload, in can_rx_offload_queue_tail() argument
271 if (skb_queue_len(&offload->skb_queue) > in can_rx_offload_queue_tail()
272 offload->skb_queue_len_max) { in can_rx_offload_queue_tail()
277 __skb_queue_tail(&offload->skb_irq_queue, skb); in can_rx_offload_queue_tail()
284 can_rx_offload_get_echo_skb_queue_tail(struct can_rx_offload *offload, in can_rx_offload_get_echo_skb_queue_tail() argument
288 struct net_device *dev = offload->dev; in can_rx_offload_get_echo_skb_queue_tail()
298 err = can_rx_offload_queue_tail(offload, skb); in can_rx_offload_get_echo_skb_queue_tail()
308 void can_rx_offload_irq_finish(struct can_rx_offload *offload) in can_rx_offload_irq_finish() argument
313 if (skb_queue_empty_lockless(&offload->skb_irq_queue)) in can_rx_offload_irq_finish()
316 spin_lock_irqsave(&offload->skb_queue.lock, flags); in can_rx_offload_irq_finish()
317 skb_queue_splice_tail_init(&offload->skb_irq_queue, &offload->skb_queue); in can_rx_offload_irq_finish()
318 spin_unlock_irqrestore(&offload->skb_queue.lock, flags); in can_rx_offload_irq_finish()
320 queue_len = skb_queue_len(&offload->skb_queue); in can_rx_offload_irq_finish()
321 if (queue_len > offload->skb_queue_len_max / 8) in can_rx_offload_irq_finish()
322 netdev_dbg(offload->dev, "%s: queue_len=%d\n", in can_rx_offload_irq_finish()
325 napi_schedule(&offload->napi); in can_rx_offload_irq_finish()
329 void can_rx_offload_threaded_irq_finish(struct can_rx_offload *offload) in can_rx_offload_threaded_irq_finish() argument
334 if (skb_queue_empty_lockless(&offload->skb_irq_queue)) in can_rx_offload_threaded_irq_finish()
337 spin_lock_irqsave(&offload->skb_queue.lock, flags); in can_rx_offload_threaded_irq_finish()
338 skb_queue_splice_tail_init(&offload->skb_irq_queue, &offload->skb_queue); in can_rx_offload_threaded_irq_finish()
339 spin_unlock_irqrestore(&offload->skb_queue.lock, flags); in can_rx_offload_threaded_irq_finish()
341 queue_len = skb_queue_len(&offload->skb_queue); in can_rx_offload_threaded_irq_finish()
342 if (queue_len > offload->skb_queue_len_max / 8) in can_rx_offload_threaded_irq_finish()
343 netdev_dbg(offload->dev, "%s: queue_len=%d\n", in can_rx_offload_threaded_irq_finish()
347 napi_schedule(&offload->napi); in can_rx_offload_threaded_irq_finish()
353 struct can_rx_offload *offload, in can_rx_offload_init_queue() argument
356 offload->dev = dev; in can_rx_offload_init_queue()
359 offload->skb_queue_len_max = 2 << fls(weight); in can_rx_offload_init_queue()
360 offload->skb_queue_len_max *= 4; in can_rx_offload_init_queue()
361 skb_queue_head_init(&offload->skb_queue); in can_rx_offload_init_queue()
362 __skb_queue_head_init(&offload->skb_irq_queue); in can_rx_offload_init_queue()
364 netif_napi_add_weight(dev, &offload->napi, can_rx_offload_napi_poll, in can_rx_offload_init_queue()
368 __func__, offload->skb_queue_len_max); in can_rx_offload_init_queue()
374 struct can_rx_offload *offload) in can_rx_offload_add_timestamp() argument
378 if (offload->mb_first > BITS_PER_LONG_LONG || in can_rx_offload_add_timestamp()
379 offload->mb_last > BITS_PER_LONG_LONG || !offload->mailbox_read) in can_rx_offload_add_timestamp()
382 if (offload->mb_first < offload->mb_last) { in can_rx_offload_add_timestamp()
383 offload->inc = true; in can_rx_offload_add_timestamp()
384 weight = offload->mb_last - offload->mb_first; in can_rx_offload_add_timestamp()
386 offload->inc = false; in can_rx_offload_add_timestamp()
387 weight = offload->mb_first - offload->mb_last; in can_rx_offload_add_timestamp()
390 return can_rx_offload_init_queue(dev, offload, weight); in can_rx_offload_add_timestamp()
395 struct can_rx_offload *offload, unsigned int weight) in can_rx_offload_add_fifo() argument
397 if (!offload->mailbox_read) in can_rx_offload_add_fifo()
400 return can_rx_offload_init_queue(dev, offload, weight); in can_rx_offload_add_fifo()
405 struct can_rx_offload *offload, in can_rx_offload_add_manual() argument
408 if (offload->mailbox_read) in can_rx_offload_add_manual()
411 return can_rx_offload_init_queue(dev, offload, weight); in can_rx_offload_add_manual()
415 void can_rx_offload_enable(struct can_rx_offload *offload) in can_rx_offload_enable() argument
417 napi_enable(&offload->napi); in can_rx_offload_enable()
421 void can_rx_offload_del(struct can_rx_offload *offload) in can_rx_offload_del() argument
423 netif_napi_del(&offload->napi); in can_rx_offload_del()
424 skb_queue_purge(&offload->skb_queue); in can_rx_offload_del()
425 __skb_queue_purge(&offload->skb_irq_queue); in can_rx_offload_del()