int nfp_hwmon_register(struct nfp_pf *pf);
void nfp_hwmon_unregister(struct nfp_pf *pf);
-struct nfp_eth_table_port *
-nfp_net_find_port(struct nfp_eth_table *eth_tbl, unsigned int id);
void
nfp_net_get_mac_addr(struct nfp_pf *pf, struct nfp_port *port, unsigned int id);
ether_addr_copy(port->netdev->perm_addr, mac_addr);
}
-struct nfp_eth_table_port *
-nfp_net_find_port(struct nfp_eth_table *eth_tbl, unsigned int id)
+static struct nfp_eth_table_port *
+nfp_net_find_port(struct nfp_eth_table *eth_tbl, unsigned int index)
{
int i;
for (i = 0; eth_tbl && i < eth_tbl->count; i++)
- if (eth_tbl->ports[i].eth_index == id)
+ if (eth_tbl->ports[i].index == index)
return ð_tbl->ports[i];
return NULL;
static struct nfp_net *
nfp_net_pf_alloc_vnic(struct nfp_pf *pf, bool needs_netdev,
void __iomem *ctrl_bar, void __iomem *qc_bar,
- int stride, unsigned int eth_id)
+ int stride, unsigned int id)
{
u32 tx_base, rx_base, n_tx_rings, n_rx_rings;
struct nfp_net *nn;
nn->stride_tx = stride;
if (needs_netdev) {
- err = nfp_app_vnic_init(pf->app, nn, eth_id);
+ err = nfp_app_vnic_init(pf->app, nn, id);
if (err) {
nfp_net_free(nn);
return ERR_PTR(err);
int nfp_port_init_phy_port(struct nfp_pf *pf, struct nfp_app *app,
struct nfp_port *port, unsigned int id)
{
- port->eth_id = id;
- port->eth_port = nfp_net_find_port(pf->eth_tbl, id);
-
/* Check if vNIC has external port associated and cfg is OK */
- if (!port->eth_port) {
+ if (!pf->eth_tbl || id >= pf->eth_tbl->count) {
nfp_err(app->cpp,
- "NSP port entries don't match vNICs (no entry for port #%d)\n",
+ "NSP port entries don't match vNICs (no entry %d)\n",
id);
return -EINVAL;
}
- if (port->eth_port->override_changed) {
+ 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",
- id);
+ pf->eth_tbl->ports[id].index);
port->type = NFP_PORT_INVALID;
return 0;
}
+ port->eth_port = &pf->eth_tbl->ports[id];
+ port->eth_id = pf->eth_tbl->ports[id].index;
+
return 0;
}