Skip to content

Commit 43d7ca2

Browse files
Sebastian Andrzej Siewiorkuba-moo
authored andcommitted
net: Use __napi_alloc_frag_align() instead of open coding it.
The else condition within __netdev_alloc_frag_align() is an open coded __napi_alloc_frag_align(). Use __napi_alloc_frag_align() instead of open coding it. Move fragsz assignment before page_frag_alloc_align() invocation because __napi_alloc_frag_align() also contains this statement. Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c5bcab7 commit 43d7ca2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

net/core/skbuff.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,19 +318,15 @@ void *__netdev_alloc_frag_align(unsigned int fragsz, unsigned int align_mask)
318318
{
319319
void *data;
320320

321-
fragsz = SKB_DATA_ALIGN(fragsz);
322321
if (in_hardirq() || irqs_disabled()) {
323322
struct page_frag_cache *nc = this_cpu_ptr(&netdev_alloc_cache);
324323

324+
fragsz = SKB_DATA_ALIGN(fragsz);
325325
data = __page_frag_alloc_align(nc, fragsz, GFP_ATOMIC,
326326
align_mask);
327327
} else {
328-
struct napi_alloc_cache *nc;
329-
330328
local_bh_disable();
331-
nc = this_cpu_ptr(&napi_alloc_cache);
332-
data = __page_frag_alloc_align(&nc->page, fragsz, GFP_ATOMIC,
333-
align_mask);
329+
data = __napi_alloc_frag_align(fragsz, align_mask);
334330
local_bh_enable();
335331
}
336332
return data;

0 commit comments

Comments
 (0)