drivers/net/arcnet/rfc1201.c
Source file repositories/reference/linux-study-clean/drivers/net/arcnet/rfc1201.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/arcnet/rfc1201.c- Extension
.c- Size
- 16226 bytes
- Lines
- 549
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/gfp.hlinux/module.hlinux/init.hlinux/if_arp.hlinux/netdevice.hlinux/skbuff.harcdevice.h
Detected Declarations
function arcnet_rfc1201_initfunction arcnet_rfc1201_exitfunction type_transfunction rxfunction addrfunction build_headerfunction load_pktfunction prepare_txfunction continue_txmodule init arcnet_rfc1201_init
Annotated Snippet
module_init(arcnet_rfc1201_init);
module_exit(arcnet_rfc1201_exit);
/* Determine a packet's protocol ID.
*
* With ARCnet we have to convert everything to Ethernet-style stuff.
*/
static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)
{
struct archdr *pkt = (struct archdr *)skb->data;
struct arc_rfc1201 *soft = &pkt->soft.rfc1201;
int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE;
/* Pull off the arcnet header. */
skb_reset_mac_header(skb);
skb_pull(skb, hdr_size);
if (pkt->hard.dest == 0) {
skb->pkt_type = PACKET_BROADCAST;
} else if (dev->flags & IFF_PROMISC) {
/* if we're not sending to ourselves :) */
if (pkt->hard.dest != dev->dev_addr[0])
skb->pkt_type = PACKET_OTHERHOST;
}
/* now return the protocol number */
switch (soft->proto) {
case ARC_P_IP:
return htons(ETH_P_IP);
case ARC_P_IPV6:
return htons(ETH_P_IPV6);
case ARC_P_ARP:
return htons(ETH_P_ARP);
case ARC_P_RARP:
return htons(ETH_P_RARP);
case ARC_P_IPX:
case ARC_P_NOVELL_EC:
return htons(ETH_P_802_3);
default:
dev->stats.rx_errors++;
dev->stats.rx_crc_errors++;
return 0;
}
return htons(ETH_P_IP);
}
/* packet receiver */
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length)
{
struct arcnet_local *lp = netdev_priv(dev);
struct sk_buff *skb;
struct archdr *pkt = pkthdr;
struct arc_rfc1201 *soft = &pkthdr->soft.rfc1201;
int saddr = pkt->hard.source, ofs;
struct Incoming *in = &lp->rfc1201.incoming[saddr];
arc_printk(D_DURING, dev, "it's an RFC1201 packet (length=%d)\n",
length);
if (length >= MinTU)
ofs = 512 - length;
else
ofs = 256 - length;
if (soft->split_flag == 0xFF) { /* Exception Packet */
if (length >= 4 + RFC1201_HDR_SIZE) {
arc_printk(D_DURING, dev, "compensating for exception packet\n");
} else {
arc_printk(D_EXTRA, dev, "short RFC1201 exception packet from %02Xh",
saddr);
return;
}
/* skip over 4-byte junkola */
length -= 4;
ofs += 4;
lp->hw.copy_from_card(dev, bufnum, 512 - length,
soft, sizeof(pkt->soft));
}
if (!soft->split_flag) { /* not split */
arc_printk(D_RX, dev, "incoming is not split (splitflag=%d)\n",
soft->split_flag);
if (in->skb) { /* already assembling one! */
arc_printk(D_EXTRA, dev, "aborting assembly (seq=%d) for unsplit packet (splitflag=%d, seq=%d)\n",
in->sequence, soft->split_flag,
soft->sequence);
lp->rfc1201.aborted_seq = soft->sequence;
Annotation
- Immediate include surface: `linux/gfp.h`, `linux/module.h`, `linux/init.h`, `linux/if_arp.h`, `linux/netdevice.h`, `linux/skbuff.h`, `arcdevice.h`.
- Detected declarations: `function arcnet_rfc1201_init`, `function arcnet_rfc1201_exit`, `function type_trans`, `function rx`, `function addr`, `function build_header`, `function load_pkt`, `function prepare_tx`, `function continue_tx`, `module init arcnet_rfc1201_init`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.