27 #include <linux/module.h>
30 #include <linux/if_arp.h>
32 #include <linux/netdevice.h>
36 #define VERSION "arcnet: raw mode (`r') encapsulation support loaded.\n"
46 static struct ArcProto rawmode_proto =
51 .build_header = build_header,
52 .prepare_tx = prepare_tx,
58 static int __init arcnet_raw_init(
void)
64 for (count = 0; count < 256; count++)
76 static void __exit arcnet_raw_exit(
void)
91 struct arcnet_local *
lp = netdev_priv(dev);
93 struct archdr *pkt = pkthdr;
96 BUGMSG(D_DURING,
"it's a raw packet (length=%d)\n", length);
105 BUGMSG(D_NORMAL,
"Memory squeeze, dropping packet.\n");
106 dev->
stats.rx_dropped++;
114 skb_reset_mac_header(skb);
119 if (length >
sizeof(pkt->
soft))
120 lp->hw.copy_from_card(dev, bufnum, ofs +
sizeof(pkt->
soft),
122 length -
sizeof(pkt->
soft));
124 BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "
rx");
148 pkt->
hard.source = *dev->dev_addr;
167 static int prepare_tx(
struct net_device *dev,
struct archdr *pkt,
int length,
170 struct arcnet_local *lp = netdev_priv(dev);
174 BUGMSG(D_DURING,
"prepare_tx: txbufs=%d/%d/%d\n",
175 lp->next_tx, lp->cur_tx, bufnum);
181 BUGMSG(D_NORMAL,
"Bug! prepare_tx with size %d (> %d)\n",
185 if (length >= MinTU) {
188 }
else if (length > MTU) {
190 hard->
offset[1] = ofs = 512 - length - 3;
194 BUGMSG(D_DURING,
"prepare_tx: length=%d ofs=%d\n",
197 lp->hw.copy_to_card(dev, bufnum, 0, hard,
ARC_HDR_SIZE);
198 lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->
soft, length);
200 lp->lastload_dest = hard->
dest;