Skip to content

Commit 7717c31

Browse files
Jakub Kicinskidavem330
authored andcommitted
nfp: make use of MAC reinit
Recent management FW images can perform full reinit of MAC cores without requiring a reboot. When loading the driver check if there are changes pending and if so call NSP MAC reinit. Full application FW reload is still required, and all MACs need to be reinited at the same time (not only the ones which have been reconfigured, and thus potentially causing disruption to unrelated netdevs) therefore for now changing MAC config without reloading the driver still remains future work. Signed-off-by: Jakub Kicinski <[email protected]> Tested-by: Dirk van der Merwe <[email protected]> Signed-off-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4e59532 commit 7717c31

File tree

5 files changed

+40
-3
lines changed

5 files changed

+40
-3
lines changed

drivers/net/ethernet/netronome/nfp/nfp_main.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,32 @@ nfp_fw_load(struct pci_dev *pdev, struct nfp_pf *pf, struct nfp_nsp *nsp)
346346
return err < 0 ? err : 1;
347347
}
348348

349+
static void
350+
nfp_nsp_init_ports(struct pci_dev *pdev, struct nfp_pf *pf,
351+
struct nfp_nsp *nsp)
352+
{
353+
bool needs_reinit = false;
354+
int i;
355+
356+
pf->eth_tbl = __nfp_eth_read_ports(pf->cpp, nsp);
357+
if (!pf->eth_tbl)
358+
return;
359+
360+
if (!nfp_nsp_has_mac_reinit(nsp))
361+
return;
362+
363+
for (i = 0; i < pf->eth_tbl->count; i++)
364+
needs_reinit |= pf->eth_tbl->ports[i].override_changed;
365+
if (!needs_reinit)
366+
return;
367+
368+
kfree(pf->eth_tbl);
369+
if (nfp_nsp_mac_reinit(nsp))
370+
dev_warn(&pdev->dev, "MAC reinit failed\n");
371+
372+
pf->eth_tbl = __nfp_eth_read_ports(pf->cpp, nsp);
373+
}
374+
349375
static int nfp_nsp_init(struct pci_dev *pdev, struct nfp_pf *pf)
350376
{
351377
struct nfp_nsp *nsp;
@@ -366,7 +392,7 @@ static int nfp_nsp_init(struct pci_dev *pdev, struct nfp_pf *pf)
366392
if (err < 0)
367393
goto exit_close_nsp;
368394

369-
pf->eth_tbl = __nfp_eth_read_ports(pf->cpp, nsp);
395+
nfp_nsp_init_ports(pdev, pf, nsp);
370396

371397
pf->nspi = __nfp_nsp_identify(nsp);
372398
if (pf->nspi)

drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ nfp_net_set_link_ksettings(struct net_device *netdev,
328328
return -EOPNOTSUPP;
329329

330330
if (netif_running(netdev)) {
331-
netdev_warn(netdev, "Changing settings not allowed on an active interface. It may cause the port to be disabled until reboot.\n");
331+
netdev_warn(netdev, "Changing settings not allowed on an active interface. It may cause the port to be disabled until driver reload.\n");
332332
return -EBUSY;
333333
}
334334

drivers/net/ethernet/netronome/nfp/nfp_net_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ nfp_net_eth_port_update(struct nfp_cpp *cpp, struct nfp_port *port,
597597
return -EIO;
598598
}
599599
if (eth_port->override_changed) {
600-
nfp_warn(cpp, "Port #%d config changed, unregistering. Reboot required before port will be operational again.\n", port->eth_id);
600+
nfp_warn(cpp, "Port #%d config changed, unregistering. Driver reload required before port will be operational again.\n", port->eth_id);
601601
port->type = NFP_PORT_INVALID;
602602
}
603603

drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@ int nfp_nsp_device_soft_reset(struct nfp_nsp *state)
477477
return nfp_nsp_command(state, SPCODE_SOFT_RESET, 0, 0, 0);
478478
}
479479

480+
int nfp_nsp_mac_reinit(struct nfp_nsp *state)
481+
{
482+
return nfp_nsp_command(state, SPCODE_MAC_INIT, 0, 0, 0);
483+
}
484+
480485
int nfp_nsp_load_fw(struct nfp_nsp *state, const struct firmware *fw)
481486
{
482487
return nfp_nsp_command_buf(state, SPCODE_FW_LOAD, fw->size, fw->data,

drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ u16 nfp_nsp_get_abi_ver_minor(struct nfp_nsp *state);
4848
int nfp_nsp_wait(struct nfp_nsp *state);
4949
int nfp_nsp_device_soft_reset(struct nfp_nsp *state);
5050
int nfp_nsp_load_fw(struct nfp_nsp *state, const struct firmware *fw);
51+
int nfp_nsp_mac_reinit(struct nfp_nsp *state);
52+
53+
static inline bool nfp_nsp_has_mac_reinit(struct nfp_nsp *state)
54+
{
55+
return nfp_nsp_get_abi_ver_minor(state) > 20;
56+
}
5157

5258
enum nfp_eth_interface {
5359
NFP_INTERFACE_NONE = 0,

0 commit comments

Comments
 (0)