netmap.c (cebea510579ed43724156cc596a8ff14ba208740) netmap.c (f394b2e20d9a666fb194fb692179a0eeaca5daea)
1/*
2 * netmap access for qemu
3 *
4 * Copyright (c) 2012-2013 Luigi Rizzo
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 386 unchanged lines hidden (view full) ---

395 * enables the offloadings. */
396 if (!s->vnet_hdr_len) {
397 netmap_set_vnet_hdr_len(nc, sizeof(struct virtio_net_hdr));
398 }
399}
400
401/* NetClientInfo methods */
402static NetClientInfo net_netmap_info = {
1/*
2 * netmap access for qemu
3 *
4 * Copyright (c) 2012-2013 Luigi Rizzo
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 386 unchanged lines hidden (view full) ---

395 * enables the offloadings. */
396 if (!s->vnet_hdr_len) {
397 netmap_set_vnet_hdr_len(nc, sizeof(struct virtio_net_hdr));
398 }
399}
400
401/* NetClientInfo methods */
402static NetClientInfo net_netmap_info = {
403 .type = NET_CLIENT_OPTIONS_KIND_NETMAP,
403 .type = NET_CLIENT_DRIVER_NETMAP,
404 .size = sizeof(NetmapState),
405 .receive = netmap_receive,
406 .receive_iov = netmap_receive_iov,
407 .poll = netmap_poll,
408 .cleanup = netmap_cleanup,
409 .has_ufo = netmap_has_vnet_hdr,
410 .has_vnet_hdr = netmap_has_vnet_hdr,
411 .has_vnet_hdr_len = netmap_has_vnet_hdr_len,

--- 4 unchanged lines hidden (view full) ---

416
417/* The exported init function
418 *
419 * ... -net netmap,ifname="..."
420 */
421int net_init_netmap(const Netdev *netdev,
422 const char *name, NetClientState *peer, Error **errp)
423{
404 .size = sizeof(NetmapState),
405 .receive = netmap_receive,
406 .receive_iov = netmap_receive_iov,
407 .poll = netmap_poll,
408 .cleanup = netmap_cleanup,
409 .has_ufo = netmap_has_vnet_hdr,
410 .has_vnet_hdr = netmap_has_vnet_hdr,
411 .has_vnet_hdr_len = netmap_has_vnet_hdr_len,

--- 4 unchanged lines hidden (view full) ---

416
417/* The exported init function
418 *
419 * ... -net netmap,ifname="..."
420 */
421int net_init_netmap(const Netdev *netdev,
422 const char *name, NetClientState *peer, Error **errp)
423{
424 const NetdevNetmapOptions *netmap_opts = netdev->opts->u.netmap.data;
424 const NetdevNetmapOptions *netmap_opts = &netdev->u.netmap;
425 struct nm_desc *nmd;
426 NetClientState *nc;
427 Error *err = NULL;
428 NetmapState *s;
429
430 nmd = netmap_open(netmap_opts, &err);
431 if (err) {
432 error_propagate(errp, err);

--- 15 unchanged lines hidden ---
425 struct nm_desc *nmd;
426 NetClientState *nc;
427 Error *err = NULL;
428 NetmapState *s;
429
430 nmd = netmap_open(netmap_opts, &err);
431 if (err) {
432 error_propagate(errp, err);

--- 15 unchanged lines hidden ---