virtio_net.c (afd92d82c9d715fb97565408755acad81573591a) | virtio_net.c (9ce4e3d6d85600153e61c4b8c3c346bd84d84470) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* A network driver using virtio. 3 * 4 * Copyright 2007 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation 5 */ 6//#define DEBUG 7#include <linux/netdevice.h> 8#include <linux/etherdevice.h> --- 409 unchanged lines hidden (view full) --- 418 /* copy small packet so we can reuse these pages */ 419 if (!NET_IP_ALIGN && len > GOOD_COPY_LEN && tailroom >= shinfo_size) { 420 skb = build_skb(buf, truesize); 421 if (unlikely(!skb)) 422 return NULL; 423 424 skb_reserve(skb, p - buf); 425 skb_put(skb, len); | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* A network driver using virtio. 3 * 4 * Copyright 2007 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation 5 */ 6//#define DEBUG 7#include <linux/netdevice.h> 8#include <linux/etherdevice.h> --- 409 unchanged lines hidden (view full) --- 418 /* copy small packet so we can reuse these pages */ 419 if (!NET_IP_ALIGN && len > GOOD_COPY_LEN && tailroom >= shinfo_size) { 420 skb = build_skb(buf, truesize); 421 if (unlikely(!skb)) 422 return NULL; 423 424 skb_reserve(skb, p - buf); 425 skb_put(skb, len); |
426 427 page = (struct page *)page->private; 428 if (page) 429 give_pages(rq, page); | |
430 goto ok; 431 } 432 433 /* copy small packet so we can reuse these pages for small data */ 434 skb = napi_alloc_skb(&rq->napi, GOOD_COPY_LEN); 435 if (unlikely(!skb)) 436 return NULL; 437 --- 2091 unchanged lines hidden (view full) --- 2529 } 2530 2531 curr_qp = vi->curr_queue_pairs - vi->xdp_queue_pairs; 2532 if (prog) 2533 xdp_qp = nr_cpu_ids; 2534 2535 /* XDP requires extra queues for XDP_TX */ 2536 if (curr_qp + xdp_qp > vi->max_queue_pairs) { | 426 goto ok; 427 } 428 429 /* copy small packet so we can reuse these pages for small data */ 430 skb = napi_alloc_skb(&rq->napi, GOOD_COPY_LEN); 431 if (unlikely(!skb)) 432 return NULL; 433 --- 2091 unchanged lines hidden (view full) --- 2525 } 2526 2527 curr_qp = vi->curr_queue_pairs - vi->xdp_queue_pairs; 2528 if (prog) 2529 xdp_qp = nr_cpu_ids; 2530 2531 /* XDP requires extra queues for XDP_TX */ 2532 if (curr_qp + xdp_qp > vi->max_queue_pairs) { |
2537 netdev_warn(dev, "XDP request %i queues but max is %i. XDP_TX and XDP_REDIRECT will operate in a slower locked tx mode.\n", 2538 curr_qp + xdp_qp, vi->max_queue_pairs); | 2533 netdev_warn_once(dev, "XDP request %i queues but max is %i. XDP_TX and XDP_REDIRECT will operate in a slower locked tx mode.\n", 2534 curr_qp + xdp_qp, vi->max_queue_pairs); |
2539 xdp_qp = 0; 2540 } 2541 2542 old_prog = rtnl_dereference(vi->rq[0].xdp_prog); 2543 if (!prog && !old_prog) 2544 return 0; 2545 2546 if (prog) --- 892 unchanged lines hidden --- | 2535 xdp_qp = 0; 2536 } 2537 2538 old_prog = rtnl_dereference(vi->rq[0].xdp_prog); 2539 if (!prog && !old_prog) 2540 return 0; 2541 2542 if (prog) --- 892 unchanged lines hidden --- |