Skip to content

Commit 01a1a17

Browse files
committed
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 <[email protected]>
2 parents cdb8744 + e62e51a commit 01a1a17

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

drivers/net/ethernet/netronome/nfp/flower/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ static int nfp_flower_vnic_alloc(struct nfp_app *app, struct nfp_net *nn,
455455

456456
eth_hw_addr_random(nn->dp.netdev);
457457
netif_keep_dst(nn->dp.netdev);
458+
nn->vnic_no_name = true;
458459

459460
return 0;
460461

drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
381381
err = PTR_ERR_OR_ZERO(rt);
382382
if (err)
383383
return NOTIFY_DONE;
384+
385+
ip_rt_put(rt);
384386
#else
385387
return NOTIFY_DONE;
386388
#endif

drivers/net/ethernet/netronome/nfp/nfp_net.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ struct nfp_net_dp {
590590
* @vnic_list: Entry on device vNIC list
591591
* @pdev: Backpointer to PCI device
592592
* @app: APP handle if available
593+
* @vnic_no_name: For non-port PF vNIC make ndo_get_phys_port_name return
594+
* -EOPNOTSUPP to keep backwards compatibility (set by app)
593595
* @port: Pointer to nfp_port structure if vNIC is a port
594596
* @app_priv: APP private data for this vNIC
595597
*/
@@ -663,6 +665,8 @@ struct nfp_net {
663665
struct pci_dev *pdev;
664666
struct nfp_app *app;
665667

668+
bool vnic_no_name;
669+
666670
struct nfp_port *port;
667671

668672
void *app_priv;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3121,7 +3121,7 @@ static void nfp_net_stat64(struct net_device *netdev,
31213121
struct nfp_net *nn = netdev_priv(netdev);
31223122
int r;
31233123

3124-
for (r = 0; r < nn->dp.num_r_vecs; r++) {
3124+
for (r = 0; r < nn->max_r_vecs; r++) {
31253125
struct nfp_net_r_vector *r_vec = &nn->r_vecs[r];
31263126
u64 data[3];
31273127
unsigned int start;
@@ -3286,7 +3286,7 @@ nfp_net_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
32863286
if (nn->port)
32873287
return nfp_port_get_phys_port_name(netdev, name, len);
32883288

3289-
if (nn->dp.is_vf)
3289+
if (nn->dp.is_vf || nn->vnic_no_name)
32903290
return -EOPNOTSUPP;
32913291

32923292
n = snprintf(name, len, "n%d", nn->id);

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,18 @@ struct nfp_resource {
9898

9999
static int nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res)
100100
{
101-
char name_pad[NFP_RESOURCE_ENTRY_NAME_SZ] = {};
102101
struct nfp_resource_entry entry;
103102
u32 cpp_id, key;
104103
int ret, i;
105104

106105
cpp_id = NFP_CPP_ID(NFP_RESOURCE_TBL_TARGET, 3, 0); /* Atomic read */
107106

108-
strncpy(name_pad, res->name, sizeof(name_pad));
109-
110107
/* Search for a matching entry */
111-
if (!memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8)) {
108+
if (!strcmp(res->name, NFP_RESOURCE_TBL_NAME)) {
112109
nfp_err(cpp, "Grabbing device lock not supported\n");
113110
return -EOPNOTSUPP;
114111
}
115-
key = crc32_posix(name_pad, sizeof(name_pad));
112+
key = crc32_posix(res->name, NFP_RESOURCE_ENTRY_NAME_SZ);
116113

117114
for (i = 0; i < NFP_RESOURCE_TBL_ENTRIES; i++) {
118115
u64 addr = NFP_RESOURCE_TBL_BASE +

0 commit comments

Comments
 (0)