/* Create the ARCnet hard/soft headers for cap mode. *Therearen'tanysoftheadersincapmode-noteventheprotocolid.
*/ staticint build_header(struct sk_buff *skb, struct net_device *dev, unsignedshort type,
uint8_t daddr)
{ int hdr_size = ARC_HDR_SIZE; struct archdr *pkt = skb_push(skb, hdr_size);
arc_printk(D_PROTO, dev, "Preparing header for cap packet %x.\n",
*((int *)&pkt->soft.cap.cookie[0]));
/* Set the source hardware address. * *Thisisprettypointlessformostpurposes,butitcanhelpin *debugging.ARCnetdoesnotallowustochangethesourceaddressin *theactualpacketsent)
*/
pkt->hard.source = *dev->dev_addr;
/* see linux/net/ethernet/eth.c to see where I got the following */
if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) { /* FIXME: fill in the last byte of the dest ipaddr here to *bettercomplywithRFC1051in"noarp"mode.
*/
pkt->hard.dest = 0; return hdr_size;
} /* otherwise, just fill it in and go! */
pkt->hard.dest = daddr;
return hdr_size; /* success */
}
staticint prepare_tx(struct net_device *dev, struct archdr *pkt, int length, int bufnum)
{ struct arcnet_local *lp = netdev_priv(dev); struct arc_hardware *hard = &pkt->hard; int ofs;
/* hard header is not included in packet length */
length -= ARC_HDR_SIZE; /* And neither is the cookie field */
length -= sizeof(int);
/* Copy the arcnet-header + the protocol byte down: */
lp->hw.copy_to_card(dev, bufnum, 0, hard, ARC_HDR_SIZE);
lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->soft.cap.proto, sizeof(pkt->soft.cap.proto));
/* Skip the extra integer we have written into it as a cookie *butwritetherestofthemessage:
*/
lp->hw.copy_to_card(dev, bufnum, ofs + 1,
((unsignedchar *)&pkt->soft.cap.mes), length - 1);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.