net/ionic: split up queue-completion queue structure
[dpdk.git] / drivers / net / failsafe / failsafe_ops.c
index 5c606ff..1343777 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <rte_debug.h>
 #include <rte_atomic.h>
-#include <rte_ethdev_driver.h>
+#include <ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_flow.h>
 #include <rte_cycles.h>
@@ -147,7 +147,9 @@ fs_dev_start(struct rte_eth_dev *dev)
                if (ret) {
                        if (!fs_err(sdev, ret))
                                continue;
-                       rte_eth_dev_stop(PORT_ID(sdev));
+                       if (fs_err(sdev, rte_eth_dev_stop(PORT_ID(sdev))) < 0)
+                               ERROR("Failed to stop sub-device %u",
+                                     SUB_ID(sdev));
                        fs_unlock(dev, 0);
                        return ret;
                }
@@ -177,22 +179,32 @@ fs_set_queues_state_stop(struct rte_eth_dev *dev)
                                                RTE_ETH_QUEUE_STATE_STOPPED;
 }
 
-static void
+static int
 fs_dev_stop(struct rte_eth_dev *dev)
 {
        struct sub_device *sdev;
        uint8_t i;
+       int ret;
 
        fs_lock(dev, 0);
        PRIV(dev)->state = DEV_STARTED - 1;
        FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_STARTED) {
-               rte_eth_dev_stop(PORT_ID(sdev));
+               ret = rte_eth_dev_stop(PORT_ID(sdev));
+               if (fs_err(sdev, ret) < 0) {
+                       ERROR("Failed to stop device %u",
+                             PORT_ID(sdev));
+                       PRIV(dev)->state = DEV_STARTED + 1;
+                       fs_unlock(dev, 0);
+                       return ret;
+               }
                failsafe_rx_intr_uninstall_subdevice(sdev);
                sdev->state = DEV_STARTED - 1;
        }
        failsafe_rx_intr_uninstall(dev);
        fs_set_queues_state_stop(dev);
        fs_unlock(dev, 0);
+
+       return 0;
 }
 
 static int
@@ -642,8 +654,13 @@ failsafe_eth_dev_close(struct rte_eth_dev *dev)
 
        fs_lock(dev, 0);
        failsafe_hotplug_alarm_cancel(dev);
-       if (PRIV(dev)->state == DEV_STARTED)
-               dev->dev_ops->dev_stop(dev);
+       if (PRIV(dev)->state == DEV_STARTED) {
+               ret = dev->dev_ops->dev_stop(dev);
+               if (ret != 0) {
+                       fs_unlock(dev, 0);
+                       return ret;
+               }
+       }
        PRIV(dev)->state = DEV_ACTIVE - 1;
        FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
                DEBUG("Closing sub_device %d", i);
@@ -1078,6 +1095,8 @@ static void
 fs_dev_merge_info(struct rte_eth_dev_info *info,
                  const struct rte_eth_dev_info *sinfo)
 {
+       info->min_mtu = RTE_MAX(info->min_mtu, sinfo->min_mtu);
+       info->max_mtu = RTE_MIN(info->max_mtu, sinfo->max_mtu);
        info->max_rx_pktlen = RTE_MIN(info->max_rx_pktlen, sinfo->max_rx_pktlen);
        info->max_rx_queues = RTE_MIN(info->max_rx_queues, sinfo->max_rx_queues);
        info->max_tx_queues = RTE_MIN(info->max_tx_queues, sinfo->max_tx_queues);
@@ -1146,6 +1165,8 @@ fs_dev_infos_get(struct rte_eth_dev *dev,
        int ret;
 
        /* Use maximum upper bounds by default */
+       infos->min_mtu = RTE_ETHER_MIN_MTU;
+       infos->max_mtu = UINT16_MAX;
        infos->max_rx_pktlen = UINT32_MAX;
        infos->max_rx_queues = RTE_MAX_QUEUES_PER_PORT;
        infos->max_tx_queues = RTE_MAX_QUEUES_PER_PORT;
@@ -1175,7 +1196,8 @@ fs_dev_infos_get(struct rte_eth_dev *dev,
                DEV_RX_OFFLOAD_JUMBO_FRAME |
                DEV_RX_OFFLOAD_SCATTER |
                DEV_RX_OFFLOAD_TIMESTAMP |
-               DEV_RX_OFFLOAD_SECURITY;
+               DEV_RX_OFFLOAD_SECURITY |
+               DEV_RX_OFFLOAD_RSS_HASH;
 
        infos->rx_queue_offload_capa =
                DEV_RX_OFFLOAD_VLAN_STRIP |
@@ -1192,7 +1214,8 @@ fs_dev_infos_get(struct rte_eth_dev *dev,
                DEV_RX_OFFLOAD_JUMBO_FRAME |
                DEV_RX_OFFLOAD_SCATTER |
                DEV_RX_OFFLOAD_TIMESTAMP |
-               DEV_RX_OFFLOAD_SECURITY;
+               DEV_RX_OFFLOAD_SECURITY |
+               DEV_RX_OFFLOAD_RSS_HASH;
 
        infos->tx_offload_capa =
                DEV_TX_OFFLOAD_MULTI_SEGS |