26 #include <linux/module.h>
29 #include <linux/if_arp.h>
31 #include <linux/netdevice.h>
35 #define VERSION "arcnet: RFC1051 \"simple standard\" (`s') encapsulation support loaded.\n"
47 static struct ArcProto rfc1051_proto =
53 .build_header = build_header,
54 .prepare_tx = prepare_tx,
60 static int __init arcnet_rfc1051_init(
void)
75 static void __exit arcnet_rfc1051_exit(
void)
97 skb_reset_mac_header(skb);
100 if (pkt->
hard.dest == 0)
108 switch (
soft->proto) {
115 dev->
stats.rx_errors++;
116 dev->
stats.rx_crc_errors++;
128 struct arcnet_local *
lp = netdev_priv(dev);
130 struct archdr *pkt = pkthdr;
133 BUGMSG(D_DURING,
"it's a raw packet (length=%d)\n", length);
142 BUGMSG(D_NORMAL,
"Memory squeeze, dropping packet.\n");
143 dev->
stats.rx_dropped++;
153 if (length >
sizeof(pkt->
soft))
154 lp->hw.copy_from_card(dev, bufnum, ofs +
sizeof(pkt->
soft),
156 length -
sizeof(pkt->
soft));
158 BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "
rx");
160 skb->
protocol = type_trans(skb, dev);
184 BUGMSG(D_NORMAL,
"RFC1051: I don't understand protocol %d (%Xh)\n",
186 dev->stats.tx_errors++;
187 dev->stats.tx_aborted_errors++;
199 pkt->
hard.source = *dev->dev_addr;
218 static int prepare_tx(
struct net_device *dev,
struct archdr *pkt,
int length,
221 struct arcnet_local *lp = netdev_priv(dev);
225 BUGMSG(D_DURING,
"prepare_tx: txbufs=%d/%d/%d\n",
226 lp->next_tx, lp->cur_tx, bufnum);
232 BUGMSG(D_NORMAL,
"Bug! prepare_tx with size %d (> %d)\n",
236 if (length > MinTU) {
239 }
else if (length > MTU) {
241 hard->
offset[1] = ofs = 512 - length - 3;
245 lp->hw.copy_to_card(dev, bufnum, 0, hard,
ARC_HDR_SIZE);
246 lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->
soft, length);
248 lp->lastload_dest = hard->
dest;