~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to net/x25/x25_dev.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <linux/kernel.h>
21
21
#include <linux/netdevice.h>
22
22
#include <linux/skbuff.h>
 
23
#include <linux/slab.h>
23
24
#include <net/sock.h>
24
25
#include <linux/if_arp.h>
25
26
#include <net/x25.h>
 
27
#include <net/x25device.h>
26
28
 
27
29
static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
28
30
{
53
55
                if (!sock_owned_by_user(sk)) {
54
56
                        queued = x25_process_rx_frame(sk, skb);
55
57
                } else {
56
 
                        sk_add_backlog(sk, skb);
 
58
                        queued = !sk_add_backlog(sk, skb);
57
59
                }
58
60
                bh_unlock_sock(sk);
59
61
                sock_put(sk);
114
116
        }
115
117
 
116
118
        switch (skb->data[0]) {
117
 
                case 0x00:
118
 
                        skb_pull(skb, 1);
119
 
                        if (x25_receive_data(skb, nb)) {
120
 
                                x25_neigh_put(nb);
121
 
                                goto out;
122
 
                        }
123
 
                        break;
124
 
                case 0x01:
125
 
                        x25_link_established(nb);
126
 
                        break;
127
 
                case 0x02:
128
 
                        x25_link_terminated(nb);
129
 
                        break;
 
119
 
 
120
        case X25_IFACE_DATA:
 
121
                skb_pull(skb, 1);
 
122
                if (x25_receive_data(skb, nb)) {
 
123
                        x25_neigh_put(nb);
 
124
                        goto out;
 
125
                }
 
126
                break;
 
127
 
 
128
        case X25_IFACE_CONNECT:
 
129
                x25_link_established(nb);
 
130
                break;
 
131
 
 
132
        case X25_IFACE_DISCONNECT:
 
133
                x25_link_terminated(nb);
 
134
                break;
130
135
        }
131
136
        x25_neigh_put(nb);
132
137
drop:
147
152
                                return;
148
153
                        }
149
154
                        ptr  = skb_put(skb, 1);
150
 
                        *ptr = 0x01;
 
155
                        *ptr = X25_IFACE_CONNECT;
151
156
                        break;
152
157
 
153
158
#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
183
188
        }
184
189
 
185
190
        ptr  = skb_put(skb, 1);
186
 
        *ptr = 0x02;
 
191
        *ptr = X25_IFACE_DISCONNECT;
187
192
 
188
193
        skb->protocol = htons(ETH_P_X25);
189
194
        skb->dev      = nb->dev;
199
204
        switch (nb->dev->type) {
200
205
                case ARPHRD_X25:
201
206
                        dptr  = skb_push(skb, 1);
202
 
                        *dptr = 0x00;
 
207
                        *dptr = X25_IFACE_DATA;
203
208
                        break;
204
209
 
205
210
#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)