Skip to content

Commit 5d4d846

Browse files
Stanislav Fomichevkuba-moo
authored andcommitted
net: s/dev_set_threaded/netif_set_threaded/
Commit cc34acd ("docs: net: document new locking reality") introduced netif_ vs dev_ function semantics: the former expects locked netdev, the latter takes care of the locking. We don't strictly follow this semantics on either side, but there are more dev_xxx handlers now that don't fit. Rename them to netif_xxx where appropriate. Note that one dev_set_threaded call still remains in mt76 for debugfs file. Signed-off-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 93893a5 commit 5d4d846

File tree

10 files changed

+23
-10
lines changed

10 files changed

+23
-10
lines changed

Documentation/networking/net_cachelines/net_device.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ struct sfp_bus* sfp_bus
165165
struct lock_class_key* qdisc_tx_busylock
166166
bool proto_down
167167
unsigned:1 wol_enabled
168-
unsigned:1 threaded napi_poll(napi_enable,dev_set_threaded)
168+
unsigned:1 threaded napi_poll(napi_enable,netif_set_threaded)
169169
unsigned_long:1 see_all_hwtstamp_requests
170170
unsigned_long:1 change_proto_down
171171
unsigned_long:1 netns_immutable

drivers/net/ethernet/atheros/atl1c/atl1c_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2688,7 +2688,7 @@ static int atl1c_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
26882688
adapter->mii.mdio_write = atl1c_mdio_write;
26892689
adapter->mii.phy_id_mask = 0x1f;
26902690
adapter->mii.reg_num_mask = MDIO_CTRL_REG_MASK;
2691-
dev_set_threaded(netdev, true);
2691+
netif_set_threaded(netdev, true);
26922692
for (i = 0; i < adapter->rx_queue_count; ++i)
26932693
netif_napi_add(netdev, &adapter->rrd_ring[i].napi,
26942694
atl1c_clean_rx);

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static int mlxsw_pci_napi_devs_init(struct mlxsw_pci *mlxsw_pci)
156156
}
157157
strscpy(mlxsw_pci->napi_dev_rx->name, "mlxsw_rx",
158158
sizeof(mlxsw_pci->napi_dev_rx->name));
159-
dev_set_threaded(mlxsw_pci->napi_dev_rx, true);
159+
netif_set_threaded(mlxsw_pci->napi_dev_rx, true);
160160

161161
return 0;
162162

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3075,7 +3075,7 @@ static int ravb_probe(struct platform_device *pdev)
30753075
if (info->coalesce_irqs) {
30763076
netdev_sw_irq_coalesce_default_on(ndev);
30773077
if (num_present_cpus() == 1)
3078-
dev_set_threaded(ndev, true);
3078+
netif_set_threaded(ndev, true);
30793079
}
30803080

30813081
/* Network device register */

drivers/net/wireguard/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static int wg_newlink(struct net_device *dev,
366366
if (ret < 0)
367367
goto err_free_handshake_queue;
368368

369-
dev_set_threaded(dev, true);
369+
netif_set_threaded(dev, true);
370370
ret = register_netdevice(dev);
371371
if (ret < 0)
372372
goto err_uninit_ratelimiter;

drivers/net/wireless/ath/ath10k/snoc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ static int ath10k_snoc_hif_start(struct ath10k *ar)
936936

937937
bitmap_clear(ar_snoc->pending_ce_irqs, 0, CE_COUNT_MAX);
938938

939-
dev_set_threaded(ar->napi_dev, true);
939+
netif_set_threaded(ar->napi_dev, true);
940940
ath10k_core_napi_enable(ar);
941941
/* IRQs are left enabled when we restart due to a firmware crash */
942942
if (!test_bit(ATH10K_SNOC_FLAG_RECOVERY, &ar_snoc->flags))

include/linux/netdevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ static inline bool napi_complete(struct napi_struct *n)
589589
return napi_complete_done(n, 0);
590590
}
591591

592+
int netif_set_threaded(struct net_device *dev, bool threaded);
592593
int dev_set_threaded(struct net_device *dev, bool threaded);
593594

594595
void napi_disable(struct napi_struct *n);

net/core/dev.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4798,7 +4798,7 @@ static inline void ____napi_schedule(struct softnet_data *sd,
47984798

47994799
if (test_bit(NAPI_STATE_THREADED, &napi->state)) {
48004800
/* Paired with smp_mb__before_atomic() in
4801-
* napi_enable()/dev_set_threaded().
4801+
* napi_enable()/netif_set_threaded().
48024802
* Use READ_ONCE() to guarantee a complete
48034803
* read on napi->thread. Only call
48044804
* wake_up_process() when it's not NULL.
@@ -6990,7 +6990,7 @@ int napi_set_threaded(struct napi_struct *napi, bool threaded)
69906990
return 0;
69916991
}
69926992

6993-
int dev_set_threaded(struct net_device *dev, bool threaded)
6993+
int netif_set_threaded(struct net_device *dev, bool threaded)
69946994
{
69956995
struct napi_struct *napi;
69966996
int err = 0;
@@ -7031,7 +7031,7 @@ int dev_set_threaded(struct net_device *dev, bool threaded)
70317031

70327032
return err;
70337033
}
7034-
EXPORT_SYMBOL(dev_set_threaded);
7034+
EXPORT_SYMBOL(netif_set_threaded);
70357035

70367036
/**
70377037
* netif_queue_set_napi - Associate queue with the napi

net/core/dev_api.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,15 @@ void netdev_state_change(struct net_device *dev)
367367
netdev_unlock_ops(dev);
368368
}
369369
EXPORT_SYMBOL(netdev_state_change);
370+
371+
int dev_set_threaded(struct net_device *dev, bool threaded)
372+
{
373+
int ret;
374+
375+
netdev_lock(dev);
376+
ret = netif_set_threaded(dev, threaded);
377+
netdev_unlock(dev);
378+
379+
return ret;
380+
}
381+
EXPORT_SYMBOL(dev_set_threaded);

net/core/net-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ static int modify_napi_threaded(struct net_device *dev, unsigned long val)
757757
if (val != 0 && val != 1)
758758
return -EOPNOTSUPP;
759759

760-
ret = dev_set_threaded(dev, val);
760+
ret = netif_set_threaded(dev, val);
761761

762762
return ret;
763763
}

0 commit comments

Comments
 (0)