aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/atm/raw.c')
-rw-r--r--net/atm/raw.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/net/atm/raw.c b/net/atm/raw.c
index cbfcc71a17b1..b4f7b9ff3c74 100644
--- a/net/atm/raw.c
+++ b/net/atm/raw.c
@@ -2,6 +2,7 @@
2 2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4 4
5#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
5 6
6#include <linux/module.h> 7#include <linux/module.h>
7#include <linux/atmdev.h> 8#include <linux/atmdev.h>
@@ -9,6 +10,7 @@
9#include <linux/kernel.h> 10#include <linux/kernel.h>
10#include <linux/skbuff.h> 11#include <linux/skbuff.h>
11#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/slab.h>
12 14
13#include "common.h" 15#include "common.h"
14#include "protocols.h" 16#include "protocols.h"
@@ -17,7 +19,7 @@
17 * SKB == NULL indicates that the link is being closed 19 * SKB == NULL indicates that the link is being closed
18 */ 20 */
19 21
20static void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb) 22static void atm_push_raw(struct atm_vcc *vcc, struct sk_buff *skb)
21{ 23{
22 if (skb) { 24 if (skb) {
23 struct sock *sk = sk_atm(vcc); 25 struct sock *sk = sk_atm(vcc);
@@ -27,36 +29,33 @@ static void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
27 } 29 }
28} 30}
29 31
30 32static void atm_pop_raw(struct atm_vcc *vcc, struct sk_buff *skb)
31static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
32{ 33{
33 struct sock *sk = sk_atm(vcc); 34 struct sock *sk = sk_atm(vcc);
34 35
35 pr_debug("APopR (%d) %d -= %d\n", vcc->vci, 36 pr_debug("(%d) %d -= %d\n",
36 sk_wmem_alloc_get(sk), skb->truesize); 37 vcc->vci, sk_wmem_alloc_get(sk), skb->truesize);
37 atomic_sub(skb->truesize, &sk->sk_wmem_alloc); 38 atomic_sub(skb->truesize, &sk->sk_wmem_alloc);
38 dev_kfree_skb_any(skb); 39 dev_kfree_skb_any(skb);
39 sk->sk_write_space(sk); 40 sk->sk_write_space(sk);
40} 41}
41 42
42 43static int atm_send_aal0(struct atm_vcc *vcc, struct sk_buff *skb)
43static int atm_send_aal0(struct atm_vcc *vcc,struct sk_buff *skb)
44{ 44{
45 /* 45 /*
46 * Note that if vpi/vci are _ANY or _UNSPEC the below will 46 * Note that if vpi/vci are _ANY or _UNSPEC the below will
47 * still work 47 * still work
48 */ 48 */
49 if (!capable(CAP_NET_ADMIN) && 49 if (!capable(CAP_NET_ADMIN) &&
50 (((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) != 50 (((u32 *)skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
51 ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT))) 51 ((vcc->vpi << ATM_HDR_VPI_SHIFT) |
52 { 52 (vcc->vci << ATM_HDR_VCI_SHIFT))) {
53 kfree_skb(skb); 53 kfree_skb(skb);
54 return -EADDRNOTAVAIL; 54 return -EADDRNOTAVAIL;
55 } 55 }
56 return vcc->dev->ops->send(vcc,skb); 56 return vcc->dev->ops->send(vcc, skb);
57} 57}
58 58
59
60int atm_init_aal0(struct atm_vcc *vcc) 59int atm_init_aal0(struct atm_vcc *vcc)
61{ 60{
62 vcc->push = atm_push_raw; 61 vcc->push = atm_push_raw;
@@ -66,7 +65,6 @@ int atm_init_aal0(struct atm_vcc *vcc)
66 return 0; 65 return 0;
67} 66}
68 67
69
70int atm_init_aal34(struct atm_vcc *vcc) 68int atm_init_aal34(struct atm_vcc *vcc)
71{ 69{
72 vcc->push = atm_push_raw; 70 vcc->push = atm_push_raw;
@@ -76,7 +74,6 @@ int atm_init_aal34(struct atm_vcc *vcc)
76 return 0; 74 return 0;
77} 75}
78 76
79
80int atm_init_aal5(struct atm_vcc *vcc) 77int atm_init_aal5(struct atm_vcc *vcc)
81{ 78{
82 vcc->push = atm_push_raw; 79 vcc->push = atm_push_raw;
@@ -85,6 +82,4 @@ int atm_init_aal5(struct atm_vcc *vcc)
85 vcc->send = vcc->dev->ops->send; 82 vcc->send = vcc->dev->ops->send;
86 return 0; 83 return 0;
87} 84}
88
89
90EXPORT_SYMBOL(atm_init_aal5); 85EXPORT_SYMBOL(atm_init_aal5);