aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 060135ceaf0e..005020042be9 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1536,6 +1536,7 @@ static void tun_rx_batched(struct tun_struct *tun, struct tun_file *tfile,
1536 1536
1537 if (!rx_batched || (!more && skb_queue_empty(queue))) { 1537 if (!rx_batched || (!more && skb_queue_empty(queue))) {
1538 local_bh_disable(); 1538 local_bh_disable();
1539 skb_record_rx_queue(skb, tfile->queue_index);
1539 netif_receive_skb(skb); 1540 netif_receive_skb(skb);
1540 local_bh_enable(); 1541 local_bh_enable();
1541 return; 1542 return;
@@ -1555,8 +1556,11 @@ static void tun_rx_batched(struct tun_struct *tun, struct tun_file *tfile,
1555 struct sk_buff *nskb; 1556 struct sk_buff *nskb;
1556 1557
1557 local_bh_disable(); 1558 local_bh_disable();
1558 while ((nskb = __skb_dequeue(&process_queue))) 1559 while ((nskb = __skb_dequeue(&process_queue))) {
1560 skb_record_rx_queue(nskb, tfile->queue_index);
1559 netif_receive_skb(nskb); 1561 netif_receive_skb(nskb);
1562 }
1563 skb_record_rx_queue(skb, tfile->queue_index);
1560 netif_receive_skb(skb); 1564 netif_receive_skb(skb);
1561 local_bh_enable(); 1565 local_bh_enable();
1562 } 1566 }
@@ -2289,9 +2293,9 @@ static void tun_setup(struct net_device *dev)
2289static int tun_validate(struct nlattr *tb[], struct nlattr *data[], 2293static int tun_validate(struct nlattr *tb[], struct nlattr *data[],
2290 struct netlink_ext_ack *extack) 2294 struct netlink_ext_ack *extack)
2291{ 2295{
2292 if (!data) 2296 NL_SET_ERR_MSG(extack,
2293 return 0; 2297 "tun/tap creation via rtnetlink is not supported.");
2294 return -EINVAL; 2298 return -EOPNOTSUPP;
2295} 2299}
2296 2300
2297static size_t tun_get_size(const struct net_device *dev) 2301static size_t tun_get_size(const struct net_device *dev)
@@ -2381,6 +2385,7 @@ static int tun_xdp_one(struct tun_struct *tun,
2381 struct tun_file *tfile, 2385 struct tun_file *tfile,
2382 struct xdp_buff *xdp, int *flush) 2386 struct xdp_buff *xdp, int *flush)
2383{ 2387{
2388 unsigned int datasize = xdp->data_end - xdp->data;
2384 struct tun_xdp_hdr *hdr = xdp->data_hard_start; 2389 struct tun_xdp_hdr *hdr = xdp->data_hard_start;
2385 struct virtio_net_hdr *gso = &hdr->gso; 2390 struct virtio_net_hdr *gso = &hdr->gso;
2386 struct tun_pcpu_stats *stats; 2391 struct tun_pcpu_stats *stats;
@@ -2451,12 +2456,13 @@ build:
2451 if (!rcu_dereference(tun->steering_prog)) 2456 if (!rcu_dereference(tun->steering_prog))
2452 rxhash = __skb_get_hash_symmetric(skb); 2457 rxhash = __skb_get_hash_symmetric(skb);
2453 2458
2459 skb_record_rx_queue(skb, tfile->queue_index);
2454 netif_receive_skb(skb); 2460 netif_receive_skb(skb);
2455 2461
2456 stats = get_cpu_ptr(tun->pcpu_stats); 2462 stats = get_cpu_ptr(tun->pcpu_stats);
2457 u64_stats_update_begin(&stats->syncp); 2463 u64_stats_update_begin(&stats->syncp);
2458 stats->rx_packets++; 2464 stats->rx_packets++;
2459 stats->rx_bytes += skb->len; 2465 stats->rx_bytes += datasize;
2460 u64_stats_update_end(&stats->syncp); 2466 u64_stats_update_end(&stats->syncp);
2461 put_cpu_ptr(stats); 2467 put_cpu_ptr(stats);
2462 2468