caif_virtio.c (d0034a7a4ac7fae708146ac0059b9c47a1543f0d) | caif_virtio.c (ae8102b87b9a91f401841513ceab4fc2c0e14787) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) ST-Ericsson AB 2013 4 * Authors: Vicram Arv 5 * Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no> 6 * Sjur Brendeland 7 */ 8#include <linux/module.h> --- 301 unchanged lines hidden (view full) --- 310 ++cfv->stats.rx_napi_resched; 311 goto out; 312 313exit: 314 switch (err) { 315 case 0: 316 ++cfv->stats.rx_napi_complete; 317 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) ST-Ericsson AB 2013 4 * Authors: Vicram Arv 5 * Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no> 6 * Sjur Brendeland 7 */ 8#include <linux/module.h> --- 301 unchanged lines hidden (view full) --- 310 ++cfv->stats.rx_napi_resched; 311 goto out; 312 313exit: 314 switch (err) { 315 case 0: 316 ++cfv->stats.rx_napi_complete; 317 |
318 /* Really out of patckets? (stolen from virtio_net)*/ | 318 /* Really out of packets? (stolen from virtio_net)*/ |
319 napi_complete(napi); 320 if (unlikely(!vringh_notify_enable_kern(cfv->vr_rx)) && 321 napi_schedule_prep(napi)) { 322 vringh_notify_disable_kern(cfv->vr_rx); 323 __napi_schedule(napi); 324 } 325 break; 326 --- 131 unchanged lines hidden (view full) --- 458 struct buf_info *buf_info; 459 460 /* Disable interrupts, queues and NAPI polling */ 461 netif_carrier_off(netdev); 462 virtqueue_disable_cb(cfv->vq_tx); 463 vringh_notify_disable_kern(cfv->vr_rx); 464 napi_disable(&cfv->napi); 465 | 319 napi_complete(napi); 320 if (unlikely(!vringh_notify_enable_kern(cfv->vr_rx)) && 321 napi_schedule_prep(napi)) { 322 vringh_notify_disable_kern(cfv->vr_rx); 323 __napi_schedule(napi); 324 } 325 break; 326 --- 131 unchanged lines hidden (view full) --- 458 struct buf_info *buf_info; 459 460 /* Disable interrupts, queues and NAPI polling */ 461 netif_carrier_off(netdev); 462 virtqueue_disable_cb(cfv->vq_tx); 463 vringh_notify_disable_kern(cfv->vr_rx); 464 napi_disable(&cfv->napi); 465 |
466 /* Release any TX buffers on both used and avilable rings */ | 466 /* Release any TX buffers on both used and available rings */ |
467 cfv_release_used_buf(cfv->vq_tx); 468 spin_lock_irqsave(&cfv->tx_lock, flags); 469 while ((buf_info = virtqueue_detach_unused_buf(cfv->vq_tx))) 470 free_buf_info(cfv, buf_info); 471 spin_unlock_irqrestore(&cfv->tx_lock, flags); 472 473 /* Release all dma allocated memory and destroy the pool */ 474 cfv_destroy_genpool(cfv); --- 17 unchanged lines hidden (view full) --- 492 cfv->tx_hr + skb->len + cfv->tx_tr, cfv->mtu); 493 goto err; 494 } 495 496 buf_info = kmalloc(sizeof(struct buf_info), GFP_ATOMIC); 497 if (unlikely(!buf_info)) 498 goto err; 499 | 467 cfv_release_used_buf(cfv->vq_tx); 468 spin_lock_irqsave(&cfv->tx_lock, flags); 469 while ((buf_info = virtqueue_detach_unused_buf(cfv->vq_tx))) 470 free_buf_info(cfv, buf_info); 471 spin_unlock_irqrestore(&cfv->tx_lock, flags); 472 473 /* Release all dma allocated memory and destroy the pool */ 474 cfv_destroy_genpool(cfv); --- 17 unchanged lines hidden (view full) --- 492 cfv->tx_hr + skb->len + cfv->tx_tr, cfv->mtu); 493 goto err; 494 } 495 496 buf_info = kmalloc(sizeof(struct buf_info), GFP_ATOMIC); 497 if (unlikely(!buf_info)) 498 goto err; 499 |
500 /* Make the IP header aligned in tbe buffer */ | 500 /* Make the IP header aligned in the buffer */ |
501 hdr_ofs = cfv->tx_hr + info->hdr_len; 502 pad_len = hdr_ofs & (IP_HDR_ALIGN - 1); 503 buf_info->size = cfv->tx_hr + skb->len + cfv->tx_tr + pad_len; 504 505 /* allocate dma memory buffer */ 506 buf_info->vaddr = (void *)gen_pool_alloc(cfv->genpool, buf_info->size); 507 if (unlikely(!buf_info->vaddr)) 508 goto err; --- 275 unchanged lines hidden --- | 501 hdr_ofs = cfv->tx_hr + info->hdr_len; 502 pad_len = hdr_ofs & (IP_HDR_ALIGN - 1); 503 buf_info->size = cfv->tx_hr + skb->len + cfv->tx_tr + pad_len; 504 505 /* allocate dma memory buffer */ 506 buf_info->vaddr = (void *)gen_pool_alloc(cfv->genpool, buf_info->size); 507 if (unlikely(!buf_info->vaddr)) 508 goto err; --- 275 unchanged lines hidden --- |