nfp: don't depend on eth_tbl being available
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 25 Apr 2018 18:21:08 +0000 (11:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Apr 2018 15:15:10 +0000 (11:15 -0400)
commitc55ca688ed99a9cb79367aee2ed2ff6cb80fc039
treeb4195e37a404e450b7298001c6b8ed1bf09a7c60
parent7dbc73e6124ce4d0cfbdd6166de388e9367c47ad
nfp: don't depend on eth_tbl being available

For very very old generation of the management FW Ethernet port
information table may theoretically not be available.  This in
turn will cause the nfp_port structures to not be allocated.

Make sure we don't crash the kernel when there is no eth_tbl:

RIP: 0010:nfp_net_pci_probe+0xf2/0xb40 [nfp]
...
Call Trace:
  nfp_pci_probe+0x6de/0xab0 [nfp]
  local_pci_probe+0x47/0xa0
  work_for_cpu_fn+0x1a/0x30
  process_one_work+0x1de/0x3e0

Found while working with broken/development version of management FW.

Fixes: a5950182c00e ("nfp: map mac_stats and vf_cfg BARs")
Fixes: 93da7d9660ee ("nfp: provide nfp_port to of nfp_net_get_mac_addr()")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/flower/main.c
drivers/net/ethernet/netronome/nfp/nfp_app_nic.c
drivers/net/ethernet/netronome/nfp/nfp_main.h
drivers/net/ethernet/netronome/nfp/nfp_net_main.c