diff options
Diffstat (limited to 'drivers/net/macvtap.c')
-rw-r--r-- | drivers/net/macvtap.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 60f7ee5fafbe..7df221788cd4 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -46,16 +46,18 @@ struct macvtap_queue { | |||
46 | struct list_head next; | 46 | struct list_head next; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | #define MACVTAP_FEATURES (IFF_VNET_HDR | IFF_VNET_LE | IFF_MULTI_QUEUE) | 49 | #define MACVTAP_FEATURES (IFF_VNET_HDR | IFF_MULTI_QUEUE) |
50 | |||
51 | #define MACVTAP_VNET_LE 0x80000000 | ||
50 | 52 | ||
51 | static inline u16 macvtap16_to_cpu(struct macvtap_queue *q, __virtio16 val) | 53 | static inline u16 macvtap16_to_cpu(struct macvtap_queue *q, __virtio16 val) |
52 | { | 54 | { |
53 | return __virtio16_to_cpu(q->flags & IFF_VNET_LE, val); | 55 | return __virtio16_to_cpu(q->flags & MACVTAP_VNET_LE, val); |
54 | } | 56 | } |
55 | 57 | ||
56 | static inline __virtio16 cpu_to_macvtap16(struct macvtap_queue *q, u16 val) | 58 | static inline __virtio16 cpu_to_macvtap16(struct macvtap_queue *q, u16 val) |
57 | { | 59 | { |
58 | return __cpu_to_virtio16(q->flags & IFF_VNET_LE, val); | 60 | return __cpu_to_virtio16(q->flags & MACVTAP_VNET_LE, val); |
59 | } | 61 | } |
60 | 62 | ||
61 | static struct proto macvtap_proto = { | 63 | static struct proto macvtap_proto = { |
@@ -999,7 +1001,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, | |||
999 | void __user *argp = (void __user *)arg; | 1001 | void __user *argp = (void __user *)arg; |
1000 | struct ifreq __user *ifr = argp; | 1002 | struct ifreq __user *ifr = argp; |
1001 | unsigned int __user *up = argp; | 1003 | unsigned int __user *up = argp; |
1002 | unsigned int u; | 1004 | unsigned short u; |
1003 | int __user *sp = argp; | 1005 | int __user *sp = argp; |
1004 | int s; | 1006 | int s; |
1005 | int ret; | 1007 | int ret; |
@@ -1014,7 +1016,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, | |||
1014 | if ((u & ~MACVTAP_FEATURES) != (IFF_NO_PI | IFF_TAP)) | 1016 | if ((u & ~MACVTAP_FEATURES) != (IFF_NO_PI | IFF_TAP)) |
1015 | ret = -EINVAL; | 1017 | ret = -EINVAL; |
1016 | else | 1018 | else |
1017 | q->flags = u; | 1019 | q->flags = (q->flags & ~MACVTAP_FEATURES) | u; |
1018 | 1020 | ||
1019 | return ret; | 1021 | return ret; |
1020 | 1022 | ||
@@ -1027,8 +1029,9 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, | |||
1027 | } | 1029 | } |
1028 | 1030 | ||
1029 | ret = 0; | 1031 | ret = 0; |
1032 | u = q->flags; | ||
1030 | if (copy_to_user(&ifr->ifr_name, vlan->dev->name, IFNAMSIZ) || | 1033 | if (copy_to_user(&ifr->ifr_name, vlan->dev->name, IFNAMSIZ) || |
1031 | put_user(q->flags, &ifr->ifr_flags)) | 1034 | put_user(u, &ifr->ifr_flags)) |
1032 | ret = -EFAULT; | 1035 | ret = -EFAULT; |
1033 | macvtap_put_vlan(vlan); | 1036 | macvtap_put_vlan(vlan); |
1034 | rtnl_unlock(); | 1037 | rtnl_unlock(); |
@@ -1069,6 +1072,21 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, | |||
1069 | q->vnet_hdr_sz = s; | 1072 | q->vnet_hdr_sz = s; |
1070 | return 0; | 1073 | return 0; |
1071 | 1074 | ||
1075 | case TUNGETVNETLE: | ||
1076 | s = !!(q->flags & MACVTAP_VNET_LE); | ||
1077 | if (put_user(s, sp)) | ||
1078 | return -EFAULT; | ||
1079 | return 0; | ||
1080 | |||
1081 | case TUNSETVNETLE: | ||
1082 | if (get_user(s, sp)) | ||
1083 | return -EFAULT; | ||
1084 | if (s) | ||
1085 | q->flags |= MACVTAP_VNET_LE; | ||
1086 | else | ||
1087 | q->flags &= ~MACVTAP_VNET_LE; | ||
1088 | return 0; | ||
1089 | |||
1072 | case TUNSETOFFLOAD: | 1090 | case TUNSETOFFLOAD: |
1073 | /* let the user check for future flags */ | 1091 | /* let the user check for future flags */ |
1074 | if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | | 1092 | if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | |