aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorSridhar Samudrala <sri@us.ibm.com>2009-07-14 10:21:04 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-17 13:11:00 -0400
commite36aa25a533962b08402530e8443ac804a454e27 (patch)
tree2b61eba6b8cac10487467d1dec8f1d9072a75621 /drivers/net/tun.c
parent5c5167515d80f78f6bb538492c423adcae31ad65 (diff)
tun: Allow tap device to send/receive UFO packets.
- Allow setting UFO on tap device and handle UFO packets. Signed-off-by: Sridhar Samudrala <sri@us.ibm.com> --------------------------------------------------------- Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index dfc1054e4cbd..a998b6a9c245 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -641,6 +641,9 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun,
641 case VIRTIO_NET_HDR_GSO_TCPV6: 641 case VIRTIO_NET_HDR_GSO_TCPV6:
642 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; 642 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
643 break; 643 break;
644 case VIRTIO_NET_HDR_GSO_UDP:
645 skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
646 break;
644 default: 647 default:
645 tun->dev->stats.rx_frame_errors++; 648 tun->dev->stats.rx_frame_errors++;
646 kfree_skb(skb); 649 kfree_skb(skb);
@@ -726,6 +729,8 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
726 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; 729 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
727 else if (sinfo->gso_type & SKB_GSO_TCPV6) 730 else if (sinfo->gso_type & SKB_GSO_TCPV6)
728 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; 731 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
732 else if (sinfo->gso_type & SKB_GSO_UDP)
733 gso.gso_type = VIRTIO_NET_HDR_GSO_UDP;
729 else 734 else
730 BUG(); 735 BUG();
731 if (sinfo->gso_type & SKB_GSO_TCP_ECN) 736 if (sinfo->gso_type & SKB_GSO_TCP_ECN)
@@ -1073,7 +1078,8 @@ static int set_offload(struct net_device *dev, unsigned long arg)
1073 old_features = dev->features; 1078 old_features = dev->features;
1074 /* Unset features, set them as we chew on the arg. */ 1079 /* Unset features, set them as we chew on the arg. */
1075 features = (old_features & ~(NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST 1080 features = (old_features & ~(NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST
1076 |NETIF_F_TSO_ECN|NETIF_F_TSO|NETIF_F_TSO6)); 1081 |NETIF_F_TSO_ECN|NETIF_F_TSO|NETIF_F_TSO6
1082 |NETIF_F_UFO));
1077 1083
1078 if (arg & TUN_F_CSUM) { 1084 if (arg & TUN_F_CSUM) {
1079 features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; 1085 features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
@@ -1090,6 +1096,11 @@ static int set_offload(struct net_device *dev, unsigned long arg)
1090 features |= NETIF_F_TSO6; 1096 features |= NETIF_F_TSO6;
1091 arg &= ~(TUN_F_TSO4|TUN_F_TSO6); 1097 arg &= ~(TUN_F_TSO4|TUN_F_TSO6);
1092 } 1098 }
1099
1100 if (arg & TUN_F_UFO) {
1101 features |= NETIF_F_UFO;
1102 arg &= ~TUN_F_UFO;
1103 }
1093 } 1104 }
1094 1105
1095 /* This gives the user a way to test for new features in future by 1106 /* This gives the user a way to test for new features in future by