drivers/net/ethernet/sun/sunvnet_common.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sun/sunvnet_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sun/sunvnet_common.c- Extension
.c- Size
- 46072 bytes
- Lines
- 1815
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/types.hlinux/slab.hlinux/delay.hlinux/init.hlinux/netdevice.hlinux/ethtool.hlinux/etherdevice.hlinux/mutex.hlinux/highmem.hlinux/if_vlan.htrace/events/sunvnet.hlinux/icmpv6.hnet/ip.hnet/gso.hnet/icmp.hnet/route.hasm/vio.hasm/ldc.hsunvnet_common.h
Detected Declarations
function vnet_tx_dring_availfunction vnet_handle_unknownfunction sunvnet_send_attr_commonfunction handle_attr_infofunction handle_attr_ackfunction handle_attr_nackfunction sunvnet_handle_attr_commonfunction sunvnet_handshake_complete_commonfunction vnet_fullcsum_ipv4function vnet_fullcsum_ipv6function vnet_rx_onefunction vnet_send_ackfunction put_rx_descfunction vnet_walk_rx_onefunction vnet_walk_rxfunction vnet_rxfunction idx_is_pendingfunction vnet_ackfunction vnet_nackfunction handle_mcastfunction maybe_tx_wakeupfunction sunvnet_port_is_up_commonfunction vnet_event_napifunction sunvnet_poll_commonfunction sunvnet_event_commonfunction __vnet_tx_triggerfunction vnet_free_skbsfunction sunvnet_clean_timer_expire_commonfunction vnet_skb_mapfunction skb_tailroomfunction vnet_handle_offloadsfunction sunvnet_start_xmit_commonfunction vnet_ackfunction sunvnet_tx_timeout_commonfunction sunvnet_open_commonfunction sunvnet_close_commonfunction __update_mc_listfunction netdev_for_each_mc_addrfunction __send_mc_listfunction sunvnet_set_rx_mode_commonfunction sunvnet_set_mac_addr_commonfunction sunvnet_port_free_tx_bufs_commonfunction vnet_port_resetfunction vnet_port_alloc_tx_ringfunction sunvnet_poll_controller_commonfunction sunvnet_port_add_txq_commonfunction sunvnet_port_rm_txq_commonexport sunvnet_send_attr_common
Annotated Snippet
if (port->rmtu) {
port->rmtu = min(VNET_MAXPACKET, port->rmtu);
pkt.mtu = port->rmtu;
} else {
port->rmtu = VNET_MAXPACKET;
pkt.mtu = port->rmtu;
}
if (vio_version_after_eq(vio, 1, 6))
pkt.options = VIO_TX_DRING;
} else if (vio_version_before(vio, 1, 3)) {
pkt.mtu = framelen;
} else { /* v1.3 */
pkt.mtu = framelen + VLAN_HLEN;
}
pkt.cflags = 0;
if (vio_version_after_eq(vio, 1, 7) && port->tso) {
pkt.cflags |= VNET_LSO_IPV4_CAPAB;
if (!port->tsolen)
port->tsolen = VNET_MAXTSO;
pkt.ipv4_lso_maxlen = port->tsolen;
}
pkt.plnk_updt = PHYSLINK_UPDATE_NONE;
viodbg(HS, "SEND NET ATTR xmode[0x%x] atype[0x%x] addr[%llx] "
"ackfreq[%u] plnk_updt[0x%02x] opts[0x%02x] mtu[%llu] "
"cflags[0x%04x] lso_max[%u]\n",
pkt.xfer_mode, pkt.addr_type,
(unsigned long long)pkt.addr,
pkt.ack_freq, pkt.plnk_updt, pkt.options,
(unsigned long long)pkt.mtu, pkt.cflags, pkt.ipv4_lso_maxlen);
return vio_ldc_send(vio, &pkt, sizeof(pkt));
}
EXPORT_SYMBOL_GPL(sunvnet_send_attr_common);
static int handle_attr_info(struct vio_driver_state *vio,
struct vio_net_attr_info *pkt)
{
struct vnet_port *port = to_vnet_port(vio);
u64 localmtu;
u8 xfer_mode;
viodbg(HS, "GOT NET ATTR xmode[0x%x] atype[0x%x] addr[%llx] "
"ackfreq[%u] plnk_updt[0x%02x] opts[0x%02x] mtu[%llu] "
" (rmtu[%llu]) cflags[0x%04x] lso_max[%u]\n",
pkt->xfer_mode, pkt->addr_type,
(unsigned long long)pkt->addr,
pkt->ack_freq, pkt->plnk_updt, pkt->options,
(unsigned long long)pkt->mtu, port->rmtu, pkt->cflags,
pkt->ipv4_lso_maxlen);
pkt->tag.sid = vio_send_sid(vio);
xfer_mode = pkt->xfer_mode;
/* for version < 1.2, VIO_DRING_MODE = 0x3 and no bitmask */
if (vio_version_before(vio, 1, 2) && xfer_mode == VIO_DRING_MODE)
xfer_mode = VIO_NEW_DRING_MODE;
/* MTU negotiation:
* < v1.3 - ETH_FRAME_LEN exactly
* > v1.3 - MIN(pkt.mtu, VNET_MAXPACKET, port->rmtu) and change
* pkt->mtu for ACK
* = v1.3 - ETH_FRAME_LEN + VLAN_HLEN exactly
*/
if (vio_version_before(vio, 1, 3)) {
localmtu = ETH_FRAME_LEN;
} else if (vio_version_after(vio, 1, 3)) {
localmtu = port->rmtu ? port->rmtu : VNET_MAXPACKET;
localmtu = min(pkt->mtu, localmtu);
pkt->mtu = localmtu;
} else { /* v1.3 */
localmtu = ETH_FRAME_LEN + VLAN_HLEN;
}
port->rmtu = localmtu;
/* LSO negotiation */
if (vio_version_after_eq(vio, 1, 7))
port->tso &= !!(pkt->cflags & VNET_LSO_IPV4_CAPAB);
else
port->tso = false;
if (port->tso) {
if (!port->tsolen)
port->tsolen = VNET_MAXTSO;
port->tsolen = min(port->tsolen, pkt->ipv4_lso_maxlen);
if (port->tsolen < VNET_MINTSO) {
port->tso = false;
port->tsolen = 0;
pkt->cflags &= ~VNET_LSO_IPV4_CAPAB;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/types.h`, `linux/slab.h`, `linux/delay.h`, `linux/init.h`, `linux/netdevice.h`, `linux/ethtool.h`.
- Detected declarations: `function vnet_tx_dring_avail`, `function vnet_handle_unknown`, `function sunvnet_send_attr_common`, `function handle_attr_info`, `function handle_attr_ack`, `function handle_attr_nack`, `function sunvnet_handle_attr_common`, `function sunvnet_handshake_complete_common`, `function vnet_fullcsum_ipv4`, `function vnet_fullcsum_ipv6`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.