New upstream version 17.11.5
[deb_dpdk.git] / drivers / net / tap / rte_eth_tap.c
index 6b27679..466624a 100644 (file)
@@ -60,7 +60,6 @@
 #include <net/if.h>
 #include <linux/if_tun.h>
 #include <linux/if_ether.h>
-#include <linux/version.h>
 #include <fcntl.h>
 
 #include <rte_eth_tap.h>
@@ -78,9 +77,6 @@
 #define ETH_TAP_MAC_ARG         "mac"
 #define ETH_TAP_MAC_FIXED       "fixed"
 
-#define FLOWER_KERNEL_VERSION KERNEL_VERSION(4, 2, 0)
-#define FLOWER_VLAN_KERNEL_VERSION KERNEL_VERSION(4, 9, 0)
-
 static struct rte_vdev_driver pmd_tap_drv;
 
 static const char *valid_arguments[] = {
@@ -99,7 +95,7 @@ static struct rte_eth_link pmd_link = {
        .link_speed = ETH_SPEED_NUM_10G,
        .link_duplex = ETH_LINK_FULL_DUPLEX,
        .link_status = ETH_LINK_DOWN,
-       .link_autoneg = ETH_LINK_SPEED_AUTONEG
+       .link_autoneg = ETH_LINK_FIXED,
 };
 
 static void
@@ -226,7 +222,7 @@ tun_alloc(struct pmd_internals *pmd)
        return fd;
 
 error:
-       if (fd > 0)
+       if (fd >= 0)
                close(fd);
        return -1;
 }
@@ -548,7 +544,9 @@ apply:
        case SIOCSIFMTU:
                break;
        default:
-               RTE_ASSERT(!"unsupported request type: must not happen");
+               RTE_LOG(WARNING, PMD, "%s: ioctl() called with wrong arg\n",
+                       pmd->name);
+               return -EINVAL;
        }
        if (ioctl(pmd->ioctl_sock, request, ifr) < 0)
                goto error;
@@ -1244,13 +1242,13 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,
        data = rte_zmalloc_socket(tap_name, sizeof(*data), 0, numa_node);
        if (!data) {
                RTE_LOG(ERR, PMD, "TAP Failed to allocate data\n");
-               goto error_exit;
+               goto error_exit_nodev;
        }
 
        dev = rte_eth_vdev_allocate(vdev, sizeof(*pmd));
        if (!dev) {
                RTE_LOG(ERR, PMD, "TAP Unable to allocate device struct\n");
-               goto error_exit;
+               goto error_exit_nodev;
        }
 
        pmd = dev->data->dev_private;
@@ -1420,6 +1418,11 @@ error_remote:
        tap_flow_implicit_flush(pmd, NULL);
 
 error_exit:
+       if (pmd->ioctl_sock > 0)
+               close(pmd->ioctl_sock);
+       rte_eth_dev_release_port(dev);
+
+error_exit_nodev:
        RTE_LOG(ERR, PMD, "TAP Unable to initialize %s\n",
                rte_vdev_device_name(vdev));