]> git.proxmox.com Git - mirror_ovs.git/blame - lib/netdev-vport.c
ofp-util: Make ofputil_cls_rule_to_match() help with flow cookies too.
[mirror_ovs.git] / lib / netdev-vport.c
CommitLineData
777ece09
JG
1/*
2 * Copyright (c) 2010 Nicira Networks.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
6fcfff1b 10 * Unless required by applicable law or agreed to in writing, software
777ece09
JG
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <config.h>
2b9d6589
BP
18
19#include "netdev-vport.h"
20
777ece09
JG
21#include <errno.h>
22#include <fcntl.h>
2b9d6589 23#include <net/if.h>
777ece09
JG
24#include <sys/ioctl.h>
25
26#include "list.h"
2b9d6589 27#include "netdev-provider.h"
777ece09 28#include "openvswitch/datapath-protocol.h"
2b9d6589
BP
29#include "openvswitch/tunnel.h"
30#include "packets.h"
777ece09
JG
31#include "shash.h"
32#include "socket-util.h"
777ece09
JG
33#include "vlog.h"
34
d98e6007 35VLOG_DEFINE_THIS_MODULE(netdev_vport);
5136ce49 36
777ece09
JG
37struct netdev_vport_notifier {
38 struct netdev_notifier notifier;
39 struct list list_node;
d295e8e9 40 struct shash_node *shash_node;
777ece09
JG
41};
42
2b9d6589
BP
43struct netdev_dev_vport {
44 struct netdev_dev netdev_dev;
c3827f61 45 uint64_t config[VPORT_CONFIG_SIZE / 8];
2b9d6589
BP
46};
47
48struct netdev_vport {
49 struct netdev netdev;
50};
51
2b9d6589 52struct vport_class {
c3827f61
BP
53 struct netdev_class netdev_class;
54 int (*parse_config)(const struct netdev_dev *, const struct shash *args,
55 void *config);
2b9d6589
BP
56};
57
777ece09
JG
58static struct shash netdev_vport_notifiers =
59 SHASH_INITIALIZER(&netdev_vport_notifiers);
60
61static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
62
2b9d6589
BP
63static int netdev_vport_do_ioctl(int cmd, void *arg);
64static int netdev_vport_create(const struct netdev_class *, const char *,
65 const struct shash *, struct netdev_dev **);
66static void netdev_vport_poll_notify(const struct netdev *);
67
68static bool
69is_vport_class(const struct netdev_class *class)
777ece09 70{
2b9d6589
BP
71 return class->create == netdev_vport_create;
72}
777ece09 73
2b9d6589
BP
74static const struct vport_class *
75vport_class_cast(const struct netdev_class *class)
76{
77 assert(is_vport_class(class));
78 return CONTAINER_OF(class, struct vport_class, netdev_class);
79}
80
81static struct netdev_dev_vport *
82netdev_dev_vport_cast(const struct netdev_dev *netdev_dev)
83{
84 assert(is_vport_class(netdev_dev_get_class(netdev_dev)));
85 return CONTAINER_OF(netdev_dev, struct netdev_dev_vport, netdev_dev);
86}
87
88static struct netdev_vport *
89netdev_vport_cast(const struct netdev *netdev)
90{
91 struct netdev_dev *netdev_dev = netdev_get_dev(netdev);
92 assert(is_vport_class(netdev_dev_get_class(netdev_dev)));
93 return CONTAINER_OF(netdev, struct netdev_vport, netdev);
94}
95
c3827f61
BP
96/* If 'netdev' is a vport netdev, copies its kernel configuration into
97 * 'config'. Otherwise leaves 'config' untouched. */
98void
99netdev_vport_get_config(const struct netdev *netdev, void *config)
2b9d6589 100{
c3827f61
BP
101 const struct netdev_dev *dev = netdev_get_dev(netdev);
102
103 if (is_vport_class(netdev_dev_get_class(dev))) {
104 const struct netdev_dev_vport *vport = netdev_dev_vport_cast(dev);
105 memcpy(config, vport->config, VPORT_CONFIG_SIZE);
777ece09 106 }
2b9d6589 107}
777ece09 108
2b9d6589 109static int
c3827f61
BP
110netdev_vport_create(const struct netdev_class *netdev_class, const char *name,
111 const struct shash *args,
112 struct netdev_dev **netdev_devp)
2b9d6589 113{
c3827f61
BP
114 const struct vport_class *vport_class = vport_class_cast(netdev_class);
115 struct netdev_dev_vport *dev;
116 int error;
2b9d6589 117
c3827f61
BP
118 dev = xmalloc(sizeof *dev);
119 *netdev_devp = &dev->netdev_dev;
120 netdev_dev_init(&dev->netdev_dev, name, netdev_class);
2b9d6589 121
c3827f61
BP
122 memset(dev->config, 0, sizeof dev->config);
123 error = vport_class->parse_config(&dev->netdev_dev, args, dev->config);
2b9d6589 124
c3827f61
BP
125 if (error) {
126 netdev_dev_uninit(&dev->netdev_dev, true);
2b9d6589 127 }
c3827f61 128 return error;
777ece09
JG
129}
130
2b9d6589
BP
131static void
132netdev_vport_destroy(struct netdev_dev *netdev_dev_)
133{
134 struct netdev_dev_vport *netdev_dev = netdev_dev_vport_cast(netdev_dev_);
135
136 free(netdev_dev);
137}
138
139static int
140netdev_vport_open(struct netdev_dev *netdev_dev_, int ethertype OVS_UNUSED,
141 struct netdev **netdevp)
142{
143 struct netdev_vport *netdev;
144
145 netdev = xmalloc(sizeof *netdev);
146 netdev_init(&netdev->netdev, netdev_dev_);
147
148 *netdevp = &netdev->netdev;
149 return 0;
150}
151
152static void
153netdev_vport_close(struct netdev *netdev_)
154{
155 struct netdev_vport *netdev = netdev_vport_cast(netdev_);
156 free(netdev);
157}
158
159static int
c3827f61 160netdev_vport_reconfigure(struct netdev_dev *dev_,
2b9d6589
BP
161 const struct shash *args)
162{
c3827f61
BP
163 const struct netdev_class *netdev_class = netdev_dev_get_class(dev_);
164 const struct vport_class *vport_class = vport_class_cast(netdev_class);
165 struct netdev_dev_vport *dev = netdev_dev_vport_cast(dev_);
166 struct odp_port port;
167 int error;
168
169 memset(&port, 0, sizeof port);
170 strncpy(port.devname, netdev_dev_get_name(dev_), sizeof port.devname);
171 strncpy(port.type, netdev_dev_get_type(dev_), sizeof port.type);
172 error = vport_class->parse_config(dev_, args, port.config);
173 if (!error && memcmp(port.config, dev->config, sizeof dev->config)) {
174 error = netdev_vport_do_ioctl(ODP_VPORT_MOD, &port);
175 if (!error || error == ENODEV) {
176 /* Either reconfiguration succeeded or this vport is not installed
177 * in the kernel (e.g. it hasn't been added to a dpif yet with
178 * dpif_port_add()). */
179 memcpy(dev->config, port.config, sizeof dev->config);
180 }
2b9d6589 181 }
c3827f61 182 return error;
2b9d6589
BP
183}
184
185static int
777ece09
JG
186netdev_vport_set_etheraddr(struct netdev *netdev,
187 const uint8_t mac[ETH_ADDR_LEN])
188{
189 struct odp_vport_ether vport_ether;
190 int err;
191
192 ovs_strlcpy(vport_ether.devname, netdev_get_name(netdev),
193 sizeof vport_ether.devname);
194
195 memcpy(vport_ether.ether_addr, mac, ETH_ADDR_LEN);
196
197 err = netdev_vport_do_ioctl(ODP_VPORT_ETHER_SET, &vport_ether);
198 if (err) {
199 return err;
200 }
201
202 netdev_vport_poll_notify(netdev);
203 return 0;
204}
205
2b9d6589 206static int
777ece09
JG
207netdev_vport_get_etheraddr(const struct netdev *netdev,
208 uint8_t mac[ETH_ADDR_LEN])
209{
210 struct odp_vport_ether vport_ether;
211 int err;
212
213 ovs_strlcpy(vport_ether.devname, netdev_get_name(netdev),
214 sizeof vport_ether.devname);
215
216 err = netdev_vport_do_ioctl(ODP_VPORT_ETHER_GET, &vport_ether);
217 if (err) {
218 return err;
219 }
220
221 memcpy(mac, vport_ether.ether_addr, ETH_ADDR_LEN);
222 return 0;
223}
224
2b9d6589 225static int
777ece09
JG
226netdev_vport_get_mtu(const struct netdev *netdev, int *mtup)
227{
228 struct odp_vport_mtu vport_mtu;
229 int err;
230
231 ovs_strlcpy(vport_mtu.devname, netdev_get_name(netdev),
232 sizeof vport_mtu.devname);
233
234 err = netdev_vport_do_ioctl(ODP_VPORT_MTU_GET, &vport_mtu);
235 if (err) {
236 return err;
237 }
238
239 *mtup = vport_mtu.mtu;
240 return 0;
241}
242
777ece09
JG
243int
244netdev_vport_get_stats(const struct netdev *netdev, struct netdev_stats *stats)
245{
246 const char *name = netdev_get_name(netdev);
247 struct odp_vport_stats_req ovsr;
248 int err;
249
250 ovs_strlcpy(ovsr.devname, name, sizeof ovsr.devname);
251 err = netdev_vport_do_ioctl(ODP_VPORT_STATS_GET, &ovsr);
252 if (err) {
253 return err;
254 }
255
256 stats->rx_packets = ovsr.stats.rx_packets;
257 stats->tx_packets = ovsr.stats.tx_packets;
258 stats->rx_bytes = ovsr.stats.rx_bytes;
259 stats->tx_bytes = ovsr.stats.tx_bytes;
260 stats->rx_errors = ovsr.stats.rx_errors;
261 stats->tx_errors = ovsr.stats.tx_errors;
262 stats->rx_dropped = ovsr.stats.rx_dropped;
263 stats->tx_dropped = ovsr.stats.tx_dropped;
ec61a01c 264 stats->multicast = ovsr.stats.multicast;
777ece09 265 stats->collisions = ovsr.stats.collisions;
ec61a01c
BP
266 stats->rx_length_errors = ovsr.stats.rx_length_errors;
267 stats->rx_over_errors = ovsr.stats.rx_over_errors;
268 stats->rx_crc_errors = ovsr.stats.rx_crc_errors;
269 stats->rx_frame_errors = ovsr.stats.rx_frame_errors;
270 stats->rx_fifo_errors = ovsr.stats.rx_fifo_errors;
271 stats->rx_missed_errors = ovsr.stats.rx_missed_errors;
272 stats->tx_aborted_errors = ovsr.stats.tx_aborted_errors;
273 stats->tx_carrier_errors = ovsr.stats.tx_carrier_errors;
274 stats->tx_fifo_errors = ovsr.stats.tx_fifo_errors;
275 stats->tx_heartbeat_errors = ovsr.stats.tx_heartbeat_errors;
276 stats->tx_window_errors = ovsr.stats.tx_window_errors;
777ece09
JG
277
278 return 0;
279}
280
f4b6076a
JG
281int
282netdev_vport_set_stats(struct netdev *netdev, const struct netdev_stats *stats)
283{
284 struct odp_vport_stats_req ovsr;
285 int err;
286
287 ovs_strlcpy(ovsr.devname, netdev_get_name(netdev), sizeof ovsr.devname);
288
289 ovsr.stats.rx_packets = stats->rx_packets;
290 ovsr.stats.tx_packets = stats->tx_packets;
291 ovsr.stats.rx_bytes = stats->rx_bytes;
292 ovsr.stats.tx_bytes = stats->tx_bytes;
293 ovsr.stats.rx_errors = stats->rx_errors;
294 ovsr.stats.tx_errors = stats->tx_errors;
295 ovsr.stats.rx_dropped = stats->rx_dropped;
296 ovsr.stats.tx_dropped = stats->tx_dropped;
ec61a01c 297 ovsr.stats.multicast = stats->multicast;
f4b6076a 298 ovsr.stats.collisions = stats->collisions;
ec61a01c
BP
299 ovsr.stats.rx_length_errors = stats->rx_length_errors;
300 ovsr.stats.rx_over_errors = stats->rx_over_errors;
301 ovsr.stats.rx_crc_errors = stats->rx_crc_errors;
302 ovsr.stats.rx_frame_errors = stats->rx_frame_errors;
303 ovsr.stats.rx_fifo_errors = stats->rx_fifo_errors;
304 ovsr.stats.rx_missed_errors = stats->rx_missed_errors;
305 ovsr.stats.tx_aborted_errors = stats->tx_aborted_errors;
306 ovsr.stats.tx_carrier_errors = stats->tx_carrier_errors;
307 ovsr.stats.tx_fifo_errors = stats->tx_fifo_errors;
308 ovsr.stats.tx_heartbeat_errors = stats->tx_heartbeat_errors;
309 ovsr.stats.tx_window_errors = stats->tx_window_errors;
f4b6076a
JG
310
311 err = netdev_vport_do_ioctl(ODP_VPORT_STATS_SET, &ovsr);
312
313 /* If the vport layer doesn't know about the device, that doesn't mean it
314 * doesn't exist (after all were able to open it when netdev_open() was
315 * called), it just means that it isn't attached and we'll be getting
316 * stats a different way. */
317 if (err == ENODEV) {
318 err = EOPNOTSUPP;
319 }
320
321 return err;
322}
323
2b9d6589 324static int
777ece09
JG
325netdev_vport_update_flags(struct netdev *netdev OVS_UNUSED,
326 enum netdev_flags off, enum netdev_flags on OVS_UNUSED,
327 enum netdev_flags *old_flagsp)
328{
329 if (off & (NETDEV_UP | NETDEV_PROMISC)) {
330 return EOPNOTSUPP;
331 }
332
333 *old_flagsp = NETDEV_UP | NETDEV_PROMISC;
334 return 0;
335}
336
337static char *
338make_poll_name(const struct netdev *netdev)
339{
340 return xasprintf("%s:%s", netdev_get_type(netdev), netdev_get_name(netdev));
341}
342
2b9d6589 343static int
777ece09
JG
344netdev_vport_poll_add(struct netdev *netdev,
345 void (*cb)(struct netdev_notifier *), void *aux,
346 struct netdev_notifier **notifierp)
347{
348 char *poll_name = make_poll_name(netdev);
349 struct netdev_vport_notifier *notifier;
350 struct list *list;
351 struct shash_node *shash_node;
352
353 shash_node = shash_find_data(&netdev_vport_notifiers, poll_name);
354 if (!shash_node) {
355 list = xmalloc(sizeof *list);
356 list_init(list);
eb5f3e93 357 shash_node = shash_add(&netdev_vport_notifiers, poll_name, list);
777ece09
JG
358 } else {
359 list = shash_node->data;
360 }
361
362 notifier = xmalloc(sizeof *notifier);
363 netdev_notifier_init(&notifier->notifier, netdev, cb, aux);
364 list_push_back(list, &notifier->list_node);
365 notifier->shash_node = shash_node;
366
367 *notifierp = &notifier->notifier;
368 free(poll_name);
369
370 return 0;
371}
372
2b9d6589 373static void
777ece09
JG
374netdev_vport_poll_remove(struct netdev_notifier *notifier_)
375{
376 struct netdev_vport_notifier *notifier =
377 CONTAINER_OF(notifier_, struct netdev_vport_notifier, notifier);
378
379 struct list *list;
380
381 list = list_remove(&notifier->list_node);
382 if (list_is_empty(list)) {
383 shash_delete(&netdev_vport_notifiers, notifier->shash_node);
384 free(list);
385 }
386
387 free(notifier);
388}
2b9d6589
BP
389\f
390/* Helper functions. */
777ece09 391
2b9d6589
BP
392static int
393netdev_vport_do_ioctl(int cmd, void *arg)
394{
395 static int ioctl_fd = -1;
396
397 if (ioctl_fd < 0) {
398 ioctl_fd = open("/dev/net/dp0", O_RDONLY | O_NONBLOCK);
399 if (ioctl_fd < 0) {
400 VLOG_ERR_RL(&rl, "failed to open ioctl fd: %s", strerror(errno));
401 return errno;
402 }
403 }
404
405 return ioctl(ioctl_fd, cmd, arg) ? errno : 0;
406}
407
408static void
777ece09
JG
409netdev_vport_poll_notify(const struct netdev *netdev)
410{
411 char *poll_name = make_poll_name(netdev);
412 struct list *list = shash_find_data(&netdev_vport_notifiers,
413 poll_name);
414
415 if (list) {
416 struct netdev_vport_notifier *notifier;
417
4e8e4213 418 LIST_FOR_EACH (notifier, list_node, list) {
777ece09
JG
419 struct netdev_notifier *n = &notifier->notifier;
420 n->cb(n);
421 }
422 }
423
424 free(poll_name);
425}
2b9d6589
BP
426\f
427/* Code specific to individual vport types. */
428
429static int
c3827f61
BP
430parse_tunnel_config(const struct netdev_dev *dev, const struct shash *args,
431 void *configp)
2b9d6589 432{
c3827f61
BP
433 const char *name = netdev_dev_get_name(dev);
434 const char *type = netdev_dev_get_type(dev);
435 bool is_gre = !strcmp(type, "gre");
436 struct tnl_port_config config;
2b9d6589
BP
437 struct shash_node *node;
438 bool ipsec_ip_set = false;
439 bool ipsec_mech_set = false;
440
73d67a43 441 memset(&config, 0, sizeof config);
c3827f61
BP
442 config.flags |= TNL_F_PMTUD;
443 config.flags |= TNL_F_HDR_CACHE;
2b9d6589
BP
444
445 SHASH_FOR_EACH (node, args) {
446 if (!strcmp(node->name, "remote_ip")) {
447 struct in_addr in_addr;
448 if (lookup_ip(node->data, &in_addr)) {
c3827f61 449 VLOG_WARN("%s: bad %s 'remote_ip'", name, type);
2b9d6589 450 } else {
c3827f61 451 config.daddr = in_addr.s_addr;
2b9d6589
BP
452 }
453 } else if (!strcmp(node->name, "local_ip")) {
454 struct in_addr in_addr;
455 if (lookup_ip(node->data, &in_addr)) {
c3827f61 456 VLOG_WARN("%s: bad %s 'local_ip'", name, type);
2b9d6589 457 } else {
c3827f61 458 config.saddr = in_addr.s_addr;
2b9d6589
BP
459 }
460 } else if (!strcmp(node->name, "key") && is_gre) {
461 if (!strcmp(node->data, "flow")) {
c3827f61
BP
462 config.flags |= TNL_F_IN_KEY_MATCH;
463 config.flags |= TNL_F_OUT_KEY_ACTION;
2b9d6589 464 } else {
c3827f61 465 config.out_key = config.in_key = htonl(atoi(node->data));
2b9d6589
BP
466 }
467 } else if (!strcmp(node->name, "in_key") && is_gre) {
468 if (!strcmp(node->data, "flow")) {
c3827f61 469 config.flags |= TNL_F_IN_KEY_MATCH;
2b9d6589 470 } else {
c3827f61 471 config.in_key = htonl(atoi(node->data));
2b9d6589
BP
472 }
473 } else if (!strcmp(node->name, "out_key") && is_gre) {
474 if (!strcmp(node->data, "flow")) {
c3827f61 475 config.flags |= TNL_F_OUT_KEY_ACTION;
2b9d6589 476 } else {
c3827f61 477 config.out_key = htonl(atoi(node->data));
2b9d6589
BP
478 }
479 } else if (!strcmp(node->name, "tos")) {
480 if (!strcmp(node->data, "inherit")) {
c3827f61 481 config.flags |= TNL_F_TOS_INHERIT;
2b9d6589 482 } else {
c3827f61 483 config.tos = atoi(node->data);
2b9d6589
BP
484 }
485 } else if (!strcmp(node->name, "ttl")) {
486 if (!strcmp(node->data, "inherit")) {
c3827f61 487 config.flags |= TNL_F_TTL_INHERIT;
2b9d6589 488 } else {
c3827f61 489 config.ttl = atoi(node->data);
2b9d6589
BP
490 }
491 } else if (!strcmp(node->name, "csum") && is_gre) {
492 if (!strcmp(node->data, "true")) {
c3827f61 493 config.flags |= TNL_F_CSUM;
2b9d6589
BP
494 }
495 } else if (!strcmp(node->name, "pmtud")) {
496 if (!strcmp(node->data, "false")) {
c3827f61 497 config.flags &= ~TNL_F_PMTUD;
2b9d6589
BP
498 }
499 } else if (!strcmp(node->name, "header_cache")) {
500 if (!strcmp(node->data, "false")) {
c3827f61 501 config.flags &= ~TNL_F_HDR_CACHE;
2b9d6589
BP
502 }
503 } else if (!strcmp(node->name, "ipsec_local_ip")) {
504 ipsec_ip_set = true;
505 } else if (!strcmp(node->name, "ipsec_cert")
506 || !strcmp(node->name, "ipsec_psk")) {
507 ipsec_mech_set = true;
508 } else {
509 VLOG_WARN("%s: unknown %s argument '%s'",
c3827f61 510 name, type, node->name);
2b9d6589
BP
511 }
512 }
513
514 /* IPsec doesn't work when header caching is enabled. Disable it if the
515 * IPsec local IP address and authentication mechanism have been defined. */
516 if (ipsec_ip_set && ipsec_mech_set) {
517 VLOG_INFO("%s: header caching disabled due to use of IPsec", name);
c3827f61 518 config.flags &= ~TNL_F_HDR_CACHE;
2b9d6589
BP
519 }
520
c3827f61 521 if (!config.daddr) {
2b9d6589 522 VLOG_WARN("%s: %s type requires valid 'remote_ip' argument",
c3827f61 523 name, type);
2b9d6589
BP
524 return EINVAL;
525 }
526
c3827f61
BP
527 BUILD_ASSERT(sizeof config <= VPORT_CONFIG_SIZE);
528 memcpy(configp, &config, sizeof config);
2b9d6589
BP
529 return 0;
530}
531
532static int
c3827f61
BP
533parse_patch_config(const struct netdev_dev *dev, const struct shash *args,
534 void *configp)
2b9d6589 535{
c3827f61 536 const char *name = netdev_dev_get_name(dev);
2b9d6589
BP
537 const char *peer;
538
539 peer = shash_find_data(args, "peer");
540 if (!peer) {
541 VLOG_WARN("%s: patch type requires valid 'peer' argument", name);
542 return EINVAL;
543 }
544
545 if (shash_count(args) > 1) {
546 VLOG_WARN("%s: patch type takes only a 'peer' argument", name);
547 return EINVAL;
548 }
549
c3827f61 550 if (strlen(peer) >= MIN(IFNAMSIZ, VPORT_CONFIG_SIZE)) {
2b9d6589
BP
551 VLOG_WARN("%s: patch 'peer' arg too long", name);
552 return EINVAL;
553 }
554
555 if (!strcmp(name, peer)) {
556 VLOG_WARN("%s: patch peer must not be self", name);
557 return EINVAL;
558 }
559
c3827f61 560 strncpy(configp, peer, VPORT_CONFIG_SIZE);
2b9d6589
BP
561
562 return 0;
563}
564\f
565#define VPORT_FUNCTIONS \
566 NULL, /* init */ \
567 NULL, /* run */ \
568 NULL, /* wait */ \
569 \
570 netdev_vport_create, \
571 netdev_vport_destroy, \
572 netdev_vport_reconfigure, \
573 \
574 netdev_vport_open, \
575 netdev_vport_close, \
576 \
577 NULL, /* enumerate */ \
578 \
579 NULL, /* recv */ \
580 NULL, /* recv_wait */ \
581 NULL, /* drain */ \
582 \
583 NULL, /* send */ \
584 NULL, /* send_wait */ \
585 \
586 netdev_vport_set_etheraddr, \
587 netdev_vport_get_etheraddr, \
588 netdev_vport_get_mtu, \
589 NULL, /* get_ifindex */ \
85da620e 590 NULL, /* get_carrier */ \
2b9d6589
BP
591 netdev_vport_get_stats, \
592 netdev_vport_set_stats, \
593 \
594 NULL, /* get_features */ \
595 NULL, /* set_advertisements */ \
596 NULL, /* get_vlan_vid */ \
597 \
598 NULL, /* set_policing */ \
599 NULL, /* get_qos_types */ \
600 NULL, /* get_qos_capabilities */ \
601 NULL, /* get_qos */ \
602 NULL, /* set_qos */ \
603 NULL, /* get_queue */ \
604 NULL, /* set_queue */ \
605 NULL, /* delete_queue */ \
606 NULL, /* get_queue_stats */ \
607 NULL, /* dump_queues */ \
608 NULL, /* dump_queue_stats */ \
609 \
610 NULL, /* get_in4 */ \
611 NULL, /* set_in4 */ \
612 NULL, /* get_in6 */ \
613 NULL, /* add_router */ \
614 NULL, /* get_next_hop */ \
615 NULL, /* arp_lookup */ \
616 \
617 netdev_vport_update_flags, \
618 \
619 netdev_vport_poll_add, \
620 netdev_vport_poll_remove,
621
2b9d6589
BP
622void
623netdev_vport_register(void)
624{
c3827f61
BP
625 static const struct vport_class vport_classes[] = {
626 { { "gre", VPORT_FUNCTIONS }, parse_tunnel_config },
627 { { "capwap", VPORT_FUNCTIONS }, parse_tunnel_config },
628 { { "patch", VPORT_FUNCTIONS }, parse_patch_config }
629 };
630
631 int i;
632
633 for (i = 0; i < ARRAY_SIZE(vport_classes); i++) {
634 netdev_register_provider(&vport_classes[i].netdev_class);
635 }
2b9d6589 636}