mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
tap: Renaming tap related APIs, data structures, macros
Renaming tap related APIs, data structures and macros in tap.c from macvtap_.* to tap_.* Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
a8e0469873
commit
635b8c8ecd
@@ -1,6 +1,6 @@
|
|||||||
#include <linux/etherdevice.h>
|
#include <linux/etherdevice.h>
|
||||||
#include <linux/if_macvlan.h>
|
#include <linux/if_macvlan.h>
|
||||||
#include <linux/if_macvtap.h>
|
#include <linux/if_tap.h>
|
||||||
#include <linux/if_vlan.h>
|
#include <linux/if_vlan.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/nsproxy.h>
|
#include <linux/nsproxy.h>
|
||||||
@@ -62,7 +62,7 @@ static int macvtap_newlink(struct net *src_net,
|
|||||||
*/
|
*/
|
||||||
vlan->tap_features = TUN_OFFLOADS;
|
vlan->tap_features = TUN_OFFLOADS;
|
||||||
|
|
||||||
err = netdev_rx_handler_register(dev, macvtap_handle_frame, vlan);
|
err = netdev_rx_handler_register(dev, tap_handle_frame, vlan);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ static void macvtap_dellink(struct net_device *dev,
|
|||||||
struct list_head *head)
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
netdev_rx_handler_unregister(dev);
|
netdev_rx_handler_unregister(dev);
|
||||||
macvtap_del_queues(dev);
|
tap_del_queues(dev);
|
||||||
macvlan_dellink(dev, head);
|
macvlan_dellink(dev, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ static int macvtap_device_event(struct notifier_block *unused,
|
|||||||
* been registered but before register_netdevice has
|
* been registered but before register_netdevice has
|
||||||
* finished running.
|
* finished running.
|
||||||
*/
|
*/
|
||||||
err = macvtap_get_minor(vlan);
|
err = tap_get_minor(vlan);
|
||||||
if (err)
|
if (err)
|
||||||
return notifier_from_errno(err);
|
return notifier_from_errno(err);
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ static int macvtap_device_event(struct notifier_block *unused,
|
|||||||
classdev = device_create(&macvtap_class, &dev->dev, devt,
|
classdev = device_create(&macvtap_class, &dev->dev, devt,
|
||||||
dev, tap_name);
|
dev, tap_name);
|
||||||
if (IS_ERR(classdev)) {
|
if (IS_ERR(classdev)) {
|
||||||
macvtap_free_minor(vlan);
|
tap_free_minor(vlan);
|
||||||
return notifier_from_errno(PTR_ERR(classdev));
|
return notifier_from_errno(PTR_ERR(classdev));
|
||||||
}
|
}
|
||||||
err = sysfs_create_link(&dev->dev.kobj, &classdev->kobj,
|
err = sysfs_create_link(&dev->dev.kobj, &classdev->kobj,
|
||||||
@@ -144,10 +144,10 @@ static int macvtap_device_event(struct notifier_block *unused,
|
|||||||
sysfs_remove_link(&dev->dev.kobj, tap_name);
|
sysfs_remove_link(&dev->dev.kobj, tap_name);
|
||||||
devt = MKDEV(MAJOR(macvtap_major), vlan->minor);
|
devt = MKDEV(MAJOR(macvtap_major), vlan->minor);
|
||||||
device_destroy(&macvtap_class, devt);
|
device_destroy(&macvtap_class, devt);
|
||||||
macvtap_free_minor(vlan);
|
tap_free_minor(vlan);
|
||||||
break;
|
break;
|
||||||
case NETDEV_CHANGE_TX_QUEUE_LEN:
|
case NETDEV_CHANGE_TX_QUEUE_LEN:
|
||||||
if (macvtap_queue_resize(vlan))
|
if (tap_queue_resize(vlan))
|
||||||
return NOTIFY_BAD;
|
return NOTIFY_BAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ static struct notifier_block macvtap_notifier_block __read_mostly = {
|
|||||||
.notifier_call = macvtap_device_event,
|
.notifier_call = macvtap_device_event,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct file_operations macvtap_fops;
|
extern struct file_operations tap_fops;
|
||||||
static int macvtap_init(void)
|
static int macvtap_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@@ -169,7 +169,7 @@ static int macvtap_init(void)
|
|||||||
if (err)
|
if (err)
|
||||||
goto out1;
|
goto out1;
|
||||||
|
|
||||||
cdev_init(&macvtap_cdev, &macvtap_fops);
|
cdev_init(&macvtap_cdev, &tap_fops);
|
||||||
err = cdev_add(&macvtap_cdev, macvtap_major, MACVTAP_NUM_DEVS);
|
err = cdev_add(&macvtap_cdev, macvtap_major, MACVTAP_NUM_DEVS);
|
||||||
if (err)
|
if (err)
|
||||||
goto out2;
|
goto out2;
|
||||||
|
|||||||
+166
-166
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -24,6 +24,7 @@
|
|||||||
#include <linux/if_arp.h>
|
#include <linux/if_arp.h>
|
||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
#include <linux/if_macvlan.h>
|
#include <linux/if_macvlan.h>
|
||||||
|
#include <linux/if_tap.h>
|
||||||
#include <linux/if_vlan.h>
|
#include <linux/if_vlan.h>
|
||||||
|
|
||||||
#include <net/sock.h>
|
#include <net/sock.h>
|
||||||
@@ -960,7 +961,7 @@ static struct socket *get_tap_socket(int fd)
|
|||||||
sock = tun_get_socket(file);
|
sock = tun_get_socket(file);
|
||||||
if (!IS_ERR(sock))
|
if (!IS_ERR(sock))
|
||||||
return sock;
|
return sock;
|
||||||
sock = macvtap_get_socket(file);
|
sock = tap_get_socket(file);
|
||||||
if (IS_ERR(sock))
|
if (IS_ERR(sock))
|
||||||
fput(file);
|
fput(file);
|
||||||
return sock;
|
return sock;
|
||||||
|
|||||||
@@ -9,19 +9,6 @@
|
|||||||
#include <net/netlink.h>
|
#include <net/netlink.h>
|
||||||
#include <linux/u64_stats_sync.h>
|
#include <linux/u64_stats_sync.h>
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_MACVTAP)
|
|
||||||
struct socket *macvtap_get_socket(struct file *);
|
|
||||||
#else
|
|
||||||
#include <linux/err.h>
|
|
||||||
#include <linux/errno.h>
|
|
||||||
struct file;
|
|
||||||
struct socket;
|
|
||||||
static inline struct socket *macvtap_get_socket(struct file *f)
|
|
||||||
{
|
|
||||||
return ERR_PTR(-EINVAL);
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_MACVTAP */
|
|
||||||
|
|
||||||
struct macvlan_port;
|
struct macvlan_port;
|
||||||
struct macvtap_queue;
|
struct macvtap_queue;
|
||||||
|
|
||||||
@@ -29,7 +16,7 @@ struct macvtap_queue;
|
|||||||
* Maximum times a macvtap device can be opened. This can be used to
|
* Maximum times a macvtap device can be opened. This can be used to
|
||||||
* configure the number of receive queue, e.g. for multiqueue virtio.
|
* configure the number of receive queue, e.g. for multiqueue virtio.
|
||||||
*/
|
*/
|
||||||
#define MAX_MACVTAP_QUEUES 256
|
#define MAX_TAP_QUEUES 256
|
||||||
|
|
||||||
#define MACVLAN_MC_FILTER_BITS 8
|
#define MACVLAN_MC_FILTER_BITS 8
|
||||||
#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS)
|
#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS)
|
||||||
@@ -49,7 +36,7 @@ struct macvlan_dev {
|
|||||||
enum macvlan_mode mode;
|
enum macvlan_mode mode;
|
||||||
u16 flags;
|
u16 flags;
|
||||||
/* This array tracks active taps. */
|
/* This array tracks active taps. */
|
||||||
struct macvtap_queue __rcu *taps[MAX_MACVTAP_QUEUES];
|
struct tap_queue __rcu *taps[MAX_TAP_QUEUES];
|
||||||
/* This list tracks all taps (both enabled and disabled) */
|
/* This list tracks all taps (both enabled and disabled) */
|
||||||
struct list_head queue_list;
|
struct list_head queue_list;
|
||||||
int numvtaps;
|
int numvtaps;
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
#ifndef _LINUX_IF_MACVTAP_H_
|
|
||||||
#define _LINUX_IF_MACVTAP_H_
|
|
||||||
|
|
||||||
rx_handler_result_t macvtap_handle_frame(struct sk_buff **pskb);
|
|
||||||
void macvtap_del_queues(struct net_device *dev);
|
|
||||||
int macvtap_get_minor(struct macvlan_dev *vlan);
|
|
||||||
void macvtap_free_minor(struct macvlan_dev *vlan);
|
|
||||||
int macvtap_queue_resize(struct macvlan_dev *vlan);
|
|
||||||
|
|
||||||
#endif /*_LINUX_IF_MACVTAP_H_*/
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef _LINUX_IF_TAP_H_
|
||||||
|
#define _LINUX_IF_TAP_H_
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_MACVTAP)
|
||||||
|
struct socket *tap_get_socket(struct file *);
|
||||||
|
#else
|
||||||
|
#include <linux/err.h>
|
||||||
|
#include <linux/errno.h>
|
||||||
|
struct file;
|
||||||
|
struct socket;
|
||||||
|
static inline struct socket *tap_get_socket(struct file *f)
|
||||||
|
{
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_MACVTAP */
|
||||||
|
|
||||||
|
rx_handler_result_t tap_handle_frame(struct sk_buff **pskb);
|
||||||
|
void tap_del_queues(struct net_device *dev);
|
||||||
|
int tap_get_minor(struct macvlan_dev *vlan);
|
||||||
|
void tap_free_minor(struct macvlan_dev *vlan);
|
||||||
|
int tap_queue_resize(struct macvlan_dev *vlan);
|
||||||
|
|
||||||
|
#endif /*_LINUX_IF_TAP_H_*/
|
||||||
Reference in New Issue
Block a user