OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [net/] [atm/] [raw.c] - Diff between revs 1275 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 1275 Rev 1765
/* net/atm/raw.c - Raw AAL0 and AAL5 transports */
/* net/atm/raw.c - Raw AAL0 and AAL5 transports */
 
 
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
 
 
 
 
#include <linux/module.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/atmdev.h>
#include <linux/atmdev.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <linux/mm.h>
#include <linux/mm.h>
 
 
#include "common.h"
#include "common.h"
#include "protocols.h"
#include "protocols.h"
 
 
 
 
#if 0
#if 0
#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
#else
#else
#define DPRINTK(format,args...)
#define DPRINTK(format,args...)
#endif
#endif
 
 
 
 
/*
/*
 * SKB == NULL indicates that the link is being closed
 * SKB == NULL indicates that the link is being closed
 */
 */
 
 
void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
{
{
        if (skb) {
        if (skb) {
                skb_queue_tail(&vcc->sk->receive_queue,skb);
                skb_queue_tail(&vcc->sk->receive_queue,skb);
                wake_up(&vcc->sleep);
                wake_up(&vcc->sleep);
        }
        }
}
}
 
 
 
 
static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
{
{
        DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->sk->wmem_alloc,skb->truesize);
        DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->sk->wmem_alloc,skb->truesize);
        atomic_sub(skb->truesize, &vcc->sk->wmem_alloc);
        atomic_sub(skb->truesize, &vcc->sk->wmem_alloc);
        dev_kfree_skb_any(skb);
        dev_kfree_skb_any(skb);
        wake_up(&vcc->sleep);
        wake_up(&vcc->sleep);
}
}
 
 
 
 
static int atm_send_aal0(struct atm_vcc *vcc,struct sk_buff *skb)
static int atm_send_aal0(struct atm_vcc *vcc,struct sk_buff *skb)
{
{
        /*
        /*
         * Note that if vpi/vci are _ANY or _UNSPEC the below will
         * Note that if vpi/vci are _ANY or _UNSPEC the below will
         * still work
         * still work
         */
         */
        if (!capable(CAP_NET_ADMIN) &&
        if (!capable(CAP_NET_ADMIN) &&
            (((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
            (((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
            ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT)))
            ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT)))
            {
            {
                kfree_skb(skb);
                kfree_skb(skb);
                return -EADDRNOTAVAIL;
                return -EADDRNOTAVAIL;
        }
        }
        return vcc->dev->ops->send(vcc,skb);
        return vcc->dev->ops->send(vcc,skb);
}
}
 
 
 
 
int atm_init_aal0(struct atm_vcc *vcc)
int atm_init_aal0(struct atm_vcc *vcc)
{
{
        vcc->push = atm_push_raw;
        vcc->push = atm_push_raw;
        vcc->pop = atm_pop_raw;
        vcc->pop = atm_pop_raw;
        vcc->push_oam = NULL;
        vcc->push_oam = NULL;
        vcc->send = atm_send_aal0;
        vcc->send = atm_send_aal0;
        return 0;
        return 0;
}
}
 
 
 
 
int atm_init_aal34(struct atm_vcc *vcc)
int atm_init_aal34(struct atm_vcc *vcc)
{
{
        vcc->push = atm_push_raw;
        vcc->push = atm_push_raw;
        vcc->pop = atm_pop_raw;
        vcc->pop = atm_pop_raw;
        vcc->push_oam = NULL;
        vcc->push_oam = NULL;
        vcc->send = vcc->dev->ops->send;
        vcc->send = vcc->dev->ops->send;
        return 0;
        return 0;
}
}
 
 
 
 
int atm_init_aal5(struct atm_vcc *vcc)
int atm_init_aal5(struct atm_vcc *vcc)
{
{
        vcc->push = atm_push_raw;
        vcc->push = atm_push_raw;
        vcc->pop = atm_pop_raw;
        vcc->pop = atm_pop_raw;
        vcc->push_oam = NULL;
        vcc->push_oam = NULL;
        vcc->send = vcc->dev->ops->send;
        vcc->send = vcc->dev->ops->send;
        return 0;
        return 0;
}
}
 
 
 
 
EXPORT_SYMBOL(atm_init_aal5);
EXPORT_SYMBOL(atm_init_aal5);
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.