Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56cb5156 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller
Browse files

[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: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3b2d59d1
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -394,13 +394,11 @@ static void sp_bump(struct sixpack *sp, char cmd)
	if ((skb = dev_alloc_skb(count)) == NULL)
	if ((skb = dev_alloc_skb(count)) == NULL)
		goto out_mem;
		goto out_mem;


	skb->dev = sp->dev;
	ptr = skb_put(skb, count);
	ptr = skb_put(skb, count);
	*ptr++ = cmd;	/* KISS command */
	*ptr++ = cmd;	/* KISS command */


	memcpy(ptr, sp->cooked_buf + 1, count);
	memcpy(ptr, sp->cooked_buf + 1, count);
	skb->mac.raw = skb->data;
	skb->protocol = ax25_type_trans(skb, sp->dev);
	skb->protocol = htons(ETH_P_AX25);
	netif_rx(skb);
	netif_rx(skb);
	sp->dev->last_rx = jiffies;
	sp->dev->last_rx = jiffies;
	sp->stats.rx_packets++;
	sp->stats.rx_packets++;
+1 −3
Original line number Original line Diff line number Diff line
@@ -601,12 +601,10 @@ static void do_rxpacket(struct net_device *dev)
		bc->stats.rx_dropped++;
		bc->stats.rx_dropped++;
		return;
		return;
	}
	}
	skb->dev = dev;
	cp = skb_put(skb, pktlen);
	cp = skb_put(skb, pktlen);
	*cp++ = 0; /* KISS kludge */
	*cp++ = 0; /* KISS kludge */
	memcpy(cp, bc->hdlcrx.buf, pktlen - 1);
	memcpy(cp, bc->hdlcrx.buf, pktlen - 1);
	skb->protocol = htons(ETH_P_AX25);
	skb->protocol = ax25_type_trans(skb, dev);
	skb->mac.raw = skb->data;
	netif_rx(skb);
	netif_rx(skb);
	dev->last_rx = jiffies;
	dev->last_rx = jiffies;
	bc->stats.rx_packets++;
	bc->stats.rx_packets++;
+2 −8
Original line number Original line Diff line number Diff line
@@ -211,11 +211,7 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
	ptr = skb_push(skb, 1);
	ptr = skb_push(skb, 1);
	*ptr = 0;
	*ptr = 0;


	skb->dev = dev;
	skb->protocol = ax25_type_trans(skb, dev);
	skb->protocol = htons(ETH_P_AX25);
	skb->mac.raw = skb->data;
	skb->pkt_type = PACKET_HOST;

	netif_rx(skb);
	netif_rx(skb);
	dev->last_rx = jiffies;
	dev->last_rx = jiffies;
unlock:
unlock:
@@ -272,8 +268,6 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
		skb = newskb;
		skb = newskb;
	}
	}


	skb->protocol = htons(ETH_P_AX25);

	ptr = skb_push(skb, 2);
	ptr = skb_push(skb, 2);


	*ptr++ = (size + 5) % 256;
	*ptr++ = (size + 5) % 256;
@@ -287,7 +281,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
		return -ENODEV;
		return -ENODEV;
	}
	}


	skb->dev = dev;
	skb->protocol = ax25_type_trans(skb, dev);
	skb->nh.raw = skb->data;
	skb->nh.raw = skb->data;
	dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0);
	dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0);
	bpq->stats.tx_packets++;
	bpq->stats.tx_packets++;
+1 −3
Original line number Original line Diff line number Diff line
@@ -1306,9 +1306,7 @@ static void rx_bh(void *arg)
			data = skb_put(skb, cb + 1);
			data = skb_put(skb, cb + 1);
			data[0] = 0;
			data[0] = 0;
			memcpy(&data[1], priv->rx_buf[i], cb);
			memcpy(&data[1], priv->rx_buf[i], cb);
			skb->dev = priv->dev;
			skb->protocol = ax25_type_trans(skb, priv->dev);
			skb->protocol = ntohs(ETH_P_AX25);
			skb->mac.raw = skb->data;
			netif_rx(skb);
			netif_rx(skb);
			priv->dev->last_rx = jiffies;
			priv->dev->last_rx = jiffies;
			priv->stats.rx_packets++;
			priv->stats.rx_packets++;
+1 −3
Original line number Original line Diff line number Diff line
@@ -174,12 +174,10 @@ static void hdlc_rx_flag(struct net_device *dev, struct hdlcdrv_state *s)
		s->stats.rx_dropped++;
		s->stats.rx_dropped++;
		return;
		return;
	}
	}
	skb->dev = dev;
	cp = skb_put(skb, pkt_len);
	cp = skb_put(skb, pkt_len);
	*cp++ = 0; /* KISS kludge */
	*cp++ = 0; /* KISS kludge */
	memcpy(cp, s->hdlcrx.buffer, pkt_len - 1);
	memcpy(cp, s->hdlcrx.buffer, pkt_len - 1);
	skb->protocol = htons(ETH_P_AX25);
	skb->protocol = ax25_type_trans(skb, dev);
	skb->mac.raw = skb->data;
	netif_rx(skb);
	netif_rx(skb);
	dev->last_rx = jiffies;
	dev->last_rx = jiffies;
	s->stats.rx_packets++;
	s->stats.rx_packets++;
Loading