drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/meta/fbnic/fbnic_phylink.c- Extension
.c- Size
- 8762 bytes
- Lines
- 312
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pcs/pcs-xpcs.hlinux/phy.hlinux/phylink.hfbnic.hfbnic_mac.hfbnic_netdev.h
Detected Declarations
function fbnic_phylink_select_interfacefunction fbnic_phylink_get_pauseparamfunction fbnic_phylink_set_pauseparamfunction fbnic_phylink_get_supported_fec_modesfunction phylink_testfunction fbnic_phylink_ethtool_ksettings_getfunction fbnic_phylink_get_fecparamfunction fbnic_phylink_mac_select_pcsfunction fbnic_phylink_mac_preparefunction fbnic_phylink_mac_configfunction fbnic_phylink_mac_link_downfunction fbnic_phylink_mac_link_upfunction fbnic_phylink_createfunction fbnic_phylink_destroyfunction fbnic_phylink_pmd_training_complete_notify
Annotated Snippet
phylink_test(supported, 25000baseCR_Full)) {
phylink_set(supported, FEC_BASER);
phylink_set(supported, FEC_NONE);
phylink_set(supported, FEC_RS);
}
}
int fbnic_phylink_ethtool_ksettings_get(struct net_device *netdev,
struct ethtool_link_ksettings *cmd)
{
struct fbnic_net *fbn = netdev_priv(netdev);
int err;
err = phylink_ethtool_ksettings_get(fbn->phylink, cmd);
if (!err) {
unsigned long *supp = cmd->link_modes.supported;
cmd->base.port = PORT_DA;
cmd->lanes = (fbn->aui & FBNIC_AUI_MODE_R2) ? 2 : 1;
fbnic_phylink_get_supported_fec_modes(supp);
}
return err;
}
int fbnic_phylink_get_fecparam(struct net_device *netdev,
struct ethtool_fecparam *fecparam)
{
struct fbnic_net *fbn = netdev_priv(netdev);
if (fbn->fec & FBNIC_FEC_RS) {
fecparam->active_fec = ETHTOOL_FEC_RS;
fecparam->fec = ETHTOOL_FEC_RS;
} else if (fbn->fec & FBNIC_FEC_BASER) {
fecparam->active_fec = ETHTOOL_FEC_BASER;
fecparam->fec = ETHTOOL_FEC_BASER;
} else {
fecparam->active_fec = ETHTOOL_FEC_OFF;
fecparam->fec = ETHTOOL_FEC_OFF;
}
if (fbn->aui & FBNIC_AUI_MODE_PAM4)
fecparam->fec |= ETHTOOL_FEC_AUTO;
return 0;
}
static struct phylink_pcs *
fbnic_phylink_mac_select_pcs(struct phylink_config *config,
phy_interface_t interface)
{
struct net_device *netdev = to_net_dev(config->dev);
struct fbnic_net *fbn = netdev_priv(netdev);
return fbn->pcs;
}
static int
fbnic_phylink_mac_prepare(struct phylink_config *config, unsigned int mode,
phy_interface_t iface)
{
struct net_device *netdev = to_net_dev(config->dev);
struct fbnic_net *fbn = netdev_priv(netdev);
struct fbnic_dev *fbd = fbn->fbd;
fbd->mac->prepare(fbd, fbn->aui, fbn->fec);
return 0;
}
static void
fbnic_phylink_mac_config(struct phylink_config *config, unsigned int mode,
const struct phylink_link_state *state)
{
}
static int
fbnic_phylink_mac_finish(struct phylink_config *config, unsigned int mode,
phy_interface_t iface)
{
struct net_device *netdev = to_net_dev(config->dev);
struct fbnic_net *fbn = netdev_priv(netdev);
struct fbnic_dev *fbd = fbn->fbd;
/* Retest the link state and restart interrupts */
fbd->mac->get_link(fbd, fbn->aui, fbn->fec);
return 0;
}
Annotation
- Immediate include surface: `linux/pcs/pcs-xpcs.h`, `linux/phy.h`, `linux/phylink.h`, `fbnic.h`, `fbnic_mac.h`, `fbnic_netdev.h`.
- Detected declarations: `function fbnic_phylink_select_interface`, `function fbnic_phylink_get_pauseparam`, `function fbnic_phylink_set_pauseparam`, `function fbnic_phylink_get_supported_fec_modes`, `function phylink_test`, `function fbnic_phylink_ethtool_ksettings_get`, `function fbnic_phylink_get_fecparam`, `function fbnic_phylink_mac_select_pcs`, `function fbnic_phylink_mac_prepare`, `function fbnic_phylink_mac_config`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.