aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>2005-04-24 21:53:06 -0400
committerDavid S. Miller <davem@davemloft.net>2005-04-24 21:53:06 -0400
commit56cb515628e6a831bb76783f282a71f7285dad33 (patch)
treeef7a70e6269eaf6f616066b6e1cd718a394d94bb /drivers
parent3b2d59d1fc86cc7217f165100a939907802dc67c (diff)
[AX25] Introduce ax25_type_trans
Replacing the open coded equivalents and making ax25 look more like a linux network protocol, i.e. more similar to inet. Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/hamradio/6pack.c4
-rw-r--r--drivers/net/hamradio/baycom_epp.c4
-rw-r--r--drivers/net/hamradio/bpqether.c10
-rw-r--r--drivers/net/hamradio/dmascc.c4
-rw-r--r--drivers/net/hamradio/hdlcdrv.c4
-rw-r--r--drivers/net/hamradio/mkiss.c4
-rw-r--r--drivers/net/hamradio/scc.c5
-rw-r--r--drivers/net/hamradio/yam.c4
8 files changed, 9 insertions, 30 deletions
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 067b353e1cbd..89454915b857 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -394,13 +394,11 @@ static void sp_bump(struct sixpack *sp, char cmd)
394 if ((skb = dev_alloc_skb(count)) == NULL) 394 if ((skb = dev_alloc_skb(count)) == NULL)
395 goto out_mem; 395 goto out_mem;
396 396
397 skb->dev = sp->dev;
398 ptr = skb_put(skb, count); 397 ptr = skb_put(skb, count);
399 *ptr++ = cmd; /* KISS command */ 398 *ptr++ = cmd; /* KISS command */
400 399
401 memcpy(ptr, sp->cooked_buf + 1, count); 400 memcpy(ptr, sp->cooked_buf + 1, count);
402 skb->mac.raw = skb->data; 401 skb->protocol = ax25_type_trans(skb, sp->dev);
403 skb->protocol = htons(ETH_P_AX25);
404 netif_rx(skb); 402 netif_rx(skb);
405 sp->dev->last_rx = jiffies; 403 sp->dev->last_rx = jiffies;
406 sp->stats.rx_packets++; 404 sp->stats.rx_packets++;
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index e8cb87d906fc..1c563f905a59 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -601,12 +601,10 @@ static void do_rxpacket(struct net_device *dev)
601 bc->stats.rx_dropped++; 601 bc->stats.rx_dropped++;
602 return; 602 return;
603 } 603 }
604 skb->dev = dev;
605 cp = skb_put(skb, pktlen); 604 cp = skb_put(skb, pktlen);
606 *cp++ = 0; /* KISS kludge */ 605 *cp++ = 0; /* KISS kludge */
607 memcpy(cp, bc->hdlcrx.buf, pktlen - 1); 606 memcpy(cp, bc->hdlcrx.buf, pktlen - 1);
608 skb->protocol = htons(ETH_P_AX25); 607 skb->protocol = ax25_type_trans(skb, dev);
609 skb->mac.raw = skb->data;
610 netif_rx(skb); 608 netif_rx(skb);
611 dev->last_rx = jiffies; 609 dev->last_rx = jiffies;
612 bc->stats.rx_packets++; 610 bc->stats.rx_packets++;
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index ef1a359e2273..ba9f0580e1f9 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -211,11 +211,7 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
211 ptr = skb_push(skb, 1); 211 ptr = skb_push(skb, 1);
212 *ptr = 0; 212 *ptr = 0;
213 213
214 skb->dev = dev; 214 skb->protocol = ax25_type_trans(skb, dev);
215 skb->protocol = htons(ETH_P_AX25);
216 skb->mac.raw = skb->data;
217 skb->pkt_type = PACKET_HOST;
218
219 netif_rx(skb); 215 netif_rx(skb);
220 dev->last_rx = jiffies; 216 dev->last_rx = jiffies;
221unlock: 217unlock:
@@ -272,8 +268,6 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
272 skb = newskb; 268 skb = newskb;
273 } 269 }
274 270
275 skb->protocol = htons(ETH_P_AX25);
276
277 ptr = skb_push(skb, 2); 271 ptr = skb_push(skb, 2);
278 272
279 *ptr++ = (size + 5) % 256; 273 *ptr++ = (size + 5) % 256;
@@ -287,7 +281,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
287 return -ENODEV; 281 return -ENODEV;
288 } 282 }
289 283
290 skb->dev = dev; 284 skb->protocol = ax25_type_trans(skb, dev);
291 skb->nh.raw = skb->data; 285 skb->nh.raw = skb->data;
292 dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0); 286 dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0);
293 bpq->stats.tx_packets++; 287 bpq->stats.tx_packets++;
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index f3269b70a8c5..f515245a3fd0 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -1306,9 +1306,7 @@ static void rx_bh(void *arg)
1306 data = skb_put(skb, cb + 1); 1306 data = skb_put(skb, cb + 1);
1307 data[0] = 0; 1307 data[0] = 0;
1308 memcpy(&data[1], priv->rx_buf[i], cb); 1308 memcpy(&data[1], priv->rx_buf[i], cb);
1309 skb->dev = priv->dev; 1309 skb->protocol = ax25_type_trans(skb, priv->dev);
1310 skb->protocol = ntohs(ETH_P_AX25);
1311 skb->mac.raw = skb->data;
1312 netif_rx(skb); 1310 netif_rx(skb);
1313 priv->dev->last_rx = jiffies; 1311 priv->dev->last_rx = jiffies;
1314 priv->stats.rx_packets++; 1312 priv->stats.rx_packets++;
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index b89959a596d7..b4c836e4fe86 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -174,12 +174,10 @@ static void hdlc_rx_flag(struct net_device *dev, struct hdlcdrv_state *s)
174 s->stats.rx_dropped++; 174 s->stats.rx_dropped++;
175 return; 175 return;
176 } 176 }
177 skb->dev = dev;
178 cp = skb_put(skb, pkt_len); 177 cp = skb_put(skb, pkt_len);
179 *cp++ = 0; /* KISS kludge */ 178 *cp++ = 0; /* KISS kludge */
180 memcpy(cp, s->hdlcrx.buffer, pkt_len - 1); 179 memcpy(cp, s->hdlcrx.buffer, pkt_len - 1);
181 skb->protocol = htons(ETH_P_AX25); 180 skb->protocol = ax25_type_trans(skb, dev);
182 skb->mac.raw = skb->data;
183 netif_rx(skb); 181 netif_rx(skb);
184 dev->last_rx = jiffies; 182 dev->last_rx = jiffies;
185 s->stats.rx_packets++; 183 s->stats.rx_packets++;
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index d9ea080aea0f..62790511098f 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -332,12 +332,10 @@ static void ax_bump(struct ax_disp *ax)
332 return; 332 return;
333 } 333 }
334 334
335 skb->dev = ax->dev;
336 spin_lock_bh(&ax->buflock); 335 spin_lock_bh(&ax->buflock);
337 memcpy(skb_put(skb,count), ax->rbuff, count); 336 memcpy(skb_put(skb,count), ax->rbuff, count);
338 spin_unlock_bh(&ax->buflock); 337 spin_unlock_bh(&ax->buflock);
339 skb->mac.raw = skb->data; 338 skb->protocol = ax25_type_trans(skb, ax->dev);
340 skb->protocol = htons(ETH_P_AX25);
341 netif_rx(skb); 339 netif_rx(skb);
342 ax->dev->last_rx = jiffies; 340 ax->dev->last_rx = jiffies;
343 ax->rx_packets++; 341 ax->rx_packets++;
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index ce9e7af020da..ece1b1a13186 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1630,10 +1630,7 @@ static void scc_net_rx(struct scc_channel *scc, struct sk_buff *skb)
1630 scc->dev_stat.rx_packets++; 1630 scc->dev_stat.rx_packets++;
1631 scc->dev_stat.rx_bytes += skb->len; 1631 scc->dev_stat.rx_bytes += skb->len;
1632 1632
1633 skb->dev = scc->dev; 1633 skb->protocol = ax25_type_trans(skb, scc->dev);
1634 skb->protocol = htons(ETH_P_AX25);
1635 skb->mac.raw = skb->data;
1636 skb->pkt_type = PACKET_HOST;
1637 1634
1638 netif_rx(skb); 1635 netif_rx(skb);
1639 scc->dev->last_rx = jiffies; 1636 scc->dev->last_rx = jiffies;
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index fd7b00fe38e5..41213ef602dc 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -522,12 +522,10 @@ static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp)
522 ++yp->stats.rx_dropped; 522 ++yp->stats.rx_dropped;
523 } else { 523 } else {
524 unsigned char *cp; 524 unsigned char *cp;
525 skb->dev = dev;
526 cp = skb_put(skb, pkt_len); 525 cp = skb_put(skb, pkt_len);
527 *cp++ = 0; /* KISS kludge */ 526 *cp++ = 0; /* KISS kludge */
528 memcpy(cp, yp->rx_buf, pkt_len - 1); 527 memcpy(cp, yp->rx_buf, pkt_len - 1);
529 skb->protocol = htons(ETH_P_AX25); 528 skb->protocol = ax25_type_trans(skb, dev);
530 skb->mac.raw = skb->data;
531 netif_rx(skb); 529 netif_rx(skb);
532 dev->last_rx = jiffies; 530 dev->last_rx = jiffies;
533 ++yp->stats.rx_packets; 531 ++yp->stats.rx_packets;