Skip to content

Commit e6f50ed

Browse files
edumazetdavem330
authored andcommitted
net: move skb_defer_free_flush() up
We plan using skb_defer_free_flush() from napi_threaded_poll() in the following patch. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 931e93b commit e6f50ed

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

net/core/dev.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6598,6 +6598,27 @@ static int napi_thread_wait(struct napi_struct *napi)
65986598
return -1;
65996599
}
66006600

6601+
static void skb_defer_free_flush(struct softnet_data *sd)
6602+
{
6603+
struct sk_buff *skb, *next;
6604+
6605+
/* Paired with WRITE_ONCE() in skb_attempt_defer_free() */
6606+
if (!READ_ONCE(sd->defer_list))
6607+
return;
6608+
6609+
spin_lock(&sd->defer_lock);
6610+
skb = sd->defer_list;
6611+
sd->defer_list = NULL;
6612+
sd->defer_count = 0;
6613+
spin_unlock(&sd->defer_lock);
6614+
6615+
while (skb != NULL) {
6616+
next = skb->next;
6617+
napi_consume_skb(skb, 1);
6618+
skb = next;
6619+
}
6620+
}
6621+
66016622
static int napi_threaded_poll(void *data)
66026623
{
66036624
struct napi_struct *napi = data;
@@ -6624,27 +6645,6 @@ static int napi_threaded_poll(void *data)
66246645
return 0;
66256646
}
66266647

6627-
static void skb_defer_free_flush(struct softnet_data *sd)
6628-
{
6629-
struct sk_buff *skb, *next;
6630-
6631-
/* Paired with WRITE_ONCE() in skb_attempt_defer_free() */
6632-
if (!READ_ONCE(sd->defer_list))
6633-
return;
6634-
6635-
spin_lock(&sd->defer_lock);
6636-
skb = sd->defer_list;
6637-
sd->defer_list = NULL;
6638-
sd->defer_count = 0;
6639-
spin_unlock(&sd->defer_lock);
6640-
6641-
while (skb != NULL) {
6642-
next = skb->next;
6643-
napi_consume_skb(skb, 1);
6644-
skb = next;
6645-
}
6646-
}
6647-
66486648
static __latent_entropy void net_rx_action(struct softirq_action *h)
66496649
{
66506650
struct softnet_data *sd = this_cpu_ptr(&softnet_data);

0 commit comments

Comments
 (0)