diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-14 08:19:08 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-14 08:19:08 -0400 |
| commit | 905ec87e93bc9e01b15c60035cd6a50c636cbaef (patch) | |
| tree | 46fd7618d6511611ffc19eb0dd4d7bc6b90a41c2 /net/netrom/nr_dev.c | |
| parent | 1d6ae775d7a948c9575658eb41184fd2e506c0df (diff) | |
| parent | 2f4ba45a75d6383b4a1201169a808ffea416ffa0 (diff) | |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'net/netrom/nr_dev.c')
| -rw-r--r-- | net/netrom/nr_dev.c | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 263da4c26494..4e66eef9a034 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c | |||
| @@ -47,7 +47,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) | |||
| 47 | struct net_device_stats *stats = netdev_priv(dev); | 47 | struct net_device_stats *stats = netdev_priv(dev); |
| 48 | 48 | ||
| 49 | if (!netif_running(dev)) { | 49 | if (!netif_running(dev)) { |
| 50 | stats->rx_errors++; | 50 | stats->rx_dropped++; |
| 51 | return 0; | 51 | return 0; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| @@ -71,15 +71,10 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) | |||
| 71 | 71 | ||
| 72 | static int nr_rebuild_header(struct sk_buff *skb) | 72 | static int nr_rebuild_header(struct sk_buff *skb) |
| 73 | { | 73 | { |
| 74 | struct net_device *dev = skb->dev; | ||
| 75 | struct net_device_stats *stats = netdev_priv(dev); | ||
| 76 | struct sk_buff *skbn; | ||
| 77 | unsigned char *bp = skb->data; | 74 | unsigned char *bp = skb->data; |
| 78 | int len; | ||
| 79 | 75 | ||
| 80 | if (arp_find(bp + 7, skb)) { | 76 | if (arp_find(bp + 7, skb)) |
| 81 | return 1; | 77 | return 1; |
| 82 | } | ||
| 83 | 78 | ||
| 84 | bp[6] &= ~AX25_CBIT; | 79 | bp[6] &= ~AX25_CBIT; |
| 85 | bp[6] &= ~AX25_EBIT; | 80 | bp[6] &= ~AX25_EBIT; |
| @@ -90,27 +85,7 @@ static int nr_rebuild_header(struct sk_buff *skb) | |||
| 90 | bp[6] |= AX25_EBIT; | 85 | bp[6] |= AX25_EBIT; |
| 91 | bp[6] |= AX25_SSSID_SPARE; | 86 | bp[6] |= AX25_SSSID_SPARE; |
| 92 | 87 | ||
| 93 | if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) { | 88 | return 0; |
| 94 | kfree_skb(skb); | ||
| 95 | return 1; | ||
| 96 | } | ||
| 97 | |||
| 98 | if (skb->sk != NULL) | ||
| 99 | skb_set_owner_w(skbn, skb->sk); | ||
| 100 | |||
| 101 | kfree_skb(skb); | ||
| 102 | |||
| 103 | len = skbn->len; | ||
| 104 | |||
| 105 | if (!nr_route_frame(skbn, NULL)) { | ||
| 106 | kfree_skb(skbn); | ||
| 107 | stats->tx_errors++; | ||
| 108 | } | ||
| 109 | |||
| 110 | stats->tx_packets++; | ||
| 111 | stats->tx_bytes += len; | ||
| 112 | |||
| 113 | return 1; | ||
| 114 | } | 89 | } |
| 115 | 90 | ||
| 116 | #else | 91 | #else |
| @@ -185,15 +160,27 @@ static int nr_close(struct net_device *dev) | |||
| 185 | 160 | ||
| 186 | static int nr_xmit(struct sk_buff *skb, struct net_device *dev) | 161 | static int nr_xmit(struct sk_buff *skb, struct net_device *dev) |
| 187 | { | 162 | { |
| 188 | struct net_device_stats *stats = netdev_priv(dev); | 163 | struct nr_private *nr = netdev_priv(dev); |
| 189 | dev_kfree_skb(skb); | 164 | struct net_device_stats *stats = &nr->stats; |
| 190 | stats->tx_errors++; | 165 | unsigned int len = skb->len; |
| 166 | |||
| 167 | if (!nr_route_frame(skb, NULL)) { | ||
| 168 | kfree_skb(skb); | ||
| 169 | stats->tx_errors++; | ||
| 170 | return 0; | ||
| 171 | } | ||
| 172 | |||
| 173 | stats->tx_packets++; | ||
| 174 | stats->tx_bytes += len; | ||
| 175 | |||
| 191 | return 0; | 176 | return 0; |
| 192 | } | 177 | } |
| 193 | 178 | ||
| 194 | static struct net_device_stats *nr_get_stats(struct net_device *dev) | 179 | static struct net_device_stats *nr_get_stats(struct net_device *dev) |
| 195 | { | 180 | { |
| 196 | return netdev_priv(dev); | 181 | struct nr_private *nr = netdev_priv(dev); |
| 182 | |||
| 183 | return &nr->stats; | ||
| 197 | } | 184 | } |
| 198 | 185 | ||
| 199 | void nr_setup(struct net_device *dev) | 186 | void nr_setup(struct net_device *dev) |
| @@ -208,12 +195,11 @@ void nr_setup(struct net_device *dev) | |||
| 208 | dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; | 195 | dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; |
| 209 | dev->addr_len = AX25_ADDR_LEN; | 196 | dev->addr_len = AX25_ADDR_LEN; |
| 210 | dev->type = ARPHRD_NETROM; | 197 | dev->type = ARPHRD_NETROM; |
| 211 | dev->tx_queue_len = 40; | ||
| 212 | dev->rebuild_header = nr_rebuild_header; | 198 | dev->rebuild_header = nr_rebuild_header; |
| 213 | dev->set_mac_address = nr_set_mac_address; | 199 | dev->set_mac_address = nr_set_mac_address; |
| 214 | 200 | ||
| 215 | /* New-style flags. */ | 201 | /* New-style flags. */ |
| 216 | dev->flags = 0; | 202 | dev->flags = IFF_NOARP; |
| 217 | 203 | ||
| 218 | dev->get_stats = nr_get_stats; | 204 | dev->get_stats = nr_get_stats; |
| 219 | } | 205 | } |
