diff options
Diffstat (limited to 'net/phonet')
-rw-r--r-- | net/phonet/pep-gprs.c | 41 | ||||
-rw-r--r-- | net/phonet/sysctl.c | 2 |
2 files changed, 18 insertions, 25 deletions
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c index 9978afbd9f2a..e6e8e44852e5 100644 --- a/net/phonet/pep-gprs.c +++ b/net/phonet/pep-gprs.c | |||
@@ -41,7 +41,6 @@ struct gprs_dev { | |||
41 | void (*old_write_space)(struct sock *); | 41 | void (*old_write_space)(struct sock *); |
42 | 42 | ||
43 | struct net_device *net; | 43 | struct net_device *net; |
44 | struct net_device_stats stats; | ||
45 | 44 | ||
46 | struct sk_buff_head tx_queue; | 45 | struct sk_buff_head tx_queue; |
47 | struct work_struct tx_work; | 46 | struct work_struct tx_work; |
@@ -49,14 +48,14 @@ struct gprs_dev { | |||
49 | unsigned tx_max; | 48 | unsigned tx_max; |
50 | }; | 49 | }; |
51 | 50 | ||
52 | static int gprs_type_trans(struct sk_buff *skb) | 51 | static __be16 gprs_type_trans(struct sk_buff *skb) |
53 | { | 52 | { |
54 | const u8 *pvfc; | 53 | const u8 *pvfc; |
55 | u8 buf; | 54 | u8 buf; |
56 | 55 | ||
57 | pvfc = skb_header_pointer(skb, 0, 1, &buf); | 56 | pvfc = skb_header_pointer(skb, 0, 1, &buf); |
58 | if (!pvfc) | 57 | if (!pvfc) |
59 | return 0; | 58 | return htons(0); |
60 | /* Look at IP version field */ | 59 | /* Look at IP version field */ |
61 | switch (*pvfc >> 4) { | 60 | switch (*pvfc >> 4) { |
62 | case 4: | 61 | case 4: |
@@ -64,7 +63,7 @@ static int gprs_type_trans(struct sk_buff *skb) | |||
64 | case 6: | 63 | case 6: |
65 | return htons(ETH_P_IPV6); | 64 | return htons(ETH_P_IPV6); |
66 | } | 65 | } |
67 | return 0; | 66 | return htons(0); |
68 | } | 67 | } |
69 | 68 | ||
70 | /* | 69 | /* |
@@ -83,8 +82,9 @@ static void gprs_state_change(struct sock *sk) | |||
83 | 82 | ||
84 | static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) | 83 | static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) |
85 | { | 84 | { |
85 | struct net_device *net = dev->net; | ||
86 | int err = 0; | 86 | int err = 0; |
87 | u16 protocol = gprs_type_trans(skb); | 87 | __be16 protocol = gprs_type_trans(skb); |
88 | 88 | ||
89 | if (!protocol) { | 89 | if (!protocol) { |
90 | err = -EINVAL; | 90 | err = -EINVAL; |
@@ -99,7 +99,7 @@ static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) | |||
99 | * so wrap the IP packet as a single fragment of an head-less | 99 | * so wrap the IP packet as a single fragment of an head-less |
100 | * socket buffer. The network stack will pull what it needs, | 100 | * socket buffer. The network stack will pull what it needs, |
101 | * but at least, the whole IP payload is not memcpy'd. */ | 101 | * but at least, the whole IP payload is not memcpy'd. */ |
102 | rskb = netdev_alloc_skb(dev->net, 0); | 102 | rskb = netdev_alloc_skb(net, 0); |
103 | if (!rskb) { | 103 | if (!rskb) { |
104 | err = -ENOBUFS; | 104 | err = -ENOBUFS; |
105 | goto drop; | 105 | goto drop; |
@@ -123,11 +123,11 @@ static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) | |||
123 | 123 | ||
124 | skb->protocol = protocol; | 124 | skb->protocol = protocol; |
125 | skb_reset_mac_header(skb); | 125 | skb_reset_mac_header(skb); |
126 | skb->dev = dev->net; | 126 | skb->dev = net; |
127 | 127 | ||
128 | if (likely(dev->net->flags & IFF_UP)) { | 128 | if (likely(net->flags & IFF_UP)) { |
129 | dev->stats.rx_packets++; | 129 | net->stats.rx_packets++; |
130 | dev->stats.rx_bytes += skb->len; | 130 | net->stats.rx_bytes += skb->len; |
131 | netif_rx(skb); | 131 | netif_rx(skb); |
132 | skb = NULL; | 132 | skb = NULL; |
133 | } else | 133 | } else |
@@ -136,7 +136,7 @@ static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb) | |||
136 | drop: | 136 | drop: |
137 | if (skb) { | 137 | if (skb) { |
138 | dev_kfree_skb(skb); | 138 | dev_kfree_skb(skb); |
139 | dev->stats.rx_dropped++; | 139 | net->stats.rx_dropped++; |
140 | } | 140 | } |
141 | return err; | 141 | return err; |
142 | } | 142 | } |
@@ -199,14 +199,15 @@ static int gprs_xmit(struct sk_buff *skb, struct net_device *net) | |||
199 | static void gprs_tx(struct work_struct *work) | 199 | static void gprs_tx(struct work_struct *work) |
200 | { | 200 | { |
201 | struct gprs_dev *dev = container_of(work, struct gprs_dev, tx_work); | 201 | struct gprs_dev *dev = container_of(work, struct gprs_dev, tx_work); |
202 | struct net_device *net = dev->net; | ||
202 | struct sock *sk = dev->sk; | 203 | struct sock *sk = dev->sk; |
203 | struct sk_buff *skb; | 204 | struct sk_buff *skb; |
204 | 205 | ||
205 | while ((skb = skb_dequeue(&dev->tx_queue)) != NULL) { | 206 | while ((skb = skb_dequeue(&dev->tx_queue)) != NULL) { |
206 | int err; | 207 | int err; |
207 | 208 | ||
208 | dev->stats.tx_bytes += skb->len; | 209 | net->stats.tx_bytes += skb->len; |
209 | dev->stats.tx_packets++; | 210 | net->stats.tx_packets++; |
210 | 211 | ||
211 | skb_orphan(skb); | 212 | skb_orphan(skb); |
212 | skb_set_owner_w(skb, sk); | 213 | skb_set_owner_w(skb, sk); |
@@ -215,9 +216,9 @@ static void gprs_tx(struct work_struct *work) | |||
215 | err = pep_write(sk, skb); | 216 | err = pep_write(sk, skb); |
216 | if (err) { | 217 | if (err) { |
217 | LIMIT_NETDEBUG(KERN_WARNING"%s: TX error (%d)\n", | 218 | LIMIT_NETDEBUG(KERN_WARNING"%s: TX error (%d)\n", |
218 | dev->net->name, err); | 219 | net->name, err); |
219 | dev->stats.tx_aborted_errors++; | 220 | net->stats.tx_aborted_errors++; |
220 | dev->stats.tx_errors++; | 221 | net->stats.tx_errors++; |
221 | } | 222 | } |
222 | release_sock(sk); | 223 | release_sock(sk); |
223 | } | 224 | } |
@@ -236,13 +237,6 @@ static int gprs_set_mtu(struct net_device *net, int new_mtu) | |||
236 | return 0; | 237 | return 0; |
237 | } | 238 | } |
238 | 239 | ||
239 | static struct net_device_stats *gprs_get_stats(struct net_device *net) | ||
240 | { | ||
241 | struct gprs_dev *dev = netdev_priv(net); | ||
242 | |||
243 | return &dev->stats; | ||
244 | } | ||
245 | |||
246 | static void gprs_setup(struct net_device *net) | 240 | static void gprs_setup(struct net_device *net) |
247 | { | 241 | { |
248 | net->features = NETIF_F_FRAGLIST; | 242 | net->features = NETIF_F_FRAGLIST; |
@@ -256,7 +250,6 @@ static void gprs_setup(struct net_device *net) | |||
256 | net->destructor = free_netdev; | 250 | net->destructor = free_netdev; |
257 | net->hard_start_xmit = gprs_xmit; /* mandatory */ | 251 | net->hard_start_xmit = gprs_xmit; /* mandatory */ |
258 | net->change_mtu = gprs_set_mtu; | 252 | net->change_mtu = gprs_set_mtu; |
259 | net->get_stats = gprs_get_stats; | ||
260 | } | 253 | } |
261 | 254 | ||
262 | /* | 255 | /* |
diff --git a/net/phonet/sysctl.c b/net/phonet/sysctl.c index 600a4309b8c8..0e3347bbdb12 100644 --- a/net/phonet/sysctl.c +++ b/net/phonet/sysctl.c | |||
@@ -89,7 +89,7 @@ static struct ctl_table phonet_table[] = { | |||
89 | .data = &local_port_range, | 89 | .data = &local_port_range, |
90 | .maxlen = sizeof(local_port_range), | 90 | .maxlen = sizeof(local_port_range), |
91 | .mode = 0644, | 91 | .mode = 0644, |
92 | .proc_handler = &proc_local_port_range, | 92 | .proc_handler = proc_local_port_range, |
93 | .strategy = NULL, | 93 | .strategy = NULL, |
94 | }, | 94 | }, |
95 | { .ctl_name = 0 } | 95 | { .ctl_name = 0 } |