Version:  2.6.32 2.6.33 2.6.34 2.6.35 2.6.36 2.6.37 2.6.38 2.6.39 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9

Architecture:  x86 arm avr32 blackfin m68k m68knommu microblaze mips powerpc sh

Linux/include/linux/if_macvlan.h

  1 #ifndef _LINUX_IF_MACVLAN_H
  2 #define _LINUX_IF_MACVLAN_H
  3 
  4 #include <linux/if_link.h>
  5 #include <linux/list.h>
  6 #include <linux/netdevice.h>
  7 #include <linux/netlink.h>
  8 #include <net/netlink.h>
  9 #include <linux/u64_stats_sync.h>
 10 
 11 #if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE)
 12 struct socket *macvtap_get_socket(struct file *);
 13 #else
 14 #include <linux/err.h>
 15 #include <linux/errno.h>
 16 struct file;
 17 struct socket;
 18 static inline struct socket *macvtap_get_socket(struct file *f)
 19 {
 20         return ERR_PTR(-EINVAL);
 21 }
 22 #endif /* CONFIG_MACVTAP */
 23 
 24 struct macvlan_port;
 25 struct macvtap_queue;
 26 
 27 /**
 28  *      struct macvlan_pcpu_stats - MACVLAN percpu stats
 29  *      @rx_packets: number of received packets
 30  *      @rx_bytes: number of received bytes
 31  *      @rx_multicast: number of received multicast packets
 32  *      @tx_packets: number of transmitted packets
 33  *      @tx_bytes: number of transmitted bytes
 34  *      @syncp: synchronization point for 64bit counters
 35  *      @rx_errors: number of rx errors
 36  *      @tx_dropped: number of tx dropped packets
 37  */
 38 struct macvlan_pcpu_stats {
 39         u64                     rx_packets;
 40         u64                     rx_bytes;
 41         u64                     rx_multicast;
 42         u64                     tx_packets;
 43         u64                     tx_bytes;
 44         struct u64_stats_sync   syncp;
 45         u32                     rx_errors;
 46         u32                     tx_dropped;
 47 };
 48 
 49 /*
 50  * Maximum times a macvtap device can be opened. This can be used to
 51  * configure the number of receive queue, e.g. for multiqueue virtio.
 52  */
 53 #define MAX_MACVTAP_QUEUES      (NR_CPUS < 16 ? NR_CPUS : 16)
 54 
 55 #define MACVLAN_MC_FILTER_BITS  8
 56 #define MACVLAN_MC_FILTER_SZ    (1 << MACVLAN_MC_FILTER_BITS)
 57 
 58 struct macvlan_dev {
 59         struct net_device       *dev;
 60         struct list_head        list;
 61         struct hlist_node       hlist;
 62         struct macvlan_port     *port;
 63         struct net_device       *lowerdev;
 64         struct macvlan_pcpu_stats __percpu *pcpu_stats;
 65 
 66         DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
 67 
 68         enum macvlan_mode       mode;
 69         u16                     flags;
 70         int (*receive)(struct sk_buff *skb);
 71         int (*forward)(struct net_device *dev, struct sk_buff *skb);
 72         struct macvtap_queue    *taps[MAX_MACVTAP_QUEUES];
 73         int                     numvtaps;
 74         int                     minor;
 75 };
 76 
 77 static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
 78                                     unsigned int len, bool success,
 79                                     bool multicast)
 80 {
 81         if (likely(success)) {
 82                 struct macvlan_pcpu_stats *pcpu_stats;
 83 
 84                 pcpu_stats = this_cpu_ptr(vlan->pcpu_stats);
 85                 u64_stats_update_begin(&pcpu_stats->syncp);
 86                 pcpu_stats->rx_packets++;
 87                 pcpu_stats->rx_bytes += len;
 88                 if (multicast)
 89                         pcpu_stats->rx_multicast++;
 90                 u64_stats_update_end(&pcpu_stats->syncp);
 91         } else {
 92                 this_cpu_inc(vlan->pcpu_stats->rx_errors);
 93         }
 94 }
 95 
 96 extern void macvlan_common_setup(struct net_device *dev);
 97 
 98 extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
 99                                   struct nlattr *tb[], struct nlattr *data[],
100                                   int (*receive)(struct sk_buff *skb),
101                                   int (*forward)(struct net_device *dev,
102                                                  struct sk_buff *skb));
103 
104 extern void macvlan_count_rx(const struct macvlan_dev *vlan,
105                              unsigned int len, bool success,
106                              bool multicast);
107 
108 extern void macvlan_dellink(struct net_device *dev, struct list_head *head);
109 
110 extern int macvlan_link_register(struct rtnl_link_ops *ops);
111 
112 extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
113                                       struct net_device *dev);
114 
115 #endif /* _LINUX_IF_MACVLAN_H */
116 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds