aboutsummaryrefslogtreecommitdiffstats
path: root/package/ifxmips-atm/src/skb.c
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2009-11-01 18:52:35 +0000
committerJohn Crispin <john@openwrt.org>2009-11-01 18:52:35 +0000
commit976d1a10243874c67f3cd7f5987c3a9a4136d9e7 (patch)
tree664a2ea026634c11dff4a2451dd2e0b309fd58df /package/ifxmips-atm/src/skb.c
parenteff68fb14bf3b423ea5ae58306b95581d3a76a11 (diff)
downloadupstream-976d1a10243874c67f3cd7f5987c3a9a4136d9e7.tar.gz
upstream-976d1a10243874c67f3cd7f5987c3a9a4136d9e7.tar.bz2
upstream-976d1a10243874c67f3cd7f5987c3a9a4136d9e7.zip
adds dsl support, thank you infineon/lantiq
SVN-Revision: 18259
Diffstat (limited to 'package/ifxmips-atm/src/skb.c')
-rw-r--r--package/ifxmips-atm/src/skb.c128
1 files changed, 0 insertions, 128 deletions
diff --git a/package/ifxmips-atm/src/skb.c b/package/ifxmips-atm/src/skb.c
deleted file mode 100644
index 7ad60fd757..0000000000
--- a/package/ifxmips-atm/src/skb.c
+++ /dev/null
@@ -1,128 +0,0 @@
-#include <linux/skbuff.h>
-
-#include "common.h"
-
-void resize_skb_rx(struct sk_buff *skb, unsigned int size, int is_cell)
-{
- if((u32)skb < 0x80000000)
- {
- int key = 0;
- printk("resize_skb_rx problem: skb = %08X, size = %d, is_cell = %d\n", (u32)skb, size, is_cell);
- while(!key){}
- }
- skb->data = (unsigned char*)(((u32)skb->head + 16 + (DMA_ALIGNMENT - 1)) & ~(DMA_ALIGNMENT - 1));
- skb->tail = skb->data;
-
- /* Set up other state */
- skb->len = 0;
- skb->cloned = 0;
-#if defined(CONFIG_IMQ) || defined (CONFIG_IMQ_MODULE)
- skb->imq_flags = 0;
- skb->nf_info = NULL;
-#endif
- skb->data_len = 0;
-}
-
-struct sk_buff* alloc_skb_rx(void)
-{
- struct sk_buff *skb;
-
- /* allocate memroy including trailer and padding */
- skb = dev_alloc_skb(ppe_dev.aal5.rx_buffer_size + DMA_ALIGNMENT);
- if (skb)
- {
- /* must be burst length alignment */
- if ( ((u32)skb->data & (DMA_ALIGNMENT - 1)) != 0 )
- skb_reserve(skb, ~((u32)skb->data + (DMA_ALIGNMENT - 1)) & (DMA_ALIGNMENT - 1));
- /* put skb in reserved area "skb->data - 4" */
- *((u32*)skb->data - 1) = (u32)skb;
- /* invalidate cache */
- dma_cache_inv((unsigned long)skb->head, (u32)skb->end - (u32)skb->head);
- }
- return skb;
-}
-
-void atm_free_tx_skb_vcc(struct sk_buff *skb)
-{
- struct atm_vcc* vcc;
-
- if ( (u32)skb <= 0x80000000 )
- {
- volatile int key = 0;
- printk("atm_free_tx_skb_vcc: skb = %08X\n", (u32)skb);
- for ( ; !key; );
- }
-
- vcc = ATM_SKB(skb)->vcc;
- if ( vcc != NULL && vcc->pop != NULL )
- {
- if ( atomic_read(&skb->users) == 0 )
- {
- volatile int key = 0;
- printk("atm_free_tx_skb_vcc(vcc->pop): skb->users == 0, skb = %08X\n", (u32)skb);
- for ( ; !key; );
- }
- vcc->pop(vcc, skb);
- }
- else
- {
- if ( atomic_read(&skb->users) == 0 )
- {
- volatile int key = 0;
- printk("atm_free_tx_skb_vcc(dev_kfree_skb_any): skb->users == 0, skb = %08X\n", (u32)skb);
- for ( ; !key; );
- }
- dev_kfree_skb_any(skb);
- }
-}
-
-struct sk_buff* alloc_skb_tx(unsigned int size)
-{
- struct sk_buff *skb;
-
- /* allocate memory including header and padding */
- size += TX_INBAND_HEADER_LENGTH + MAX_TX_PACKET_ALIGN_BYTES + MAX_TX_PACKET_PADDING_BYTES;
- size &= ~(DMA_ALIGNMENT - 1);
- skb = dev_alloc_skb(size + DMA_ALIGNMENT);
- /* must be burst length alignment */
- if ( skb )
- skb_reserve(skb, (~((u32)skb->data + (DMA_ALIGNMENT - 1)) & (DMA_ALIGNMENT - 1)) + TX_INBAND_HEADER_LENGTH);
- return skb;
-}
-
-struct sk_buff* atm_alloc_tx(struct atm_vcc *vcc, unsigned int size)
-{
- int conn;
- struct sk_buff *skb;
-
- /* oversize packet */
- if ( ((size + TX_INBAND_HEADER_LENGTH + MAX_TX_PACKET_ALIGN_BYTES + MAX_TX_PACKET_PADDING_BYTES) & ~(DMA_ALIGNMENT - 1)) > ppe_dev.aal5.tx_max_packet_size )
- {
- printk("atm_alloc_tx: oversize packet\n");
- return NULL;
- }
- /* send buffer overflow */
- if ( atomic_read(&vcc->sk.sk_wmem_alloc) && !atm_may_send(vcc, size) )
- {
- printk("atm_alloc_tx: send buffer overflow\n");
- return NULL;
- }
- conn = find_vcc(vcc);
- if ( conn < 0 )
- {
- printk("atm_alloc_tx: unknown VCC\n");
- return NULL;
- }
-
- skb = dev_alloc_skb(size);
- if ( skb == NULL )
- {
- printk("atm_alloc_tx: sk buffer is used up\n");
- return NULL;
- }
-#define ATM_PDU_OVHD 0
- atomic_add(skb->truesize + ATM_PDU_OVHD, &vcc->sk.sk_wmem_alloc);
-
- return skb;
-}
-