Skip to content

Commit 4bbe2e5

Browse files
committed
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== iavf: get rid of the crit lock Przemek Kitszel says: Fix some deadlocks in iavf, and make it less error prone for the future. Patch 1 is simple and independent from the rest. Patches 2, 3, 4 are strictly a refactor, but it enables the last patch to be much smaller. (Technically Jake given his RB tags not knowing I will send it to -net). Patch 5 just adds annotations, this also helps prove last patch to be correct. Patch 6 removes the crit lock, with its unusual try_lock()s. I have more refactoring for scheduling done for -next, to be sent soon. There is a simple test: add VF; decrease number of queueus; remove VF that was way too hard to pass without this series :) * '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: iavf: get rid of the crit lock iavf: sprinkle netdev_assert_locked() annotations iavf: extract iavf_watchdog_step() out of iavf_watchdog_task() iavf: simplify watchdog_task in terms of adminq task scheduling iavf: centralize watchdog requeueing itself iavf: iavf_suspend(): take RTNL before netdev_lock() ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents db9ae3b + 120f28a commit 4bbe2e5

File tree

3 files changed

+96
-223
lines changed

3 files changed

+96
-223
lines changed

drivers/net/ethernet/intel/iavf/iavf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ struct iavf_adapter {
268268
struct list_head vlan_filter_list;
269269
int num_vlan_filters;
270270
struct list_head mac_filter_list;
271-
struct mutex crit_lock;
272271
/* Lock to protect accesses to MAC and VLAN lists */
273272
spinlock_t mac_vlan_list_lock;
274273
char misc_vector_name[IFNAMSIZ + 9];

drivers/net/ethernet/intel/iavf/iavf_ethtool.c

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <linux/bitfield.h>
55
#include <linux/uaccess.h>
66

7+
#include <net/netdev_lock.h>
8+
79
/* ethtool support for iavf */
810
#include "iavf.h"
911

@@ -1256,9 +1258,10 @@ static int iavf_add_fdir_ethtool(struct iavf_adapter *adapter, struct ethtool_rx
12561258
{
12571259
struct ethtool_rx_flow_spec *fsp = &cmd->fs;
12581260
struct iavf_fdir_fltr *fltr;
1259-
int count = 50;
12601261
int err;
12611262

1263+
netdev_assert_locked(adapter->netdev);
1264+
12621265
if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED))
12631266
return -EOPNOTSUPP;
12641267

@@ -1277,22 +1280,13 @@ static int iavf_add_fdir_ethtool(struct iavf_adapter *adapter, struct ethtool_rx
12771280
if (!fltr)
12781281
return -ENOMEM;
12791282

1280-
while (!mutex_trylock(&adapter->crit_lock)) {
1281-
if (--count == 0) {
1282-
kfree(fltr);
1283-
return -EINVAL;
1284-
}
1285-
udelay(1);
1286-
}
1287-
12881283
err = iavf_add_fdir_fltr_info(adapter, fsp, fltr);
12891284
if (!err)
12901285
err = iavf_fdir_add_fltr(adapter, fltr);
12911286

12921287
if (err)
12931288
kfree(fltr);
12941289

1295-
mutex_unlock(&adapter->crit_lock);
12961290
return err;
12971291
}
12981292

@@ -1435,11 +1429,13 @@ iavf_set_adv_rss_hash_opt(struct iavf_adapter *adapter,
14351429
{
14361430
struct iavf_adv_rss *rss_old, *rss_new;
14371431
bool rss_new_add = false;
1438-
int count = 50, err = 0;
14391432
bool symm = false;
14401433
u64 hash_flds;
1434+
int err = 0;
14411435
u32 hdrs;
14421436

1437+
netdev_assert_locked(adapter->netdev);
1438+
14431439
if (!ADV_RSS_SUPPORT(adapter))
14441440
return -EOPNOTSUPP;
14451441

@@ -1463,15 +1459,6 @@ iavf_set_adv_rss_hash_opt(struct iavf_adapter *adapter,
14631459
return -EINVAL;
14641460
}
14651461

1466-
while (!mutex_trylock(&adapter->crit_lock)) {
1467-
if (--count == 0) {
1468-
kfree(rss_new);
1469-
return -EINVAL;
1470-
}
1471-
1472-
udelay(1);
1473-
}
1474-
14751462
spin_lock_bh(&adapter->adv_rss_lock);
14761463
rss_old = iavf_find_adv_rss_cfg_by_hdrs(adapter, hdrs);
14771464
if (rss_old) {
@@ -1500,8 +1487,6 @@ iavf_set_adv_rss_hash_opt(struct iavf_adapter *adapter,
15001487
if (!err)
15011488
iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_ADD_ADV_RSS_CFG);
15021489

1503-
mutex_unlock(&adapter->crit_lock);
1504-
15051490
if (!rss_new_add)
15061491
kfree(rss_new);
15071492

0 commit comments

Comments
 (0)