Merge branch 'nfp-fixes'

Jakub Kicinski says:

====================
nfp: fix a warning, stats, naming and route leak

Various fixes for the NFP.  Patch 1 fixes a harmless GCC 8 warning.
Patch 2 ensures statistics are correct after users decrease the number
of channels/rings.  Patch 3 restores phy_port_name behaviour for flower,
ndo_get_phy_port_name used to return -EOPNOTSUPP on one of the netdevs,
and we need to keep it that way otherwise interface names may change.
Patch 4 fixes refcnt leak in flower tunnel offload code.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2018-06-12 15:18:28 -07:00
commit 01a1a170da
5 changed files with 11 additions and 7 deletions

View File

@ -455,6 +455,7 @@ static int nfp_flower_vnic_alloc(struct nfp_app *app, struct nfp_net *nn,
eth_hw_addr_random(nn->dp.netdev); eth_hw_addr_random(nn->dp.netdev);
netif_keep_dst(nn->dp.netdev); netif_keep_dst(nn->dp.netdev);
nn->vnic_no_name = true;
return 0; return 0;

View File

@ -381,6 +381,8 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
err = PTR_ERR_OR_ZERO(rt); err = PTR_ERR_OR_ZERO(rt);
if (err) if (err)
return NOTIFY_DONE; return NOTIFY_DONE;
ip_rt_put(rt);
#else #else
return NOTIFY_DONE; return NOTIFY_DONE;
#endif #endif

View File

@ -590,6 +590,8 @@ struct nfp_net_dp {
* @vnic_list: Entry on device vNIC list * @vnic_list: Entry on device vNIC list
* @pdev: Backpointer to PCI device * @pdev: Backpointer to PCI device
* @app: APP handle if available * @app: APP handle if available
* @vnic_no_name: For non-port PF vNIC make ndo_get_phys_port_name return
* -EOPNOTSUPP to keep backwards compatibility (set by app)
* @port: Pointer to nfp_port structure if vNIC is a port * @port: Pointer to nfp_port structure if vNIC is a port
* @app_priv: APP private data for this vNIC * @app_priv: APP private data for this vNIC
*/ */
@ -663,6 +665,8 @@ struct nfp_net {
struct pci_dev *pdev; struct pci_dev *pdev;
struct nfp_app *app; struct nfp_app *app;
bool vnic_no_name;
struct nfp_port *port; struct nfp_port *port;
void *app_priv; void *app_priv;

View File

@ -3121,7 +3121,7 @@ static void nfp_net_stat64(struct net_device *netdev,
struct nfp_net *nn = netdev_priv(netdev); struct nfp_net *nn = netdev_priv(netdev);
int r; int r;
for (r = 0; r < nn->dp.num_r_vecs; r++) { for (r = 0; r < nn->max_r_vecs; r++) {
struct nfp_net_r_vector *r_vec = &nn->r_vecs[r]; struct nfp_net_r_vector *r_vec = &nn->r_vecs[r];
u64 data[3]; u64 data[3];
unsigned int start; unsigned int start;
@ -3286,7 +3286,7 @@ nfp_net_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
if (nn->port) if (nn->port)
return nfp_port_get_phys_port_name(netdev, name, len); return nfp_port_get_phys_port_name(netdev, name, len);
if (nn->dp.is_vf) if (nn->dp.is_vf || nn->vnic_no_name)
return -EOPNOTSUPP; return -EOPNOTSUPP;
n = snprintf(name, len, "n%d", nn->id); n = snprintf(name, len, "n%d", nn->id);

View File

@ -98,21 +98,18 @@ struct nfp_resource {
static int nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res) static int nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res)
{ {
char name_pad[NFP_RESOURCE_ENTRY_NAME_SZ] = {};
struct nfp_resource_entry entry; struct nfp_resource_entry entry;
u32 cpp_id, key; u32 cpp_id, key;
int ret, i; int ret, i;
cpp_id = NFP_CPP_ID(NFP_RESOURCE_TBL_TARGET, 3, 0); /* Atomic read */ cpp_id = NFP_CPP_ID(NFP_RESOURCE_TBL_TARGET, 3, 0); /* Atomic read */
strncpy(name_pad, res->name, sizeof(name_pad));
/* Search for a matching entry */ /* Search for a matching entry */
if (!memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8)) { if (!strcmp(res->name, NFP_RESOURCE_TBL_NAME)) {
nfp_err(cpp, "Grabbing device lock not supported\n"); nfp_err(cpp, "Grabbing device lock not supported\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
key = crc32_posix(name_pad, sizeof(name_pad)); key = crc32_posix(res->name, NFP_RESOURCE_ENTRY_NAME_SZ);
for (i = 0; i < NFP_RESOURCE_TBL_ENTRIES; i++) { for (i = 0; i < NFP_RESOURCE_TBL_ENTRIES; i++) {
u64 addr = NFP_RESOURCE_TBL_BASE + u64 addr = NFP_RESOURCE_TBL_BASE +