struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port)
{ if (!port) return NULL; if (port->type != NFP_PORT_PHYS_PORT) return NULL;
return port->eth_port;
}
struct nfp_eth_table_port *nfp_port_get_eth_port(struct nfp_port *port)
{ if (!__nfp_port_get_eth_port(port)) return NULL;
if (test_bit(NFP_PORT_CHANGED, &port->flags)) if (nfp_net_refresh_eth_port(port)) return NULL;
return __nfp_port_get_eth_port(port);
}
int
nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
{ struct nfp_eth_table_port *eth_port; struct nfp_port *port; int n;
port = nfp_port_from_netdev(netdev); if (!port) return -EOPNOTSUPP;
switch (port->type) { case NFP_PORT_PHYS_PORT:
eth_port = __nfp_port_get_eth_port(port); if (!eth_port) return -EOPNOTSUPP;
if (!eth_port->is_split)
n = snprintf(name, len, "p%d", eth_port->label_port); else
n = snprintf(name, len, "p%ds%d", eth_port->label_port,
eth_port->label_subport); break; case NFP_PORT_PF_PORT: if (!port->pf_split)
n = snprintf(name, len, "pf%d", port->pf_id); else
n = snprintf(name, len, "pf%ds%d", port->pf_id,
port->pf_split_id); break; case NFP_PORT_VF_PORT:
n = snprintf(name, len, "pf%dvf%d", port->pf_id, port->vf_id); break; default: return -EOPNOTSUPP;
}
if (n >= len) return -EINVAL;
return 0;
}
/** * nfp_port_configure() - helper to set the interface configured bit * @netdev: net_device instance * @configed: Desired state * * Helper to set the ifup/ifdown state on the PHY only if there is a physical * interface associated with the netdev. * * Return: * 0 - configuration successful (or no change); * -ERRNO - configuration failed.
*/ int nfp_port_configure(struct net_device *netdev, bool configed)
{ struct nfp_eth_table_port *eth_port; struct nfp_port *port; int err;
port = nfp_port_from_netdev(netdev);
eth_port = __nfp_port_get_eth_port(port); if (!eth_port) return 0; if (port->eth_forced) return 0;
int nfp_port_init_phy_port(struct nfp_pf *pf, struct nfp_app *app, struct nfp_port *port, unsignedint id)
{ /* Check if vNIC has external port associated and cfg is OK */ if (!pf->eth_tbl || id >= pf->eth_tbl->count) {
nfp_err(app->cpp, "NSP port entries don't match vNICs (no entry %d)\n",
id); return -EINVAL;
} if (pf->eth_tbl->ports[id].override_changed) {
nfp_warn(app->cpp, "Config changed for port #%d, reboot required before port will be operational\n",
pf->eth_tbl->ports[id].index);
port->type = NFP_PORT_INVALID; return 0;
}
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.