Skip to content

Commit 85101bd

Browse files
zhuyifei1999kuba-moo
authored andcommitted
sfc: Use netdev refcount tracking in struct efx_async_filter_insertion
I was debugging some netdev refcount issues in OpenOnload, and one of the places I was looking at was in the sfc driver. Only struct efx_async_filter_insertion was not using netdev refcount tracker, so add it here. GFP_ATOMIC because this code path is called by ndo_rx_flow_steer which holds RCU. This patch should be a no-op if !CONFIG_NET_DEV_REFCNT_TRACKER Signed-off-by: YiFei Zhu <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a6ac667 commit 85101bd

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

drivers/net/ethernet/sfc/net_driver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,13 +831,15 @@ struct efx_arfs_rule {
831831
/**
832832
* struct efx_async_filter_insertion - Request to asynchronously insert a filter
833833
* @net_dev: Reference to the netdevice
834+
* @net_dev_tracker: reference tracker entry for @net_dev
834835
* @spec: The filter to insert
835836
* @work: Workitem for this request
836837
* @rxq_index: Identifies the channel for which this request was made
837838
* @flow_id: Identifies the kernel-side flow for which this request was made
838839
*/
839840
struct efx_async_filter_insertion {
840841
struct net_device *net_dev;
842+
netdevice_tracker net_dev_tracker;
841843
struct efx_filter_spec spec;
842844
struct work_struct work;
843845
u16 rxq_index;

drivers/net/ethernet/sfc/rx_common.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ static void efx_filter_rfs_work(struct work_struct *data)
897897

898898
/* Release references */
899899
clear_bit(slot_idx, &efx->rps_slot_map);
900-
dev_put(req->net_dev);
900+
netdev_put(req->net_dev, &req->net_dev_tracker);
901901
}
902902

903903
int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
@@ -989,7 +989,8 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
989989
}
990990

991991
/* Queue the request */
992-
dev_hold(req->net_dev = net_dev);
992+
req->net_dev = net_dev;
993+
netdev_hold(req->net_dev, &req->net_dev_tracker, GFP_ATOMIC);
993994
INIT_WORK(&req->work, efx_filter_rfs_work);
994995
req->rxq_index = rxq_index;
995996
req->flow_id = flow_id;

drivers/net/ethernet/sfc/siena/net_driver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,13 +753,15 @@ struct efx_arfs_rule {
753753
/**
754754
* struct efx_async_filter_insertion - Request to asynchronously insert a filter
755755
* @net_dev: Reference to the netdevice
756+
* @net_dev_tracker: reference tracker entry for @net_dev
756757
* @spec: The filter to insert
757758
* @work: Workitem for this request
758759
* @rxq_index: Identifies the channel for which this request was made
759760
* @flow_id: Identifies the kernel-side flow for which this request was made
760761
*/
761762
struct efx_async_filter_insertion {
762763
struct net_device *net_dev;
764+
netdevice_tracker net_dev_tracker;
763765
struct efx_filter_spec spec;
764766
struct work_struct work;
765767
u16 rxq_index;

drivers/net/ethernet/sfc/siena/rx_common.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ static void efx_filter_rfs_work(struct work_struct *data)
888888

889889
/* Release references */
890890
clear_bit(slot_idx, &efx->rps_slot_map);
891-
dev_put(req->net_dev);
891+
netdev_put(req->net_dev, &req->net_dev_tracker);
892892
}
893893

894894
int efx_siena_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
@@ -980,7 +980,8 @@ int efx_siena_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
980980
}
981981

982982
/* Queue the request */
983-
dev_hold(req->net_dev = net_dev);
983+
req->net_dev = net_dev;
984+
netdev_hold(req->net_dev, &req->net_dev_tracker, GFP_ATOMIC);
984985
INIT_WORK(&req->work, efx_filter_rfs_work);
985986
req->rxq_index = rxq_index;
986987
req->flow_id = flow_id;

0 commit comments

Comments
 (0)