net: qualcomm: rmnet: Remove some unused defines
[linux-2.6/btrfs-unstable.git] / include / net / rtnetlink.h
blobe3ca8e2e31033f8638f071937582578604ba915b
1 #ifndef __NET_RTNETLINK_H
2 #define __NET_RTNETLINK_H
4 #include <linux/rtnetlink.h>
5 #include <net/netlink.h>
7 typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *,
8 struct netlink_ext_ack *);
9 typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
11 enum rtnl_link_flags {
12 RTNL_FLAG_DOIT_UNLOCKED = 1,
15 int __rtnl_register(int protocol, int msgtype,
16 rtnl_doit_func, rtnl_dumpit_func, unsigned int flags);
17 void rtnl_register(int protocol, int msgtype,
18 rtnl_doit_func, rtnl_dumpit_func, unsigned int flags);
19 int rtnl_unregister(int protocol, int msgtype);
20 void rtnl_unregister_all(int protocol);
22 static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
24 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
25 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
26 else
27 return AF_UNSPEC;
30 /**
31 * struct rtnl_link_ops - rtnetlink link operations
33 * @list: Used internally
34 * @kind: Identifier
35 * @maxtype: Highest device specific netlink attribute number
36 * @policy: Netlink policy for device specific attribute validation
37 * @validate: Optional validation function for netlink/changelink parameters
38 * @priv_size: sizeof net_device private space
39 * @setup: net_device setup function
40 * @newlink: Function for configuring and registering a new device
41 * @changelink: Function for changing parameters of an existing device
42 * @dellink: Function to remove a device
43 * @get_size: Function to calculate required room for dumping device
44 * specific netlink attributes
45 * @fill_info: Function to dump device specific netlink attributes
46 * @get_xstats_size: Function to calculate required room for dumping device
47 * specific statistics
48 * @fill_xstats: Function to dump device specific statistics
49 * @get_num_tx_queues: Function to determine number of transmit queues
50 * to create when creating a new device.
51 * @get_num_rx_queues: Function to determine number of receive queues
52 * to create when creating a new device.
53 * @get_link_net: Function to get the i/o netns of the device
54 * @get_linkxstats_size: Function to calculate the required room for
55 * dumping device-specific extended link stats
56 * @fill_linkxstats: Function to dump device-specific extended link stats
58 struct rtnl_link_ops {
59 struct list_head list;
61 const char *kind;
63 size_t priv_size;
64 void (*setup)(struct net_device *dev);
66 int maxtype;
67 const struct nla_policy *policy;
68 int (*validate)(struct nlattr *tb[],
69 struct nlattr *data[],
70 struct netlink_ext_ack *extack);
72 int (*newlink)(struct net *src_net,
73 struct net_device *dev,
74 struct nlattr *tb[],
75 struct nlattr *data[],
76 struct netlink_ext_ack *extack);
77 int (*changelink)(struct net_device *dev,
78 struct nlattr *tb[],
79 struct nlattr *data[],
80 struct netlink_ext_ack *extack);
81 void (*dellink)(struct net_device *dev,
82 struct list_head *head);
84 size_t (*get_size)(const struct net_device *dev);
85 int (*fill_info)(struct sk_buff *skb,
86 const struct net_device *dev);
88 size_t (*get_xstats_size)(const struct net_device *dev);
89 int (*fill_xstats)(struct sk_buff *skb,
90 const struct net_device *dev);
91 unsigned int (*get_num_tx_queues)(void);
92 unsigned int (*get_num_rx_queues)(void);
94 int slave_maxtype;
95 const struct nla_policy *slave_policy;
96 int (*slave_changelink)(struct net_device *dev,
97 struct net_device *slave_dev,
98 struct nlattr *tb[],
99 struct nlattr *data[],
100 struct netlink_ext_ack *extack);
101 size_t (*get_slave_size)(const struct net_device *dev,
102 const struct net_device *slave_dev);
103 int (*fill_slave_info)(struct sk_buff *skb,
104 const struct net_device *dev,
105 const struct net_device *slave_dev);
106 struct net *(*get_link_net)(const struct net_device *dev);
107 size_t (*get_linkxstats_size)(const struct net_device *dev,
108 int attr);
109 int (*fill_linkxstats)(struct sk_buff *skb,
110 const struct net_device *dev,
111 int *prividx, int attr);
114 int __rtnl_link_register(struct rtnl_link_ops *ops);
115 void __rtnl_link_unregister(struct rtnl_link_ops *ops);
117 int rtnl_link_register(struct rtnl_link_ops *ops);
118 void rtnl_link_unregister(struct rtnl_link_ops *ops);
121 * struct rtnl_af_ops - rtnetlink address family operations
123 * @list: Used internally
124 * @family: Address family
125 * @fill_link_af: Function to fill IFLA_AF_SPEC with address family
126 * specific netlink attributes.
127 * @get_link_af_size: Function to calculate size of address family specific
128 * netlink attributes.
129 * @validate_link_af: Validate a IFLA_AF_SPEC attribute, must check attr
130 * for invalid configuration settings.
131 * @set_link_af: Function to parse a IFLA_AF_SPEC attribute and modify
132 * net_device accordingly.
134 struct rtnl_af_ops {
135 struct list_head list;
136 int family;
138 int (*fill_link_af)(struct sk_buff *skb,
139 const struct net_device *dev,
140 u32 ext_filter_mask);
141 size_t (*get_link_af_size)(const struct net_device *dev,
142 u32 ext_filter_mask);
144 int (*validate_link_af)(const struct net_device *dev,
145 const struct nlattr *attr);
146 int (*set_link_af)(struct net_device *dev,
147 const struct nlattr *attr);
149 int (*fill_stats_af)(struct sk_buff *skb,
150 const struct net_device *dev);
151 size_t (*get_stats_af_size)(const struct net_device *dev);
154 void rtnl_af_register(struct rtnl_af_ops *ops);
155 void rtnl_af_unregister(struct rtnl_af_ops *ops);
157 struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
158 struct net_device *rtnl_create_link(struct net *net, const char *ifname,
159 unsigned char name_assign_type,
160 const struct rtnl_link_ops *ops,
161 struct nlattr *tb[]);
162 int rtnl_delete_link(struct net_device *dev);
163 int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm);
165 int rtnl_nla_parse_ifla(struct nlattr **tb, const struct nlattr *head, int len,
166 struct netlink_ext_ack *exterr);
168 #define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
170 #endif