]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
tuntap: move socket to tun_file
authorJason Wang <jasowang@redhat.com>
Wed, 31 Oct 2012 19:45:57 +0000 (19:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Nov 2012 15:14:07 +0000 (11:14 -0400)
commit54f968d6efdbf7dec36faa44fc11f01b0e4d1990
treec6cf1f86265af7cb215c0a1e0d3662d30992a578
parent1e5883382c3287a61aeebc33a301fd50f3a1005b
tuntap: move socket to tun_file

Current tuntap makes use of the socket receive queue as its tx queue. To
implement multiple tx queues for tuntap and enable the ability of adding and
removing queues during workload, the first step is to move the socket related
structures to tun_file. Then we could let multiple fds/sockets to be attached to
the tuntap.

This patch removes tun_sock and moves socket related structures from tun_sock or
tun_struct to tun_file. Two exceptions are tap_filter and sock_fprog, they are
still kept in tun_structure since they are used to filter packets for the net
device instead of per transmit queue (at least I see no requirements for
them). After those changes, socket were created and destroyed during file open
and close (instead of device creation and destroy), the socket structures could
be dereferenced from tun_file instead of the file of tun_struct structure
itself.

For persisent device, since we purge during datching and wouldn't queue any
packets when no interface were attached, there's no behaviod changes before and
after this patch, so the changes were transparent to the userspace. To keep the
attributes such as sndbuf, socket filter and vnet header, those would be
re-initialize after a new interface were attached to an persist device.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c