ia64/linux-2.6.18-xen.hg

view net/rose/rose_out.c @ 871:9cbcc9008446

xen/x86: don't initialize cpu_data[]'s apicid field on generic code

Afaict, this is not only redundant with the intialization done in
drivers/xen/core/smpboot.c, but actually results - at least for
secondary CPUs - in the Xen-specific value written to be later
overwritten with whatever the generic code determines (with no
guarantee that the two values are identical).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 14 10:09:15 2009 +0100 (2009-05-14)
parents 831230e53067
children
line source
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
8 */
9 #include <linux/errno.h>
10 #include <linux/types.h>
11 #include <linux/socket.h>
12 #include <linux/in.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
15 #include <linux/timer.h>
16 #include <linux/string.h>
17 #include <linux/sockios.h>
18 #include <linux/net.h>
19 #include <net/ax25.h>
20 #include <linux/inet.h>
21 #include <linux/netdevice.h>
22 #include <linux/skbuff.h>
23 #include <net/sock.h>
24 #include <asm/system.h>
25 #include <linux/fcntl.h>
26 #include <linux/mm.h>
27 #include <linux/interrupt.h>
28 #include <net/rose.h>
30 /*
31 * This procedure is passed a buffer descriptor for an iframe. It builds
32 * the rest of the control part of the frame and then writes it out.
33 */
34 static void rose_send_iframe(struct sock *sk, struct sk_buff *skb)
35 {
36 struct rose_sock *rose = rose_sk(sk);
38 if (skb == NULL)
39 return;
41 skb->data[2] |= (rose->vr << 5) & 0xE0;
42 skb->data[2] |= (rose->vs << 1) & 0x0E;
44 rose_start_idletimer(sk);
46 rose_transmit_link(skb, rose->neighbour);
47 }
49 void rose_kick(struct sock *sk)
50 {
51 struct rose_sock *rose = rose_sk(sk);
52 struct sk_buff *skb, *skbn;
53 unsigned short start, end;
55 if (rose->state != ROSE_STATE_3)
56 return;
58 if (rose->condition & ROSE_COND_PEER_RX_BUSY)
59 return;
61 if (!skb_peek(&sk->sk_write_queue))
62 return;
64 start = (skb_peek(&rose->ack_queue) == NULL) ? rose->va : rose->vs;
65 end = (rose->va + sysctl_rose_window_size) % ROSE_MODULUS;
67 if (start == end)
68 return;
70 rose->vs = start;
72 /*
73 * Transmit data until either we're out of data to send or
74 * the window is full.
75 */
77 skb = skb_dequeue(&sk->sk_write_queue);
79 do {
80 if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
81 skb_queue_head(&sk->sk_write_queue, skb);
82 break;
83 }
85 skb_set_owner_w(skbn, sk);
87 /*
88 * Transmit the frame copy.
89 */
90 rose_send_iframe(sk, skbn);
92 rose->vs = (rose->vs + 1) % ROSE_MODULUS;
94 /*
95 * Requeue the original data frame.
96 */
97 skb_queue_tail(&rose->ack_queue, skb);
99 } while (rose->vs != end &&
100 (skb = skb_dequeue(&sk->sk_write_queue)) != NULL);
102 rose->vl = rose->vr;
103 rose->condition &= ~ROSE_COND_ACK_PENDING;
105 rose_stop_timer(sk);
106 }
108 /*
109 * The following routines are taken from page 170 of the 7th ARRL Computer
110 * Networking Conference paper, as is the whole state machine.
111 */
113 void rose_enquiry_response(struct sock *sk)
114 {
115 struct rose_sock *rose = rose_sk(sk);
117 if (rose->condition & ROSE_COND_OWN_RX_BUSY)
118 rose_write_internal(sk, ROSE_RNR);
119 else
120 rose_write_internal(sk, ROSE_RR);
122 rose->vl = rose->vr;
123 rose->condition &= ~ROSE_COND_ACK_PENDING;
125 rose_stop_timer(sk);
126 }