voicebus: Update the network debug device to use dma_pools.

r9402 switched to dma_pool for the SFRAMES. This updates the network
debug device to use the dma_pools for SFRAME allocation.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9877 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2011-04-04 16:24:33 +00:00
parent 1c42df4cd1
commit 50f51ee459
2 changed files with 12 additions and 9 deletions

View File

@ -32,11 +32,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#ifdef VOICEBUS_NET_DEBUG
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#endif
#define VOICEBUS_DEFAULT_LATENCY 3U #define VOICEBUS_DEFAULT_LATENCY 3U
#define VOICEBUS_DEFAULT_MAXLATENCY 25U #define VOICEBUS_DEFAULT_MAXLATENCY 25U
#define VOICEBUS_MAXLATENCY_BUMP 6U #define VOICEBUS_MAXLATENCY_BUMP 6U
@ -76,6 +71,11 @@ struct dahdi_fifo *dahdi_fifo_alloc(size_t maxsize, gfp_t alloc_flags);
#endif #endif
#ifdef VOICEBUS_NET_DEBUG
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#endif
struct voicebus; struct voicebus;

View File

@ -3,7 +3,7 @@
* *
* Written by Shaun Ruffell <sruffell@digium.com> * Written by Shaun Ruffell <sruffell@digium.com>
* *
* Copyright (C) 2010 Digium, Inc. * Copyright (C) 2010-2011 Digium, Inc.
* *
* All rights reserved. * All rights reserved.
@ -57,8 +57,9 @@ static void *
skb_to_vbb(struct voicebus *vb, struct sk_buff *skb) skb_to_vbb(struct voicebus *vb, struct sk_buff *skb)
{ {
int res; int res;
void *vbb; struct vbb *vbb;
const int COMMON_HEADER = 30; const int COMMON_HEADER = 30;
dma_addr_t dma_addr;
if (skb->len != (VOICEBUS_SFRAME_SIZE + COMMON_HEADER)) { if (skb->len != (VOICEBUS_SFRAME_SIZE + COMMON_HEADER)) {
dev_warn(&vb->pdev->dev, "Packet of length %d is not the " dev_warn(&vb->pdev->dev, "Packet of length %d is not the "
@ -67,13 +68,15 @@ skb_to_vbb(struct voicebus *vb, struct sk_buff *skb)
return NULL; return NULL;
} }
vbb = voicebus_alloc(vb); vbb = dma_pool_alloc(vb->pool, GFP_KERNEL, &dma_addr);
if (!vbb) if (!vbb)
return NULL; return NULL;
vbb->dma_addr = dma_addr;
res = skb_copy_bits(skb, COMMON_HEADER, vbb, VOICEBUS_SFRAME_SIZE); res = skb_copy_bits(skb, COMMON_HEADER, vbb, VOICEBUS_SFRAME_SIZE);
if (res) { if (res) {
dev_warn(&vb->pdev->dev, "Failed call to skb_copy_bits.\n"); dev_warn(&vb->pdev->dev, "Failed call to skb_copy_bits.\n");
voicebus_free(vb, vbb); dma_pool_free(vb->pool, vbb, vbb->dma_addr);
return NULL; return NULL;
} }
return vbb; return vbb;